emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/accurate-warning-pos 8a23e87 1/2: Merge branch 'ma


From: Alan Mackenzie
Subject: [Emacs-diffs] scratch/accurate-warning-pos 8a23e87 1/2: Merge branch 'master' into scratch/accurate-warning-pos
Date: Fri, 5 Apr 2019 08:22:33 -0400 (EDT)

branch: scratch/accurate-warning-pos
commit 8a23e8717008d31b4648c999c7a417f4729d239f
Merge: 2e04dda b619777
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    Merge branch 'master' into scratch/accurate-warning-pos
---
 .dir-locals.el                                     |   14 +-
 .gitattributes                                     |    2 +-
 .gitignore                                         |   11 +-
 .gitlab-ci.yml                                     |   34 +-
 CONTRIBUTE                                         |   31 +-
 ChangeLog.1                                        |    2 +-
 ChangeLog.2                                        |    2 +-
 ChangeLog.3                                        | 3793 +++++++++++++-
 GNUmakefile                                        |    2 +-
 INSTALL                                            |    8 +-
 INSTALL.REPO                                       |    2 +-
 Makefile.in                                        |   11 +-
 README                                             |    2 +-
 admin/CPP-DEFINES                                  |    2 -
 admin/ChangeLog.1                                  |    2 +-
 admin/README                                       |    2 +-
 admin/admin.el                                     |    6 +-
 admin/alloc-colors.c                               |    2 +-
 admin/authors.el                                   |    2 +-
 admin/automerge                                    |    2 +-
 admin/build-configs                                |    2 +-
 admin/charsets/Makefile.in                         |    2 +-
 admin/charsets/mapconv                             |    2 +-
 admin/charsets/mapfiles/README                     |    2 +-
 admin/cus-test.el                                  |    2 +-
 admin/diff-tar-files                               |    2 +-
 admin/find-gc.el                                   |    2 +-
 admin/gitmerge.el                                  |    6 +-
 admin/grammars/Makefile.in                         |    2 +-
 admin/grammars/c.by                                |    2 +-
 admin/grammars/grammar.wy                          |    2 +-
 admin/grammars/java-tags.wy                        |    2 +-
 admin/grammars/js.wy                               |    2 +-
 admin/grammars/make.by                             |    2 +-
 admin/grammars/python.wy                           |    2 +-
 admin/grammars/scheme.by                           |    2 +-
 admin/grammars/srecode-template.wy                 |    2 +-
 admin/last-chance.el                               |    2 +-
 admin/make-emacs                                   |    2 +-
 admin/make-manuals                                 |    2 +-
 admin/merge-gnulib                                 |    6 +-
 admin/merge-pkg-config                             |    2 +-
 admin/notes/bugtracker                             |   22 +-
 admin/notes/copyright                              |    5 +-
 admin/notes/emba                                   |   64 +
 admin/notes/font-backend                           |    2 +-
 admin/notes/hydra                                  |    6 +-
 admin/notes/multi-tty                              |    8 +-
 admin/notes/unicode                                |   55 +-
 admin/notes/www                                    |    2 +-
 admin/nt/README-UNDUMP.W32                         |    2 +-
 admin/nt/README-ftp-server                         |    2 +-
 admin/nt/dist-build/build-dep-zips.py              |    2 +-
 admin/nt/dist-build/build-zips.sh                  |    2 +-
 admin/quick-install-emacs                          |    2 +-
 admin/unidata/BidiBrackets.txt                     |    4 +-
 admin/unidata/BidiMirroring.txt                    |    6 +-
 admin/unidata/Blocks.txt                           |   15 +-
 admin/unidata/Makefile.in                          |    2 +-
 admin/unidata/NormalizationTest.txt                |   33 +-
 admin/unidata/SpecialCasing.txt                    |    6 +-
 admin/unidata/UnicodeData.txt                      |  564 +-
 admin/unidata/blocks.awk                           |    7 +-
 admin/unidata/copyright.html                       |  209 +-
 admin/unidata/unidata-gen.el                       |    4 +-
 admin/unidata/uvs.el                               |    5 +-
 admin/update-copyright                             |    2 +-
 admin/update_autogen                               |    2 +-
 admin/upload-manuals                               |    2 +-
 autogen.sh                                         |    2 +-
 build-aux/config.guess                             |  205 +-
 build-aux/config.sub                               |   41 +-
 build-aux/git-hooks/commit-msg                     |    2 +-
 build-aux/git-hooks/pre-commit                     |    2 +-
 build-aux/gitlog-to-changelog                      |    2 +-
 build-aux/gitlog-to-emacslog                       |    2 +-
 build-aux/make-info-dir                            |    2 +-
 build-aux/move-if-change                           |    5 +-
 build-aux/msys-to-w32                              |    2 +-
 build-aux/update-copyright                         |    2 +-
 build-aux/update-subdirs                           |    2 +-
 config.bat                                         |    2 +-
 configure.ac                                       |  310 +-
 doc/emacs/ChangeLog.1                              |    4 +-
 doc/emacs/Makefile.in                              |    2 +-
 doc/emacs/abbrevs.texi                             |    2 +-
 doc/emacs/ack.texi                                 |    6 +-
 doc/emacs/anti.texi                                |    2 +-
 doc/emacs/arevert-xtra.texi                        |    2 +-
 doc/emacs/basic.texi                               |    2 +-
 doc/emacs/buffers.texi                             |    2 +-
 doc/emacs/building.texi                            |   17 +-
 doc/emacs/cal-xtra.texi                            |    2 +-
 doc/emacs/calendar.texi                            |    2 +-
 doc/emacs/cmdargs.texi                             |   36 +-
 doc/emacs/commands.texi                            |    2 +-
 doc/emacs/custom.texi                              |   96 +-
 doc/emacs/dired-xtra.texi                          |    2 +-
 doc/emacs/dired.texi                               |   12 +-
 doc/emacs/display.texi                             |    2 +-
 doc/emacs/emacs-xtra.texi                          |    2 +-
 doc/emacs/emacs.texi                               |    5 +-
 doc/emacs/emerge-xtra.texi                         |    2 +-
 doc/emacs/entering.texi                            |    2 +-
 doc/emacs/files.texi                               |  135 +-
 doc/emacs/fixit.texi                               |    2 +-
 doc/emacs/fortran-xtra.texi                        |    2 +-
 doc/emacs/frames.texi                              |   12 +-
 doc/emacs/glossary.texi                            |    2 +-
 doc/emacs/gnu.texi                                 |    2 +-
 doc/emacs/help.texi                                |    2 +-
 doc/emacs/indent.texi                              |    6 +-
 doc/emacs/killing.texi                             |    2 +-
 doc/emacs/kmacro.texi                              |   21 +-
 doc/emacs/m-x.texi                                 |    2 +-
 doc/emacs/macos.texi                               |   23 +-
 doc/emacs/maintaining.texi                         |   21 +-
 doc/emacs/mark.texi                                |    2 +-
 doc/emacs/mini.texi                                |    2 +-
 doc/emacs/misc.texi                                |   35 +-
 doc/emacs/modes.texi                               |    2 +-
 doc/emacs/msdos-xtra.texi                          |    2 +-
 doc/emacs/msdos.texi                               |    2 +-
 doc/emacs/mule.texi                                |    4 +-
 doc/emacs/package.texi                             |    2 +-
 doc/emacs/picture-xtra.texi                        |    2 +-
 doc/emacs/programs.texi                            |    2 +-
 doc/emacs/regs.texi                                |    2 +-
 doc/emacs/rmail.texi                               |    4 +-
 doc/emacs/screen.texi                              |    2 +-
 doc/emacs/search.texi                              |   31 +-
 doc/emacs/sending.texi                             |    2 +-
 doc/emacs/text.texi                                |    2 +-
 doc/emacs/trouble.texi                             |    2 +-
 doc/emacs/vc-xtra.texi                             |    2 +-
 doc/emacs/vc1-xtra.texi                            |    2 +-
 doc/emacs/windows.texi                             |  138 +-
 doc/emacs/xresources.texi                          |    2 +-
 doc/lispintro/ChangeLog.1                          |    2 +-
 doc/lispintro/Makefile.in                          |    2 +-
 doc/lispintro/README                               |    2 +-
 doc/lispintro/cons-1.eps                           |    2 +-
 doc/lispintro/cons-2.eps                           |    2 +-
 doc/lispintro/cons-2a.eps                          |    2 +-
 doc/lispintro/cons-3.eps                           |    2 +-
 doc/lispintro/cons-4.eps                           |    2 +-
 doc/lispintro/cons-5.eps                           |    2 +-
 doc/lispintro/drawers.eps                          |    2 +-
 doc/lispintro/emacs-lisp-intro.texi                |    8 +-
 doc/lispintro/lambda-1.eps                         |    2 +-
 doc/lispintro/lambda-2.eps                         |    2 +-
 doc/lispintro/lambda-3.eps                         |    2 +-
 doc/lispref/ChangeLog.1                            |    2 +-
 doc/lispref/Makefile.in                            |    2 +-
 doc/lispref/README                                 |    2 +-
 doc/lispref/abbrevs.texi                           |    4 +-
 doc/lispref/anti.texi                              |    2 +-
 doc/lispref/back.texi                              |    2 +-
 doc/lispref/backups.texi                           |    2 +-
 doc/lispref/buffers.texi                           |   10 +-
 doc/lispref/commands.texi                          |   13 +-
 doc/lispref/compile.texi                           |    2 +-
 doc/lispref/control.texi                           |  224 +-
 doc/lispref/customize.texi                         |    2 +-
 doc/lispref/debugging.texi                         |    2 +-
 doc/lispref/display.texi                           |  122 +-
 doc/lispref/edebug.texi                            |    2 +-
 doc/lispref/elisp.texi                             |   18 +-
 doc/lispref/errors.texi                            |    2 +-
 doc/lispref/eval.texi                              |   11 +-
 doc/lispref/files.texi                             |   64 +-
 doc/lispref/frames.texi                            |   45 +-
 doc/lispref/functions.texi                         |   11 +-
 doc/lispref/hash.texi                              |    2 +-
 doc/lispref/help.texi                              |    2 +-
 doc/lispref/hooks.texi                             |    2 +-
 doc/lispref/internals.texi                         |  336 +-
 doc/lispref/intro.texi                             |   14 +-
 doc/lispref/keymaps.texi                           |   13 +-
 doc/lispref/lay-flat.texi                          |    2 +-
 doc/lispref/lists.texi                             |   18 +-
 doc/lispref/loading.texi                           |    2 +-
 doc/lispref/macros.texi                            |    2 +-
 doc/lispref/maps.texi                              |    2 +-
 doc/lispref/markers.texi                           |    2 +-
 doc/lispref/minibuf.texi                           |   60 +-
 doc/lispref/modes.texi                             |  123 +-
 doc/lispref/nonascii.texi                          |   30 +-
 doc/lispref/numbers.texi                           |   10 +-
 doc/lispref/objects.texi                           |    2 +-
 doc/lispref/os.texi                                |   45 +-
 doc/lispref/package.texi                           |   35 +-
 doc/lispref/positions.texi                         |    2 +-
 doc/lispref/processes.texi                         |  102 +-
 doc/lispref/records.texi                           |    2 +-
 doc/lispref/searching.texi                         |   34 +-
 doc/lispref/sequences.texi                         |   36 +-
 doc/lispref/streams.texi                           |    2 +-
 doc/lispref/strings.texi                           |    2 +-
 doc/lispref/symbols.texi                           |    2 +-
 doc/lispref/syntax.texi                            |   17 +-
 doc/lispref/text.texi                              |   89 +-
 doc/lispref/threads.texi                           |    8 +-
 doc/lispref/tips.texi                              |   17 +-
 doc/lispref/two-volume-cross-refs.txt              |    2 +-
 doc/lispref/two-volume.make                        |    2 +-
 doc/lispref/variables.texi                         |   19 +-
 doc/lispref/windows.texi                           | 1949 +++++--
 doc/man/ChangeLog.1                                |    2 +-
 doc/man/ebrowse.1                                  |    2 +-
 doc/man/emacs.1.in                                 |    6 +-
 doc/man/etags.1                                    |    2 +-
 doc/misc/ChangeLog.1                               |    2 +-
 doc/misc/Makefile.in                               |    2 +-
 doc/misc/ada-mode.texi                             |    2 +-
 doc/misc/auth.texi                                 |   13 +-
 doc/misc/autotype.texi                             |    2 +-
 doc/misc/bovine.texi                               |    2 +-
 doc/misc/calc.texi                                 |    6 +-
 doc/misc/cc-mode.texi                              |  155 +-
 doc/misc/cl.texi                                   |    2 +-
 doc/misc/dbus.texi                                 |    4 +-
 doc/misc/dired-x.texi                              |    2 +-
 doc/misc/ebrowse.texi                              |    2 +-
 doc/misc/ede.texi                                  |   18 +-
 doc/misc/ediff.texi                                |   17 +-
 doc/misc/edt.texi                                  |    2 +-
 doc/misc/efaq-w32.texi                             |    2 +-
 doc/misc/efaq.texi                                 |   17 +-
 doc/misc/eieio.texi                                |    2 +-
 doc/misc/emacs-gnutls.texi                         |   40 +-
 doc/misc/emacs-mime.texi                           |   68 +-
 doc/misc/epa.texi                                  |    2 +-
 doc/misc/erc.texi                                  |    2 +-
 doc/misc/ert.texi                                  |    2 +-
 doc/misc/eshell.texi                               |   32 +-
 doc/misc/eudc.texi                                 |    2 +-
 doc/misc/eww.texi                                  |   15 +-
 doc/misc/flymake.texi                              |    2 +-
 doc/misc/forms.texi                                |    2 +-
 doc/misc/gnus-coding.texi                          |  159 +-
 doc/misc/gnus-faq.texi                             |    4 +-
 doc/misc/gnus-news.el                              |  115 -
 doc/misc/gnus-news.texi                            |  371 --
 doc/misc/gnus-overrides.texi                       |    0
 doc/misc/gnus.texi                                 |  408 +-
 doc/misc/htmlfontify.texi                          |    2 +-
 doc/misc/idlwave.texi                              |    2 +-
 doc/misc/ido.texi                                  |    2 +-
 doc/misc/info.texi                                 |    2 +-
 doc/misc/mairix-el.texi                            |    2 +-
 doc/misc/message.texi                              |    4 +-
 doc/misc/mh-e.texi                                 |    2 +-
 doc/misc/newsticker.texi                           |    2 +-
 doc/misc/nxml-mode.texi                            |    2 +-
 doc/misc/octave-mode.texi                          |    2 +-
 doc/misc/org.texi                                  |    6 +-
 doc/misc/pcl-cvs.texi                              |    2 +-
 doc/misc/pgg.texi                                  |    4 +-
 doc/misc/rcirc.texi                                |    2 +-
 doc/misc/reftex.texi                               |    2 +-
 doc/misc/remember.texi                             |    2 +-
 doc/misc/sasl.texi                                 |    4 +-
 doc/misc/sc.texi                                   |    5 +-
 doc/misc/sem-user.texi                             |    2 +-
 doc/misc/semantic.texi                             |    2 +-
 doc/misc/ses.texi                                  |    2 +-
 doc/misc/sieve.texi                                |    4 +-
 doc/misc/smtpmail.texi                             |    2 +-
 doc/misc/speedbar.texi                             |    2 +-
 doc/misc/srecode.texi                              |    2 +-
 doc/misc/texinfo.tex                               |  904 ++--
 doc/misc/todo-mode.texi                            |    2 +-
 doc/misc/tramp.texi                                |  300 +-
 doc/misc/trampver.texi                             |    4 +-
 doc/misc/url.texi                                  |    2 +-
 doc/misc/vhdl-mode.texi                            |    2 +-
 doc/misc/vip.texi                                  |    2 +-
 doc/misc/viper.texi                                |    2 +-
 doc/misc/widget.texi                               |    2 +-
 doc/misc/wisent.texi                               |    2 +-
 doc/misc/woman.texi                                |    2 +-
 etc/AUTHORS                                        |  286 +-
 etc/CALC-NEWS                                      |   13 +-
 etc/CENSORSHIP                                     |    8 -
 etc/ChangeLog.1                                    |    2 +-
 etc/DEBUG                                          |    4 +-
 etc/DISTRIB                                        |    2 +-
 etc/ERC-NEWS                                       |    2 +-
 etc/ETAGS.EBNF                                     |    2 +-
 etc/ETAGS.README                                   |    2 +-
 etc/FTP                                            |    9 -
 etc/GNU                                            |    8 -
 etc/GNUS-NEWS                                      |  316 --
 etc/HELLO                                          |   10 +-
 etc/LINUX-GNU                                      |    8 -
 etc/MACHINES                                       |    2 +-
 etc/MH-E-NEWS                                      |    2 +-
 etc/MORE.STUFF                                     |    8 -
 etc/NEWS                                           |  829 ++-
 etc/NEWS.1-17                                      |    4 +-
 etc/NEWS.18                                        |    4 +-
 etc/NEWS.19                                        |    4 +-
 etc/NEWS.20                                        |    4 +-
 etc/NEWS.21                                        |    4 +-
 etc/NEWS.22                                        |    2 +-
 etc/NEWS.23                                        |    2 +-
 etc/NEWS.24                                        |    2 +-
 etc/NEWS.25                                        |    2 +-
 etc/NEWS.26                                        |   64 +-
 etc/NEXTSTEP                                       |    2 +-
 etc/NXML-NEWS                                      |    2 +-
 etc/ORDERS                                         |    8 -
 etc/ORG-NEWS                                       |    2 +-
 etc/PROBLEMS                                       |    8 +-
 etc/README                                         |    2 +-
 etc/TERMS                                          |    2 +-
 etc/THE-GNU-PROJECT                                |    8 -
 etc/TODO                                           |    2 +-
 etc/WHY-FREE                                       |    8 -
 etc/charsets/README                                |    2 +-
 etc/compilation.txt                                |    2 +-
 etc/edt-user.el                                    |    2 +-
 etc/emacs-buffer.gdb                               |    2 +-
 etc/emacs.appdata.xml                              |    2 +-
 etc/enriched.txt                                   |    2 +-
 etc/forms/forms-d2.el                              |    2 +-
 etc/gnus-tut.txt                                   |    2 +-
 etc/grep.txt                                       |    2 +-
 etc/images/README                                  |    8 +-
 etc/images/checked.xpm                             |    2 +-
 etc/images/custom/README                           |    2 +-
 etc/images/ezimage/README                          |    2 +-
 etc/images/gnus/README                             |    6 +-
 etc/images/gnus/gnus.svg                           |    2 +-
 etc/images/gud/README                              |    6 +-
 etc/images/icons/README                            |    8 +-
 etc/images/icons/hicolor/scalable/apps/emacs.svg   |    2 +-
 etc/images/icons/hicolor/scalable/apps/emacs23.svg |    2 +-
 .../scalable/mimetypes/emacs-document23.svg        |    2 +-
 etc/images/mh-logo.xpm                             |    2 +-
 etc/images/mpc/README                              |    2 +-
 etc/images/newsticker/README                       |    2 +-
 etc/images/smilies/README                          |    2 +-
 etc/images/smilies/grayscale/README                |    2 +-
 etc/images/smilies/medium/README                   |    2 +-
 etc/images/splash.svg                              |    2 +-
 etc/images/tree-widget/default/README              |    2 +-
 etc/images/tree-widget/folder/README               |    2 +-
 etc/images/unchecked.xpm                           |    2 +-
 etc/org/README                                     |    2 +-
 etc/ps-prin0.ps                                    |    2 +-
 etc/ps-prin1.ps                                    |    2 +-
 etc/refcards/Makefile                              |    2 +-
 etc/refcards/README                                |    4 +-
 etc/refcards/calccard.tex                          |    2 +-
 etc/refcards/cs-dired-ref.tex                      |    2 +-
 etc/refcards/cs-refcard.tex                        |    2 +-
 etc/refcards/cs-survival.tex                       |    2 +-
 etc/refcards/de-refcard.tex                        |    2 +-
 etc/refcards/dired-ref.tex                         |    2 +-
 etc/refcards/emacsver.tex.in                       |    2 +-
 etc/refcards/fr-dired-ref.tex                      |    2 +-
 etc/refcards/fr-refcard.tex                        |    2 +-
 etc/refcards/fr-survival.tex                       |    2 +-
 etc/refcards/gnus-logo.eps                         |    2 +-
 etc/refcards/gnus-refcard.tex                      |    2 +-
 etc/refcards/orgcard.tex                           |    2 +-
 etc/refcards/pdflayout.sty                         |    2 +-
 etc/refcards/pl-refcard.tex                        |    2 +-
 etc/refcards/pt-br-refcard.tex                     |    2 +-
 etc/refcards/refcard.tex                           |    2 +-
 etc/refcards/ru-refcard.tex                        |    4 +-
 etc/refcards/sk-dired-ref.tex                      |    2 +-
 etc/refcards/sk-refcard.tex                        |    2 +-
 etc/refcards/sk-survival.tex                       |    2 +-
 etc/refcards/survival.tex                          |    2 +-
 etc/refcards/vipcard.tex                           |    2 +-
 etc/refcards/viperCard.tex                         |    2 +-
 etc/schema/locate.rnc                              |    2 +-
 etc/schema/relaxng.rnc                             |    2 +-
 etc/schema/schemas.xml                             |    2 +-
 etc/ses-example.ses                                |    2 +-
 etc/srecode/c.srt                                  |    2 +-
 etc/srecode/cpp.srt                                |    2 +-
 etc/srecode/default.srt                            |    2 +-
 etc/srecode/doc-cpp.srt                            |    2 +-
 etc/srecode/doc-default.srt                        |    2 +-
 etc/srecode/doc-java.srt                           |    2 +-
 etc/srecode/ede-autoconf.srt                       |    2 +-
 etc/srecode/ede-make.srt                           |    2 +-
 etc/srecode/el.srt                                 |    2 +-
 etc/srecode/getset-cpp.srt                         |    2 +-
 etc/srecode/java.srt                               |    2 +-
 etc/srecode/make.srt                               |    2 +-
 etc/srecode/template.srt                           |    2 +-
 etc/srecode/test.srt                               |    2 +-
 etc/srecode/texi.srt                               |    2 +-
 etc/srecode/wisent.srt                             |    2 +-
 etc/themes/adwaita-theme.el                        |    2 +-
 etc/themes/deeper-blue-theme.el                    |    2 +-
 etc/themes/dichromacy-theme.el                     |    2 +-
 etc/themes/leuven-theme.el                         |    2 +-
 etc/themes/light-blue-theme.el                     |    2 +-
 etc/themes/manoj-dark-theme.el                     |    2 +-
 etc/themes/misterioso-theme.el                     |    2 +-
 etc/themes/tango-dark-theme.el                     |    2 +-
 etc/themes/tango-theme.el                          |    2 +-
 etc/themes/tsdh-dark-theme.el                      |    2 +-
 etc/themes/tsdh-light-theme.el                     |    2 +-
 etc/themes/wheatgrass-theme.el                     |    2 +-
 etc/themes/whiteboard-theme.el                     |    2 +-
 etc/themes/wombat-theme.el                         |    2 +-
 etc/tutorials/TUTORIAL                             |    4 +-
 etc/tutorials/TUTORIAL.bg                          |    2 +-
 etc/tutorials/TUTORIAL.cn                          |    4 +-
 etc/tutorials/TUTORIAL.cs                          |    2 +-
 etc/tutorials/TUTORIAL.de                          |    2 +-
 etc/tutorials/TUTORIAL.eo                          |    2 +-
 etc/tutorials/TUTORIAL.es                          |    2 +-
 etc/tutorials/TUTORIAL.fr                          |    2 +-
 etc/tutorials/TUTORIAL.he                          |    2 +-
 etc/tutorials/TUTORIAL.it                          |    2 +-
 etc/tutorials/TUTORIAL.ja                          |    2 +-
 etc/tutorials/TUTORIAL.ko                          |    2 +-
 etc/tutorials/TUTORIAL.nl                          |    4 +-
 etc/tutorials/TUTORIAL.pl                          |    2 +-
 etc/tutorials/TUTORIAL.pt_BR                       |    2 +-
 etc/tutorials/TUTORIAL.ro                          |    4 +-
 etc/tutorials/TUTORIAL.ru                          |    2 +-
 etc/tutorials/TUTORIAL.sk                          |    2 +-
 etc/tutorials/TUTORIAL.sl                          |    2 +-
 etc/tutorials/TUTORIAL.sv                          |    2 +-
 etc/tutorials/TUTORIAL.th                          |    2 +-
 etc/tutorials/TUTORIAL.zh                          |    2 +-
 leim/ChangeLog.1                                   |    2 +-
 leim/Makefile.in                                   |    8 +-
 leim/README                                        |    2 +-
 leim/leim-ext.el                                   |    2 +-
 lib-src/ChangeLog.1                                |    2 +-
 lib-src/Makefile.in                                |   13 +-
 lib-src/ebrowse.c                                  |   70 +-
 lib-src/emacsclient.c                              | 1272 ++---
 lib-src/etags.c                                    |    2 +-
 lib-src/hexl.c                                     |    2 +-
 lib-src/make-docfile.c                             |    7 +-
 lib-src/make-fingerprint.c                         |  113 +
 lib-src/movemail.c                                 |    2 +-
 lib-src/ntlib.c                                    |    2 +-
 lib-src/ntlib.h                                    |    2 +-
 lib-src/pop.c                                      |    2 +-
 lib-src/pop.h                                      |    2 +-
 lib-src/profile.c                                  |    2 +-
 lib-src/rcs2log                                    |    4 +-
 lib-src/update-game-score.c                        |    2 +-
 lib/Makefile.in                                    |    2 +-
 lib/_Noreturn.h                                    |   15 +-
 lib/acl-errno-valid.c                              |    2 +-
 lib/acl-internal.c                                 |    2 +-
 lib/acl-internal.h                                 |    2 +-
 lib/acl.h                                          |    2 +-
 lib/acl_entries.c                                  |    2 +-
 lib/alloca.in.h                                    |    8 +-
 lib/allocator.h                                    |    2 +-
 lib/arg-nonnull.h                                  |    2 +-
 lib/at-func.c                                      |    2 +-
 lib/binary-io.c                                    |    2 +-
 lib/binary-io.h                                    |    2 +-
 lib/byteswap.in.h                                  |    2 +-
 lib/c++defs.h                                      |    2 +-
 lib/c-ctype.h                                      |    2 +-
 lib/c-strcase.h                                    |    2 +-
 lib/c-strcasecmp.c                                 |    2 +-
 lib/c-strncasecmp.c                                |    2 +-
 lib/careadlinkat.c                                 |    2 +-
 lib/careadlinkat.h                                 |    2 +-
 lib/cdefs.h                                        |    6 +-
 lib/cloexec.c                                      |    2 +-
 lib/cloexec.h                                      |    2 +-
 lib/close-stream.c                                 |    2 +-
 lib/count-leading-zeros.h                          |    2 +-
 lib/count-one-bits.h                               |    2 +-
 lib/count-trailing-zeros.h                         |    2 +-
 lib/diffseq.h                                      |    2 +-
 lib/dirent.in.h                                    |    2 +-
 lib/dirfd.c                                        |    2 +-
 lib/dosname.h                                      |    2 +-
 lib/dtotimespec.c                                  |    2 +-
 lib/dup2.c                                         |    2 +-
 lib/errno.in.h                                     |    2 +-
 lib/euidaccess.c                                   |    2 +-
 lib/execinfo.in.h                                  |    2 +-
 lib/explicit_bzero.c                               |    2 +-
 lib/faccessat.c                                    |    2 +-
 lib/fcntl.c                                        |    4 +-
 lib/fcntl.in.h                                     |    2 +-
 lib/fdatasync.c                                    |   27 -
 lib/fdopendir.c                                    |    2 +-
 lib/filemode.c                                     |    2 +-
 lib/filemode.h                                     |    2 +-
 lib/filevercmp.c                                   |    2 +-
 lib/filevercmp.h                                   |    2 +-
 lib/flexmember.h                                   |    2 +-
 lib/fpending.c                                     |    2 +-
 lib/fpending.h                                     |    2 +-
 lib/fstatat.c                                      |    8 +-
 lib/fsusage.c                                      |   56 +-
 lib/fsusage.h                                      |    2 +-
 lib/fsync.c                                        |    2 +-
 lib/ftoastr.c                                      |    8 +-
 lib/ftoastr.h                                      |    2 +-
 lib/get-permissions.c                              |    2 +-
 lib/getdtablesize.c                                |    2 +-
 lib/getgroups.c                                    |    6 +-
 lib/getloadavg.c                                   |  123 +-
 lib/getopt-cdefs.in.h                              |    2 +-
 lib/getopt-core.h                                  |    2 +-
 lib/getopt-ext.h                                   |    2 +-
 lib/getopt-pfx-core.h                              |    2 +-
 lib/getopt-pfx-ext.h                               |    2 +-
 lib/getopt.c                                       |    2 +-
 lib/getopt.in.h                                    |    2 +-
 lib/getopt1.c                                      |    2 +-
 lib/getopt_int.h                                   |    2 +-
 lib/gettext.h                                      |   15 +-
 lib/gettime.c                                      |    2 +-
 lib/gettimeofday.c                                 |    8 +-
 lib/gnulib.mk.in                                   |   43 +-
 lib/group-member.c                                 |    2 +-
 lib/ieee754.in.h                                   |    2 +-
 lib/ignore-value.h                                 |    2 +-
 lib/intprops.h                                     |    2 +-
 lib/inttypes.in.h                                  |    2 +-
 lib/libc-config.h                                  |    2 +-
 lib/limits.in.h                                    |    2 +-
 lib/localtime-buffer.c                             |    4 +-
 lib/localtime-buffer.h                             |    2 +-
 lib/lstat.c                                        |    8 +-
 lib/md5.c                                          |    2 +-
 lib/md5.h                                          |    2 +-
 lib/memrchr.c                                      |    4 +-
 lib/minmax.h                                       |    2 +-
 lib/mkostemp.c                                     |    2 +-
 lib/mktime-internal.h                              |    2 +-
 lib/mktime.c                                       |  395 +-
 lib/nstrftime.c                                    |  121 +-
 lib/open.c                                         |    2 +-
 lib/openat-priv.h                                  |    2 +-
 lib/openat-proc.c                                  |    2 +-
 lib/openat.h                                       |    2 +-
 lib/pipe2.c                                        |    2 +-
 lib/pselect.c                                      |    2 +-
 lib/pthread_sigmask.c                              |    2 +-
 lib/putenv.c                                       |    2 +-
 lib/qcopy-acl.c                                    |    2 +-
 lib/readlink.c                                     |    2 +-
 lib/readlinkat.c                                   |    2 +-
 lib/regcomp.c                                      |   38 +-
 lib/regex.c                                        |    6 +-
 lib/regex.h                                        |    2 +-
 lib/regex_internal.c                               |    2 +-
 lib/regex_internal.h                               |   24 +-
 lib/regexec.c                                      |   33 +-
 lib/root-uid.h                                     |    2 +-
 lib/save-cwd.c                                     |    2 +-
 lib/save-cwd.h                                     |    2 +-
 lib/set-permissions.c                              |    2 +-
 lib/sha1.c                                         |    2 +-
 lib/sha1.h                                         |    2 +-
 lib/sha256.c                                       |    2 +-
 lib/sha256.h                                       |    2 +-
 lib/sha512.c                                       |    2 +-
 lib/sha512.h                                       |    2 +-
 lib/sig2str.c                                      |    2 +-
 lib/sig2str.h                                      |    2 +-
 lib/signal.in.h                                    |    2 +-
 lib/stat-time.h                                    |    4 +-
 lib/stdalign.in.h                                  |    2 +-
 lib/stddef.in.h                                    |    2 +-
 lib/stdint.in.h                                    |    2 +-
 lib/stdio-impl.h                                   |   11 +-
 lib/stdio.in.h                                     |    9 +-
 lib/stdlib.in.h                                    |   97 +-
 lib/stpcpy.c                                       |    2 +-
 lib/strftime.h                                     |    2 +-
 lib/string.in.h                                    |    2 +-
 lib/strtoimax.c                                    |    2 +-
 lib/strtol.c                                       |    2 +-
 lib/strtoll.c                                      |    2 +-
 lib/symlink.c                                      |    2 +-
 lib/sys_select.in.h                                |    2 +-
 lib/sys_stat.in.h                                  |   11 +-
 lib/sys_time.in.h                                  |    2 +-
 lib/sys_types.in.h                                 |    2 +-
 lib/tempname.c                                     |    2 +-
 lib/tempname.h                                     |    2 +-
 lib/time-internal.h                                |    2 +-
 lib/time.in.h                                      |    4 +-
 lib/time_r.c                                       |    2 +-
 lib/time_rz.c                                      |    2 +-
 lib/timegm.c                                       |    2 +-
 lib/timespec-add.c                                 |    2 +-
 lib/timespec-sub.c                                 |    2 +-
 lib/timespec.h                                     |    2 +-
 lib/u64.h                                          |    2 +-
 lib/unistd.in.h                                    |   15 +-
 lib/unlocked-io.h                                  |    2 +-
 lib/utimens.c                                      |   10 +-
 lib/utimens.h                                      |    2 +-
 lib/verify.h                                       |    8 +-
 lib/vla.h                                          |   28 +-
 lib/warn-on-use.h                                  |    2 +-
 lib/xalloc-oversized.h                             |    2 +-
 lisp/ChangeLog.1                                   |    2 +-
 lisp/ChangeLog.10                                  |    2 +-
 lisp/ChangeLog.11                                  |    2 +-
 lisp/ChangeLog.12                                  |    4 +-
 lisp/ChangeLog.13                                  |    2 +-
 lisp/ChangeLog.14                                  |    2 +-
 lisp/ChangeLog.15                                  |    2 +-
 lisp/ChangeLog.16                                  |    2 +-
 lisp/ChangeLog.17                                  |    2 +-
 lisp/ChangeLog.2                                   |    2 +-
 lisp/ChangeLog.3                                   |    2 +-
 lisp/ChangeLog.4                                   |    2 +-
 lisp/ChangeLog.5                                   |    2 +-
 lisp/ChangeLog.6                                   |    2 +-
 lisp/ChangeLog.7                                   |    4 +-
 lisp/ChangeLog.8                                   |    2 +-
 lisp/ChangeLog.9                                   |    2 +-
 lisp/Makefile.in                                   |   31 +-
 lisp/abbrev.el                                     |   13 +-
 lisp/align.el                                      |   10 +-
 lisp/allout-widgets.el                             |    2 +-
 lisp/allout.el                                     |   15 +-
 lisp/ansi-color.el                                 |    2 +-
 lisp/apropos.el                                    |   12 +-
 lisp/arc-mode.el                                   |   17 +-
 lisp/array.el                                      |    2 +-
 lisp/auth-source-pass.el                           |    8 +-
 lisp/auth-source.el                                |    8 +-
 lisp/autoarg.el                                    |    2 +-
 lisp/autoinsert.el                                 |    2 +-
 lisp/autorevert.el                                 |   73 +-
 lisp/avoid.el                                      |   14 +-
 lisp/battery.el                                    |  118 +-
 lisp/bindings.el                                   |   21 +-
 lisp/bookmark.el                                   |   22 +-
 lisp/bs.el                                         |    6 +-
 lisp/buff-menu.el                                  |   10 +-
 lisp/button.el                                     |    2 +-
 lisp/calc/calc-aent.el                             |    2 +-
 lisp/calc/calc-alg.el                              |  934 ++--
 lisp/calc/calc-arith.el                            |    2 +-
 lisp/calc/calc-bin.el                              |    2 +-
 lisp/calc/calc-comb.el                             |    2 +-
 lisp/calc/calc-cplx.el                             |    2 +-
 lisp/calc/calc-embed.el                            |    2 +-
 lisp/calc/calc-ext.el                              |   91 +-
 lisp/calc/calc-fin.el                              |    2 +-
 lisp/calc/calc-forms.el                            |   29 +-
 lisp/calc/calc-frac.el                             |    2 +-
 lisp/calc/calc-funcs.el                            |    2 +-
 lisp/calc/calc-graph.el                            |   41 +-
 lisp/calc/calc-help.el                             |    4 +-
 lisp/calc/calc-incom.el                            |    2 +-
 lisp/calc/calc-keypd.el                            |    2 +-
 lisp/calc/calc-lang.el                             |    8 +-
 lisp/calc/calc-macs.el                             |    2 +-
 lisp/calc/calc-map.el                              |    2 +-
 lisp/calc/calc-math.el                             |    2 +-
 lisp/calc/calc-menu.el                             |    2 +-
 lisp/calc/calc-misc.el                             |    2 +-
 lisp/calc/calc-mode.el                             |    2 +-
 lisp/calc/calc-mtx.el                              |    2 +-
 lisp/calc/calc-nlfit.el                            |    2 +-
 lisp/calc/calc-poly.el                             |  124 +-
 lisp/calc/calc-prog.el                             |    2 +-
 lisp/calc/calc-rewr.el                             |    2 +-
 lisp/calc/calc-rules.el                            |    2 +-
 lisp/calc/calc-sel.el                              |    2 +-
 lisp/calc/calc-stat.el                             |    2 +-
 lisp/calc/calc-store.el                            |    6 +-
 lisp/calc/calc-stuff.el                            |    2 +-
 lisp/calc/calc-trail.el                            |    2 +-
 lisp/calc/calc-undo.el                             |    2 +-
 lisp/calc/calc-units.el                            |  265 +-
 lisp/calc/calc-vec.el                              |    2 +-
 lisp/calc/calc-yank.el                             |    2 +-
 lisp/calc/calc.el                                  |  171 +-
 lisp/calc/calcalg2.el                              |    2 +-
 lisp/calc/calcalg3.el                              |    2 +-
 lisp/calc/calccomp.el                              |   53 +-
 lisp/calc/calcsel2.el                              |    2 +-
 lisp/calculator.el                                 |    6 +-
 lisp/calendar/appt.el                              |    2 +-
 lisp/calendar/cal-bahai.el                         |    2 +-
 lisp/calendar/cal-china.el                         |    2 +-
 lisp/calendar/cal-coptic.el                        |    2 +-
 lisp/calendar/cal-dst.el                           |   10 +-
 lisp/calendar/cal-french.el                        |    2 +-
 lisp/calendar/cal-hebrew.el                        |    2 +-
 lisp/calendar/cal-html.el                          |    2 +-
 lisp/calendar/cal-islam.el                         |    2 +-
 lisp/calendar/cal-iso.el                           |    2 +-
 lisp/calendar/cal-julian.el                        |    2 +-
 lisp/calendar/cal-mayan.el                         |    2 +-
 lisp/calendar/cal-menu.el                          |    2 +-
 lisp/calendar/cal-move.el                          |    2 +-
 lisp/calendar/cal-persia.el                        |    2 +-
 lisp/calendar/cal-tex.el                           |    6 +-
 lisp/calendar/cal-x.el                             |    2 +-
 lisp/calendar/calendar.el                          |    2 +-
 lisp/calendar/diary-lib.el                         |   18 +-
 lisp/calendar/holidays.el                          |   67 +-
 lisp/calendar/icalendar.el                         |   22 +-
 lisp/calendar/lunar.el                             |    2 +-
 lisp/calendar/parse-time.el                        |    4 +-
 lisp/calendar/solar.el                             |    2 +-
 lisp/calendar/time-date.el                         |   10 +-
 lisp/calendar/timeclock.el                         |   82 +-
 lisp/calendar/todo-mode.el                         |   33 +-
 lisp/case-table.el                                 |    2 +-
 lisp/cdl.el                                        |    2 +-
 lisp/cedet/ChangeLog.1                             |    2 +-
 lisp/cedet/cedet-cscope.el                         |    2 +-
 lisp/cedet/cedet-files.el                          |    2 +-
 lisp/cedet/cedet-global.el                         |    2 +-
 lisp/cedet/cedet-idutils.el                        |    2 +-
 lisp/cedet/cedet.el                                |    2 +-
 lisp/cedet/data-debug.el                           |    8 +-
 lisp/cedet/ede.el                                  |    2 +-
 lisp/cedet/ede/auto.el                             |    2 +-
 lisp/cedet/ede/autoconf-edit.el                    |    2 +-
 lisp/cedet/ede/base.el                             |    2 +-
 lisp/cedet/ede/config.el                           |    2 +-
 lisp/cedet/ede/cpp-root.el                         |    2 +-
 lisp/cedet/ede/custom.el                           |    2 +-
 lisp/cedet/ede/detect.el                           |    4 +-
 lisp/cedet/ede/dired.el                            |    2 +-
 lisp/cedet/ede/emacs.el                            |    2 +-
 lisp/cedet/ede/files.el                            |    2 +-
 lisp/cedet/ede/generic.el                          |    2 +-
 lisp/cedet/ede/linux.el                            |    2 +-
 lisp/cedet/ede/locate.el                           |    2 +-
 lisp/cedet/ede/make.el                             |    2 +-
 lisp/cedet/ede/makefile-edit.el                    |    4 +-
 lisp/cedet/ede/pconf.el                            |    2 +-
 lisp/cedet/ede/pmake.el                            |    2 +-
 lisp/cedet/ede/proj-archive.el                     |    2 +-
 lisp/cedet/ede/proj-aux.el                         |    2 +-
 lisp/cedet/ede/proj-comp.el                        |    2 +-
 lisp/cedet/ede/proj-elisp.el                       |    2 +-
 lisp/cedet/ede/proj-info.el                        |    2 +-
 lisp/cedet/ede/proj-misc.el                        |    2 +-
 lisp/cedet/ede/proj-obj.el                         |    2 +-
 lisp/cedet/ede/proj-prog.el                        |    2 +-
 lisp/cedet/ede/proj-scheme.el                      |    2 +-
 lisp/cedet/ede/proj-shared.el                      |    2 +-
 lisp/cedet/ede/proj.el                             |    2 +-
 lisp/cedet/ede/project-am.el                       |    2 +-
 lisp/cedet/ede/shell.el                            |    2 +-
 lisp/cedet/ede/simple.el                           |    2 +-
 lisp/cedet/ede/source.el                           |    2 +-
 lisp/cedet/ede/speedbar.el                         |    4 +-
 lisp/cedet/ede/srecode.el                          |    2 +-
 lisp/cedet/ede/system.el                           |    2 +-
 lisp/cedet/ede/util.el                             |    2 +-
 lisp/cedet/inversion.el                            |    2 +-
 lisp/cedet/mode-local.el                           |    2 +-
 lisp/cedet/pulse.el                                |    2 +-
 lisp/cedet/semantic.el                             |   18 +-
 lisp/cedet/semantic/analyze.el                     |    2 +-
 lisp/cedet/semantic/analyze/complete.el            |    2 +-
 lisp/cedet/semantic/analyze/debug.el               |   28 +-
 lisp/cedet/semantic/analyze/fcn.el                 |    2 +-
 lisp/cedet/semantic/analyze/refs.el                |    2 +-
 lisp/cedet/semantic/bovine.el                      |    4 +-
 lisp/cedet/semantic/bovine/c.el                    |    2 +-
 lisp/cedet/semantic/bovine/debug.el                |    2 +-
 lisp/cedet/semantic/bovine/el.el                   |    2 +-
 lisp/cedet/semantic/bovine/gcc.el                  |    2 +-
 lisp/cedet/semantic/bovine/grammar.el              |    2 +-
 lisp/cedet/semantic/bovine/make.el                 |    2 +-
 lisp/cedet/semantic/bovine/scm.el                  |    2 +-
 lisp/cedet/semantic/chart.el                       |    2 +-
 lisp/cedet/semantic/complete.el                    |    2 +-
 lisp/cedet/semantic/ctxt.el                        |    2 +-
 lisp/cedet/semantic/db-debug.el                    |    2 +-
 lisp/cedet/semantic/db-ebrowse.el                  |    2 +-
 lisp/cedet/semantic/db-el.el                       |    2 +-
 lisp/cedet/semantic/db-file.el                     |    2 +-
 lisp/cedet/semantic/db-find.el                     |    2 +-
 lisp/cedet/semantic/db-global.el                   |    2 +-
 lisp/cedet/semantic/db-javascript.el               |    2 +-
 lisp/cedet/semantic/db-mode.el                     |    2 +-
 lisp/cedet/semantic/db-ref.el                      |    2 +-
 lisp/cedet/semantic/db-typecache.el                |    2 +-
 lisp/cedet/semantic/db.el                          |    2 +-
 lisp/cedet/semantic/debug.el                       |    2 +-
 lisp/cedet/semantic/decorate.el                    |    2 +-
 lisp/cedet/semantic/decorate/include.el            |    2 +-
 lisp/cedet/semantic/decorate/mode.el               |    2 +-
 lisp/cedet/semantic/dep.el                         |    6 +-
 lisp/cedet/semantic/doc.el                         |    2 +-
 lisp/cedet/semantic/ede-grammar.el                 |    2 +-
 lisp/cedet/semantic/edit.el                        |    2 +-
 lisp/cedet/semantic/find.el                        |    2 +-
 lisp/cedet/semantic/format.el                      |    2 +-
 lisp/cedet/semantic/fw.el                          |    2 +-
 lisp/cedet/semantic/grammar-wy.el                  |    2 +-
 lisp/cedet/semantic/grammar.el                     |    4 +-
 lisp/cedet/semantic/html.el                        |    2 +-
 lisp/cedet/semantic/ia-sb.el                       |    2 +-
 lisp/cedet/semantic/ia.el                          |    2 +-
 lisp/cedet/semantic/idle.el                        |    2 +-
 lisp/cedet/semantic/imenu.el                       |    2 +-
 lisp/cedet/semantic/java.el                        |    2 +-
 lisp/cedet/semantic/lex-spp.el                     |    2 +-
 lisp/cedet/semantic/lex.el                         |    2 +-
 lisp/cedet/semantic/mru-bookmark.el                |    2 +-
 lisp/cedet/semantic/sb.el                          |    6 +-
 lisp/cedet/semantic/scope.el                       |    2 +-
 lisp/cedet/semantic/senator.el                     |    2 +-
 lisp/cedet/semantic/sort.el                        |    2 +-
 lisp/cedet/semantic/symref.el                      |    2 +-
 lisp/cedet/semantic/symref/cscope.el               |    2 +-
 lisp/cedet/semantic/symref/filter.el               |    2 +-
 lisp/cedet/semantic/symref/global.el               |    2 +-
 lisp/cedet/semantic/symref/grep.el                 |    2 +-
 lisp/cedet/semantic/symref/idutils.el              |    2 +-
 lisp/cedet/semantic/symref/list.el                 |    2 +-
 lisp/cedet/semantic/tag-file.el                    |    2 +-
 lisp/cedet/semantic/tag-ls.el                      |    2 +-
 lisp/cedet/semantic/tag-write.el                   |    2 +-
 lisp/cedet/semantic/tag.el                         |    2 +-
 lisp/cedet/semantic/texi.el                        |    2 +-
 lisp/cedet/semantic/util-modes.el                  |    2 +-
 lisp/cedet/semantic/util.el                        |    2 +-
 lisp/cedet/semantic/wisent.el                      |    2 +-
 lisp/cedet/semantic/wisent/comp.el                 |    6 +-
 lisp/cedet/semantic/wisent/grammar.el              |    4 +-
 lisp/cedet/semantic/wisent/java-tags.el            |    2 +-
 lisp/cedet/semantic/wisent/javascript.el           |    2 +-
 lisp/cedet/semantic/wisent/python.el               |    2 +-
 lisp/cedet/semantic/wisent/wisent.el               |    2 +-
 lisp/cedet/srecode.el                              |    2 +-
 lisp/cedet/srecode/args.el                         |    2 +-
 lisp/cedet/srecode/compile.el                      |    2 +-
 lisp/cedet/srecode/cpp.el                          |    2 +-
 lisp/cedet/srecode/ctxt.el                         |    2 +-
 lisp/cedet/srecode/dictionary.el                   |    2 +-
 lisp/cedet/srecode/document.el                     |    2 +-
 lisp/cedet/srecode/el.el                           |    2 +-
 lisp/cedet/srecode/expandproto.el                  |    2 +-
 lisp/cedet/srecode/extract.el                      |    2 +-
 lisp/cedet/srecode/fields.el                       |    2 +-
 lisp/cedet/srecode/filters.el                      |    2 +-
 lisp/cedet/srecode/find.el                         |    2 +-
 lisp/cedet/srecode/getset.el                       |    2 +-
 lisp/cedet/srecode/insert.el                       |    2 +-
 lisp/cedet/srecode/java.el                         |    2 +-
 lisp/cedet/srecode/map.el                          |    2 +-
 lisp/cedet/srecode/mode.el                         |   16 +-
 lisp/cedet/srecode/semantic.el                     |    2 +-
 lisp/cedet/srecode/srt-mode.el                     |    2 +-
 lisp/cedet/srecode/srt.el                          |    2 +-
 lisp/cedet/srecode/table.el                        |    2 +-
 lisp/cedet/srecode/template.el                     |    2 +-
 lisp/cedet/srecode/texi.el                         |    2 +-
 lisp/char-fold.el                                  |    2 +-
 lisp/chistory.el                                   |    2 +-
 lisp/cmuscheme.el                                  |    2 +-
 lisp/color.el                                      |    2 +-
 lisp/comint.el                                     |   29 +-
 lisp/completion.el                                 |    9 +-
 lisp/composite.el                                  |    2 +-
 lisp/cus-dep.el                                    |    2 +-
 lisp/cus-edit.el                                   |    6 +-
 lisp/cus-face.el                                   |    2 +-
 lisp/cus-start.el                                  |   14 +-
 lisp/cus-theme.el                                  |    2 +-
 lisp/custom.el                                     |    2 +-
 lisp/dabbrev.el                                    |    2 +-
 lisp/delim-col.el                                  |    2 +-
 lisp/delsel.el                                     |    2 +-
 lisp/descr-text.el                                 |   27 +-
 lisp/desktop.el                                    |   10 +-
 lisp/dframe.el                                     |    2 +-
 lisp/dired-aux.el                                  |  163 +-
 lisp/dired-x.el                                    |    8 +-
 lisp/dired.el                                      |  174 +-
 lisp/dirtrack.el                                   |    2 +-
 lisp/disp-table.el                                 |    2 +-
 lisp/display-line-numbers.el                       |    2 +-
 lisp/dnd.el                                        |    3 +-
 lisp/doc-view.el                                   |  373 +-
 lisp/dom.el                                        |    2 +-
 lisp/dos-fns.el                                    |    2 +-
 lisp/dos-vars.el                                   |    2 +-
 lisp/dos-w32.el                                    |    2 +-
 lisp/double.el                                     |    2 +-
 lisp/dynamic-setting.el                            |    2 +-
 lisp/ebuff-menu.el                                 |    2 +-
 lisp/echistory.el                                  |    2 +-
 lisp/ecomplete.el                                  |    6 +-
 lisp/edmacro.el                                    |   14 +-
 lisp/ehelp.el                                      |    2 +-
 lisp/elec-pair.el                                  |   75 +-
 lisp/electric.el                                   |  184 +-
 lisp/elide-head.el                                 |    2 +-
 lisp/emacs-lisp/advice.el                          |    2 +-
 lisp/emacs-lisp/autoload.el                        |   18 +-
 lisp/emacs-lisp/avl-tree.el                        |    2 +-
 lisp/emacs-lisp/backquote.el                       |    2 +-
 lisp/emacs-lisp/backtrace.el                       |    2 +-
 lisp/emacs-lisp/benchmark.el                       |    6 +-
 lisp/emacs-lisp/bindat.el                          |    2 +-
 lisp/emacs-lisp/byte-opt.el                        |    8 +-
 lisp/emacs-lisp/byte-run.el                        |    2 +-
 lisp/emacs-lisp/bytecomp.el                        |   62 +-
 lisp/emacs-lisp/cconv.el                           |   22 +-
 lisp/emacs-lisp/chart.el                           |    4 +-
 lisp/emacs-lisp/check-declare.el                   |    2 +-
 lisp/emacs-lisp/checkdoc.el                        |   23 +-
 lisp/emacs-lisp/cl-extra.el                        |   24 +-
 lisp/emacs-lisp/cl-generic.el                      |    4 +-
 lisp/emacs-lisp/cl-indent.el                       |    2 +-
 lisp/emacs-lisp/cl-lib.el                          |    9 +-
 lisp/emacs-lisp/cl-macs.el                         |   10 +-
 lisp/emacs-lisp/cl-preloaded.el                    |    2 +-
 lisp/emacs-lisp/cl-print.el                        |    2 +-
 lisp/emacs-lisp/cl-seq.el                          |    9 +-
 lisp/emacs-lisp/cl.el                              |    2 +-
 lisp/emacs-lisp/copyright.el                       |    2 +-
 lisp/emacs-lisp/crm.el                             |    2 +-
 lisp/emacs-lisp/cursor-sensor.el                   |   53 +-
 lisp/emacs-lisp/debug.el                           |   70 +-
 lisp/emacs-lisp/derived.el                         |    2 +-
 lisp/emacs-lisp/disass.el                          |    2 +-
 lisp/emacs-lisp/easy-mmode.el                      |   26 +-
 lisp/emacs-lisp/easymenu.el                        |    2 +-
 lisp/emacs-lisp/edebug.el                          |   10 +-
 lisp/emacs-lisp/eieio-base.el                      |    2 +-
 lisp/emacs-lisp/eieio-compat.el                    |    6 +-
 lisp/emacs-lisp/eieio-core.el                      |    2 +-
 lisp/emacs-lisp/eieio-custom.el                    |    2 +-
 lisp/emacs-lisp/eieio-datadebug.el                 |    2 +-
 lisp/emacs-lisp/eieio-opt.el                       |    4 +-
 lisp/emacs-lisp/eieio-speedbar.el                  |    4 +-
 lisp/emacs-lisp/eieio.el                           |    2 +-
 lisp/emacs-lisp/eldoc.el                           |   17 +-
 lisp/emacs-lisp/elint.el                           |    2 +-
 lisp/emacs-lisp/elp.el                             |    2 +-
 lisp/emacs-lisp/ert-x.el                           |    2 +-
 lisp/emacs-lisp/ert.el                             |   11 +-
 lisp/emacs-lisp/ewoc.el                            |    2 +-
 lisp/emacs-lisp/faceup.el                          |    2 +-
 lisp/emacs-lisp/find-func.el                       |    2 +-
 lisp/emacs-lisp/float-sup.el                       |    2 +-
 lisp/emacs-lisp/generator.el                       |   26 +-
 lisp/emacs-lisp/generic.el                         |    2 +-
 lisp/emacs-lisp/gv.el                              |    2 +-
 lisp/emacs-lisp/helper.el                          |    2 +-
 lisp/emacs-lisp/inline.el                          |    4 +-
 lisp/emacs-lisp/let-alist.el                       |    2 +-
 lisp/emacs-lisp/lisp-mnt.el                        |    2 +-
 lisp/emacs-lisp/lisp-mode.el                       |    2 +-
 lisp/emacs-lisp/lisp.el                            |    2 +-
 lisp/emacs-lisp/macroexp.el                        |   16 +-
 lisp/emacs-lisp/map-ynp.el                         |   12 +-
 lisp/emacs-lisp/map.el                             |  360 +-
 lisp/emacs-lisp/nadvice.el                         |    2 +-
 lisp/emacs-lisp/package-x.el                       |    6 +-
 lisp/emacs-lisp/package.el                         |  160 +-
 lisp/emacs-lisp/pcase.el                           |   56 +-
 lisp/emacs-lisp/pp.el                              |    2 +-
 lisp/emacs-lisp/radix-tree.el                      |    4 +-
 lisp/emacs-lisp/re-builder.el                      |    2 +-
 lisp/emacs-lisp/regexp-opt.el                      |   57 +-
 lisp/emacs-lisp/regi.el                            |    2 +-
 lisp/emacs-lisp/ring.el                            |   35 +-
 lisp/emacs-lisp/rmc.el                             |    2 +-
 lisp/emacs-lisp/rx.el                              |  144 +-
 lisp/emacs-lisp/seq.el                             |   36 +-
 lisp/emacs-lisp/shadow.el                          |    2 +-
 lisp/emacs-lisp/smie.el                            |   12 +-
 lisp/emacs-lisp/subr-x.el                          |   60 +-
 lisp/emacs-lisp/syntax.el                          |   43 +-
 lisp/emacs-lisp/tabulated-list.el                  |   73 +-
 lisp/emacs-lisp/tcover-ses.el                      |    2 +-
 lisp/emacs-lisp/tcover-unsafep.el                  |    2 +-
 lisp/emacs-lisp/testcover.el                       |    2 +-
 lisp/emacs-lisp/text-property-search.el            |    2 +-
 lisp/emacs-lisp/thunk.el                           |    2 +-
 lisp/emacs-lisp/timer-list.el                      |   18 +-
 lisp/emacs-lisp/timer.el                           |   12 +-
 lisp/emacs-lisp/tq.el                              |    2 +-
 lisp/emacs-lisp/trace.el                           |    2 +-
 lisp/emacs-lisp/unsafep.el                         |    2 +-
 lisp/emacs-lisp/warnings.el                        |    2 +-
 lisp/emacs-lock.el                                 |    2 +-
 lisp/emulation/cua-base.el                         |   13 +-
 lisp/emulation/cua-gmrk.el                         |    2 +-
 lisp/emulation/cua-rect.el                         |    2 +-
 lisp/emulation/edt-lk201.el                        |    2 +-
 lisp/emulation/edt-mapper.el                       |    2 +-
 lisp/emulation/edt-pc.el                           |    2 +-
 lisp/emulation/edt-vt100.el                        |    2 +-
 lisp/emulation/edt.el                              |    2 +-
 lisp/emulation/keypad.el                           |    2 +-
 lisp/emulation/viper-cmd.el                        |   32 +-
 lisp/emulation/viper-ex.el                         |   22 +-
 lisp/emulation/viper-init.el                       |    3 +-
 lisp/emulation/viper-keym.el                       |    2 +-
 lisp/emulation/viper-macs.el                       |    2 +-
 lisp/emulation/viper-mous.el                       |    2 +-
 lisp/emulation/viper-util.el                       |    2 +-
 lisp/emulation/viper.el                            |    2 +-
 lisp/env.el                                        |    2 +-
 lisp/epa-dired.el                                  |    2 +-
 lisp/epa-file.el                                   |    2 +-
 lisp/epa-hook.el                                   |    2 +-
 lisp/epa-mail.el                                   |    4 +-
 lisp/epa.el                                        |   14 +-
 lisp/epg-config.el                                 |    2 +-
 lisp/epg.el                                        |    4 +-
 lisp/erc/ChangeLog.1                               |    4 +-
 lisp/erc/ChangeLog.2                               |    2 +-
 lisp/erc/erc-autoaway.el                           |    2 +-
 lisp/erc/erc-backend.el                            |   32 +-
 lisp/erc/erc-button.el                             |    2 +-
 lisp/erc/erc-capab.el                              |    2 +-
 lisp/erc/erc-compat.el                             |    2 +-
 lisp/erc/erc-dcc.el                                |   29 +-
 lisp/erc/erc-desktop-notifications.el              |    2 +-
 lisp/erc/erc-ezbounce.el                           |    2 +-
 lisp/erc/erc-fill.el                               |    2 +-
 lisp/erc/erc-goodies.el                            |    2 +-
 lisp/erc/erc-ibuffer.el                            |    2 +-
 lisp/erc/erc-identd.el                             |    2 +-
 lisp/erc/erc-imenu.el                              |    2 +-
 lisp/erc/erc-join.el                               |    2 +-
 lisp/erc/erc-lang.el                               |    2 +-
 lisp/erc/erc-list.el                               |    2 +-
 lisp/erc/erc-log.el                                |    2 +-
 lisp/erc/erc-match.el                              |    4 +-
 lisp/erc/erc-menu.el                               |    2 +-
 lisp/erc/erc-netsplit.el                           |    2 +-
 lisp/erc/erc-networks.el                           |    2 +-
 lisp/erc/erc-notify.el                             |    2 +-
 lisp/erc/erc-page.el                               |    2 +-
 lisp/erc/erc-pcomplete.el                          |    2 +-
 lisp/erc/erc-replace.el                            |    2 +-
 lisp/erc/erc-ring.el                               |    2 +-
 lisp/erc/erc-services.el                           |    2 +-
 lisp/erc/erc-sound.el                              |    2 +-
 lisp/erc/erc-speedbar.el                           |    8 +-
 lisp/erc/erc-spelling.el                           |    2 +-
 lisp/erc/erc-stamp.el                              |    2 +-
 lisp/erc/erc-track.el                              |   23 +-
 lisp/erc/erc-truncate.el                           |    2 +-
 lisp/erc/erc-xdcc.el                               |    2 +-
 lisp/erc/erc.el                                    |   63 +-
 lisp/eshell/em-alias.el                            |    2 +-
 lisp/eshell/em-banner.el                           |    2 +-
 lisp/eshell/em-basic.el                            |    4 +-
 lisp/eshell/em-cmpl.el                             |   40 +-
 lisp/eshell/em-dirs.el                             |  118 +-
 lisp/eshell/em-glob.el                             |    2 +-
 lisp/eshell/em-hist.el                             |   11 +-
 lisp/eshell/em-ls.el                               |    4 +-
 lisp/eshell/em-pred.el                             |   17 +-
 lisp/eshell/em-prompt.el                           |    2 +-
 lisp/eshell/em-rebind.el                           |    2 +-
 lisp/eshell/em-script.el                           |    2 +-
 lisp/eshell/em-smart.el                            |    2 +-
 lisp/eshell/em-term.el                             |    4 +-
 lisp/eshell/em-tramp.el                            |    6 +-
 lisp/eshell/em-unix.el                             |   27 +-
 lisp/eshell/em-xtra.el                             |    4 +-
 lisp/eshell/esh-arg.el                             |    2 +-
 lisp/eshell/esh-cmd.el                             |   96 +-
 lisp/eshell/esh-ext.el                             |    4 +-
 lisp/eshell/esh-io.el                              |    2 +-
 lisp/eshell/esh-mode.el                            |    2 +-
 lisp/eshell/esh-module.el                          |    2 +-
 lisp/eshell/esh-opt.el                             |    6 +-
 lisp/eshell/esh-proc.el                            |    5 +-
 lisp/eshell/esh-util.el                            |   16 +-
 lisp/eshell/esh-var.el                             |  112 +-
 lisp/eshell/eshell.el                              |    2 +-
 lisp/expand.el                                     |    2 +-
 lisp/ezimage.el                                    |    2 +-
 lisp/face-remap.el                                 |    2 +-
 lisp/facemenu.el                                   |    2 +-
 lisp/faces.el                                      |    2 +-
 lisp/ffap.el                                       |    2 +-
 lisp/filecache.el                                  |    2 +-
 lisp/{multifile.el => fileloop.el}                 |   76 +-
 lisp/filenotify.el                                 |   29 +-
 lisp/files-x.el                                    |   66 +-
 lisp/files.el                                      |  110 +-
 lisp/filesets.el                                   |   12 +-
 lisp/find-cmd.el                                   |    2 +-
 lisp/find-dired.el                                 |    4 +-
 lisp/find-file.el                                  |    2 +-
 lisp/find-lisp.el                                  |   13 +-
 lisp/finder.el                                     |    2 +-
 lisp/flow-ctrl.el                                  |    2 +-
 lisp/foldout.el                                    |    2 +-
 lisp/follow.el                                     |    2 +-
 lisp/font-core.el                                  |    2 +-
 lisp/font-lock.el                                  |   24 +-
 lisp/format-spec.el                                |    2 +-
 lisp/format.el                                     |    2 +-
 lisp/forms.el                                      |    2 +-
 lisp/frame.el                                      |  157 +-
 lisp/frameset.el                                   |   16 +-
 lisp/fringe.el                                     |    2 +-
 lisp/generic-x.el                                  |    7 +-
 lisp/gnus/ChangeLog.1                              |    2 +-
 lisp/gnus/ChangeLog.2                              |    2 +-
 lisp/gnus/ChangeLog.3                              |    2 +-
 lisp/gnus/canlock.el                               |    2 +-
 lisp/gnus/deuglify.el                              |    2 +-
 lisp/gnus/gmm-utils.el                             |    2 +-
 lisp/gnus/gnus-agent.el                            |  294 +-
 lisp/gnus/gnus-art.el                              |   56 +-
 lisp/gnus/gnus-async.el                            |   31 +-
 lisp/gnus/gnus-bcklg.el                            |  116 +-
 lisp/gnus/gnus-bookmark.el                         |    2 +-
 lisp/gnus/gnus-cache.el                            |   62 +-
 lisp/gnus/gnus-cite.el                             |   12 +-
 lisp/gnus/gnus-cloud.el                            |    2 +-
 lisp/gnus/gnus-cus.el                              |    2 +-
 lisp/gnus/gnus-delay.el                            |   28 +-
 lisp/gnus/gnus-demon.el                            |   12 +-
 lisp/gnus/gnus-diary.el                            |   47 +-
 lisp/gnus/gnus-dired.el                            |    2 +-
 lisp/gnus/gnus-draft.el                            |    2 +-
 lisp/gnus/gnus-dup.el                              |   24 +-
 lisp/gnus/gnus-eform.el                            |    2 +-
 lisp/gnus/gnus-fun.el                              |    2 +-
 lisp/gnus/gnus-gravatar.el                         |    2 +-
 lisp/gnus/gnus-group.el                            |  329 +-
 lisp/gnus/gnus-html.el                             |    2 +-
 lisp/gnus/gnus-icalendar.el                        |   76 +-
 lisp/gnus/gnus-int.el                              |    5 +-
 lisp/gnus/gnus-kill.el                             |    7 +-
 lisp/gnus/gnus-logic.el                            |    8 +-
 lisp/gnus/gnus-mh.el                               |    2 +-
 lisp/gnus/gnus-ml.el                               |    2 +-
 lisp/gnus/gnus-mlspl.el                            |    2 +-
 lisp/gnus/gnus-msg.el                              |    4 +-
 lisp/gnus/gnus-notifications.el                    |    2 +-
 lisp/gnus/gnus-picon.el                            |    2 +-
 lisp/gnus/gnus-range.el                            |    2 +-
 lisp/gnus/gnus-registry.el                         |    2 +-
 lisp/gnus/gnus-rfc1843.el                          |    2 +-
 lisp/gnus/gnus-salt.el                             |   13 +-
 lisp/gnus/gnus-score.el                            |   33 +-
 lisp/gnus/gnus-sieve.el                            |    2 +-
 lisp/gnus/gnus-spec.el                             |    6 +-
 lisp/gnus/gnus-srvr.el                             |   60 +-
 lisp/gnus/gnus-start.el                            |  505 +-
 lisp/gnus/gnus-sum.el                              |  327 +-
 lisp/gnus/gnus-topic.el                            |   52 +-
 lisp/gnus/gnus-undo.el                             |    2 +-
 lisp/gnus/gnus-util.el                             |   83 +-
 lisp/gnus/gnus-uu.el                               |    2 +-
 lisp/gnus/gnus-vm.el                               |    2 +-
 lisp/gnus/gnus-win.el                              |    2 +-
 lisp/gnus/gnus.el                                  |   63 +-
 lisp/gnus/gssapi.el                                |    2 +-
 lisp/gnus/legacy-gnus-agent.el                     |    2 +-
 lisp/gnus/mail-source.el                           |    8 +-
 lisp/gnus/message.el                               |   74 +-
 lisp/gnus/mm-archive.el                            |    2 +-
 lisp/gnus/mm-bodies.el                             |    4 +-
 lisp/gnus/mm-decode.el                             |   46 +-
 lisp/gnus/mm-encode.el                             |    2 +-
 lisp/gnus/mm-extern.el                             |    2 +-
 lisp/gnus/mm-partial.el                            |    2 +-
 lisp/gnus/mm-url.el                                |    2 +-
 lisp/gnus/mm-util.el                               |    4 +-
 lisp/gnus/mm-uu.el                                 |    2 +-
 lisp/gnus/mm-view.el                               |   15 +-
 lisp/gnus/mml-sec.el                               |    4 +-
 lisp/gnus/mml-smime.el                             |    2 +-
 lisp/gnus/mml.el                                   |   12 +-
 lisp/gnus/mml1991.el                               |    2 +-
 lisp/gnus/mml2015.el                               |    2 +-
 lisp/gnus/nnagent.el                               |    2 +-
 lisp/gnus/nnbabyl.el                               |    8 +-
 lisp/gnus/nndiary.el                               |   26 +-
 lisp/gnus/nndir.el                                 |    2 +-
 lisp/gnus/nndoc.el                                 |    2 +-
 lisp/gnus/nndraft.el                               |    2 +-
 lisp/gnus/nneething.el                             |    4 +-
 lisp/gnus/nnfolder.el                              |    2 +-
 lisp/gnus/nngateway.el                             |    2 +-
 lisp/gnus/nnheader.el                              |   13 +-
 lisp/gnus/nnimap.el                                |   25 +-
 lisp/gnus/nnir.el                                  |   63 +-
 lisp/gnus/nnmail.el                                |   13 +-
 lisp/gnus/nnmaildir.el                             |  295 +-
 lisp/gnus/nnmairix.el                              |    4 +-
 lisp/gnus/nnmbox.el                                |    2 +-
 lisp/gnus/nnmh.el                                  |    2 +-
 lisp/gnus/nnml.el                                  |    2 +-
 lisp/gnus/nnoo.el                                  |    2 +-
 lisp/gnus/nnregistry.el                            |    2 +-
 lisp/gnus/nnrss.el                                 |   10 +-
 lisp/gnus/nnspool.el                               |   25 +-
 lisp/gnus/nntp.el                                  |    2 +-
 lisp/gnus/nnvirtual.el                             |   18 +-
 lisp/gnus/nnweb.el                                 |   10 +-
 lisp/gnus/score-mode.el                            |    2 +-
 lisp/gnus/smiley.el                                |    2 +-
 lisp/gnus/smime.el                                 |    2 +-
 lisp/gnus/spam-report.el                           |    2 +-
 lisp/gnus/spam-stat.el                             |    2 +-
 lisp/gnus/spam-wash.el                             |    2 +-
 lisp/gnus/spam.el                                  |   10 +-
 lisp/help-at-pt.el                                 |    2 +-
 lisp/help-fns.el                                   |   17 +-
 lisp/help-macro.el                                 |    2 +-
 lisp/help-mode.el                                  |    2 +-
 lisp/help.el                                       |    7 +-
 lisp/hex-util.el                                   |    2 +-
 lisp/hexl.el                                       |    4 +-
 lisp/hfy-cmap.el                                   |    2 +-
 lisp/hi-lock.el                                    |   32 +-
 lisp/hilit-chg.el                                  |    2 +-
 lisp/hippie-exp.el                                 |    2 +-
 lisp/hl-line.el                                    |    2 +-
 lisp/htmlfontify.el                                |    2 +-
 lisp/ibuf-ext.el                                   |   27 +-
 lisp/ibuf-macs.el                                  |    2 +-
 lisp/ibuffer.el                                    |   16 +-
 lisp/icomplete.el                                  |   44 +-
 lisp/ido.el                                        |   97 +-
 lisp/ielm.el                                       |    2 +-
 lisp/iimage.el                                     |    2 +-
 lisp/image-dired.el                                |    2 +-
 lisp/image-file.el                                 |    2 +-
 lisp/image-mode.el                                 |   16 +-
 lisp/image.el                                      |   32 +-
 lisp/image/compface.el                             |    2 +-
 lisp/image/gravatar.el                             |    2 +-
 lisp/imenu.el                                      |    2 +-
 lisp/indent.el                                     |    2 +-
 lisp/info-look.el                                  |    2 +-
 lisp/info-xref.el                                  |    4 +-
 lisp/info.el                                       |   18 +-
 lisp/informat.el                                   |    2 +-
 lisp/international/ccl.el                          |    2 +-
 lisp/international/characters.el                   |   36 +-
 lisp/international/fontset.el                      |   38 +-
 lisp/international/isearch-x.el                    |    2 +-
 lisp/international/iso-ascii.el                    |    2 +-
 lisp/international/iso-cvt.el                      |    2 +-
 lisp/international/iso-transl.el                   |    2 +-
 lisp/international/ja-dic-cnv.el                   |   67 +-
 lisp/international/ja-dic-utl.el                   |   43 +-
 lisp/international/kinsoku.el                      |   38 +-
 lisp/international/kkc.el                          |    6 +-
 lisp/international/latexenc.el                     |    2 +-
 lisp/international/latin1-disp.el                  |    2 +-
 lisp/international/mule-cmds.el                    |  125 +-
 lisp/international/mule-conf.el                    |   11 +-
 lisp/international/mule-diag.el                    |    2 +-
 lisp/international/mule-util.el                    |   22 +-
 lisp/international/mule.el                         |   39 +-
 lisp/international/ogonek.el                       |    2 +-
 lisp/international/quail.el                        |    2 +-
 lisp/international/rfc1843.el                      |    2 +-
 lisp/international/titdic-cnv.el                   |  325 +-
 lisp/international/ucs-normalize.el                |    8 +-
 lisp/international/utf-7.el                        |    2 +-
 lisp/international/utf7.el                         |    2 +-
 lisp/isearch.el                                    |  701 ++-
 lisp/isearchb.el                                   |    2 +-
 lisp/jit-lock.el                                   |    2 +-
 lisp/jka-cmpr-hook.el                              |    2 +-
 lisp/jka-compr.el                                  |    2 +-
 lisp/json.el                                       |   81 +-
 lisp/jsonrpc.el                                    |   20 +-
 lisp/kermit.el                                     |    2 +-
 lisp/kmacro.el                                     |   14 +-
 lisp/language/china-util.el                        |    4 +-
 lisp/language/chinese.el                           |    2 +-
 lisp/language/cyril-util.el                        |    2 +-
 lisp/language/cyrillic.el                          |   16 +-
 lisp/language/czech.el                             |    2 +-
 lisp/language/english.el                           |   10 +-
 lisp/language/ethio-util.el                        |    4 +-
 lisp/language/ethiopic.el                          |    2 +-
 lisp/language/european.el                          |   10 +-
 lisp/language/georgian.el                          |    4 +-
 lisp/language/greek.el                             |    2 +-
 lisp/language/hanja-util.el                        |    2 +-
 lisp/language/hebrew.el                            |    2 +-
 lisp/language/ind-util.el                          |    2 +-
 lisp/language/indian.el                            |    2 +-
 lisp/language/japan-util.el                        |   98 +-
 lisp/language/japanese.el                          |    6 +-
 lisp/language/korea-util.el                        |    2 +-
 lisp/language/korean.el                            |    2 +-
 lisp/language/lao-util.el                          |    2 +-
 lisp/language/lao.el                               |    2 +-
 lisp/language/romanian.el                          |    2 +-
 lisp/language/slovak.el                            |    2 +-
 lisp/language/tai-viet.el                          |    2 +-
 lisp/language/thai-util.el                         |    2 +-
 lisp/language/thai.el                              |    2 +-
 lisp/language/tibet-util.el                        |    2 +-
 lisp/language/tibetan.el                           |    4 +-
 lisp/language/utf-8-lang.el                        |   34 +-
 lisp/language/viet-util.el                         |    2 +-
 lisp/language/vietnamese.el                        |    6 +-
 lisp/ldefs-boot.el                                 | 2595 +++------
 lisp/leim/quail/arabic.el                          |    2 +-
 lisp/leim/quail/croatian.el                        |    2 +-
 lisp/leim/quail/cyril-jis.el                       |  206 +-
 lisp/leim/quail/cyrillic.el                        |    2 +-
 lisp/leim/quail/czech.el                           |    2 +-
 lisp/leim/quail/georgian.el                        |    2 +-
 lisp/leim/quail/greek.el                           |    2 +-
 lisp/leim/quail/hangul.el                          |    2 +-
 lisp/leim/quail/hanja-jis.el                       |  984 ++--
 lisp/leim/quail/hanja.el                           |    2 +-
 lisp/leim/quail/hanja3.el                          |    2 +-
 lisp/leim/quail/indian.el                          |    2 +-
 lisp/leim/quail/ipa-praat.el                       |    2 +-
 lisp/leim/quail/ipa.el                             |    2 +-
 lisp/leim/quail/japanese.el                        |  376 +-
 lisp/leim/quail/latin-alt.el                       |    2 +-
 lisp/leim/quail/latin-ltx.el                       |    2 +-
 lisp/leim/quail/latin-post.el                      |    2 +-
 lisp/leim/quail/latin-pre.el                       |   31 +-
 lisp/leim/quail/lrt.el                             |    2 +-
 lisp/leim/quail/persian.el                         |    2 +-
 lisp/leim/quail/programmer-dvorak.el               |    2 +-
 lisp/leim/quail/py-punct.el                        |   16 +-
 lisp/leim/quail/pypunct-b5.el                      |    8 +-
 lisp/leim/quail/rfc1345.el                         |    2 +-
 lisp/leim/quail/sami.el                            |  755 +++
 lisp/leim/quail/sgml-input.el                      |    2 +-
 lisp/leim/quail/sisheng.el                         |    2 +-
 lisp/leim/quail/slovak.el                          |    2 +-
 lisp/leim/quail/symbol-ksc.el                      |    2 +-
 lisp/leim/quail/tamil-dvorak.el                    |    2 +-
 lisp/leim/quail/tibetan.el                         |    2 +-
 lisp/leim/quail/uni-input.el                       |    2 +-
 lisp/leim/quail/vntelex.el                         |    2 +-
 lisp/leim/quail/vnvni.el                           |    2 +-
 lisp/leim/quail/welsh.el                           |    2 +-
 lisp/linum.el                                      |    2 +-
 lisp/loadhist.el                                   |    5 +-
 lisp/loadup.el                                     |  182 +-
 lisp/locate.el                                     |   20 +-
 lisp/lpr.el                                        |   22 +-
 lisp/ls-lisp.el                                    |   12 +-
 lisp/macros.el                                     |    2 +-
 lisp/mail/binhex.el                                |    2 +-
 lisp/mail/blessmail.el                             |    2 +-
 lisp/mail/emacsbug.el                              |    5 +-
 lisp/mail/feedmail.el                              |   10 +-
 lisp/mail/flow-fill.el                             |    2 +-
 lisp/mail/footnote.el                              |   22 +-
 lisp/mail/hashcash.el                              |   10 +-
 lisp/mail/ietf-drums.el                            |   14 +-
 lisp/mail/mail-extr.el                             |   45 +-
 lisp/mail/mail-hist.el                             |    2 +-
 lisp/mail/mail-parse.el                            |    2 +-
 lisp/mail/mail-prsvr.el                            |    2 +-
 lisp/mail/mail-utils.el                            |    6 +-
 lisp/mail/mailabbrev.el                            |    2 +-
 lisp/mail/mailalias.el                             |    2 +-
 lisp/mail/mailclient.el                            |    4 +-
 lisp/mail/mailheader.el                            |    4 +-
 lisp/mail/metamail.el                              |    2 +-
 lisp/mail/mspools.el                               |    2 +-
 lisp/mail/qp.el                                    |    2 +-
 lisp/mail/reporter.el                              |    2 +-
 lisp/mail/rfc2045.el                               |    2 +-
 lisp/mail/rfc2047.el                               |   10 +-
 lisp/mail/rfc2231.el                               |    2 +-
 lisp/mail/rfc2368.el                               |    2 +-
 lisp/mail/rfc822.el                                |    8 +-
 lisp/mail/rmail-spam-filter.el                     |    2 +-
 lisp/mail/rmail.el                                 |   58 +-
 lisp/mail/rmailedit.el                             |    2 +-
 lisp/mail/rmailkwd.el                              |    2 +-
 lisp/mail/rmailmm.el                               |    2 +-
 lisp/mail/rmailmsc.el                              |    2 +-
 lisp/mail/rmailout.el                              |    2 +-
 lisp/mail/rmailsort.el                             |    2 +-
 lisp/mail/rmailsum.el                              |    2 +-
 lisp/mail/sendmail.el                              |   11 +-
 lisp/mail/smtpmail.el                              |    9 +-
 lisp/mail/supercite.el                             |    8 +-
 lisp/mail/uce.el                                   |    2 +-
 lisp/mail/undigest.el                              |    2 +-
 lisp/mail/unrmail.el                               |    2 +-
 lisp/mail/uudecode.el                              |    2 +-
 lisp/mail/yenc.el                                  |    2 +-
 lisp/makesum.el                                    |    2 +-
 lisp/man.el                                        |   40 +-
 lisp/master.el                                     |    2 +-
 lisp/mb-depth.el                                   |    2 +-
 lisp/md4.el                                        |    2 +-
 lisp/menu-bar.el                                   |   25 +-
 lisp/mh-e/ChangeLog.1                              |    2 +-
 lisp/mh-e/ChangeLog.2                              |    2 +-
 lisp/mh-e/mh-acros.el                              |   26 +-
 lisp/mh-e/mh-alias.el                              |    8 +-
 lisp/mh-e/mh-buffers.el                            |    2 +-
 lisp/mh-e/mh-comp.el                               |    4 +-
 lisp/mh-e/mh-compat.el                             |    2 +-
 lisp/mh-e/mh-e.el                                  |   25 +-
 lisp/mh-e/mh-folder.el                             |    4 +-
 lisp/mh-e/mh-funcs.el                              |    2 +-
 lisp/mh-e/mh-gnus.el                               |    2 +-
 lisp/mh-e/mh-identity.el                           |    2 +-
 lisp/mh-e/mh-inc.el                                |    2 +-
 lisp/mh-e/mh-junk.el                               |    2 +-
 lisp/mh-e/mh-letter.el                             |    2 +-
 lisp/mh-e/mh-limit.el                              |    2 +-
 lisp/mh-e/mh-mime.el                               |    4 +-
 lisp/mh-e/mh-print.el                              |    2 +-
 lisp/mh-e/mh-scan.el                               |    2 +-
 lisp/mh-e/mh-search.el                             |   12 +-
 lisp/mh-e/mh-seq.el                                |    2 +-
 lisp/mh-e/mh-show.el                               |    6 +-
 lisp/mh-e/mh-speed.el                              |    8 +-
 lisp/mh-e/mh-thread.el                             |    2 +-
 lisp/mh-e/mh-tool-bar.el                           |    2 +-
 lisp/mh-e/mh-utils.el                              |    6 +-
 lisp/mh-e/mh-xface.el                              |    4 +-
 lisp/midnight.el                                   |    8 +-
 lisp/minibuf-eldef.el                              |    2 +-
 lisp/minibuffer.el                                 |  289 +-
 lisp/misc.el                                       |    2 +-
 lisp/misearch.el                                   |    2 +-
 lisp/mouse-copy.el                                 |    2 +-
 lisp/mouse-drag.el                                 |    2 +-
 lisp/mouse.el                                      |   19 +-
 lisp/mpc.el                                        |   17 +-
 lisp/msb.el                                        |    2 +-
 lisp/mwheel.el                                     |    2 +-
 lisp/net/ange-ftp.el                               |   15 +-
 lisp/net/browse-url.el                             |    2 +-
 lisp/net/dbus.el                                   |    2 +-
 lisp/net/dig.el                                    |    2 +-
 lisp/net/dns.el                                    |    7 +-
 lisp/net/eudc-bob.el                               |    2 +-
 lisp/net/eudc-export.el                            |    2 +-
 lisp/net/eudc-hotlist.el                           |    2 +-
 lisp/net/eudc-vars.el                              |    2 +-
 lisp/net/eudc.el                                   |    2 +-
 lisp/net/eudcb-bbdb.el                             |    2 +-
 lisp/net/eudcb-ldap.el                             |    2 +-
 lisp/net/eudcb-mab.el                              |    5 +-
 lisp/net/eww.el                                    |   38 +-
 lisp/net/gnutls.el                                 |   52 +-
 lisp/net/goto-addr.el                              |    6 +-
 lisp/net/hmac-def.el                               |    4 +-
 lisp/net/hmac-md5.el                               |    2 +-
 lisp/net/imap.el                                   |   28 +-
 lisp/net/ldap.el                                   |    7 +-
 lisp/net/mailcap.el                                |    2 +-
 lisp/net/mairix.el                                 |    2 +-
 lisp/net/net-utils.el                              |    2 +-
 lisp/net/netrc.el                                  |    2 +-
 lisp/net/network-stream.el                         |    9 +-
 lisp/net/newst-backend.el                          |   31 +-
 lisp/net/newst-plainview.el                        |    2 +-
 lisp/net/newst-reader.el                           |    2 +-
 lisp/net/newst-ticker.el                           |    2 +-
 lisp/net/newst-treeview.el                         |    2 +-
 lisp/net/newsticker.el                             |    2 +-
 lisp/net/nsm.el                                    |    2 +-
 lisp/net/ntlm.el                                   |    2 +-
 lisp/net/pop3.el                                   |   35 +-
 lisp/net/puny.el                                   |    2 +-
 lisp/net/quickurl.el                               |   12 +-
 lisp/net/rcirc.el                                  |   62 +-
 lisp/net/rfc2104.el                                |    2 +-
 lisp/net/rlogin.el                                 |    2 +-
 lisp/net/sasl-cram.el                              |    2 +-
 lisp/net/sasl-digest.el                            |    2 +-
 lisp/net/sasl-ntlm.el                              |    2 +-
 lisp/net/sasl-scram-rfc.el                         |    2 +-
 lisp/net/sasl.el                                   |    2 +-
 lisp/net/secrets.el                                |    2 +-
 lisp/net/shr-color.el                              |    2 +-
 lisp/net/shr.el                                    |   11 +-
 lisp/net/sieve-manage.el                           |    2 +-
 lisp/net/sieve-mode.el                             |    2 +-
 lisp/net/sieve.el                                  |    2 +-
 lisp/net/snmp-mode.el                              |    2 +-
 lisp/net/soap-client.el                            |    4 +-
 lisp/net/soap-inspect.el                           |    2 +-
 lisp/net/socks.el                                  |    2 +-
 lisp/net/telnet.el                                 |    2 +-
 lisp/net/tramp-adb.el                              |  605 +--
 lisp/net/tramp-archive.el                          |   77 +-
 lisp/net/tramp-cache.el                            |   66 +-
 lisp/net/tramp-cmds.el                             |   75 +-
 lisp/net/tramp-compat.el                           |   89 +-
 lisp/net/tramp-ftp.el                              |   48 +-
 lisp/net/tramp-gvfs.el                             |  218 +-
 lisp/net/tramp-integration.el                      |  199 +
 lisp/net/tramp-rclone.el                           |  608 +++
 lisp/net/tramp-sh.el                               | 2147 ++++----
 lisp/net/tramp-smb.el                              |  324 +-
 lisp/net/tramp-sudoedit.el                         |  893 ++++
 lisp/net/tramp-uu.el                               |    2 +-
 lisp/net/tramp.el                                  | 1168 +++--
 lisp/net/trampver.el                               |   48 +-
 lisp/net/webjump.el                                |    4 +-
 lisp/net/zeroconf.el                               |   35 +-
 lisp/newcomment.el                                 |    2 +-
 lisp/notifications.el                              |    6 +-
 lisp/novice.el                                     |    2 +-
 lisp/nxml/nxml-enc.el                              |    2 +-
 lisp/nxml/nxml-maint.el                            |    6 +-
 lisp/nxml/nxml-mode.el                             |    2 +-
 lisp/nxml/nxml-ns.el                               |    2 +-
 lisp/nxml/nxml-outln.el                            |    2 +-
 lisp/nxml/nxml-parse.el                            |    2 +-
 lisp/nxml/nxml-rap.el                              |    2 +-
 lisp/nxml/nxml-util.el                             |    2 +-
 lisp/nxml/rng-cmpct.el                             |    2 +-
 lisp/nxml/rng-dt.el                                |    2 +-
 lisp/nxml/rng-loc.el                               |    2 +-
 lisp/nxml/rng-maint.el                             |    5 +-
 lisp/nxml/rng-match.el                             |    2 +-
 lisp/nxml/rng-nxml.el                              |    8 +-
 lisp/nxml/rng-parse.el                             |    2 +-
 lisp/nxml/rng-pttrn.el                             |    2 +-
 lisp/nxml/rng-uri.el                               |   11 +-
 lisp/nxml/rng-util.el                              |    2 +-
 lisp/nxml/rng-valid.el                             |    2 +-
 lisp/nxml/rng-xsd.el                               |    4 +-
 lisp/nxml/xmltok.el                                |    2 +-
 lisp/nxml/xsd-regexp.el                            |    2 +-
 lisp/obarray.el                                    |    2 +-
 lisp/obsolete/abbrevlist.el                        |    2 +-
 lisp/obsolete/assoc.el                             |    2 +-
 lisp/obsolete/bruce.el                             |    2 +-
 lisp/obsolete/cc-compat.el                         |    2 +-
 lisp/obsolete/cl-compat.el                         |    2 +-
 lisp/obsolete/complete.el                          |    2 +-
 lisp/obsolete/crisp.el                             |    6 +-
 lisp/obsolete/cust-print.el                        |    2 +-
 lisp/obsolete/erc-hecomplete.el                    |    2 +-
 lisp/obsolete/eudcb-ph.el                          |    2 +-
 lisp/obsolete/fast-lock.el                         |    2 +-
 lisp/obsolete/gs.el                                |    2 +-
 lisp/obsolete/gulp.el                              |    2 +-
 lisp/obsolete/html2text.el                         |    2 +-
 lisp/obsolete/iswitchb.el                          |    2 +-
 lisp/obsolete/landmark.el                          |   13 +-
 lisp/obsolete/lazy-lock.el                         |    2 +-
 lisp/obsolete/ledit.el                             |    2 +-
 lisp/obsolete/levents.el                           |    2 +-
 lisp/obsolete/lmenu.el                             |    2 +-
 lisp/obsolete/longlines.el                         |    2 +-
 lisp/obsolete/lucid.el                             |    2 +-
 lisp/obsolete/messcompat.el                        |    2 +-
 lisp/obsolete/mouse-sel.el                         |    2 +-
 lisp/obsolete/old-emacs-lock.el                    |    2 +-
 lisp/obsolete/old-whitespace.el                    |    2 +-
 lisp/obsolete/otodo-mode.el                        |    2 +-
 lisp/obsolete/pc-mode.el                           |    2 +-
 lisp/obsolete/pc-select.el                         |    2 +-
 lisp/obsolete/pgg-def.el                           |    2 +-
 lisp/obsolete/pgg-gpg.el                           |    2 +-
 lisp/obsolete/pgg-parse.el                         |    6 +-
 lisp/obsolete/pgg-pgp.el                           |    2 +-
 lisp/obsolete/pgg-pgp5.el                          |    2 +-
 lisp/obsolete/pgg.el                               |    4 +-
 lisp/obsolete/rcompile.el                          |    2 +-
 lisp/obsolete/s-region.el                          |    2 +-
 lisp/obsolete/sregex.el                            |    2 +-
 lisp/obsolete/starttls.el                          |    6 +-
 lisp/obsolete/sup-mouse.el                         |    2 +-
 lisp/obsolete/terminal.el                          |    2 +-
 lisp/obsolete/tls.el                               |    2 +-
 lisp/obsolete/tpu-edt.el                           |    2 +-
 lisp/obsolete/tpu-extras.el                        |    2 +-
 lisp/obsolete/tpu-mapper.el                        |    2 +-
 lisp/obsolete/vc-arch.el                           |    6 +-
 lisp/obsolete/vip.el                               |   18 +-
 lisp/obsolete/ws-mode.el                           |    2 +-
 lisp/obsolete/xesam.el                             |   13 +-
 lisp/obsolete/yow.el                               |    2 +-
 lisp/org/ChangeLog.1                               |    2 +-
 lisp/org/ob-C.el                                   |    2 +-
 lisp/org/ob-J.el                                   |    2 +-
 lisp/org/ob-R.el                                   |    2 +-
 lisp/org/ob-abc.el                                 |    6 +-
 lisp/org/ob-asymptote.el                           |    2 +-
 lisp/org/ob-awk.el                                 |    2 +-
 lisp/org/ob-calc.el                                |    2 +-
 lisp/org/ob-clojure.el                             |    2 +-
 lisp/org/ob-comint.el                              |    2 +-
 lisp/org/ob-coq.el                                 |    2 +-
 lisp/org/ob-core.el                                |    4 +-
 lisp/org/ob-css.el                                 |    2 +-
 lisp/org/ob-ditaa.el                               |    2 +-
 lisp/org/ob-dot.el                                 |    2 +-
 lisp/org/ob-ebnf.el                                |    2 +-
 lisp/org/ob-emacs-lisp.el                          |    2 +-
 lisp/org/ob-eval.el                                |    2 +-
 lisp/org/ob-exp.el                                 |    2 +-
 lisp/org/ob-forth.el                               |    4 +-
 lisp/org/ob-fortran.el                             |    2 +-
 lisp/org/ob-gnuplot.el                             |    2 +-
 lisp/org/ob-groovy.el                              |    2 +-
 lisp/org/ob-haskell.el                             |    2 +-
 lisp/org/ob-hledger.el                             |    2 +-
 lisp/org/ob-io.el                                  |    2 +-
 lisp/org/ob-java.el                                |    2 +-
 lisp/org/ob-js.el                                  |    2 +-
 lisp/org/ob-keys.el                                |    2 +-
 lisp/org/ob-latex.el                               |    2 +-
 lisp/org/ob-ledger.el                              |    2 +-
 lisp/org/ob-lilypond.el                            |    2 +-
 lisp/org/ob-lisp.el                                |    2 +-
 lisp/org/ob-lob.el                                 |    2 +-
 lisp/org/ob-lua.el                                 |    2 +-
 lisp/org/ob-makefile.el                            |    2 +-
 lisp/org/ob-matlab.el                              |    2 +-
 lisp/org/ob-maxima.el                              |    2 +-
 lisp/org/ob-mscgen.el                              |    2 +-
 lisp/org/ob-ocaml.el                               |    2 +-
 lisp/org/ob-octave.el                              |    2 +-
 lisp/org/ob-org.el                                 |    2 +-
 lisp/org/ob-perl.el                                |    2 +-
 lisp/org/ob-picolisp.el                            |    2 +-
 lisp/org/ob-plantuml.el                            |    2 +-
 lisp/org/ob-processing.el                          |    2 +-
 lisp/org/ob-python.el                              |    2 +-
 lisp/org/ob-ref.el                                 |    2 +-
 lisp/org/ob-ruby.el                                |    2 +-
 lisp/org/ob-sass.el                                |    2 +-
 lisp/org/ob-scheme.el                              |    2 +-
 lisp/org/ob-screen.el                              |    2 +-
 lisp/org/ob-sed.el                                 |    2 +-
 lisp/org/ob-shell.el                               |    2 +-
 lisp/org/ob-shen.el                                |    2 +-
 lisp/org/ob-sql.el                                 |    2 +-
 lisp/org/ob-sqlite.el                              |    2 +-
 lisp/org/ob-stan.el                                |    2 +-
 lisp/org/ob-table.el                               |    2 +-
 lisp/org/ob-tangle.el                              |    2 +-
 lisp/org/ob-vala.el                                |    2 +-
 lisp/org/ob.el                                     |    2 +-
 lisp/org/org-agenda.el                             |   42 +-
 lisp/org/org-archive.el                            |    2 +-
 lisp/org/org-attach.el                             |    2 +-
 lisp/org/org-bbdb.el                               |    2 +-
 lisp/org/org-bibtex.el                             |    2 +-
 lisp/org/org-capture.el                            |   10 +-
 lisp/org/org-clock.el                              |  124 +-
 lisp/org/org-colview.el                            |   12 +-
 lisp/org/org-compat.el                             |    2 +-
 lisp/org/org-crypt.el                              |    2 +-
 lisp/org/org-ctags.el                              |    2 +-
 lisp/org/org-datetree.el                           |   11 +-
 lisp/org/org-docview.el                            |    2 +-
 lisp/org/org-duration.el                           |   11 +-
 lisp/org/org-element.el                            |   13 +-
 lisp/org/org-entities.el                           |    2 +-
 lisp/org/org-eshell.el                             |    2 +-
 lisp/org/org-eww.el                                |    2 +-
 lisp/org/org-faces.el                              |    2 +-
 lisp/org/org-feed.el                               |    2 +-
 lisp/org/org-footnote.el                           |    2 +-
 lisp/org/org-gnus.el                               |    2 +-
 lisp/org/org-habit.el                              |    7 +-
 lisp/org/org-id.el                                 |    8 +-
 lisp/org/org-indent.el                             |    6 +-
 lisp/org/org-info.el                               |    2 +-
 lisp/org/org-inlinetask.el                         |    2 +-
 lisp/org/org-irc.el                                |    2 +-
 lisp/org/org-lint.el                               |    2 +-
 lisp/org/org-list.el                               |    6 +-
 lisp/org/org-macro.el                              |    4 +-
 lisp/org/org-macs.el                               |    2 +-
 lisp/org/org-mhe.el                                |    4 +-
 lisp/org/org-mobile.el                             |    6 +-
 lisp/org/org-mouse.el                              |    4 +-
 lisp/org/org-pcomplete.el                          |    8 +-
 lisp/org/org-plot.el                               |    4 +-
 lisp/org/org-protocol.el                           |   19 +-
 lisp/org/org-rmail.el                              |    2 +-
 lisp/org/org-src.el                                |    2 +-
 lisp/org/org-table.el                              |   21 +-
 lisp/org/org-timer.el                              |   34 +-
 lisp/org/org-w3m.el                                |    2 +-
 lisp/org/org.el                                    |  141 +-
 lisp/org/ox-ascii.el                               |    6 +-
 lisp/org/ox-beamer.el                              |    2 +-
 lisp/org/ox-html.el                                |    8 +-
 lisp/org/ox-icalendar.el                           |    2 +-
 lisp/org/ox-latex.el                               |    4 +-
 lisp/org/ox-man.el                                 |    2 +-
 lisp/org/ox-md.el                                  |    2 +-
 lisp/org/ox-odt.el                                 |    2 +-
 lisp/org/ox-org.el                                 |    2 +-
 lisp/org/ox-publish.el                             |   14 +-
 lisp/org/ox-texinfo.el                             |    2 +-
 lisp/org/ox.el                                     |    6 +-
 lisp/outline.el                                    |    2 +-
 lisp/paren.el                                      |    2 +-
 lisp/password-cache.el                             |    2 +-
 lisp/pcmpl-cvs.el                                  |    2 +-
 lisp/pcmpl-gnu.el                                  |    2 +-
 lisp/pcmpl-linux.el                                |    2 +-
 lisp/pcmpl-rpm.el                                  |    2 +-
 lisp/pcmpl-unix.el                                 |    2 +-
 lisp/pcmpl-x.el                                    |    2 +-
 lisp/pcomplete.el                                  |   28 +-
 lisp/pixel-scroll.el                               |   11 +-
 lisp/play/5x5.el                                   |    2 +-
 lisp/play/animate.el                               |    2 +-
 lisp/play/blackbox.el                              |    2 +-
 lisp/play/bubbles.el                               |   52 +-
 lisp/play/cookie1.el                               |    2 +-
 lisp/play/decipher.el                              |    2 +-
 lisp/play/dissociate.el                            |    2 +-
 lisp/play/doctor.el                                |    2 +-
 lisp/play/dunnet.el                                |    2 +-
 lisp/play/fortune.el                               |    2 +-
 lisp/play/gamegrid.el                              |   14 +-
 lisp/play/gametree.el                              |    2 +-
 lisp/play/gomoku.el                                |   30 +-
 lisp/play/handwrite.el                             |    2 +-
 lisp/play/hanoi.el                                 |    2 +-
 lisp/play/life.el                                  |    2 +-
 lisp/play/morse.el                                 |    2 +-
 lisp/play/mpuz.el                                  |    2 +-
 lisp/play/pong.el                                  |    2 +-
 lisp/play/snake.el                                 |    2 +-
 lisp/play/solitaire.el                             |    2 +-
 lisp/play/spook.el                                 |    2 +-
 lisp/play/tetris.el                                |    2 +-
 lisp/play/zone.el                                  |    4 +-
 lisp/plstore.el                                    |    2 +-
 lisp/printing.el                                   |    4 +-
 lisp/proced.el                                     |    4 +-
 lisp/profiler.el                                   |    2 +-
 lisp/progmodes/ada-mode.el                         |    4 +-
 lisp/progmodes/ada-prj.el                          |    2 +-
 lisp/progmodes/ada-stmt.el                         |    2 +-
 lisp/progmodes/ada-xref.el                         |    7 +-
 lisp/progmodes/antlr-mode.el                       |    2 +-
 lisp/progmodes/asm-mode.el                         |    2 +-
 lisp/progmodes/autoconf.el                         |    4 +-
 lisp/progmodes/bat-mode.el                         |    2 +-
 lisp/progmodes/bug-reference.el                    |    2 +-
 lisp/progmodes/cc-align.el                         |  126 +-
 lisp/progmodes/cc-awk.el                           |   12 +-
 lisp/progmodes/cc-bytecomp.el                      |    2 +-
 lisp/progmodes/cc-cmds.el                          |  429 +-
 lisp/progmodes/cc-defs.el                          |  131 +-
 lisp/progmodes/cc-engine.el                        | 1021 +++-
 lisp/progmodes/cc-fonts.el                         |  213 +-
 lisp/progmodes/cc-guess.el                         |    2 +-
 lisp/progmodes/cc-langs.el                         |   66 +-
 lisp/progmodes/cc-menus.el                         |    2 +-
 lisp/progmodes/cc-mode.el                          |  157 +-
 lisp/progmodes/cc-styles.el                        |   18 +-
 lisp/progmodes/cc-vars.el                          |    8 +-
 lisp/progmodes/cfengine.el                         |    6 +-
 lisp/progmodes/cmacexp.el                          |    2 +-
 lisp/progmodes/compile.el                          |  165 +-
 lisp/progmodes/cperl-mode.el                       |   58 +-
 lisp/progmodes/cpp.el                              |    6 +-
 lisp/progmodes/cwarn.el                            |    2 +-
 lisp/progmodes/dcl-mode.el                         |    4 +-
 lisp/progmodes/ebnf-abn.el                         |    2 +-
 lisp/progmodes/ebnf-bnf.el                         |    2 +-
 lisp/progmodes/ebnf-dtd.el                         |    2 +-
 lisp/progmodes/ebnf-ebx.el                         |    2 +-
 lisp/progmodes/ebnf-iso.el                         |    2 +-
 lisp/progmodes/ebnf-otz.el                         |    2 +-
 lisp/progmodes/ebnf-yac.el                         |    4 +-
 lisp/progmodes/ebnf2ps.el                          |    2 +-
 lisp/progmodes/ebrowse.el                          |  221 +-
 lisp/progmodes/elisp-mode.el                       |   39 +-
 lisp/progmodes/etags.el                            |   42 +-
 lisp/progmodes/executable.el                       |    2 +-
 lisp/progmodes/f90.el                              |    4 +-
 lisp/progmodes/flymake-cc.el                       |   14 +-
 lisp/progmodes/flymake-proc.el                     |    8 +-
 lisp/progmodes/flymake.el                          |  134 +-
 lisp/progmodes/fortran.el                          |    8 +-
 lisp/progmodes/gdb-mi.el                           |   14 +-
 lisp/progmodes/glasses.el                          |    2 +-
 lisp/progmodes/grep.el                             |   25 +-
 lisp/progmodes/gud.el                              |   22 +-
 lisp/progmodes/hideif.el                           |   13 +-
 lisp/progmodes/hideshow.el                         |    2 +-
 lisp/progmodes/icon.el                             |    2 +-
 lisp/progmodes/idlw-complete-structtag.el          |    4 +-
 lisp/progmodes/idlw-help.el                        |    2 +-
 lisp/progmodes/idlw-shell.el                       |    2 +-
 lisp/progmodes/idlw-toolbar.el                     |    2 +-
 lisp/progmodes/idlwave.el                          |   17 +-
 lisp/progmodes/inf-lisp.el                         |    2 +-
 lisp/progmodes/js.el                               |   77 +-
 lisp/progmodes/ld-script.el                        |    2 +-
 lisp/progmodes/m4-mode.el                          |    7 +-
 lisp/progmodes/make-mode.el                        |    4 +-
 lisp/progmodes/mantemp.el                          |   10 +-
 lisp/progmodes/meta-mode.el                        |    4 +-
 lisp/progmodes/mixal-mode.el                       |    6 +-
 lisp/progmodes/modula2.el                          |    8 +-
 lisp/progmodes/octave.el                           |   14 +-
 lisp/progmodes/opascal.el                          |   10 +-
 lisp/progmodes/pascal.el                           |    4 +-
 lisp/progmodes/perl-mode.el                        |    2 +-
 lisp/progmodes/prog-mode.el                        |    2 +-
 lisp/progmodes/project.el                          |  254 +-
 lisp/progmodes/prolog.el                           |   20 +-
 lisp/progmodes/ps-mode.el                          |    8 +-
 lisp/progmodes/python.el                           |   53 +-
 lisp/progmodes/ruby-mode.el                        |  134 +-
 lisp/progmodes/scheme.el                           |    4 +-
 lisp/progmodes/sh-script.el                        |   42 +-
 lisp/progmodes/simula.el                           |    2 +-
 lisp/progmodes/sql.el                              |  284 +-
 lisp/progmodes/subword.el                          |    6 +-
 lisp/progmodes/tcl.el                              |    2 +-
 lisp/progmodes/vera-mode.el                        |    2 +-
 lisp/progmodes/verilog-mode.el                     |  817 +--
 lisp/progmodes/vhdl-mode.el                        |   28 +-
 lisp/progmodes/which-func.el                       |   19 +-
 lisp/progmodes/xref.el                             |   57 +-
 lisp/progmodes/xscheme.el                          |    2 +-
 lisp/ps-bdf.el                                     |    2 +-
 lisp/ps-def.el                                     |    2 +-
 lisp/ps-mule.el                                    |    4 +-
 lisp/ps-print.el                                   |    2 +-
 lisp/ps-samp.el                                    |    6 +-
 lisp/recentf.el                                    |    2 +-
 lisp/rect.el                                       |    2 +-
 lisp/register.el                                   |    2 +-
 lisp/registry.el                                   |    2 +-
 lisp/repeat.el                                     |    2 +-
 lisp/replace.el                                    |   90 +-
 lisp/reposition.el                                 |    2 +-
 lisp/reveal.el                                     |    2 +-
 lisp/rfn-eshadow.el                                |    2 +-
 lisp/rot13.el                                      |    2 +-
 lisp/rtree.el                                      |    4 +-
 lisp/ruler-mode.el                                 |    4 +-
 lisp/savehist.el                                   |    2 +-
 lisp/saveplace.el                                  |    2 +-
 lisp/sb-image.el                                   |    2 +-
 lisp/scroll-all.el                                 |    2 +-
 lisp/scroll-bar.el                                 |    2 +-
 lisp/scroll-lock.el                                |    2 +-
 lisp/select.el                                     |    2 +-
 lisp/server.el                                     |   18 +-
 lisp/ses.el                                        |   36 +-
 lisp/shadowfile.el                                 |    2 +-
 lisp/shell.el                                      |   85 +-
 lisp/simple.el                                     |  126 +-
 lisp/skeleton.el                                   |    2 +-
 lisp/sort.el                                       |    2 +-
 lisp/soundex.el                                    |    2 +-
 lisp/speedbar.el                                   |  139 +-
 lisp/startup.el                                    |   58 +-
 lisp/strokes.el                                    |    2 +-
 lisp/subr.el                                       |  100 +-
 lisp/svg.el                                        |    2 +-
 lisp/t-mouse.el                                    |    2 +-
 lisp/tabify.el                                     |    2 +-
 lisp/talk.el                                       |    2 +-
 lisp/tar-mode.el                                   |    4 +-
 lisp/tempo.el                                      |    2 +-
 lisp/term.el                                       |  158 +-
 lisp/term/AT386.el                                 |    2 +-
 lisp/term/README                                   |    2 +-
 lisp/term/common-win.el                            |    2 +-
 lisp/term/internal.el                              |    2 +-
 lisp/term/iris-ansi.el                             |    2 +-
 lisp/term/konsole.el                               |    2 +-
 lisp/term/news.el                                  |    2 +-
 lisp/term/ns-win.el                                |   58 +-
 lisp/term/pc-win.el                                |    2 +-
 lisp/term/rxvt.el                                  |    2 +-
 lisp/term/screen.el                                |    2 +-
 lisp/term/sun.el                                   |    2 +-
 lisp/term/tmux.el                                  |    2 +-
 lisp/term/tty-colors.el                            |    2 +-
 lisp/term/tvi970.el                                |    2 +-
 lisp/term/vt100.el                                 |    2 +-
 lisp/term/w32-win.el                               |    2 +-
 lisp/term/w32console.el                            |    2 +-
 lisp/term/wyse50.el                                |    2 +-
 lisp/term/x-win.el                                 |    2 +-
 lisp/term/xterm.el                                 |   10 +-
 lisp/textmodes/artist.el                           |    4 +-
 lisp/textmodes/bib-mode.el                         |    4 +-
 lisp/textmodes/bibtex-style.el                     |    2 +-
 lisp/textmodes/bibtex.el                           |    6 +-
 lisp/textmodes/conf-mode.el                        |   14 +-
 lisp/textmodes/css-mode.el                         |   56 +-
 lisp/textmodes/dns-mode.el                         |    8 +-
 lisp/textmodes/enriched.el                         |    2 +-
 lisp/textmodes/fill.el                             |    2 +-
 lisp/textmodes/flyspell.el                         |    6 +-
 lisp/textmodes/ispell.el                           |   31 +-
 lisp/textmodes/less-css-mode.el                    |    2 +-
 lisp/textmodes/makeinfo.el                         |    2 +-
 lisp/textmodes/mhtml-mode.el                       |    6 +-
 lisp/textmodes/nroff-mode.el                       |    2 +-
 lisp/textmodes/page-ext.el                         |    2 +-
 lisp/textmodes/page.el                             |    2 +-
 lisp/textmodes/paragraphs.el                       |    2 +-
 lisp/textmodes/picture.el                          |   16 +-
 lisp/textmodes/po.el                               |    2 +-
 lisp/textmodes/refbib.el                           |    4 +-
 lisp/textmodes/refer.el                            |    2 +-
 lisp/textmodes/refill.el                           |   10 +-
 lisp/textmodes/reftex-auc.el                       |    2 +-
 lisp/textmodes/reftex-cite.el                      |    6 +-
 lisp/textmodes/reftex-dcr.el                       |    2 +-
 lisp/textmodes/reftex-global.el                    |    2 +-
 lisp/textmodes/reftex-index.el                     |    2 +-
 lisp/textmodes/reftex-parse.el                     |    4 +-
 lisp/textmodes/reftex-ref.el                       |    4 +-
 lisp/textmodes/reftex-sel.el                       |    2 +-
 lisp/textmodes/reftex-toc.el                       |    2 +-
 lisp/textmodes/reftex-vars.el                      |   53 +-
 lisp/textmodes/reftex.el                           |    2 +-
 lisp/textmodes/remember.el                         |    2 +-
 lisp/textmodes/rst.el                              |    4 +-
 lisp/textmodes/sgml-mode.el                        |   93 +-
 lisp/textmodes/table.el                            |    2 +-
 lisp/textmodes/tex-mode.el                         |   10 +-
 lisp/textmodes/texinfmt.el                         |   10 +-
 lisp/textmodes/texinfo.el                          |   35 +-
 lisp/textmodes/texnfo-upd.el                       |    4 +-
 lisp/textmodes/text-mode.el                        |    2 +-
 lisp/textmodes/tildify.el                          |    2 +-
 lisp/textmodes/two-column.el                       |    2 +-
 lisp/textmodes/underline.el                        |    2 +-
 lisp/thingatpt.el                                  |   15 +-
 lisp/thread.el                                     |    2 +-
 lisp/thumbs.el                                     |    2 +-
 lisp/time-stamp.el                                 |    2 +-
 lisp/time.el                                       |   22 +-
 lisp/timezone.el                                   |    2 +-
 lisp/tmm.el                                        |   44 +-
 lisp/tool-bar.el                                   |    2 +-
 lisp/tooltip.el                                    |    5 +-
 lisp/tree-widget.el                                |    2 +-
 lisp/tutorial.el                                   |    6 +-
 lisp/type-break.el                                 |   16 +-
 lisp/uniquify.el                                   |    2 +-
 lisp/url/ChangeLog.1                               |    2 +-
 lisp/url/url-about.el                              |    2 +-
 lisp/url/url-auth.el                               |    5 +-
 lisp/url/url-cache.el                              |    6 +-
 lisp/url/url-cid.el                                |    2 +-
 lisp/url/url-cookie.el                             |   11 +-
 lisp/url/url-dav.el                                |   30 +-
 lisp/url/url-dired.el                              |    2 +-
 lisp/url/url-domsuf.el                             |    2 +-
 lisp/url/url-expand.el                             |    2 +-
 lisp/url/url-file.el                               |    2 +-
 lisp/url/url-ftp.el                                |    2 +-
 lisp/url/url-future.el                             |    2 +-
 lisp/url/url-gw.el                                 |   10 +-
 lisp/url/url-handlers.el                           |   14 +-
 lisp/url/url-history.el                            |    2 +-
 lisp/url/url-http.el                               |   68 +-
 lisp/url/url-imap.el                               |    2 +-
 lisp/url/url-irc.el                                |    2 +-
 lisp/url/url-ldap.el                               |    2 +-
 lisp/url/url-mailto.el                             |    2 +-
 lisp/url/url-methods.el                            |    6 +-
 lisp/url/url-misc.el                               |    2 +-
 lisp/url/url-news.el                               |    2 +-
 lisp/url/url-nfs.el                                |    2 +-
 lisp/url/url-ns.el                                 |    2 +-
 lisp/url/url-parse.el                              |    4 +-
 lisp/url/url-privacy.el                            |    8 +-
 lisp/url/url-proxy.el                              |    2 +-
 lisp/url/url-queue.el                              |    6 +-
 lisp/url/url-tramp.el                              |    2 +-
 lisp/url/url-util.el                               |   11 +-
 lisp/url/url-vars.el                               |    2 +-
 lisp/url/url.el                                    |    5 +-
 lisp/userlock.el                                   |    8 +-
 lisp/vc/add-log.el                                 |    4 +-
 lisp/vc/compare-w.el                               |    2 +-
 lisp/vc/cvs-status.el                              |   32 +-
 lisp/vc/diff-mode.el                               |  395 +-
 lisp/vc/diff.el                                    |    5 +-
 lisp/vc/ediff-diff.el                              |    2 +-
 lisp/vc/ediff-help.el                              |    2 +-
 lisp/vc/ediff-hook.el                              |    2 +-
 lisp/vc/ediff-init.el                              |   24 +-
 lisp/vc/ediff-merg.el                              |    2 +-
 lisp/vc/ediff-mult.el                              |    2 +-
 lisp/vc/ediff-ptch.el                              |   16 +-
 lisp/vc/ediff-util.el                              |    8 +-
 lisp/vc/ediff-vers.el                              |    2 +-
 lisp/vc/ediff-wind.el                              |    2 +-
 lisp/vc/ediff.el                                   |   11 +-
 lisp/vc/log-edit.el                                |    4 +-
 lisp/vc/log-view.el                                |   18 +-
 lisp/vc/pcvs-defs.el                               |    2 +-
 lisp/vc/pcvs-info.el                               |   14 +-
 lisp/vc/pcvs-parse.el                              |    2 +-
 lisp/vc/pcvs-util.el                               |    2 +-
 lisp/vc/pcvs.el                                    |   14 +-
 lisp/vc/smerge-mode.el                             |   46 +-
 lisp/vc/vc-annotate.el                             |    6 +-
 lisp/vc/vc-bzr.el                                  |   16 +-
 lisp/vc/vc-cvs.el                                  |   11 +-
 lisp/vc/vc-dav.el                                  |    2 +-
 lisp/vc/vc-dir.el                                  |    2 +-
 lisp/vc/vc-dispatcher.el                           |    2 +-
 lisp/vc/vc-filewise.el                             |    2 +-
 lisp/vc/vc-git.el                                  |   78 +-
 lisp/vc/vc-hg.el                                   |   35 +-
 lisp/vc/vc-hooks.el                                |   27 +-
 lisp/vc/vc-mtn.el                                  |    6 +-
 lisp/vc/vc-rcs.el                                  |   10 +-
 lisp/vc/vc-sccs.el                                 |    2 +-
 lisp/vc/vc-src.el                                  |    2 +-
 lisp/vc/vc-svn.el                                  |    2 +-
 lisp/vc/vc.el                                      |  221 +-
 lisp/vcursor.el                                    |    2 +-
 lisp/version.el                                    |   30 +-
 lisp/view.el                                       |    2 +-
 lisp/vt-control.el                                 |    2 +-
 lisp/vt100-led.el                                  |    2 +-
 lisp/w32-fns.el                                    |    2 +-
 lisp/w32-vars.el                                   |    2 +-
 lisp/wdired.el                                     |    2 +-
 lisp/whitespace.el                                 |    4 +-
 lisp/wid-browse.el                                 |    2 +-
 lisp/wid-edit.el                                   |    4 +-
 lisp/widget.el                                     |    2 +-
 lisp/windmove.el                                   |  286 +-
 lisp/window.el                                     |  805 +--
 lisp/winner.el                                     |    2 +-
 lisp/woman.el                                      |   18 +-
 lisp/x-dnd.el                                      |    2 +-
 lisp/xdg.el                                        |    4 +-
 lisp/xml.el                                        |    6 +-
 lisp/xt-mouse.el                                   |   30 +-
 lisp/xwidget.el                                    |    2 +-
 lwlib/ChangeLog.1                                  |    2 +-
 lwlib/Makefile.in                                  |    2 +-
 lwlib/deps.mk                                      |    2 +-
 lwlib/lwlib-Xaw.c                                  |    2 +-
 lwlib/lwlib-Xlw.c                                  |    2 +-
 lwlib/lwlib-Xm.c                                   |    2 +-
 lwlib/lwlib-int.h                                  |    2 +-
 lwlib/lwlib-utils.c                                |    2 +-
 lwlib/lwlib-widget.h                               |    2 +-
 lwlib/lwlib.c                                      |    2 +-
 lwlib/lwlib.h                                      |    2 +-
 lwlib/xlwmenu.c                                    |    2 +-
 lwlib/xlwmenu.h                                    |    2 +-
 lwlib/xlwmenuP.h                                   |    2 +-
 m4/00gnulib.m4                                     |    2 +-
 m4/__inline.m4                                     |    2 +-
 m4/absolute-header.m4                              |    2 +-
 m4/acl.m4                                          |    2 +-
 m4/alloca.m4                                       |   11 +-
 m4/builtin-expect.m4                               |    2 +-
 m4/byteswap.m4                                     |    2 +-
 m4/c-strtod.m4                                     |   76 -
 m4/clock_time.m4                                   |    2 +-
 m4/close-stream.m4                                 |    2 +-
 m4/count-leading-zeros.m4                          |    2 +-
 m4/count-one-bits.m4                               |    2 +-
 m4/count-trailing-zeros.m4                         |    2 +-
 m4/d-type.m4                                       |    2 +-
 m4/dirent_h.m4                                     |    2 +-
 m4/dirfd.m4                                        |    2 +-
 m4/dup2.m4                                         |    2 +-
 m4/eealloc.m4                                      |    2 +-
 m4/environ.m4                                      |    2 +-
 m4/errno_h.m4                                      |   12 +-
 m4/euidaccess.m4                                   |    2 +-
 m4/execinfo.m4                                     |    2 +-
 m4/explicit_bzero.m4                               |    2 +-
 m4/extensions.m4                                   |    2 +-
 m4/extern-inline.m4                                |    2 +-
 m4/faccessat.m4                                    |    2 +-
 m4/fcntl.m4                                        |    2 +-
 m4/fcntl_h.m4                                      |    2 +-
 m4/fdatasync.m4                                    |   32 -
 m4/fdopendir.m4                                    |   14 +-
 m4/filemode.m4                                     |    2 +-
 m4/flexmember.m4                                   |    2 +-
 m4/fpending.m4                                     |    2 +-
 m4/fpieee.m4                                       |    2 +-
 m4/fstatat.m4                                      |    2 +-
 m4/fsusage.m4                                      |   47 +-
 m4/fsync.m4                                        |    2 +-
 m4/getdtablesize.m4                                |    2 +-
 m4/getgroups.m4                                    |   10 +-
 m4/getloadavg.m4                                   |    2 +-
 m4/getopt.m4                                       |    2 +-
 m4/gettime.m4                                      |    2 +-
 m4/gettimeofday.m4                                 |    6 +-
 m4/glibc21.m4                                      |    2 +-
 m4/gnulib-common.m4                                |  134 +-
 m4/gnulib-comp.m4                                  |   33 +-
 m4/group-member.m4                                 |    2 +-
 m4/ieee754-h.m4                                    |    2 +-
 m4/include_next.m4                                 |    2 +-
 m4/inttypes.m4                                     |    2 +-
 m4/largefile.m4                                    |    2 +-
 m4/limits-h.m4                                     |    2 +-
 m4/localtime-buffer.m4                             |    2 +-
 m4/longlong.m4                                     |   12 +-
 m4/lstat.m4                                        |    2 +-
 m4/manywarnings.m4                                 |    2 +-
 m4/mbstate_t.m4                                    |    2 +-
 m4/md5.m4                                          |    2 +-
 m4/memrchr.m4                                      |    2 +-
 m4/minmax.m4                                       |    2 +-
 m4/mkostemp.m4                                     |    2 +-
 m4/mktime.m4                                       |    2 +-
 m4/mode_t.m4                                       |    2 +-
 m4/multiarch.m4                                    |    2 +-
 m4/nocrash.m4                                      |    2 +-
 m4/nstrftime.m4                                    |    2 +-
 m4/off_t.m4                                        |    2 +-
 m4/open-cloexec.m4                                 |    2 +-
 m4/open.m4                                         |    2 +-
 m4/pipe2.m4                                        |    2 +-
 m4/pselect.m4                                      |    2 +-
 m4/pthread_sigmask.m4                              |    2 +-
 m4/putenv.m4                                       |    6 +-
 m4/readlink.m4                                     |    2 +-
 m4/readlinkat.m4                                   |    2 +-
 m4/regex.m4                                        |   15 +-
 m4/sha1.m4                                         |    2 +-
 m4/sha256.m4                                       |    2 +-
 m4/sha512.m4                                       |    2 +-
 m4/sig2str.m4                                      |    2 +-
 m4/signal_h.m4                                     |    2 +-
 m4/socklen.m4                                      |    2 +-
 m4/ssize_t.m4                                      |    2 +-
 m4/st_dm_mode.m4                                   |    2 +-
 m4/stat-time.m4                                    |    2 +-
 m4/std-gnu11.m4                                    |    6 +-
 m4/stdalign.m4                                     |    2 +-
 m4/stddef_h.m4                                     |    2 +-
 m4/stdint.m4                                       |   12 +-
 m4/stdio_h.m4                                      |    2 +-
 m4/stdlib_h.m4                                     |   17 +-
 m4/stpcpy.m4                                       |    2 +-
 m4/string_h.m4                                     |    2 +-
 m4/strtoimax.m4                                    |    2 +-
 m4/strtoll.m4                                      |    2 +-
 m4/symlink.m4                                      |    2 +-
 m4/sys_select_h.m4                                 |    2 +-
 m4/sys_socket_h.m4                                 |    2 +-
 m4/sys_stat_h.m4                                   |    2 +-
 m4/sys_time_h.m4                                   |    2 +-
 m4/sys_types_h.m4                                  |    2 +-
 m4/tempname.m4                                     |    2 +-
 m4/time_h.m4                                       |    2 +-
 m4/time_r.m4                                       |    2 +-
 m4/time_rz.m4                                      |    2 +-
 m4/timegm.m4                                       |    2 +-
 m4/timer_time.m4                                   |    2 +-
 m4/timespec.m4                                     |    2 +-
 m4/tm_gmtoff.m4                                    |    2 +-
 m4/unistd_h.m4                                     |    2 +-
 m4/unlocked-io.m4                                  |    2 +-
 m4/utimbuf.m4                                      |    2 +-
 m4/utimens.m4                                      |    2 +-
 m4/utimes.m4                                       |   12 +-
 m4/vararrays.m4                                    |    2 +-
 m4/warnings.m4                                     |    2 +-
 m4/wchar_t.m4                                      |    2 +-
 make-dist                                          |  394 +-
 modules/modhelp.py                                 |    2 +-
 msdos/ChangeLog.1                                  |    2 +-
 msdos/INSTALL                                      |    2 +-
 msdos/README                                       |    4 +-
 msdos/autogen/Makefile.in                          |    6 +-
 msdos/autogen/config.in                            |    2 +-
 msdos/depfiles.bat                                 |    2 +-
 msdos/inttypes.h                                   |    2 +-
 msdos/mainmake.v2                                  |    2 +-
 msdos/sed1v2.inp                                   |    2 +-
 msdos/sed1x.inp                                    |    2 +-
 msdos/sed2v2.inp                                   |    4 +-
 msdos/sed2x.inp                                    |    2 +-
 msdos/sed3v2.inp                                   |    2 +-
 msdos/sed4.inp                                     |    2 +-
 msdos/sed5x.inp                                    |    2 +-
 msdos/sed6.inp                                     |    2 +-
 msdos/sedadmin.inp                                 |    2 +-
 msdos/sedalloc.inp                                 |    2 +-
 msdos/sedleim.inp                                  |    2 +-
 msdos/sedlibcf.inp                                 |    2 +-
 msdos/sedlibmk.inp                                 |    2 +-
 msdos/sedlisp.inp                                  |    2 +-
 nextstep/ChangeLog.1                               |    2 +-
 nextstep/INSTALL                                   |   31 +-
 nextstep/Makefile.in                               |    9 +-
 nextstep/README                                    |    2 +-
 nextstep/templates/Info.plist.in                   |    2 +-
 nt/ChangeLog.1                                     |    2 +-
 nt/INSTALL                                         |    2 +-
 nt/INSTALL.W64                                     |    2 +-
 nt/Makefile.in                                     |    2 +-
 nt/README                                          |    2 +-
 nt/README.W32                                      |    2 +-
 nt/addpm.c                                         |    2 +-
 nt/cmdproxy.c                                      |    2 +-
 nt/configure.bat                                   |    2 +-
 nt/ddeclient.c                                     |    2 +-
 nt/emacs.rc.in                                     |    2 +-
 nt/emacsclient.rc.in                               |    2 +-
 nt/epaths.nt                                       |    2 +-
 nt/gnulib-cfg.mk                                   |    2 +-
 nt/icons/README                                    |    6 +-
 nt/inc/grp.h                                       |    2 +-
 nt/inc/inttypes.h                                  |    2 +-
 nt/inc/langinfo.h                                  |    6 +-
 nt/inc/ms-w32.h                                    |    4 +-
 nt/inc/nl_types.h                                  |    2 +-
 nt/inc/stdint.h                                    |    2 +-
 nt/inc/sys/resource.h                              |    2 +-
 nt/inc/sys/socket.h                                |    2 +-
 nt/inc/sys/stat.h                                  |    2 +-
 nt/inc/sys/wait.h                                  |    2 +-
 nt/mingw-cfg.site                                  |    1 +
 nt/preprep.c                                       |    2 +-
 nt/runemacs.c                                      |    2 +-
 oldXMenu/Activate.c                                |    2 +-
 oldXMenu/ChangeLog.1                               |    2 +-
 oldXMenu/Create.c                                  |    2 +-
 oldXMenu/FindSel.c                                 |    2 +-
 oldXMenu/Internal.c                                |    2 +-
 oldXMenu/Makefile.in                               |    2 +-
 oldXMenu/deps.mk                                   |    2 +-
 oldXMenu/insque.c                                  |    2 +-
 src/.gdbinit                                       |   26 +-
 src/ChangeLog.1                                    |    2 +-
 src/ChangeLog.10                                   |    2 +-
 src/ChangeLog.11                                   |    4 +-
 src/ChangeLog.12                                   |    2 +-
 src/ChangeLog.13                                   |    2 +-
 src/ChangeLog.2                                    |    2 +-
 src/ChangeLog.3                                    |    2 +-
 src/ChangeLog.4                                    |    4 +-
 src/ChangeLog.5                                    |    2 +-
 src/ChangeLog.6                                    |    2 +-
 src/ChangeLog.7                                    |    2 +-
 src/ChangeLog.8                                    |    2 +-
 src/ChangeLog.9                                    |    2 +-
 src/Makefile.in                                    |  127 +-
 src/README                                         |    2 +-
 src/alloc.c                                        | 1409 +++--
 src/atimer.c                                       |   27 +-
 src/atimer.h                                       |    2 +-
 src/bidi.c                                         |    6 +-
 src/bignum.c                                       |    6 +-
 src/bignum.h                                       |    2 +-
 src/blockinput.h                                   |    2 +-
 src/buffer.c                                       |  168 +-
 src/buffer.h                                       |   27 +-
 src/bytecode.c                                     |   15 +-
 src/callint.c                                      |   18 +-
 src/callproc.c                                     |   25 +-
 src/casefiddle.c                                   |    2 +-
 src/casetab.c                                      |    2 +-
 src/category.c                                     |   18 +-
 src/ccl.c                                          |    6 +-
 src/character.c                                    |    4 +-
 src/charset.c                                      |   88 +-
 src/charset.h                                      |    3 +-
 src/chartab.c                                      |   13 +-
 src/cm.c                                           |    2 +-
 src/cm.h                                           |    2 +-
 src/cmds.c                                         |   53 +-
 src/coding.c                                       |  337 +-
 src/coding.h                                       |   17 +-
 src/commands.h                                     |    2 +-
 src/composite.c                                    |   34 +-
 src/composite.h                                    |    4 +-
 src/conf_post.h                                    |   14 +-
 src/cygw32.c                                       |    2 +-
 src/cygw32.h                                       |    2 +-
 src/data.c                                         |   84 +-
 src/dbusbind.c                                     |    6 +-
 src/decompress.c                                   |    2 +-
 src/deps.mk                                        |    2 +-
 src/dired.c                                        |   26 +-
 src/dispextern.h                                   |   46 +-
 src/dispnew.c                                      |  113 +-
 src/disptab.h                                      |    2 +-
 src/dmpstruct.awk                                  |   45 +
 src/doc.c                                          |   20 +-
 src/doprnt.c                                       |    6 +-
 src/dosfns.c                                       |    2 +-
 src/dosfns.h                                       |    2 +-
 src/dynlib.c                                       |    2 +-
 src/dynlib.h                                       |    2 +-
 src/editfns.c                                      |  254 +-
 src/emacs-icon.h                                   |    2 +-
 src/emacs-module.c                                 |  407 +-
 src/emacs-module.h.in                              |   23 +-
 src/emacs.c                                        |  447 +-
 src/emacsgtkfixed.c                                |    2 +-
 src/emacsgtkfixed.h                                |    2 +-
 src/epaths.in                                      |    2 +-
 src/eval.c                                         |  157 +-
 src/fileio.c                                       |  205 +-
 src/filelock.c                                     |   15 +-
 nt/inc/nl_types.h => src/fingerprint-dummy.c       |   14 +-
 src/{mini-gmp-emacs.c => fingerprint.h}            |   23 +-
 src/firstfile.c                                    |    2 +-
 src/floatfns.c                                     |   29 +-
 src/fns.c                                          |  286 +-
 src/font.c                                         |   50 +-
 src/font.h                                         |   67 +-
 src/fontset.c                                      |   30 +-
 src/fontset.h                                      |    2 +-
 src/frame.c                                        |  270 +-
 src/frame.h                                        |   84 +-
 src/fringe.c                                       |   27 +-
 src/ftcrfont.c                                     |   53 +-
 src/ftfont.c                                       |   78 +-
 src/ftfont.h                                       |   37 +-
 src/ftxfont.c                                      |   11 +-
 src/getpagesize.h                                  |    2 +-
 src/gfilenotify.c                                  |   26 +-
 src/gmalloc.c                                      |   23 +-
 src/gnutls.c                                       |  203 +-
 src/gnutls.h                                       |    2 +-
 src/gtkutil.c                                      |   82 +-
 src/gtkutil.h                                      |    3 +-
 src/image.c                                        |  484 +-
 src/indent.c                                       |   20 +-
 src/indent.h                                       |    2 +-
 src/inotify.c                                      |    2 +-
 src/insdel.c                                       |   33 +-
 src/intervals.c                                    |   32 +-
 src/intervals.h                                    |   17 +-
 src/json.c                                         |   24 +-
 src/keyboard.c                                     |  426 +-
 src/keyboard.h                                     |    6 +-
 src/keymap.c                                       |   58 +-
 src/keymap.h                                       |    2 +-
 src/kqueue.c                                       |    9 +-
 src/lastfile.c                                     |    4 +-
 src/lcms.c                                         |    2 +-
 src/lisp.h                                         |  394 +-
 src/lread.c                                        |  260 +-
 src/macfont.h                                      |    2 +-
 src/macfont.m                                      |   43 +-
 src/macros.c                                       |    6 +-
 src/macros.h                                       |    2 +-
 src/macuvs.h                                       |    3 +-
 src/marker.c                                       |    4 +-
 src/menu.c                                         |   42 +-
 src/menu.h                                         |    5 +-
 src/mini-gmp-emacs.c                               |    2 +-
 src/mini-gmp.c                                     |    2 +-
 src/mini-gmp.h                                     |    2 +-
 src/minibuf.c                                      |   62 +-
 src/module-env-25.h                                |    4 +-
 src/module-env-27.h                                |    4 +
 src/msdos.c                                        |    2 +-
 src/msdos.h                                        |    2 +-
 src/nsfns.m                                        |   30 +-
 src/nsfont.m                                       |   23 +-
 src/nsgui.h                                        |    4 +-
 src/nsimage.m                                      |   70 +-
 src/nsmenu.m                                       |    4 +-
 src/nsselect.m                                     |    2 +-
 src/nsterm.h                                       |    4 +-
 src/nsterm.m                                       |  280 +-
 src/pdumper.c                                      | 5536 ++++++++++++++++++++
 src/pdumper.h                                      |  254 +
 src/print.c                                        |    2 +-
 src/process.c                                      |  196 +-
 src/process.h                                      |    3 +-
 src/profiler.c                                     |  122 +-
 src/ptr-bounds.h                                   |    2 +-
 src/puresize.h                                     |    2 +-
 src/ralloc.c                                       |   14 +-
 src/regex-emacs.c                                  |  351 +-
 src/regex-emacs.h                                  |   42 +-
 src/region-cache.c                                 |    2 +-
 src/region-cache.h                                 |    2 +-
 src/scroll.c                                       |   14 +-
 src/search.c                                       |  211 +-
 src/sheap.c                                        |    3 +-
 src/sheap.h                                        |    3 +-
 src/sound.c                                        |    2 +-
 src/syntax.c                                       |   99 +-
 src/syntax.h                                       |    2 +-
 src/sysdep.c                                       |  102 +-
 src/sysselect.h                                    |    2 +-
 src/syssignal.h                                    |    4 +-
 src/sysstdio.h                                     |    2 +-
 src/systhread.c                                    |    2 +-
 src/systhread.h                                    |    2 +-
 src/systime.h                                      |    4 +-
 src/systty.h                                       |    2 +-
 src/syswait.h                                      |    2 +-
 src/term.c                                         |   44 +-
 src/termcap.c                                      |   45 +-
 src/termchar.h                                     |    2 +-
 src/termhooks.h                                    |    2 +-
 src/terminal.c                                     |    2 +-
 src/terminfo.c                                     |    2 +-
 src/termopts.h                                     |    2 +-
 src/textprop.c                                     |   96 +-
 src/thread.c                                       |   19 +-
 src/thread.h                                       |   19 +-
 src/timefns.c                                      |  194 +-
 src/tparam.c                                       |    2 +-
 src/tparam.h                                       |    2 +-
 src/undo.c                                         |   13 +-
 src/unexaix.c                                      |    2 +-
 src/unexcoff.c                                     |    6 +-
 src/unexcw.c                                       |    2 +-
 src/unexelf.c                                      |    2 +-
 src/unexmacosx.c                                   |    4 +-
 src/unexw32.c                                      |  128 +-
 src/vm-limit.c                                     |    2 +-
 src/w16select.c                                    |   18 +-
 src/w32.c                                          |  151 +-
 src/w32.h                                          |    5 +-
 src/w32common.h                                    |    2 +-
 src/w32console.c                                   |    2 +-
 src/w32cygwinx.c                                   |    5 +-
 src/w32fns.c                                       |   36 +-
 src/w32font.c                                      |   13 +-
 src/w32font.h                                      |    2 +-
 src/w32gui.h                                       |    2 +-
 src/w32heap.c                                      |   44 +-
 src/w32heap.h                                      |    5 +-
 src/w32inevt.c                                     |    2 +-
 src/w32inevt.h                                     |    2 +-
 src/w32menu.c                                      |    4 +-
 src/w32notify.c                                    |    2 +-
 src/w32proc.c                                      |  221 +-
 src/w32reg.c                                       |    2 +-
 src/w32select.c                                    |    4 +-
 src/w32select.h                                    |    2 +-
 src/w32term.c                                      |  140 +-
 src/w32term.h                                      |    2 +-
 src/w32uniscribe.c                                 |   17 +-
 src/w32xfns.c                                      |    2 +-
 src/widget.c                                       |    4 +-
 src/widget.h                                       |    2 +-
 src/widgetprv.h                                    |    2 +-
 src/window.c                                       | 1202 +++--
 src/window.h                                       |  180 +-
 src/xdisp.c                                        |  405 +-
 src/xfaces.c                                       |   84 +-
 src/xfns.c                                         |   24 +-
 src/xfont.c                                        |   14 +-
 src/xftfont.c                                      |   54 +-
 src/xgselect.c                                     |    2 +-
 src/xgselect.h                                     |    2 +-
 src/xmenu.c                                        |   26 +-
 src/xml.c                                          |    2 +-
 src/xrdb.c                                         |   56 +-
 src/xselect.c                                      |   46 +-
 src/xsettings.c                                    |    8 +-
 src/xsettings.h                                    |    2 +-
 src/xsmfns.c                                       |    2 +-
 src/xterm.c                                        |  219 +-
 src/xterm.h                                        |    2 +-
 src/xwidget.c                                      |   35 +-
 src/xwidget.h                                      |    2 +-
 test/ChangeLog.1                                   |    2 +-
 test/Makefile.in                                   |   20 +-
 test/README                                        |   21 +-
 test/data/decompress/tg.tar.gz                     |  Bin 0 -> 150 bytes
 test/data/decompress/zg.zip                        |  Bin 0 -> 182 bytes
 test/data/emacs-module/mod-test.c                  |   77 +-
 test/data/shr/ol.html                              |   29 +
 test/data/shr/ol.txt                               |   19 +
 test/data/vc/diff-mode/hello_emacs.c               |    6 +
 test/data/vc/diff-mode/hello_emacs_1.c             |    1 +
 test/data/vc/diff-mode/hello_world.c               |    6 +
 test/data/vc/diff-mode/hello_world_1.c             |    1 +
 test/lib-src/emacsclient-tests.el                  |    2 +-
 test/lisp/abbrev-tests.el                          |    2 +-
 test/lisp/arc-mode-tests.el                        |   16 +-
 test/lisp/auth-source-pass-tests.el                |    2 +-
 test/lisp/auth-source-tests.el                     |    2 +-
 test/lisp/autorevert-tests.el                      |    5 +-
 test/lisp/buff-menu-tests.el                       |    2 +-
 test/lisp/calc/calc-tests.el                       |    2 +-
 test/lisp/calendar/icalendar-tests.el              |    2 +-
 test/lisp/calendar/parse-time-tests.el             |    2 +-
 test/lisp/calendar/todo-mode-tests.el              |    2 +-
 test/lisp/char-fold-tests.el                       |    2 +-
 test/lisp/color-tests.el                           |    2 +-
 test/lisp/comint-tests.el                          |    2 +-
 test/lisp/custom-resources/custom--test-theme.el   |    9 +
 test/lisp/custom-tests.el                          |   41 +-
 test/lisp/dabbrev-tests.el                         |    2 +-
 test/lisp/descr-text-tests.el                      |    2 +-
 test/lisp/dired-aux-tests.el                       |    2 +-
 test/lisp/dired-tests.el                           |    2 +-
 test/lisp/dired-x-tests.el                         |    2 +-
 test/lisp/dom-tests.el                             |    2 +-
 test/lisp/electric-tests.el                        |  156 +-
 test/lisp/emacs-lisp/backtrace-tests.el            |    2 +-
 test/lisp/emacs-lisp/benchmark-tests.el            |    2 +-
 test/lisp/emacs-lisp/bytecomp-tests.el             |    2 +-
 test/lisp/emacs-lisp/cconv-tests.el                |    2 +-
 test/lisp/emacs-lisp/checkdoc-tests.el             |    2 +-
 test/lisp/emacs-lisp/cl-extra-tests.el             |    7 +-
 test/lisp/emacs-lisp/cl-generic-tests.el           |    2 +-
 test/lisp/emacs-lisp/cl-lib-tests.el               |    4 +-
 test/lisp/emacs-lisp/cl-macs-tests.el              |    2 +-
 test/lisp/emacs-lisp/cl-preloaded-tests.el         |    2 +-
 test/lisp/emacs-lisp/cl-print-tests.el             |    4 +-
 test/lisp/emacs-lisp/cl-seq-tests.el               |    2 +-
 test/lisp/emacs-lisp/cl-tests.el                   |    2 +-
 test/lisp/emacs-lisp/derived-tests.el              |    2 +-
 .../edebug-resources/edebug-test-code.el           |    2 +-
 test/lisp/emacs-lisp/edebug-tests.el               |    2 +-
 .../eieio-tests/eieio-test-methodinvoke.el         |    2 +-
 .../emacs-lisp/eieio-tests/eieio-test-persist.el   |    2 +-
 test/lisp/emacs-lisp/eieio-tests/eieio-tests.el    |    2 +-
 test/lisp/emacs-lisp/ert-tests.el                  |   10 +-
 test/lisp/emacs-lisp/ert-x-tests.el                |    2 +-
 .../faceup-resources/faceup-test-mode.el           |    2 +-
 .../faceup-test-this-file-directory.el             |    2 +-
 .../emacs-lisp/faceup-tests/faceup-test-basics.el  |    2 +-
 .../emacs-lisp/faceup-tests/faceup-test-files.el   |    2 +-
 test/lisp/emacs-lisp/generator-tests.el            |    2 +-
 test/lisp/emacs-lisp/gv-tests.el                   |    2 +-
 test/lisp/emacs-lisp/let-alist-tests.el            |    2 +-
 test/lisp/emacs-lisp/lisp-mode-tests.el            |    2 +-
 test/lisp/emacs-lisp/lisp-tests.el                 |    2 +-
 test/lisp/emacs-lisp/map-tests.el                  |   27 +-
 test/lisp/emacs-lisp/nadvice-tests.el              |    2 +-
 test/lisp/emacs-lisp/package-tests.el              |   87 +-
 test/lisp/emacs-lisp/pcase-tests.el                |    6 +-
 test/lisp/emacs-lisp/pp-tests.el                   |    2 +-
 test/lisp/emacs-lisp/regexp-opt-tests.el           |    2 +-
 test/lisp/emacs-lisp/ring-tests.el                 |   39 +-
 test/lisp/emacs-lisp/rmc-tests.el                  |    2 +-
 test/lisp/emacs-lisp/rx-tests.el                   |   70 +-
 test/lisp/emacs-lisp/seq-tests.el                  |   39 +-
 test/lisp/emacs-lisp/shadow-tests.el               |    2 +-
 test/lisp/emacs-lisp/subr-x-tests.el               |    2 +-
 test/lisp/emacs-lisp/tabulated-list-test.el        |    2 +-
 .../emacs-lisp/testcover-resources/testcases.el    |    2 +-
 test/lisp/emacs-lisp/testcover-tests.el            |    2 +-
 test/lisp/emacs-lisp/text-property-search-tests.el |    2 +-
 test/lisp/emacs-lisp/thunk-tests.el                |    2 +-
 test/lisp/emacs-lisp/timer-tests.el                |    2 +-
 test/lisp/emulation/viper-tests.el                 |    2 +-
 test/lisp/epg-tests.el                             |   12 +-
 test/lisp/erc/erc-track-tests.el                   |    2 +-
 test/lisp/eshell/em-hist-tests.el                  |    2 +-
 test/lisp/eshell/em-ls-tests.el                    |   16 +-
 test/lisp/eshell/esh-opt-tests.el                  |    2 +-
 test/lisp/eshell/eshell-tests.el                   |    5 +-
 test/lisp/faces-tests.el                           |   11 +-
 test/lisp/ffap-tests.el                            |    2 +-
 test/lisp/filenotify-tests.el                      |  217 +-
 test/lisp/files-tests.el                           |   12 +-
 test/lisp/files-x-tests.el                         |   91 +-
 test/lisp/gnus/gnus-test-headers.el                |  176 +
 test/lisp/gnus/gnus-tests.el                       |    2 +-
 test/lisp/gnus/message-tests.el                    |    2 +-
 test/lisp/help-fns-tests.el                        |    2 +-
 test/lisp/hi-lock-tests.el                         |    2 +-
 test/lisp/htmlfontify-tests.el                     |    2 +-
 test/lisp/ibuffer-tests.el                         |    6 +-
 test/lisp/ido-tests.el                             |    2 +-
 test/lisp/imenu-tests.el                           |    2 +-
 test/lisp/info-xref-tests.el                       |    2 +-
 test/lisp/international/ccl-tests.el               |    2 +-
 test/lisp/international/mule-tests.el              |    2 +-
 test/lisp/international/mule-util-tests.el         |    2 +-
 test/lisp/international/ucs-normalize-tests.el     |   72 +-
 test/lisp/isearch-tests.el                         |    2 +-
 test/lisp/jit-lock-tests.el                        |    2 +-
 test/lisp/json-tests.el                            |    2 +-
 test/lisp/jsonrpc-tests.el                         |    4 +-
 test/lisp/kmacro-tests.el                          |    2 +-
 test/lisp/ls-lisp-tests.el                         |    2 +-
 test/lisp/mail/rmail-tests.el                      |    4 +-
 test/lisp/man-tests.el                             |    2 +-
 test/lisp/md4-tests.el                             |    2 +-
 test/lisp/minibuffer-tests.el                      |    8 +-
 test/lisp/mouse-tests.el                           |    2 +-
 test/lisp/net/dbus-tests.el                        |    2 +-
 test/lisp/net/gnutls-tests.el                      |    2 +-
 test/lisp/net/mailcap-tests.el                     |    2 +-
 test/lisp/net/network-stream-tests.el              |  436 +-
 test/lisp/net/newsticker-tests.el                  |    2 +-
 test/lisp/net/puny-tests.el                        |    2 +-
 test/lisp/net/sasl-scram-rfc-tests.el              |    2 +-
 test/lisp/net/secrets-tests.el                     |    9 +-
 test/lisp/net/shr-tests.el                         |    2 +-
 test/lisp/net/tramp-archive-tests.el               |   53 +-
 test/lisp/net/tramp-tests.el                       |  747 ++-
 test/lisp/obarray-tests.el                         |    2 +-
 test/lisp/org/org-tests.el                         |    2 +-
 test/lisp/progmodes/bat-mode-tests.el              |    2 +-
 test/lisp/progmodes/cc-mode-tests.el               |    2 +-
 test/lisp/progmodes/compile-tests.el               |    2 +-
 test/lisp/progmodes/elisp-mode-tests.el            |   30 +-
 test/lisp/progmodes/etags-tests.el                 |    2 +-
 test/lisp/progmodes/f90-tests.el                   |    4 +-
 test/lisp/progmodes/flymake-resources/Makefile     |    2 +-
 test/lisp/progmodes/flymake-tests.el               |    4 +-
 test/lisp/progmodes/js-tests.el                    |    2 +-
 test/lisp/progmodes/python-tests.el                |    5 +-
 test/lisp/progmodes/ruby-mode-tests.el             |   92 +-
 test/lisp/progmodes/sql-tests.el                   |  219 +-
 test/lisp/progmodes/subword-tests.el               |    2 +-
 test/lisp/progmodes/tcl-tests.el                   |    2 +-
 test/lisp/progmodes/xref-tests.el                  |    2 +-
 test/lisp/ps-print-tests.el                        |    2 +-
 test/lisp/register-tests.el                        |    2 +-
 test/lisp/replace-tests.el                         |    2 +-
 test/lisp/rot13-tests.el                           |    2 +-
 test/lisp/ses-tests.el                             |    2 +-
 test/lisp/shadowfile-tests.el                      |    2 +-
 test/lisp/shell-tests.el                           |   10 +-
 test/lisp/simple-tests.el                          |   36 +-
 test/lisp/sort-tests.el                            |    2 +-
 test/lisp/soundex-tests.el                         |    2 +-
 test/lisp/subr-tests.el                            |   21 +-
 test/lisp/tar-mode-tests.el                        |   15 +-
 test/lisp/term-tests.el                            |    2 +-
 test/lisp/textmodes/conf-mode-tests.el             |  204 +
 test/lisp/textmodes/css-mode-tests.el              |    2 +-
 test/lisp/textmodes/dns-mode-tests.el              |    2 +-
 test/lisp/textmodes/fill-tests.el                  |    2 +-
 test/lisp/textmodes/mhtml-mode-tests.el            |    2 +-
 test/lisp/textmodes/reftex-tests.el                |    2 +-
 test/lisp/textmodes/sgml-mode-tests.el             |    2 +-
 test/lisp/textmodes/tildify-tests.el               |    2 +-
 test/lisp/thingatpt-tests.el                       |    2 +-
 test/lisp/thread-tests.el                          |    2 +-
 test/lisp/url/url-auth-tests.el                    |    2 +-
 test/lisp/url/url-expand-tests.el                  |    2 +-
 test/lisp/url/url-file-tests.el                    |    2 +-
 test/lisp/url/url-future-tests.el                  |    2 +-
 test/lisp/url/url-handlers-test.el                 |    2 +-
 test/lisp/url/url-misc-tests.el                    |    2 +-
 test/lisp/url/url-parse-tests.el                   |    2 +-
 test/lisp/url/url-tramp-tests.el                   |    2 +-
 test/lisp/url/url-util-tests.el                    |    2 +-
 test/lisp/vc/add-log-tests.el                      |    2 +-
 test/lisp/vc/diff-mode-tests.el                    |  118 +-
 test/lisp/vc/ediff-diff-tests.el                   |    2 +-
 test/lisp/vc/ediff-ptch-tests.el                   |    2 +-
 test/lisp/vc/smerge-mode-tests.el                  |    2 +-
 test/lisp/vc/vc-bzr-tests.el                       |    2 +-
 test/lisp/vc/vc-hg-tests.el                        |    2 +-
 test/lisp/vc/vc-tests.el                           |    2 +-
 test/lisp/wdired-tests.el                          |    2 +-
 test/lisp/whitespace-tests.el                      |    2 +-
 test/lisp/xdg-tests.el                             |    2 +-
 test/lisp/xml-tests.el                             |    2 +-
 test/lisp/xt-mouse-tests.el                        |    2 +-
 test/manual/BidiCharacterTest.txt                  |    4 +-
 test/manual/biditest.el                            |    2 +-
 test/manual/cedet/cedet-utests.el                  |    2 +-
 test/manual/cedet/ede-tests.el                     |    2 +-
 test/manual/cedet/semantic-ia-utest.el             |    2 +-
 test/manual/cedet/semantic-tests.el                |    2 +-
 test/manual/cedet/semantic-utest-c.el              |    2 +-
 test/manual/cedet/semantic-utest.el                |    2 +-
 test/manual/cedet/srecode-tests.el                 |    2 +-
 test/manual/cedet/tests/test.c                     |    2 +-
 test/manual/cedet/tests/test.el                    |    2 +-
 test/manual/cedet/tests/test.make                  |    2 +-
 test/manual/cedet/tests/testdoublens.cpp           |    2 +-
 test/manual/cedet/tests/testdoublens.hpp           |    2 +-
 test/manual/cedet/tests/testjavacomp.java          |    2 +-
 test/manual/cedet/tests/testpolymorph.cpp          |    2 +-
 test/manual/cedet/tests/testspp.c                  |    2 +-
 test/manual/cedet/tests/testsppreplace.c           |    2 +-
 test/manual/cedet/tests/testsppreplaced.c          |    2 +-
 test/manual/cedet/tests/testsubclass.cpp           |    2 +-
 test/manual/cedet/tests/testsubclass.hh            |    2 +-
 test/manual/cedet/tests/testtypedefs.cpp           |    2 +-
 test/manual/cedet/tests/testvarnames.c             |    2 +-
 test/manual/etags/c-src/abbrev.c                   |    2 +-
 test/manual/etags/c-src/emacs/src/gmalloc.c        |    2 +-
 test/manual/etags/c-src/emacs/src/keyboard.c       |    2 +-
 test/manual/etags/c-src/emacs/src/lisp.h           |    2 +-
 test/manual/etags/c-src/emacs/src/regex.h          |    2 +-
 test/manual/etags/c-src/etags.c                    |    2 +-
 test/manual/etags/c-src/exit.c                     |    2 +-
 test/manual/etags/c-src/exit.strange_suffix        |    2 +-
 test/manual/etags/c-src/getopt.h                   |    2 +-
 test/manual/etags/c-src/sysdep.h                   |    2 +-
 .../etags/el-src/emacs/lisp/progmodes/etags.el     |    2 +-
 test/manual/etags/tex-src/texinfo.tex              |    2 +-
 test/manual/etags/y-src/cccp.c                     |    2 +-
 test/manual/etags/y-src/parse.c                    |    2 +-
 test/manual/etags/y-src/parse.y                    |    2 +-
 test/manual/image-size-tests.el                    |    2 +-
 test/manual/indent/js.js                           |   16 +
 test/manual/indent/pascal.pas                      |    2 +-
 test/manual/redisplay-testsuite.el                 |    2 +-
 test/manual/rmailmm.el                             |    2 +-
 test/manual/scroll-tests.el                        |    2 +-
 test/src/alloc-tests.el                            |    2 +-
 test/src/buffer-tests.el                           |    2 +-
 test/src/callint-tests.el                          |    2 +-
 test/src/callproc-tests.el                         |    2 +-
 test/src/casefiddle-tests.el                       |    2 +-
 test/src/charset-tests.el                          |    2 +-
 test/src/chartab-tests.el                          |    2 +-
 test/src/cmds-tests.el                             |   10 +-
 test/src/coding-tests.el                           |    2 +-
 test/src/data-tests.el                             |   28 +-
 test/src/decompress-tests.el                       |    2 +-
 test/src/doc-tests.el                              |    2 +-
 test/src/editfns-tests.el                          |   44 +-
 test/src/emacs-module-tests.el                     |   25 +-
 test/src/eval-tests.el                             |    2 +-
 test/src/fileio-tests.el                           |   14 +-
 test/src/floatfns-tests.el                         |    2 +-
 test/src/fns-tests.el                              |    7 +-
 test/src/font-tests.el                             |    2 +-
 test/src/inotify-tests.el                          |    2 +-
 test/src/json-tests.el                             |    6 +-
 test/src/keyboard-tests.el                         |    2 +-
 test/src/keymap-tests.el                           |    2 +-
 test/src/lcms-tests.el                             |    2 +-
 test/src/lread-tests.el                            |    2 +-
 test/src/marker-tests.el                           |    2 +-
 test/src/minibuf-tests.el                          |    2 +-
 test/src/print-tests.el                            |    2 +-
 test/src/process-tests.el                          |   55 +-
 test/src/regex-emacs-tests.el                      |   10 +-
 test/src/syntax-tests.el                           |    2 +-
 test/src/textprop-tests.el                         |    2 +-
 test/src/thread-tests.el                           |    2 +-
 test/src/timefns-tests.el                          |    2 +-
 test/src/undo-tests.el                             |    2 +-
 test/src/xml-tests.el                              |    2 +-
 2769 files changed, 50132 insertions(+), 26944 deletions(-)

diff --git a/.dir-locals.el b/.dir-locals.el
index 68eb58f..9cd3992 100644
--- a/.dir-locals.el
+++ b/.dir-locals.el
@@ -2,8 +2,12 @@
          (sentence-end-double-space . t)
          (fill-column . 70)))
  (c-mode . ((c-file-style . "GNU")
-            (c-noise-macro-names . ("UNINIT" "CALLBACK" "ALIGN_STACK"))))
- (objc-mode . ((c-file-style . "GNU")))
+            (c-noise-macro-names . ("INLINE" "ATTRIBUTE_NO_SANITIZE_UNDEFINED" 
"UNINIT" "CALLBACK" "ALIGN_STACK"))
+            (electric-quote-comment . nil)
+            (electric-quote-string . nil)))
+ (objc-mode . ((c-file-style . "GNU")
+               (electric-quote-comment . nil)
+               (electric-quote-string . nil)))
  (log-edit-mode . ((log-edit-font-lock-gnu-style . t)
                    (log-edit-setup-add-author . t)))
  (change-log-mode . ((add-log-time-zone-rule . t)
@@ -11,4 +15,8 @@
                     (bug-reference-url-format . "https://debbugs.gnu.org/%s";)
                     (mode . bug-reference)))
  (diff-mode . ((mode . whitespace)))
- (emacs-lisp-mode . ((indent-tabs-mode . nil))))
+ (emacs-lisp-mode . ((indent-tabs-mode . nil)
+                     (electric-quote-comment . nil)
+                     (electric-quote-string . nil)))
+ (texinfo-mode . ((electric-quote-comment . nil)
+                  (electric-quote-string . nil))))
diff --git a/.gitattributes b/.gitattributes
index 15f83ae..65a943f 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,6 +1,6 @@
 # Attributes of Emacs files in the Git repository.
 
-# Copyright 2015-2018 Free Software Foundation, Inc.
+# Copyright 2015-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/.gitignore b/.gitignore
index 8ab4e8d..355824f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,6 @@
 # Files that Git should ignore in the Emacs source directory.
 
-# Copyright 2009-2018 Free Software Foundation, Inc.
+# Copyright 2009-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -171,6 +171,7 @@ lib-src/emacsclient
 lib-src/etags
 lib-src/hexl
 lib-src/make-docfile
+lib-src/make-fingerprint
 lib-src/movemail
 lib-src/profile
 lib-src/test-distrib
@@ -184,6 +185,10 @@ src/bootstrap-emacs
 src/emacs
 src/emacs-[0-9]*
 src/temacs
+src/temacs.in
+src/fingerprint.c
+src/dmpstruct.h
+src/*.pdmp
 
 # Character-set info.
 admin/charsets/jisx2131-filter
@@ -194,6 +199,7 @@ lisp/international/charscript.el
 lisp/international/cp51932.el
 lisp/international/eucjp-ms.el
 lisp/international/uni-*.el
+lisp/language/pinyin.el
 
 # Documentation.
 *.aux
@@ -257,6 +263,9 @@ ChangeLog
 # Built by 'make install'.
 etc/emacs.tmpdesktop
 
+# Built by 'make-dist'.
+/MANIFEST
+
 # Distribution directories.
 /emacs-[1-9]*/
 
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 60c4d55..b022e4b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,4 +1,4 @@
-# Copyright (C) 2017-2018 Free Software Foundation, Inc.
+# Copyright (C) 2017-2019 Free Software Foundation, Inc.
 #
 #  This file is part of GNU Emacs.
 #
@@ -22,20 +22,44 @@
 # evaluation purposes, thus possibly temporary.
 
 # Maintainer: address@hidden
-# URL: https://gitlab.com/emacs-ci/emacs
+# URL: https://emba.gnu.org/emacs/emacs
 
 image: debian:stretch
 
+variables:
+  GIT_STRATEGY: fetch
+  EMACS_EMBA_CI: 1
+
 before_script:
   - apt update -qq
-  - DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y -qq 
-o=Dpkg::Use-Pty=0 libc-dev gcc make autoconf automake libncurses-dev gnutls-dev
+  - DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y -qq 
-o=Dpkg::Use-Pty=0 libc-dev gcc make autoconf automake libncurses-dev 
gnutls-dev git
 
 stages:
   - test
 
-test:
+test-all:
+  # This tests also file monitor libraries inotify and inotifywatch.
   stage: test
   script:
+    - DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y 
-qq -o=Dpkg::Use-Pty=0 inotify-tools
     - ./autogen.sh autoconf
     - ./configure --without-makeinfo
-    - make check
+    - make bootstrap
+    - make check-expensive
+
+test-filenotify-gio:
+  stage: test
+  # This tests file monitor libraries gfilemonitor and gio.
+  only:
+    changes:
+      - .gitlab-ci.yml
+      - lisp/filenotify.el
+      - lisp/net/tramp-sh.el
+      - src/gfilenotify.c
+      - test/lisp/filenotify-tests.el
+  script:
+    - DEBIAN_FRONTEND=noninteractive apt install --no-install-recommends -y 
-qq -o=Dpkg::Use-Pty=0 libglib2.0-dev libglib2.0-bin libglib2.0-0
+    - ./autogen.sh autoconf
+    - ./configure --without-makeinfo --with-file-notification=gfile
+    - make bootstrap
+    - make -C test filenotify-tests
diff --git a/CONTRIBUTE b/CONTRIBUTE
index 0b68052..e8bb95d 100644
--- a/CONTRIBUTE
+++ b/CONTRIBUTE
@@ -59,7 +59,10 @@ such patch without additional remarks, you can use a command 
like
 The Emacs issue tracker at https://debbugs.gnu.org lets you view bug
 reports and search the database for bugs matching several criteria.
 Messages posted to the address@hidden mailing list, mentioned
-above, are recorded by the tracker with the corresponding bugs/issues.
+above, are recorded by the tracker with the corresponding
+bugs/issues.  If a message to the bug tracker contains a patch, please
+include the string "[PATCH]" in the subject of the message in order to
+let the bug tracker tag the bug properly.
 
 GNU ELPA has a 'debbugs' package that allows accessing the tracker
 database from Emacs.
@@ -287,15 +290,23 @@ the current release branch.  Periodically, the current 
release branch
 is merged into the master, using the gitmerge function described in
 admin/notes/git-workflow.
 
-If you are fixing a bug that exists in the current release, be sure to
-commit it to the release branch; it will be merged to the master
-branch later by the gitmerge function.
-
-Documentation fixes (in doc strings, in manuals, and in comments)
-should always go to the release branch, if the documentation to be
-fixed exists and is relevant to the release-branch codebase.  Doc
-fixes are always considered "safe" -- even when a release branch is in
-feature freeze, it can still receive doc fixes.
+If you are fixing a bug that exists in the current release, you should
+generally commit it to the release branch; it will be merged to the
+master branch later by the gitmerge function.  However, when the
+release branch is for Emacs version NN.2 and later, or when it is for
+Emacs version NN.1 that is in the very last stages of its pretest,
+that branch is considered to be in a feature freeze: only bug fixes
+that are "safe" or are fixing major problems should go to the release
+branch, the rest should be committed to the master branch.  This is so
+to avoid destabilizing the next Emacs release.  If you are unsure
+whether your bug fix is "safe" enough for the release branch, ask on
+the emacs-devel mailing list.
+
+Documentation fixes (in doc strings, in manuals, in NEWS, and in
+comments) should always go to the release branch, if the documentation
+to be fixed exists and is relevant to the release-branch codebase.
+Doc fixes are always considered "safe" -- even when a release branch
+is in feature freeze, it can still receive doc fixes.
 
 When you know that the change will be difficult to merge to the
 master (e.g., because the code on master has changed a lot), you can
diff --git a/ChangeLog.1 b/ChangeLog.1
index 011b383..8324af3 100644
--- a/ChangeLog.1
+++ b/ChangeLog.1
@@ -14700,7 +14700,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993-1999, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1993-1999, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/ChangeLog.2 b/ChangeLog.2
index 71c792e..d26ea14 100644
--- a/ChangeLog.2
+++ b/ChangeLog.2
@@ -35787,7 +35787,7 @@ See ChangeLog.1 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2015-2018 Free Software Foundation, Inc.
+  Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/ChangeLog.3 b/ChangeLog.3
index a0a4794..235c8bb 100644
--- a/ChangeLog.3
+++ b/ChangeLog.3
@@ -1,3 +1,3792 @@
+2019-03-20  Eli Zaretskii  <address@hidden>
+
+       Improve indexing of the user manual
+
+       * doc/emacs/search.texi (Word Search): Improve indexing of
+       "M-s M-w".
+
+2019-03-19  Basil L. Contovounesios  <address@hidden>
+
+       Fix url-copy-file arglist
+
+       * lisp/url/url-handlers.el: Silence byte-compiler.
+       (url-copy-file): Add 6th argument following change to copy-file in
+       2012-12-16T19:22:27+01:address@hidden (bug#4410)
+
+2019-03-19  Eli Zaretskii  <address@hidden>
+
+       Fix downloading updates for packages with non-ASCII descriptions
+
+       * lisp/emacs-lisp/package.el (package--download-one-archive):
+       Make sure archive contents are written using UTF-8 encoding.
+       (Bug#34909)
+       (list-packages): Set buffer's encoding to UTF-8.
+
+2019-03-18  Nicolas Petton  <address@hidden>
+
+       * etc/NEWS: Remove temporary markers.
+
+2019-03-15  Alan Mackenzie  <address@hidden>
+
+       * doc/misc/cc-mode.texi (Config Basics): in @itemize, @asis -> @w{}
+
+2019-03-15  Eli Zaretskii  <address@hidden>
+
+       Don't clobber 'comint-input-autoexpand' in 'read-shell-command'
+
+       * lisp/shell.el (shell-completion-vars): Set only the
+       buffer-local value of 'comint-input-autoexpand'.  (Bug#34815)
+
+2019-03-13  Martin Rudalics  <address@hidden>
+
+       Document restrictions when setting window margins, fringes or scroll 
bars
+
+       * src/window.c (Fset_window_margins, Fset_window_fringes)
+       (Fset_window_scroll_bars): In doc-strings tell that a window
+       must be large enough to accommodate fringes, sroll bars and
+       margins of the desired size.
+       * doc/lispref/display.texi (Fringe Size/Pos, Scroll Bars)
+       (Display Margins): Tell that windows must be large enough to
+       accommodate fringes, sroll bars and margins of the desired
+       size.
+
+2019-03-10  Eli Zaretskii  <address@hidden>
+
+       More improvements for 'read-buffer's doc string
+
+       * src/minibuf.c (Fread_buffer): Further improve the doc
+       string.  (Bug#347694)
+
+2019-03-10  Alan Mackenzie  <address@hidden>
+
+       * lisp/progmodes/cc-defs.el: Update c-version to 5.33.2 for Emacs 26.2
+
+2019-03-09  Eli Zaretskii  <address@hidden>
+
+       * src/minibuf.c (Fread_buffer): Minor doc fixes.  (Bug#34749)
+
+2019-03-09  Eli Zaretskii  <address@hidden>
+
+       Fix markup of fake keys in the ELisp manual
+
+       * doc/lispref/keymaps.texi (Menu Bar, Tool Bar): Fix markup of
+       fake keys.  (Bug#34785)
+
+2019-03-09  Eli Zaretskii  <address@hidden>
+
+       Avoid errors in Auto Revert mode
+
+       * lisp/autorevert.el (auto-revert-buffers): Cancel
+       auto-revert-timer only if it is non-nil.  This avoids errors
+       on first invocation of Auto-Revert mode.
+
+2019-03-09  Michael Albinus  <address@hidden>
+
+       Mention empty strings in file name expansion, emacs lisp reference
+
+       * doc/lispref/files.texi (Files, File Name Expansion):
+       Mention also empty strings.
+
+2019-03-08  Alan Mackenzie  <address@hidden>
+
+       cc-mode.texi: Work around makeinfo alignment bug.  Fix problem with ss 
index
+
+       * doc/misc/cc-mode.texi (top level): Using txicommandconditionals to
+       differentiate between the C and perl versions of Texinfo, create an "ss
+       index" unless we are both using the C Texinfo and are building the .dvi 
output
+       format.
+       (Config Basics): Work around a perl Texinfo alignment bug by writing a
+       separate version of an item list structure for this version, 
simplifying it
+       considerably.
+
+2019-03-08  Martin Rudalics  <address@hidden>
+
+       Warn against recursive invocations of 'buffer-list-update-hook' 
(Bug#34765)
+
+       * src/buffer.c (Vbuffer_list_update_hook):
+       * doc/lispref/buffers.texi (Buffer List): Warn against
+       recursive invocations of 'buffer-list-update-hook' (Bug#34765).
+
+2019-03-08  Martin Rudalics  <address@hidden>
+
+       Provide more details in doc-string of 'delete-windows-on' (Bug#34749)
+
+       * lisp/window.el (delete-windows-on): Provide more details in
+       doc-string (Bug#34749).
+
+2019-03-08  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'delete-windows-on'
+
+       * doc/emacs/windows.texi (Change Window): Document
+       'delete-windows-on'.
+
+       * lisp/window.el (delete-windows-on): Doc fix.  (Bug#34749)
+
+2019-03-08  Eli Zaretskii  <address@hidden>
+
+       * lisp/frame.el (make-frame-command): Doc fix.  (Bug#34715)
+
+2019-03-07  Eli Zaretskii  <address@hidden>
+
+       Avoid undefined behavior in gdb-mi.el
+
+       * lisp/progmodes/gdb-mi.el (gdb-send): Don't call match-string
+       if this is not a control command.  (Bug#34769)
+
+2019-03-06  Martin Rudalics  <address@hidden>
+
+       * lisp/window.el (fit-frame-to-buffer): Make doc-string more accurate.
+
+2019-03-05  Basil L. Contovounesios  <address@hidden>
+
+       Minor spelling and grammar fixes (bug#34756)
+
+       doc/misc/cc-mode.texi (Style Variables, Customizing Indentation):
+       doc/misc/ede.texi (Extending EDE, ede-project-placeholder)
+       (ede-target, ede-proj-target, ede-compilation-program, ede-compiler)
+       (ede-linker): Remove apostrophe from possessive "it's".
+       doc/lispintro/emacs-lisp-intro.texi (Find a File):
+       doc/misc/gnus-faq.texi (FAQ 2-2): Write "an other" as a single word.
+       doc/misc/gnus.texi (Article Buttons):
+       lisp/gnus/gnus-art.el (gnus-button-mid-or-mail-heuristic-alist)
+       (gnus-button-mid-or-mail-heuristic): Write singular number of
+       Message-IDs, rather than plural.
+       lisp/gnus/message.el (message-user-fqdn): Capitalize initialism.
+
+2019-03-04  Eli Zaretskii  <address@hidden>
+
+       Minor improvement of documentation of '(when CONDITION . SPEC)'
+
+       * doc/lispref/display.texi (Other Display Specs): Add a caveat
+       to using the '(when CONDITION . SPEC)' display specs.
+
+2019-03-02  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'auto-coding-functions'
+
+       * doc/lispref/nonascii.texi (Default Coding Systems): Clarify
+       that the functions in 'auto-coding-functions' are called both
+       for decoding and for encoding.
+
+       * lisp/international/mule.el (auto-coding-functions): Doc fix.
+
+2019-03-02  Eli Zaretskii  <address@hidden>
+
+       Fix visiting XML files with non-Unix EOL format
+
+       * lisp/international/mule.el (sgml-xml-auto-coding-function)
+       (sgml-html-meta-auto-coding-function): Don't use
+       'buffer-file-coding-system' if the buffer is unibyte.
+       (Bug#34704)
+
+2019-03-02  Basil L. Contovounesios  <address@hidden>
+
+       Update example major mode code in Elisp manual
+
+       * doc/lispref/modes.texi (Example Major Modes): Update code examples
+       to reflect current state of lisp/textmodes/text-mode.el and
+       lisp/emacs-lisp/lisp-mode.el. (bug#34671)
+
+2019-03-01  Eli Zaretskii  <address@hidden>
+
+       Fix a typo in the Calc manual
+
+       * doc/misc/calc.texi (Algebraic Tutorial): Fix parentheses in
+       @example.  (Bug#34689)
+
+2019-03-01  Eli Zaretskii  <address@hidden>
+
+       Minor improvement in cross-references of the ELisp manual
+
+       * doc/lispref/modes.texi (Minor Mode Conventions): Add
+       cross-references to related major-mode descriptions.  (Bug#34678)
+
+2019-03-01  Tobias Bading  <address@hidden>  (tiny change)
+
+       Fix last change on 'compilation-parse-errors'
+
+       * lisp/progmodes/compile.el (compilation-parse-errors): Fix
+       previous change in this function.  (Bug#34479)
+
+2019-02-25  Dmitry Gutov  <address@hidden>
+
+       Backport: js--re-search-backward-inner: Fix infloop
+
+       Fix JS indentation infloop reported in
+       https://github.com/mooz/js2-mode/issues/513.
+
+       * lisp/progmodes/js.el (js--re-search-backward-inner): Account for
+       multiline string literals.
+       * test/manual/indent/js.js: New test example.
+
+       (cherry picked from commit b01a4295c2f9bb58858880e4e28b05cc8396791c)
+
+2019-02-23  Eli Zaretskii  <address@hidden>
+
+       Minor improvement for docs of completion
+
+       * doc/lispref/minibuf.texi (Completion Commands)
+       (Completion in Buffers, Programmed Completion): Add to text
+       that references completion tables a cross-reference to where
+       "completion table" is described.
+       (Programmed Completion): Fix the description of
+       'completion-table-dynamic'.  Add more cross-references.
+
+2019-02-22  Ken Brown  <address@hidden>
+
+       Disable the timerfd interface on Cygwin
+
+       * configure.ac (emacs_cv_have_timerfd): Set to "no" on Cygwin.
+
+2019-02-22  Eli Zaretskii  <address@hidden>
+
+       Fix a typo in the doc string of 'regex-opt'
+
+       * lisp/emacs-lisp/regexp-opt.el (regexp-opt): Fix example in
+       the doc string.  (Bug#34596)
+
+2019-02-21  Michael Albinus  <address@hidden>
+
+       Document bash 5.0.0 misbehavior in tramp.texi (Bug#34192)
+
+       * doc/misc/tramp.texi (Frequently Asked Questions): Warn about
+       bash 5.0.0 and HISTSIZE=0.  (Bug#34192)
+
+2019-02-20  Nicolas Petton  <address@hidden>
+
+       Bump Emacs version to 26.1.92
+
+       * README:
+       * configure.ac:
+       * msdos/sed2v2.inp:
+       * nt/README.W32: Bump Emacs version to 26.1.92.
+
+2019-02-20  Nicolas Petton  <address@hidden>
+
+       * ; ChangeLog.3 update
+
+       * etc/AUTHORS: Update.
+
+2019-02-20  Glenn Morris  <address@hidden>
+
+       Remove .art from the default list of ImageMagick extensions
+
+       It seems that .art files can be non-image files that
+       ImageMagick mistakenly treats as extremely large images.
+       Real .art images seem rare.
+       * lisp/image.el (imagemagick-enabled-types): Remove ART.  (Bug#22289)
+
+2019-02-19  Eli Zaretskii  <address@hidden>
+
+       Fix input after setting x-wait-for-event-timeout nil
+
+       * src/w32term.c (x_make_frame_visible): Call unblock_input
+       before returning early.  (Bug#34575)
+
+2019-02-19  Martin Rudalics  <address@hidden>
+
+       Fix two warnings in eshell.texi
+
+       * doc/misc/eshell.texi (Built-ins, Globbing): Fix `.' or `,'
+       must follow @xref, not `f' warnings.
+
+2019-02-18  Stefan Monnier  <address@hidden>
+
+       * lisp/minibuffer.el (completion-table-dynamic): Improve docstring
+
+2019-02-18  David Pathakjee  <address@hidden>  (tiny change)
+
+       * lisp/emacs-lisp/debug.el (debug-on-variable-change): Doc fix.  
(Bug#34518)
+
+2019-02-17  Eli Zaretskii  <address@hidden>
+
+       Fix a typo in ELisp manual
+
+       * doc/lispref/abbrevs.texi (Abbrev Table Properties): Fix a
+       typo.  (Bug#34508)
+
+2019-02-16  Paul Eggert  <address@hidden>
+
+       Update citations of Internet RFCs
+
+       For example, RFC 822 has been obsoleted by RFC 2822, which in
+       turn has been obsoleted by RFC 5322.
+       * doc/emacs/ack.texi, doc/lispref/os.texi:
+       * doc/misc/emacs-mime.texi, doc/misc/gnus-coding.texi:
+       * doc/misc/gnus.texi, doc/misc/sc.texi:
+       * lisp/calendar/parse-time.el, lisp/gnus/gnus-cite.el:
+       * lisp/gnus/gnus-util.el, lisp/gnus/message.el:
+       * lisp/gnus/mm-bodies.el, lisp/gnus/nnrss.el:
+       * lisp/mail/feedmail.el, lisp/mail/ietf-drums.el:
+       * lisp/mail/mail-extr.el, lisp/mail/mail-utils.el:
+       * lisp/mail/mailclient.el, lisp/mail/mailheader.el:
+       * lisp/mail/rfc2047.el, lisp/mail/rfc822.el, lisp/mail/rmail.el:
+       * lisp/mail/sendmail.el, lisp/mail/smtpmail.el:
+       * lisp/mail/supercite.el, lisp/mh-e/mh-e.el:
+       * lisp/mh-e/mh-utils.el, lisp/net/imap.el:
+       * lisp/net/newst-backend.el, lisp/org/org-id.el:
+       * lisp/ps-samp.el, lisp/simple.el, lisp/url/url-util.el:
+       Update RFC citations.
+
+2019-02-16  Eli Zaretskii  <address@hidden>
+
+       Fix handling of manpage references divided by hyphenation
+
+       * lisp/man.el (Man-reference-regexp): Accept a newline as part
+       of a manpage name only if it's preceded by a hyphen.  (Bug#34286)
+       (Man-translate-references): Adapt to change in
+       'Man-reference-regexp'.
+       (Man-default-man-entry): Support references divided between
+       two lines by an ASCII hyphen.  This is a left-over from fixing
+       bug#6289.
+
+2019-02-16  Gregor Zattler  <address@hidden>  (tiny change)
+
+       * doc/misc/eshell.texi: Fix some @ref's.
+
+2019-02-16  Eli Zaretskii  <address@hidden>
+
+       Fix a typo in lispref/syntax.texi
+
+       * doc/lispref/syntax.texi (Syntax Table Internals): Fix a
+       typo.  (Bug#34495)
+
+2019-02-15  Victor J. Orlikowski  <address@hidden>  (tiny change)
+
+       Avoid errors in erc-dcc.el when erc-dcc-verbose is non-nil
+
+       * lisp/erc/erc-dcc.el (erc-dcc-get-filter): Don't assume STR
+       is always a string.  Use 'buffer-name' to get the DCC file
+       name, as buffer-file-name is not set in the process buffer.
+
+2019-02-15  Daniel Lopez  <address@hidden>  (tiny change)
+
+       Fix faces in compilation messages
+
+       * lisp/progmodes/compile.el (compilation-parse-errors): Don't
+       clobber the value of TYPE inside the loop.  (Bug#34479)
+
+2019-02-15  Gregor Zattler  <address@hidden>
+
+       * doc/misc/eshell.texi (Built-ins): Fix alias description
+
+       Dear eamcs developers, eshells current documentation first states
+       that alias definitions are not saved to an alias file, later that
+       they are saved to an alias file.  I tested it and the latter is
+       correct.
+
+       Please find attached a patch which fixes this.
+
+       Thanks for working on emacs which is really great, Gregor
+
+       >From 1fe51cc769ab7a30d0896fb3d6105c0561243fa7 Mon Sep 17 00:00:00 2001
+       From: Gregor Zattler <address@hidden>
+       Date: Wed, 13 Feb 2019 20:19:38 +0100
+       Subject: * doc/misc/eshell.texi (Built-ins): Fix alias description.
+
+       Bring description of built-in 'alias' in line with (info "(eshell) 
Aliases"),
+       which describes the actual behaviur.
+
+       (cherry picked from commit a48099ce7ff63cda416a870766fe61f5b8ac7c2c)
+
+2019-02-14  Katsumi Yamaoka  <address@hidden>
+
+       Work for empty MIME attachments (related to bug#34387)
+
+       * lisp/gnus/mm-view.el (mm-inline-text):
+       Make undisplayer do nothing if the part is empty.
+
+       * lisp/gnus/mm-decode.el (mm-copy-to-buffer): Work for empty MIME part.
+       * lisp/gnus/mml.el (mime-to-mml): Ditto.
+
+2019-02-14  Jackson Ray Hamilton  <address@hidden>
+
+       Backport: js-indent-align-list-continuation: Make variable safe
+
+       * lisp/progmodes/js.el (js-indent-align-list-continuation): Indicate
+       variable is safe as a file-local variable.  This fixes the
+       js-indent-align-list-continuation-nil test when run with make.
+
+       (cherry picked from commit dd319f2711f895eec87c1017b82cd9d88d9ecd0a)
+
+2019-02-13  Eli Zaretskii  <address@hidden>
+
+       Avoid crashes upon C-g in nested invocations of 'read_char'
+
+       * src/keyboard.c (read_char, read_event_from_main_queue):
+       Ensure the global value of getcjmp is restored when the stack
+       is unwound by the likes of 'throw', by calling
+       record_unwind_protect_ptr instead of restoring the value
+       manually.  (Bug#34394)
+       (restore_getcjmp): Argument is now 'void *', to match the
+       signature of record_unwind_protect_ptr.
+
+       (cherry picked from commit 10527fca66e39d7067986904161fa33741abcd26)
+
+2019-02-12  Stefan Monnier  <address@hidden>
+
+       * src/data.c (Fmake_local_variable): Fix bug#34318
+
+       Revert part of ed962f2b8a.
+
+       * test/src/data-tests.el (data-tests-make-local-forwarded-var):
+       Add corresponding test.
+
+2019-02-12  Eli Zaretskii  <address@hidden>
+
+       Minor fixes in ELisp manual wrt syntax-table properties
+
+       * doc/lispref/syntax.texi (Syntax Properties): Fix reference
+       to syntax-table properties.  (Bug#34455)
+       (Control Parsing): Remove redundant @vindex entry.
+
+2019-02-12  Michael Albinus  <address@hidden>
+
+       * admin/notes/emba: New file.
+
+2019-02-11  Eli Zaretskii  <address@hidden>
+
+       Fix Hunspell invocation for discovering its dictionaries
+
+       * lisp/textmodes/ispell.el
+       (ispell-find-hunspell-dictionaries): Invoke Hunspell with the
+       -a switch, to prevent it from initializing its curses UI.
+       (Bug#34272)
+
+2019-02-08  Eli Zaretskii  <address@hidden>
+
+       Minor improvements to do strings in callproc.c
+
+       * src/callproc.c (Fcall_process, Fcall_process_region): Minor
+       fixes to doc strings.  Suggested by Nicholas Drozd
+       <address@hidden>.  (Bug#34274)
+
+2019-02-08  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'date-to-time' and 'parse-time-string'
+
+       * doc/lispref/os.texi (Time Parsing): Document
+       'parse-time-string', and refer to it for the description of
+       the argument of 'date-to-time'.
+
+       * lisp/calendar/time-date.el (date-to-time): Refer in the doc
+       string to 'parse-time-string' for more information about the
+       format of the DATE argument.  (Bug#34303)
+
+2019-02-08  Nick Drozd  <address@hidden>
+
+       Fix downloading of URLs that end in a slash
+
+       * lisp/net/eww.el (eww-download-callback): Fix download URL
+       file name.  Previously this wasn't handling download URLs
+       correctly, resulting in all downloaded pages being named
+       "!", "!(1)", etc.  (Bug#34291)
+
+2019-02-08  Nick Drozd  <address@hidden>
+
+       * doc/misc/eww.texi (Basics): Fix eww keybindings.  (Bug#34291)
+
+2019-02-08  Robert Pluim  <address@hidden>
+
+       Fix process-thread docstring
+
+       * src/process.c (Fprocess_thread): Correct docstring.
+
+2019-02-08  Eli Zaretskii  <address@hidden>
+
+       Fix failures of vc-find-revision with non-ASCII file names
+
+       * lisp/vc/vc.el (vc-find-revision): Instead of binding
+       coding-system-for-write, make the buffer-file-coding-system of
+       the temporary buffer be no-conversion.  This avoids the
+       unwanted side effect of not encoding the command-line
+       arguments of the VCS commands invoked by the backend.
+       (Bug#34350)
+
+2019-02-07  Eli Zaretskii  <address@hidden>
+
+       * doc/lispref/tips.texi (Documentation Tips): Fix quotes.  (Bug#34372)
+
+2019-02-05  Alex Branham  <address@hidden>
+
+       Add documentation for tabulated-list functions in the elisp manual
+
+       * doc/lispref/modes.texi: Add documentation for
+         'tabulated-list-delete-entry', 'tabulated-list-get-id',
+         'tabulated-list-get-entry', 'tabulated-list-header-overlay-p',
+         'tabulated-list-put-tag', and 'tabulated-list-set-col'.
+
+       Bug#21074
+
+2019-02-03  Jean-Christophe Helary  <address@hidden>
+
+       Fix URL in ucs-normalize.el
+
+       * lisp/international/ucs-normalize.el: Fix URL of the HFS
+       normalization reference.  (Bug#34300)
+
+2019-02-03  Alan Mackenzie  <address@hidden>
+
+       * etc/PROBLEMS: Amend entry for profiler bug #34235 to mention kernel 
4.14.97
+
+2019-02-02  Glenn Morris  <address@hidden>
+
+       * make-dist: Remove references to src/stamp-h.in.
+
+       This file was removed two years ago in 2f89350.
+       No need to merge to master.
+
+2019-02-02  Paul Eggert  <address@hidden>
+
+       * etc/PROBLEMS: Mention profiler-report bug (Bug#34235).
+
+2019-02-01  Eli Zaretskii  <address@hidden>
+
+       Correct the docs of inserting kmacro counter
+
+       * doc/emacs/kmacro.texi (Keyboard Macro Counter): Correct the
+       description of the affect "C-u" has on inserting the macro
+       counter.  Define "previous counter value".
+
+       * lisp/kmacro.el (kmacro-insert-counter)
+       (kmacro-start-macro-or-insert-counter): Fix the doc strings
+       regarding the effect of "C-u".  (Bug#34263)
+
+2019-02-01  Nicholas Drozd  <address@hidden>
+
+       * doc/misc/calc.texi (Algebraic Tutorial): Fix a typo.  (Bug#34273)
+
+2019-02-01  Eli Zaretskii  <address@hidden>
+
+       Avoid errors in 'rmail-get-new-mail'
+
+       * lisp/mail/rmail.el (rmail-insert-inbox-text): Don't assume
+       the Rmail protocol is always a string when calling
+       'rmail-remote-proto-p'.  (Bug#34252)
+
+2019-01-31  Paul Eggert  <address@hidden>
+
+       Fix process-contact bug with TCP connections
+
+       This fixes a regression from Emacs 25.3 (Bug#34134).
+       * src/process.c (server_accept_connection):
+       Set host correctly, fixing a bug introduced in
+       2017-09-16T21:29:address@hidden
+       when working around a GCC bug.
+
+2019-01-29  Eli Zaretskii  <address@hidden>
+
+       Minor copyedits in last manual change
+
+       * doc/emacs/custom.texi (Authentication): Improve markup,
+       indexing, and wording.
+
+2019-01-29  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of face numbers
+
+       * doc/lispref/display.texi (Face Functions): Mention where the
+       face number is used and that it depends on the 'face' property
+       of the face symbol.  Improve indexing.
+
+2019-01-27  Michael Albinus  <address@hidden>
+
+       * doc/emacs/custom.texi (Authentication): Refer to the "Help for users" 
node.
+
+2019-01-26  Michael Albinus  <address@hidden>
+
+       New node Authentication in the Emacs manual
+
+       * doc/emacs/custom.texi (Customization):
+       * doc/emacs/emacs.texi (Top): Add node Authentication.
+
+2019-01-25  Alan Mackenzie  <address@hidden>
+
+       Fix a loop in c-fl-decl-start.  This fixes bug #34186.
+
+       * lisp/progmodes/cc-mode.el (c-fl-decl-start) In the pair of operations
+       c-syntactic-skip-backward and c-forward-syntactic-ws, ensure the latter
+       doesn't come back to the position before the former, and break out of 
the
+       enclosing loop if it does.
+
+2019-01-25  Eli Zaretskii  <address@hidden>
+
+       Fix LaTeX output of month and day from cal-tex.el
+
+       * lisp/calendar/cal-tex.el (cal-tex-cursor-week-iso)
+       (cal-tex-week-hours): Escape a lone blank, to make it through
+       LaTeX.  (Bug#34148)
+
+2019-01-25  Daniel Kahn Gillmor  <address@hidden>  (tiny change)
+
+       Avoid elisp crash for OpenPGP User IDs with no e-mail address
+
+       * lisp/gnus/mml-sec.el (mml-secure-check-user-id): Verify that
+       there is an e-mail address in the current User ID before trying
+       to downcase it.  (Bug#34121)
+
+2019-01-25  Benjamin Riefenstahl  <address@hidden>
+
+       image-mode: Do not use default scaling (bug#33990)
+
+       * lisp/image-mode.el (image-toggle-display-image): Set :scale == 1 so
+       that create-image does not apply additional scaling.
+
+2019-01-25  Benjamin Riefenstahl  <address@hidden>
+
+       create-image: Expand documentation (bug#33990)
+
+       * lisp/image.el (create-image): Discuss default for :scale in the doc
+       string.
+
+2019-01-21  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'isearch-filter-predicate'
+
+       * lisp/isearch.el (isearch-filter-predicate)
+       (isearch-filter-visible): Doc fixes.  (Bug#34150)
+
+2019-01-19  Trevor Spiteri  <address@hidden>  (tiny change)
+
+       Fix cursor column positioning on Grep hits
+
+       * lisp/progmodes/grep.el (grep-match-face): Move before first
+       use, to avoid byte-compilation warning.
+       (grep-regexp-alist): Don't quote grep-match-face.  (Bug#34068)
+
+2019-01-18  Eli Zaretskii  <address@hidden>
+
+       Fix a typo in ELisp manual
+
+       * doc/lispref/nonascii.texi (Converting Representations): Fix
+       inconsistency between @defun and the argument description of
+       'byte-to-string'.  (Bug#34119)
+
+2019-01-15  Alan Third  <address@hidden>
+
+       Prevent redrawing if frame is garbaged
+
+       * src/nsterm.m ([EmacsView viewWillDraw]): Cancel drawing if the frame
+       has been garbaged.
+       * src/xdisp.c (expose_window_tree, expose_frame): Remove NS only
+       exceptions.
+
+2019-01-14  Eli Zaretskii  <address@hidden>
+
+       Attempt to fix hangs on MS-Windows due to C-g
+
+       * src/w32uniscribe.c (uniscribe_otf_capability): Set
+       inhibit-quit around calls to otf_features, because the latter
+       cons Lisp data structures while we are in a critical section.
+       * src/xdisp.c (ALLOCATE_HDC) [HAVE_NTGUI]: Set inhibit-quit.
+       (RELEASE_HDC) [HAVE_NTGUI]: Restore inhibit-quit.
+       (OPTIONAL_HDC, DECLARE_HDC): Remove macros, their job is now
+       done by ALLOCATE_HDC and by a single #ifdef.
+       (draw_glyphs): Adapt to the above changes in macros.
+       (Bug#34059)
+
+2019-01-13  Eli Zaretskii  <address@hidden>
+
+       Fix Calc graph output on MS-Windows
+
+       The previous code relied on "pgnuplot" executable, which is
+       no longer provided with Gnuplot 5.x.
+       * lisp/calc/calc.el (calc-gnuplot-name): Set to "pgnuplot" on
+       MS-Windows only if such an executable exists.
+       * lisp/calc/calc-graph.el (calc-graph-w32-p): New defsubst.
+       (calc-graph-plot, calc-graph-command, calc-gnuplot-command)
+       (calc-graph-init): Call calc-graph-w32-p wherever we need to
+       do something special for invoking gnuplot on MS-Windows,
+       instead of comparing against calc-gnuplot-name.
+       (calc-graph-plot): Set the terminal to "qt" on MS-Windows when
+       pgnuplot.exe is not available.
+       (calc-graph-kill): Delete the temporary files only after
+       killing the gnuplot process, otherwise the deletion might fail
+       on MS-Windows because the files are still in use.
+
+2019-01-13  Eli Zaretskii  <address@hidden>
+
+       Fix a minor mistake in ELisp manual
+
+       * doc/lispref/buffers.texi (Modification Time): Fix
+       documentation of 'visited-file-modtime'.  (Bug#34055)
+
+2019-01-12  Stephen Berman  <address@hidden>
+
+       * etc/tutorials/TUTORIAL: Fix typo (bug#34049)
+
+2019-01-12  Devon Sean McCullough  <address@hidden>
+
+       Fix UI of Buffer-menu
+
+       * lisp/buff-menu.el (Buffer-menu-execute): Don't remove
+       entries of buffers whose killing the user didn't confirm.
+       (Bug#33669)
+
+2019-01-12  Philip K  <address@hidden>  (tiny change)
+
+       Reinitialize ispell-really-enchant when changing the speller
+
+       * lisp/textmodes/ispell.el (ispell-check-version): Reset also
+       ispell-really-enchant.  (Bug#34019)
+
+2019-01-07  Leo Liu  <address@hidden>
+
+       Speed up loading css-mode
+
+       lisp/textmodes/css-mode.el: Remove (require 'eww) which is redundant
+       and slow.  (Bug#33939)
+
+2019-01-07  Michael Albinus  <address@hidden>
+
+       Adapt filenotify-tests for emba
+
+       * .gitlab-ci.yml (test): Add EMACS_EMBA_CI variable.
+
+       * test/lisp/filenotify-tests.el (file-notify-test03-events)
+       (file-notify-test05-file-validity)
+       (file-notify-test06-dir-validity)
+       (file-notify-test07-many-events)
+       (file-notify-test09-watched-file-in-watched-dir): Adapt tests for emba.
+
+2019-01-07  Nicolas Petton  <address@hidden>
+
+       Bump Emacs version to 26.1.91
+
+       * README:
+       * configure.ac:
+       * msdos/sed2v2.inp:
+       * nt/README.W32: Bump Emacs version to 26.1.91.
+
+2019-01-07  Nicolas Petton  <address@hidden>
+
+       * etc/AUTHORS: Update.
+
+2019-01-07  Leo Liu  <address@hidden>
+
+       * lisp/textmodes/mhtml-mode.el: Avoid loading flyspell.  (Bug#33939)
+
+2019-01-07  Paul Eggert  <address@hidden>
+
+       Improve GC+Cairo workaround
+
+       Suggested by Eli Zaretskii (Bug#20890#31).
+       * src/font.h (font_data_structures_may_be_ill_formed): New function.
+       * src/ftfont.c (ftfont_close):
+       * src/ftcrfont.c (ftcrfont_close): Use it.
+
+       (cherry picked from commit d02fd482fbeaf6ed551e78223b538495cb0c3541)
+
+2019-01-07  Paul Eggert  <address@hidden>
+
+       Work around GC+Cairo bug
+
+       Workaround suggested by Robert Pluim (Bug#20890#13).
+       * src/ftfont.c (ftfont_close) [USE_CAIRO]:
+       Do nothing if GC is in progress.
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Improve commentary in font.h
+
+       * src/font.h (struct font, struct font_driver): Fix typos and
+       wording in comments.  Document all driver methods.
+
+2019-01-07  Martin Rudalics  <address@hidden>
+
+       Fix definition of Qwindow_point_insertion_type (Bug#33871)
+
+       * src/window.c (Qwindow_point_insertion_type): Fix definition
+       (Bug#33871).
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'server-name'
+
+       * doc/emacs/misc.texi (Emacs Server, TCP Emacs server)
+       (emacsclient Options):
+       * lisp/server.el (server-name):  Document the usage of
+       'server-name' to specify the server file as an absolute file
+       name.  Do not merge to master.  (Bug#33934)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Update Unicode copyright notice
+
+       * admin/unidata/copyright.html: Updated version from the
+       Unicode Consortium's site.
+
+2019-01-07  Michael Albinus  <address@hidden>
+
+       Handle quoted file names in filenotify.el
+
+       * lisp/filenotify.el (file-notify-add-watch): Do not save
+       quoted file names in `file-notify-descriptors'.
+
+       * test/lisp/files-tests.el
+       (files-file-name-non-special-notify-handlers): Do not expect
+       to fail.
+
+2019-01-07  Paul Eggert  <address@hidden>
+
+       Fix copyright years by hand
+
+       These are dates that admin/update-copyright did not update, or
+       updated incorrectly.
+
+2019-01-07  Paul Eggert  <address@hidden>
+
+       Update copyright year to 2019
+
+       Run 'TZ=UTC0 admin/update-copyright $(git ls-files)'.
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       * doc/man/emacs.1.in: Fix value of default frame height.  (Bug#33921)
+
+2019-01-07  Martin Rudalics  <address@hidden>
+
+       In user manual fix value of default frame height (Bug#33921)
+
+       * doc/emacs/cmdargs.texi (Window Size X): Fix value of default
+       frame height (Bug#33921).
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'file-local-name' and related APIs
+
+       * doc/lispref/files.texi (Unique File Names)
+       (Magic File Names, File Name Expansion): Improve documentation
+       of the "local part" of a remote file name.
+       * doc/lispref/processes.texi (Synchronous Processes)
+       (Asynchronous Processes): State explicitly that program and
+       file names passed to functions that start remote processes
+       need to be relative or obtained by 'file-local-name'.
+
+       * lisp/files.el (file-local-name):
+       * lisp/simple.el (start-file-process, process-file): Improve
+       the documentation of the "local part" of a remote file name,
+       and its use in APIs that start remote processes.
+
+2019-01-07  Michael Albinus  <address@hidden>
+
+       Fix Bug#31704.  Do not merge
+
+       * lisp/net/tramp.el (tramp-eshell-directory-change):
+       Use `path-separator' as it does eshell.  (Bug#31704)
+
+2019-01-07  Michael Albinus  <address@hidden>
+
+       Fix Bug#31704.  Do not merge
+
+       * lisp/eshell/esh-proc.el (eshell-gather-process-output): Do not
+       let `expand-file-name' prefix remote file names with MS Windows
+       volume letter.
+
+       * lisp/net/tramp.el (tramp-eshell-directory-change):
+       Use `path-separator' as it does eshell.  (Bug#31704)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       * lisp/files.el (cd): Fix last change.  (Bug#33791)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Fix remote directories in Eshell on MS-Windows
+
+       * lisp/files.el (cd): Support remote directory names on
+       MS-Windows.  (Bug#33791)
+
+2019-01-07  Drew Adams  <address@hidden>
+
+       Fix :type 'group' in defcustom
+
+       * lisp/wid-edit.el (group): Fix the :format spec.  (Bug#33566)
+
+2019-01-07  Alan Third  <address@hidden>
+
+       Fix NS fringe bitmap drawing bug (bug#33864)
+
+       * src/nsterm.m (ns_draw_fringe_bitmap): Check the rectangle to clear
+       correctly.
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Fix commentary in dispnew.c
+
+       * src/dispnew.c (buffer_posn_from_coords): Fix inaccuracies in
+       the commentary.
+
+2019-01-07  Paul Eggert  <address@hidden>
+
+       Improve accept-process-process doc
+
+       * doc/lispref/processes.texi (Accepting Output):
+       * src/process.c (Faccept_process_output):
+       Document that (accept-process-output P) can return non-nil
+       even after P has exited, and that it can return nil even if P
+       is still running (Bug#33839).
+
+2019-01-07  Stephen Leake  <address@hidden>
+
+       Fix a simple bug in display-buffer-use-some-frame
+
+       * lisp/window.el (display-buffer-use-some-frame): Simplify the
+       predicate, fix TYPE arg to window--display-buffer.
+
+2019-01-07  Michael Albinus  <address@hidden>
+
+       Clarify thread switching while waiting for process output
+
+       * doc/lispref/threads.texi (Threads): Clarify, that thread
+       switching happens when waiting for process output from
+       asynchronous processes.
+
+2019-01-07  Charles A. Roelli  <address@hidden>
+
+       Improve process doc. with respect to handling of large input (Bug#33191)
+
+       * src/process.c (Fprocess_send_region, Fprocess_send_string):
+       Document that process input longer than the process input
+       buffer may be split into bunches.  Remove an outdated
+       reference to a 500 character split boundary.
+       * doc/lispref/processes.texi (Asynchronous Processes): Remove
+       mention of "stray character injections" in PTY processes.  See
+       also the comment about ICANON in src/sysdep.c, function
+       child_setup_tty.
+
+2019-01-07  Terrence Brannon  <address@hidden>
+
+       Minor copyedits in landmark.el
+
+       * lisp/obsolete/landmark.el: Fix author's email and commentary.
+
+2019-01-07  Alan Mackenzie  <address@hidden>
+
+       Check result from c-backward-token-2 to avoid infinite loop
+
+       This fixes bug #33784.
+
+       * lisp/progmodes/cc-fonts.el (c-get-fontification-context): While 
moving back
+       over enclosing parentheses, check that c-backward-token-2 actually 
moves.
+
+2019-01-07  Paul Eggert  <address@hidden>
+
+       cl-make-random-state was not copying its arg
+
+       Problem reported by Xu Chunyang (Bug#33731).
+       * lisp/emacs-lisp/cl-extra.el (cl-make-random-state):
+       Use copy-sequence, not copy-tree, so that the record is copied.
+       * test/lisp/emacs-lisp/cl-extra-tests.el:
+       (cl-extra-test-cl-make-random-state): New test.
+
+2019-01-07  Glenn Morris  <address@hidden>
+
+       Skip a vc-bzr test if run as root
+
+       * test/lisp/vc/vc-bzr-tests.el (vc-bzr-test-faulty-bzr-autoloads):
+       Skip this test when run as root.  This works around a race
+       condition in root-specific code in vc-mode-line when deleting a file.
+
+2019-01-07  Chris Feng  <address@hidden>
+
+       Backport: Handle unread-command-events consistently (bug#23980)
+
+       * src/keyboard.c (read_char): Events put into `unread-command-events'
+       with the form (t . EVENT) should always have the t stripped when read
+       out.
+       * test/src/keyboard-tests.el: New tests for `unread-command-events'.
+
+       (cherry picked from commit 1f3f4b1296613b8cdc0632a68fde86e86ddad866)
+
+2019-01-07  Glenn Morris  <address@hidden>
+
+       Restrict downcasing in elisp xref tests (bug#25534)
+
+       The tests happen to not fail at the moment because find-library-name
+       now has an extra feature, find-library--from-load-history, which
+       happens to do a case-insensitive regexp match; but still it seems
+       better not to rely on this.
+
+       * test/lisp/progmodes/elisp-mode-tests.el (xref--case-insensitive):
+       New variable.
+       (xref-elisp-test-run, emacs-test-dir): Only downcase if the
+       filesystem seems to be case-insensitive.
+
+2019-01-07  Rob Browning  <address@hidden>
+
+       Avoid test failures if directory name looks like a regexp
+
+       Taken from <https://sources.debian.org/patches/emacs/1:26.1+1-1>
+       * test/lisp/ibuffer-tests.el (ibuffer-filter-inclusion-3):
+       * test/lisp/net/tramp-tests.el (tramp-test42-remote-load-path):
+       Regexp-quote file names to avoid failures with directory names
+       of the form "build/emacs-i87jK3/emacs-26.1+1/...".
+
+2019-01-07  Michael Albinus  <address@hidden>
+
+       Fix Bug#33524
+
+       * lisp/progmodes/flymake-proc.el
+       (flymake-proc-create-temp-with-folder-structure):
+       Unquote file-name.  (Bug#33524)
+
+2019-01-07  Glenn Morris  <address@hidden>
+
+       * doc/lispintro/emacs-lisp-intro.texi (Finding More): Fix xref.
+
+2019-01-07  Paul Eggert  <address@hidden>
+
+       More porting to GCC 8 of --enable-gcc-warnings
+
+       Backport from master.
+       I ran into this when building Emacs 26 with GCC 8 on Fedora 29 x86.
+       * lwlib/lwlib-Xaw.h (xaw_update_one_value, xaw_popup_menu):
+       * lwlib/lwlib-Xlw.h (xlw_update_one_value, xlw_pop_instance):
+       * lwlib/lwlib.h (lw_allow_resizing, lw_set_main_areas) [!USE_MOTIF]:
+       No longer const.
+       * src/emacs-module.c: Ignore -Wcast-function-type.
+
+2019-01-07  Glenn Morris  <address@hidden>
+
+       Fix an epg test for recent GnuPG versions (bug#33439)
+
+       * test/lisp/epg-tests.el (epg-decrypt-1):
+       Tell recent GnuPG (e.g. 2.2.11) not to worry about missing MDC.
+
+2019-01-07  Robert Pluim  <address@hidden>
+
+       Document font structure layout constraints
+
+       This has to be the same as in src/ftcrfont.c and src/ftfont.c
+
+       * src/xftfont.c (struct xftfont_info): Document layout constraints.
+
+2019-01-07  Robert Pluim  <address@hidden>
+
+       Document font structure layout constraints
+
+       The layout of the initial members of ftcrfont_info must match
+       ftfont_info
+
+       * src/ftcrfont.c (struct ftcrfont_info): Likewise.
+
+       * src/ftfont.c (struct ftfont_info): Document layout constraints.
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Fix display of line numbers in empty lines beyond EOB
+
+       * src/xdisp.c (maybe_produce_line_number): When the current
+       line is at EOB, use the 'line-number-current-line' face only
+       on that single line, but not on the rest of empty lines beyond
+       EOB.  (Bug#33732)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Fix redisplay when a window's scroll bar or fringes are changed
+
+       * src/window.c (set_window_fringes, set_window_scroll_bars):
+       Set windows_or_buffers_changed flag to cause immediate
+       thorough redisplay of a window when scroll bars or fringes are
+       changed.  (Bug#33694)
+
+2019-01-07  Martin Rudalics  <address@hidden>
+
+       Tiny markup fix in Elisp manual
+
+       * doc/lispref/lists.texi (Building Lists): Use '@var' instead
+       of '@code' for argument.
+
+2019-01-07  Alan Mackenzie  <address@hidden>
+
+       CC Mode: stop extra parens on expression causing false fontification as 
type
+
+       * lisp/progmodes/cc-fonts.el (c-get-fontification-context): recognize
+       arithmetic operator followed by several open parentheses, not just one, 
as not
+       being an argument list.
+
+2019-01-07  Ari Roponen  <address@hidden>
+
+       Fix cairo scrolling for side-by-side windows
+
+       Backport: Fixes Bug#33442.
+
+       * src/xterm.c (x_scroll_run) [USE_CAIRO]: Fix scrolling for
+       side-by-side split windows.  (Bug#31288)
+
+       (cherry picked from commit 6e362a32bc9d21f73a0f29ca6f45481edeea6f29)
+
+2019-01-07  Alan Mackenzie  <address@hidden>
+
+       CC Mode: stop wrongly recognizing "func(a * 9)" as "pointer to type a"
+
+       * lisp/progmodes/cc-engine.el (c-forward-decl-or-cast-1): When testing 
for an
+       identifier after "a *", on failure additionally check for a digit, 
setting a
+       new flag variable got-number if one is found.  In the test for CASE 18, 
check
+       this flag.
+
+2019-01-07  Stefan Monnier  <address@hidden>
+
+       * lisp/emacs-lisp/cursor-sensor.el: Add motivation
+
+2019-01-07  Raimon Grau  <address@hidden>
+
+       Guard occur against an undefined orig-line
+
+       * lisp/replace.el (occur-engine): Avoid inserting the current line if
+       orig-line is nil.  This happens, for example, when reverting an occur
+       buffer with `list-matching-lines-jump-to-current-line' set to t.
+       (Bug#33476)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Indexing followup to recent changes
+
+       * doc/lispref/text.texi (Special Properties): Index
+       'cursor-sensor-inhibit'.  (Bug#33664)
+
+2019-01-07  Stefan Monnier  <address@hidden>
+
+       Improve documentation of cursor-sensor.el (bug#33664)
+
+       * doc/lispref/text.texi (Special Properties): Mention 
cursor-sensor-inhibit.
+       * lisp/emacs-lisp/cursor-sensor.el (Commentary): Add cursor-sensor-mode.
+       (cursor-sensor-inhibit): Add docstring.
+
+2019-01-07  Stefan Monnier  <address@hidden>
+
+       * doc/lispref/commands.texi (Adjusting Point): Bug#33662
+
+       Tweak text to clarify intangibility.
+
+2019-01-07  Michael Albinus  <address@hidden>
+
+       Tramp multi-hop methods must be inline
+
+       * doc/misc/tramp.texi (Ad-hoc multi-hops): Involved methods must
+       be inline methods.
+
+2019-01-07  Ari Roponen  <address@hidden>
+
+       Fix scaling problem in Cairo builds
+
+       * src/xterm.c (x_begin_cr_clip) [USE_GTK]:
+       (x_update_begin) [USE_CAIRO && USE_GTK]: Support scaling.
+       (Bug#33442)
+
+2019-01-07  Juri Linkov  <address@hidden>
+
+       * lisp/simple.el (next-line-or-history-element): Use current-column
+
+       in all position calculations.
+       (previous-line-or-history-element): Idem.  (Bug#33640)
+
+2019-01-07  Martin Rudalics  <address@hidden>
+
+       A few further fixes of window internals description
+
+       * doc/lispref/internals.texi (Window Internals): Add a few
+       more items and clarify description of some others.
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Revert "Revert "Fix infloop in GC mark_kboards""
+
+       This reverts commit c418c85617babbe7b63730fefb71e2c87a0141af.
+       This reinstates the original fix, as it had nothing to do
+       with the behavior reported in bug#33571, which seems to be
+       the expected behavior.
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Revert "Fix infloop in GC mark_kboards"
+
+       This reverts commit af914fc26db273d8788e7efa57c569f0f778d037,
+       since it caused unintended adverse effects on echoing of keys.
+       (Bug#33571)
+
+2019-01-07  Glenn Morris  <address@hidden>
+
+       * lisp/emacs-lisp/subr-x.el (if-let, when-let): Doc fix: active voice.
+
+2019-01-07  Paul Eggert  <address@hidden>
+
+       Fix infloop in GC mark_kboards
+
+       Do not merge to master, as I have a more systematic fix there.
+       * src/keyboard.c (mark_kboards): Fix infloop (Bug#33547).
+
+2019-01-07  Alan Third  <address@hidden>
+
+       Fix macOS run-time feature check
+
+       * src/nsterm.m (x_set_parent_frame) [NS_IMPL_COCOA]: Fix run-time
+       feature check.
+
+2019-01-07  Stefan Monnier  <address@hidden>
+
+       * etc/NEWS-*: Fix capitalization of "Emacs"
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Fix "M-x man" when there's no 'man' program on PATH
+
+       * lisp/man.el (Man-bgproc-sentinel): Make sure the process
+       buffer is not read-only when inserting a message into it.
+       (Bug#33510)
+
+2019-01-07  Paul Eggert  <address@hidden>
+
+       Fix core dump in dbus-message-internal
+
+       Backport from master.
+       * src/dbusbind.c (Fdbus_message_internal):
+       Don’t go past array end (Bug#33530).
+
+2019-01-07  Michael Albinus  <address@hidden>
+
+       * doc/misc/dbus.texi (Type Conversion): Fix typo.  (Bug#33551)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of gdb-mi.el
+
+       * lisp/progmodes/gdb-mi.el (gdb-show-changed-values)
+       (gdb-max-children): Doc fixes.
+
+       * doc/emacs/building.texi (Source Buffers, Stack Buffer)
+       (GDB User Interface Layout): Mention some additional
+       customizable variables.  (Bug#33548)
+
+2019-01-07  Thomas Fitzsimmons  <address@hidden>
+
+       LDAP: Set process-connection-type to t on Darwin
+
+       * lisp/net/ldap.el (ldap-search-internal): Set
+       process-connection-type to t on Darwin.  Do not merge to
+       master.  (Bug#33050)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Fix a typo in a doc string
+
+       * lisp/emacs-lisp/map-ynp.el (read-answer-short): Fix typo.
+       (Bug#33528)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Minor markup fix in frames.texi
+
+       * doc/lispref/frames.texi (Frame Layout): Fix markup of @table
+       entries.  (Bug#33531)
+
+2019-01-07  Glenn Morris  <address@hidden>
+
+       * lisp/net/trampver.el (customize-package-emacs-version-alist):
+       Add 2.3.3.
+
+       * lisp/mh-e/mh-e.el (customize-package-emacs-version-alist): Additions.
+
+2019-01-07  Glenn Morris  <address@hidden>
+
+       * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Pass format to message.
+
+2019-01-07  Robert Pluim  <address@hidden>
+
+       Don't call xwidget functions until GTK has been initialized
+
+       Follow up fix to Bug#33294.
+
+       * src/gtkutil.c: Define xg_gtk_initialized.
+       (xg_initialize): Set it when GTK has finished initializing.
+
+       * src/gtkutil.h: Declare xg_gtk_initialized.
+
+       * src/xwidget.c (Fmake_xwidget): Error out if GTK has not been
+       initialized.
+       (xwidget_init_view): Likewise.
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of Ediff wordwise commands
+
+       * lisp/vc/ediff.el (ediff-windows-wordwise)
+       (ediff-windows-linewise, ediff-regions-wordwise): Update and
+       clarify the doc strings.
+
+       * doc/misc/ediff.texi (Major Entry Points): Update and clarify
+       the documentation of 'ediff-windows-wordwise' and
+       'ediff-regions-wordwise'.  See the discussion starting at
+       https://lists.gnu.org/archive/html/help-gnu-emacs/2018-11/msg00197.html
+       for the details.
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Support Hunspell 1.7.0 in ispell.el
+
+       * lisp/textmodes/ispell.el
+       (ispell-find-hunspell-dictionaries): Invoke Hunspell with an
+       additional command-line argument, to work around a misfeature
+       in Hunspell 1.7.0 that prevents it from reporting the loaded
+       dictionary.  (Bug#33493)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Avoid clearing echo-area message by auto-save-visited-file-name
+
+       * lisp/emacs-lisp/map-ynp.el (map-y-or-n-p): Record the
+       previous echo-area message, if any, and restore it before
+       exiting.  (Bug#33490)
+
+2019-01-07  Alan Third  <address@hidden>
+
+       Set tooltip text color (bug#33452)
+
+
+       * src/nsmenu.m: ([EmacsTooltip init]): Set text color to black.
+
+2019-01-07  Alan Third  <address@hidden>
+
+       Fix more drawing bugs in NS port (bug#32932)
+
+       * src/nsterm.m (ns_row_rect): New function.
+       (ns_clip_to_row): Remove function.
+       (ns_copy_bits): Fix mistake.
+       (ns_shift_glyphs_for_insert): Mark the frame as dirty instead of
+       directly copying.
+       (ns_draw_fringe_bitmap): Stop using ns_clip_to_row.
+       (ns_draw_window_cursor): Stop using ns_clip_to_row and perform a
+       display when not in redisplay.
+       (ns_update_window_begin): Remove redundant code that never executes.
+       ([EmacsView drawRect:]): Show the rectangle being exposed in NSTRACE.
+       * src/xdisp.c (expose_window_tree) [HAVE_NS]:
+       (expose_frame) [HAVE_NS]: Redraw even if the frame is garbaged.
+
+2019-01-07  Alan Mackenzie  <address@hidden>
+
+       Fix bug #33416, where typing a ) in a comment at EOB caused a loop (CC 
Mode).
+
+       * lisp/progmodes/cc-mode.el (c-fl-decl-start): A c-forward-syntactic-ws 
leaves
+       point inside whitespace when moving over a comment at EOB which has no
+       terminating LF.  Check this possibility and correct for it.
+
+2019-01-07  Ulrich Müller  <address@hidden>
+
+       Update the calc units table
+
+       On 2018-11-16, the 26th meeting of the General Conference on Weights
+       and Measures (CGPM) has redefined the International System of Units by
+       adopting fixed values for the Planck constant, the elementary charge,
+       the Boltzmann constant, and the Avogadro constant:
+       https://www.bipm.org/utils/en/pdf/CGPM/Draft-Resolution-A-EN.pdf
+
+       * lisp/calc/calc-units.el (math-standard-units): Update according
+       to redefinition of the SI in 2018.  (Bug#33412)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Improve indexing in the ELisp manual
+
+       * doc/lispref/control.texi (Control Structures, Sequencing)
+       (Conditionals, Iteration, Catch and Throw, Handling Errors)
+       (Cleanups):
+       * doc/lispref/eval.texi (Self-Evaluating Forms)
+       (Symbol Forms, Function Forms, Macro Forms, Special Forms)
+       (Quoting, Backquote): Add index entries that begin with
+       "forms".  (Bug#33440)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       More Symbola-related extensions for default fontset
+
+       * lisp/international/fontset.el (setup-default-fontset): Add
+       few more blocks of symbols and punctuation supported by latest
+       Symbola.
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Better support for display of U+1F900..U+1F9FF block
+
+       * lisp/international/fontset.el (setup-default-fontset): Add
+       the [#x1F900..#x1F9FF] block to those supported by Symbola.
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'edit-abbrevs-mode'
+
+       * lisp/abbrev.el (edit-abbrevs-mode): Refer to 'edit-abbrevs'
+       for more detailed usage information.  (Bug#33443)
+       (edit-abbrevs): Doc fix.
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'dired-do-compress'
+
+       * lisp/dired-aux.el (dired-do-compress): Describe in the doc
+       string the effect on directories and on compressed archive.
+       (Bug#33450)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Improve doc string and display of 'describe-character'
+
+       * lisp/descr-text.el (describe-char): Explain how does the
+       function obtain the various data about the character.  Don't
+       display "preferred" before "charset": it tends to confuse
+       people.
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       * etc/NEWS: Clarify what 'Z' does in Dired.  (Bug#33450)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Update the docs of object internals
+
+       * doc/lispref/internals.texi (Buffer Internals)
+       (Window Internals, Process Internals): Update the descriptions
+       of Lisp objects.
+
+2019-01-07  Stephen Berman  <address@hidden>
+
+       Fix two Edebug defcustoms (bug#33428)
+
+       * lisp/emacs-lisp/edebug.el (edebug-print-length)
+       (edebug-print-level): Fix customization type to allow setting
+       the documented valid value nil via the Customize interface.
+
+2019-01-07  Michael Albinus  <address@hidden>
+
+       Fix Bug#33141
+
+       * lisp/net/tramp.el (tramp-make-tramp-file-name): Avoid check for
+       empty method with simplified `tramp-syntax'.  (Bug#33141)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of the window tree
+
+       * doc/lispref/windows.texi (Windows and Frames): More accurate
+       wording regarding the relation of a mini-window to its frame's
+       window tree.
+
+       * src/window.h (struct window): Improve commentary to some
+       fields.
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Fix window scrolling on TTY frames when there's no mode line
+
+       * src/window.c (window_internal_height): Remove tests for
+       next, prev, and parent pointers, as they are unrelated to
+       whether a window has a mode line.  (Bug#33363)
+
+2019-01-07  Eli Zaretskii  <address@hidden>
+
+       Fix decoding XML files encoded in ISO-8859
+
+       * lisp/international/mule.el (sgml-xml-auto-coding-function):
+       Avoid signaling an error from coding-system-equal when the XML
+       encoding tag specifies an encoding whose type is 'charset'.
+       (Bug#33429)
+
+2019-01-07  Nicolas Petton  <address@hidden>
+
+       * etc/AUTHORS: Update.
+
+2018-11-18  Martin Rudalics  <address@hidden>
+
+       Fix description of some window hooks
+
+       * doc/lispref/windows.texi (Window Hooks): Remove text that
+       warns against using 'save-window-excursion' while running
+       'window-size-change-functions', it's no more relevant.
+       Clarify description of 'window-configuration-change-hook'.
+
+2018-11-18  Gary Fredericks  <address@hidden>  (tiny change)
+
+       Run 'window--adjust-process-windows' when frame size changes (Bug#32720)
+
+       * lisp/window.el (window-size-change-functions): Run
+       'window--adjust-process-windows' from
+       'window-size-change-functions' too (Bug#32720, "another issue"
+       in Bug#33230).
+
+2018-11-16  Eli Zaretskii  <address@hidden>
+
+       Avoid errors in zone.el when there's overlay at EOB
+
+       * lisp/play/zone.el (zone): Make sure the window-end position
+       is calculated accurately, to avoid errors from
+       buffer-substring.  (Bug#33384)
+
+2018-11-16  Eli Zaretskii  <address@hidden>
+
+       Document Emacs 26 behavior of Dired's 'Z' on directories
+
+       * doc/emacs/dired.texi (Operating on Files): Document behavior
+       of 'Z' on directories.
+
+       * etc/NEWS: Belatedly announce the new behavior of Dired's 'Z'
+       on directory names and on .tar.gz archives.
+
+2018-11-15  Eli Zaretskii  <address@hidden>
+
+       Fix a typo in the Emacs manual
+
+       * doc/emacs/rmail.texi (Rmail Deletion): Fix a typo.
+       Reported by Jorge P. de Morais Neto <address@hidden>
+       in address@hidden
+
+2018-11-15  Paul Eggert  <address@hidden>
+
+       Fix tempfile creation when byte compiling
+
+       This improves on the recent fix for master failing to build
+       on FreeBSD.  Suggested by Stefan Monnier in:
+       https://lists.gnu.org/r/emacs-devel/2018-01/msg00600.html
+       * lisp/emacs-lisp/bytecomp.el (byte-compile-file):
+       Put tempfile next to the target file, as was the original intent.
+
+       (cherry picked from commit 64c846738617d1d037eac0cefb6586c04317b0a1)
+
+2018-11-14  Markus Triska  <address@hidden>
+
+       Small documentation correction.
+
+       * doc/lispref/windows.texi (Textual Scrolling): In the description of
+       scroll-up-aggressively, refer to scroll-down-aggressively instead of
+       a recursive reference to scroll-up-aggressively.  (Bug#33369)
+
+2018-11-14  Eli Zaretskii  <address@hidden>
+
+       * src/coding.c (Fcheck_coding_systems_region): Doc fix.  (Bug#33372)
+
+2018-11-14  Michael Albinus  <address@hidden>
+
+       Fix Bug#33364
+
+       * lisp/net/tramp.el (tramp-parse-sconfig-group): Support also
+       "Host host1 host2 ..." syntax.  (Bug#33364)
+
+2018-11-13  Michael Albinus  <address@hidden>
+
+       * test/README: Explain $REMOTE_TEMPORARY_FILE_DIRECTORY.
+
+2018-11-12  Glenn Morris  <address@hidden>
+
+       Avoid kill-emacs-hook errors hanging batch mode
+
+       * src/emacs.c (Fkill_emacs): Prevent errors from kill-emacs-hook
+       hanging Emacs in batch mode.  (Bug#29955)
+
+       (cherry picked from commit 109da684c5124e22505917fe0255ca66f2a6bfc9)
+
+2018-11-12  Nicolas Petton  <address@hidden>
+
+       Bump Emacs version to 26.1.90
+
+       * README:
+       * configure.ac:
+       * msdos/sed2v2.inp:
+       * nt/README.W32: Bump Emacs version to 26.1.90.
+
+2018-11-12  Nicolas Petton  <address@hidden>
+
+       * etc/AUTHORS: Update.
+
+2018-11-12  Paul Eggert  <address@hidden>
+
+       Work around dumping bug on GNU/Linux ppc64le
+
+       Problem reported by Thomas Fitzsimmons (Bug#33174).
+       Do not merge to master, as we have a better fix there.
+       * src/Makefile.in (emacs$(EXEEXT)):
+       (bootstrap-emacs$(EXEEXT)):
+       Unset EMACS_HEAP_EXEC before invoking temacs.
+
+2018-11-11  Eli Zaretskii  <address@hidden>
+
+       * lisp/files.el (write-file): Clarify the doc string.  (Bug#33339)
+
+2018-11-11  Simen Heggestøyl  <address@hidden>
+
+       Fix typos in midnight.el
+
+       * lisp/midnight.el (clean-buffer-list-delay-general)
+       (clean-buffer-list-kill-regexps)
+       (clean-buffer-list-kill-buffer-names): Fix docstring typos.
+
+2018-11-10  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'move-file-to-trash'
+
+       * doc/emacs/files.texi (Misc File Ops): Index
+       move-file-to-trash.  State that the way to restore trashed
+       files is system-dependent.
+
+2018-11-09  Stefan Monnier  <address@hidden>
+
+       * src/data.c (Ftype_of): xwidget objects are possible! (bug#33294)
+
+       (syms_of_data): Define Qwidget here.
+       * src/xwidget.c (syms_of_xwidget): Instead of here.
+
+2018-11-09  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of Diff mode
+
+       * doc/emacs/files.texi (Diff Mode): Document the effect of
+       prefix argument on the Diff mode's commands.  Document
+       'diff-jump-to-old-file'.
+
+2018-11-09  Noam Postavsky  <address@hidden>
+
+       Note that lex bound lambda forms are not self-quoting (Bug#33199)
+
+       * doc/lispref/functions.texi (Anonymous Functions):
+       * lisp/subr.el (lambda): Note that under lexical binding a lambda form
+       yields a closure object (Bug#33199).
+
+2018-11-08  Martin Rudalics  <address@hidden>
+
+       Rewrite buffer display related doc-strings and doc
+
+       * lisp/window.el (display-buffer-overriding-action)
+       (display-buffer-alist, display-buffer-base-action)
+       (display-buffer-fallback-action, display-buffer-assq-regexp)
+       (display-buffer): Rewrite doc-strings using suggestions by
+       Alan Mackenzie <address@hidden>.
+       (display-buffer-use-some-frame): Adjust doc-string and
+       reformat code.
+       * doc/lispref/windows.texi (Buffer Display Action Alists):
+       Make docs on 'window-height', 'window-width' and
+       'preserve-size' entries more accurate.
+
+2018-11-06  Eli Zaretskii  <address@hidden>
+
+       Fix call to GlobalMemoryStatusEx in w32.c
+
+       * src/w32.c (system_process_attributes): Initialize the size
+       of the data structure passed to GlobalMemoryStatusEx,
+       otherwise it fails.
+
+2018-11-04  Eli Zaretskii  <address@hidden>
+
+       Improve recent changes in documentation of window handling
+
+       * doc/lispref/windows.texi (Displaying Buffers)
+       (Choosing Window, Buffer Display Action Functions)
+       (Buffer Display Action Alists, Choosing Window Options)
+       (Precedence of Action Functions, The Zen of Buffer Display):
+       Fix wording, punctuation, and markup.  Remove redundant
+       cross-references.
+
+       * doc/emacs/windows.texi (Window Choice, Temporary Displays):
+       Fix wording and punctuation.
+
+2018-11-04  Martin Rudalics  <address@hidden>
+
+       Rewrite documentation of buffer display
+
+       * doc/emacs/windows.texi (Window Choice): Rewrite, replacing
+       references to older buffer display options with references to
+       and examples of buffer display actions.
+       (Temporary Displays): Rewrite display of *Completions*
+       example.
+
+       * doc/lispref/elisp.texi (Top): New Windows section
+       'Displaying Buffers'.
+       * doc/lispref/frames.texi (Child Frames): Adjust cross
+       reference.
+       * doc/lispref/windows.texi (Windows): New section 'Displaying
+       Buffers'.  Move sections 'Choosing Window', 'Display Action
+       Functions' and 'Choosing Window Options' there and adjust
+       namings.  Preferably write 'Buffer Display Action' instead of
+       'Display Action'.  More consistently use @w{} to make key
+       binding specifications unsplittable.
+       (Displaying Buffers): New section.
+       (Choosing Window): Make it a subsection of 'Displaying
+       Buffers'.  More explicitly describe how 'display-buffer'
+       compiles its list of action functions and the action alist.
+       (Buffer Display Action Functions): Rename from 'Display Action
+       Functions', make it a subsection of 'Displaying Buffers' and
+       rewrite it.  Elide more detailed descriptions of action alist
+       entries; these are now in the new section 'Buffer Display
+       Action Functions'.  Remove example.
+       (Buffer Display Action Alists): New subsection of 'Displaying
+       Buffers' giving a comprehensive description of recognized
+       action alist entries with appropriate indexing.  Contents were
+       partially moved here from the old 'Display Action Functions'
+       section.
+       (Choosing Window Options): Make it a subsection of 'Displaying
+       Buffers'.  Add examples of how to rewrite old buffer display
+       options with the help of buffer display actions.
+       (Precedence of Action Functions): New subsection of
+       'Displaying Buffers' explaining the execution order of action
+       functions with the help of a detailed example.
+       (The Zen of Buffer Display): New subsection of 'Displaying
+       Buffers' supplying guidelines on how to write and use buffer
+       display actions with examples.
+       (Side Windows, Displaying Buffers in Side Windows)
+       (Frame Layouts with Side Windows, Atomic Windows): Update
+       references to the 'Displaying Buffers' subsections.
+
+2018-11-03  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of destructuring-binding macros
+
+       * lisp/emacs-lisp/pcase.el (pcase-dolist, pcase-let)
+       (pcase-let*): Improve the doc strings.
+
+       * doc/lispref/sequences.texi (Sequence Functions): Improve
+       wording and rename arguments of seq-let to be more
+       descriptive.  Add a cross-reference to "Destructuring with
+       pcase Patterns".
+       * doc/lispref/control.texi (Pattern-Matching Conditional):
+       Improve wording and the menu.
+       (pcase Macro): Incorporate patch suggested by Paul Eggert
+       <address@hidden>.  Reformat text.
+       (Destructuring with pcase Patterns): Rename from
+       "Destructuring patterns", and improve wording and indexing.
+
+2018-11-03  Eli Zaretskii  <address@hidden>
+
+       Avoid byte compilation warning in rcirc.el
+
+       * lisp/net/rcirc.el (rcirc-prompt-start-marker): Move
+       definition before 1st use to avoild byte-compiler warning.
+
+2018-11-03  Basil L. Contovounesios  <address@hidden>
+
+       Avoid race in rcirc process filter (bug#33145)
+
+       * lisp/net/rcirc.el (rcirc-filter): Clear rcirc-process-output
+       before processing its constituent lines.  Otherwise, if rcirc-filter
+       runs again before the last rcirc-process-server-response is
+       finished, the contents of rcirc-process-output could be duplicated.
+
+2018-11-03  Jordan Wilson  <address@hidden>  (tiny change)
+
+       Avoid file-name errors when viewing PDF from Gnus
+
+       * lisp/doc-view.el (doc-view-mode): Run the output file name
+       through 'convert-standard-filename', to avoid problems with
+       characters that are not allowed in file names on some
+       systems.  (Bug#32989)
+
+2018-11-02  Eli Zaretskii  <address@hidden>
+
+       Avoid crashes with remapped default face in Org mode
+
+       * src/xfaces.c (face_at_buffer_position): Look up BASE_FACE_ID
+       anew if it is not in the frame's face cache.  This avoids
+       crashes when Org mode sets up for a new major mode in embedded
+       code fragment, and the default face is remapped.  (Bug#33222)
+
+2018-11-01  Eric Abrahamsen  <address@hidden>
+
+       Doc fix for checkdoc-continue
+
+       * lisp/emacs-lisp/checkdoc.el (checkdoc-continue): There is no second
+         optional argument, and the function always starts from point.
+
+2018-11-01  Eli Zaretskii  <address@hidden>
+
+       Fix a typo in autoload.el
+
+       * lisp/emacs-lisp/autoload.el (update-directory-autoloads):
+       Remove stray backslashes.  (Bug#33231)
+
+2018-10-31  Stefan Monnier  <address@hidden>
+
+       * doc/lispref/control.texi (Destructuring patterns): New subsection.
+
+2018-10-31  Gemini Lasswell  <address@hidden>
+
+       Add regression test for Bug#33014
+
+       Backport from master.
+       * test/src/eval-tests.el:
+       (eval-tests-byte-code-being-evaluated-is-protected-from-gc): New test.
+       (eval-tests-33014-var): New variable.
+       (eval-tests-33014-func, eval-tests-33014-redefine): New functions.
+
+2018-10-31  Paul Eggert  <address@hidden>
+
+       Refer to bytecode constant vectors (Bug#33014)
+
+       Backport from master.
+       * src/bytecode.c (exec_byte_code): Save VECTOR into stack slot
+       so that it survives GC.  The stack slot was otherwise unused,
+       so this doesn’t cost us memory, only a store insn.
+
+2018-10-30  Stefan Monnier  <address@hidden>
+
+       * lisp/emacs-lisp/pcase.el: Improve docstrings.
+
+2018-10-30  Eli Zaretskii  <address@hidden>
+
+       * lisp/emacs-lisp/rx.el (rx): Fix typo in doc string.  (Bug#33205)
+
+2018-10-30  Eli Zaretskii  <address@hidden>
+
+       Improve doc string of 'call-process'
+
+       * src/callproc.c (Fcall_process): Clarify DESTINATION in the
+       doc string.
+
+2018-10-30  Eli Zaretskii  <address@hidden>
+
+       Document that generic functions cannot be commands
+
+       * doc/lispref/commands.texi (Defining Commands):
+       * doc/lispref/functions.texi (Generic Functions): Document
+       that generic functions cannot be turned into commands.
+       (Bug#33170)
+
+2018-10-28  Charles A. Roelli  <address@hidden>
+
+       * lisp/mail/rmailsum.el (rmail-summary-output): Add lost word to doc.
+
+2018-10-28  Charles A. Roelli  <address@hidden>
+
+       Add index entries for more isearch commands/bindings (Bug#32990)
+
+       * doc/emacs/search.texi (Basic Isearch): Index isearch-exit,
+       isearch-abort, isearch-cancel, isearch-repeat-forward,
+       isearch-repeat-backward and their bindings.
+       (Repeat Isearch): Index isearch-ring-advance,
+       isearch-ring-retreat and isearch-edit-string.
+       (Special Isearch): Index isearch-quote-char,
+       isearch-char-by-name and their bindings.  Index
+       isearch-query-replace and isearch-query-replace-regexp, and
+       the latter's binding.  Explain what
+       isearch-query-replace-regexp does.  Index isearch-complete.
+       (Word Search): Index isearch-toggle-word.
+
+2018-10-27  Noam Postavsky  <address@hidden>
+
+       * lisp/simple.el (filter-buffer-substring): Clarify doc (Bug#33179).
+
+2018-10-27  Eli Zaretskii  <address@hidden>
+
+       Fix recent change in lispref/processes.texi.
+
+       * doc/lispref/processes.texi (Asynchronous Processes): Clarify
+       wording.  Suggested by Thomas Fitzsimmons <address@hidden>.
+       (Bug#33050)
+
+2018-10-27  Eli Zaretskii  <address@hidden>
+
+       * lisp/simple.el (region-extract-function): Doc fix.  (Bug#33167)
+
+       * lisp/simple.el (region-bounds): Doc fix.  (Bug#33168)
+
+2018-10-27  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'process-connection-type'
+
+       * doc/lispref/processes.texi (Asynchronous Processes): Clarify
+       better when it is advisable to use pipes for communicating
+       with subprocesses.  (Bug#33050)
+
+2018-10-27  Pierre Téchoueyres  <address@hidden>
+
+       Unify prompt for gnupg passphrase between GNU/Linux and MS-Windows.
+
+       * lisp/epg.el (epg--start): Use 'raw-text' for coding system instead
+       of 'binary', in order to avoid spurious carriage return on Microsoft
+       Windows and MS-DOS when prompting for a password.  (Bug#33040)
+
+2018-10-27  Eli Zaretskii  <address@hidden>
+
+       Doc fix of 'gnus-fetch-old-headers'
+
+       * lisp/gnus/gnus-sum.el (gnus-fetch-old-headers): Avoid
+       treating 'some' and 'invisible' as symbols that need to be
+       hyperlinked.  Reported by Robert Pluim <address@hidden>.
+       (Bug#33090)
+
+2018-10-27  Eric Abrahamsen  <address@hidden>
+
+       Deactivate incorrect hyperlinking in gnus-build-sparse-threads doc
+
+       * lisp/gnus/gnus-sum.el (gnus-build-sparse-threads): Add the word
+       "symbol" so it doesn't link to the `some' function.  (Bug#33090)
+
+2018-10-27  Eli Zaretskii  <address@hidden>
+
+       Minor copyedits in cmdargs.texi
+
+       * doc/emacs/cmdargs.texi (Initial Options): Document '-nsl'.
+       Add a cross-reference to "Writing Dynamic Modules".
+
+2018-10-27  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of X resource loading
+
+       * doc/emacs/cmdargs.texi (Initial Options):
+       * doc/emacs/frames.texi (Frame Parameters):
+       * doc/emacs/xresources.texi (Resources): Document the
+       '--no-x-resources' command-line option and the fact that X
+       resources override .emacs settings of frame parameters.
+       (Bug#32975)
+
+2018-10-27  Michael Albinus  <address@hidden>
+
+       * lisp/net/tramp-sh.el (tramp-inline-compress-commands):
+
+       Suppress warnings about obsolete environment variable GZIP.
+
+2018-10-25  Noam Postavsky  <address@hidden>
+
+       Don't error when indenting malformed Lisp (Bug#30891)
+
+       * lisp/emacs-lisp/lisp-mode.el (lisp-indent-calc-next): If we run out
+       of indent stack, reset the parse state.
+
+2018-10-25  Charles A. Roelli  <address@hidden>
+
+       Improve 'isearch-delete-char' documentation (Bug#32990)
+
+       * doc/emacs/search.texi (Basic Isearch): Index
+       'isearch-delete-char', its keybinding and the isearch "input
+       item" concept, and define the latter.
+       (Error in Isearch): Clarify the different uses of DEL and
+       C-M-w during isearch.
+
+       * lisp/isearch.el (isearch-delete-char): Correct its
+       documentation and link to the Info node '(emacs)Basic Isearch'
+       which explains less technically how this function works in
+       everyday usage.
+
+2018-10-25  Alan Third  <address@hidden>
+
+       Improve XPM load failure message (bug#33126)
+
+       * src/image.c (xpm_load_image): Only XPM3 is supported, so make that
+       explicit.
+
+2018-10-25  Eli Zaretskii  <address@hidden>
+
+       Avoid infloop in CPerl mode fontification
+
+       * lisp/progmodes/cperl-mode.el
+       (cperl-font-lock-fontify-region-function): Stop the loop at
+       EOB, to avoid inflooping there.  (Bug#33114)
+
+2018-10-25  Andreas Schwab  <address@hidden>
+
+       Fix minibuffer-help-form for lexical binding
+
+       * lisp/simple.el (set-variable): Substitute var into
+       minibuffer-help-form.
+       * lisp/cus-edit.el (custom-prompt-variable): Likewise.
+
+2018-10-24  Alan Third  <address@hidden>
+
+       Fix some NS drawing issues (bug#32932)
+
+       * src/nsterm.m (ns_clip_to_rect):
+       (ns_reset_clipping): Remove gsaved variable and associated code.
+       (ns_flush_display): Remove function.
+       (ns_copy_bits): use translateRectsNeedingDisplayInRect:by: to copy any
+       pending drawing actions along with the image.
+       ([EmacsView windowWillResize:toSize:]): Remove unneeded call.
+       ([EmacsView drawRect:]): Remove redundant call to ns_clear_frame_area,
+       and optimize the exposed rectangles.
+       (ns_draw_window_cursor): Remove unneeded disabling of screen updates.
+
+2018-10-24  Katsumi Yamaoka  <address@hidden>
+
+       * lisp/gnus/mm-util.el (mm-decompress-buffer): Fix split-string args.
+
+2018-10-24  Noam Postavsky  <address@hidden>
+
+       * doc/misc/calc.texi (Summary): The +/- key is 'p', not 'P'.
+
+2018-10-23  Robert Pluim  <address@hidden>
+
+       Correct typo in GNU ELPA url
+
+       * doc/misc/efaq.texi (Packages that do not come with Emacs):
+       Correct typo in GNU ELPA url (Bug#33072).  Change other url
+       references to use https scheme.
+
+2018-10-22  Eli Zaretskii  <address@hidden>
+
+       * doc/misc/dired-x.texi (Omitting Variables): Fix wording. (Bug#33112)
+
+2018-10-20  Michael Heerdegen  <address@hidden>
+
+       Fix help-form binding in dired-create-files
+
+       This fixes Bug#32630: since "dired-aux" moved to lexical binding mode,
+       the free variable TO in the constructed HELP-FORM got out of scope of
+       the surrounding 'let'.
+
+       * lisp/dired-aux.el (dired-create-files): Make the binding of
+       HELP-FORM a string.
+
+2018-10-20  Eli Zaretskii  <address@hidden>
+
+       Fix a pasto in a Gnus doc string
+
+       * lisp/gnus/gnus-art.el (gnus-article-treat-fold-newsgroups):
+       Doc string fix.  (Bug#33081)
+
+2018-10-19  Mauro Aranda  <address@hidden>  (tiny change)
+
+       Update revert-buffer documentation
+
+       * doc/emacs/files.texi (Reverting): Document that revert-buffer
+       does keep undo history.  (Bug#33084)
+
+2018-10-18  Juri Linkov  <address@hidden>
+
+       * lisp/mail/smtpmail.el (smtpmail-send-queued-mail): Load file with .el 
suffix.
+
+       For the case when load-prefer-newer is t, ensure loading the right file
+       by explicitly adding the .el suffix.  Use the same variable names
+       as in the function smtpmail-send-it.  (Bug#33055)
+
+2018-10-16  Glenn Morris  <address@hidden>
+
+       Tweak Makefile emacs-module.h handling
+
+       * Makefile.in (install-arch-indep, uninstall): Respect DESTDIR.
+       Handle whitespace.  Remove non-portable mkdir argument.
+
+       (cherry picked from commit c1d0dbd6ca92cb221024382b19654e4fbf1d1ed3)
+
+2018-10-16  Philipp Stephani  <address@hidden>
+
+       Install emacs-module.h (Bug#31929)
+
+       * Makefile.in (includedir): New variable.
+       (install-arch-indep): Install emacs-module.h.
+       (uninstall): Uninstall emacs-module.h.
+
+       (cherry picked from commit 00ea749f2af44bff6ea8c1259477fbf0ead8a306)
+
+2018-10-15  Alan Mackenzie  <address@hidden>
+
+       Clarify documentation of fractional vertical scrolling and some doc 
strings
+
+       * doc/lispref/windows.texi (vertical scrolling): Clarify the meaning of
+       vertical scrolling by referring to tall screen lines, images, and the 
display
+       action.  Clarify an ambiguous English tense.
+
+       * src/window.c (window-vscroll, set-window-vscroll): Amend doc strings 
to
+       refer to display.
+
+2018-10-15  Charles A. Roelli  <address@hidden>
+
+       * lisp/isearch.el (isearch-cmds): Recall absent isearch--state slot.
+
+2018-10-14  Alan Mackenzie  <address@hidden>
+
+       doc/lispref/edebug.texi (Specification List) Remove obstrusive blank 
line
+
+2018-10-14  Eli Zaretskii  <address@hidden>
+
+       Fix wording in module API documentation
+
+       * doc/lispref/internals.texi (Module Functions): Fix confusing
+       wording.  Reported by Basil L. Contovounesios <address@hidden>.
+
+2018-10-13  Eli Zaretskii  <address@hidden>
+
+       Fix redisplay of glyphless characters
+
+       * src/conf_post.h (bool_bf): Use 'unsigned int' in the MinGW
+       builds.  Suggested by Tom Tromey <address@hidden>.  (Bug#33017)
+       * src/dispnew.c (scrolling_window): Update commentary
+       regarding xwidget builds.
+
+2018-10-13  Robert Pluim  <address@hidden>
+
+       Update --without-toolkit-scroll-bars doc
+
+       * configure.ac (--without-toolkit-scroll-bars): Update list of
+       affected toolkits.
+
+2018-10-13  Robert Pluim  <address@hidden>
+
+       Call GTK functions only on GTK scrollbars
+
+       * src/gtkutil.c (xg_set_background_color) [USE_TOOLKIT_SCROLL_BARS]:
+       Don't call GTK functions on non-GTK scrollbars (Bug#32975).
+
+2018-10-13  Eli Zaretskii  <address@hidden>
+
+       Update the description of startup in ELisp manual
+
+       * doc/lispref/os.texi (Startup Summary): Remove stale
+       reference to window-system-initialization-alist.  Reported by
+       Zhang Haijun <address@hidden>.
+
+2018-10-13  Eli Zaretskii  <address@hidden>
+
+       Use the 'line-number' face for line-number fields past EOB
+
+       * src/xdisp.c (get_phys_cursor_geometry): Treat rows at and
+       beyond ZV specially.  Don't let the cursor exceed the
+       vertical dimensions of the row.
+       (maybe_produce_line_number): Use the 'line-number' face
+       instead of 'default' for blank fields beyond ZV.  Don't update
+       the IT metrics when displaying blank line-number fields beyond
+       ZV.  (Bug#32337)
+
+2018-10-12  Alan Third  <address@hidden>
+
+       Ensure NS frame is redrawn correctly  after scroll
+
+       * src/nsterm.m (ns_copy_bits): Set needsDisplay so the previous cursor
+       position is redrawn.
+
+2018-10-12  Alex Branham  <address@hidden>
+
+       Avoid byte-compiler warning in em-rebind.el
+
+       * lisp/eshell/em-rebind.el (eshell-delete-backward-char): Use
+       'delete-char' instead of delete-backward-char.  (Bug#32945)
+
+2018-10-12  Eli Zaretskii  <address@hidden>
+
+       Improve indexing of 'C-SPC C-SPC'
+
+       * doc/emacs/mark.texi (Disabled Transient Mark): Fix
+       indexing.  (Bug#32959)
+
+2018-10-11  Eric Abrahamsen  <address@hidden>
+
+       Fix bug with precious entries in Gnus registry
+
+       * lisp/registry.el (registry-collect-prune-candidates): This `cdr' was
+         an error: it meant that the last key in the precious list, would be
+         considered a nil. Since the precious list only contains the symbol
+         'mark by default, marks were never considered precious.
+       * doc/misc/gnus.texi (Store arbitrary data): Fix typo: "marks" should
+         be "mark".
+
+2018-10-11  Eli Zaretskii  <address@hidden>
+
+       Document in the ELisp manual how to write loadable modules
+
+       * doc/lispref/internals.texi (Writing Dynamic Modules)
+       (Module Initialization, Module Functions, Module Values)
+       (Module Misc, Module Nonlocal): New nodes.
+       * doc/lispref/loading.texi (Dynamic Modules): Add
+       cross-reference to the new node.
+       * doc/lispref/internals.texi (GNU Emacs Internals):
+       * doc/lispref/elisp.texi (Top): Update menus for the new nodes.
+
+2018-10-11  Tino Calancha  <address@hidden>
+
+       dired-do-shell-command: Notify users after abort the command
+
+       * lisp/dired-aux.el (dired-do-shell-command):  Notify users that
+       the command have aborted when they answer 'n' to the prompt (Bug#32969).
+
+2018-10-11  Michael Albinus  <address@hidden>
+
+       Adapt Tramp version.  Do not merge with master
+
+       * lisp/net/trampver.el: Change version to "2.3.5.26.2".
+       (customize-package-emacs-version-alist): Add Tramp version
+       integrated in Emacs 26.2.
+
+2018-10-10  Alan Third  <address@hidden>
+
+       Fix Apple Script permissions error
+
+       * nextstep/templates/Info.plist.in: Add NSAppleEventsUsageDescription
+       message to enable AppleEvents usage.
+
+2018-10-10  Mauro Aranda  <address@hidden>  (tiny change)
+
+       Fix typo in 'timerp' documentation
+
+       * doc/lispref/os.texi (Timers): Fix typo in 'timerp' documentation.
+       (Bug#32999)
+
+2018-10-08  Charles A. Roelli  <address@hidden>
+
+       * doc/emacs/mark.texi (Mark): Index "(de)activating the mark".
+
+       (Bug#32956)
+
+2018-10-08  Scott Corley  <address@hidden>  (tiny change)
+
+       Fix overflow lockup with frames > 255 lines
+
+       Backport from master.
+       * src/scroll.c (struct matrix_elt): Change unsigned char fields to
+       int to handle frames with more than 255 lines (Bug#32951).
+
+2018-10-07  Eli Zaretskii  <address@hidden>
+
+       Avoid assertion violations in nonsensical calls to 'signal'
+
+       * src/eval.c (Fsignal): If both arguments are nil, replace the
+       first one with 'error', to avoid assertion violations further
+       down the line.  (Bug#32961)
+
+2018-10-06  Charles A. Roelli  <address@hidden>
+
+       * lisp/simple.el (transient-mark-mode): Correct documentation.  
(Bug#32956)
+
+2018-10-06  Eli Zaretskii  <address@hidden>
+
+       Update the locale and language database
+
+       * lisp/international/mule-cmds.el (locale-language-names):
+       Update the list of supported locales.  Use existing language
+       names where available.
+
+2018-10-05  Eli Zaretskii  <address@hidden>
+
+       Fix a typo in a doc string.
+
+       * lisp/window.el (display-buffer-alist): Fix a typo in a doc string.
+       Reported by Michael Heerdegen <address@hidden>.
+
+2018-10-05  Katsumi Yamaoka  <address@hidden>
+
+       Make nneething allow CRLF-encoded files (bug#32940)
+
+       * lisp/gnus/nneething.el (nneething-request-article):
+       Bind coding system to raw-text instead of binary when reading a file,
+       that may be CRLF-encoded (bug#32940).
+
+2018-10-04  Eric Abrahamsen  <address@hidden>
+
+       Further fix to eieio-persistent
+
+       * lisp/emacs-lisp/eieio-base.el 
(eieio-persistent-validate/fix-slot-value):
+         Make handling of hash tables and vectors recursive. This is
+         necessary because the write process, in `eieio-override-prin1' is
+         also recursive. With any luck, this will be the last fix of its
+         kind. If that's true, cherry-pick to Emacs 26.2 later on.
+
+2018-10-04  Eli Zaretskii  <address@hidden>
+
+       Avoid ridiculously high stack limit requests on macOS
+
+       * src/emacs.c (main): Avoid wraparound in subtraction of
+       rlim_t values, in case rlim_t is an unsigned type.  (Bug#32338)
+
+2018-10-03  Charles A. Roelli  <address@hidden>
+
+       Improve documentation of 'read-hide-char'
+
+       * src/minibuf.c (syms_of_minibuf) <Vread_hide_char>: Clarify
+       documentation and mention where else the variable is used.
+       * doc/lispref/minibuf.texi (Reading a Password): Add an index
+       entry for 'read-hide-char'.
+
+2018-10-03  Alan Mackenzie  <address@hidden>
+
+       In follow mode, prevent the cursor resting on a partially displayed line
+
+       Don't merge to master.  This fixes bug #32848
+
+       * lisp/follow.el (follow-adjust-window): If point ends up in a partially
+       displayed line in a left hand or middle window, move it one line
+       forward, to
+       prevent unwanted scrolling should make-cursor-line-fully-visible be
+       non-nil.
+
+2018-10-03  Alan Mackenzie  <address@hidden>
+
+       Revert "Temporary workaround for bug #32848 for branch emacs-26"
+
+       This reverts commit 6650751ce73413d05599df07a9c5bc70744260f3.
+
+2018-10-03  Alan Mackenzie  <address@hidden>
+
+       Revert "* etc/NEWS: Note setting make-cursor-line-fully-visible to nil 
in follow-mode"
+
+       This reverts commit f3c8f4bde2de2b9d42c44f5e44f34c427bebdc58.
+
+2018-10-03  Alan Mackenzie  <address@hidden>
+
+       * etc/NEWS: Note setting make-cursor-line-fully-visible to nil in 
follow-mode
+
+       Also re-insert the "temporary note" explaining --- and +++.
+
+2018-10-03  Noam Postavsky  <address@hidden>
+
+       Fix note about interactive advice (Bug#32905)
+
+       * doc/lispref/functions.texi (Core Advising Primitives): Add missing
+       ':', and finish the sentence fragment.
+
+2018-10-01  Michael Albinus  <address@hidden>
+
+       Comple fix for Bug#32550
+
+       * lisp/net/tramp.el (tramp-rfn-eshadow-update-overlay):
+       Use `save-excursion'.  This completes the fix of Bug#32550.
+
+2018-10-01  Eli Zaretskii  <address@hidden>
+
+       * lisp/savehist.el (savehist-mode): Doc fix.  (Bug#32889)
+
+2018-09-30  Nicolas Goaziou  <address@hidden>
+
+       Org manual: Rewrite the Org Mobile section
+
+       * doc/misc/org.texi (Org Mobile): Rewritten from "MobileOrg" section.
+       Remove all references to non-free software.
+       Moved into "Miscellaneous", much like Org Crypt library. No longer an
+       appendix.
+       (Footnotes): Remove a reference to "MobileOrg".
+       (Bug#32722)
+
+2018-09-30  Alan Mackenzie  <address@hidden>
+
+       Temporary workaround for bug #32848 for branch emacs-26
+
+       Do not merge with master.
+
+       * lisp/follow.el (follow-mode): Set make-cursor-line-fully-visible to 
nil
+       buffer locally whilst follow-mode is active.
+
+2018-09-29  Tino Calancha  <address@hidden>
+
+       Improve cl-do, cl-do* docstrings
+
+       * lisp/emacs-lisp/cl-macs.el(cl-do, cl-do*):
+       Improve docstring (Bug#32803).
+
+2018-09-29  Eli Zaretskii  <address@hidden>
+
+       Avoid returning early in 'while-no-input' due to subprocesses
+
+       * src/keyboard.c (kbd_buffer_store_buffered_event): Support
+       also the internal buffer-switch events.
+       (syms_of_keyboard) <Qbuffer_switch>: New DEFSYM.
+
+       * lisp/subr.el (while-no-input-ignore-events): Ignore
+       'buffer-switch' events.  Reported by Michael Heerdegen
+       <address@hidden>.
+
+       * etc/NEWS: Mention the change in behavior of 'while-no-input'
+
+2018-09-29  John Shahid  <address@hidden>
+
+       Cleanup when opening a new terminal fails. (Bug#32794)
+
+       * src/term.c (init_tty): Call delete_terminal_internal if emacs_open
+       fail.
+       * src/terminal.c (delete_terminal): Move some code into
+       delete_terminal_internal and call it.
+       (delete_terminal_internal): New function.
+       * src/termhooks.h: Prototype for delete_terminal_internal.
+
+2018-09-28  Alan Third  <address@hidden>
+
+       Fix deprecation warning
+
+       * src/nsterm.m (ns_term_init): Use writeToFile or writeToURL as
+       required.
+
+2018-09-28  Alan Third  <address@hidden>
+
+       Make all NS drawing be done from drawRect
+
+       See bug#31904 and bug#32812.
+
+       * src/nsterm.m (ns_update_begin): Don't lock focus, only clip if there
+       is already a view focused.
+       (ns_update_end): Don't mess with view focusing any more.
+       (ns_focus): Only clip drawing if there is already a focused view,
+       otherwise mark area dirty for later drawing.  Renamed ns_clip_to_rect.
+       All callers changed.
+       (ns_unfocus): Don't unfocus the view any more.  Renamed
+       ns_reset_clipping. All callers changed.
+       (ns_clip_to_row): Update to match ns_clip_to_rect.
+       (ns_clear_frame):
+       (ns_clear_frame_area):
+       (ns_draw_fringe_bitmap):
+       (ns_draw_window_cursor):
+       (ns_draw_vertical_window_border):
+       (ns_draw_window_divider):
+       (ns_dumpglyphs_stretch):
+       (ns_draw_glyph_string): Only draw if ns_focus or ns_clip_to_row
+       return YES.
+       (ns_copy_bits): Remove superfluous calls to ns_(un)focus.
+       (ns_flush_display): New function.
+
+2018-09-28  Michael Albinus  <address@hidden>
+
+       Fix Bug#32828
+
+       * lisp/net/dbus.el (dbus-init-bus): Return number of connections,
+       as promised by the docstring.  (Bug#32828)
+
+2018-09-28  Noam Postavsky  <address@hidden>
+
+       * lisp/net/shr.el (shr-copy-url): Fix docstring.
+
+2018-09-27  Eli Zaretskii  <address@hidden>
+
+       Fix typos in documentation
+
+       * doc/misc/vhdl-mode.texi (Custom Indentation Functions):
+       * doc/misc/url.texi (Customization):
+       * doc/misc/tramp.texi (Overview):
+       * doc/misc/srecode.texi (Developing Template Functions):
+       * doc/misc/sieve.texi (Sieve Mode):
+       * doc/misc/reftex.texi (Options - Creating Citations):
+       * doc/misc/org.texi (Cooperation, Conflicts):
+       * doc/misc/gnus.texi (Misc Group Stuff):
+       * doc/misc/eshell.texi (Bugs and ideas):
+       * doc/misc/calc.texi (Summary):
+       * doc/man/emacsclient.1:
+       * doc/lispref/os.texi (Security Considerations):
+       * doc/lispref/control.texi (pcase Macro):
+       * CONTRIBUTE: Fix typos.  Reported by Mak Kolybabi
+       <address@hidden>  (Bug#32853)
+
+2018-09-24  Stefan Monnier  <address@hidden>
+
+       * doc/emacs/kmacro.texi (Basic Keyboard Macro): Mention old bindings
+
+       According to Apple gospel, function keys are partly going the way of 
the dodo
+       so F3/F4 can, like in the good old days, be hard to reach for some 
users.
+
+2018-09-24  Eli Zaretskii  <address@hidden>
+
+       Improve docs of functions/variables related to 'display-buffer'
+
+       * lisp/window.el (display-buffer, pop-to-buffer-same-window)
+       (display-buffer-same-window, display-buffer-in-side-window)
+       (same-window-p, display-buffer-overriding-action)
+       (display-buffer-base-action)
+       (display-buffer--same-window-action)
+       (display-buffer--other-frame-action)
+       (with-current-buffer-window, with-displayed-buffer-window)
+       (display-buffer-alist, display-buffer-assq-regexp)
+       (display-buffer-other-frame): Clarify and improve the doc
+       strings.  (Bug#32798)
+
+2018-09-23  Stefan Monnier  <address@hidden>
+
+       * lisp/mouse.el (tear-off-window): Fix non-mouse use (bug#32799)
+
+2018-09-22  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of directory-local variables
+
+       * lisp/files.el (hack-local-variables, normal-mode)
+       (after-find-file, find-file-hook): Mention directory-local
+       variables in the doc strings.  Suggested by Marcin Borkowski
+       <address@hidden>.
+
+       * doc/emacs/custom.texi (File Variables, Directory Variables):
+       Clarify that directory-local variables are overridden by
+       file-local ones.
+
+2018-09-22  Eli Zaretskii  <address@hidden>
+
+       Don't use obsolete variable 'save-place' in documentation
+
+       * doc/lispref/customize.texi (Variable Definitions): Replace
+       example of saveplace defcustom with a fictitious one, which
+       will not bit-rot with time.  (Bug#32741)
+
+2018-09-22  Mark A. Hershberger  <address@hidden>
+
+       Use save-place-mode instead of save-place
+
+       * lisp/menu-bar.el (menu-bar-options-save, menu-bar-options-menu):
+       * lisp/saveplace.el (save-place-to-alist, save-places-to-alist)
+       (save-place-find-file-hook, save-place-dired-hook): Use
+       save-place-mode instead of the obsolete save-place.
+
+2018-09-20  Eli Zaretskii  <address@hidden>
+
+       More accurate docs for 'text-char-description'
+
+       * src/keymap.c (Ftext_char_description):
+       * doc/lispref/help.texi (Describing Characters): More accurate
+       description of 'text-char-description'.  Remove incorrect
+       examples from the ELisp manual.  (Bug#32743)
+
+2018-09-20  Noam Postavsky  <address@hidden>
+
+       Document synchronous behavior of eshell/make (Bug#32513)
+
+       * doc/misc/eshell.texi (Built-ins):
+       * lisp/eshell/em-unix.el (eshell/make): Mention that it falls back to
+       the external 'make' command when called synchronously.
+
+2018-09-20  Shigeru Fukaya  <address@hidden>
+
+       Fix bs-show with wide characters (Bug#17822)
+
+       * lisp/bs.el (bs--insert-one-entry, bs-show-in-buffer): Use
+       string-width instead of length.
+
+2018-09-19  Eli Zaretskii  <address@hidden>
+
+       Improve Custom menu labels for 2 options
+
+       * lisp/dired.el (dired-use-ls-dired):
+       * lisp/progmodes/xref.el (xref-prompt-for-identifier): Improve
+       the doc string and the defcustom menu/tags text.  (Bug#32756)
+
+2018-09-19  Eli Zaretskii  <address@hidden>
+
+       Improve wording of last change in dired-x.texi
+
+       * doc/misc/dired-x.texi (Shell Command Guessing): Clarify
+       wording in description of 'dired-guess-shell-alist-user'.
+       Avoid passive tense.  (Bug#32733)
+
+2018-09-18  Eli Zaretskii  <address@hidden>
+
+       Fix GnuTLS test suite with GnuTLS versions 3.4.x
+
+       * src/gnutls.c (gnutls_cipher_get_tag_size): Make it return
+       zero only for versions of GnuTLS < 3.2.2, where
+       gnutls_cipher_get_tag_size was introduced.  This fixes the
+       GnuTLS test suite, which assumes that any cipher whose tag
+       size is non-zero is AEAD-capable, and doesn't test such ciphers
+       if AEAD is not available, i.e. for GnuTLS < 3.5.1.  (Bug#32446)
+
+2018-09-17  Noam Postavsky  <address@hidden>
+
+       Fix build with gnutls versions 3.0 to 3.2 (Bug#32446)
+
+       We previously used functions available only in 3.2+ for all 3.x
+       versions.
+       * src/gnutls.c [GNUTLS_VERSION_NUMBER < 0x030501]: Replace calls to
+       gnutls_cipher_get_tag_size with 0.
+       [GNUTLS_VERSION_NUMBER < 0x030200]: Alias gnutls_cipher_get_iv_size
+       to gnutls_cipher_get_block_size, gnutls_digest_list to
+       gnutls_mac_list, and gnutls_digest_get_name to gnutls_mac_get_name.
+       [WINDOWSNT]: Adjust DLL function definitions and declarations
+       accordingly.
+
+2018-09-17  Eli Zaretskii  <address@hidden>
+
+       Fix the Bubbles game on TTY frames
+
+       * lisp/play/bubbles.el (bubbles--col-offset)
+       (bubbles--row-offset): Doc fixes.
+       (bubbles--compute-offsets): Conflate the GUI and TTY code into
+       a single common version.  Set the offsets to simple numbers,
+       not to lists.
+       (bubbles--initialize, bubbles--show-scores): Wrap offset
+       values in a list, so that they are interpreted as pixel
+       values, not as units of character width.  This fixes the game
+       on TTY frames.  (Bug#32744)
+
+2018-09-17  Allen Li  <address@hidden>
+
+       Add choice to reshow certificate information (Bug#31877)
+
+       In various situations, the window displaying the certificate
+       information can be hidden (such as if the user accidentally presses ?,
+       which causes the read-multiple-choice help window to replace it).
+       Instead of leaving the user to make a choice blindly, add a choice to
+       reshow the certification information.
+
+       * lisp/net/nsm.el (nsm-query-user): Add reshow choice.
+
+2018-09-16  Glenn Morris  <address@hidden>
+
+       * src/alloc.c (Fbool_vector, Flist, Fvector): Doc tweak.
+
+       Use a simpler, consistent form.
+
+2018-09-15  Alan Mackenzie  <address@hidden>
+
+       * src/alloc.c (vector): Fix grammatical error in doc string: "are" -> 
"is".
+
+2018-09-15  Eli Zaretskii  <address@hidden>
+
+       Avoid adverse side effects of fixing bug#21824
+
+       * test/src/buffer-tests.el
+       (overlay-modification-hooks-deleted-overlay): New test.
+
+       * src/buffer.c (report_overlay_modification): Don't bypass all
+       the overlay-modification hooks; instead, invoke each function
+       only if the buffer associated with the overlay is the current
+       buffer.  (Bug#30823)
+
+2018-09-15  Eli Zaretskii  <address@hidden>
+
+       Document changes called out in NEWS
+
+       * doc/lispref/lists.texi (Association Lists): Document
+       'assoc-delete-all'.
+       * doc/lispref/minibuf.texi (Minibuffers): Adapt menu.
+       (Multiple Queries): Document 'read-answer'.
+
+       * etc/NEWS: Reflect the above documentation in the respective
+       entries.
+
+2018-09-14  Glenn Morris  <address@hidden>
+
+       Tiny doc updates re yum/dnf etc
+
+       * INSTALL: Mention dnf and Debian unversioned emacs package.
+       * doc/misc/efaq.texi (Installing Emacs): Mention dnf.
+
+2018-09-14  Leo Liu  <address@hidden>
+
+       Remove unused variable
+
+       * lisp/progmodes/prolog.el (prolog-hungry-delete-key-flag): Remove.
+
+2018-09-14  Leo Liu  <address@hidden>
+
+       Fix (thing-at-point 'list) regression (Bug#31772)
+
+       * lisp/thingatpt.el (thing-at-point-bounds-of-list-at-point): Revert
+         to pre 26.1 behavior.  Return whole sexp at point if no enclosing
+         list.
+         (list-at-point): New optional arg to ignore comments and strings.
+
+       * test/lisp/thingatpt-tests.el
+         (thing-at-point-bounds-of-list-at-point): Fix and augment tests.
+
+2018-09-14  Robert Pluim  <address@hidden>
+
+       Clarify meaning of '*'
+
+       * doc/misc/dired-x.texi (Shell Command Guessing): Clarify meaning
+       of '*'. (Bug#32733)
+
+2018-09-12  Paul Eggert  <address@hidden>
+
+       * etc/PROBLEMS: Document Ubuntu 16.04 issue.
+
+2018-09-12  Alex Branham  <address@hidden>  (tiny change)
+
+       Increase default value for imenu-auto-rescan-maxout
+
+       * lisp/imenu.el (imenu-auto-rescan-maxout): Increase default value to
+         600000.  (Bug#18426)
+       * doc/emacs/programs.texi (imenu-auto-rescan-maxout): Add
+         documentation for imenu-auto-rescan-maxout.
+
+2018-09-11  Eli Zaretskii  <address@hidden>
+
+       Improve recent change to ELisp manual
+
+       * doc/lispref/commands.texi (Keyboard Events): Add index entry
+       for "character event".  (Bug#32562)
+
+2018-09-11  Eli Zaretskii  <address@hidden>
+
+       * doc/lispref/display.texi (SVG Images): Improve wording.
+
+       * doc/lispref/display.texi (SVG Images): Fix a typo.  (Bug#32690)
+
+2018-09-10  Eli Zaretskii  <address@hidden>
+
+       Clarify completion text in the ELisp manual
+
+       * doc/lispref/minibuf.texi (Programmed Completion): Clarify
+       text.  Suggested by Stefan Monnier <address@hidden>.
+
+2018-09-10  Eli Zaretskii  <address@hidden>
+
+       Fix handling of abbreviated control command in gdb-mi.el
+
+       * lisp/progmodes/gdb-mi.el (gdb-control-commands-regexp):
+       Support unambiguous abbreviations of commands.  (Bug#32576)
+
+2018-09-10  Eli Zaretskii  <address@hidden>
+
+       Clarify documentation of functions reading character events
+
+       * doc/lispref/help.texi (Describing Characters):
+       * doc/lispref/commands.texi (Keyboard Events)
+       (Reading One Event, Classifying Events): Make the distinction
+       between characters and character events more explicit.
+
+       * src/keymap.c (Ftext_char_description)
+       (Fsingle_key_description):
+       * src/lread.c (Fread_char, Fread_char_exclusive): Doc fixes,
+       to make a clear distinction between a character input event
+       and a character code.  (Bug#32562)
+
+2018-09-07  Eli Zaretskii  <address@hidden>
+
+       Record :version for built-in variables while dumping
+
+       * lisp/cus-start.el (standard): Record the ':version; of the
+       symbols when dumping, so that 'describe-variable' could tell
+       which built-in variables were added/changed in recent
+       versions.
+
+2018-09-07  YAMAMOTO Mitsuharu  <address@hidden>
+
+       * src/process.c (connect_network_socket): Fix memory leak.  (Bug#32604)
+
+2018-09-05  Glenn Morris  <address@hidden>
+
+       * Makefile.in (appdatadir): Use the non-obsolete location "metainfo".
+
+2018-09-04  Stefan Monnier  <address@hidden>
+
+       Better fix for bug#32550
+
+       * lisp/rfn-eshadow.el (rfn-eshadow-overlay): Give it a global default.
+
+       * lisp/net/tramp.el (rfn-eshadow-overlay): Declare it as dynamically 
scoped.
+       (tramp-rfn-eshadow-update-overlay): Revert the corresponding part of
+       last change.
+
+2018-09-04  Michael Albinus  <address@hidden>
+
+       Fix Bug#32550
+
+       * lisp/net/tramp.el (tramp-rfn-eshadow-setup-minibuffer): Do not
+       use `symbol-value'.
+       (tramp-rfn-eshadow-update-overlay): Do not use `symbol-value'.  Do
+       not let-bind `rfn-eshadow-overlay', assign it directly (due to
+       lexical binding).  (Bug#32550)
+
+2018-09-04  Martin Rudalics  <address@hidden>
+
+       Don't call XGetGeometry for frames without outer X window (Bug#32615)
+
+       * src/xfns.c (frame_geometry): Don't call XGetGeometry when
+       FRAME has no outer X window; return nil instead.  (Bug#32615)
+
+2018-09-03  Paul Eggert  <address@hidden>
+
+       * lisp/calculator.el: Fix doc typo.
+
+2018-09-03  Glenn Morris  <address@hidden>
+
+       Standardize calc bug reporting instructions
+
+       * doc/misc/calc.texi (Reporting Bugs): Use standard commands.
+       * lisp/calc/calc-misc.el (report-calc-bug, calc-report-bug):
+       * lisp/calc/calc.el (calc-bug-address): Change to be
+       obsolete aliases for standard Emacs bug reporting items.
+
+2018-08-31  Michael Albinus  <address@hidden>
+
+       Rename thread-alive-p to thread-live-p
+
+       * doc/lispref/threads.texi (Basic Thread Functions): Use thread-live-p.
+
+       * etc/NEWS: 'thread-alive-p' has been renamed to 'thread-live-p'.
+
+       * src/thread.c (thread_live_p): Rename from thread_alive_p.  Adapt
+       all callees.
+       (Fthread_live_p): Rename from Fthread_alive_p.
+       (syms_of_threads): Make thread-alive-p an alias of thread-live-p.
+
+       * test/src/thread-tests.el (all): Replace `thread-alive-p' by
+       `thread-live-p'.
+       (threads-live): Rename from `threads-alive'.
+
+2018-08-30  Miciah Masters  <address@hidden>  (tiny change)
+
+       rcirc: Document /reconnect as a built-in command (Bug#29656)
+
+       The change "New command rcirc-cmd-reconnect" from 2014-04-09 (shipped
+       in Emacs 25.1) added a /reconnect command to rcirc but did not
+       document it and did not delete the example /reconnect command
+       definition in the manual.
+       * doc/misc/rcirc.texi (rcirc commands): Document the built-in /reconnect
+       command.
+       (Hacking and Tweaking): Delete example reconnect command.
+
+2018-08-30  Noam Postavsky  <address@hidden>
+
+       * test/lisp/calc/calc-tests.el (calc-imaginary-i): New test.
+
+2018-08-28  Glenn Morris  <address@hidden>
+
+       admin.el: respect environment settings for makeinfo etc
+
+       * admin/admin.el (manual-makeinfo, manual-texi2pdf, manual-texi2dvi):
+       New variables.
+       (manual-html-mono, manual-html-node, manual-pdf, manual-ps): Use them.
+
+2018-08-28  Glenn Morris  <address@hidden>
+
+       * etc/PROBLEMS: New entry about GTK+ 3 crash with some X servers.
+
+2018-08-28  Noam Postavsky  <address@hidden>
+
+       Index profiler commands in elisp manual
+
+       * doc/lispref/debugging.texi (Profiling): Add index entries for
+       profiler-start, profiler-report, profiler-stop.
+
+2018-08-28  Noam Postavsky  <address@hidden>
+
+       Fix math-imaginary-i check
+
+       Reported by Bastian Erdnüß at
+       <https://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00300.html>.
+       * lisp/calc/calc-cplx.el (math-imaginary-i): Check for a value
+       of (polar 1 <quarter-circle>).
+
+2018-08-28  Eli Zaretskii  <address@hidden>
+
+       Avoid infinite hscrolling loops when line numbers are displayed
+
+       * src/xdisp.c (maybe_produce_line_number): Don't produce line
+       numbers if we don't have enough screen estate.  (Bug#32351)
+
+2018-08-28  Eli Zaretskii  <address@hidden>
+
+       Avoid crashes in malformed defvar
+
+       * src/eval.c (Fdefvar): Don't call XSYMBOL on something that
+       might not be a symbol.  This avoids crashes due to malformed
+       'defvar' forms.  (Bug#32552)
+
+2018-08-28  Glenn Morris  <address@hidden>
+
+       * configure.ac (emacs_config_features): Add GLIB, XDBE, XIM.
+
+       * configure.ac: Doc fixes related to --with-xim.
+
+2018-08-28  Glenn Morris  <address@hidden>
+
+       Small checkdoc quoting fix (bug#32546)
+
+       * lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
+       Fix quoting thinko.
+
+2018-08-26  Sergey Vinokurov  <address@hidden>
+
+       Fix detection of freed emacs_values (Bug#32479)
+
+       * src/emacs-module.c (module_free_global_ref): Compare a value to be
+       freed with all entries of the list.
+
+       * test/data/emacs-module/mod-test.c (Fmod_test_globref_free): New
+       function.
+       (emacs_module_init): Make it accessible from Lisp.
+       * test/src/emacs-module-tests.el (mod-test-globref-free-test): New
+       test which uses it.
+
+2018-08-25  Eli Zaretskii  <address@hidden>
+
+       Avoid crashes with very wide TTY frames on MS-Windows
+
+       * src/w32console.c <glyph_base>: Reduce the number of elements
+       to 80.
+       <glyphs, glyphs_len>: New static variables.
+       (w32con_clear_end_of_line): If the line is wider than the
+       current size of the "empty row" in 'glyphs', reallocate
+       'glyphs' to support the full width of the frame.  This
+       avoids segfaults when the frame is wider than 256 columns.
+       (Bug#32445)
+
+2018-08-25  Wenjamin Petrenko  <address@hidden>  (tiny change)
+
+       Prevent `modify-file-local-variable-prop-line' from adding extra ';'
+
+       * lisp/files-x.el (modify-file-local-variable-prop-line): Handle
+       whitespace when checking if there's already a ';' before the
+       variable (Bug#23294).
+
+2018-08-24  Glenn Morris  <address@hidden>
+
+       Update GNOME bugtracker URLs
+
+       * configure.ac, admin/notes/multi-tty, etc/PROBLEMS:
+       * src/emacs.c (main):
+       * src/xterm.c (x_connection_closed): Update GNOME bugtracker URLs.
+
+2018-08-23  Eli Zaretskii  <address@hidden>
+
+       Clarify in the Emacs manual that ChangeLog files are not used
+
+       * doc/emacs/trouble.texi (Sending Patches): Use "commit log"
+       instead of "change log", to avoid the interpretation that we
+       are talking about literal ChangeLog files.  (Bug#32359)
+
+2018-08-21  Eli Zaretskii  <address@hidden>
+
+       Recognize codepage 65001 as a valid encoding
+
+       * lisp/international/mule-conf.el (cp65001): Define it as an
+       alias for UTF-8.
+
+2018-08-18  Eli Zaretskii  <address@hidden>
+
+       Avoid compilation warning in nt/addpm.c
+
+       * nt/addpm.c [!MINGW_W64]: Undefine _WIN32_IE before
+       redefining it, to avoid compilation warnings.
+
+2018-08-17  Basil L. Contovounesios  <address@hidden>
+
+       Fix duplicate custom group names in bibtex.el
+
+       * lisp/textmodes/bibtex.el (bibtex-BibTeX-entry-alist):
+       Change :group from BibTeX to bibtex.  (bug#32436)
+
+2018-08-17  Eli Zaretskii  <address@hidden>
+
+       Fix outdated text in the Calc manual
+
+       * doc/misc/calc.texi (Internals): Don't advertise
+       'calc-extensions' which no longer exists.  Reported by Francis
+       Wright <address@hidden>.
+
+2018-08-13  Paul Eggert  <address@hidden>
+
+       Port better to x86 -fexcess-precision=fast
+
+       Problem reported by Eli Zaretskii in:
+       https://lists.gnu.org/r/emacs-devel/2018-08/msg00380.html
+       * src/data.c (arithcompare): Work around incompatibility
+       between gcc -fexcess-precision=fast and the C standard on x86,
+       by capturing the results of floating-point comparisons before
+       the excess precision spontaneously decays.  Although this fix
+       might not work in general, it does work here and is probably
+       good enough for the platforms we care about.
+
+       (cherry picked from commit a84cef90957f2379cc0df6bd908317fc441971ce)
+
+2018-08-13  Paul Eggert  <address@hidden>
+
+       Add comment about floating point test
+
+       * test/src/data-tests.el (data-tests--float-greater-than-fixnums):
+       New constant.
+       (data-tests-=, data-tests-<, data-tests->, data-tests-<=)
+       (data-tests->=, data-tests-min): Use it.
+
+2018-08-13  Tino Calancha  <address@hidden>
+
+       Ibuffer: Add toggle ibuffer-do-toggle-lock
+
+       Toggle the locked status in marked buffers or the buffer
+       at point (Bug#32421).
+       * lisp/ibuffer.el (ibuffer-do-toggle-lock): New command.
+       (ibuffer-mode-map): Bind it to 'L'.
+       (ibuffer-mode-operate-map): Add entries for
+       `ibuffer-do-toggle-read-only' and `ibuffer-do-toggle-lock'.
+       * etc/NEWS (Changes in Specialized Modes and Packages in Emacs 26.2):
+       Announce the change.
+
+2018-08-13  Tino Calancha  <address@hidden>
+
+       Ibuffer: Detect correctly the buffers running a process
+
+       * lisp/ibuffer.el (filename-and-process): Store the process buffer
+       as a text property; check for such property to detect a buffer
+       with a process (Bug#32420).
+
+2018-08-12  Michael Albinus  <address@hidden>
+
+       Backport fix for Bug#32226
+
+       * test/lisp/shadowfile-tests.el: Set Tramp variables for hydra.
+       (shadow-test06-literal-groups, shadow-test07-regexp-groups)
+       (shadow-test08-shadow-todo, shadow-test09-shadow-copy-files):
+       Use `set-visited-file-name' instead of setting the value in
+       `buffer-file-name' directly.
+       (shadow-test08-shadow-todo, shadow-test09-shadow-copy-files):
+       Test for writable temporary directory.  Suppress errors in
+       cleanup.  (Bug#32226)
+
+2018-08-12  Yuri D'Elia  <address@hidden>
+
+       Do not consider external packages to be removable (Bug#27822)
+
+       Packages which are not directly user-installed shouldn't be autoremoved,
+       since they can be setup through a different path (via
+       `package-directory-list') where we have no authority over.
+       * lisp/emacs-lisp/package.el (package--user-installed-p): New
+       function.
+       (package--removable-packages): Use it.
+
+2018-08-11  Paul Eggert  <address@hidden>
+
+       * src/alloc.c: Remove obsolete comments.
+
+2018-08-11  Eli Zaretskii  <address@hidden>
+
+       Better support utf-8-with-signature and utf-8-hfs in HTML
+
+       * lisp/international/mule.el (sgml-html-meta-auto-coding-function):
+       Support UTF-8 with BOM and utf-8-hfs as variants of UTF-8, and
+       obey the buffer's encoding if it is one of these variants, instead
+       of re-encoding in UTF-8 proper.  (Bug#20623)
+
+2018-08-11  Eli Zaretskii  <address@hidden>
+
+       Don't use -Wabi compiler option
+
+       * configure.ac: Add -Wabi to the list of disabled warning
+       options.  For the details, see
+       http://lists.gnu.org/archive/html/emacs-devel/2018-08/msg00123.html.
+
+2018-08-10  Filipp Gunbin  <address@hidden>
+
+       Fix bugs in `auth-source-netrc-parse-one'.
+
+       * lisp/auth-source.el (auth-source-netrc-parse-one): Ensure that match
+         data is not overwritten in `auth-source-netrc-parse-next-interesting'.
+         Ensure that blanks are skipped before and after going over comments
+         and eols.
+       * test/lisp/auth-source-tests.el (auth-source-test-netrc-parse-one): 
New test.
+
+       (cherry picked from commit 60ff8101449eea3a5ca4961299501efd83d011bd)
+
+2018-08-09  Eli Zaretskii  <address@hidden>
+
+       Fix copying text properties by 'format'
+
+       * src/editfns.c (styled_format): Add the spec beginning index
+       to the info recorded for each format spec, and use it to
+       detect the case that a format spec and its text property end
+       where the next spec with another property begins.  (Bug#32404)
+
+       * test/src/editfns-tests.el (format-properties): Add tests for
+       bug#32404.
+
+2018-08-09  Alexander Gramiak  <address@hidden>
+
+       Improve error messages regarding initial-buffer-choice (Bug#29098)
+
+       * lisp/startup.el (command-line-1) <initial-buffer-choice>: Make the
+       messages conform to Emacs conventions, and show the invalid return
+       value in the message.
+
+2018-08-09  Glenn Morris  <address@hidden>
+
+       * test/lisp/wdired-tests.el (wdired-test-unfinished-edit-01): Fix typo.
+
+2018-08-09  Lars Ingebrigtsen  <address@hidden>
+
+       Make async :family 'local failures fail correctly again
+
+       * src/fileio.c (get_file_errno_data): Refactor out into its own
+       function so that we can reuse the error handling from an async
+       context (bug#31901).
+
+       * src/process.c (connect_network_socket): When an async :family
+       'local client fails (with a file error, for instance), mark the
+       process as failed.
+
+       (cherry picked from commit 92ba34d89ac4f5b5bbb818e1c39a3cc12a405790)
+
+2018-08-09  Noam Postavsky  <address@hidden>
+
+       Fix emacsclient check for term.el buffer (Bug#21041)
+
+       * lib-src/emacsclient.c (find_tty): Check for any TERM value with
+       prefix of "eterm", not just "eterm" itself.  Also check for ",term:"
+       in INSIDE_EMACS value.
+
+2018-08-08  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'set-fontset-font'
+
+       * doc/lispref/display.texi (Fontsets): Fix description of
+       'set-fontset-font'.
+       * src/fontset.c (Fset_fontset_font): Doc fix.  (Bug#32401)
+
+2018-08-07  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of M-?
+
+       * doc/emacs/maintaining.texi (Identifier Search):
+       * lisp/progmodes/xref.el (xref-find-references): Improve
+       documentation of xref-find-references and
+       xref-prompt-for-identifier.  (Bug#32389)
+
+2018-08-07  Ivan Shmakov  <address@hidden>
+
+       Reinterpret Esperanto characters in iso-transl as iso-8859-3.
+
+       * lisp/international/iso-transl.el (iso-transl-language-alist):
+       Reinterpret Esperanto characters as iso-8859-3 (were: iso-8859-1).
+       (Bug#32371)
+
+2018-08-07  Eli Zaretskii  <address@hidden>
+
+       Fix Flyspell mode when several languages are mixed in a buffer
+
+       * lisp/textmodes/flyspell.el (flyspell-external-point-words):
+       Handle "misspelled" words that actually belong to a language
+       unsupported by the current dictionary.  (Bug#32280)  Fix the test
+       for Ispell the program.
+
+2018-08-04  Juri Linkov  <address@hidden>
+
+       New function read-answer (Bug#31782)
+
+       * lisp/emacs-lisp/map-ynp.el (read-answer-short): New defcustom.
+       (read-answer): New function.
+       * lisp/subr.el (assoc-delete-all): New function.
+       * etc/NEWS: Announce them.
+
+       * lisp/dired.el (dired-delete-file): Use read-answer.
+       (dired--yes-no-all-quit-help): Remove function.
+       (dired-delete-help): Remove defconst.
+
+       (backported from master, "New function read-answer (bug#30073)" and
+       "Respect non-saved value of `read-short-answer' (Bug#31782)")
+
+2018-08-02  Eli Zaretskii  <address@hidden>
+
+       Avoid assertion violations in maybe_produce_line_number
+
+       * src/xdisp.c (redisplay_window): Make sure desired_matrix is
+       cleared before calling try_window.  This is important when
+       display-line-numbers is non-nil, because line-number display code
+       assumes each glyph row is completely cleared when it is called to
+       produce a line number.  (Bug#32358)
+
+2018-08-02  Eli Zaretskii  <address@hidden>
+
+       Avoid assertion violations in set_text_properties_1
+
+       * src/textprop.c (set_text_properties): If the call to
+       modify_text_properties modifies the interval tree as side effect,
+       recalculate the correct interval for START and END.  (Bug#32265)
+
+2018-07-31  Stephen Berman  <address@hidden>
+
+       Fix wdired test failure when byte compiled (bug#32318)
+
+       * test/lisp/wdired-tests.el: Require wdired.  Defvar dired-query
+       to silence byte-compiler.
+
+2018-07-30  Stephen Berman  <address@hidden>
+
+       * test/lisp/wdired-tests.el (wdired-test-symlink-name): New test.
+
+2018-07-29  Raimon Grau  <address@hidden>
+
+       Fix url's thing-at-point beginning-op (Bug#32028)
+
+       * lisp/thingatpt.el (url): Fix beginning-op making.
+
+2018-07-29  Eli Zaretskii  <address@hidden>
+
+       Fix last change in 'char_width'
+
+       * src/character.c (char_width): Make sure variable C is always
+       initialized.  (Bug#32276)
+
+2018-07-29  Stephen Berman  <address@hidden>
+
+       Add initial tests for wdired.el
+
+       * test/lisp/wdired-tests.el: New file.
+
+2018-07-28  Stephen Berman  <address@hidden>
+
+       Fix use of non-nil wdired-use-interactive-rename
+
+       This is a fairly minimal fix for the release branch; a more
+       comprehensive fix is on master, so do not merge this to master.
+
+       * lisp/wdired.el (wdired-search-and-rename): Remove dired-filename
+       text property in order to find new filename when it only partially
+       replaces old filename (bug#32173).  If user quits before renaming
+       succeeds, restore the dired-filename text property.
+
+2018-07-28  Eli Zaretskii  <address@hidden>
+
+       Fix compilation with mingw.org's MinGW 5.x headers
+
+2018-07-28  Eli Zaretskii  <address@hidden>
+
+       Update the list of special forms in the ELisp manual
+
+       * doc/lispref/eval.texi (Special Forms):
+       * doc/lispref/frames.texi (Mouse Tracking): 'track-mouse' is
+       nowadays a macro.  (Bug#32284)
+
+2018-07-28  Noam Postavsky  <address@hidden>
+
+       Don't fail to indent-sexp before a full sexp (Bug#31984)
+
+       * lisp/emacs-lisp/lisp-mode.el (indent-sexp): Only signal error if the
+       initial forward-sexp fails.  Suppress scan-error forn any of the
+       forward-sexp calls after that.
+       * test/lisp/emacs-lisp/lisp-mode-tests.el (indent-sexp-cant-go): New
+       test.
+
+2018-07-27  Eli Zaretskii  <address@hidden>
+
+       Fix calls to modifications hooks in replace-buffer-contents
+
+       * src/editfns.c (Freplace_buffer_contents): Call the modification
+       hooks on the entire region where replacements could have taken
+       place.  The previous attempts of being more accurate just
+       introduced bugs.  (Bug#32278)
+
+2018-07-27  Eli Zaretskii  <address@hidden>
+
+       * src/character.c (char_width): Support glyphs with faces.  (Bug#32276)
+
+2018-07-27  Eli Zaretskii  <address@hidden>
+
+       Display raw bytes as belonging to 'eight-bit' charset
+
+       * lisp/descr-text.el (describe-char):
+       * lisp/simple.el (what-cursor-position): Display characters in the
+       range #x3FFF80..#x3FFF9F as belonging to charset 'eight-bit', not
+       'tis620-2533'.
+       * lisp/international/mule-diag.el (describe-character-set):
+       Improve description of :supplementary-p.
+
+2018-07-26  Eli Zaretskii  <address@hidden>
+
+       Fix inaccurate text in the user manual
+
+       * doc/emacs/mule.texi (International Chars): Correct inaccurate
+       description of raw bytes display by "C-x =".
+
+2018-07-26  Michael Albinus  <address@hidden>
+
+       Copyedits in tramp.texi, improved example with bash's readline
+
+       * doc/misc/tramp.texi (all): Unify some wordings.
+       (Frequently Asked Questions): Update example with bash's readline.
+
+2018-07-25  Michael Albinus  <address@hidden>
+
+       Minor Tramp doc update
+
+       * doc/misc/tramp.texi (Frequently Asked Questions): Disable bash's
+       INPUTRC.
+
+2018-07-25  Michael Albinus  <address@hidden>
+
+       File Shadowing is not available on MS Windows
+
+       * doc/emacs/files.texi (File Shadowing): File Shadowing is not
+       available on MS Windows.
+
+       * test/lisp/shadowfile-tests.el (shadow-test00-clusters)
+       (shadow-test01-sites, shadow-test02-files)
+       (shadow-test03-expand-cluster-in-file-name)
+       (shadow-test04-contract-file-name, shadow-test05-file-match)
+       (shadow-test06-literal-groups, shadow-test07-regexp-groups)
+       (shadow-test08-shadow-todo, shadow-test09-shadow-copy-files):
+       Skip under MS Windows.
+
+2018-07-24  Noam Postavsky  <address@hidden>
+
+       Let bookmark-jump override window-point (Bug#31751)
+
+       * lisp/bookmark.el (bookmark-jump): Use pop-to-buffer-same-window
+       instead of switch-to-buffer, the latter obeys
+       switch-to-buffer-preserve-window-point and so loses the bookmark's
+       point.
+
+2018-07-23  Noam Postavsky  <address@hidden>
+
+       Omit keymap from subword-mode docstring (Bug#32212)
+
+       * lisp/progmodes/subword.el (subword-mode): Remove listing of
+       subword-mode-map bindings, since it is empty as of 2014-03-23 "Merge
+       capitalized-words-mode and subword-mode".
+
+2018-07-23  Tino Calancha  <address@hidden>
+           Noam Postavsky  <address@hidden>
+
+       Prevent line-mode term from showing user passwords
+
+       For buffers whose mode derive from comint-mode, the user password is
+       read from the minibuffer and it's hidden.  A buffer in term-mode and
+       line submode, instead shows the passwords.  Make buffers in line
+       term-mode to hide passwords too (Bug#30190).
+
+       * lisp/term.el (term-send-invisible): Prefer the more robust
+       `read-passwd' instead of `term-read-noecho'.
+       (term-watch-for-password-prompt): New function.
+       (term-emulate-terminal): Call it each time we receive non-escape
+       sequence output.
+
+2018-07-22  Jonathan Kyle Mitchell  <address@hidden>
+
+       Check for special filenames in eshell (Bug#30724)
+
+       * lisp/eshell/esh-cmd.el (eshell-lisp-command): Check for "~"
+       in lisp commands with the eshell-filename-arguments property
+       (Bug#30724).
+
+       * lisp/eshell/em-dirs.el (eshell/cd, eshell/pushd, eshell/popd):
+       * lisp/eshell/em-ls.el (eshell/ls):
+       * lisp/eshell/em-unix.el (eshell/rm, eshell/mkdir, eshell/rmdir)
+       (eshell/mv, eshell/cp, eshell/ln, eshell/cat, eshell/du, eshell/diff):
+       * lisp/eshell/esh-ext.el (eshell/addpath): Add
+       eshell-filename-arguments to symbol plist.
+
+2018-07-22  Noam Postavsky  <address@hidden>
+
+       Fix indent-sexp of #s(...) (Bug#31984)
+
+       * lisp/emacs-lisp/lisp-mode.el (indent-sexp): Look for a sexp that
+       ends after the current line.
+       * test/lisp/emacs-lisp/lisp-mode-tests.el (indent-sexp-go): New test.
+
+2018-07-22  Noam Postavsky  <address@hidden>
+
+       Add save-match-data to abbreviate-file-name (Bug#32201)
+
+       * lisp/files.el (abbreviate-file-name): Save match-data around
+       expand-file-name; it is not guaranteed to preserve match-data, and may
+       well do so depending on what file handlers and hooks are in effect.
+
+2018-07-21  Eli Zaretskii  <address@hidden>
+
+       Fix last change in editfns.c
+
+       * src/editfns.c (Freplace_buffer_contents): Fix last change: always
+       call buffer modification hooks, even if nothing was deleted/inserted.
+       (bug#32237)
+
+2018-07-21  Eli Zaretskii  <address@hidden>
+
+       Fix calls to buffer modification hooks from replace-buffer-contents
+
+       * src/editfns.c (Freplace_buffer_contents): Don't call buffer
+       modification hooks if nothing was deleted/inserted.  (Bug#32237)
+
+2018-07-21  Michael Albinus  <address@hidden>
+
+       Fix Bug#32226
+
+       * lisp/shadowfile.el (shadow-site-name, shadow-name-site):
+       Use "[-.[:word:]]+" as hostname regexp.  (Bug#32226)
+
+       * test/lisp/shadowfile-tests.el (shadow-test06-literal-groups)
+       (shadow-test07-regexp-groups, shadow-test08-shadow-todo)
+       (shadow-test09-shadow-copy-files): Skip if needed.
+
+2018-07-21  Eli Zaretskii  <address@hidden>
+
+       Improve doc strings of several variables in keyboard.c
+
+       * src/keyboard.c (syms_of_keyboard) <debug-on-event>
+       <attempt-stack-overflow-recovery>
+       <attempt-orderly-shutdown-on-fatal-signal>: Make sure the first
+       sentence of the doc string fits on a single line.
+
+2018-07-20  Michael Albinus  <address@hidden>
+
+       Fix (Bug#32218).  Do not merge with master
+
+       * doc/misc/trampver.texi:
+       * lisp/net/trampver.el: Change version to "2.3.4.26.2".
+       (customize-package-emacs-version-alist): Add Tramp version
+       integrated in Emacs 26.2.
+
+       * lisp/net/tramp.el (tramp-handle-file-truename):
+       * lisp/net/tramp-adb.el (tramp-adb-handle-file-truename):
+       * lisp/net/tramp-sh.el (tramp-sh-handle-file-truename): Fix problem
+       with trailing slash.  (Bug#32218)
+
+       * test/lisp/net/tramp-tests.el (tramp-test21-file-links):
+       Remove `tramp--test-emacs27-p' check.
+
+2018-07-20  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'pcase-defmacro rx'
+
+       * lisp/emacs-lisp/rx.el (rx): Clarify and improve the doc string.
+       For the details, see the discussion starting at
+       http://lists.gnu.org/archive/html/emacs-devel/2018-06/msg00399.html.
+
+2018-07-19  Eli Zaretskii  <address@hidden>
+
+       Fix TTY colors breakage by 'clear-face-cache'
+
+       Without examining the right frame, 'tty-color-24bit' was erroneously
+       treating a GUI frame as a 24-bit TTY frame.
+       * lisp/term/tty-colors.el (tty-color-24bit): Accept optional
+       argument DISPLAY and pass it to display-color-cells.  Doc fix.
+       (tty-color-define, tty-color-desc): Pass the FRAME argument to
+       tty-color-24bit.  (Bug#32072)
+
+2018-07-18  Michael Albinus  <address@hidden>
+
+       * admin/MAINTAINERS: Add files maintained by me (Michael Albinus).
+
+2018-07-18  Michael Albinus  <address@hidden>
+
+       Adapt shadowfile.el for Tramp  (Bug#4526, Bug#4846)
+
+       * etc/NEWS: Mention changes in shadowfile.el.
+
+       * lisp/shadowfile.el (top): Require 'tramp instead of 'ange-ftp.
+       (shadow-cluster): New defstruct.
+       (shadow-make-cluster, shadow-cluster-name, shadow-cluster-primary)
+       (shadow-cluster-regexp, shadow-get-user)
+       (shadow-parse-fullname): Remove.
+       (shadow-info-file, shadow-todo-file, shadow-system-name)
+       (shadow-homedir, shadow-regexp-superquote, shadow-suffix)
+       (shadow-set-cluster, shadow-get-cluster, shadow-site-name)
+       (shadow-name-site, shadow-site-primary, shadow-site-cluster)
+       (shadow-read-site, shadow-parse-name, shadow-make-fullname)
+       (shadow-replace-name-component, shadow-local-file)
+       (shadow-expand-cluster-in-file-name, shadow-contract-file-name)
+       (shadow-same-site, shadow-file-match, shadow-define-cluster)
+       (shadow-define-literal-group, shadow-define-regexp-group)
+       (shadow-make-group, shadow-shadows-of-1, shadow-read-files)
+       (shadow-write-info-file, shadow-write-todo-file)
+       (shadow-initialize): Adapt variables and functions.
+
+       * test/lisp/shadowfile-tests.el: New file.
+
+2018-07-18  Noam Postavsky  <address@hidden>
+
+       Fix auth-source-delete (Bug#26184)
+
+       * lisp/auth-source.el (auth-source-delete): Fix `auth-source-search'
+       call.
+       * test/lisp/auth-source-tests.el (auth-source-delete): New test.
+
+2018-07-17  Eli Zaretskii  <address@hidden>
+
+       Avoid assertion violations in gnutls.c
+
+       * src/gnutls.c (Fgnutls_hash_digest, gnutls_symmetric)
+       (Fgnutls_hash_mac): Check CONSP before invoking XCDR.  (Bug#32187)
+       Report values of invalid arguments when signaling an error.
+
+2018-07-14  Eli Zaretskii  <address@hidden>
+
+       Don't use a literal "C-u" in ispell.el  help message text
+
+       * lisp/textmodes/ispell.el (ispell-command-loop): Use
+       "\\[universal-argument]" instead of a literal "C-u".  (Bug#32142)
+
+2018-07-14  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'seqp'
+
+       * doc/lispref/sequences.texi (Sequence Functions): Add text to
+       explain the relation between 'seqp' and 'sequencep'.  (Bug#32125)
+
+2018-07-14  Eli Zaretskii  <address@hidden>
+
+       Clarify usage and dependencies between several Flyspell features
+
+       * lisp/textmodes/flyspell.el (flyspell-region)
+       (flyspell-small-region, flyspell-persistent-highlight):
+       Documentation improvements.  (Bug#32142)
+
+2018-07-13  Michael Albinus  <address@hidden>
+
+       Use consistent function names in thread-tests.el
+
+       * test/src/thread-tests.el (threads-call-error, threads-custom)
+       (threads-errors, threads-sticky-point, threads-signal-early):
+       Rename, using naming convention to prefix with "threads-".
+
+2018-07-13  Michael Albinus  <address@hidden>
+
+       Fix format error in Faccept_process_output
+
+       * src/process.c (Faccept_process_output): Do not use format spec
+       "%p", it isn't valid for error().
+
+2018-07-13  Paul Eggert  <address@hidden>
+
+       Lessen stack consumption in recursive read1
+
+       * src/lread.c (read1): Shrink local buffer size from
+       MAX_ALLOCA to 128 (Bug#31995).
+
+2018-07-13  Noam Postavsky  <address@hidden>
+
+       Match w32 paths in grep sans --null hits (Bug#32051)
+
+       * lisp/progmodes/grep.el (grep-regexp-alist): Add an optional part to
+       match paths starting with C: (other drive letters).
+       * test/lisp/progmodes/compile-tests.el
+       (compile-tests--grep-regexp-testcases)
+       (compile-tests--grep-regexp-tricky-testcases)
+       (compile-test-grep-regexps): New tests.
+       (compile--test-error-line): Return `compilation-message'.
+
+2018-07-13  Noam Postavsky  <address@hidden>
+
+       Fix previous make-network-process change
+
+       * src/process.c (Fmake_network_process): On 2018-07-09 "Explicitly
+       reject :server and :nowait (Bug#31903)", the sense of the SERVER check
+       was accidentally reversed so that we ended up looking for the wrong
+       ADDRESS.  Reported by T.V Raman in
+       <https://lists.gnu.org/archive/html/emacs-devel/2018-07/msg00437.html>.
+
+2018-07-12  Eli Zaretskii  <address@hidden>
+
+       Another documentation improvement in flyspell.el
+
+       * lisp/textmodes/flyspell.el (flyspell-persistent-highlight): Doc
+       fix.
+
+2018-07-12  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of Flyspell
+
+       For the background, see
+       http://lists.gnu.org/archive/html/help-gnu-emacs/2018-07/msg00099.html.
+
+       * doc/emacs/fixit.texi (Spelling): Add a couple of caveats.
+       * lisp/textmodes/flyspell.el: Update commentary.
+
+2018-07-12  Michael Albinus  <address@hidden>
+
+       Provide feature 'threads
+
+       * src/thread.c (syms_of_threads): Provide feature "threads".
+
+       * test/src/thread-tests.el (top): Declare the functions.
+       (all): Use (featurep 'threads) check.
+
+2018-07-11  Miciah Masters  <address@hidden>  (tiny change)
+
+       Save the server alias on reconnect (Bug#29657)
+
+       rcirc does not retain the server alias on reconnect.  As a result, rcirc
+       fails to re-use server and channel buffers when an alias is used.  
Further
+       problems may ensue when aliases are used to differentiate multiple
+       connections to the same host, for example when using a single IRC 
bouncer
+       or proxy to connect to multiple IRC networks.
+
+       Save the server alias when connecting to a server so that reconnect will
+       retain the alias.
+       * lisp/net/rcirc.el (rcirc-connect): Include server-alias when setting
+       rcirc-connection-info.
+
+2018-07-11  Basil L. Contovounesios  <address@hidden>
+
+       Refer to "proper lists" instead of "true lists"
+
+       * doc/lispref/lists.texi (Cons Cells, Building Lists):
+       * doc/lispref/sequences.texi (Vector Functions): Use the more
+       popular term "proper", rather than "true", to qualify nil-terminated
+       lists.
+
+       For discussion, see the following emacs-devel subthreads:
+       https://lists.gnu.org/archive/html/emacs-devel/2018-06/msg00112.html
+       https://lists.gnu.org/archive/html/emacs-devel/2018-06/msg00138.html
+
+2018-07-10  John Shahid  <address@hidden>
+
+       Avoid turning on the global-minor-mode recursively
+
+       * lisp/emacs-lisp/easy-mmode.el (define-globalized-minor-mode): Clear
+       the buffer-list inside MODE-enable-in-buffers to avoid enabling the
+       mode recursively.  (Bug#31793)
+
+2018-07-10  Michael Albinus  <address@hidden>
+
+       Fix Bug#32085
+
+       * doc/misc/tramp.texi (GVFS based methods): `dav' and `davs' do
+       not support paths in the volume name.  (Bug#32085)
+
+2018-07-10  Noam Postavsky  <address@hidden>
+
+       Stop using indent-line-to in lisp-indent-line (Bug#32014)
+
+       This is partial revert of "Remove ignored argument from
+       lisp-indent-line", because `indent-line-to' doesn't respect field
+       boundaries.
+       * lisp/emacs-lisp/lisp-mode.el (lisp-indent-line): Use delete-region
+       and indent-to instead of `indent-line-to'.
+       * test/lisp/emacs-lisp/lisp-mode-tests.el
+       (lisp-indent-with-read-only-field): Expect to pass.
+
+       Don't merge to master, we will fix indent-line-to there instead.
+
+2018-07-10  Noam Postavsky  <address@hidden>
+
+       Explicitly reject :server and :nowait (Bug#31903)
+
+       * src/process.c (Fmake_network_process): Explicitly check for and
+       signal an error when passed both :server and :nowait non-nil.  In
+       Emacs 25, :nowait would be ignored in this case, but as of Emacs 26.1
+       this gives an error, albeit an unclear one.  Also remove obsolete
+       comment regarding configurations lacking non-blocking mode, the
+       corresponding code was removed in 2012-11-17 "Assume POSIX 1003.1-1988
+       or later for fcntl.h."
+
+2018-07-09  Michael Albinus  <address@hidden>
+
+       Fix Bug#32090
+
+       * lisp/files-x.el (connection-local-normalize-criteria): Do not
+       use PROPERTIES anymore.
+       (connection-local-get-profiles): Rewrite, in order to accept any
+       property as optional.  (Bug#32090)
+       (connection-local-set-profiles):
+       Adapt ´connection-local-normalize-criteria' call.
+
+       * test/lisp/files-x-tests.el
+       (files-x-test-connection-local-set-profiles)
+       (files-x-test-hack-connection-local-variables-apply): Extend tests.
+
+2018-07-08  Paul Eggert  <address@hidden>
+
+       Fix floating point exceptions on Alpha (Bug#32086)
+
+       Backport from master.
+       * admin/merge-gnulib (GNULIB_MODULES): Add fpieee.
+       * m4/fpieee.m4: New file, copied from Gnulib.
+       * m4/gnulib-comp.m4: Regenerate.
+
+2018-07-08  Paul Eggert  <address@hidden>
+
+       Fix bootstrap infloop in GNU/Linux alpha
+
+       * src/emacs.c (main): Do not re-exec if EMACS_HEAP_EXEC
+       is already set (Bug#32083).
+
+2018-07-08  Eli Zaretskii  <address@hidden>
+
+       Minor fix of a recent documentation change
+
+       * lisp/net/gnutls.el (gnutls-algorithm-priority): Clarify the doc
+       string.
+
+2018-07-08  Lars Ingebrigtsen  <address@hidden>
+
+       Mention the NSM in the gnutls variable doc strings
+
+       * lisp/net/gnutls.el (gnutls-algorithm-priority): Mention the Network
+       Security Manager here since this variable is an obvious place
+       for people concerned about network security to look.
+       (gnutls-verify-error): Ditto.
+       (gnutls-min-prime-bits): Ditto.
+
+2018-07-08  Michael Albinus  <address@hidden>
+
+       Remove test code from last commit
+
+2018-07-08  Michael Albinus  <address@hidden>
+
+       Fix Bug#32084
+
+       * test/lisp/net/dbus-tests.el (dbus-test02-register-service-own-bus):
+       Unset $DISPLAY when calling dbus-launch, in order to avoid
+       possible X11 authentication errors.  (Bug#32084)
+
+2018-07-07  Basil L. Contovounesios  <address@hidden>
+
+       Fix (length NON-SEQUENCE) documentation
+
+       Suggested by Eli Zaretskii <address@hidden> in the following threads:
+       https://lists.gnu.org/archive/html/emacs-devel/2018-07/msg00171.html
+       https://lists.gnu.org/archive/html/emacs-devel/2018-07/msg00206.html
+
+       * doc/lispref/sequences.texi (Sequence Functions): Mention that
+       'length' signals a 'wrong-type-argument' also when given a
+       non-sequencep argument.
+
+2018-07-07  Eli Zaretskii  <address@hidden>
+
+       Fix bug #11732
+
+       * src/w32fns.c (w32_wnd_proc): Fix handling of Windows input
+       methods.  (Bug#11732)
+
+2018-07-07  Eli Zaretskii  <address@hidden>
+
+       Improve documentation of 'emacs-lock-mode'
+
+       * lisp/emacs-lock.el (emacs-lock-mode): Mention in the doc string
+       the special handling of some major modes due to
+       'emacs-lock-unlockable-modes'.
+
+2018-07-07  Eli Zaretskii  <address@hidden>
+
+       * lisp/imenu.el (imenu-generic-expression): Doc fix.  (Bug#32016)
+
+2018-07-07  Eli Zaretskii  <address@hidden>
+
+       Improve indexing of 'eval-defun' in ELisp manual
+
+       * doc/lispref/display.texi (Defining Faces):
+       * doc/lispref/debugging.texi (Explicit Debug):
+       * doc/lispref/customize.texi (Variable Definitions):
+       * doc/lispref/variables.texi (Defining Variables): Add index
+       entries for 'eval-defun'.  (Bug#32066)
+
+2018-07-06  Paul Eggert  <address@hidden>
+
+       Fix (length CIRCULAR) documentation
+
+       * doc/lispref/sequences.texi (Sequence Functions):
+       Correct documentation of what (length X) does when
+       X is a circular list.
+
+2018-07-06  Michael Albinus  <address@hidden>
+
+       Tramp editorials
+
+       * doc/misc/tramp.texi (Android shell setup): Mention Termux.
+
+       * lisp/net/tramp-sh.el (tramp-remote-process-environment):
+       Use proper spelling "Tramp" in docstring.
+
+2018-07-06  Eli Zaretskii  <address@hidden>
+
+       Clarify and improve doc strings of 'eval-last-sexp' and friends
+
+       * lisp/simple.el (eval-expression, eval-expression-print-format):
+       * lisp/progmodes/elisp-mode.el (eval-last-sexp): Doc fixes.
+       (Bug#32064)
+
+2018-07-06  Glenn Morris  <address@hidden>
+
+       Automate upload of Emacs manuals to gnu.org
+
+       * admin/make-manuals, admin/upload-manuals: New scripts.
+       * admin/admin.el (make-manuals, make-manuals-dist): Handle batch mode.
+       * admin/make-tarball.txt: Update web-page details.
+
+2018-07-05  Mike Kupfer  <address@hidden>
+
+       Fix MH-E mail composition with GNU Mailutils (SF#485)
+
+       * lisp/mh-e/mh-comp.el (mh-bare-components): Recursively delete
+       the temporary folder.
+
+2018-07-03  Eli Zaretskii  <address@hidden>
+
+       Speed up 'replace-buffer-contents' some more
+
+       * src/editfns.c (EXTRA_CONTEXT_FIELDS): New members beg_a and beg_b.
+       (Freplace_buffer_contents): Set up ctx.beg_a and ctx.beg_b.
+       (buffer_chars_equal): Use ctx->beg_a and ctx->beg_b instead of
+       calling BUF_BEGV, which is expensive.  This speeds up the recipe
+       in bug#31888 by 30%.
+
+2018-07-03  Glenn Morris  <address@hidden>
+
+       * doc/emacs/docstyle.texi: Avoid messing up the html output.
+
+       Previously the @hyphenation commands somehow caused the <head>
+       section to go missing, with makeinfo 4.13 at least.
+
 2018-07-01  Paul Eggert  <address@hidden>
 
        * etc/HISTORY: Cite Brinkhoff on early history.
@@ -61157,14 +64946,14 @@
 
 This file records repository revisions from
 commit 9d56a21e6a696ad19ac65c4b405aeca44785884a (exclusive) to
-commit f205928d1f93f4373d755ca91805a88e022ac414 (inclusive).
+commit 0f523deec1c1e9e2a5a3474f912aa2183d3fe33d (inclusive).
 See ChangeLog.1 for earlier changes.
 
 ;; Local Variables:
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2015-2018 Free Software Foundation, Inc.
+  Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/GNUmakefile b/GNUmakefile
index 0c1a757..e878dbb 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,6 +1,6 @@
 # Build Emacs from a fresh tarball or version-control checkout.
 
-# Copyright (C) 2011-2018 Free Software Foundation, Inc.
+# Copyright (C) 2011-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/INSTALL b/INSTALL
index 0c56fff..8022385 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,5 @@
 GNU Emacs Installation Guide
-Copyright (C) 1992, 1994, 1996-1997, 2000-2018 Free Software Foundation,
+Copyright (C) 1992, 1994, 1996-1997, 2000-2019 Free Software Foundation,
 Inc.
 See the end of the file for license conditions.
 
@@ -318,6 +318,12 @@ features enabled, you can combine --without-all with 
--with-FEATURE.
 For example, you can use --without-all --without-x --with-dbus to
 build with D-Bus support and nothing more.
 
+Use --with-gnutls=ifavailable to use GnuTLS if available but go ahead
+and build without it if not available.  This overrides Emacs's default
+behavior of refusing to build if GnuTLS is absent.  When X11 support
+is enabled, the libraries for gif, jpeg, png, tiff, and xpm are in the
+same strongly-recommended category as GnuTLS, and have similar options.
+
 Use --with-wide-int to implement Emacs values with the type 'long long',
 even on hosts where a narrower type would do.  With this option, on a
 typical 32-bit host, Emacs integers have 62 bits instead of 30.
diff --git a/INSTALL.REPO b/INSTALL.REPO
index caa46b4..6dca9dd 100644
--- a/INSTALL.REPO
+++ b/INSTALL.REPO
@@ -76,7 +76,7 @@ never platform-specific.
 
 
 
-Copyright (C) 2002-2018 Free Software Foundation, Inc.
+Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/Makefile.in b/Makefile.in
index f0b2b66..5370363 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1992-2018 Free Software Foundation, Inc.
+# Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -66,6 +66,8 @@
 
 SHELL = @SHELL@
 
address@hidden@
+
 # This only matters when inheriting a CDPATH not starting with the
 # current directory.
 CDPATH=
@@ -491,6 +493,9 @@ install-arch-dep: src install-arch-indep install-etcdoc 
install-$(NTDIR)
        $(MAKE) -C lib-src install
 ifeq (${ns_self_contained},no)
        ${INSTALL_PROGRAM} $(INSTALL_STRIP) src/emacs${EXEEXT} 
"$(DESTDIR)${bindir}/$(EMACSFULL)"
+ifeq (${DUMPING},pdumper)
+       ${INSTALL_DATA} src/emacs.pdmp 
"$(DESTDIR)${libexecdir}/emacs/${version}/${configuration}"/emacs.pdmp
+endif
        -chmod 755 "$(DESTDIR)${bindir}/$(EMACSFULL)"
 ifndef NO_BIN_LINK
        rm -f "$(DESTDIR)${bindir}/$(EMACS)"
@@ -939,7 +944,9 @@ extraclean: $(extraclean_dirs:=_extraclean)
 # The src subdir knows how to do the right thing
 # even when the build directory and source dir are different.
 .PHONY: TAGS tags
-TAGS tags: lib lib-src src
+# FIXME: We used to include `src` in the dependencies, not sure why.
+# I removed it because it causes `make tags` to build Emacs.
+TAGS tags: lib lib-src # src
        $(MAKE) -C src tags
 
 .PHONY: have-tests
diff --git a/README b/README
index 25adcfd..7236816 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES
index 04d1ff7..ea99d50 100644
--- a/admin/CPP-DEFINES
+++ b/admin/CPP-DEFINES
@@ -104,7 +104,6 @@ HAVE_ALLOCA_H
 HAVE_ALSA
 HAVE_BDFFONT
 HAVE_BOXES
-HAVE_C99_STRTOLD
 HAVE_CFMAKERAW
 HAVE_CFSETSPEED
 HAVE_CLOCK_GETTIME
@@ -181,7 +180,6 @@ HAVE_GTK_WINDOW_SET_HAS_RESIZE_GRIP
 HAVE_G_TYPE_INIT
 HAVE_IFADDRS_H
 HAVE_IMAGEMAGICK
-HAVE_INET_SOCKETS
 HAVE_INTTYPES_H
 HAVE_JPEG
 HAVE_KERBEROSIV_KRB_H
diff --git a/admin/ChangeLog.1 b/admin/ChangeLog.1
index c318750..6889407 100644
--- a/admin/ChangeLog.1
+++ b/admin/ChangeLog.1
@@ -2577,7 +2577,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/admin/README b/admin/README
index 58e3c5b..54b79ab 100644
--- a/admin/README
+++ b/admin/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/admin/admin.el b/admin/admin.el
index 1cad7ae..650cf47 100644
--- a/admin/admin.el
+++ b/admin/admin.el
@@ -1,6 +1,6 @@
 ;;; admin.el --- utilities for Emacs administration
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -144,7 +144,7 @@ Root must be the root of an Emacs source tree."
     (unless (> (length newversion) 2)   ; pretest or release candidate?
       (with-temp-buffer
         (insert-file-contents newsfile)
-        (if (re-search-forward "^\\(+++ *\\|--- *\\)$" nil t)
+        (if (re-search-forward "^\\(\\+\\+\\+ *\\|--- *\\)$" nil t)
             (display-warning 'admin
                              "NEWS file still contains temporary markup.
 Documentation changes might not have been completed!"))))
@@ -657,7 +657,7 @@ style=\"text-align:left\">")
 
 
 (defconst make-manuals-dist-output-variables
-  `(("@\\(top_\\)?srcdir@" . ".")      ; top_srcdir is wrong, but not used
+  '(("@\\(top_\\)?srcdir@" . ".")      ; top_srcdir is wrong, but not used
     ("^\\(\\(?:texinfo\\|buildinfo\\|emacs\\)dir *=\\).*" . "\\1 .")
     ("^\\(clean:.*\\)" . "\\1 infoclean")
     ("@MAKEINFO@" . "makeinfo")
diff --git a/admin/alloc-colors.c b/admin/alloc-colors.c
index e1a344b..5f47acc 100644
--- a/admin/alloc-colors.c
+++ b/admin/alloc-colors.c
@@ -1,6 +1,6 @@
 /* Allocate X colors.  Used for testing with dense colormaps.
 
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/admin/authors.el b/admin/authors.el
index 1ff98fa..a3f8bdd 100644
--- a/admin/authors.el
+++ b/admin/authors.el
@@ -1,7 +1,7 @@
 
 ;;; authors.el --- utility for maintaining Emacs's AUTHORS file
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Gerd Moellmann <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/admin/automerge b/admin/automerge
index 8bf9817..405fd9e 100755
--- a/admin/automerge
+++ b/admin/automerge
@@ -1,7 +1,7 @@
 #!/bin/bash
 ### automerge - automatically merge the Emacs release branch to master
 
-## Copyright (C) 2018 Free Software Foundation, Inc.
+## Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <address@hidden>
 
diff --git a/admin/build-configs b/admin/build-configs
index 3739d4b..09800fc 100755
--- a/admin/build-configs
+++ b/admin/build-configs
@@ -1,7 +1,7 @@
 #! /usr/bin/perl
 # Build Emacs in several different configurations.
 
-# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/admin/charsets/Makefile.in b/admin/charsets/Makefile.in
index 8755c18..0327a5d 100644
--- a/admin/charsets/Makefile.in
+++ b/admin/charsets/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 2015-2018 Free Software Foundation, Inc.
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 #   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/admin/charsets/mapconv b/admin/charsets/mapconv
index c7e7aa7..8e19972 100755
--- a/admin/charsets/mapconv
+++ b/admin/charsets/mapconv
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# Copyright (C) 2015-2018 Free Software Foundation, Inc.
+# Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 #   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/admin/charsets/mapfiles/README b/admin/charsets/mapfiles/README
index 825ec62..7e4493b 100644
--- a/admin/charsets/mapfiles/README
+++ b/admin/charsets/mapfiles/README
@@ -1,4 +1,4 @@
-Copyright (C) 2009-2018 Free Software Foundation, Inc.
+Copyright (C) 2009-2019 Free Software Foundation, Inc.
 Copyright (C) 2009, 2010, 2011
   National Institute of Advanced Industrial Science and Technology (AIST)
   Registration Number H13PRO009
diff --git a/admin/cus-test.el b/admin/cus-test.el
index 13d777d..f9fd53d 100644
--- a/admin/cus-test.el
+++ b/admin/cus-test.el
@@ -1,6 +1,6 @@
 ;;; cus-test.el --- tests for custom types and load problems
 
-;; Copyright (C) 1998, 2000, 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000, 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Markus Rost <address@hidden>
 ;; Maintainer: Markus Rost <address@hidden>
diff --git a/admin/diff-tar-files b/admin/diff-tar-files
index 87446fb..79a035b 100755
--- a/admin/diff-tar-files
+++ b/admin/diff-tar-files
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/admin/find-gc.el b/admin/find-gc.el
index e8cc113..bf93c4e 100644
--- a/admin/find-gc.el
+++ b/admin/find-gc.el
@@ -1,6 +1,6 @@
 ;;; find-gc.el --- detect functions that call the garbage collector
 
-;; Copyright (C) 1992, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 
diff --git a/admin/gitmerge.el b/admin/gitmerge.el
index 6dedee8..edf4379 100644
--- a/admin/gitmerge.el
+++ b/admin/gitmerge.el
@@ -1,6 +1,6 @@
 ;;; gitmerge.el --- help merge one Emacs branch into another
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Authors: David Engster <address@hidden>
 ;;          Stefan Monnier <address@hidden>
@@ -51,7 +51,7 @@
   ;; We used to include "sync" in there, but in my experience it only
   ;; caused false positives.  --Stef
   (let ((skip "back[- ]?port\\|cherry picked from commit\\|\
-\\(do\\( no\\|n['’]\\)t\\|no need to\\) merge\\|\
+\\(do\\( no\\|n['’]\\)t\\|no need to\\) merge\\|not to be merged\\|\
 bump \\(Emacs \\)?version\\|Auto-commit"))
     (if noninteractive skip
       ;; "Regenerate" is quite prone to false positives.
@@ -294,7 +294,7 @@ Returns non-nil if conflicts remain."
            ((derived-mode-p 'change-log-mode)
             ;; Fix up dates before resolving the conflicts.
             (goto-char (point-min))
-            (let ((diff-auto-refine-mode nil))
+            (let ((diff-refine nil))
               (while (re-search-forward smerge-begin-re nil t)
                 (smerge-match-conflict)
                 (smerge-ensure-match 3)
diff --git a/admin/grammars/Makefile.in b/admin/grammars/Makefile.in
index 1f6a863..2d9d0e8 100644
--- a/admin/grammars/Makefile.in
+++ b/admin/grammars/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-## Copyright (C) 2013-2018 Free Software Foundation, Inc.
+## Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ## This file is part of GNU Emacs.
 
diff --git a/admin/grammars/c.by b/admin/grammars/c.by
index 3755c32..bd1b6a5 100644
--- a/admin/grammars/c.by
+++ b/admin/grammars/c.by
@@ -1,5 +1,5 @@
 ;;; c.by -- LL grammar for C/C++ language specification
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Eric M. Ludlam <address@hidden>
 ;;         David Ponce <address@hidden>
diff --git a/admin/grammars/grammar.wy b/admin/grammars/grammar.wy
index d8647f9..f7664de 100644
--- a/admin/grammars/grammar.wy
+++ b/admin/grammars/grammar.wy
@@ -1,6 +1,6 @@
 ;;; semantic-grammar.wy -- LALR grammar of Semantic input grammars
 ;;
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: David Ponce <address@hidden>
 ;; Maintainer: David Ponce <address@hidden>
diff --git a/admin/grammars/java-tags.wy b/admin/grammars/java-tags.wy
index b3c23d5..88beafe 100644
--- a/admin/grammars/java-tags.wy
+++ b/admin/grammars/java-tags.wy
@@ -1,6 +1,6 @@
 ;;; java-tags.wy -- Semantic LALR grammar for Java
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: David Ponce <address@hidden>
 ;; Maintainer: David Ponce <address@hidden>
diff --git a/admin/grammars/js.wy b/admin/grammars/js.wy
index 653d2b0..441fd41 100644
--- a/admin/grammars/js.wy
+++ b/admin/grammars/js.wy
@@ -1,6 +1,6 @@
 ;;; javascript-jv.wy -- LALR grammar for Javascript
 
-;; Copyright (C) 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1998-2011 Ecma International.
 
 ;; Author: Joakim Verona
diff --git a/admin/grammars/make.by b/admin/grammars/make.by
index da1320d..423c952 100644
--- a/admin/grammars/make.by
+++ b/admin/grammars/make.by
@@ -1,6 +1,6 @@
 ;;; make.by -- BY notation for Makefiles.
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Eric M. Ludlam <address@hidden>
 ;;         David Ponce <address@hidden>
diff --git a/admin/grammars/python.wy b/admin/grammars/python.wy
index 1f02d43..5e5bdc1 100644
--- a/admin/grammars/python.wy
+++ b/admin/grammars/python.wy
@@ -1,6 +1,6 @@
 ;;; python.wy -- LALR grammar for Python
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 ;; Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
 ;; 2009, 2010 Python Software Foundation; All Rights Reserved
 
diff --git a/admin/grammars/scheme.by b/admin/grammars/scheme.by
index 5ea2550..76ded7f 100644
--- a/admin/grammars/scheme.by
+++ b/admin/grammars/scheme.by
@@ -1,6 +1,6 @@
 ;;; scheme.by -- Scheme BNF language specification
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/admin/grammars/srecode-template.wy 
b/admin/grammars/srecode-template.wy
index de52ede..fb56d23 100644
--- a/admin/grammars/srecode-template.wy
+++ b/admin/grammars/srecode-template.wy
@@ -1,6 +1,6 @@
 ;;; srecode-template.wy --- Semantic Recoder Template parser
 
-;; Copyright (C) 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Ludlam <address@hidden>
 ;; Keywords: syntax
diff --git a/admin/last-chance.el b/admin/last-chance.el
index c536ca8..5f993be 100644
--- a/admin/last-chance.el
+++ b/admin/last-chance.el
@@ -1,6 +1,6 @@
 ;;; last-chance.el --- dangling deterrence     -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Thien-Thi Nguyen <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/admin/make-emacs b/admin/make-emacs
index 5ff2f5a..b7cca06 100755
--- a/admin/make-emacs
+++ b/admin/make-emacs
@@ -2,7 +2,7 @@
 # Build Emacs with various options for profiling, debugging,
 # with and without warnings enabled etc.
 
-# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/admin/make-manuals b/admin/make-manuals
index 7b9f6a2..4e65d3d 100755
--- a/admin/make-manuals
+++ b/admin/make-manuals
@@ -1,7 +1,7 @@
 #!/bin/bash
 ### make-manuals - create the Emacs manuals to upload to the gnu.org website
 
-## Copyright 2018 Free Software Foundation, Inc.
+## Copyright 2018-2019 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <address@hidden>
 
diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index 575e3fa..055e791 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -4,7 +4,7 @@
 #
 #      admin/merge-gnulib
 
-# Copyright 2012-2018 Free Software Foundation, Inc.
+# Copyright 2012-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -30,9 +30,9 @@ GNULIB_MODULES='
   careadlinkat close-stream
   count-leading-zeros count-one-bits count-trailing-zeros
   crypto/md5-buffer crypto/sha1-buffer crypto/sha256-buffer 
crypto/sha512-buffer
-  d-type diffseq dtoastr dtotimespec dup2
+  d-type diffseq dosname dtoastr dtotimespec dup2
   environ execinfo explicit_bzero faccessat
-  fcntl fcntl-h fdatasync fdopendir
+  fcntl fcntl-h fdopendir
   filemode filevercmp flexmember fpieee fstatat fsusage fsync
   getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog
   ieee754-h ignore-value intprops largefile lstat
diff --git a/admin/merge-pkg-config b/admin/merge-pkg-config
index a7d7122..61f96e5 100755
--- a/admin/merge-pkg-config
+++ b/admin/merge-pkg-config
@@ -4,7 +4,7 @@
 #
 #      admin/merge-pkg-config
 
-# Copyright 2014-2018 Free Software Foundation, Inc.
+# Copyright 2014-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/admin/notes/bugtracker b/admin/notes/bugtracker
index f3bc304..92ae326 100644
--- a/admin/notes/bugtracker
+++ b/admin/notes/bugtracker
@@ -241,21 +241,29 @@ report, and Bcc: the control server (note the commands 
have no effect
 if you just send them to the bug-report number).  Bcc: is better than Cc:
 in case people use Reply-To-All in response.
 
+For the full documentation of control commands, see
+https://debbugs.gnu.org/server-control.html
+
 Some useful control commands:
 
+*** To close a bug and indicate in what Emacs version it was fixed
+close 123 VERSION
+
+where VERSION is XX.YY numerical version number, like 42.1.
+
 *** To reopen a closed bug:
 reopen 123
 
 *** Bugs can be tagged in various ways (eg wontfix, patch, etc).
 The available tags are:
-patch wontfix moreinfo unreproducible fixed notabug
+patch wontfix moreinfo unreproducible fixed notabug security confirmed
 See https://debbugs.gnu.org/Developer#tags
 The list of tags can be prefixed with +, - or =, meaning to add (the
 default), remove, or reset the tags. E.g.:
 
 tags 123 + wontfix
 
-** URL shortcuts
+*** URL shortcuts
 
 https://debbugs.gnu.org/...
 
@@ -266,7 +274,7 @@ from:address@hidden
 severity:severity      # all bugs of given severity
 tag:tag                # all bugs with given tag
 
-** Usertags
+*** Usertags
 
 See <http://wiki.debian.org/bugs.debian.org/usertags>
 
@@ -410,21 +418,21 @@ reassign 1234 emacs
 Note that reassigning clears the list of found versions, even if the
 new packages includes the original one.
 
-** To remove spam from the tracker, move it to the 'spam' pseudo-package:
+*** To remove spam from the tracker, move it to the 'spam' pseudo-package:
 reassign 123 spam
 
 (Should not be necessary any more, now that the input is moderated.)
 
-** To change the title of a bug:
+*** To change the title of a bug:
 retitle 123 Some New Title
 
-** To change the submitter address:
+*** To change the submitter address:
 submitter 123 address@hidden
 
 Note that it does not seem to work to specify "Submitter:" in the
 pseudo-header when first reporting a bug.
 
-** How does archiving work?
+*** How does archiving work?
 You can still send mail to a bug after it is closed.  After 28 days with
 no activity, the bug is archived, at which point no more changes can
 be made.  If you try to send mail to the bug after that (or merge with
diff --git a/admin/notes/copyright b/admin/notes/copyright
index 246950e..e22db6b 100644
--- a/admin/notes/copyright
+++ b/admin/notes/copyright
@@ -1,4 +1,4 @@
-Copyright (C) 2007-2018 Free Software Foundation, Inc.
+Copyright (C) 2007-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
@@ -161,9 +161,6 @@ etc/letter.pbm,letter.xpm
   - trivial, no notice needed.
 <https://lists.gnu.org/r/emacs-devel/2007-02/msg00324.html>
 
-etc/FTP, ORDERS
-  - trivial (at time of writing), no license needed
-
 etc/HELLO
   standard notices. Just a note that although the file itself is not
   really copyrightable, in the wider context of it being part of
diff --git a/admin/notes/emba b/admin/notes/emba
new file mode 100644
index 0000000..cb0dbc4
--- /dev/null
+++ b/admin/notes/emba
@@ -0,0 +1,64 @@
+-*- mode: outline; coding: utf-8 -*-
+
+Copyright (C) 2019 Free Software Foundation, Inc.
+See the end of the file for license conditions.
+
+NOTES FOR EMACS CONTINUOUS BUILD ON EMBA
+
+A continuous build for Emacs can be found at
+<https://emba.gnu.org/emacs/emacs>, a Gitlab instance.  It watches the
+Emacs git repository and starts a pipeline (jobset) if there are new
+changes.  This happens for all Emacs branches.
+
+* Mail notifications
+
+In addition to the web interface, emba can send notifications by email
+when a job fails.  It sends notifications about test status to
+<address@hidden>.
+
+If you want to receive these notifications, please subscribe at
+<https://lists.gnu.org/mailman/listinfo/emacs-buildstatus>.
+
+Alternatively, these notifications can be read via gmane at
+<nntp+news.gmane.org:gmane.emacs.buildstatus>.
+
+The messages contain a URL to the log file of the failed job, like
+<https://emba.gnu.org/emacs/emacs/-/jobs/739/raw>.
+
+* Emacs jobset
+
+The Emacs jobset is defined in the Emacs source tree, file
+'.gitlab-ci.yml'.  It could be adapted for every Emacs branch, see
+<https://emba.gnu.org/help/ci/yaml/README.md>.
+
+Every job runs in a Debian docker container.  It uses the local clone
+of the Emacs git repository to perform a bootstrap and test of Emacs.
+This could happen for several jobs with changed configuration, compile
+and test parameters.
+
+* Emba configuration
+
+The emba configuration files are hosted on
+<https://gitlab.com/emacs-ci/emba-ansible>.
+
+* Identifying emba
+
+Lisp packages, Makefiles, scripts, and other software could determine
+whether they run on emba by checking for the environment variable
+EMACS_EMBA_CI.
+
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
diff --git a/admin/notes/font-backend b/admin/notes/font-backend
index fcb9c37..eef7439 100644
--- a/admin/notes/font-backend
+++ b/admin/notes/font-backend
@@ -1,4 +1,4 @@
-Copyright (C) 2002-2018 Free Software Foundation, Inc.
+Copyright (C) 2002-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/admin/notes/hydra b/admin/notes/hydra
index 5fe8332..da8d986 100644
--- a/admin/notes/hydra
+++ b/admin/notes/hydra
@@ -1,6 +1,6 @@
 -*- mode: outline; coding: utf-8 -*-
 
-Copyright (C) 2013-2018 Free Software Foundation, Inc.
+Copyright (C) 2013-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 NOTES FOR EMACS CONTINUOUS BUILD ON HYDRA
@@ -10,8 +10,6 @@ https://hydra.nixos.org/jobset/gnu/emacs-trunk
 
 * It builds Emacs on various platforms.
 Sometimes jobs fail due to hydra problems rather than Emacs problems.
-Eg it seems like the darwin build will never work again.
-https://lists.gnu.org/r/hydra-users/2016-01/msg00000.html
 
 * Mail notifications
 In addition to the web interface, Hydra can send notifications by
@@ -22,6 +20,8 @@ Emacs trunk to address@hidden
 If you want to receive these notifications, please subscribe at
 https://lists.gnu.org/mailman/listinfo/emacs-buildstatus
 
+(This feature seems to have been broken for ages.)
+
 * The Emacs jobset consists of the following jobs:
 
 ** The 'tarball' job
diff --git a/admin/notes/multi-tty b/admin/notes/multi-tty
index 5b34bb5..e15a25b 100644
--- a/admin/notes/multi-tty
+++ b/admin/notes/multi-tty
@@ -1,6 +1,6 @@
 -*- coding: utf-8; mode: text; -*-
 
-Copyright (C) 2007-2018 Free Software Foundation, Inc.
+Copyright (C) 2007-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 From README.multi-tty in the multi-tty branch.
@@ -171,7 +171,11 @@ preload-emacs "$name" wait
 name="$1"
 waitp="$2"
 screendir="/var/run/screen/S-$USER"
-serverdir="/tmp/emacs$UID"
+if [ "${XDG_RUNTIME_DIR+set}" ]; then
+  serverdir="$XDG_RUNTIME_DIR/emacs"
+else
+  serverdir="${TMPDIR-/tmp}/emacs$UID"
+fi
 emacs=/usr/bin/emacs-multi-tty # Or wherever you installed your multi-tty Emacs
 
 if [ -z "$name" ]; then
diff --git a/admin/notes/unicode b/admin/notes/unicode
index 40f93fc..4d6aa6e 100644
--- a/admin/notes/unicode
+++ b/admin/notes/unicode
@@ -1,6 +1,6 @@
                                             -*-mode: text; coding: utf-8;-*-
 
-Copyright (C) 2002-2018 Free Software Foundation, Inc.
+Copyright (C) 2002-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Importing a new Unicode Standard version into Emacs
@@ -11,15 +11,20 @@ Emacs uses the following files from the Unicode Character 
Database
 
   . UnicodeData.txt
   . Blocks.txt
-  . BidiMirroring.txt
   . BidiBrackets.txt
+  . BidiCharacterTest.txt
+  . BidiMirroring.txt
   . IVD_Sequences.txt
   . NormalizationTest.txt
   . SpecialCasing.txt
-  . BidiCharacterTest.txt
 
 First, the first 7 files need to be copied into admin/unidata/, and
-then Emacs should be rebuilt for them to take effect.  Rebuilding
+the file https://www.unicode.org/copyright.html should be copied over
+copyright.html in admin/unidata (that file might need trailing
+whitespace removed before it can be committed to the Emacs
+repository).
+
+Then Emacs should be rebuilt for them to take effect.  Rebuilding
 Emacs updates several derived files elsewhere in the Emacs source
 tree, mainly in lisp/international/.
 
@@ -28,7 +33,10 @@ files, pay attention to any warning or error messages.  In 
particular,
 admin/unidata/unidata-gen.el will complain if UnicodeData.txt defines
 new bidirectional attributes of characters, because unidata-gen.el,
 bidi.c and dispextern.h need to be updated in that case; failure to do
-so will cause aborts in redisplay.
+so will cause aborts in redisplay.  unidata-gen.el will also complain
+if the format of the Unicode Copyright notice in copyright.html
+changed in significant ways; in that case, update the regular
+expression in unidata-gen-file used to extract the copyright string.
 
 Next, review the changes in UnicodeData.txt vs the previous version
 used by Emacs.  Any changes, be it introduction of new scripts or
@@ -40,7 +48,12 @@ and see if any changes in admin/unidata/blocks.awk are 
required.
 
 The setting of char-width-table around line 1200 of characters.el
 should be checked against the latest version of the Unicode file
-EastAsianWidth.txt, and any discrepancies fixed.
+EastAsianWidth.txt, and any discrepancies fixed: double-width
+characters are those marked with W or F in that file.  Zero-width
+characters are not taken from EastAsianWidth.txt, they are those whose
+Unicode General Category property is one of Mn, Me, or Cf, and also
+Hangul jungseong and jongseong characters (a.k.a. "Jamo medial vowels"
+and "Jamo final consonants").
 
 Any new scripts added by UnicodeData.txt will also need updates to
 script-representative-chars defined in fontset.el, and also the list
@@ -230,37 +243,21 @@ nontrivial changes to the build process.
 
        admin/charsets/mapfiles/cns2ucsdkw.txt
 
- * iso-2022-7bit
+ * iso-2022-jp
 
-     Each of these files contains just one CJK charset, but Emacs
-     currently has no easy way to specify set-charset-priority on a
-     per-file basis, so converting any of these files to UTF-8 might
-     change the file's appearance when viewed by an Emacs that is
-     operating in some other language environment.
+     This contains just one CJK charset, but Emacs currently has no
+     easy way to specify set-charset-priority on a per-file basis, so
+     converting this file to UTF-8 might change the file's appearance
+     when viewed by an Emacs that is operating in some other language
+     environment.
 
        etc/tutorials/TUTORIAL.ja
-       lisp/international/ja-dic-cnv.el
-       lisp/international/ja-dic-utl.el
-       lisp/international/kinsoku.el
-       lisp/international/kkc.el
-       lisp/international/titdic-cnv.el
-       lisp/language/japan-util.el
-       lisp/language/japanese.el
-       lisp/leim/quail/cyril-jis.el
-       lisp/leim/quail/hanja-jis.el
-       lisp/leim/quail/japanese.el
-       lisp/leim/quail/py-punct.el
-       lisp/leim/quail/pypunct-b5.el
-
-     This file contains just Chinese characters, and has same problem.
-     Also, it contains characters that cannot be encoded in UTF-8.
-
-       lisp/international/titdic-cnv.el
 
  * utf-8-emacs
 
      These files contain characters that cannot be encoded in UTF-8.
 
+       lisp/international/titdic-cnv.el
        lisp/language/ethio-util.el
        lisp/language/ethiopic.el
        lisp/language/ind-util.el
diff --git a/admin/notes/www b/admin/notes/www
index 2652ecc..ed2349d 100644
--- a/admin/notes/www
+++ b/admin/notes/www
@@ -1,6 +1,6 @@
 -*- outline -*-
 
-Copyright (C) 2013-2018 Free Software Foundation, Inc.
+Copyright (C) 2013-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 NOTES FOR EMACS WWW PAGES
diff --git a/admin/nt/README-UNDUMP.W32 b/admin/nt/README-UNDUMP.W32
index e54e208..d692a30 100644
--- a/admin/nt/README-UNDUMP.W32
+++ b/admin/nt/README-UNDUMP.W32
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
                           Emacs for Windows
diff --git a/admin/nt/README-ftp-server b/admin/nt/README-ftp-server
index 3378820..0c68d99 100644
--- a/admin/nt/README-ftp-server
+++ b/admin/nt/README-ftp-server
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
                      Precompiled Distributions of
diff --git a/admin/nt/dist-build/build-dep-zips.py 
b/admin/nt/dist-build/build-dep-zips.py
index e6c1ce8..5a5bfe7 100755
--- a/admin/nt/dist-build/build-dep-zips.py
+++ b/admin/nt/dist-build/build-dep-zips.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python3
 
-## Copyright (C) 2017-2018 Free Software Foundation, Inc.
+## Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ## This file is part of GNU Emacs.
 
diff --git a/admin/nt/dist-build/build-zips.sh 
b/admin/nt/dist-build/build-zips.sh
index 7ffa862..4404c77 100755
--- a/admin/nt/dist-build/build-zips.sh
+++ b/admin/nt/dist-build/build-zips.sh
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-## Copyright (C) 2017-2018 Free Software Foundation, Inc.
+## Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ## This file is part of GNU Emacs.
 
diff --git a/admin/quick-install-emacs b/admin/quick-install-emacs
index e2e00d5..71c4431 100755
--- a/admin/quick-install-emacs
+++ b/admin/quick-install-emacs
@@ -1,7 +1,7 @@
 #!/bin/sh
 ### quick-install-emacs --- do a halfway-decent job of installing emacs quickly
 
-## Copyright (C) 2001-2018 Free Software Foundation, Inc.
+## Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ## Author: Miles Bader <address@hidden>
 
diff --git a/admin/unidata/BidiBrackets.txt b/admin/unidata/BidiBrackets.txt
index c505861..9e51834 100644
--- a/admin/unidata/BidiBrackets.txt
+++ b/admin/unidata/BidiBrackets.txt
@@ -1,5 +1,5 @@
-# BidiBrackets-11.0.0.txt
-# Date: 2018-02-18, 05:50:00 GMT [AG, LI, KW]
+# BidiBrackets-12.0.0.txt
+# Date: 2018-11-02, 16:32:00 GMT [AG, LI, KW]
 # © 2018 Unicode®, Inc.
 # Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in 
the U.S. and other countries.
 # For terms of use, see http://www.unicode.org/terms_of_use.html
diff --git a/admin/unidata/BidiMirroring.txt b/admin/unidata/BidiMirroring.txt
index b3135c0..80dab88 100644
--- a/admin/unidata/BidiMirroring.txt
+++ b/admin/unidata/BidiMirroring.txt
@@ -1,5 +1,5 @@
-# BidiMirroring-11.0.0.txt
-# Date: 2018-05-07, 18:02:00 GMT [KW, LI, RP]
+# BidiMirroring-12.0.0.txt
+# Date: 2018-11-02, 16:33:00 GMT [KW, LI, RP]
 # © 2018 Unicode®, Inc.
 # For terms of use, see http://www.unicode.org/terms_of_use.html
 #
@@ -15,7 +15,7 @@
 # value, for which there is another Unicode character that typically has a 
glyph
 # that is the mirror image of the original character's glyph.
 #
-# The repertoire covered by the file is Unicode 11.0.0.
+# The repertoire covered by the file is Unicode 12.0.0.
 #
 # The file contains a list of lines with mappings from one code point
 # to another one for character-based mirroring.
diff --git a/admin/unidata/Blocks.txt b/admin/unidata/Blocks.txt
index 3579820..7216614 100644
--- a/admin/unidata/Blocks.txt
+++ b/admin/unidata/Blocks.txt
@@ -1,6 +1,6 @@
-# Blocks-11.0.0.txt
-# Date: 2017-10-16, 24:39:00 GMT [KW]
-# © 2017 Unicode®, Inc.
+# Blocks-12.0.0.txt
+# Date: 2018-07-30, 19:40:00 GMT [KW]
+# © 2018 Unicode®, Inc.
 # For terms of use, see http://www.unicode.org/terms_of_use.html
 #
 # Unicode Character Database
@@ -239,6 +239,7 @@ FFF0..FFFF; Specials
 10E60..10E7F; Rumi Numeral Symbols
 10F00..10F2F; Old Sogdian
 10F30..10F6F; Sogdian
+10FE0..10FFF; Elymaic
 11000..1107F; Brahmi
 11080..110CF; Kaithi
 110D0..110FF; Sora Sompeng
@@ -259,6 +260,7 @@ FFF0..FFFF; Specials
 11700..1173F; Ahom
 11800..1184F; Dogra
 118A0..118FF; Warang Citi
+119A0..119FF; Nandinagari
 11A00..11A4F; Zanabazar Square
 11A50..11AAF; Soyombo
 11AC0..11AFF; Pau Cin Hau
@@ -267,10 +269,12 @@ FFF0..FFFF; Specials
 11D00..11D5F; Masaram Gondi
 11D60..11DAF; Gunjala Gondi
 11EE0..11EFF; Makasar
+11FC0..11FFF; Tamil Supplement
 12000..123FF; Cuneiform
 12400..1247F; Cuneiform Numbers and Punctuation
 12480..1254F; Early Dynastic Cuneiform
 13000..1342F; Egyptian Hieroglyphs
+13430..1343F; Egyptian Hieroglyph Format Controls
 14400..1467F; Anatolian Hieroglyphs
 16800..16A3F; Bamum Supplement
 16A40..16A6F; Mro
@@ -283,6 +287,7 @@ FFF0..FFFF; Specials
 18800..18AFF; Tangut Components
 1B000..1B0FF; Kana Supplement
 1B100..1B12F; Kana Extended-A
+1B130..1B16F; Small Kana Extension
 1B170..1B2FF; Nushu
 1BC00..1BC9F; Duployan
 1BCA0..1BCAF; Shorthand Format Controls
@@ -295,9 +300,12 @@ FFF0..FFFF; Specials
 1D400..1D7FF; Mathematical Alphanumeric Symbols
 1D800..1DAAF; Sutton SignWriting
 1E000..1E02F; Glagolitic Supplement
+1E100..1E14F; Nyiakeng Puachue Hmong
+1E2C0..1E2FF; Wancho
 1E800..1E8DF; Mende Kikakui
 1E900..1E95F; Adlam
 1EC70..1ECBF; Indic Siyaq Numbers
+1ED00..1ED4F; Ottoman Siyaq Numbers
 1EE00..1EEFF; Arabic Mathematical Alphabetic Symbols
 1F000..1F02F; Mahjong Tiles
 1F030..1F09F; Domino Tiles
@@ -313,6 +321,7 @@ FFF0..FFFF; Specials
 1F800..1F8FF; Supplemental Arrows-C
 1F900..1F9FF; Supplemental Symbols and Pictographs
 1FA00..1FA6F; Chess Symbols
+1FA70..1FAFF; Symbols and Pictographs Extended-A
 20000..2A6DF; CJK Unified Ideographs Extension B
 2A700..2B73F; CJK Unified Ideographs Extension C
 2B740..2B81F; CJK Unified Ideographs Extension D
diff --git a/admin/unidata/Makefile.in b/admin/unidata/Makefile.in
index 818404f..31efba0 100644
--- a/admin/unidata/Makefile.in
+++ b/admin/unidata/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 2012-2018 Free Software Foundation, Inc.
+# Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 # Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
 #   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/admin/unidata/NormalizationTest.txt 
b/admin/unidata/NormalizationTest.txt
index 72a31bc..04c935c 100644
--- a/admin/unidata/NormalizationTest.txt
+++ b/admin/unidata/NormalizationTest.txt
@@ -1,6 +1,6 @@
-# NormalizationTest-11.0.0.txt
-# Date: 2018-02-19, 18:33:08 GMT
-# © 2018 Unicode®, Inc.
+# NormalizationTest-12.0.0.txt
+# Date: 2019-01-22, 08:18:33 GMT
+# © 2019 Unicode®, Inc.
 # Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in 
the U.S. and other countries.
 # For terms of use, see http://www.unicode.org/terms_of_use.html
 #
@@ -16363,6 +16363,7 @@ FFEE;FFEE;FFEE;25CB;25CB; # (○; ○; ○; ○; ○; ) HALFWIDTH 
WHITE CIRCLE
 1F14F;1F14F;1F14F;0057 0043;0057 0043; # (🅏; 🅏; 🅏; WC; WC; ) SQUARED WC
 1F16A;1F16A;1F16A;004D 0043;004D 0043; # (🅪; 🅪; 🅪; MC; MC; ) RAISED MC SIGN
 1F16B;1F16B;1F16B;004D 0044;004D 0044; # (🅫; 🅫; 🅫; MD; MD; ) RAISED MD SIGN
+1F16C;1F16C;1F16C;004D 0052;004D 0052; # (🅬; 🅬; 🅬; MR; MR; ) RAISED MR SIGN
 1F190;1F190;1F190;0044 004A;0044 004A; # (🆐; 🆐; 🆐; DJ; DJ; ) SQUARE DJ
 1F200;1F200;1F200;307B 304B;307B 304B; # (🈀; 🈀; 🈀; ほか; ほか; ) SQUARE HIRAGANA 
HOKA
 1F201;1F201;1F201;30B3 30B3;30B3 30B3; # (🈁; 🈁; 🈁; ココ; ココ; ) SQUARED KATAKANA 
KOKO
@@ -17685,6 +17686,8 @@ FFEE;FFEE;FFEE;25CB;25CB; # (○; ○; ○; ○; ○; ) HALFWIDTH 
WHITE CIRCLE
 0061 0EB8 0EC8 0EB8 0E48 0062;0061 0E48 0EB8 0EB8 0EC8 0062;0061 0E48 0EB8 
0EB8 0EC8 0062;0061 0E48 0EB8 0EB8 0EC8 0062;0061 0E48 0EB8 0EB8 0EC8 0062; # 
(a◌ຸ◌່◌ຸ◌่b; a◌่◌ຸ◌ຸ◌່b; a◌่◌ຸ◌ຸ◌່b; a◌่◌ຸ◌ຸ◌່b; a◌่◌ຸ◌ຸ◌່b; ) LATIN SMALL 
LETTER A, LAO VOWEL SIGN U, LAO TONE MAI EK, LAO VOWEL SIGN U, THAI CHARACTER 
MAI EK, LATIN SMALL LETTER B
 0061 0EC8 0EB8 0E48 0EB9 0062;0061 0E48 0EB8 0EB9 0EC8 0062;0061 0E48 0EB8 
0EB9 0EC8 0062;0061 0E48 0EB8 0EB9 0EC8 0062;0061 0E48 0EB8 0EB9 0EC8 0062; # 
(a◌່◌ຸ◌่◌ູb; a◌่◌ຸ◌ູ◌່b; a◌่◌ຸ◌ູ◌່b; a◌่◌ຸ◌ູ◌່b; a◌่◌ຸ◌ູ◌່b; ) LATIN SMALL 
LETTER A, LAO TONE MAI EK, LAO VOWEL SIGN U, THAI CHARACTER MAI EK, LAO VOWEL 
SIGN UU, LATIN SMALL LETTER B
 0061 0EB9 0EC8 0EB8 0E48 0062;0061 0E48 0EB9 0EB8 0EC8 0062;0061 0E48 0EB9 
0EB8 0EC8 0062;0061 0E48 0EB9 0EB8 0EC8 0062;0061 0E48 0EB9 0EB8 0EC8 0062; # 
(a◌ູ◌່◌ຸ◌่b; a◌่◌ູ◌ຸ◌່b; a◌่◌ູ◌ຸ◌່b; a◌่◌ູ◌ຸ◌່b; a◌่◌ູ◌ຸ◌່b; ) LATIN SMALL 
LETTER A, LAO VOWEL SIGN UU, LAO TONE MAI EK, LAO VOWEL SIGN U, THAI CHARACTER 
MAI EK, LATIN SMALL LETTER B
+0061 05B0 094D 3099 0EBA 0062;0061 3099 094D 0EBA 05B0 0062;0061 3099 094D 
0EBA 05B0 0062;0061 3099 094D 0EBA 05B0 0062;0061 3099 094D 0EBA 05B0 0062; # 
(a◌ְ◌्◌゙◌຺b; a◌゙◌्◌຺◌ְb; a◌゙◌्◌຺◌ְb; a◌゙◌्◌຺◌ְb; a◌゙◌्◌຺◌ְb; ) LATIN SMALL 
LETTER A, HEBREW POINT SHEVA, DEVANAGARI SIGN VIRAMA, COMBINING 
KATAKANA-HIRAGANA VOICED SOUND MARK, LAO SIGN PALI VIRAMA, LATIN SMALL LETTER B
+0061 0EBA 05B0 094D 3099 0062;0061 3099 0EBA 094D 05B0 0062;0061 3099 0EBA 
094D 05B0 0062;0061 3099 0EBA 094D 05B0 0062;0061 3099 0EBA 094D 05B0 0062; # 
(a◌຺◌ְ◌्◌゙b; a◌゙◌຺◌्◌ְb; a◌゙◌຺◌्◌ְb; a◌゙◌຺◌्◌ְb; a◌゙◌຺◌्◌ְb; ) LATIN SMALL 
LETTER A, LAO SIGN PALI VIRAMA, HEBREW POINT SHEVA, DEVANAGARI SIGN VIRAMA, 
COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK, LATIN SMALL LETTER B
 0061 0F71 0EC8 0EB8 0EC8 0062;0061 0EB8 0EC8 0EC8 0F71 0062;0061 0EB8 0EC8 
0EC8 0F71 0062;0061 0EB8 0EC8 0EC8 0F71 0062;0061 0EB8 0EC8 0EC8 0F71 0062; # 
(a◌ཱ◌່◌ຸ◌່b; a◌ຸ◌່◌່◌ཱb; a◌ຸ◌່◌່◌ཱb; a◌ຸ◌່◌່◌ཱb; a◌ຸ◌່◌່◌ཱb; ) LATIN SMALL 
LETTER A, TIBETAN VOWEL SIGN AA, LAO TONE MAI EK, LAO VOWEL SIGN U, LAO TONE 
MAI EK, LATIN SMALL LETTER B
 0061 0EC8 0F71 0EC8 0EB8 0062;0061 0EB8 0EC8 0EC8 0F71 0062;0061 0EB8 0EC8 
0EC8 0F71 0062;0061 0EB8 0EC8 0EC8 0F71 0062;0061 0EB8 0EC8 0EC8 0F71 0062; # 
(a◌່◌ཱ◌່◌ຸb; a◌ຸ◌່◌່◌ཱb; a◌ຸ◌່◌່◌ཱb; a◌ຸ◌່◌່◌ཱb; a◌ຸ◌່◌່◌ཱb; ) LATIN SMALL 
LETTER A, LAO TONE MAI EK, TIBETAN VOWEL SIGN AA, LAO TONE MAI EK, LAO VOWEL 
SIGN U, LATIN SMALL LETTER B
 0061 0F71 0EC8 0EB8 0EC9 0062;0061 0EB8 0EC8 0EC9 0F71 0062;0061 0EB8 0EC8 
0EC9 0F71 0062;0061 0EB8 0EC8 0EC9 0F71 0062;0061 0EB8 0EC8 0EC9 0F71 0062; # 
(a◌ཱ◌່◌ຸ◌້b; a◌ຸ◌່◌້◌ཱb; a◌ຸ◌່◌້◌ཱb; a◌ຸ◌່◌້◌ཱb; a◌ຸ◌່◌້◌ཱb; ) LATIN SMALL 
LETTER A, TIBETAN VOWEL SIGN AA, LAO TONE MAI EK, LAO VOWEL SIGN U, LAO TONE 
MAI THO, LATIN SMALL LETTER B
@@ -18453,6 +18456,8 @@ FFEE;FFEE;FFEE;25CB;25CB; # (○; ○; ○; ○; ○; ) HALFWIDTH 
WHITE CIRCLE
 0061 11839 05B0 094D 3099 0062;0061 3099 11839 094D 05B0 0062;0061 3099 11839 
094D 05B0 0062;0061 3099 11839 094D 05B0 0062;0061 3099 11839 094D 05B0 0062; # 
(a◌𑠹◌ְ◌्◌゙b; a◌゙◌𑠹◌्◌ְb; a◌゙◌𑠹◌्◌ְb; a◌゙◌𑠹◌्◌ְb; a◌゙◌𑠹◌्◌ְb; ) LATIN SMALL 
LETTER A, DOGRA SIGN VIRAMA, HEBREW POINT SHEVA, DEVANAGARI SIGN VIRAMA, 
COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK, LATIN SMALL LETTER B
 0061 3099 093C 0334 1183A 0062;0061 0334 093C 1183A 3099 0062;0061 0334 093C 
1183A 3099 0062;0061 0334 093C 1183A 3099 0062;0061 0334 093C 1183A 3099 0062; 
# (a◌゙◌़◌̴◌𑠺b; a◌̴◌़◌𑠺◌゙b; a◌̴◌़◌𑠺◌゙b; a◌̴◌़◌𑠺◌゙b; a◌̴◌़◌𑠺◌゙b; ) LATIN SMALL 
LETTER A, COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK, DEVANAGARI SIGN NUKTA, 
COMBINING TILDE OVERLAY, DOGRA SIGN NUKTA, LATIN SMALL LETTER B
 0061 1183A 3099 093C 0334 0062;0061 0334 1183A 093C 3099 0062;0061 0334 1183A 
093C 3099 0062;0061 0334 1183A 093C 3099 0062;0061 0334 1183A 093C 3099 0062; # 
(a◌𑠺◌゙◌़◌̴b; a◌̴◌𑠺◌़◌゙b; a◌̴◌𑠺◌़◌゙b; a◌̴◌𑠺◌़◌゙b; a◌̴◌𑠺◌़◌゙b; ) LATIN SMALL 
LETTER A, DOGRA SIGN NUKTA, COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK, 
DEVANAGARI SIGN NUKTA, COMBINING TILDE OVERLAY, LATIN SMALL LETTER B
+0061 05B0 094D 3099 119E0 0062;0061 3099 094D 119E0 05B0 0062;0061 3099 094D 
119E0 05B0 0062;0061 3099 094D 119E0 05B0 0062;0061 3099 094D 119E0 05B0 0062; 
# (a◌ְ◌्◌゙◌𑧠b; a◌゙◌्◌𑧠◌ְb; a◌゙◌्◌𑧠◌ְb; a◌゙◌्◌𑧠◌ְb; a◌゙◌्◌𑧠◌ְb; ) LATIN SMALL 
LETTER A, HEBREW POINT SHEVA, DEVANAGARI SIGN VIRAMA, COMBINING 
KATAKANA-HIRAGANA VOICED SOUND MARK, NANDINAGARI SIGN VIRAMA, LATIN SMALL 
LETTER B
+0061 119E0 05B0 094D 3099 0062;0061 3099 119E0 094D 05B0 0062;0061 3099 119E0 
094D 05B0 0062;0061 3099 119E0 094D 05B0 0062;0061 3099 119E0 094D 05B0 0062; # 
(a◌𑧠◌ְ◌्◌゙b; a◌゙◌𑧠◌्◌ְb; a◌゙◌𑧠◌्◌ְb; a◌゙◌𑧠◌्◌ְb; a◌゙◌𑧠◌्◌ְb; ) LATIN SMALL 
LETTER A, NANDINAGARI SIGN VIRAMA, HEBREW POINT SHEVA, DEVANAGARI SIGN VIRAMA, 
COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK, LATIN SMALL LETTER B
 0061 05B0 094D 3099 11A34 0062;0061 3099 094D 11A34 05B0 0062;0061 3099 094D 
11A34 05B0 0062;0061 3099 094D 11A34 05B0 0062;0061 3099 094D 11A34 05B0 0062; 
# (a◌ְ◌्◌゙◌𑨴b; a◌゙◌्◌𑨴◌ְb; a◌゙◌्◌𑨴◌ְb; a◌゙◌्◌𑨴◌ְb; a◌゙◌्◌𑨴◌ְb; ) LATIN SMALL 
LETTER A, HEBREW POINT SHEVA, DEVANAGARI SIGN VIRAMA, COMBINING 
KATAKANA-HIRAGANA VOICED SOUND MARK, ZANABAZAR SQUARE SIGN VIRAMA, LATIN SMALL 
LETTER B
 0061 11A34 05B0 094D 3099 0062;0061 3099 11A34 094D 05B0 0062;0061 3099 11A34 
094D 05B0 0062;0061 3099 11A34 094D 05B0 0062;0061 3099 11A34 094D 05B0 0062; # 
(a◌𑨴◌ְ◌्◌゙b; a◌゙◌𑨴◌्◌ְb; a◌゙◌𑨴◌्◌ְb; a◌゙◌𑨴◌्◌ְb; a◌゙◌𑨴◌्◌ְb; ) LATIN SMALL 
LETTER A, ZANABAZAR SQUARE SIGN VIRAMA, HEBREW POINT SHEVA, DEVANAGARI SIGN 
VIRAMA, COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK, LATIN SMALL LETTER B
 0061 05B0 094D 3099 11A47 0062;0061 3099 094D 11A47 05B0 0062;0061 3099 094D 
11A47 05B0 0062;0061 3099 094D 11A47 05B0 0062;0061 3099 094D 11A47 05B0 0062; 
# (a◌ְ◌्◌゙◌𑩇b; a◌゙◌्◌𑩇◌ְb; a◌゙◌्◌𑩇◌ְb; a◌゙◌्◌𑩇◌ְb; a◌゙◌्◌𑩇◌ְb; ) LATIN SMALL 
LETTER A, HEBREW POINT SHEVA, DEVANAGARI SIGN VIRAMA, COMBINING 
KATAKANA-HIRAGANA VOICED SOUND MARK, ZANABAZAR SQUARE SUBJOINER, LATIN SMALL 
LETTER B
@@ -18637,6 +18642,28 @@ FFEE;FFEE;FFEE;25CB;25CB; # (○; ○; ○; ○; ○; ) 
HALFWIDTH WHITE CIRCLE
 0061 1E029 0315 0300 05AE 0062;0061 05AE 1E029 0300 0315 0062;0061 05AE 1E029 
0300 0315 0062;0061 05AE 1E029 0300 0315 0062;0061 05AE 1E029 0300 0315 0062; # 
(a◌𞀩◌̕◌̀◌֮b; a◌֮◌𞀩◌̀◌̕b; a◌֮◌𞀩◌̀◌̕b; a◌֮◌𞀩◌̀◌̕b; a◌֮◌𞀩◌̀◌̕b; ) LATIN SMALL 
LETTER A, COMBINING GLAGOLITIC LETTER IOTATED BIG YUS, COMBINING COMMA ABOVE 
RIGHT, COMBINING GRAVE ACCENT, HEBREW ACCENT ZINOR, LATIN SMALL LETTER B
 0061 0315 0300 05AE 1E02A 0062;00E0 05AE 1E02A 0315 0062;0061 05AE 0300 1E02A 
0315 0062;00E0 05AE 1E02A 0315 0062;0061 05AE 0300 1E02A 0315 0062; # 
(a◌̕◌̀◌֮◌𞀪b; à◌֮◌𞀪◌̕b; a◌֮◌̀◌𞀪◌̕b; à◌֮◌𞀪◌̕b; a◌֮◌̀◌𞀪◌̕b; ) LATIN SMALL LETTER 
A, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE ACCENT, HEBREW ACCENT ZINOR, 
COMBINING GLAGOLITIC LETTER FITA, LATIN SMALL LETTER B
 0061 1E02A 0315 0300 05AE 0062;0061 05AE 1E02A 0300 0315 0062;0061 05AE 1E02A 
0300 0315 0062;0061 05AE 1E02A 0300 0315 0062;0061 05AE 1E02A 0300 0315 0062; # 
(a◌𞀪◌̕◌̀◌֮b; a◌֮◌𞀪◌̀◌̕b; a◌֮◌𞀪◌̀◌̕b; a◌֮◌𞀪◌̀◌̕b; a◌֮◌𞀪◌̀◌̕b; ) LATIN SMALL 
LETTER A, COMBINING GLAGOLITIC LETTER FITA, COMBINING COMMA ABOVE RIGHT, 
COMBINING GRAVE ACCENT, HEBREW ACCENT ZINOR, LATIN SMALL LETTER B
+0061 0315 0300 05AE 1E130 0062;00E0 05AE 1E130 0315 0062;0061 05AE 0300 1E130 
0315 0062;00E0 05AE 1E130 0315 0062;0061 05AE 0300 1E130 0315 0062; # 
(a◌̕◌̀◌֮◌𞄰b; à◌֮◌𞄰◌̕b; a◌֮◌̀◌𞄰◌̕b; à◌֮◌𞄰◌̕b; a◌֮◌̀◌𞄰◌̕b; ) LATIN SMALL LETTER 
A, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE ACCENT, HEBREW ACCENT ZINOR, 
NYIAKENG PUACHUE HMONG TONE-B, LATIN SMALL LETTER B
+0061 1E130 0315 0300 05AE 0062;0061 05AE 1E130 0300 0315 0062;0061 05AE 1E130 
0300 0315 0062;0061 05AE 1E130 0300 0315 0062;0061 05AE 1E130 0300 0315 0062; # 
(a◌𞄰◌̕◌̀◌֮b; a◌֮◌𞄰◌̀◌̕b; a◌֮◌𞄰◌̀◌̕b; a◌֮◌𞄰◌̀◌̕b; a◌֮◌𞄰◌̀◌̕b; ) LATIN SMALL 
LETTER A, NYIAKENG PUACHUE HMONG TONE-B, COMBINING COMMA ABOVE RIGHT, COMBINING 
GRAVE ACCENT, HEBREW ACCENT ZINOR, LATIN SMALL LETTER B
+0061 0315 0300 05AE 1E131 0062;00E0 05AE 1E131 0315 0062;0061 05AE 0300 1E131 
0315 0062;00E0 05AE 1E131 0315 0062;0061 05AE 0300 1E131 0315 0062; # 
(a◌̕◌̀◌֮◌𞄱b; à◌֮◌𞄱◌̕b; a◌֮◌̀◌𞄱◌̕b; à◌֮◌𞄱◌̕b; a◌֮◌̀◌𞄱◌̕b; ) LATIN SMALL LETTER 
A, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE ACCENT, HEBREW ACCENT ZINOR, 
NYIAKENG PUACHUE HMONG TONE-M, LATIN SMALL LETTER B
+0061 1E131 0315 0300 05AE 0062;0061 05AE 1E131 0300 0315 0062;0061 05AE 1E131 
0300 0315 0062;0061 05AE 1E131 0300 0315 0062;0061 05AE 1E131 0300 0315 0062; # 
(a◌𞄱◌̕◌̀◌֮b; a◌֮◌𞄱◌̀◌̕b; a◌֮◌𞄱◌̀◌̕b; a◌֮◌𞄱◌̀◌̕b; a◌֮◌𞄱◌̀◌̕b; ) LATIN SMALL 
LETTER A, NYIAKENG PUACHUE HMONG TONE-M, COMBINING COMMA ABOVE RIGHT, COMBINING 
GRAVE ACCENT, HEBREW ACCENT ZINOR, LATIN SMALL LETTER B
+0061 0315 0300 05AE 1E132 0062;00E0 05AE 1E132 0315 0062;0061 05AE 0300 1E132 
0315 0062;00E0 05AE 1E132 0315 0062;0061 05AE 0300 1E132 0315 0062; # 
(a◌̕◌̀◌֮◌𞄲b; à◌֮◌𞄲◌̕b; a◌֮◌̀◌𞄲◌̕b; à◌֮◌𞄲◌̕b; a◌֮◌̀◌𞄲◌̕b; ) LATIN SMALL LETTER 
A, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE ACCENT, HEBREW ACCENT ZINOR, 
NYIAKENG PUACHUE HMONG TONE-J, LATIN SMALL LETTER B
+0061 1E132 0315 0300 05AE 0062;0061 05AE 1E132 0300 0315 0062;0061 05AE 1E132 
0300 0315 0062;0061 05AE 1E132 0300 0315 0062;0061 05AE 1E132 0300 0315 0062; # 
(a◌𞄲◌̕◌̀◌֮b; a◌֮◌𞄲◌̀◌̕b; a◌֮◌𞄲◌̀◌̕b; a◌֮◌𞄲◌̀◌̕b; a◌֮◌𞄲◌̀◌̕b; ) LATIN SMALL 
LETTER A, NYIAKENG PUACHUE HMONG TONE-J, COMBINING COMMA ABOVE RIGHT, COMBINING 
GRAVE ACCENT, HEBREW ACCENT ZINOR, LATIN SMALL LETTER B
+0061 0315 0300 05AE 1E133 0062;00E0 05AE 1E133 0315 0062;0061 05AE 0300 1E133 
0315 0062;00E0 05AE 1E133 0315 0062;0061 05AE 0300 1E133 0315 0062; # 
(a◌̕◌̀◌֮◌𞄳b; à◌֮◌𞄳◌̕b; a◌֮◌̀◌𞄳◌̕b; à◌֮◌𞄳◌̕b; a◌֮◌̀◌𞄳◌̕b; ) LATIN SMALL LETTER 
A, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE ACCENT, HEBREW ACCENT ZINOR, 
NYIAKENG PUACHUE HMONG TONE-V, LATIN SMALL LETTER B
+0061 1E133 0315 0300 05AE 0062;0061 05AE 1E133 0300 0315 0062;0061 05AE 1E133 
0300 0315 0062;0061 05AE 1E133 0300 0315 0062;0061 05AE 1E133 0300 0315 0062; # 
(a◌𞄳◌̕◌̀◌֮b; a◌֮◌𞄳◌̀◌̕b; a◌֮◌𞄳◌̀◌̕b; a◌֮◌𞄳◌̀◌̕b; a◌֮◌𞄳◌̀◌̕b; ) LATIN SMALL 
LETTER A, NYIAKENG PUACHUE HMONG TONE-V, COMBINING COMMA ABOVE RIGHT, COMBINING 
GRAVE ACCENT, HEBREW ACCENT ZINOR, LATIN SMALL LETTER B
+0061 0315 0300 05AE 1E134 0062;00E0 05AE 1E134 0315 0062;0061 05AE 0300 1E134 
0315 0062;00E0 05AE 1E134 0315 0062;0061 05AE 0300 1E134 0315 0062; # 
(a◌̕◌̀◌֮◌𞄴b; à◌֮◌𞄴◌̕b; a◌֮◌̀◌𞄴◌̕b; à◌֮◌𞄴◌̕b; a◌֮◌̀◌𞄴◌̕b; ) LATIN SMALL LETTER 
A, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE ACCENT, HEBREW ACCENT ZINOR, 
NYIAKENG PUACHUE HMONG TONE-S, LATIN SMALL LETTER B
+0061 1E134 0315 0300 05AE 0062;0061 05AE 1E134 0300 0315 0062;0061 05AE 1E134 
0300 0315 0062;0061 05AE 1E134 0300 0315 0062;0061 05AE 1E134 0300 0315 0062; # 
(a◌𞄴◌̕◌̀◌֮b; a◌֮◌𞄴◌̀◌̕b; a◌֮◌𞄴◌̀◌̕b; a◌֮◌𞄴◌̀◌̕b; a◌֮◌𞄴◌̀◌̕b; ) LATIN SMALL 
LETTER A, NYIAKENG PUACHUE HMONG TONE-S, COMBINING COMMA ABOVE RIGHT, COMBINING 
GRAVE ACCENT, HEBREW ACCENT ZINOR, LATIN SMALL LETTER B
+0061 0315 0300 05AE 1E135 0062;00E0 05AE 1E135 0315 0062;0061 05AE 0300 1E135 
0315 0062;00E0 05AE 1E135 0315 0062;0061 05AE 0300 1E135 0315 0062; # 
(a◌̕◌̀◌֮◌𞄵b; à◌֮◌𞄵◌̕b; a◌֮◌̀◌𞄵◌̕b; à◌֮◌𞄵◌̕b; a◌֮◌̀◌𞄵◌̕b; ) LATIN SMALL LETTER 
A, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE ACCENT, HEBREW ACCENT ZINOR, 
NYIAKENG PUACHUE HMONG TONE-G, LATIN SMALL LETTER B
+0061 1E135 0315 0300 05AE 0062;0061 05AE 1E135 0300 0315 0062;0061 05AE 1E135 
0300 0315 0062;0061 05AE 1E135 0300 0315 0062;0061 05AE 1E135 0300 0315 0062; # 
(a◌𞄵◌̕◌̀◌֮b; a◌֮◌𞄵◌̀◌̕b; a◌֮◌𞄵◌̀◌̕b; a◌֮◌𞄵◌̀◌̕b; a◌֮◌𞄵◌̀◌̕b; ) LATIN SMALL 
LETTER A, NYIAKENG PUACHUE HMONG TONE-G, COMBINING COMMA ABOVE RIGHT, COMBINING 
GRAVE ACCENT, HEBREW ACCENT ZINOR, LATIN SMALL LETTER B
+0061 0315 0300 05AE 1E136 0062;00E0 05AE 1E136 0315 0062;0061 05AE 0300 1E136 
0315 0062;00E0 05AE 1E136 0315 0062;0061 05AE 0300 1E136 0315 0062; # 
(a◌̕◌̀◌֮◌𞄶b; à◌֮◌𞄶◌̕b; a◌֮◌̀◌𞄶◌̕b; à◌֮◌𞄶◌̕b; a◌֮◌̀◌𞄶◌̕b; ) LATIN SMALL LETTER 
A, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE ACCENT, HEBREW ACCENT ZINOR, 
NYIAKENG PUACHUE HMONG TONE-D, LATIN SMALL LETTER B
+0061 1E136 0315 0300 05AE 0062;0061 05AE 1E136 0300 0315 0062;0061 05AE 1E136 
0300 0315 0062;0061 05AE 1E136 0300 0315 0062;0061 05AE 1E136 0300 0315 0062; # 
(a◌𞄶◌̕◌̀◌֮b; a◌֮◌𞄶◌̀◌̕b; a◌֮◌𞄶◌̀◌̕b; a◌֮◌𞄶◌̀◌̕b; a◌֮◌𞄶◌̀◌̕b; ) LATIN SMALL 
LETTER A, NYIAKENG PUACHUE HMONG TONE-D, COMBINING COMMA ABOVE RIGHT, COMBINING 
GRAVE ACCENT, HEBREW ACCENT ZINOR, LATIN SMALL LETTER B
+0061 0315 0300 05AE 1E2EC 0062;00E0 05AE 1E2EC 0315 0062;0061 05AE 0300 1E2EC 
0315 0062;00E0 05AE 1E2EC 0315 0062;0061 05AE 0300 1E2EC 0315 0062; # 
(a◌̕◌̀◌֮◌𞋬b; à◌֮◌𞋬◌̕b; a◌֮◌̀◌𞋬◌̕b; à◌֮◌𞋬◌̕b; a◌֮◌̀◌𞋬◌̕b; ) LATIN SMALL LETTER 
A, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE ACCENT, HEBREW ACCENT ZINOR, 
WANCHO TONE TUP, LATIN SMALL LETTER B
+0061 1E2EC 0315 0300 05AE 0062;0061 05AE 1E2EC 0300 0315 0062;0061 05AE 1E2EC 
0300 0315 0062;0061 05AE 1E2EC 0300 0315 0062;0061 05AE 1E2EC 0300 0315 0062; # 
(a◌𞋬◌̕◌̀◌֮b; a◌֮◌𞋬◌̀◌̕b; a◌֮◌𞋬◌̀◌̕b; a◌֮◌𞋬◌̀◌̕b; a◌֮◌𞋬◌̀◌̕b; ) LATIN SMALL 
LETTER A, WANCHO TONE TUP, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE ACCENT, 
HEBREW ACCENT ZINOR, LATIN SMALL LETTER B
+0061 0315 0300 05AE 1E2ED 0062;00E0 05AE 1E2ED 0315 0062;0061 05AE 0300 1E2ED 
0315 0062;00E0 05AE 1E2ED 0315 0062;0061 05AE 0300 1E2ED 0315 0062; # 
(a◌̕◌̀◌֮◌𞋭b; à◌֮◌𞋭◌̕b; a◌֮◌̀◌𞋭◌̕b; à◌֮◌𞋭◌̕b; a◌֮◌̀◌𞋭◌̕b; ) LATIN SMALL LETTER 
A, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE ACCENT, HEBREW ACCENT ZINOR, 
WANCHO TONE TUPNI, LATIN SMALL LETTER B
+0061 1E2ED 0315 0300 05AE 0062;0061 05AE 1E2ED 0300 0315 0062;0061 05AE 1E2ED 
0300 0315 0062;0061 05AE 1E2ED 0300 0315 0062;0061 05AE 1E2ED 0300 0315 0062; # 
(a◌𞋭◌̕◌̀◌֮b; a◌֮◌𞋭◌̀◌̕b; a◌֮◌𞋭◌̀◌̕b; a◌֮◌𞋭◌̀◌̕b; a◌֮◌𞋭◌̀◌̕b; ) LATIN SMALL 
LETTER A, WANCHO TONE TUPNI, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE 
ACCENT, HEBREW ACCENT ZINOR, LATIN SMALL LETTER B
+0061 0315 0300 05AE 1E2EE 0062;00E0 05AE 1E2EE 0315 0062;0061 05AE 0300 1E2EE 
0315 0062;00E0 05AE 1E2EE 0315 0062;0061 05AE 0300 1E2EE 0315 0062; # 
(a◌̕◌̀◌֮◌𞋮b; à◌֮◌𞋮◌̕b; a◌֮◌̀◌𞋮◌̕b; à◌֮◌𞋮◌̕b; a◌֮◌̀◌𞋮◌̕b; ) LATIN SMALL LETTER 
A, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE ACCENT, HEBREW ACCENT ZINOR, 
WANCHO TONE KOI, LATIN SMALL LETTER B
+0061 1E2EE 0315 0300 05AE 0062;0061 05AE 1E2EE 0300 0315 0062;0061 05AE 1E2EE 
0300 0315 0062;0061 05AE 1E2EE 0300 0315 0062;0061 05AE 1E2EE 0300 0315 0062; # 
(a◌𞋮◌̕◌̀◌֮b; a◌֮◌𞋮◌̀◌̕b; a◌֮◌𞋮◌̀◌̕b; a◌֮◌𞋮◌̀◌̕b; a◌֮◌𞋮◌̀◌̕b; ) LATIN SMALL 
LETTER A, WANCHO TONE KOI, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE ACCENT, 
HEBREW ACCENT ZINOR, LATIN SMALL LETTER B
+0061 0315 0300 05AE 1E2EF 0062;00E0 05AE 1E2EF 0315 0062;0061 05AE 0300 1E2EF 
0315 0062;00E0 05AE 1E2EF 0315 0062;0061 05AE 0300 1E2EF 0315 0062; # 
(a◌̕◌̀◌֮◌𞋯b; à◌֮◌𞋯◌̕b; a◌֮◌̀◌𞋯◌̕b; à◌֮◌𞋯◌̕b; a◌֮◌̀◌𞋯◌̕b; ) LATIN SMALL LETTER 
A, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE ACCENT, HEBREW ACCENT ZINOR, 
WANCHO TONE KOINI, LATIN SMALL LETTER B
+0061 1E2EF 0315 0300 05AE 0062;0061 05AE 1E2EF 0300 0315 0062;0061 05AE 1E2EF 
0300 0315 0062;0061 05AE 1E2EF 0300 0315 0062;0061 05AE 1E2EF 0300 0315 0062; # 
(a◌𞋯◌̕◌̀◌֮b; a◌֮◌𞋯◌̀◌̕b; a◌֮◌𞋯◌̀◌̕b; a◌֮◌𞋯◌̀◌̕b; a◌֮◌𞋯◌̀◌̕b; ) LATIN SMALL 
LETTER A, WANCHO TONE KOINI, COMBINING COMMA ABOVE RIGHT, COMBINING GRAVE 
ACCENT, HEBREW ACCENT ZINOR, LATIN SMALL LETTER B
 0061 059A 0316 302A 1E8D0 0062;0061 302A 0316 1E8D0 059A 0062;0061 302A 0316 
1E8D0 059A 0062;0061 302A 0316 1E8D0 059A 0062;0061 302A 0316 1E8D0 059A 0062; 
# (a◌֚◌̖◌〪◌𞣐b; a◌〪◌̖◌𞣐◌֚b; a◌〪◌̖◌𞣐◌֚b; a◌〪◌̖◌𞣐◌֚b; a◌〪◌̖◌𞣐◌֚b; ) LATIN SMALL 
LETTER A, HEBREW ACCENT YETIV, COMBINING GRAVE ACCENT BELOW, IDEOGRAPHIC LEVEL 
TONE MARK, MENDE KIKAKUI COMBINING NUMBER TEENS, LATIN SMALL LETTER B
 0061 1E8D0 059A 0316 302A 0062;0061 302A 1E8D0 0316 059A 0062;0061 302A 1E8D0 
0316 059A 0062;0061 302A 1E8D0 0316 059A 0062;0061 302A 1E8D0 0316 059A 0062; # 
(a◌𞣐◌֚◌̖◌〪b; a◌〪◌𞣐◌̖◌֚b; a◌〪◌𞣐◌̖◌֚b; a◌〪◌𞣐◌̖◌֚b; a◌〪◌𞣐◌̖◌֚b; ) LATIN SMALL 
LETTER A, MENDE KIKAKUI COMBINING NUMBER TEENS, HEBREW ACCENT YETIV, COMBINING 
GRAVE ACCENT BELOW, IDEOGRAPHIC LEVEL TONE MARK, LATIN SMALL LETTER B
 0061 059A 0316 302A 1E8D1 0062;0061 302A 0316 1E8D1 059A 0062;0061 302A 0316 
1E8D1 059A 0062;0061 302A 0316 1E8D1 059A 0062;0061 302A 0316 1E8D1 059A 0062; 
# (a◌֚◌̖◌〪◌𞣑b; a◌〪◌̖◌𞣑◌֚b; a◌〪◌̖◌𞣑◌֚b; a◌〪◌̖◌𞣑◌֚b; a◌〪◌̖◌𞣑◌֚b; ) LATIN SMALL 
LETTER A, HEBREW ACCENT YETIV, COMBINING GRAVE ACCENT BELOW, IDEOGRAPHIC LEVEL 
TONE MARK, MENDE KIKAKUI COMBINING NUMBER TENS, LATIN SMALL LETTER B
diff --git a/admin/unidata/SpecialCasing.txt b/admin/unidata/SpecialCasing.txt
index c90d09a..7db2e31 100644
--- a/admin/unidata/SpecialCasing.txt
+++ b/admin/unidata/SpecialCasing.txt
@@ -1,6 +1,6 @@
-# SpecialCasing-11.0.0.txt
-# Date: 2018-02-22, 06:16:47 GMT
-# © 2018 Unicode®, Inc.
+# SpecialCasing-12.0.0.txt
+# Date: 2019-01-22, 08:18:50 GMT
+# © 2019 Unicode®, Inc.
 # Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in 
the U.S. and other countries.
 # For terms of use, see http://www.unicode.org/terms_of_use.html
 #
diff --git a/admin/unidata/UnicodeData.txt b/admin/unidata/UnicodeData.txt
index ec32faf..d88a601 100644
--- a/admin/unidata/UnicodeData.txt
+++ b/admin/unidata/UnicodeData.txt
@@ -640,7 +640,7 @@
 027F;LATIN SMALL LETTER REVERSED R WITH FISHHOOK;Ll;0;L;;;;;N;LATIN SMALL 
LETTER REVERSED FISHHOOK R;;;;
 0280;LATIN LETTER SMALL CAPITAL R;Ll;0;L;;;;;N;;;01A6;;01A6
 0281;LATIN LETTER SMALL CAPITAL INVERTED R;Ll;0;L;;;;;N;;;;;
-0282;LATIN SMALL LETTER S WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER S HOOK;;;;
+0282;LATIN SMALL LETTER S WITH HOOK;Ll;0;L;;;;;N;LATIN SMALL LETTER S 
HOOK;;A7C5;;A7C5
 0283;LATIN SMALL LETTER ESH;Ll;0;L;;;;;N;;;01A9;;01A9
 0284;LATIN SMALL LETTER DOTLESS J WITH STROKE AND HOOK;Ll;0;L;;;;;N;LATIN 
SMALL LETTER DOTLESS J BAR HOOK;;;;
 0285;LATIN SMALL LETTER SQUAT REVERSED ESH;Ll;0;L;;;;;N;;;;;
@@ -2809,6 +2809,7 @@
 0C6D;TELUGU DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
 0C6E;TELUGU DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
 0C6F;TELUGU DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+0C77;TELUGU SIGN SIDDHAM;Po;0;L;;;;;N;;;;;
 0C78;TELUGU FRACTION DIGIT ZERO FOR ODD POWERS OF FOUR;No;0;ON;;;;0;N;;;;;
 0C79;TELUGU FRACTION DIGIT ONE FOR ODD POWERS OF FOUR;No;0;ON;;;;1;N;;;;;
 0C7A;TELUGU FRACTION DIGIT TWO FOR ODD POWERS OF FOUR;No;0;ON;;;;2;N;;;;;
@@ -3203,14 +3204,24 @@
 0E81;LAO LETTER KO;Lo;0;L;;;;;N;;;;;
 0E82;LAO LETTER KHO SUNG;Lo;0;L;;;;;N;;;;;
 0E84;LAO LETTER KHO TAM;Lo;0;L;;;;;N;;;;;
+0E86;LAO LETTER PALI GHA;Lo;0;L;;;;;N;;;;;
 0E87;LAO LETTER NGO;Lo;0;L;;;;;N;;;;;
 0E88;LAO LETTER CO;Lo;0;L;;;;;N;;;;;
+0E89;LAO LETTER PALI CHA;Lo;0;L;;;;;N;;;;;
 0E8A;LAO LETTER SO TAM;Lo;0;L;;;;;N;;;;;
+0E8C;LAO LETTER PALI JHA;Lo;0;L;;;;;N;;;;;
 0E8D;LAO LETTER NYO;Lo;0;L;;;;;N;;;;;
+0E8E;LAO LETTER PALI NYA;Lo;0;L;;;;;N;;;;;
+0E8F;LAO LETTER PALI TTA;Lo;0;L;;;;;N;;;;;
+0E90;LAO LETTER PALI TTHA;Lo;0;L;;;;;N;;;;;
+0E91;LAO LETTER PALI DDA;Lo;0;L;;;;;N;;;;;
+0E92;LAO LETTER PALI DDHA;Lo;0;L;;;;;N;;;;;
+0E93;LAO LETTER PALI NNA;Lo;0;L;;;;;N;;;;;
 0E94;LAO LETTER DO;Lo;0;L;;;;;N;;;;;
 0E95;LAO LETTER TO;Lo;0;L;;;;;N;;;;;
 0E96;LAO LETTER THO SUNG;Lo;0;L;;;;;N;;;;;
 0E97;LAO LETTER THO TAM;Lo;0;L;;;;;N;;;;;
+0E98;LAO LETTER PALI DHA;Lo;0;L;;;;;N;;;;;
 0E99;LAO LETTER NO;Lo;0;L;;;;;N;;;;;
 0E9A;LAO LETTER BO;Lo;0;L;;;;;N;;;;;
 0E9B;LAO LETTER PO;Lo;0;L;;;;;N;;;;;
@@ -3218,13 +3229,17 @@
 0E9D;LAO LETTER FO TAM;Lo;0;L;;;;;N;;;;;
 0E9E;LAO LETTER PHO TAM;Lo;0;L;;;;;N;;;;;
 0E9F;LAO LETTER FO SUNG;Lo;0;L;;;;;N;;;;;
+0EA0;LAO LETTER PALI BHA;Lo;0;L;;;;;N;;;;;
 0EA1;LAO LETTER MO;Lo;0;L;;;;;N;;;;;
 0EA2;LAO LETTER YO;Lo;0;L;;;;;N;;;;;
 0EA3;LAO LETTER LO LING;Lo;0;L;;;;;N;;;;;
 0EA5;LAO LETTER LO LOOT;Lo;0;L;;;;;N;;;;;
 0EA7;LAO LETTER WO;Lo;0;L;;;;;N;;;;;
+0EA8;LAO LETTER SANSKRIT SHA;Lo;0;L;;;;;N;;;;;
+0EA9;LAO LETTER SANSKRIT SSA;Lo;0;L;;;;;N;;;;;
 0EAA;LAO LETTER SO SUNG;Lo;0;L;;;;;N;;;;;
 0EAB;LAO LETTER HO SUNG;Lo;0;L;;;;;N;;;;;
+0EAC;LAO LETTER PALI LLA;Lo;0;L;;;;;N;;;;;
 0EAD;LAO LETTER O;Lo;0;L;;;;;N;;;;;
 0EAE;LAO LETTER HO TAM;Lo;0;L;;;;;N;;;;;
 0EAF;LAO ELLIPSIS;Lo;0;L;;;;;N;;;;;
@@ -3238,6 +3253,7 @@
 0EB7;LAO VOWEL SIGN YY;Mn;0;NSM;;;;;N;;;;;
 0EB8;LAO VOWEL SIGN U;Mn;118;NSM;;;;;N;;;;;
 0EB9;LAO VOWEL SIGN UU;Mn;118;NSM;;;;;N;;;;;
+0EBA;LAO SIGN PALI VIRAMA;Mn;9;NSM;;;;;N;;;;;
 0EBB;LAO VOWEL SIGN MAI KON;Mn;0;NSM;;;;;N;;;;;
 0EBC;LAO SEMIVOWEL SIGN LO;Mn;0;NSM;;;;;N;;;;;
 0EBD;LAO SEMIVOWEL SIGN NYO;Lo;0;L;;;;;N;;;;;
@@ -5079,7 +5095,7 @@
 166A;CANADIAN SYLLABICS CARRIER TTSEE;Lo;0;L;;;;;N;;;;;
 166B;CANADIAN SYLLABICS CARRIER TTSI;Lo;0;L;;;;;N;;;;;
 166C;CANADIAN SYLLABICS CARRIER TTSA;Lo;0;L;;;;;N;;;;;
-166D;CANADIAN SYLLABICS CHI SIGN;Po;0;L;;;;;N;;;;;
+166D;CANADIAN SYLLABICS CHI SIGN;So;0;L;;;;;N;;;;;
 166E;CANADIAN SYLLABICS FULL STOP;Po;0;L;;;;;N;;;;;
 166F;CANADIAN SYLLABICS QAI;Lo;0;L;;;;;N;;;;;
 1670;CANADIAN SYLLABICS NGAI;Lo;0;L;;;;;N;;;;;
@@ -6488,14 +6504,15 @@
 1CEF;VEDIC SIGN LONG ANUSVARA;Lo;0;L;;;;;N;;;;;
 1CF0;VEDIC SIGN RTHANG LONG ANUSVARA;Lo;0;L;;;;;N;;;;;
 1CF1;VEDIC SIGN ANUSVARA UBHAYATO MUKHA;Lo;0;L;;;;;N;;;;;
-1CF2;VEDIC SIGN ARDHAVISARGA;Mc;0;L;;;;;N;;;;;
-1CF3;VEDIC SIGN ROTATED ARDHAVISARGA;Mc;0;L;;;;;N;;;;;
+1CF2;VEDIC SIGN ARDHAVISARGA;Lo;0;L;;;;;N;;;;;
+1CF3;VEDIC SIGN ROTATED ARDHAVISARGA;Lo;0;L;;;;;N;;;;;
 1CF4;VEDIC TONE CANDRA ABOVE;Mn;230;NSM;;;;;N;;;;;
 1CF5;VEDIC SIGN JIHVAMULIYA;Lo;0;L;;;;;N;;;;;
 1CF6;VEDIC SIGN UPADHMANIYA;Lo;0;L;;;;;N;;;;;
 1CF7;VEDIC SIGN ATIKRAMA;Mc;0;L;;;;;N;;;;;
 1CF8;VEDIC TONE RING ABOVE;Mn;230;NSM;;;;;N;;;;;
 1CF9;VEDIC TONE DOUBLE RING ABOVE;Mn;230;NSM;;;;;N;;;;;
+1CFA;VEDIC SIGN DOUBLE ANUSVARA ANTARGOMUKHA;Lo;0;L;;;;;N;;;;;
 1D00;LATIN LETTER SMALL CAPITAL A;Ll;0;L;;;;;N;;;;;
 1D01;LATIN LETTER SMALL CAPITAL AE;Ll;0;L;;;;;N;;;;;
 1D02;LATIN SMALL LETTER TURNED AE;Ll;0;L;;;;;N;;;;;
@@ -6638,7 +6655,7 @@
 1D8B;LATIN SMALL LETTER ESH WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
 1D8C;LATIN SMALL LETTER V WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
 1D8D;LATIN SMALL LETTER X WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
-1D8E;LATIN SMALL LETTER Z WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+1D8E;LATIN SMALL LETTER Z WITH PALATAL HOOK;Ll;0;L;;;;;N;;;A7C6;;A7C6
 1D8F;LATIN SMALL LETTER A WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
 1D90;LATIN SMALL LETTER ALPHA WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
 1D91;LATIN SMALL LETTER D WITH HOOK AND TAIL;Ll;0;L;;;;;N;;;;;
@@ -10165,6 +10182,7 @@
 2BC6;BLACK MEDIUM DOWN-POINTING TRIANGLE CENTRED;So;0;ON;;;;;N;;;;;
 2BC7;BLACK MEDIUM LEFT-POINTING TRIANGLE CENTRED;So;0;ON;;;;;N;;;;;
 2BC8;BLACK MEDIUM RIGHT-POINTING TRIANGLE CENTRED;So;0;ON;;;;;N;;;;;
+2BC9;NEPTUNE FORM TWO;So;0;ON;;;;;N;;;;;
 2BCA;TOP HALF BLACK CIRCLE;So;0;ON;;;;;N;;;;;
 2BCB;BOTTOM HALF BLACK CIRCLE;So;0;ON;;;;;N;;;;;
 2BCC;LIGHT FOUR POINTED BLACK CUSP;So;0;ON;;;;;N;;;;;
@@ -10218,6 +10236,7 @@
 2BFC;DOUBLED SYMBOL;So;0;ON;;;;;N;;;;;
 2BFD;PASSED SYMBOL;So;0;ON;;;;;N;;;;;
 2BFE;REVERSED RIGHT ANGLE;So;0;ON;;;;;Y;;;;;
+2BFF;HELLSCHREIBER PAUSE SYMBOL;So;0;ON;;;;;N;;;;;
 2C00;GLAGOLITIC CAPITAL LETTER AZU;Lu;0;L;;;;;N;;;;2C30;
 2C01;GLAGOLITIC CAPITAL LETTER BUKY;Lu;0;L;;;;;N;;;;2C31;
 2C02;GLAGOLITIC CAPITAL LETTER VEDE;Lu;0;L;;;;;N;;;;2C32;
@@ -10756,6 +10775,7 @@
 2E4C;MEDIEVAL COMMA;Po;0;ON;;;;;N;;;;;
 2E4D;PARAGRAPHUS MARK;Po;0;ON;;;;;N;;;;;
 2E4E;PUNCTUS ELEVATUS MARK;Po;0;ON;;;;;N;;;;;
+2E4F;CORNISH VERSE DIVIDER;Po;0;ON;;;;;N;;;;;
 2E80;CJK RADICAL REPEAT;So;0;ON;;;;;N;;;;;
 2E81;CJK RADICAL CLIFF;So;0;ON;;;;;N;;;;;
 2E82;CJK RADICAL SECOND ONE;So;0;ON;;;;;N;;;;;
@@ -14060,7 +14080,7 @@ A790;LATIN CAPITAL LETTER N WITH 
DESCENDER;Lu;0;L;;;;;N;;;;A791;
 A791;LATIN SMALL LETTER N WITH DESCENDER;Ll;0;L;;;;;N;;;A790;;A790
 A792;LATIN CAPITAL LETTER C WITH BAR;Lu;0;L;;;;;N;;;;A793;
 A793;LATIN SMALL LETTER C WITH BAR;Ll;0;L;;;;;N;;;A792;;A792
-A794;LATIN SMALL LETTER C WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
+A794;LATIN SMALL LETTER C WITH PALATAL HOOK;Ll;0;L;;;;;N;;;A7C4;;A7C4
 A795;LATIN SMALL LETTER H WITH PALATAL HOOK;Ll;0;L;;;;;N;;;;;
 A796;LATIN CAPITAL LETTER B WITH FLOURISH;Lu;0;L;;;;;N;;;;A797;
 A797;LATIN SMALL LETTER B WITH FLOURISH;Ll;0;L;;;;;N;;;A796;;A796
@@ -14098,6 +14118,17 @@ A7B6;LATIN CAPITAL LETTER OMEGA;Lu;0;L;;;;;N;;;;A7B7;
 A7B7;LATIN SMALL LETTER OMEGA;Ll;0;L;;;;;N;;;A7B6;;A7B6
 A7B8;LATIN CAPITAL LETTER U WITH STROKE;Lu;0;L;;;;;N;;;;A7B9;
 A7B9;LATIN SMALL LETTER U WITH STROKE;Ll;0;L;;;;;N;;;A7B8;;A7B8
+A7BA;LATIN CAPITAL LETTER GLOTTAL A;Lu;0;L;;;;;N;;;;A7BB;
+A7BB;LATIN SMALL LETTER GLOTTAL A;Ll;0;L;;;;;N;;;A7BA;;A7BA
+A7BC;LATIN CAPITAL LETTER GLOTTAL I;Lu;0;L;;;;;N;;;;A7BD;
+A7BD;LATIN SMALL LETTER GLOTTAL I;Ll;0;L;;;;;N;;;A7BC;;A7BC
+A7BE;LATIN CAPITAL LETTER GLOTTAL U;Lu;0;L;;;;;N;;;;A7BF;
+A7BF;LATIN SMALL LETTER GLOTTAL U;Ll;0;L;;;;;N;;;A7BE;;A7BE
+A7C2;LATIN CAPITAL LETTER ANGLICANA W;Lu;0;L;;;;;N;;;;A7C3;
+A7C3;LATIN SMALL LETTER ANGLICANA W;Ll;0;L;;;;;N;;;A7C2;;A7C2
+A7C4;LATIN CAPITAL LETTER C WITH PALATAL HOOK;Lu;0;L;;;;;N;;;;A794;
+A7C5;LATIN CAPITAL LETTER S WITH HOOK;Lu;0;L;;;;;N;;;;0282;
+A7C6;LATIN CAPITAL LETTER Z WITH PALATAL HOOK;Lu;0;L;;;;;N;;;;1D8E;
 A7F7;LATIN EPIGRAPHIC LETTER SIDEWAYS I;Lo;0;L;;;;;N;;;;;
 A7F8;MODIFIER LETTER CAPITAL H WITH STROKE;Lm;0;L;<super> 0126;;;;N;;;;;
 A7F9;MODIFIER LETTER SMALL LIGATURE OE;Lm;0;L;<super> 0153;;;;N;;;;;
@@ -14506,7 +14537,7 @@ A9B9;JAVANESE VOWEL SIGN SUKU MENDUT;Mn;0;NSM;;;;;N;;;;;
 A9BA;JAVANESE VOWEL SIGN TALING;Mc;0;L;;;;;N;;;;;
 A9BB;JAVANESE VOWEL SIGN DIRGA MURE;Mc;0;L;;;;;N;;;;;
 A9BC;JAVANESE VOWEL SIGN PEPET;Mn;0;NSM;;;;;N;;;;;
-A9BD;JAVANESE CONSONANT SIGN KERET;Mc;0;L;;;;;N;;;;;
+A9BD;JAVANESE CONSONANT SIGN KERET;Mn;0;NSM;;;;;N;;;;;
 A9BE;JAVANESE CONSONANT SIGN PENGKAL;Mc;0;L;;;;;N;;;;;
 A9BF;JAVANESE CONSONANT SIGN CAKRA;Mc;0;L;;;;;N;;;;;
 A9C0;JAVANESE PANGKON;Mc;9;L;;;;;N;;;;;
@@ -14863,6 +14894,8 @@ AB62;LATIN SMALL LETTER OPEN OE;Ll;0;L;;;;;N;;;;;
 AB63;LATIN SMALL LETTER UO;Ll;0;L;;;;;N;;;;;
 AB64;LATIN SMALL LETTER INVERTED ALPHA;Ll;0;L;;;;;N;;;;;
 AB65;GREEK LETTER SMALL CAPITAL OMEGA;Ll;0;L;;;;;N;;;;;
+AB66;LATIN SMALL LETTER DZ DIGRAPH WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
+AB67;LATIN SMALL LETTER TS DIGRAPH WITH RETROFLEX HOOK;Ll;0;L;;;;;N;;;;;
 AB70;CHEROKEE SMALL LETTER A;Ll;0;L;;;;;N;;;13A0;;13A0
 AB71;CHEROKEE SMALL LETTER E;Ll;0;L;;;;;N;;;13A1;;13A1
 AB72;CHEROKEE SMALL LETTER I;Ll;0;L;;;;;N;;;13A2;;13A2
@@ -19105,6 +19138,29 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 10F57;SOGDIAN PUNCTUATION CIRCLE WITH DOT;Po;0;AL;;;;;N;;;;;
 10F58;SOGDIAN PUNCTUATION TWO CIRCLES WITH DOTS;Po;0;AL;;;;;N;;;;;
 10F59;SOGDIAN PUNCTUATION HALF CIRCLE WITH DOT;Po;0;AL;;;;;N;;;;;
+10FE0;ELYMAIC LETTER ALEPH;Lo;0;R;;;;;N;;;;;
+10FE1;ELYMAIC LETTER BETH;Lo;0;R;;;;;N;;;;;
+10FE2;ELYMAIC LETTER GIMEL;Lo;0;R;;;;;N;;;;;
+10FE3;ELYMAIC LETTER DALETH;Lo;0;R;;;;;N;;;;;
+10FE4;ELYMAIC LETTER HE;Lo;0;R;;;;;N;;;;;
+10FE5;ELYMAIC LETTER WAW;Lo;0;R;;;;;N;;;;;
+10FE6;ELYMAIC LETTER ZAYIN;Lo;0;R;;;;;N;;;;;
+10FE7;ELYMAIC LETTER HETH;Lo;0;R;;;;;N;;;;;
+10FE8;ELYMAIC LETTER TETH;Lo;0;R;;;;;N;;;;;
+10FE9;ELYMAIC LETTER YODH;Lo;0;R;;;;;N;;;;;
+10FEA;ELYMAIC LETTER KAPH;Lo;0;R;;;;;N;;;;;
+10FEB;ELYMAIC LETTER LAMEDH;Lo;0;R;;;;;N;;;;;
+10FEC;ELYMAIC LETTER MEM;Lo;0;R;;;;;N;;;;;
+10FED;ELYMAIC LETTER NUN;Lo;0;R;;;;;N;;;;;
+10FEE;ELYMAIC LETTER SAMEKH;Lo;0;R;;;;;N;;;;;
+10FEF;ELYMAIC LETTER AYIN;Lo;0;R;;;;;N;;;;;
+10FF0;ELYMAIC LETTER PE;Lo;0;R;;;;;N;;;;;
+10FF1;ELYMAIC LETTER SADHE;Lo;0;R;;;;;N;;;;;
+10FF2;ELYMAIC LETTER QOPH;Lo;0;R;;;;;N;;;;;
+10FF3;ELYMAIC LETTER RESH;Lo;0;R;;;;;N;;;;;
+10FF4;ELYMAIC LETTER SHIN;Lo;0;R;;;;;N;;;;;
+10FF5;ELYMAIC LETTER TAW;Lo;0;R;;;;;N;;;;;
+10FF6;ELYMAIC LIGATURE ZAYIN-YODH;Lo;0;R;;;;;N;;;;;
 11000;BRAHMI SIGN CANDRABINDU;Mc;0;L;;;;;N;;;;;
 11001;BRAHMI SIGN ANUSVARA;Mn;0;NSM;;;;;N;;;;;
 11002;BRAHMI SIGN VISARGA;Mc;0;L;;;;;N;;;;;
@@ -19887,6 +19943,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1145B;NEWA PLACEHOLDER MARK;Po;0;L;;;;;N;;;;;
 1145D;NEWA INSERTION SIGN;Po;0;L;;;;;N;;;;;
 1145E;NEWA SANDHI MARK;Mn;230;NSM;;;;;N;;;;;
+1145F;NEWA LETTER VEDIC ANUSVARA;Lo;0;L;;;;;N;;;;;
 11480;TIRHUTA ANJI;Lo;0;L;;;;;N;;;;;
 11481;TIRHUTA LETTER A;Lo;0;L;;;;;N;;;;;
 11482;TIRHUTA LETTER AA;Lo;0;L;;;;;N;;;;;
@@ -20209,6 +20266,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 116B5;TAKRI VOWEL SIGN AU;Mn;0;NSM;;;;;N;;;;;
 116B6;TAKRI SIGN VIRAMA;Mc;9;L;;;;;N;;;;;
 116B7;TAKRI SIGN NUKTA;Mn;7;NSM;;;;;N;;;;;
+116B8;TAKRI LETTER ARCHAIC KHA;Lo;0;L;;;;;N;;;;;
 116C0;TAKRI DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
 116C1;TAKRI DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
 116C2;TAKRI DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
@@ -20421,6 +20479,71 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 118F1;WARANG CITI NUMBER EIGHTY;No;0;L;;;;80;N;;;;;
 118F2;WARANG CITI NUMBER NINETY;No;0;L;;;;90;N;;;;;
 118FF;WARANG CITI OM;Lo;0;L;;;;;N;;;;;
+119A0;NANDINAGARI LETTER A;Lo;0;L;;;;;N;;;;;
+119A1;NANDINAGARI LETTER AA;Lo;0;L;;;;;N;;;;;
+119A2;NANDINAGARI LETTER I;Lo;0;L;;;;;N;;;;;
+119A3;NANDINAGARI LETTER II;Lo;0;L;;;;;N;;;;;
+119A4;NANDINAGARI LETTER U;Lo;0;L;;;;;N;;;;;
+119A5;NANDINAGARI LETTER UU;Lo;0;L;;;;;N;;;;;
+119A6;NANDINAGARI LETTER VOCALIC R;Lo;0;L;;;;;N;;;;;
+119A7;NANDINAGARI LETTER VOCALIC RR;Lo;0;L;;;;;N;;;;;
+119AA;NANDINAGARI LETTER E;Lo;0;L;;;;;N;;;;;
+119AB;NANDINAGARI LETTER AI;Lo;0;L;;;;;N;;;;;
+119AC;NANDINAGARI LETTER O;Lo;0;L;;;;;N;;;;;
+119AD;NANDINAGARI LETTER AU;Lo;0;L;;;;;N;;;;;
+119AE;NANDINAGARI LETTER KA;Lo;0;L;;;;;N;;;;;
+119AF;NANDINAGARI LETTER KHA;Lo;0;L;;;;;N;;;;;
+119B0;NANDINAGARI LETTER GA;Lo;0;L;;;;;N;;;;;
+119B1;NANDINAGARI LETTER GHA;Lo;0;L;;;;;N;;;;;
+119B2;NANDINAGARI LETTER NGA;Lo;0;L;;;;;N;;;;;
+119B3;NANDINAGARI LETTER CA;Lo;0;L;;;;;N;;;;;
+119B4;NANDINAGARI LETTER CHA;Lo;0;L;;;;;N;;;;;
+119B5;NANDINAGARI LETTER JA;Lo;0;L;;;;;N;;;;;
+119B6;NANDINAGARI LETTER JHA;Lo;0;L;;;;;N;;;;;
+119B7;NANDINAGARI LETTER NYA;Lo;0;L;;;;;N;;;;;
+119B8;NANDINAGARI LETTER TTA;Lo;0;L;;;;;N;;;;;
+119B9;NANDINAGARI LETTER TTHA;Lo;0;L;;;;;N;;;;;
+119BA;NANDINAGARI LETTER DDA;Lo;0;L;;;;;N;;;;;
+119BB;NANDINAGARI LETTER DDHA;Lo;0;L;;;;;N;;;;;
+119BC;NANDINAGARI LETTER NNA;Lo;0;L;;;;;N;;;;;
+119BD;NANDINAGARI LETTER TA;Lo;0;L;;;;;N;;;;;
+119BE;NANDINAGARI LETTER THA;Lo;0;L;;;;;N;;;;;
+119BF;NANDINAGARI LETTER DA;Lo;0;L;;;;;N;;;;;
+119C0;NANDINAGARI LETTER DHA;Lo;0;L;;;;;N;;;;;
+119C1;NANDINAGARI LETTER NA;Lo;0;L;;;;;N;;;;;
+119C2;NANDINAGARI LETTER PA;Lo;0;L;;;;;N;;;;;
+119C3;NANDINAGARI LETTER PHA;Lo;0;L;;;;;N;;;;;
+119C4;NANDINAGARI LETTER BA;Lo;0;L;;;;;N;;;;;
+119C5;NANDINAGARI LETTER BHA;Lo;0;L;;;;;N;;;;;
+119C6;NANDINAGARI LETTER MA;Lo;0;L;;;;;N;;;;;
+119C7;NANDINAGARI LETTER YA;Lo;0;L;;;;;N;;;;;
+119C8;NANDINAGARI LETTER RA;Lo;0;L;;;;;N;;;;;
+119C9;NANDINAGARI LETTER LA;Lo;0;L;;;;;N;;;;;
+119CA;NANDINAGARI LETTER VA;Lo;0;L;;;;;N;;;;;
+119CB;NANDINAGARI LETTER SHA;Lo;0;L;;;;;N;;;;;
+119CC;NANDINAGARI LETTER SSA;Lo;0;L;;;;;N;;;;;
+119CD;NANDINAGARI LETTER SA;Lo;0;L;;;;;N;;;;;
+119CE;NANDINAGARI LETTER HA;Lo;0;L;;;;;N;;;;;
+119CF;NANDINAGARI LETTER LLA;Lo;0;L;;;;;N;;;;;
+119D0;NANDINAGARI LETTER RRA;Lo;0;L;;;;;N;;;;;
+119D1;NANDINAGARI VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
+119D2;NANDINAGARI VOWEL SIGN I;Mc;0;L;;;;;N;;;;;
+119D3;NANDINAGARI VOWEL SIGN II;Mc;0;L;;;;;N;;;;;
+119D4;NANDINAGARI VOWEL SIGN U;Mn;0;NSM;;;;;N;;;;;
+119D5;NANDINAGARI VOWEL SIGN UU;Mn;0;NSM;;;;;N;;;;;
+119D6;NANDINAGARI VOWEL SIGN VOCALIC R;Mn;0;NSM;;;;;N;;;;;
+119D7;NANDINAGARI VOWEL SIGN VOCALIC RR;Mn;0;NSM;;;;;N;;;;;
+119DA;NANDINAGARI VOWEL SIGN E;Mn;0;NSM;;;;;N;;;;;
+119DB;NANDINAGARI VOWEL SIGN AI;Mn;0;NSM;;;;;N;;;;;
+119DC;NANDINAGARI VOWEL SIGN O;Mc;0;L;;;;;N;;;;;
+119DD;NANDINAGARI VOWEL SIGN AU;Mc;0;L;;;;;N;;;;;
+119DE;NANDINAGARI SIGN ANUSVARA;Mc;0;L;;;;;N;;;;;
+119DF;NANDINAGARI SIGN VISARGA;Mc;0;L;;;;;N;;;;;
+119E0;NANDINAGARI SIGN VIRAMA;Mn;9;NSM;;;;;N;;;;;
+119E1;NANDINAGARI SIGN AVAGRAHA;Lo;0;L;;;;;N;;;;;
+119E2;NANDINAGARI SIGN SIDDHAM;Po;0;L;;;;;N;;;;;
+119E3;NANDINAGARI HEADSTROKE;Lo;0;L;;;;;N;;;;;
+119E4;NANDINAGARI VOWEL SIGN PRISHTHAMATRA E;Mc;0;L;;;;;N;;;;;
 11A00;ZANABAZAR SQUARE LETTER A;Lo;0;L;;;;;N;;;;;
 11A01;ZANABAZAR SQUARE VOWEL SIGN I;Mn;0;NSM;;;;;N;;;;;
 11A02;ZANABAZAR SQUARE VOWEL SIGN UE;Mn;0;NSM;;;;;N;;;;;
@@ -20545,6 +20668,8 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 11A81;SOYOMBO LETTER SA;Lo;0;L;;;;;N;;;;;
 11A82;SOYOMBO LETTER HA;Lo;0;L;;;;;N;;;;;
 11A83;SOYOMBO LETTER KSSA;Lo;0;L;;;;;N;;;;;
+11A84;SOYOMBO SIGN JIHVAMULIYA;Lo;0;L;;;;;N;;;;;
+11A85;SOYOMBO SIGN UPADHMANIYA;Lo;0;L;;;;;N;;;;;
 11A86;SOYOMBO CLUSTER-INITIAL LETTER RA;Lo;0;L;;;;;N;;;;;
 11A87;SOYOMBO CLUSTER-INITIAL LETTER LA;Lo;0;L;;;;;N;;;;;
 11A88;SOYOMBO CLUSTER-INITIAL LETTER SHA;Lo;0;L;;;;;N;;;;;
@@ -20959,6 +21084,57 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 11EF6;MAKASAR VOWEL SIGN O;Mc;0;L;;;;;N;;;;;
 11EF7;MAKASAR PASSIMBANG;Po;0;L;;;;;N;;;;;
 11EF8;MAKASAR END OF SECTION;Po;0;L;;;;;N;;;;;
+11FC0;TAMIL FRACTION ONE THREE-HUNDRED-AND-TWENTIETH;No;0;L;;;;1/320;N;;;;;
+11FC1;TAMIL FRACTION ONE ONE-HUNDRED-AND-SIXTIETH;No;0;L;;;;1/160;N;;;;;
+11FC2;TAMIL FRACTION ONE EIGHTIETH;No;0;L;;;;1/80;N;;;;;
+11FC3;TAMIL FRACTION ONE SIXTY-FOURTH;No;0;L;;;;1/64;N;;;;;
+11FC4;TAMIL FRACTION ONE FORTIETH;No;0;L;;;;1/40;N;;;;;
+11FC5;TAMIL FRACTION ONE THIRTY-SECOND;No;0;L;;;;1/32;N;;;;;
+11FC6;TAMIL FRACTION THREE EIGHTIETHS;No;0;L;;;;3/80;N;;;;;
+11FC7;TAMIL FRACTION THREE SIXTY-FOURTHS;No;0;L;;;;3/64;N;;;;;
+11FC8;TAMIL FRACTION ONE TWENTIETH;No;0;L;;;;1/20;N;;;;;
+11FC9;TAMIL FRACTION ONE SIXTEENTH-1;No;0;L;;;;1/16;N;;;;;
+11FCA;TAMIL FRACTION ONE SIXTEENTH-2;No;0;L;;;;1/16;N;;;;;
+11FCB;TAMIL FRACTION ONE TENTH;No;0;L;;;;1/10;N;;;;;
+11FCC;TAMIL FRACTION ONE EIGHTH;No;0;L;;;;1/8;N;;;;;
+11FCD;TAMIL FRACTION THREE TWENTIETHS;No;0;L;;;;3/20;N;;;;;
+11FCE;TAMIL FRACTION THREE SIXTEENTHS;No;0;L;;;;3/16;N;;;;;
+11FCF;TAMIL FRACTION ONE FIFTH;No;0;L;;;;1/5;N;;;;;
+11FD0;TAMIL FRACTION ONE QUARTER;No;0;L;;;;1/4;N;;;;;
+11FD1;TAMIL FRACTION ONE HALF-1;No;0;L;;;;1/2;N;;;;;
+11FD2;TAMIL FRACTION ONE HALF-2;No;0;L;;;;1/2;N;;;;;
+11FD3;TAMIL FRACTION THREE QUARTERS;No;0;L;;;;3/4;N;;;;;
+11FD4;TAMIL FRACTION DOWNSCALING FACTOR KIIZH;No;0;L;;;;1/320;N;;;;;
+11FD5;TAMIL SIGN NEL;So;0;ON;;;;;N;;;;;
+11FD6;TAMIL SIGN CEVITU;So;0;ON;;;;;N;;;;;
+11FD7;TAMIL SIGN AAZHAAKKU;So;0;ON;;;;;N;;;;;
+11FD8;TAMIL SIGN UZHAKKU;So;0;ON;;;;;N;;;;;
+11FD9;TAMIL SIGN MUUVUZHAKKU;So;0;ON;;;;;N;;;;;
+11FDA;TAMIL SIGN KURUNI;So;0;ON;;;;;N;;;;;
+11FDB;TAMIL SIGN PATHAKKU;So;0;ON;;;;;N;;;;;
+11FDC;TAMIL SIGN MUKKURUNI;So;0;ON;;;;;N;;;;;
+11FDD;TAMIL SIGN KAACU;Sc;0;ET;;;;;N;;;;;
+11FDE;TAMIL SIGN PANAM;Sc;0;ET;;;;;N;;;;;
+11FDF;TAMIL SIGN PON;Sc;0;ET;;;;;N;;;;;
+11FE0;TAMIL SIGN VARAAKAN;Sc;0;ET;;;;;N;;;;;
+11FE1;TAMIL SIGN PAARAM;So;0;ON;;;;;N;;;;;
+11FE2;TAMIL SIGN KUZHI;So;0;ON;;;;;N;;;;;
+11FE3;TAMIL SIGN VELI;So;0;ON;;;;;N;;;;;
+11FE4;TAMIL WET CULTIVATION SIGN;So;0;ON;;;;;N;;;;;
+11FE5;TAMIL DRY CULTIVATION SIGN;So;0;ON;;;;;N;;;;;
+11FE6;TAMIL LAND SIGN;So;0;ON;;;;;N;;;;;
+11FE7;TAMIL SALT PAN SIGN;So;0;ON;;;;;N;;;;;
+11FE8;TAMIL TRADITIONAL CREDIT SIGN;So;0;ON;;;;;N;;;;;
+11FE9;TAMIL TRADITIONAL NUMBER SIGN;So;0;ON;;;;;N;;;;;
+11FEA;TAMIL CURRENT SIGN;So;0;ON;;;;;N;;;;;
+11FEB;TAMIL AND ODD SIGN;So;0;ON;;;;;N;;;;;
+11FEC;TAMIL SPENT SIGN;So;0;ON;;;;;N;;;;;
+11FED;TAMIL TOTAL SIGN;So;0;ON;;;;;N;;;;;
+11FEE;TAMIL IN POSSESSION SIGN;So;0;ON;;;;;N;;;;;
+11FEF;TAMIL STARTING FROM SIGN;So;0;ON;;;;;N;;;;;
+11FF0;TAMIL SIGN MUTHALIYA;So;0;ON;;;;;N;;;;;
+11FF1;TAMIL SIGN VAKAIYARAA;So;0;ON;;;;;N;;;;;
+11FFF;TAMIL PUNCTUATION END OF TEXT;Po;0;L;;;;;N;;;;;
 12000;CUNEIFORM SIGN A;Lo;0;L;;;;;N;;;;;
 12001;CUNEIFORM SIGN A TIMES A;Lo;0;L;;;;;N;;;;;
 12002;CUNEIFORM SIGN A TIMES BAD;Lo;0;L;;;;;N;;;;;
@@ -23264,6 +23440,15 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1342C;EGYPTIAN HIEROGLYPH AA030;Lo;0;L;;;;;N;;;;;
 1342D;EGYPTIAN HIEROGLYPH AA031;Lo;0;L;;;;;N;;;;;
 1342E;EGYPTIAN HIEROGLYPH AA032;Lo;0;L;;;;;N;;;;;
+13430;EGYPTIAN HIEROGLYPH VERTICAL JOINER;Cf;0;L;;;;;N;;;;;
+13431;EGYPTIAN HIEROGLYPH HORIZONTAL JOINER;Cf;0;L;;;;;N;;;;;
+13432;EGYPTIAN HIEROGLYPH INSERT AT TOP START;Cf;0;L;;;;;N;;;;;
+13433;EGYPTIAN HIEROGLYPH INSERT AT BOTTOM START;Cf;0;L;;;;;N;;;;;
+13434;EGYPTIAN HIEROGLYPH INSERT AT TOP END;Cf;0;L;;;;;N;;;;;
+13435;EGYPTIAN HIEROGLYPH INSERT AT BOTTOM END;Cf;0;L;;;;;N;;;;;
+13436;EGYPTIAN HIEROGLYPH OVERLAY MIDDLE;Cf;0;L;;;;;N;;;;;
+13437;EGYPTIAN HIEROGLYPH BEGIN SEGMENT;Cf;0;L;;;;;N;;;;;
+13438;EGYPTIAN HIEROGLYPH END SEGMENT;Cf;0;L;;;;;N;;;;;
 14400;ANATOLIAN HIEROGLYPH A001;Lo;0;L;;;;;N;;;;;
 14401;ANATOLIAN HIEROGLYPH A002;Lo;0;L;;;;;N;;;;;
 14402;ANATOLIAN HIEROGLYPH A003;Lo;0;L;;;;;N;;;;;
@@ -24782,6 +24967,13 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 16F42;MIAO LETTER WA;Lo;0;L;;;;;N;;;;;
 16F43;MIAO LETTER AH;Lo;0;L;;;;;N;;;;;
 16F44;MIAO LETTER HHA;Lo;0;L;;;;;N;;;;;
+16F45;MIAO LETTER BRI;Lo;0;L;;;;;N;;;;;
+16F46;MIAO LETTER SYI;Lo;0;L;;;;;N;;;;;
+16F47;MIAO LETTER DZYI;Lo;0;L;;;;;N;;;;;
+16F48;MIAO LETTER TE;Lo;0;L;;;;;N;;;;;
+16F49;MIAO LETTER TSE;Lo;0;L;;;;;N;;;;;
+16F4A;MIAO LETTER RTE;Lo;0;L;;;;;N;;;;;
+16F4F;MIAO SIGN CONSONANT MODIFIER BAR;Mn;0;NSM;;;;;N;;;;;
 16F50;MIAO LETTER NASALIZATION;Lo;0;L;;;;;N;;;;;
 16F51;MIAO SIGN ASPIRATION;Mc;0;L;;;;;N;;;;;
 16F52;MIAO SIGN REFORMED VOICING;Mc;0;L;;;;;N;;;;;
@@ -24829,6 +25021,15 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 16F7C;MIAO VOWEL SIGN OU;Mc;0;L;;;;;N;;;;;
 16F7D;MIAO VOWEL SIGN N;Mc;0;L;;;;;N;;;;;
 16F7E;MIAO VOWEL SIGN NG;Mc;0;L;;;;;N;;;;;
+16F7F;MIAO VOWEL SIGN UOG;Mc;0;L;;;;;N;;;;;
+16F80;MIAO VOWEL SIGN YUI;Mc;0;L;;;;;N;;;;;
+16F81;MIAO VOWEL SIGN OG;Mc;0;L;;;;;N;;;;;
+16F82;MIAO VOWEL SIGN OER;Mc;0;L;;;;;N;;;;;
+16F83;MIAO VOWEL SIGN VW;Mc;0;L;;;;;N;;;;;
+16F84;MIAO VOWEL SIGN IG;Mc;0;L;;;;;N;;;;;
+16F85;MIAO VOWEL SIGN EA;Mc;0;L;;;;;N;;;;;
+16F86;MIAO VOWEL SIGN IONG;Mc;0;L;;;;;N;;;;;
+16F87;MIAO VOWEL SIGN UI;Mc;0;L;;;;;N;;;;;
 16F8F;MIAO TONE RIGHT;Mn;0;NSM;;;;;N;;;;;
 16F90;MIAO TONE TOP RIGHT;Mn;0;NSM;;;;;N;;;;;
 16F91;MIAO TONE ABOVE;Mn;0;NSM;;;;;N;;;;;
@@ -24848,8 +25049,10 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 16F9F;MIAO LETTER REFORMED TONE-8;Lm;0;L;;;;;N;;;;;
 16FE0;TANGUT ITERATION MARK;Lm;0;L;;;;;N;;;;;
 16FE1;NUSHU ITERATION MARK;Lm;0;L;;;;;N;;;;;
+16FE2;OLD CHINESE HOOK MARK;Po;0;ON;;;;;N;;;;;
+16FE3;OLD CHINESE ITERATION MARK;Lm;0;L;;;;;N;;;;;
 17000;<Tangut Ideograph, First>;Lo;0;L;;;;;N;;;;;
-187F1;<Tangut Ideograph, Last>;Lo;0;L;;;;;N;;;;;
+187F7;<Tangut Ideograph, Last>;Lo;0;L;;;;;N;;;;;
 18800;TANGUT COMPONENT-001;Lo;0;L;;;;;N;;;;;
 18801;TANGUT COMPONENT-002;Lo;0;L;;;;;N;;;;;
 18802;TANGUT COMPONENT-003;Lo;0;L;;;;;N;;;;;
@@ -25892,6 +26095,13 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1B11C;HENTAIGANA LETTER WO-7;Lo;0;L;;;;;N;;;;;
 1B11D;HENTAIGANA LETTER N-MU-MO-1;Lo;0;L;;;;;N;;;;;
 1B11E;HENTAIGANA LETTER N-MU-MO-2;Lo;0;L;;;;;N;;;;;
+1B150;HIRAGANA LETTER SMALL WI;Lo;0;L;;;;;N;;;;;
+1B151;HIRAGANA LETTER SMALL WE;Lo;0;L;;;;;N;;;;;
+1B152;HIRAGANA LETTER SMALL WO;Lo;0;L;;;;;N;;;;;
+1B164;KATAKANA LETTER SMALL WI;Lo;0;L;;;;;N;;;;;
+1B165;KATAKANA LETTER SMALL WE;Lo;0;L;;;;;N;;;;;
+1B166;KATAKANA LETTER SMALL WO;Lo;0;L;;;;;N;;;;;
+1B167;KATAKANA LETTER SMALL N;Lo;0;L;;;;;N;;;;;
 1B170;NUSHU CHARACTER-1B170;Lo;0;L;;;;;N;;;;;
 1B171;NUSHU CHARACTER-1B171;Lo;0;L;;;;;N;;;;;
 1B172;NUSHU CHARACTER-1B172;Lo;0;L;;;;;N;;;;;
@@ -28820,6 +29030,136 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1E028;COMBINING GLAGOLITIC LETTER BIG YUS;Mn;230;NSM;;;;;N;;;;;
 1E029;COMBINING GLAGOLITIC LETTER IOTATED BIG YUS;Mn;230;NSM;;;;;N;;;;;
 1E02A;COMBINING GLAGOLITIC LETTER FITA;Mn;230;NSM;;;;;N;;;;;
+1E100;NYIAKENG PUACHUE HMONG LETTER MA;Lo;0;L;;;;;N;;;;;
+1E101;NYIAKENG PUACHUE HMONG LETTER TSA;Lo;0;L;;;;;N;;;;;
+1E102;NYIAKENG PUACHUE HMONG LETTER NTA;Lo;0;L;;;;;N;;;;;
+1E103;NYIAKENG PUACHUE HMONG LETTER TA;Lo;0;L;;;;;N;;;;;
+1E104;NYIAKENG PUACHUE HMONG LETTER HA;Lo;0;L;;;;;N;;;;;
+1E105;NYIAKENG PUACHUE HMONG LETTER NA;Lo;0;L;;;;;N;;;;;
+1E106;NYIAKENG PUACHUE HMONG LETTER XA;Lo;0;L;;;;;N;;;;;
+1E107;NYIAKENG PUACHUE HMONG LETTER NKA;Lo;0;L;;;;;N;;;;;
+1E108;NYIAKENG PUACHUE HMONG LETTER CA;Lo;0;L;;;;;N;;;;;
+1E109;NYIAKENG PUACHUE HMONG LETTER LA;Lo;0;L;;;;;N;;;;;
+1E10A;NYIAKENG PUACHUE HMONG LETTER SA;Lo;0;L;;;;;N;;;;;
+1E10B;NYIAKENG PUACHUE HMONG LETTER ZA;Lo;0;L;;;;;N;;;;;
+1E10C;NYIAKENG PUACHUE HMONG LETTER NCA;Lo;0;L;;;;;N;;;;;
+1E10D;NYIAKENG PUACHUE HMONG LETTER NTSA;Lo;0;L;;;;;N;;;;;
+1E10E;NYIAKENG PUACHUE HMONG LETTER KA;Lo;0;L;;;;;N;;;;;
+1E10F;NYIAKENG PUACHUE HMONG LETTER DA;Lo;0;L;;;;;N;;;;;
+1E110;NYIAKENG PUACHUE HMONG LETTER NYA;Lo;0;L;;;;;N;;;;;
+1E111;NYIAKENG PUACHUE HMONG LETTER NRA;Lo;0;L;;;;;N;;;;;
+1E112;NYIAKENG PUACHUE HMONG LETTER VA;Lo;0;L;;;;;N;;;;;
+1E113;NYIAKENG PUACHUE HMONG LETTER NTXA;Lo;0;L;;;;;N;;;;;
+1E114;NYIAKENG PUACHUE HMONG LETTER TXA;Lo;0;L;;;;;N;;;;;
+1E115;NYIAKENG PUACHUE HMONG LETTER FA;Lo;0;L;;;;;N;;;;;
+1E116;NYIAKENG PUACHUE HMONG LETTER RA;Lo;0;L;;;;;N;;;;;
+1E117;NYIAKENG PUACHUE HMONG LETTER QA;Lo;0;L;;;;;N;;;;;
+1E118;NYIAKENG PUACHUE HMONG LETTER YA;Lo;0;L;;;;;N;;;;;
+1E119;NYIAKENG PUACHUE HMONG LETTER NQA;Lo;0;L;;;;;N;;;;;
+1E11A;NYIAKENG PUACHUE HMONG LETTER PA;Lo;0;L;;;;;N;;;;;
+1E11B;NYIAKENG PUACHUE HMONG LETTER XYA;Lo;0;L;;;;;N;;;;;
+1E11C;NYIAKENG PUACHUE HMONG LETTER NPA;Lo;0;L;;;;;N;;;;;
+1E11D;NYIAKENG PUACHUE HMONG LETTER DLA;Lo;0;L;;;;;N;;;;;
+1E11E;NYIAKENG PUACHUE HMONG LETTER NPLA;Lo;0;L;;;;;N;;;;;
+1E11F;NYIAKENG PUACHUE HMONG LETTER HAH;Lo;0;L;;;;;N;;;;;
+1E120;NYIAKENG PUACHUE HMONG LETTER MLA;Lo;0;L;;;;;N;;;;;
+1E121;NYIAKENG PUACHUE HMONG LETTER PLA;Lo;0;L;;;;;N;;;;;
+1E122;NYIAKENG PUACHUE HMONG LETTER GA;Lo;0;L;;;;;N;;;;;
+1E123;NYIAKENG PUACHUE HMONG LETTER RRA;Lo;0;L;;;;;N;;;;;
+1E124;NYIAKENG PUACHUE HMONG LETTER A;Lo;0;L;;;;;N;;;;;
+1E125;NYIAKENG PUACHUE HMONG LETTER AA;Lo;0;L;;;;;N;;;;;
+1E126;NYIAKENG PUACHUE HMONG LETTER I;Lo;0;L;;;;;N;;;;;
+1E127;NYIAKENG PUACHUE HMONG LETTER U;Lo;0;L;;;;;N;;;;;
+1E128;NYIAKENG PUACHUE HMONG LETTER O;Lo;0;L;;;;;N;;;;;
+1E129;NYIAKENG PUACHUE HMONG LETTER OO;Lo;0;L;;;;;N;;;;;
+1E12A;NYIAKENG PUACHUE HMONG LETTER E;Lo;0;L;;;;;N;;;;;
+1E12B;NYIAKENG PUACHUE HMONG LETTER EE;Lo;0;L;;;;;N;;;;;
+1E12C;NYIAKENG PUACHUE HMONG LETTER W;Lo;0;L;;;;;N;;;;;
+1E130;NYIAKENG PUACHUE HMONG TONE-B;Mn;230;NSM;;;;;N;;;;;
+1E131;NYIAKENG PUACHUE HMONG TONE-M;Mn;230;NSM;;;;;N;;;;;
+1E132;NYIAKENG PUACHUE HMONG TONE-J;Mn;230;NSM;;;;;N;;;;;
+1E133;NYIAKENG PUACHUE HMONG TONE-V;Mn;230;NSM;;;;;N;;;;;
+1E134;NYIAKENG PUACHUE HMONG TONE-S;Mn;230;NSM;;;;;N;;;;;
+1E135;NYIAKENG PUACHUE HMONG TONE-G;Mn;230;NSM;;;;;N;;;;;
+1E136;NYIAKENG PUACHUE HMONG TONE-D;Mn;230;NSM;;;;;N;;;;;
+1E137;NYIAKENG PUACHUE HMONG SIGN FOR PERSON;Lm;0;L;;;;;N;;;;;
+1E138;NYIAKENG PUACHUE HMONG SIGN FOR THING;Lm;0;L;;;;;N;;;;;
+1E139;NYIAKENG PUACHUE HMONG SIGN FOR LOCATION;Lm;0;L;;;;;N;;;;;
+1E13A;NYIAKENG PUACHUE HMONG SIGN FOR ANIMAL;Lm;0;L;;;;;N;;;;;
+1E13B;NYIAKENG PUACHUE HMONG SIGN FOR INVERTEBRATE;Lm;0;L;;;;;N;;;;;
+1E13C;NYIAKENG PUACHUE HMONG SIGN XW XW;Lm;0;L;;;;;N;;;;;
+1E13D;NYIAKENG PUACHUE HMONG SYLLABLE LENGTHENER;Lm;0;L;;;;;N;;;;;
+1E140;NYIAKENG PUACHUE HMONG DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+1E141;NYIAKENG PUACHUE HMONG DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+1E142;NYIAKENG PUACHUE HMONG DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+1E143;NYIAKENG PUACHUE HMONG DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+1E144;NYIAKENG PUACHUE HMONG DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+1E145;NYIAKENG PUACHUE HMONG DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+1E146;NYIAKENG PUACHUE HMONG DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+1E147;NYIAKENG PUACHUE HMONG DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+1E148;NYIAKENG PUACHUE HMONG DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+1E149;NYIAKENG PUACHUE HMONG DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+1E14E;NYIAKENG PUACHUE HMONG LOGOGRAM NYAJ;Lo;0;L;;;;;N;;;;;
+1E14F;NYIAKENG PUACHUE HMONG CIRCLED CA;So;0;L;;;;;N;;;;;
+1E2C0;WANCHO LETTER AA;Lo;0;L;;;;;N;;;;;
+1E2C1;WANCHO LETTER A;Lo;0;L;;;;;N;;;;;
+1E2C2;WANCHO LETTER BA;Lo;0;L;;;;;N;;;;;
+1E2C3;WANCHO LETTER CA;Lo;0;L;;;;;N;;;;;
+1E2C4;WANCHO LETTER DA;Lo;0;L;;;;;N;;;;;
+1E2C5;WANCHO LETTER GA;Lo;0;L;;;;;N;;;;;
+1E2C6;WANCHO LETTER YA;Lo;0;L;;;;;N;;;;;
+1E2C7;WANCHO LETTER PHA;Lo;0;L;;;;;N;;;;;
+1E2C8;WANCHO LETTER LA;Lo;0;L;;;;;N;;;;;
+1E2C9;WANCHO LETTER NA;Lo;0;L;;;;;N;;;;;
+1E2CA;WANCHO LETTER PA;Lo;0;L;;;;;N;;;;;
+1E2CB;WANCHO LETTER TA;Lo;0;L;;;;;N;;;;;
+1E2CC;WANCHO LETTER THA;Lo;0;L;;;;;N;;;;;
+1E2CD;WANCHO LETTER FA;Lo;0;L;;;;;N;;;;;
+1E2CE;WANCHO LETTER SA;Lo;0;L;;;;;N;;;;;
+1E2CF;WANCHO LETTER SHA;Lo;0;L;;;;;N;;;;;
+1E2D0;WANCHO LETTER JA;Lo;0;L;;;;;N;;;;;
+1E2D1;WANCHO LETTER ZA;Lo;0;L;;;;;N;;;;;
+1E2D2;WANCHO LETTER WA;Lo;0;L;;;;;N;;;;;
+1E2D3;WANCHO LETTER VA;Lo;0;L;;;;;N;;;;;
+1E2D4;WANCHO LETTER KA;Lo;0;L;;;;;N;;;;;
+1E2D5;WANCHO LETTER O;Lo;0;L;;;;;N;;;;;
+1E2D6;WANCHO LETTER AU;Lo;0;L;;;;;N;;;;;
+1E2D7;WANCHO LETTER RA;Lo;0;L;;;;;N;;;;;
+1E2D8;WANCHO LETTER MA;Lo;0;L;;;;;N;;;;;
+1E2D9;WANCHO LETTER KHA;Lo;0;L;;;;;N;;;;;
+1E2DA;WANCHO LETTER HA;Lo;0;L;;;;;N;;;;;
+1E2DB;WANCHO LETTER E;Lo;0;L;;;;;N;;;;;
+1E2DC;WANCHO LETTER I;Lo;0;L;;;;;N;;;;;
+1E2DD;WANCHO LETTER NGA;Lo;0;L;;;;;N;;;;;
+1E2DE;WANCHO LETTER U;Lo;0;L;;;;;N;;;;;
+1E2DF;WANCHO LETTER LLHA;Lo;0;L;;;;;N;;;;;
+1E2E0;WANCHO LETTER TSA;Lo;0;L;;;;;N;;;;;
+1E2E1;WANCHO LETTER TRA;Lo;0;L;;;;;N;;;;;
+1E2E2;WANCHO LETTER ONG;Lo;0;L;;;;;N;;;;;
+1E2E3;WANCHO LETTER AANG;Lo;0;L;;;;;N;;;;;
+1E2E4;WANCHO LETTER ANG;Lo;0;L;;;;;N;;;;;
+1E2E5;WANCHO LETTER ING;Lo;0;L;;;;;N;;;;;
+1E2E6;WANCHO LETTER ON;Lo;0;L;;;;;N;;;;;
+1E2E7;WANCHO LETTER EN;Lo;0;L;;;;;N;;;;;
+1E2E8;WANCHO LETTER AAN;Lo;0;L;;;;;N;;;;;
+1E2E9;WANCHO LETTER NYA;Lo;0;L;;;;;N;;;;;
+1E2EA;WANCHO LETTER UEN;Lo;0;L;;;;;N;;;;;
+1E2EB;WANCHO LETTER YIH;Lo;0;L;;;;;N;;;;;
+1E2EC;WANCHO TONE TUP;Mn;230;NSM;;;;;N;;;;;
+1E2ED;WANCHO TONE TUPNI;Mn;230;NSM;;;;;N;;;;;
+1E2EE;WANCHO TONE KOI;Mn;230;NSM;;;;;N;;;;;
+1E2EF;WANCHO TONE KOINI;Mn;230;NSM;;;;;N;;;;;
+1E2F0;WANCHO DIGIT ZERO;Nd;0;L;;0;0;0;N;;;;;
+1E2F1;WANCHO DIGIT ONE;Nd;0;L;;1;1;1;N;;;;;
+1E2F2;WANCHO DIGIT TWO;Nd;0;L;;2;2;2;N;;;;;
+1E2F3;WANCHO DIGIT THREE;Nd;0;L;;3;3;3;N;;;;;
+1E2F4;WANCHO DIGIT FOUR;Nd;0;L;;4;4;4;N;;;;;
+1E2F5;WANCHO DIGIT FIVE;Nd;0;L;;5;5;5;N;;;;;
+1E2F6;WANCHO DIGIT SIX;Nd;0;L;;6;6;6;N;;;;;
+1E2F7;WANCHO DIGIT SEVEN;Nd;0;L;;7;7;7;N;;;;;
+1E2F8;WANCHO DIGIT EIGHT;Nd;0;L;;8;8;8;N;;;;;
+1E2F9;WANCHO DIGIT NINE;Nd;0;L;;9;9;9;N;;;;;
+1E2FF;WANCHO NGUN SIGN;Sc;0;ET;;;;;N;;;;;
 1E800;MENDE KIKAKUI SYLLABLE M001 KI;Lo;0;R;;;;;N;;;;;
 1E801;MENDE KIKAKUI SYLLABLE M002 KA;Lo;0;R;;;;;N;;;;;
 1E802;MENDE KIKAKUI SYLLABLE M003 KU;Lo;0;R;;;;;N;;;;;
@@ -29108,6 +29448,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1E948;ADLAM CONSONANT MODIFIER;Mn;230;NSM;;;;;N;;;;;
 1E949;ADLAM GEMINATE CONSONANT MODIFIER;Mn;230;NSM;;;;;N;;;;;
 1E94A;ADLAM NUKTA;Mn;7;NSM;;;;;N;;;;;
+1E94B;ADLAM NASALIZATION MARK;Lm;0;R;;;;;N;;;;;
 1E950;ADLAM DIGIT ZERO;Nd;0;R;;0;0;0;N;;;;;
 1E951;ADLAM DIGIT ONE;Nd;0;R;;1;1;1;N;;;;;
 1E952;ADLAM DIGIT TWO;Nd;0;R;;2;2;2;N;;;;;
@@ -29188,6 +29529,67 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1ECB2;INDIC SIYAQ NUMBER ALTERNATE TWO;No;0;AL;;;;2;N;;;;;
 1ECB3;INDIC SIYAQ NUMBER ALTERNATE TEN THOUSAND;No;0;AL;;;;10000;N;;;;;
 1ECB4;INDIC SIYAQ ALTERNATE LAKH MARK;No;0;AL;;;;100000;N;;;;;
+1ED01;OTTOMAN SIYAQ NUMBER ONE;No;0;AL;;;;1;N;;;;;
+1ED02;OTTOMAN SIYAQ NUMBER TWO;No;0;AL;;;;2;N;;;;;
+1ED03;OTTOMAN SIYAQ NUMBER THREE;No;0;AL;;;;3;N;;;;;
+1ED04;OTTOMAN SIYAQ NUMBER FOUR;No;0;AL;;;;4;N;;;;;
+1ED05;OTTOMAN SIYAQ NUMBER FIVE;No;0;AL;;;;5;N;;;;;
+1ED06;OTTOMAN SIYAQ NUMBER SIX;No;0;AL;;;;6;N;;;;;
+1ED07;OTTOMAN SIYAQ NUMBER SEVEN;No;0;AL;;;;7;N;;;;;
+1ED08;OTTOMAN SIYAQ NUMBER EIGHT;No;0;AL;;;;8;N;;;;;
+1ED09;OTTOMAN SIYAQ NUMBER NINE;No;0;AL;;;;9;N;;;;;
+1ED0A;OTTOMAN SIYAQ NUMBER TEN;No;0;AL;;;;10;N;;;;;
+1ED0B;OTTOMAN SIYAQ NUMBER TWENTY;No;0;AL;;;;20;N;;;;;
+1ED0C;OTTOMAN SIYAQ NUMBER THIRTY;No;0;AL;;;;30;N;;;;;
+1ED0D;OTTOMAN SIYAQ NUMBER FORTY;No;0;AL;;;;40;N;;;;;
+1ED0E;OTTOMAN SIYAQ NUMBER FIFTY;No;0;AL;;;;50;N;;;;;
+1ED0F;OTTOMAN SIYAQ NUMBER SIXTY;No;0;AL;;;;60;N;;;;;
+1ED10;OTTOMAN SIYAQ NUMBER SEVENTY;No;0;AL;;;;70;N;;;;;
+1ED11;OTTOMAN SIYAQ NUMBER EIGHTY;No;0;AL;;;;80;N;;;;;
+1ED12;OTTOMAN SIYAQ NUMBER NINETY;No;0;AL;;;;90;N;;;;;
+1ED13;OTTOMAN SIYAQ NUMBER ONE HUNDRED;No;0;AL;;;;100;N;;;;;
+1ED14;OTTOMAN SIYAQ NUMBER TWO HUNDRED;No;0;AL;;;;200;N;;;;;
+1ED15;OTTOMAN SIYAQ NUMBER THREE HUNDRED;No;0;AL;;;;300;N;;;;;
+1ED16;OTTOMAN SIYAQ NUMBER FOUR HUNDRED;No;0;AL;;;;400;N;;;;;
+1ED17;OTTOMAN SIYAQ NUMBER FIVE HUNDRED;No;0;AL;;;;500;N;;;;;
+1ED18;OTTOMAN SIYAQ NUMBER SIX HUNDRED;No;0;AL;;;;600;N;;;;;
+1ED19;OTTOMAN SIYAQ NUMBER SEVEN HUNDRED;No;0;AL;;;;700;N;;;;;
+1ED1A;OTTOMAN SIYAQ NUMBER EIGHT HUNDRED;No;0;AL;;;;800;N;;;;;
+1ED1B;OTTOMAN SIYAQ NUMBER NINE HUNDRED;No;0;AL;;;;900;N;;;;;
+1ED1C;OTTOMAN SIYAQ NUMBER ONE THOUSAND;No;0;AL;;;;1000;N;;;;;
+1ED1D;OTTOMAN SIYAQ NUMBER TWO THOUSAND;No;0;AL;;;;2000;N;;;;;
+1ED1E;OTTOMAN SIYAQ NUMBER THREE THOUSAND;No;0;AL;;;;3000;N;;;;;
+1ED1F;OTTOMAN SIYAQ NUMBER FOUR THOUSAND;No;0;AL;;;;4000;N;;;;;
+1ED20;OTTOMAN SIYAQ NUMBER FIVE THOUSAND;No;0;AL;;;;5000;N;;;;;
+1ED21;OTTOMAN SIYAQ NUMBER SIX THOUSAND;No;0;AL;;;;6000;N;;;;;
+1ED22;OTTOMAN SIYAQ NUMBER SEVEN THOUSAND;No;0;AL;;;;7000;N;;;;;
+1ED23;OTTOMAN SIYAQ NUMBER EIGHT THOUSAND;No;0;AL;;;;8000;N;;;;;
+1ED24;OTTOMAN SIYAQ NUMBER NINE THOUSAND;No;0;AL;;;;9000;N;;;;;
+1ED25;OTTOMAN SIYAQ NUMBER TEN THOUSAND;No;0;AL;;;;10000;N;;;;;
+1ED26;OTTOMAN SIYAQ NUMBER TWENTY THOUSAND;No;0;AL;;;;20000;N;;;;;
+1ED27;OTTOMAN SIYAQ NUMBER THIRTY THOUSAND;No;0;AL;;;;30000;N;;;;;
+1ED28;OTTOMAN SIYAQ NUMBER FORTY THOUSAND;No;0;AL;;;;40000;N;;;;;
+1ED29;OTTOMAN SIYAQ NUMBER FIFTY THOUSAND;No;0;AL;;;;50000;N;;;;;
+1ED2A;OTTOMAN SIYAQ NUMBER SIXTY THOUSAND;No;0;AL;;;;60000;N;;;;;
+1ED2B;OTTOMAN SIYAQ NUMBER SEVENTY THOUSAND;No;0;AL;;;;70000;N;;;;;
+1ED2C;OTTOMAN SIYAQ NUMBER EIGHTY THOUSAND;No;0;AL;;;;80000;N;;;;;
+1ED2D;OTTOMAN SIYAQ NUMBER NINETY THOUSAND;No;0;AL;;;;90000;N;;;;;
+1ED2E;OTTOMAN SIYAQ MARRATAN;So;0;AL;;;;;N;;;;;
+1ED2F;OTTOMAN SIYAQ ALTERNATE NUMBER TWO;No;0;AL;;;;2;N;;;;;
+1ED30;OTTOMAN SIYAQ ALTERNATE NUMBER THREE;No;0;AL;;;;3;N;;;;;
+1ED31;OTTOMAN SIYAQ ALTERNATE NUMBER FOUR;No;0;AL;;;;4;N;;;;;
+1ED32;OTTOMAN SIYAQ ALTERNATE NUMBER FIVE;No;0;AL;;;;5;N;;;;;
+1ED33;OTTOMAN SIYAQ ALTERNATE NUMBER SIX;No;0;AL;;;;6;N;;;;;
+1ED34;OTTOMAN SIYAQ ALTERNATE NUMBER SEVEN;No;0;AL;;;;7;N;;;;;
+1ED35;OTTOMAN SIYAQ ALTERNATE NUMBER EIGHT;No;0;AL;;;;8;N;;;;;
+1ED36;OTTOMAN SIYAQ ALTERNATE NUMBER NINE;No;0;AL;;;;9;N;;;;;
+1ED37;OTTOMAN SIYAQ ALTERNATE NUMBER TEN;No;0;AL;;;;10;N;;;;;
+1ED38;OTTOMAN SIYAQ ALTERNATE NUMBER FOUR HUNDRED;No;0;AL;;;;400;N;;;;;
+1ED39;OTTOMAN SIYAQ ALTERNATE NUMBER SIX HUNDRED;No;0;AL;;;;600;N;;;;;
+1ED3A;OTTOMAN SIYAQ ALTERNATE NUMBER TWO THOUSAND;No;0;AL;;;;2000;N;;;;;
+1ED3B;OTTOMAN SIYAQ ALTERNATE NUMBER TEN THOUSAND;No;0;AL;;;;10000;N;;;;;
+1ED3C;OTTOMAN SIYAQ FRACTION ONE HALF;No;0;AL;;;;1/2;N;;;;;
+1ED3D;OTTOMAN SIYAQ FRACTION ONE SIXTH;No;0;AL;;;;1/6;N;;;;;
 1EE00;ARABIC MATHEMATICAL ALEF;Lo;0;AL;<font> 0627;;;;N;;;;;
 1EE01;ARABIC MATHEMATICAL BEH;Lo;0;AL;<font> 0628;;;;N;;;;;
 1EE02;ARABIC MATHEMATICAL JEEM;Lo;0;AL;<font> 062C;;;;N;;;;;
@@ -29662,6 +30064,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F169;NEGATIVE CIRCLED LATIN CAPITAL LETTER Z;So;0;L;;;;;N;;;;;
 1F16A;RAISED MC SIGN;So;0;ON;<super> 004D 0043;;;;N;;;;;
 1F16B;RAISED MD SIGN;So;0;ON;<super> 004D 0044;;;;N;;;;;
+1F16C;RAISED MR SIGN;So;0;ON;<super> 004D 0052;;;;N;;;;;
 1F170;NEGATIVE SQUARED LATIN CAPITAL LETTER A;So;0;L;;;;;N;;;;;
 1F171;NEGATIVE SQUARED LATIN CAPITAL LETTER B;So;0;L;;;;;N;;;;;
 1F172;NEGATIVE SQUARED LATIN CAPITAL LETTER C;So;0;L;;;;;N;;;;;
@@ -30794,6 +31197,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F6D2;SHOPPING TROLLEY;So;0;ON;;;;;N;;;;;
 1F6D3;STUPA;So;0;ON;;;;;N;;;;;
 1F6D4;PAGODA;So;0;ON;;;;;N;;;;;
+1F6D5;HINDU TEMPLE;So;0;ON;;;;;N;;;;;
 1F6E0;HAMMER AND WRENCH;So;0;ON;;;;;N;;;;;
 1F6E1;SHIELD;So;0;ON;;;;;N;;;;;
 1F6E2;OIL DRUM;So;0;ON;;;;;N;;;;;
@@ -30817,6 +31221,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F6F7;SLED;So;0;ON;;;;;N;;;;;
 1F6F8;FLYING SAUCER;So;0;ON;;;;;N;;;;;
 1F6F9;SKATEBOARD;So;0;ON;;;;;N;;;;;
+1F6FA;AUTO RICKSHAW;So;0;ON;;;;;N;;;;;
 1F700;ALCHEMICAL SYMBOL FOR QUINTESSENCE;So;0;ON;;;;;N;;;;;
 1F701;ALCHEMICAL SYMBOL FOR AIR;So;0;ON;;;;;N;;;;;
 1F702;ALCHEMICAL SYMBOL FOR FIRE;So;0;ON;;;;;N;;;;;
@@ -31022,6 +31427,18 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F7D6;NEGATIVE CIRCLED TRIANGLE;So;0;ON;;;;;N;;;;;
 1F7D7;CIRCLED SQUARE;So;0;ON;;;;;N;;;;;
 1F7D8;NEGATIVE CIRCLED SQUARE;So;0;ON;;;;;N;;;;;
+1F7E0;LARGE ORANGE CIRCLE;So;0;ON;;;;;N;;;;;
+1F7E1;LARGE YELLOW CIRCLE;So;0;ON;;;;;N;;;;;
+1F7E2;LARGE GREEN CIRCLE;So;0;ON;;;;;N;;;;;
+1F7E3;LARGE PURPLE CIRCLE;So;0;ON;;;;;N;;;;;
+1F7E4;LARGE BROWN CIRCLE;So;0;ON;;;;;N;;;;;
+1F7E5;LARGE RED SQUARE;So;0;ON;;;;;N;;;;;
+1F7E6;LARGE BLUE SQUARE;So;0;ON;;;;;N;;;;;
+1F7E7;LARGE ORANGE SQUARE;So;0;ON;;;;;N;;;;;
+1F7E8;LARGE YELLOW SQUARE;So;0;ON;;;;;N;;;;;
+1F7E9;LARGE GREEN SQUARE;So;0;ON;;;;;N;;;;;
+1F7EA;LARGE PURPLE SQUARE;So;0;ON;;;;;N;;;;;
+1F7EB;LARGE BROWN SQUARE;So;0;ON;;;;;N;;;;;
 1F800;LEFTWARDS ARROW WITH SMALL TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;;
 1F801;UPWARDS ARROW WITH SMALL TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;;
 1F802;RIGHTWARDS ARROW WITH SMALL TRIANGLE ARROWHEAD;So;0;ON;;;;;N;;;;;
@@ -31182,6 +31599,9 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F909;DOWNWARD FACING NOTCHED HOOK;So;0;ON;;;;;N;;;;;
 1F90A;DOWNWARD FACING HOOK WITH DOT;So;0;ON;;;;;N;;;;;
 1F90B;DOWNWARD FACING NOTCHED HOOK WITH DOT;So;0;ON;;;;;N;;;;;
+1F90D;WHITE HEART;So;0;ON;;;;;N;;;;;
+1F90E;BROWN HEART;So;0;ON;;;;;N;;;;;
+1F90F;PINCHING HAND;So;0;ON;;;;;N;;;;;
 1F910;ZIPPER-MOUTH FACE;So;0;ON;;;;;N;;;;;
 1F911;MONEY-MOUTH FACE;So;0;ON;;;;;N;;;;;
 1F912;FACE WITH THERMOMETER;So;0;ON;;;;;N;;;;;
@@ -31229,6 +31649,7 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F93C;WRESTLERS;So;0;ON;;;;;N;;;;;
 1F93D;WATER POLO;So;0;ON;;;;;N;;;;;
 1F93E;HANDBALL;So;0;ON;;;;;N;;;;;
+1F93F;DIVING MASK;So;0;ON;;;;;N;;;;;
 1F940;WILTED FLOWER;So;0;ON;;;;;N;;;;;
 1F941;DRUM WITH DRUMSTICKS;So;0;ON;;;;;N;;;;;
 1F942;CLINKING GLASSES;So;0;ON;;;;;N;;;;;
@@ -31278,11 +31699,13 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F96E;MOON CAKE;So;0;ON;;;;;N;;;;;
 1F96F;BAGEL;So;0;ON;;;;;N;;;;;
 1F970;SMILING FACE WITH SMILING EYES AND THREE HEARTS;So;0;ON;;;;;N;;;;;
+1F971;YAWNING FACE;So;0;ON;;;;;N;;;;;
 1F973;FACE WITH PARTY HORN AND PARTY HAT;So;0;ON;;;;;N;;;;;
 1F974;FACE WITH UNEVEN EYES AND WAVY MOUTH;So;0;ON;;;;;N;;;;;
 1F975;OVERHEATED FACE;So;0;ON;;;;;N;;;;;
 1F976;FREEZING FACE;So;0;ON;;;;;N;;;;;
 1F97A;FACE WITH PLEADING EYES;So;0;ON;;;;;N;;;;;
+1F97B;SARI;So;0;ON;;;;;N;;;;;
 1F97C;LAB COAT;So;0;ON;;;;;N;;;;;
 1F97D;GOGGLES;So;0;ON;;;;;N;;;;;
 1F97E;HIKING BOOT;So;0;ON;;;;;N;;;;;
@@ -31322,6 +31745,14 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F9A0;MICROBE;So;0;ON;;;;;N;;;;;
 1F9A1;BADGER;So;0;ON;;;;;N;;;;;
 1F9A2;SWAN;So;0;ON;;;;;N;;;;;
+1F9A5;SLOTH;So;0;ON;;;;;N;;;;;
+1F9A6;OTTER;So;0;ON;;;;;N;;;;;
+1F9A7;ORANGUTAN;So;0;ON;;;;;N;;;;;
+1F9A8;SKUNK;So;0;ON;;;;;N;;;;;
+1F9A9;FLAMINGO;So;0;ON;;;;;N;;;;;
+1F9AA;OYSTER;So;0;ON;;;;;N;;;;;
+1F9AE;GUIDE DOG;So;0;ON;;;;;N;;;;;
+1F9AF;PROBING CANE;So;0;ON;;;;;N;;;;;
 1F9B0;EMOJI COMPONENT RED HAIR;So;0;ON;;;;;N;;;;;
 1F9B1;EMOJI COMPONENT CURLY HAIR;So;0;ON;;;;;N;;;;;
 1F9B2;EMOJI COMPONENT BALD;So;0;ON;;;;;N;;;;;
@@ -31332,9 +31763,26 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F9B7;TOOTH;So;0;ON;;;;;N;;;;;
 1F9B8;SUPERHERO;So;0;ON;;;;;N;;;;;
 1F9B9;SUPERVILLAIN;So;0;ON;;;;;N;;;;;
+1F9BA;SAFETY VEST;So;0;ON;;;;;N;;;;;
+1F9BB;EAR WITH HEARING AID;So;0;ON;;;;;N;;;;;
+1F9BC;MOTORIZED WHEELCHAIR;So;0;ON;;;;;N;;;;;
+1F9BD;MANUAL WHEELCHAIR;So;0;ON;;;;;N;;;;;
+1F9BE;MECHANICAL ARM;So;0;ON;;;;;N;;;;;
+1F9BF;MECHANICAL LEG;So;0;ON;;;;;N;;;;;
 1F9C0;CHEESE WEDGE;So;0;ON;;;;;N;;;;;
 1F9C1;CUPCAKE;So;0;ON;;;;;N;;;;;
 1F9C2;SALT SHAKER;So;0;ON;;;;;N;;;;;
+1F9C3;BEVERAGE BOX;So;0;ON;;;;;N;;;;;
+1F9C4;GARLIC;So;0;ON;;;;;N;;;;;
+1F9C5;ONION;So;0;ON;;;;;N;;;;;
+1F9C6;FALAFEL;So;0;ON;;;;;N;;;;;
+1F9C7;WAFFLE;So;0;ON;;;;;N;;;;;
+1F9C8;BUTTER;So;0;ON;;;;;N;;;;;
+1F9C9;MATE DRINK;So;0;ON;;;;;N;;;;;
+1F9CA;ICE CUBE;So;0;ON;;;;;N;;;;;
+1F9CD;STANDING PERSON;So;0;ON;;;;;N;;;;;
+1F9CE;KNEELING PERSON;So;0;ON;;;;;N;;;;;
+1F9CF;DEAF PERSON;So;0;ON;;;;;N;;;;;
 1F9D0;FACE WITH MONOCLE;So;0;ON;;;;;N;;;;;
 1F9D1;ADULT;So;0;ON;;;;;N;;;;;
 1F9D2;CHILD;So;0;ON;;;;;N;;;;;
@@ -31383,6 +31831,90 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1F9FD;SPONGE;So;0;ON;;;;;N;;;;;
 1F9FE;RECEIPT;So;0;ON;;;;;N;;;;;
 1F9FF;NAZAR AMULET;So;0;ON;;;;;N;;;;;
+1FA00;NEUTRAL CHESS KING;So;0;ON;;;;;N;;;;;
+1FA01;NEUTRAL CHESS QUEEN;So;0;ON;;;;;N;;;;;
+1FA02;NEUTRAL CHESS ROOK;So;0;ON;;;;;N;;;;;
+1FA03;NEUTRAL CHESS BISHOP;So;0;ON;;;;;N;;;;;
+1FA04;NEUTRAL CHESS KNIGHT;So;0;ON;;;;;N;;;;;
+1FA05;NEUTRAL CHESS PAWN;So;0;ON;;;;;N;;;;;
+1FA06;WHITE CHESS KNIGHT ROTATED FORTY-FIVE DEGREES;So;0;ON;;;;;N;;;;;
+1FA07;BLACK CHESS KNIGHT ROTATED FORTY-FIVE DEGREES;So;0;ON;;;;;N;;;;;
+1FA08;NEUTRAL CHESS KNIGHT ROTATED FORTY-FIVE DEGREES;So;0;ON;;;;;N;;;;;
+1FA09;WHITE CHESS KING ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA0A;WHITE CHESS QUEEN ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA0B;WHITE CHESS ROOK ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA0C;WHITE CHESS BISHOP ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA0D;WHITE CHESS KNIGHT ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA0E;WHITE CHESS PAWN ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA0F;BLACK CHESS KING ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA10;BLACK CHESS QUEEN ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA11;BLACK CHESS ROOK ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA12;BLACK CHESS BISHOP ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA13;BLACK CHESS KNIGHT ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA14;BLACK CHESS PAWN ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA15;NEUTRAL CHESS KING ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA16;NEUTRAL CHESS QUEEN ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA17;NEUTRAL CHESS ROOK ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA18;NEUTRAL CHESS BISHOP ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA19;NEUTRAL CHESS KNIGHT ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA1A;NEUTRAL CHESS PAWN ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA1B;WHITE CHESS KNIGHT ROTATED ONE HUNDRED THIRTY-FIVE 
DEGREES;So;0;ON;;;;;N;;;;;
+1FA1C;BLACK CHESS KNIGHT ROTATED ONE HUNDRED THIRTY-FIVE 
DEGREES;So;0;ON;;;;;N;;;;;
+1FA1D;NEUTRAL CHESS KNIGHT ROTATED ONE HUNDRED THIRTY-FIVE 
DEGREES;So;0;ON;;;;;N;;;;;
+1FA1E;WHITE CHESS TURNED KING;So;0;ON;;;;;N;;;;;
+1FA1F;WHITE CHESS TURNED QUEEN;So;0;ON;;;;;N;;;;;
+1FA20;WHITE CHESS TURNED ROOK;So;0;ON;;;;;N;;;;;
+1FA21;WHITE CHESS TURNED BISHOP;So;0;ON;;;;;N;;;;;
+1FA22;WHITE CHESS TURNED KNIGHT;So;0;ON;;;;;N;;;;;
+1FA23;WHITE CHESS TURNED PAWN;So;0;ON;;;;;N;;;;;
+1FA24;BLACK CHESS TURNED KING;So;0;ON;;;;;N;;;;;
+1FA25;BLACK CHESS TURNED QUEEN;So;0;ON;;;;;N;;;;;
+1FA26;BLACK CHESS TURNED ROOK;So;0;ON;;;;;N;;;;;
+1FA27;BLACK CHESS TURNED BISHOP;So;0;ON;;;;;N;;;;;
+1FA28;BLACK CHESS TURNED KNIGHT;So;0;ON;;;;;N;;;;;
+1FA29;BLACK CHESS TURNED PAWN;So;0;ON;;;;;N;;;;;
+1FA2A;NEUTRAL CHESS TURNED KING;So;0;ON;;;;;N;;;;;
+1FA2B;NEUTRAL CHESS TURNED QUEEN;So;0;ON;;;;;N;;;;;
+1FA2C;NEUTRAL CHESS TURNED ROOK;So;0;ON;;;;;N;;;;;
+1FA2D;NEUTRAL CHESS TURNED BISHOP;So;0;ON;;;;;N;;;;;
+1FA2E;NEUTRAL CHESS TURNED KNIGHT;So;0;ON;;;;;N;;;;;
+1FA2F;NEUTRAL CHESS TURNED PAWN;So;0;ON;;;;;N;;;;;
+1FA30;WHITE CHESS KNIGHT ROTATED TWO HUNDRED TWENTY-FIVE 
DEGREES;So;0;ON;;;;;N;;;;;
+1FA31;BLACK CHESS KNIGHT ROTATED TWO HUNDRED TWENTY-FIVE 
DEGREES;So;0;ON;;;;;N;;;;;
+1FA32;NEUTRAL CHESS KNIGHT ROTATED TWO HUNDRED TWENTY-FIVE 
DEGREES;So;0;ON;;;;;N;;;;;
+1FA33;WHITE CHESS KING ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA34;WHITE CHESS QUEEN ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA35;WHITE CHESS ROOK ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA36;WHITE CHESS BISHOP ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA37;WHITE CHESS KNIGHT ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA38;WHITE CHESS PAWN ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA39;BLACK CHESS KING ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA3A;BLACK CHESS QUEEN ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA3B;BLACK CHESS ROOK ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA3C;BLACK CHESS BISHOP ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA3D;BLACK CHESS KNIGHT ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA3E;BLACK CHESS PAWN ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA3F;NEUTRAL CHESS KING ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA40;NEUTRAL CHESS QUEEN ROTATED TWO HUNDRED SEVENTY 
DEGREES;So;0;ON;;;;;N;;;;;
+1FA41;NEUTRAL CHESS ROOK ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA42;NEUTRAL CHESS BISHOP ROTATED TWO HUNDRED SEVENTY 
DEGREES;So;0;ON;;;;;N;;;;;
+1FA43;NEUTRAL CHESS KNIGHT ROTATED TWO HUNDRED SEVENTY 
DEGREES;So;0;ON;;;;;N;;;;;
+1FA44;NEUTRAL CHESS PAWN ROTATED TWO HUNDRED SEVENTY DEGREES;So;0;ON;;;;;N;;;;;
+1FA45;WHITE CHESS KNIGHT ROTATED THREE HUNDRED FIFTEEN 
DEGREES;So;0;ON;;;;;N;;;;;
+1FA46;BLACK CHESS KNIGHT ROTATED THREE HUNDRED FIFTEEN 
DEGREES;So;0;ON;;;;;N;;;;;
+1FA47;NEUTRAL CHESS KNIGHT ROTATED THREE HUNDRED FIFTEEN 
DEGREES;So;0;ON;;;;;N;;;;;
+1FA48;WHITE CHESS EQUIHOPPER;So;0;ON;;;;;N;;;;;
+1FA49;BLACK CHESS EQUIHOPPER;So;0;ON;;;;;N;;;;;
+1FA4A;NEUTRAL CHESS EQUIHOPPER;So;0;ON;;;;;N;;;;;
+1FA4B;WHITE CHESS EQUIHOPPER ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA4C;BLACK CHESS EQUIHOPPER ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA4D;NEUTRAL CHESS EQUIHOPPER ROTATED NINETY DEGREES;So;0;ON;;;;;N;;;;;
+1FA4E;WHITE CHESS KNIGHT-QUEEN;So;0;ON;;;;;N;;;;;
+1FA4F;WHITE CHESS KNIGHT-ROOK;So;0;ON;;;;;N;;;;;
+1FA50;WHITE CHESS KNIGHT-BISHOP;So;0;ON;;;;;N;;;;;
+1FA51;BLACK CHESS KNIGHT-QUEEN;So;0;ON;;;;;N;;;;;
+1FA52;BLACK CHESS KNIGHT-ROOK;So;0;ON;;;;;N;;;;;
+1FA53;BLACK CHESS KNIGHT-BISHOP;So;0;ON;;;;;N;;;;;
 1FA60;XIANGQI RED GENERAL;So;0;ON;;;;;N;;;;;
 1FA61;XIANGQI RED MANDARIN;So;0;ON;;;;;N;;;;;
 1FA62;XIANGQI RED ELEPHANT;So;0;ON;;;;;N;;;;;
@@ -31397,6 +31929,22 @@ FFFD;REPLACEMENT CHARACTER;So;0;ON;;;;;N;;;;;
 1FA6B;XIANGQI BLACK CHARIOT;So;0;ON;;;;;N;;;;;
 1FA6C;XIANGQI BLACK CANNON;So;0;ON;;;;;N;;;;;
 1FA6D;XIANGQI BLACK SOLDIER;So;0;ON;;;;;N;;;;;
+1FA70;BALLET SHOES;So;0;ON;;;;;N;;;;;
+1FA71;ONE-PIECE SWIMSUIT;So;0;ON;;;;;N;;;;;
+1FA72;BRIEFS;So;0;ON;;;;;N;;;;;
+1FA73;SHORTS;So;0;ON;;;;;N;;;;;
+1FA78;DROP OF BLOOD;So;0;ON;;;;;N;;;;;
+1FA79;ADHESIVE BANDAGE;So;0;ON;;;;;N;;;;;
+1FA7A;STETHOSCOPE;So;0;ON;;;;;N;;;;;
+1FA80;YO-YO;So;0;ON;;;;;N;;;;;
+1FA81;KITE;So;0;ON;;;;;N;;;;;
+1FA82;PARACHUTE;So;0;ON;;;;;N;;;;;
+1FA90;RINGED PLANET;So;0;ON;;;;;N;;;;;
+1FA91;CHAIR;So;0;ON;;;;;N;;;;;
+1FA92;RAZOR;So;0;ON;;;;;N;;;;;
+1FA93;AXE;So;0;ON;;;;;N;;;;;
+1FA94;DIYA LAMP;So;0;ON;;;;;N;;;;;
+1FA95;BANJO;So;0;ON;;;;;N;;;;;
 20000;<CJK Ideograph Extension B, First>;Lo;0;L;;;;;N;;;;;
 2A6D6;<CJK Ideograph Extension B, Last>;Lo;0;L;;;;;N;;;;;
 2A700;<CJK Ideograph Extension C, First>;Lo;0;L;;;;;N;;;;;
diff --git a/admin/unidata/blocks.awk b/admin/unidata/blocks.awk
index ea62d87..a7ee134 100755
--- a/admin/unidata/blocks.awk
+++ b/admin/unidata/blocks.awk
@@ -1,6 +1,6 @@
 #!/usr/bin/awk -f
 
-## Copyright (C) 2015-2018 Free Software Foundation, Inc.
+## Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <address@hidden>
 
@@ -115,14 +115,15 @@ function name2alias(name   , w, w2) {
     else if (name ~ /duployan|shorthand/) return "duployan-shorthand"
     else if (name ~ /sutton signwriting/) return "sutton-sign-writing"
 
-    sub(/ (extended|extensions|supplement).*/, "", name)
+    sub(/^small /, "", name)
+    sub(/ (extended|extensions*|supplement).*/, "", name)
     sub(/numbers/, "number", name)
     sub(/numerals/, "numeral", name)
     sub(/symbols/, "symbol", name)
     sub(/forms$/, "form", name)
     sub(/tiles$/, "tile", name)
     sub(/^new /, "", name)
-    sub(/ (characters|hieroglyphs|cursive)$/, "", name)
+    sub(/ (characters|hieroglyphs|cursive|hieroglyph format controls)$/, "", 
name)
     gsub(/ /, "-", name)
 
     return name
diff --git a/admin/unidata/copyright.html b/admin/unidata/copyright.html
index 0df59c1..2f5c88d 100644
--- a/admin/unidata/copyright.html
+++ b/admin/unidata/copyright.html
@@ -36,7 +36,7 @@ pre {
  <td class="icon"><a href="http://www.unicode.org/";><img border="0"
           src="http://www.unicode.org/webscripts/logo60s2.gif"; align="middle"
           alt="[Unicode]" width="34" height="33"></a>&nbsp;&nbsp;<a class="bar"
-          href="http://www.unicode.org/copyright.html";><font size="3">Terms of
+          href="https://www.unicode.org/copyright.html";><font size="3">Terms of
           Use</font></a></td>
           <td class="bar"><a href="http://www.unicode.org"; class="bar">Home</a>
           | <a href="http://www.unicode.org/sitemap/"; class="bar">Site Map</a> 
|
@@ -59,46 +59,48 @@ pre {
           <td valign="top" class="navColCell"><a href="#1">Unicode 
Copyright</a></td>
         </tr>
         <tr>
-          <td valign="top" class="navColCell"><a href="#2">Restricted Rights
-          Legend</a></td>
+          <td valign="top" class="navColCell"><a href="#6">Definitions</a></td>
         </tr>
         <tr>
-          <td valign="top" class="navColCell"><a href="#3">Warranties &amp;
-          Disclaimers</a></td>
+          <td valign="top" class="navColCell"><a href="#8">Terms of 
Use</a></td>
+        </tr>
+        <tr>
+          <td valign="top" class="navColCell"><a href="#2">Restricted Rights 
Legend</a></td>
+        </tr>
+        <tr>
+          <td valign="top" class="navColCell"><a href="#3">Warranties &amp; 
Disclaimers</a></td>
         </tr>
         <tr>
           <td valign="top" class="navColCell"><a href="#4">Waiver of 
Damages</a></td>
         </tr>
         <tr>
-          <td valign="top" class="navColCell"><a href="#5">Trademarks & 
Logos</a></td>
+          <td valign="top" class="navColCell"><a href="#5">Trademarks &amp; 
Logos</a></td>
         </tr>
         <tr>
           <td valign="top" class="navColCell"><a 
href="#7">Miscellaneous</a></td>
         </tr>
         <tr>
-          <td valign="top" class="navColCell"><a href="#License">Data Files and
-          Software License Agreement (Exhibit 1)</a></td>
+          <td class="navColTitle">Unicode License</td>
         </tr>
         <tr>
-          <td valign="top" class="navColCell">&nbsp;</td>
+          <td valign="top" class="navColCell">
+        <a href="https://www.unicode.org/license.html";>Unicode Data Files and 
Software License</a></td>
         </tr>
-      </table>
-      <table class="navColTable" border="0" width="100%" cellspacing="4"
-      cellpadding="0">
         <tr>
           <td class="navColTitle">Related Links</td>
         </tr>
         <tr>
           <td valign="top" class="navColCell">
-        <a href="http://www.unicode.org/policies/logo_policy.html";>Trademark 
Policy</a></td>
+        <a href="https://www.unicode.org/policies/privacy_policy.html";>Privacy 
Policy</a></td>
         </tr>
         <tr>
           <td valign="top" class="navColCell">
-          <a href="http://www.unicode.org/policies/policies.html";>Unicode
-          Policies</a></td>
+        <a href="https://www.unicode.org/policies/logo_policy.html";>Trademark 
Policy</a></td>
         </tr>
         <tr>
-          <td valign="top" class="navColCell"></td>
+          <td valign="top" class="navColCell">
+          <a href="https://www.unicode.org/policies/policies.html";>Unicode
+          Policies</a></td>
         </tr>
       </table>
 
@@ -108,30 +110,41 @@ pre {
       <td>
 
 <blockquote>
-            <h1>Unicode® Terms of Use</h1>
+            <h1>Unicode® Copyright and Terms of Use</h1>
 
             <p>For the general privacy policy governing access to this site, 
see
             the&nbsp;
             <a href="http://www.unicode.org/policies/privacy_policy.html";>
-            Unicode Privacy Policy</a>. For trademark usage, see
-            <a href="http://www.unicode.org/policies/logo_policy.html";>the
-        Unicode® Consortium Name and Trademark Usage Policy</a>.</p>
-
-            <table class="sidebar" align="right" width="50%" id="table1">
-              <tr>
-                <td class="sidebarTitle">Notice to End User: Terms of Use</td>
-              </tr>
-              <tr>
-                <td class="sidebar">Carefully read the following legal 
agreement
-                (&quot;Agreement&quot;). Use or copying of the software and/or 
codes
-                provided with this agreement (The &quot;Software&quot;) 
constitutes your
-                acceptance of these terms. If you have any questions about 
these terms of use, please <a 
href="http://www.unicode.org/contacts.html";>contact the Unicode 
Consortium</a>.</td>
-              </tr>
-            </table>
+            Unicode Privacy Policy</a>.</p>
+
             <ol type="A">
-              <li><u><a name="1"></a>Unicode Copyright.</u>
+              <li><u><a name="1"></a>Unicode Copyright</u>
+              <ol>
+                <li>Copyright © 1991-2019 Unicode, Inc. All rights 
reserved.</li>
+              </ol>
+              </li>
+
+              <li><u><a name="6"></a>Definitions</u>
+<pre>
+Unicode Data Files ("DATA FILES") include all data files under the directories:
+https://www.unicode.org/Public/
+https://www.unicode.org/reports/
+https://www.unicode.org/ivd/data/
+
+Unicode Data Files do not include PDF online code charts under the directory:
+https://www.unicode.org/Public/
+
+Unicode Software ("SOFTWARE") includes any source code published in the 
Unicode Standard
+or any source code or compiled code under the directories:
+https://www.unicode.org/Public/PROGRAMS/
+https://www.unicode.org/Public/cldr/
+https://site.icu-project.org/download/
+</pre>
+              </li>
+
+              <li><u><a name="8"></a>Terms of Use</u>
               <ol>
-                <li>Copyright © 1991-2018 Unicode, Inc. All rights 
reserved.</li>
+
                 <li>Certain documents and files on this website contain a 
legend
                 indicating that &quot;Modification is permitted.&quot; Any 
person is
                 hereby authorized, without fee, to modify such documents and
@@ -141,22 +154,26 @@ pre {
                 reproduce, and distribute all documents and files, subject to 
the Terms and Conditions
                 herein.</li>
                 <li>Further specifications of rights and restrictions 
pertaining
-                to the use of the particular set of data files known as the
-                &quot;Unicode Character Database&quot; can be found in the
-                <a href="#License">License</a>.</li>
+                to the use of the Unicode DATA FILES and SOFTWARE can be found 
in the
+                <a href="https://www.unicode.org/license.html";>Unicode Data 
Files and Software License</a>.</li>
                 <li>Each version of the Unicode Standard has further
                 specifications of rights and restrictions of use. For the book
                 editions (Unicode 5.0 and earlier), these are found on the back
                 of the
-                               <a 
href="http://www.unicode.org/versions/Unicode5.0.0/Title.pdf";>title page</a>.
-                The online code charts carry specific restrictions. All other 
files, including online documentation  of the core specification for Unicode 
6.0 and later, are covered under these  general Terms of Use.</li>
+                               <a 
href="http://www.unicode.org/versions/Unicode5.0.0/Title.pdf";>title 
page</a>.</li>
+                <li>
+                The Unicode PDF <a 
href="https://www.unicode.org/charts/";>online code charts</a> carry specific 
restrictions. Those restrictions are incorporated as the
+                first page of each PDF code chart.</li>
+                <li>All other files, including online documentation of the 
core specification for Unicode 6.0 and later, are covered under these general 
Terms of Use.</li>
                 <li>No license is granted to &quot;mirror&quot; the Unicode 
website where
                 a fee is charged for access to the &quot;mirror&quot; 
site.</li>
                 <li>Modification is not permitted with respect to this 
document.
                 All copies of this document must be verbatim.</li>
               </ol>
               </li>
-              <li><u><a name="2"></a>Restricted Rights Legend</u>. Any 
technical
+              <li><u><a name="2"></a>Restricted Rights Legend</u>
+              <ol>
+                <li>Any technical
               data or software which is licensed to the United States of
               America, its agencies and/or instrumentalities under this
               Agreement is commercial technical data or commercial computer
@@ -169,66 +186,71 @@ pre {
               227-7202, as applicable, use, duplication or disclosure by the
               Government is subject to the restrictions set forth in this
               Agreement.</li>
-              <li><u><a name="3"></a>Warranties and Disclaimers</u>.
+              </ol>
+              </li>
+              <li><u><a name="3"></a>Warranties and Disclaimers</u>
               <ol>
                 <li>This publication and/or website may include technical or
-                typographical errors or other inaccuracies . Changes are
+                typographical errors or other inaccuracies. Changes are
                 periodically added to the information herein; these changes 
will
                 be incorporated in new editions of the publication and/or
-                website. Unicode may make improvements and/or changes in the
+                website. Unicode, Inc. may make improvements and/or changes in 
the
                 product(s) and/or program(s) described in this publication
                 and/or website at any time.</li>
                 <li>If this file has been purchased on magnetic or optical 
media
                 from Unicode, Inc. the sole and exclusive remedy for any claim
                 will be exchange of the defective media within ninety (90) days
                 of original purchase.</li>
-                <li>EXCEPT AS PROVIDED IN SECTION&nbsp;C.2, THIS PUBLICATION 
AND/OR
+                <li>EXCEPT AS PROVIDED IN SECTION&nbsp;E.2, THIS PUBLICATION 
AND/OR
                 SOFTWARE IS PROVIDED &quot;AS IS&quot; WITHOUT WARRANTY OF ANY 
KIND EITHER
                 EXPRESS, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO,
                 ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
-                PURPOSE, OR NON-INFRINGEMENT. UNICODE AND ITS LICENSORS ASSUME
+                PURPOSE, OR NON-INFRINGEMENT. UNICODE, INC. AND ITS LICENSORS 
ASSUME
                 NO RESPONSIBILITY FOR ERRORS OR OMISSIONS IN THIS PUBLICATION
                 AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH ARE REFERENCED BY OR
                 LINKED TO THIS PUBLICATION OR THE UNICODE WEBSITE.</li>
               </ol>
               </li>
-              <li><u><a name="4"></a>Waiver of Damages.</u> In no event shall
-              Unicode or its licensors be liable for any special, incidental,
+              <li><u><a name="4"></a>Waiver of Damages</u>
+              <ol>
+                <li>In no event shall
+              Unicode, Inc. or its licensors be liable for any special, 
incidental,
               indirect or consequential damages of any kind, or any damages
-              whatsoever, whether or not Unicode was advised of the possibility
+              whatsoever, whether or not Unicode, Inc. was advised of the 
possibility
               of the damage, including, without limitation, those resulting 
from
               the following: loss of use, data or profits, in connection with
               the use, modification or distribution of this information or its
               derivatives.</li>
-              <li><u><a name="5"></a>Trademarks &amp; Logos.</u>
+              </ol>
+              </li>
+              <li><u><a name="5"></a>Trademarks &amp; Logos</u>
                 <ol>
                 <li>The Unicode Word Mark and the Unicode Logo are trademarks 
of Unicode, Inc.  “The Unicode Consortium” and “Unicode, Inc.” are trade names 
of Unicode, Inc.  Use of the information and materials found on this website 
indicates your acknowledgement of Unicode, Inc.’s exclusive worldwide rights in 
the Unicode Word Mark, the Unicode Logo, and the Unicode trade names.</li>
 <li><a href="http://www.unicode.org/policies/logo_policy.html";>The Unicode 
Consortium Name and Trademark Usage Policy</a> (“Trademark Policy”) are 
incorporated herein by reference and you agree to abide by the provisions of 
the Trademark Policy, which may be changed from time to time in the sole 
discretion of Unicode, Inc.</li>
-<li>All third party trademarks referenced herein are the property of their 
respective owners.
-</li>
+<li>All third party trademarks referenced herein are the property of their 
respective owners.</li>
               </ol>
               </li>
 
-              <li><u><a name="7"></a>Miscellaneous</u>.
+              <li><u><a name="7"></a>Miscellaneous</u>
               <ol>
-                <li><u>Jurisdiction and Venue</u>. This server is operated from
+                <li><u>Jurisdiction and Venue</u>. This website is operated 
from
                                a location in the State of California, United 
States of America.
-                               Unicode makes no representation that the 
materials are
+                               Unicode, Inc. makes no representation that the 
materials are
                                appropriate for use in other locations. If you 
access this
-                               server from other locations, you are 
responsible for compliance
-                               with local laws. This Agreement, all use of 
this site and any
-                               claims and damages resulting from use of this 
site are governed
+                               website from other locations, you are 
responsible for compliance
+                               with local laws. This Agreement, all use of 
this website and any
+                               claims and damages resulting from use of this 
website are governed
                                solely by the laws of the State of California 
without regard to
                                any principles which would apply the laws of a 
different
                                jurisdiction. The user agrees that any disputes 
regarding this
-                               site shall be resolved solely in the courts 
located in Santa
+                               website shall be resolved solely in the courts 
located in Santa
                                Clara County, California. The user agrees said 
courts have
                                personal jurisdiction and agree to waive any 
right to transfer
-                               the dispute to any other forum. </li>
-                <li><u>Modification by Unicode </u>Unicode shall have the right
-                to modify this Agreement at any time by posting it to this 
site.
+                               the dispute to any other forum.</li>
+                <li><u>Modification by Unicode, Inc.</u> Unicode, Inc. shall 
have the right
+                to modify this Agreement at any time by posting it to this 
website.
                 The user may not assign any part of this Agreement without
-                Unicode’s prior written consent.</li>
+                Unicode, Inc.’s prior written consent.</li>
                 <li><u>Taxes.</u> The user agrees to pay any taxes arising from
                 access to this website or use of the information herein, except
                 for those based on Unicode’s net income.</li>
@@ -240,70 +262,7 @@ pre {
               </ol>
               </li>
             </ol>
-</blockquote>
-            <hr width="95%">
 
-<blockquote>
-<h3 align="center"><a name="Exhibit1">EXHIBIT 1</a><br>
-<a name="License">UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND 
SOFTWARE</a></h3>
-
-<pre>
-Unicode Data Files include all data files under the directories
-http://www.unicode.org/Public/, http://www.unicode.org/reports/,
-http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, 
and
-http://www.unicode.org/utility/trac/browser/.
-
-Unicode Data Files do not include PDF online code charts under the
-directory http://www.unicode.org/Public/.
-
-Software includes any source code published in the Unicode Standard
-or under the directories
-http://www.unicode.org/Public/, http://www.unicode.org/reports/,
-http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, 
and
-http://www.unicode.org/utility/trac/browser/.
-
-NOTICE TO USER: Carefully read the following legal agreement.
-BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S
-DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"),
-YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE
-TERMS AND CONDITIONS OF THIS AGREEMENT.
-IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE
-THE DATA FILES OR SOFTWARE.
-
-COPYRIGHT AND PERMISSION NOTICE
-
-Copyright © 1991-2018 Unicode, Inc. All rights reserved.
-Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of the Unicode data files and any associated documentation
-(the "Data Files") or Unicode software and any associated documentation
-(the "Software") to deal in the Data Files or Software
-without restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, and/or sell copies of
-the Data Files or Software, and to permit persons to whom the Data Files
-or Software are furnished to do so, provided that either
-(a) this copyright and permission notice appear with all copies
-of the Data Files or Software, or
-(b) this copyright and permission notice appear in associated
-Documentation.
-
-THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
-ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT OF THIRD PARTY RIGHTS.
-IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
-NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
-DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THE DATA FILES OR SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale,
-use or other dealings in these Data Files or Software without prior
-written authorization of the copyright holder.
-</pre>
 
 </blockquote>
 
diff --git a/admin/unidata/unidata-gen.el b/admin/unidata/unidata-gen.el
index e520d18..1a3afd3 100644
--- a/admin/unidata/unidata-gen.el
+++ b/admin/unidata/unidata-gen.el
@@ -1,6 +1,6 @@
 ;; unidata-gen.el -- Create files containing character property data.
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -1413,7 +1413,7 @@ Property value is a symbol `o' (Open), `c' (Close), or 
`n' (None)."
         (copyright (with-temp-buffer
                      (insert-file-contents
                       (expand-file-name "copyright.html" unidata-dir))
-                     (re-search-forward "^Copyright .*Unicode, Inc.")
+                     (re-search-forward "Copyright .*Unicode, Inc.")
                      (match-string 0))))
     (or unidata-list (unidata-setup-list unidata-text-file))
     (let* ((basename (file-name-nondirectory file))
diff --git a/admin/unidata/uvs.el b/admin/unidata/uvs.el
index 31840fb..ad2b654 100644
--- a/admin/unidata/uvs.el
+++ b/admin/unidata/uvs.el
@@ -1,6 +1,6 @@
 ;;; uvs.el --- utility for UVS (format 14) cmap subtables in OpenType fonts.
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: YAMAMOTO Mitsuharu <address@hidden>
 
@@ -201,7 +201,8 @@ corresponding number."
           (uvs-alist-from-ivd collection-id
                               sequence-id-to-glyph-func))))
     (set-binary-mode 'stdout t)
-    (princ "/* Automatically generated by uvs.el.  */\n")
+    (princ "/* This file was automatically generated from 
admin/unidata/IVD_Sequences.txt\n")
+    (princ "   by the script admin/unidata/uvs.el  */\n")
     (princ
      (format "static const unsigned char mac_uvs_table_%s_bytes[] =\n  {\n"
             (replace-regexp-in-string "[^_[:alnum:]]" "_"
diff --git a/admin/update-copyright b/admin/update-copyright
index d3ffb47..44cb84d 100755
--- a/admin/update-copyright
+++ b/admin/update-copyright
@@ -7,7 +7,7 @@
 # By default, this script uses the local-time calendar year.
 # Set the UPDATE_COPYRIGHT_YEAR environment variable to override the default.
 
-# Copyright 2013-2018 Free Software Foundation, Inc.
+# Copyright 2013-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/admin/update_autogen b/admin/update_autogen
index f4c2c39..bb831a0 100755
--- a/admin/update_autogen
+++ b/admin/update_autogen
@@ -1,7 +1,7 @@
 #!/usr/bin/env bash
 ### update_autogen - update some auto-generated files in the Emacs tree
 
-## Copyright (C) 2011-2018 Free Software Foundation, Inc.
+## Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <address@hidden>
 
diff --git a/admin/upload-manuals b/admin/upload-manuals
index 1aa7d8b..08b47d7 100755
--- a/admin/upload-manuals
+++ b/admin/upload-manuals
@@ -2,7 +2,7 @@
 
 ### upload-manuals - upload the Emacs manuals to the gnu.org website
 
-## Copyright 2018 Free Software Foundation, Inc.
+## Copyright 2018-2019 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <address@hidden>
 
diff --git a/autogen.sh b/autogen.sh
index 2d52f9e..40d0c37 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 ### autogen.sh - tool to help build Emacs from a repository checkout
 
-## Copyright (C) 2011-2018 Free Software Foundation, Inc.
+## Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <address@hidden>
 ## Maintainer: address@hidden
diff --git a/build-aux/config.guess b/build-aux/config.guess
index b33c9e8..79d1317 100755
--- a/build-aux/config.guess
+++ b/build-aux/config.guess
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Attempt to guess a canonical system name.
-#   Copyright 1992-2018 Free Software Foundation, Inc.
+#   Copyright 1992-2019 Free Software Foundation, Inc.
 
-timestamp='2018-08-29'
+timestamp='2019-03-04'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -50,7 +50,7 @@ version="\
 GNU config.guess ($timestamp)
 
 Originally written by Per Bothner.
-Copyright 1992-2018 Free Software Foundation, Inc.
+Copyright 1992-2019 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -96,8 +96,7 @@ fi
 
 tmp=
 # shellcheck disable=SC2172
-trap 'test -z "$tmp" || rm -fr "$tmp"' 1 2 13 15
-trap 'exitcode=$?; test -z "$tmp" || rm -fr "$tmp"; exit $exitcode' 0
+trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15
 
 set_cc_for_build() {
     : "${TMPDIR=/tmp}"
@@ -392,15 +391,20 @@ case 
"$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in
        echo i386-pc-auroraux"$UNAME_RELEASE"
        exit ;;
     i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
-       UNAME_REL="`echo "$UNAME_RELEASE" | sed -e 's/[^.]*//'`"
-       case `isainfo -b` in
-           32)
-               echo i386-pc-solaris2"$UNAME_REL"
-               ;;
-           64)
-               echo x86_64-pc-solaris2"$UNAME_REL"
-               ;;
-       esac
+       set_cc_for_build
+       SUN_ARCH=i386
+       # If there is a compiler, see if it is configured for 64-bit objects.
+       # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+       # This test works for both compilers.
+       if [ "$CC_FOR_BUILD" != no_compiler_found ]; then
+           if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+               (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \
+               grep IS_64BIT_ARCH >/dev/null
+           then
+               SUN_ARCH=x86_64
+           fi
+       fi
+       echo "$SUN_ARCH"-pc-solaris2"`echo "$UNAME_RELEASE"|sed -e 's/[^.]*//'`"
        exit ;;
     sun4*:SunOS:6*:*)
        # According to config.sub, this is the proper way to canonicalize
@@ -890,7 +894,7 @@ EOF
        echo "$UNAME_MACHINE"-pc-uwin
        exit ;;
     amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
-       echo x86_64-unknown-cygwin
+       echo x86_64-pc-cygwin
        exit ;;
     prep*:SunOS:5.*:*)
        echo powerpcle-unknown-solaris2"`echo "$UNAME_RELEASE"|sed -e 
's/[^.]*//'`"
@@ -981,22 +985,50 @@ EOF
        exit ;;
     mips:Linux:*:* | mips64:Linux:*:*)
        set_cc_for_build
+       IS_GLIBC=0
+       test x"${LIBC}" = xgnu && IS_GLIBC=1
        sed 's/^        //' << EOF > "$dummy.c"
        #undef CPU
-       #undef ${UNAME_MACHINE}
-       #undef ${UNAME_MACHINE}el
+       #undef mips
+       #undef mipsel
+       #undef mips64
+       #undef mips64el
+       #if ${IS_GLIBC} && defined(_ABI64)
+       LIBCABI=gnuabi64
+       #else
+       #if ${IS_GLIBC} && defined(_ABIN32)
+       LIBCABI=gnuabin32
+       #else
+       LIBCABI=${LIBC}
+       #endif
+       #endif
+
+       #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && 
__mips_isa_rev>=6
+       CPU=mipsisa64r6
+       #else
+       #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && 
__mips_isa_rev>=6
+       CPU=mipsisa32r6
+       #else
+       #if defined(__mips64)
+       CPU=mips64
+       #else
+       CPU=mips
+       #endif
+       #endif
+       #endif
+
        #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || 
defined(MIPSEL)
-       CPU=${UNAME_MACHINE}el
+       MIPS_ENDIAN=el
        #else
        #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || 
defined(MIPSEB)
-       CPU=${UNAME_MACHINE}
+       MIPS_ENDIAN=
        #else
-       CPU=
+       MIPS_ENDIAN=
        #endif
        #endif
 EOF
-       eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU'`"
-       test "x$CPU" != x && { echo "$CPU-unknown-linux-$LIBC"; exit; }
+       eval "`$CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep 
'^CPU\|^MIPS_ENDIAN\|^LIBCABI'`"
+       test "x$CPU" != x && { echo 
"$CPU${MIPS_ENDIAN}-unknown-linux-$LIBCABI"; exit; }
        ;;
     mips64el:Linux:*:*)
        echo "$UNAME_MACHINE"-unknown-linux-"$LIBC"
@@ -1109,7 +1141,7 @@ EOF
            *Pentium)        UNAME_MACHINE=i586 ;;
            *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
        esac
-       echo 
"$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}{$UNAME_VERSION}"
+       echo 
"$UNAME_MACHINE-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}"
        exit ;;
     i*86:*:3.2:*)
        if test -f /usr/options/cb.name; then
@@ -1424,8 +1456,135 @@ EOF
     amd64:Isilon\ OneFS:*:*)
        echo x86_64-unknown-onefs
        exit ;;
+    *:Unleashed:*:*)
+       echo "$UNAME_MACHINE"-unknown-unleashed"$UNAME_RELEASE"
+       exit ;;
 esac
 
+# No uname command or uname output not recognized.
+set_cc_for_build
+cat > "$dummy.c" <<EOF
+#ifdef _SEQUENT_
+#include <sys/types.h>
+#include <sys/utsname.h>
+#endif
+main ()
+{
+#if defined (sony)
+#if defined (MIPSEB)
+  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
+     I don't know....  */
+  printf ("mips-sony-bsd\n"); exit (0);
+#else
+#include <sys/param.h>
+  printf ("m68k-sony-newsos%s\n",
+#ifdef NEWSOS4
+  "4"
+#else
+  ""
+#endif
+  ); exit (0);
+#endif
+#endif
+
+#if defined (NeXT)
+#if !defined (__ARCHITECTURE__)
+#define __ARCHITECTURE__ "m68k"
+#endif
+  int version;
+  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
+  if (version < 4)
+    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
+  else
+    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
+  exit (0);
+#endif
+
+#if defined (MULTIMAX) || defined (n16)
+#if defined (UMAXV)
+  printf ("ns32k-encore-sysv\n"); exit (0);
+#else
+#if defined (CMU)
+  printf ("ns32k-encore-mach\n"); exit (0);
+#else
+  printf ("ns32k-encore-bsd\n"); exit (0);
+#endif
+#endif
+#endif
+
+#if defined (__386BSD__)
+  printf ("i386-pc-bsd\n"); exit (0);
+#endif
+
+#if defined (sequent)
+#if defined (i386)
+  printf ("i386-sequent-dynix\n"); exit (0);
+#endif
+#if defined (ns32000)
+  printf ("ns32k-sequent-dynix\n"); exit (0);
+#endif
+#endif
+
+#if defined (_SEQUENT_)
+  struct utsname un;
+
+  uname(&un);
+  if (strncmp(un.version, "V2", 2) == 0) {
+    printf ("i386-sequent-ptx2\n"); exit (0);
+  }
+  if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
+    printf ("i386-sequent-ptx1\n"); exit (0);
+  }
+  printf ("i386-sequent-ptx\n"); exit (0);
+#endif
+
+#if defined (vax)
+#if !defined (ultrix)
+#include <sys/param.h>
+#if defined (BSD)
+#if BSD == 43
+  printf ("vax-dec-bsd4.3\n"); exit (0);
+#else
+#if BSD == 199006
+  printf ("vax-dec-bsd4.3reno\n"); exit (0);
+#else
+  printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#endif
+#else
+  printf ("vax-dec-bsd\n"); exit (0);
+#endif
+#else
+  printf ("vax-dec-ultrix\n"); exit (0);
+#endif
+#endif
+#if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || 
defined(__ultrix__)
+#if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || 
defined(__MIPS__)
+#include <signal.h>
+#if defined(_SIZE_T_) /* >= ULTRIX4 */
+  printf ("mips-dec-ultrix4\n"); exit (0);
+#else
+#if defined(ULTRIX3) || defined(ultrix3) || defined(SIGLOST)
+  printf ("mips-dec-ultrix3\n"); exit (0);
+#endif
+#endif
+#endif
+#endif
+
+#if defined (alliant) && defined (i860)
+  printf ("i860-alliant-bsd\n"); exit (0);
+#endif
+
+  exit (1);
+}
+EOF
+
+$CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=`$dummy` &&
+       { echo "$SYSTEM_NAME"; exit; }
+
+# Apollos put the system type in the environment.
+test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; }
+
 echo "$0: unable to guess system type" >&2
 
 case "$UNAME_MACHINE:$UNAME_SYSTEM" in
diff --git a/build-aux/config.sub b/build-aux/config.sub
index b51fb8c..3b4c762 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -1,8 +1,8 @@
 #! /bin/sh
 # Configuration validation subroutine script.
-#   Copyright 1992-2018 Free Software Foundation, Inc.
+#   Copyright 1992-2019 Free Software Foundation, Inc.
 
-timestamp='2018-08-29'
+timestamp='2019-01-05'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -67,7 +67,7 @@ Report bugs and patches to <address@hidden>."
 version="\
 GNU config.sub ($timestamp)
 
-Copyright 1992-2018 Free Software Foundation, Inc.
+Copyright 1992-2019 Free Software Foundation, Inc.
 
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -89,7 +89,7 @@ while test $# -gt 0 ; do
     - )        # Use stdin as input.
        break ;;
     -* )
-       echo "$me: invalid option $1$help"
+       echo "$me: invalid option $1$help" >&2
        exit 1 ;;
 
     *local*)
@@ -111,7 +111,8 @@ case $# in
 esac
 
 # Split fields of configuration type
-IFS="-" read -r field1 field2 field3 field4 <<EOF
+# shellcheck disable=SC2162
+IFS="-" read field1 field2 field3 field4 <<EOF
 $1
 EOF
 
@@ -149,7 +150,7 @@ case $1 in
                esac
                ;;
        *-*)
-               # A lone config we happen to match not fitting any patern
+               # A lone config we happen to match not fitting any pattern
                case $field1-$field2 in
                        decstation-3100)
                                basic_machine=mips-dec
@@ -918,7 +919,8 @@ case $basic_machine in
                ;;
 
        *-*)
-               IFS="-" read -r cpu vendor <<EOF
+               # shellcheck disable=SC2162
+               IFS="-" read cpu vendor <<EOF
 $basic_machine
 EOF
                ;;
@@ -950,7 +952,7 @@ unset -v basic_machine
 
 # Decode basic machines in the full and proper CPU-Company form.
 case $cpu-$vendor in
-       # Here we handle the default manufacturer of certain CPU types in 
cannonical form. It is in
+       # Here we handle the default manufacturer of certain CPU types in 
canonical form. It is in
        # some cases the only manufacturer, in others, it is the most popular.
        craynv-unknown)
                vendor=cray
@@ -1101,7 +1103,7 @@ case $cpu-$vendor in
                cpu=`echo "$cpu" | sed 's/^xscale/arm/'`
                ;;
 
-       # Recognize the cannonical CPU Types that limit and/or modify the
+       # Recognize the canonical CPU Types that limit and/or modify the
        # company names they are paired with.
        cr16-*)
                os=${os:-elf}
@@ -1150,7 +1152,7 @@ case $cpu-$vendor in
                ;;
 
        *)
-               # Recognize the cannonical CPU types that are allowed with any
+               # Recognize the canonical CPU types that are allowed with any
                # company name.
                case $cpu in
                        1750a | 580 \
@@ -1161,6 +1163,7 @@ case $cpu-$vendor in
                        | alpha64 | alpha64ev[4-8] | alpha64ev56 | 
alpha64ev6[78] \
                        | alphapca5[67] | alpha64pca5[67] \
                        | am33_2.0 \
+                       | amdgcn \
                        | arc | arceb \
                        | arm  | arm[lb]e | arme[lb] | armv* \
                        | avr | avr32 \
@@ -1182,13 +1185,13 @@ case $cpu-$vendor in
                        | le32 | le64 \
                        | lm32 \
                        | m32c | m32r | m32rle \
-                       | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | 
m68k | v70 | w65 \
-                       | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx 
| picochip \
+                       | m5200 | m68000 | m680[012346]0 | m68360 | m683?2 | 
m68k \
+                       | m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x \
                        | m88110 | m88k | maxq | mb | mcore | mep | metag \
                        | microblaze | microblazeel \
                        | mips | mipsbe | mipseb | mipsel | mipsle \
                        | mips16 \
-                       | mips64 | mips64el \
+                       | mips64 | mips64eb | mips64el \
                        | mips64octeon | mips64octeonel \
                        | mips64orion | mips64orionel \
                        | mips64r5900 | mips64r5900el \
@@ -1215,11 +1218,12 @@ case $cpu-$vendor in
                        | nds32 | nds32le | nds32be \
                        | nfp \
                        | nios | nios2 | nios2eb | nios2el \
-                       | none | np1 | ns16k | ns32k \
+                       | none | np1 | ns16k | ns32k | nvptx \
                        | open8 \
                        | or1k* \
                        | or32 \
                        | orion \
+                       | picochip \
                        | pdp10 | pdp11 | pj | pjl | pn | power \
                        | powerpc | powerpc64 | powerpc64le | powerpcle | 
powerpcspe \
                        | pru \
@@ -1227,7 +1231,8 @@ case $cpu-$vendor in
                        | riscv | riscv32 | riscv64 \
                        | rl78 | romp | rs6000 | rx \
                        | score \
-                       | sh | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | 
she[lb] | sh[lb]e \
+                       | sh | shl \
+                       | sh[1234] | sh[24]a | sh[24]ae[lb] | sh[23]e | she[lb] 
| sh[lb]e \
                        | sh[1234]e[lb] |  sh[12345][lb]e | sh[23]ele | sh64 | 
sh64le \
                        | sparc | sparc64 | sparc64b | sparc64v | sparc86x | 
sparclet \
                        | sparclite \
@@ -1237,10 +1242,10 @@ case $cpu-$vendor in
                        | tic30 | tic4x | tic54x | tic55x | tic6x | tic80 \
                        | tron \
                        | ubicom32 \
-                       | v850 | v850e | v850e1 | v850es | v850e2 | v850e2v3 \
+                       | v70 | v850 | v850e | v850e1 | v850es | v850e2 | 
v850e2v3 \
                        | vax \
                        | visium \
-                       | wasm32 \
+                       | w65 | wasm32 \
                        | we32k \
                        | x86 | x86_64 | xc16x | xgate | xps100 \
                        | xstormy16 | xtensa* \
@@ -1360,7 +1365,7 @@ case $os in
             | powermax* | dnix* | nx6 | nx7 | sei* | dragonfly* \
             | skyos* | haiku* | rdos* | toppers* | drops* | es* \
             | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
-            | midnightbsd*)
+            | midnightbsd* | amdhsa* | unleashed* | emscripten*)
        # Remember, each alternative MUST END IN *, to match a version number.
                ;;
        qnx*)
diff --git a/build-aux/git-hooks/commit-msg b/build-aux/git-hooks/commit-msg
index 1ce4cee..4ed2614 100755
--- a/build-aux/git-hooks/commit-msg
+++ b/build-aux/git-hooks/commit-msg
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Check the format of GNU Emacs change log entries.
 
-# Copyright 2014-2018 Free Software Foundation, Inc.
+# Copyright 2014-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/build-aux/git-hooks/pre-commit b/build-aux/git-hooks/pre-commit
index c0455fb..e29a69f 100755
--- a/build-aux/git-hooks/pre-commit
+++ b/build-aux/git-hooks/pre-commit
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Check file names in git commits for GNU Emacs.
 
-# Copyright 2014-2018 Free Software Foundation, Inc.
+# Copyright 2014-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog
index 1e73f42..deddef2 100755
--- a/build-aux/gitlog-to-changelog
+++ b/build-aux/gitlog-to-changelog
@@ -9,7 +9,7 @@ my $VERSION = '2018-03-07 03:47'; # UTC
 # If you change this file with Emacs, please let the write hook
 # do its job.  Otherwise, update this string manually.
 
-# Copyright (C) 2008-2018 Free Software Foundation, Inc.
+# Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/build-aux/gitlog-to-emacslog b/build-aux/gitlog-to-emacslog
index bdf4536..7cd7c58 100755
--- a/build-aux/gitlog-to-emacslog
+++ b/build-aux/gitlog-to-emacslog
@@ -2,7 +2,7 @@
 
 # Convert git log output to ChangeLog format for GNU Emacs.
 
-# Copyright (C) 2014-2018 Free Software Foundation, Inc.
+# Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 # Author: Paul Eggert
 
diff --git a/build-aux/make-info-dir b/build-aux/make-info-dir
index cf8ffab..2dcac87 100755
--- a/build-aux/make-info-dir
+++ b/build-aux/make-info-dir
@@ -2,7 +2,7 @@
 
 ### make-info-dir - create info/dir, for systems without install-info
 
-## Copyright (C) 2013-2018 Free Software Foundation, Inc.
+## Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ## Author: Glenn Morris <address@hidden>
 ## Maintainer: address@hidden
diff --git a/build-aux/move-if-change b/build-aux/move-if-change
index 5da3eae..9073f1a 100755
--- a/build-aux/move-if-change
+++ b/build-aux/move-if-change
@@ -8,7 +8,7 @@ VERSION='2018-03-07 03:47'; # UTC
 # If you change this file with Emacs, please let the write hook
 # do its job.  Otherwise, update this string manually.
 
-# Copyright (C) 2002-2018 Free Software Foundation, Inc.
+# Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -36,9 +36,10 @@ The variable CMPPROG can be used to specify an alternative 
to 'cmp'.
 
 Report bugs to <address@hidden>."
 
+year=`expr "$VERSION" : '\([^-]*\)'`
 version=`expr "$VERSION" : '\([^ ]*\)'`
 version="move-if-change (gnulib) $version
-Copyright (C) 2011 Free Software Foundation, Inc.
+Copyright $year Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law."
diff --git a/build-aux/msys-to-w32 b/build-aux/msys-to-w32
index ca23302..758d172 100755
--- a/build-aux/msys-to-w32
+++ b/build-aux/msys-to-w32
@@ -2,7 +2,7 @@
 # Convert a MSYS path list to Windows-native format.
 # Status is zero if successful, nonzero otherwise.
 
-# Copyright (C) 2013-2018 Free Software Foundation, Inc.
+# Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/build-aux/update-copyright b/build-aux/update-copyright
index f2fc97e..d80549e 100755
--- a/build-aux/update-copyright
+++ b/build-aux/update-copyright
@@ -5,7 +5,7 @@ eval '(exit $?0)' && eval 'exec perl -wS -0777 -pi "$0" "$@"'
 
 my $VERSION = '2018-03-07.03:47'; # UTC
 
-# Copyright (C) 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 2009-2019 Free Software Foundation, Inc.
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/build-aux/update-subdirs b/build-aux/update-subdirs
index 8bc4f1a..7550995 100755
--- a/build-aux/update-subdirs
+++ b/build-aux/update-subdirs
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Write into $1/subdirs.el a list of subdirs of directory $1.
 
-# Copyright (C) 1994-1995, 1997, 1999, 2001-2018 Free Software
+# Copyright (C) 1994-1995, 1997, 1999, 2001-2019 Free Software
 # Foundation, Inc.
 
 # This file is part of GNU Emacs.
diff --git a/config.bat b/config.bat
index e5b3a08..3f8f73f 100644
--- a/config.bat
+++ b/config.bat
@@ -1,7 +1,7 @@
 @echo off
 rem   ----------------------------------------------------------------------
 rem   Configuration script for MSDOS
-rem   Copyright (C) 1994-1999, 2001-2018 Free Software Foundation, Inc.
+rem   Copyright (C) 1994-1999, 2001-2019 Free Software Foundation, Inc.
 
 rem   This file is part of GNU Emacs.
 
diff --git a/configure.ac b/configure.ac
index 4a80eb4..c93cfbb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ dnl     autoconf
 dnl in the directory containing this script.
 dnl If you changed any AC_DEFINES, also run autoheader.
 dnl
-dnl Copyright (C) 1994-1996, 1999-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 1994-1996, 1999-2019 Free Software Foundation, Inc.
 dnl
 dnl  This file is part of GNU Emacs.
 dnl
@@ -311,6 +311,80 @@ this option's value should be 'yes', 'no', 'alsa', 'oss', 
or 'bsd-ossaudio'.])
   ],
   [with_sound=$with_features])
 
+AC_ARG_WITH([pdumper],
+  AS_HELP_STRING(
+    [--with-pdumper=VALUE],
+    [enable pdumper support unconditionally
+      ('yes', 'no', or 'auto': default 'auto')]),
+    [ case "${withval}" in
+        yes|no|auto) val=$withval ;;
+        *) AC_MSG_ERROR(
+           ['--with-pdumper=$withval' is invalid;
+this option's value should be 'yes' or 'no'.]) ;;
+      esac
+      with_pdumper=$val
+    ],
+    [with_pdumper=auto])
+
+AC_ARG_WITH([unexec],
+  AS_HELP_STRING(
+    [--with-unexec=VALUE],
+    [enable unexec support unconditionally
+      ('yes', 'no', or 'auto': default 'auto')]),
+    [ case "${withval}" in
+        yes|no|auto) val=$withval ;;
+        *) AC_MSG_ERROR(
+           ['--with-unexec=$withval' is invalid;
+this option's value should be 'yes' or 'no'.]) ;;
+      esac
+      with_unexec=$val
+    ],
+    [with_unexec=auto])
+
+AC_ARG_WITH([dumping],[AS_HELP_STRING([--with-dumping=VALUE],
+    [kind of dumping to use for initial Emacs build
+(VALUE one of: pdumper, unexec, none; default pdumper)])],
+    [ case "${withval}" in
+        pdumper|unexec|none) val=$withval ;;
+        *) AC_MSG_ERROR(['--with-dumping=$withval is invalid;
+this option's value should be 'pdumper', 'unexec', or 'none'.])
+        ;;
+      esac
+      with_dumping=$val
+    ],
+    [with_dumping=pdumper])
+
+if test "$with_pdumper" = "auto"; then
+  if test "$with_dumping" = "pdumper"; then
+    with_pdumper=yes
+  else
+    with_pdumper=no
+  fi
+fi
+
+if test "$with_unexec" = "auto"; then
+  if test "$with_dumping" = "unexec"; then
+    with_unexec=yes
+  else
+    with_unexec=no
+  fi
+fi
+
+if test "$with_dumping" = "pdumper" && test "$with_pdumper" = "no"; then
+  AC_MSG_ERROR(['--with-dumping=pdumper' requires pdumper support])
+fi
+
+if test "$with_dumping" = "unexec" && test "$with_unexec" = "no"; then
+  AC_MSG_ERROR(['--with-dumping=unexec' requires unexec support])
+fi
+
+if test "$with_pdumper" = "yes"; then
+    AC_DEFINE(HAVE_PDUMPER, 1, [Define to build with portable dumper support])
+fi
+
+DUMPING=$with_dumping
+AC_SUBST(DUMPING)
+
 dnl FIXME currently it is not the last.
 dnl This should be the last --with option, because --with-x is
 dnl added later on when we find the file name of X, and it's best to
@@ -710,7 +784,9 @@ case "${canonical}" in
     opsys=qnxnto
     test -z "$CC" && CC=qcc
     CFLAGS="$CFLAGS -D__NO_EXT_QNX"
-    LDFLAGS="-N2MB $LDFLAGS"
+    if test "$with_unexec" = yes; then
+      LDFLAGS="-N2MB $LDFLAGS"
+    fi
   ;;
 
   ## Intel 386 machines where we don't care about the manufacturer.
@@ -1215,6 +1291,10 @@ AC_PATH_PROG(GZIP_PROG, gzip)
 test $with_compress_install != yes && test -n "$GZIP_PROG" && \
    GZIP_PROG=" # $GZIP_PROG # (disabled by configure 
--without-compress-install)"
 
+if test "$with_dumping" = "unexec" && test "$opsys" = "nacl"; then
+  AC_MSG_ERROR([nacl is not compatible with --with-dumping=unexec])
+fi
+
 AC_CACHE_CHECK([for 'find' args to delete a file],
   [emacs_cv_find_delete],
   [if touch conftest.tmp && find conftest.tmp -delete 2>/dev/null &&
@@ -1227,25 +1307,21 @@ AC_SUBST([FIND_DELETE])
 
 PAXCTL_dumped=
 PAXCTL_notdumped=
-if test "$CANNOT_DUMP" != yes; then
-  if test $opsys = gnu-linux; then
-    if test "${SETFATTR+set}" != set; then
-      AC_CACHE_CHECK([for setfattr],
-       [emacs_cv_prog_setfattr],
-       [touch conftest.tmp
-        if (setfattr -n user.pax.flags conftest.tmp) >/dev/null 2>&1; then
-          emacs_cv_prog_setfattr=yes
-        else
-          emacs_cv_prog_setfattr=no
-        fi])
-      if test "$emacs_cv_prog_setfattr" = yes; then
-       PAXCTL_notdumped='$(SETFATTR) -n user.pax.flags -v er'
-       SETFATTR=setfattr
-      else
-       SETFATTR=
-      fi
-      rm -f conftest.tmp
-      AC_SUBST([SETFATTR])
+if test $with_unexec = yes && test $opsys = gnu-linux; then
+  if test "${SETFATTR+set}" != set; then
+    AC_CACHE_CHECK([for setfattr],
+      [emacs_cv_prog_setfattr],
+      [touch conftest.tmp
+       if (setfattr -n user.pax.flags conftest.tmp) >/dev/null 2>&1; then
+        emacs_cv_prog_setfattr=yes
+       else
+        emacs_cv_prog_setfattr=no
+       fi])
+    if test "$emacs_cv_prog_setfattr" = yes; then
+      PAXCTL_notdumped='$(SETFATTR) -n user.pax.flags -v er'
+      SETFATTR=setfattr
+    else
+      SETFATTR=
     fi
   fi
   case $opsys,$PAXCTL_notdumped,$emacs_uname_r in
@@ -1275,6 +1351,7 @@ if test "$CANNOT_DUMP" != yes; then
 fi
 AC_SUBST([PAXCTL_dumped])
 AC_SUBST([PAXCTL_notdumped])
+AC_SUBST([SETFATTR])
 
 # Makeinfo on macOS is ancient, check whether there is a more recent
 # version installed by Homebrew.
@@ -1351,7 +1428,7 @@ else
 fi
 
 AC_CACHE_CHECK([for -znocombreloc], [emacs_cv_znocombreloc],
-  [if test "$CANNOT_DUMP" = "yes"; then
+  [if test $with_unexec = no; then
      emacs_cv_znocombreloc='not needed'
    else
      save_LDFLAGS=$LDFLAGS
@@ -1382,23 +1459,16 @@ AC_CACHE_CHECK([whether addresses are sanitized],
      [emacs_cv_sanitize_address=yes],
      [emacs_cv_sanitize_address=no])])
 
-dnl The function dump-emacs will not be defined and temacs will do
-dnl (load "loadup") automatically unless told otherwise.
-test "x$CANNOT_DUMP" = "x" && CANNOT_DUMP=no
-case "$opsys" in
-  nacl) CANNOT_DUMP=yes ;;
-esac
-
-if test "$CANNOT_DUMP" = "yes"; then
-  AC_DEFINE(CANNOT_DUMP, 1, [Define if Emacs cannot be dumped on your system.])
-elif test "$emacs_cv_sanitize_address" = yes; then
-  AC_MSG_WARN([[Addresses are sanitized; suggest CANNOT_DUMP=yes]])
+if test $with_unexec = yes; then
+  AC_DEFINE([HAVE_UNEXEC], 1, [Define if Emacs supports unexec.])
+  if test "$emacs_cv_sanitize_address" = yes; then
+    AC_MSG_WARN([[Addresses are sanitized; suggest --without-unexec]])
+  fi
 fi
 
-AC_SUBST(CANNOT_DUMP)
-
 
-UNEXEC_OBJ=unexelf.o
+UNEXEC_OBJ=
+test $with_unexec = yes &&
 case "$opsys" in
   # MSDOS uses unexcoff.o
   aix4-2)
@@ -1426,11 +1496,13 @@ case "$opsys" in
    # not been tested, so for now this change is for Solaris 10 or newer.
    UNEXEC_OBJ=unexsol.o
    ;;
+  *)
+   UNEXEC_OBJ=unexelf.o
+   ;;
 esac
-test "$CANNOT_DUMP" = "yes" && UNEXEC_OBJ=
 
 LD_SWITCH_SYSTEM=
-case "$opsys" in
+test "$with_unexec" = no || case "$opsys" in
   freebsd|dragonfly)
    ## Let 'ld' find image libs and similar things in /usr/local/lib.
    ## The system compiler, GCC, has apparently been modified to not
@@ -1476,8 +1548,9 @@ case "$opsys" in
    LD_SWITCH_SYSTEM="\$(LD_SWITCH_X_SITE_RPATH) $LD_SWITCH_SYSTEM" ;;
 esac
 
-
 C_SWITCH_MACHINE=
+
+test $with_unexec = yes &&
 case $canonical in
  alpha*)
   AC_CHECK_DECL([__ELF__])
@@ -2236,7 +2309,7 @@ doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
 hybrid_malloc=
 system_malloc=yes
 
-test "$CANNOT_DUMP" = yes ||
+test $with_unexec = yes &&
 case "$opsys" in
   ## darwin ld insists on the use of malloc routines in the System framework.
   darwin | mingw32 | nacl | sol2-10) ;;
@@ -2868,7 +2941,7 @@ fi
 AC_SUBST(LIBSELINUX_LIBS)
 
 HAVE_GNUTLS=no
-if test "${with_gnutls}" = "yes" ; then
+if test "${with_gnutls}" != "no" ; then
   EMACS_CHECK_MODULES([LIBGNUTLS], [gnutls >= 2.12.2],
     [HAVE_GNUTLS=yes], [HAVE_GNUTLS=no])
   if test "${HAVE_GNUTLS}" = "yes"; then
@@ -3241,6 +3314,17 @@ either XPointer or XPointer*.])dnl
   CFLAGS=$late_CFLAGS
 fi
 
+# Check for XRender
+HAVE_XRENDER=no
+if test "${HAVE_X11}" = "yes"; then
+  AC_CHECK_LIB(Xrender, XRenderQueryExtension, HAVE_XRENDER=yes)
+  if test $HAVE_XRENDER = yes; then
+    XRENDER_LIBS="-lXrender"
+    AC_SUBST(XRENDER_LIBS)
+    AC_DEFINE([HAVE_XRENDER], 1, [Define to 1 if XRender is available.])
+  fi
+fi
+
 ### Start of font-backend (under any platform) section.
 # (nothing here yet -- this is a placeholder)
 ### End of font-backend (under any platform) section.
@@ -3263,15 +3347,12 @@ if test "${HAVE_X11}" = "yes"; then
       EMACS_CHECK_MODULES([XFT], [xft >= 0.13.0], [], [HAVE_XFT=no])
       ## Because xterm.c uses XRenderQueryExtension when XFT is
       ## enabled, we also need to link to -lXrender.
-      HAVE_XRENDER=no
-      AC_CHECK_LIB(Xrender, XRenderQueryExtension, HAVE_XRENDER=yes)
       if test "$HAVE_XFT" != no && test "$HAVE_XRENDER" != no; then
        OLD_CPPFLAGS="$CPPFLAGS"
        OLD_CFLAGS="$CFLAGS"
        OLD_LIBS="$LIBS"
        CPPFLAGS="$CPPFLAGS $XFT_CFLAGS"
        CFLAGS="$CFLAGS $XFT_CFLAGS"
-       XFT_LIBS="-lXrender $XFT_LIBS"
        LIBS="$XFT_LIBS $LIBS"
        AC_CHECK_HEADER(X11/Xft/Xft.h,
          AC_CHECK_LIB(Xft, XftFontOpen, HAVE_XFT=yes, , $XFT_LIBS) , ,
@@ -3431,7 +3512,10 @@ fi
 
 if test "${HAVE_X11}" = "yes"; then
   dnl Avoid Xpm on AIX unless requested, as it crashes; see Bug#17598.
-  test "$opsys$with_xpm_set" = aix4-2 && with_xpm=no
+  case $opsys,$with_xpm_set,$with_xpm in
+    aix4-2,set,yes) ;;
+    aix4-2,*) with_xpm=no;;
+  esac
 
   if test "${with_xpm}" != "no"; then
     AC_CHECK_HEADER(X11/xpm.h,
@@ -3608,8 +3692,10 @@ AC_SUBST(MODULES_SUFFIX)
 AC_CONFIG_FILES([src/emacs-module.h])
 AC_SUBST_FILE([module_env_snippet_25])
 AC_SUBST_FILE([module_env_snippet_26])
+AC_SUBST_FILE([module_env_snippet_27])
 module_env_snippet_25="$srcdir/src/module-env-25.h"
 module_env_snippet_26="$srcdir/src/module-env-26.h"
+module_env_snippet_27="$srcdir/src/module-env-27.h"
 
 ### Use -lpng if available, unless '--with-png=no'.
 HAVE_PNG=no
@@ -3747,28 +3833,46 @@ AC_SUBST(LIBGIF)
 
 dnl Check for required libraries.
 MISSING=
-WITH_NO=
+WITH_IFAVAILABLE=
 if test "${HAVE_X11}" = "yes"; then
-  test "${with_xpm}" != "no" && test "${HAVE_XPM}" != "yes" &&
-    MISSING="libXpm" && WITH_NO="--with-xpm=no"
-  test "${with_jpeg}" != "no" && test "${HAVE_JPEG}" != "yes" &&
-    MISSING="$MISSING libjpeg" && WITH_NO="$WITH_NO --with-jpeg=no"
-  test "${with_png}" != "no" && test "${HAVE_PNG}" != "yes" &&
-    MISSING="$MISSING libpng" && WITH_NO="$WITH_NO --with-png=no"
-  test "${with_gif}" != "no" && test "${HAVE_GIF}" != "yes" &&
-    MISSING="$MISSING libgif/libungif" && WITH_NO="$WITH_NO --with-gif=no"
-  test "${with_tiff}" != "no" && test "${HAVE_TIFF}" != "yes" &&
-    MISSING="$MISSING libtiff" && WITH_NO="$WITH_NO --with-tiff=no"
-fi
-test "${with_gnutls}" != "no" && test "${HAVE_GNUTLS}" != "yes" &&
-  MISSING="$MISSING gnutls" && WITH_NO="$WITH_NO --with-gnutls=no"
+  case $with_xpm,$HAVE_XPM in
+    no,* | ifavailable,* | *,yes) ;;
+    *) MISSING="libXpm"
+       WITH_IFAVAILABLE="--with-xpm=ifavailable";;
+  esac
+  case $with_jpeg,$HAVE_JPEG in
+    no,* | ifavailable,* | *,yes) ;;
+    *) MISSING="$MISSING libjpeg"
+       WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-jpeg=ifavailable";;
+  esac
+  case $with_png,$HAVE_PNG in
+    no,* | ifavailable,* | *,yes) ;;
+    *) MISSING="$MISSING libpng"
+       WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-png=ifavailable";;
+  esac
+  case $with_gif,$HAVE_GIF in
+    no,* | ifavailable,* | *,yes) ;;
+    *) MISSING="$MISSING libgif/libungif"
+       WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-gif=ifavailable";;
+  esac
+  case $with_tiff,$HAVE_TIFF in
+    no,* | ifavailable,* | *,yes) ;;
+    *) MISSING="$MISSING libtiff"
+       WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-tiff=ifavailable";;
+  esac
+fi
+case $with_gnutls,$HAVE_GNUTLS in
+  no,* | ifavailable,* | *,yes) ;;
+  *) MISSING="$MISSING gnutls"
+     WITH_IFAVAILABLE="$WITH_IFAVAILABLE --with-gnutls=ifavailable";;
+esac
 if test "X${MISSING}" != X; then
   AC_MSG_ERROR([The following required libraries were not found:
     $MISSING
 Maybe some development libraries/packages are missing?
-If you don't want to link with them give
-    $WITH_NO
-as options to configure])
+To build anyway, give:
+    $WITH_IFAVAILABLE
+as options to configure.])
 fi
 
 ### Use -lgpm if available, unless '--with-gpm=no'.
@@ -4045,7 +4149,7 @@ getrusage get_current_dir_name \
 lrand48 random rint trunc \
 select getpagesize setlocale newlocale \
 getrlimit setrlimit shutdown \
-pthread_sigmask strsignal setitimer \
+pthread_sigmask strsignal setitimer timer_getoverrun \
 sendto recvfrom getsockname getifaddrs freeifaddrs \
 gai_strerror sync \
 getpwent endpwent getgrent endgrent \
@@ -4056,6 +4160,9 @@ dnl No need to check for posix_memalign if aligned_alloc 
works.
 AC_CHECK_FUNCS([aligned_alloc posix_memalign], [break])
 AC_CHECK_DECLS([aligned_alloc], [], [], [[#include <stdlib.h>]])
 
+# Dump loading
+AC_CHECK_FUNCS([posix_madvise])
+
 dnl Cannot use AC_CHECK_FUNCS
 AC_CACHE_CHECK([for __builtin_frame_address],
   [emacs_cv_func___builtin_frame_address],
@@ -4111,7 +4218,8 @@ AC_CACHE_CHECK([for library containing tputs], 
[emacs_cv_tputs_lib],
   emacs_cv_tputs_lib='none required'
 else
   # curses precedes termcap because of AIX (Bug#9736#35) and OpenIndiana.
-  for tputs_library in '' tinfo ncurses terminfo curses termcap; do
+  tputs_libraries='tinfo ncurses terminfo curses termcap tinfow ncursesw'
+  for tputs_library in '' $tputs_libraries; do
     OLIBS=$LIBS
     if test -z "$tputs_library"; then
       emacs_cv_tputs_lib='none required'
@@ -4370,20 +4478,6 @@ AC_CHECK_MEMBERS([struct unipair.unicode], [], [], 
[[#include <linux/kd.h>]])
 
 AC_CHECK_FUNCS_ONCE([sbrk])
 
-ok_so_far=yes
-AC_CHECK_FUNC(socket, , ok_so_far=no)
-if test $ok_so_far = yes; then
-  AC_CHECK_HEADER(netinet/in.h, , ok_so_far=no)
-fi
-if test $ok_so_far = yes; then
-  AC_CHECK_HEADER(arpa/inet.h, , ok_so_far=no)
-fi
-if test $ok_so_far = yes; then
-dnl Fixme: Not used.  Should this be HAVE_SOCKETS?
-  AC_DEFINE(HAVE_INET_SOCKETS, 1,
-           [Define to 1 if you have inet sockets.])
-fi
-
 AC_FUNC_FORK
 
 AC_CHECK_FUNCS(snprintf)
@@ -4421,15 +4515,27 @@ fi
 AC_SUBST(XGSELOBJ)
 
 dnl Adapted from Haible's version.
-AC_CACHE_CHECK([for nl_langinfo and CODESET], emacs_cv_langinfo_codeset,
+AC_CACHE_CHECK([for nl_langinfo and CODESET], [emacs_cv_langinfo_codeset],
   [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
-    [[char* cs = nl_langinfo(CODESET);]])],
-    emacs_cv_langinfo_codeset=yes,
-    emacs_cv_langinfo_codeset=no)
+    [[char *cs = nl_langinfo(CODESET);]])],
+    [emacs_cv_langinfo_codeset=yes],
+    [emacs_cv_langinfo_codeset=no])
   ])
-if test $emacs_cv_langinfo_codeset = yes; then
-  AC_DEFINE(HAVE_LANGINFO_CODESET, 1,
-    [Define if you have <langinfo.h> and nl_langinfo(CODESET).])
+if test "$emacs_cv_langinfo_codeset" = yes; then
+  AC_DEFINE([HAVE_LANGINFO_CODESET], 1,
+    [Define if you have <langinfo.h> and nl_langinfo (CODESET).])
+
+  AC_CACHE_CHECK([for nl_langinfo and _NL_PAPER_WIDTH],
+    [emacs_cv_langinfo__nl_paper_width],
+    [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <langinfo.h>]],
+      [[char *cs = nl_langinfo (_NL_PAPER_WIDTH);]])],
+      [emacs_cv_langinfo__nl_paper_width=yes],
+      [emacs_cv_langinfo__nl_paper_width=no])
+    ])
+  if test "$emacs_cv_langinfo__nl_paper_width" = yes; then
+    AC_DEFINE([HAVE_LANGINFO__NL_PAPER_WIDTH], 1,
+      [Define if you have <langinfo.h> and nl_langinfo (_NL_PAPER_WIDTH).])
+  fi
 fi
 
 AC_TYPE_MBSTATE_T
@@ -4461,7 +4567,6 @@ fi
 
 dnl Everybody supports this, except MS-DOS.
 dnl Seems like the kind of thing we should be testing for, though.
-dnl Compare with HAVE_INET_SOCKETS (which is unused...) above.
 AC_DEFINE(HAVE_SOCKETS, 1, [Define if the system supports
   4.2-compatible sockets.])
 
@@ -5053,7 +5158,7 @@ fi
 
 version=$PACKAGE_VERSION
 
-copyright="Copyright (C) 2018 Free Software Foundation, Inc."
+copyright="Copyright (C) 2019 Free Software Foundation, Inc."
 AC_DEFINE_UNQUOTED(COPYRIGHT, ["$copyright"],
   [Short copyright string for this version of Emacs.])
 AC_SUBST(copyright)
@@ -5310,6 +5415,15 @@ case "$opsys" in
   cygwin) LD_SWITCH_SYSTEM_TEMACS="-Wl,-stack,0x00800000" ;;
 
   darwin)
+   if test "$HAVE_NS" = "yes"; then
+     libs_nsgui="-framework AppKit"
+     if test "$NS_IMPL_COCOA" = "yes"; then
+        libs_nsgui="$libs_nsgui -framework IOKit -framework Carbon"
+     fi
+   else
+     libs_nsgui=
+   fi
+   LD_SWITCH_SYSTEM_TEMACS=$libs_nsgui
    ## The -headerpad option tells ld (see man page) to leave room at the
    ## end of the header for adding load commands.  Needed for dumping.
    ## 0x1000 is enough for roughly 52 load commands on the x86_64
@@ -5318,15 +5432,9 @@ case "$opsys" in
    ## about 14 to about 34. Setting it high gets us plenty of slop and
    ## only costs about 1.5K of wasted binary space.
    headerpad_extra=1000
-   if test "$HAVE_NS" = "yes"; then
-     libs_nsgui="-framework AppKit"
-     if test "$NS_IMPL_COCOA" = "yes"; then
-        libs_nsgui="$libs_nsgui -framework IOKit -framework Carbon"
-     fi
-   else
-     libs_nsgui=
+   if test "$with_unexec" = yes; then
+     LD_SWITCH_SYSTEM_TEMACS="-fno-pie $LD_SWITCH_SYSTEM_TEMACS -Xlinker 
-headerpad -Xlinker $headerpad_extra"
    fi
-   LD_SWITCH_SYSTEM_TEMACS="-fno-pie -prebind $libs_nsgui -Xlinker -headerpad 
-Xlinker $headerpad_extra"
 
    ## This is here because src/Makefile.in did some extra fiddling around
    ## with LD_SWITCH_SYSTEM.  It seems cleaner to put this in
@@ -5366,7 +5474,7 @@ esac
 AC_CACHE_CHECK(
   [for $CC option to disable position independent executables],
   [emacs_cv_prog_cc_no_pie],
-  [if test "$CANNOT_DUMP" = yes; then
+  [if test $with_unexec = no; then
      emacs_cv_prog_cc_no_pie='not needed'
    else
      emacs_save_c_werror_flag=$ac_c_werror_flag
@@ -5408,7 +5516,7 @@ AC_SUBST(WINDOW_SYSTEM_OBJ)
 
 AH_TOP([/* GNU Emacs site configuration template file.
 
-Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2018
+Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2019
   Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -5478,10 +5586,11 @@ emacs_config_features=
 for opt in XAW3D XPM JPEG TIFF GIF PNG RSVG CAIRO IMAGEMAGICK SOUND GPM DBUS \
   GCONF GSETTINGS GLIB NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT \
   LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS X_TOOLKIT OLDXMENU X11 XDBE XIM \
-  NS MODULES THREADS XWIDGETS LIBSYSTEMD JSON CANNOT_DUMP LCMS2 GMP; do
+  NS MODULES THREADS XWIDGETS LIBSYSTEMD JSON PDUMPER UNEXEC LCMS2 GMP; do
 
     case $opt in
-      CANNOT_DUMP) eval val=\${$opt} ;;
+      PDUMPER) val=${with_pdumper} ;;
+      UNEXEC) val=${with_unexec} ;;
       GLIB) val=${emacs_cv_links_glib} ;;
       NOTIFY|ACL) eval val=\${${opt}_SUMMARY} ;;
       TOOLKIT_SCROLL_BARS|X_TOOLKIT) eval val=\${USE_$opt} ;;
@@ -5546,6 +5655,9 @@ AS_ECHO(["  Does Emacs use -lXaw3d?                       
          ${HAVE_XAW3D
   Does Emacs use toolkit scroll bars?                     
${USE_TOOLKIT_SCROLL_BARS}
   Does Emacs support Xwidgets (requires gtk3)?            ${HAVE_XWIDGETS}
   Does Emacs have threading support in lisp?              ${threads_enabled}
+  Does Emacs support the portable dumper?                 ${with_pdumper}
+  Does Emacs support legacy unexec dumping?               ${with_unexec}
+  Which dumping strategy does Emacs use?                  ${with_dumping}
 "])
 
 if test -n "${EMACSDATA}"; then
diff --git a/doc/emacs/ChangeLog.1 b/doc/emacs/ChangeLog.1
index 26a0d3e..b9f7e49 100644
--- a/doc/emacs/ChangeLog.1
+++ b/doc/emacs/ChangeLog.1
@@ -83,7 +83,7 @@
 
 2014-12-08  Eric S. Raymond  <address@hidden>
 
-       * maintaining.texi: Suopport fo Arch has been moved to obosolete,
+       * maintaining.texi: Support for Arch has been moved to obsolete,
        remove references that imply otherwise.
 
 2014-11-29  Paul Eggert  <address@hidden>
@@ -10919,7 +10919,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993-1999, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1993-1999, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/doc/emacs/Makefile.in b/doc/emacs/Makefile.in
index 54e173f..01c6700 100644
--- a/doc/emacs/Makefile.in
+++ b/doc/emacs/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1994, 1996-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1996-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/doc/emacs/abbrevs.texi b/doc/emacs/abbrevs.texi
index 00b9e56..9c8a280 100644
--- a/doc/emacs/abbrevs.texi
+++ b/doc/emacs/abbrevs.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Abbrevs
diff --git a/doc/emacs/ack.texi b/doc/emacs/ack.texi
index 20c8d4e..0e4a982 100644
--- a/doc/emacs/ack.texi
+++ b/doc/emacs/ack.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1994-1997, 1999-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 1994-1997, 1999-2019 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @node Acknowledgments
@@ -829,8 +829,8 @@ command with its arguments.
 Richard Mlynarik wrote @file{cl-indent.el}, a package for indenting
 Common Lisp code; @file{ebuff-menu.el}, an electric browser for
 buffer listings; @file{ehelp.el}, bindings for browsing help screens;
-and @file{rfc822.el}, a parser for E-mail addresses in the RFC-822 format,
-used in mail messages and news articles.
+and @file{rfc822.el}, a parser for E-mail addresses in the format
+used in mail messages and news articles (Internet RFC 822 and its successors).
 
 @item
 Gerd Möllmann was the Emacs maintainer from the beginning of Emacs 21
diff --git a/doc/emacs/anti.texi b/doc/emacs/anti.texi
index b915163..9eac08c 100644
--- a/doc/emacs/anti.texi
+++ b/doc/emacs/anti.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 2005-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2005-2019 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 
 @node Antinews
diff --git a/doc/emacs/arevert-xtra.texi b/doc/emacs/arevert-xtra.texi
index 45fca1f..cd7c1ff 100644
--- a/doc/emacs/arevert-xtra.texi
+++ b/doc/emacs/arevert-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 2004-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2004-2019 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi
index f911c67..86403b7 100644
--- a/doc/emacs/basic.texi
+++ b/doc/emacs/basic.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Basic
diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi
index dd7a653..27fcb73 100644
--- a/doc/emacs/buffers.texi
+++ b/doc/emacs/buffers.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Buffers
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index 496c427..78d07b8 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Building
@@ -934,6 +934,7 @@ height and width values during the debugging session.
 @cindex GDB User Interface layout
 
 @vindex gdb-many-windows
address@hidden gdb-show-main
   If the variable @code{gdb-many-windows} is @code{nil} (the default),
 @kbd{M-x gdb} normally displays only the GUD interaction buffer.
 However, if the variable @code{gdb-show-main} is also address@hidden,
@@ -1033,6 +1034,15 @@ allows you to go backwards, which can be useful for 
running through
 code that has already executed, in order to examine its execution in
 more detail.
 
address@hidden gdb-mi-decode-strings
+  If the file names of the source files are shown with octal escapes,
+set the variable @code{gdb-mi-decode-strings} to the appropriate
+coding-system, most probably @code{utf-8}.  (This is @code{nil} by
+default because GDB may emit octal escapes in situations where
+decoding is undesirable, and also because the program being debugged
+might use an encoding different from the one used to encode non-ASCII
+file names on your system.)
+
 @node Breakpoints Buffer
 @subsubsection Breakpoints Buffer
 
@@ -1172,6 +1182,11 @@ also updates the Locals buffer
 (described in the next section).
 @end iftex
 
address@hidden gdb-stack-buffer-addresses
+  If you want the frame address to be shown each stack frame,
+customize the variable @code{gdb-stack-buffer-addresses} to a
address@hidden value.
+
 @node Other GDB Buffers
 @subsubsection Other GDB Buffers
 
diff --git a/doc/emacs/cal-xtra.texi b/doc/emacs/cal-xtra.texi
index 80e9b85..7fa20de 100644
--- a/doc/emacs/cal-xtra.texi
+++ b/doc/emacs/cal-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.  -*- coding: utf-8 -*-
address@hidden Copyright (C) 2004-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2004-2019 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
diff --git a/doc/emacs/calendar.texi b/doc/emacs/calendar.texi
index 7021146..138a24f 100644
--- a/doc/emacs/calendar.texi
+++ b/doc/emacs/calendar.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.  -*- coding: utf-8 -*-
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Calendar/Diary
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi
index 2e2767c..00d5be7 100644
--- a/doc/emacs/cmdargs.texi
+++ b/doc/emacs/cmdargs.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Emacs Invocation
@@ -383,6 +383,21 @@ verify that their module conforms to the module API 
requirements.  The
 option makes Emacs abort if a module-related assertion triggers.
 @xref{Writing Dynamic Modules,, Writing Dynamically-Loaded Modules,
 elisp, The GNU Emacs Lisp Reference Manual}.
+
address@hidden address@hidden
address@hidden --dump-file
address@hidden specify dump file
+Load the dumped Emacs state from the named @var{file}.  By default, an
+installed Emacs will look for its dump state in a file named
address@hidden@var{emacs}.pdmp} in the directory where the Emacs installation
+puts the architecture-dependent files; the variable
address@hidden holds the name of that directory.  @var{emacs}
+is the name of the Emacs executable file, normally just @file{emacs}.
+(When you invoke Emacs from the @file{src} directory where it was
+built without installing it, it will look for the dump file in the
+directory of the executable.)  If you rename or move the dump file to
+a different place, you can use this option to tell Emacs where to find
+that file.
 @end table
 
 @node Command Example
@@ -528,12 +543,17 @@ This variable defaults to @file{~/.bash_history} if you 
use Bash, to
 otherwise.
 @item HOME
 @vindex address@hidden, environment variable}
-The location of your files in the directory tree; used for
-expansion of file names starting with a tilde (@file{~}).  On MS-DOS,
-it defaults to the directory from which Emacs was started, with
address@hidden/bin} removed from the end if it was present.  On Windows, the
-default value of @env{HOME} is the @file{Application Data}
-subdirectory of the user profile directory (normally, this is
+The location of your files in the directory tree; used for expansion
+of file names starting with a tilde (@file{~}).  If set, it should be
+set to an absolute file name.  (If set to a relative file name, Emacs
+interprets it relative to the directory where Emacs was started, but
+we don't recommend to use this feature.)  If unset, @env{HOME}
+normally defaults to the home directory of the user given by
address@hidden, @env{USER} or your user ID, or to @file{/} if all else
+fails.  On MS-DOS, it defaults to the directory from which Emacs was
+started, with @samp{/bin} removed from the end if it was present.  On
+Windows, the default value of @env{HOME} is the @file{Application
+Data} subdirectory of the user profile directory (normally, this is
 @file{C:/Documents and Settings/@var{username}/Application Data},
 where @var{username} is your user name), though for backwards
 compatibility @file{C:/} will be used instead if a @file{.emacs} file
@@ -1029,7 +1049,7 @@ specifies a window 164 columns wide, enough for two 
ordinary width
 windows side by side, and 55 lines tall.
 
   The default frame width is 80 characters and the default height is
-40 lines.  You can omit either the width or the height or both.  If
+36 lines.  You can omit either the width or the height or both.  If
 you start the geometry with an integer, Emacs interprets it as the
 width.  If you start with an @samp{x} followed by an integer, Emacs
 interprets it as the height.  Thus, @samp{81} specifies just the
diff --git a/doc/emacs/commands.texi b/doc/emacs/commands.texi
index a992ded..4773d76 100644
--- a/doc/emacs/commands.texi
+++ b/doc/emacs/commands.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @iftex
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index ddde5b22..c649c17 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Customization
@@ -32,6 +32,8 @@ Reference Manual}.
                           By changing them, you can redefine keys.
 * Init File::           How to write common customizations in the
                           initialization file.
+* Authentication::      Keeping persistent authentication information.
+
 @end menu
 
 @node Easy Customization
@@ -763,6 +765,8 @@ expects (@pxref{Examining}).
 * Locals::              Per-buffer values of variables.
 * File Variables::      How files can specify variable values.
 * Directory Variables:: How variable values can be specified by directory.
+* Connection Variables:: Variables which are valid for buffers with a
+                           remote default directory.
 @end menu
 
 @node Examining
@@ -1419,6 +1423,52 @@ variables are handled in the same way as unsafe 
file-local variables
 do not visit a file directly but perform work within a directory, such
 as Dired buffers (@pxref{Dired}).
 
address@hidden Connection Variables
address@hidden Per-Connection Local Variables
address@hidden local variables, for all remote connections
address@hidden connection-local variables
address@hidden per-connection local variables
+
+  Most of the variables reflect the situation on the local machine.
+Often, they must use a different value when you operate in buffers
+with a remote default directory.  Think about the shell to be applied
+when calling @code{shell} -- it might be @file{/bin/bash} on your
+local machine, and @file{/bin/ksh} on a remote machine.
+
+  This can be accomplished with @dfn{connection-local variables}.
+Directory and file local variables override connection-local
+variables.  Unsafe connection-local variables are handled in the same
+way as unsafe file-local variables (@pxref{Safe File Variables}).
+
address@hidden connection-local-set-profile-variables
address@hidden connection-local-set-profiles
+  Connection-local variables are declared as a group of
+variables/value pairs in a @dfn{profile}, using the
address@hidden function.  The function
address@hidden activates profiles for a given
+criteria, identifying a remote machine:
+
address@hidden
+(connection-local-set-profile-variables 'remote-ksh
+   '((shell-file-name . "/bin/ksh")
+     (shell-command-switch . "-c")))
+
+(connection-local-set-profile-variables 'remote-bash
+   '((shell-file-name . "/bin/bash")
+     (shell-command-switch . "-c")))
+
+(connection-local-set-profiles
+   '(:application tramp :machine "remotemachine") 'remote-ksh)
address@hidden example
+
+  This code declares two different profiles, @code{remote-ksh} and
address@hidden The profile @code{remote-ksh} is applied to all
+buffers which have a remote default directory matching the regexp
address@hidden"remotemachine} as host name.  Such a criteria can also
+discriminate for the properties @code{:protocol} (this is the Tramp
+method) or @code{:user} (a remote user name).  The @code{nil} criteria
+matches all buffers with a remote default directory.
+
 @node Key Bindings
 @section Customizing Key Bindings
 @cindex key bindings
@@ -2557,10 +2607,9 @@ library.  @xref{Hooks}.
 @node Find Init
 @subsection How Emacs Finds Your Init File
 
-  Normally Emacs uses the environment variable @env{HOME}
-(@pxref{General Variables, HOME}) to find @file{.emacs}; that's what
address@hidden means in a file name.  If @file{.emacs} is not found inside
address@hidden/} (nor @file{.emacs.el}), Emacs looks for
+  Normally Emacs uses your home directory to find @file{~/.emacs};
+that's what @samp{~} means in a file name.  @xref{General Variables, HOME}.
+If neither @file{~/.emacs} nor @file{~/.emacs.el} is found, Emacs looks for
 @file{~/.emacs.d/init.el} (which, like @file{~/.emacs.el}, can be
 byte-compiled).
 
@@ -2640,3 +2689,40 @@ provided by the Emacs startup, such as 
@code{window-setup-hook} or
 
   For more information on the early init file, @pxref{Init File,,,
 elisp, The Emacs Lisp Reference Manual}.
+
address@hidden Authentication
address@hidden Keeping Persistent Authentication Information
+
+  Some Emacs packages, which connect to other services, require
+authentication (@pxref{Passwords}), e.g., see @ref{Top, Gnus,, gnus, The
+Gnus Manual}, or @ref{Top, Tramp,, tramp, The Tramp Manual}.  Because
+it might be annoying to provide the same user name and password again
+and again, Emacs offers to keep this information persistent via the
address@hidden library.
+
address@hidden @file{~/.authinfo} file
address@hidden @file{~/.authinfo.gpg} file
address@hidden ~/.netrc file
+  By default, the authentication information is taken from the file
address@hidden/.authinfo} or @file{~/.authinfo.gpg} or @file{~/.netrc}.
+These files have a syntax similar to netrc files as known from the
address@hidden program, like this:
+
address@hidden
+machine @var{mymachine} login @var{myloginname} password @var{mypassword} port 
@var{myport}
address@hidden example
+
+  Similarly, the @file{auth-source} library supports multiple storage
+backend, currently either the classic netrc backend, JSON files, the
+Secret Service API, and pass, the standard unix password manager.
+
address@hidden auth-sources
+  All these alternatives can be customized via the user option
address@hidden, see @ref{Help for users, Emacs auth-source,,
+auth, Emacs auth-source}.
+
address@hidden auth-source-save-behavior
+  When a password is entered interactively, which is not found via the
+configured backend, some of the backends offer to save it
+persistently.  This can be changed by customizing the user option
address@hidden
diff --git a/doc/emacs/dired-xtra.texi b/doc/emacs/dired-xtra.texi
index 4412e47..025da21 100644
--- a/doc/emacs/dired-xtra.texi
+++ b/doc/emacs/dired-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 2004-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2004-2019 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index 1b03a39..9f454ea 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Dired
@@ -779,9 +779,15 @@ suitable guess made using the variables @code{lpr-command} 
and
 @item Z
 Compress the specified files (@code{dired-do-compress}).  If the file
 appears to be a compressed file already, uncompress it instead.  Each
-marked file is compressed into its own archive.  This uses the
+marked file is compressed into its own archive; this uses the
 @command{gzip} program if it is available, otherwise it uses
address@hidden
address@hidden  On a directory name, this command produces a
+compressed @file{.tar.gz} archive containing all of the directory's
+files, by running the @command{tar} command with output piped to
address@hidden  To allow decompression of compressed directories,
+typing @kbd{Z} on a @file{.tar.gz} or @file{.tgz} archive file unpacks
+all the files in the archive into a directory whose name is the
+archive name with the extension removed.
 
 @findex dired-do-compress-to
 @kindex c @r{(Dired)}
diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index d9a08b9..f464a3a 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 
 @c See file emacs.texi for copying conditions.
diff --git a/doc/emacs/emacs-xtra.texi b/doc/emacs/emacs-xtra.texi
index 3c46d72..dcd8fae 100644
--- a/doc/emacs/emacs-xtra.texi
+++ b/doc/emacs/emacs-xtra.texi
@@ -16,7 +16,7 @@
 @copying
 This manual describes specialized features of Emacs.
 
-Copyright @copyright{} 2004--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2004--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index b64a59d..7edc1a5 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -27,7 +27,7 @@ This is the @cite{GNU Emacs Manual},
 @end ifnottex
 updated for Emacs version @value{EMACSVER}.
 
-Copyright @copyright{} 1985--1987, 1993--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1985--1987, 1993--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -1114,6 +1114,7 @@ Customization
                           By changing them, you can redefine keys.
 * Init File::           How to write common customizations in the
                           initialization file.
+* Authentication::      Keeping persistent authentication information.
 
 Easy Customization Interface
 
@@ -1134,6 +1135,8 @@ Variables
 * Locals::              Per-buffer values of variables.
 * File Variables::      How files can specify variable values.
 * Directory Variables:: How variable values can be specified by directory.
+* Connection Variables:: Variables which are valid for buffers with a
+                           remote default directory.
 
 Local Variables in Files
 
diff --git a/doc/emacs/emerge-xtra.texi b/doc/emacs/emerge-xtra.texi
index 1d81712..6c5e46b 100644
--- a/doc/emacs/emerge-xtra.texi
+++ b/doc/emacs/emerge-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 2004-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2004-2019 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
diff --git a/doc/emacs/entering.texi b/doc/emacs/entering.texi
index 84b3e5d..4362553 100644
--- a/doc/emacs/entering.texi
+++ b/doc/emacs/entering.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 2001-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @iftex
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 6c68075..a574282 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Files
@@ -1427,23 +1427,30 @@ manually, type @kbd{M-x diff-mode}.
 @cindex hunk, diff
   The changes specified in a patch are grouped into @dfn{hunks}, which
 are contiguous chunks of text that contain one or more changed lines.
-Hunks can also include unchanged lines to provide context for the
+Hunks usually also include unchanged lines to provide context for the
 changes.  Each hunk is preceded by a @dfn{hunk header}, which
-specifies the old and new line numbers at which the hunk occurs.  Diff
-mode highlights each hunk header, to distinguish it from the actual
-contents of the hunk.
+specifies the old and new line numbers where the hunk's changes occur.
+Diff mode highlights each hunk header, to distinguish it from the
+actual contents of the hunk.
+
+  The first hunk in a patch is preceded by a file header, which shows
+the names of the new and the old versions of the file, and their time
+stamps.  If a patch shows changes for more than one file, each file
+has such a header before the first hunk of that file's changes.
 
 @vindex diff-update-on-the-fly
   You can edit a Diff mode buffer like any other buffer.  (If it is
-read-only, you need to make it writable first.  @xref{Misc Buffer}.)
-Whenever you change a hunk, Diff mode attempts to automatically
-correct the line numbers in the hunk headers, to ensure that the patch
-remains correct.  To disable automatic line number correction,
-change the variable @code{diff-update-on-the-fly} to @code{nil}.
-
-  Diff mode treats each hunk as an error message, similar to
-Compilation mode.  Thus, you can use commands such as @kbd{M-g M-n} to
-visit the corresponding source locations.  @xref{Compilation Mode}.
+read-only, you need to make it writable first; see @ref{Misc Buffer}.)
+Whenever you edit a hunk, Diff mode attempts to automatically correct
+the line numbers in the hunk headers, to ensure that the patch remains
+correct, and could still be applied by @command{patch}.  To disable
+automatic line number correction, change the variable
address@hidden to @code{nil}.
+
+  Diff mode arranges for hunks to be treated as compiler error
+messages by @kbd{M-g M-n} and other commands that handle error messages
+(@pxref{Compilation Mode}).  Thus, you can use the compilation-mode
+commands to visit the corresponding source locations.
 
   In addition, Diff mode provides the following commands to navigate,
 manipulate and apply parts of patches:
@@ -1451,37 +1458,34 @@ manipulate and apply parts of patches:
 @table @kbd
 @item M-n
 @findex diff-hunk-next
-Move to the next hunk-start (@code{diff-hunk-next}).
+Move to the next hunk-start (@code{diff-hunk-next}).  With prefix
+argument @var{n}, move forward to the @var{n}th next hunk.
 
address@hidden diff-auto-refine-mode
address@hidden mode, Diff Auto-Refine
address@hidden Diff Auto-Refine mode
-This command has a side effect: it @dfn{refines} the hunk you move to,
-highlighting its changes with better granularity.  To disable this
-feature, type @kbd{M-x diff-auto-refine-mode} to toggle off the minor
-mode Diff Auto-Refine mode.  To disable Diff Auto-Refine mode by
-default, add this to your init file (@pxref{Hooks}):
-
address@hidden
-(add-hook 'diff-mode-hook
-          (lambda () (diff-auto-refine-mode -1)))
address@hidden example
address@hidden diff-refine
+By default, Diff mode @dfn{refines} hunks as Emacs displays them,
+highlighting their changes with better granularity.  Alternatively, if
+you set @code{diff-refine} to the symbol @code{navigation}, Diff mode
+only refines the hunk you move to with this command or with
address@hidden
 
 @item M-p
 @findex diff-hunk-prev
-Move to the previous hunk-start (@code{diff-hunk-prev}).  Like
address@hidden, this has the side-effect of refining the hunk you move to,
-unless you disable Diff Auto-Refine mode.
+Move to the previous hunk-start (@code{diff-hunk-prev}).  With prefix
+argument @var{n}, move back to the @var{n}th previous hunk.  Like
address@hidden, this command refines the hunk you move to if you set
address@hidden to the symbol @code{navigation}.
 
 @item address@hidden
 @findex diff-file-next
 Move to the next file-start, in a multi-file patch
-(@code{diff-file-next}).
+(@code{diff-file-next}).  With prefix argument @var{n}, move forward
+to the start of the @var{n}th next file.
 
 @item address@hidden
 @findex diff-file-prev
 Move to the previous file-start, in a multi-file patch
-(@code{diff-file-prev}).
+(@code{diff-file-prev}).  With prefix argument @var{n}, move back to
+the start of the @var{n}th previous file.
 
 @item M-k
 @findex diff-hunk-kill
@@ -1496,7 +1500,10 @@ In a multi-file patch, kill the current file part.
 @findex diff-apply-hunk
 @cindex patches, applying
 Apply this hunk to its target file (@code{diff-apply-hunk}).  With a
-prefix argument of @kbd{C-u}, revert this hunk.
+prefix argument of @kbd{C-u}, revert this hunk, i.e.@: apply the
+reverse of the hunk, which changes the ``new'' version into the ``old''
+version.  If @code{diff-jump-to-old-file} is address@hidden, apply the
+hunk to the ``old'' version of the file instead.
 
 @item C-c C-b
 @findex diff-refine-hunk
@@ -1504,10 +1511,27 @@ Highlight the changes of the hunk at point with a finer 
granularity
 (@code{diff-refine-hunk}).  This allows you to see exactly which parts
 of each changed line were actually changed.
 
address@hidden diff-refine
+By default, Diff mode refines hunks as Emacs displays them, so you may
+find this command useful if you customize @code{diff-refine} to a
+non-default value.
+
 @item C-c C-c
 @findex diff-goto-source
address@hidden diff-jump-to-old-file
 Go to the source file and line corresponding to this hunk
-(@code{diff-goto-source}).
+(@code{diff-goto-source}).  By default, this jumps to the ``new''
+version of the file, the one shown first on the file header.
+With a prefix argument, jump to the ``old'' version instead.  If
address@hidden is address@hidden, this command by
+default jumps to the ``old'' file, and the meaning of the prefix
+argument is reversed.  If the prefix argument is a number greater than
+8 (e.g., if you type @kbd{C-u C-u C-c C-c}), then this command also
+sets @code{diff-jump-to-old-file} for the next invocation.
+If the source file is under version control (@pxref{Version Control}),
+this jumps to the work file by default.  With a prefix argument, jump
+to the ``old'' revision of the file (@pxref{Old Revisions}), when
+point is on the old line, or otherwise jump to the ``new'' revision.
 
 @item C-c C-e
 @findex diff-ediff-patch
@@ -1517,41 +1541,47 @@ Start an Ediff session with the patch 
(@code{diff-ediff-patch}).
 @item C-c C-n
 @findex diff-restrict-view
 Restrict the view to the current hunk (@code{diff-restrict-view}).
address@hidden  With a prefix argument of @kbd{C-u}, restrict the
address@hidden  With a prefix argument, restrict the
 view to the current file of a multiple-file patch.  To widen again,
 use @kbd{C-x n w} (@code{widen}).
 
 @item C-c C-r
 @findex diff-reverse-direction
 Reverse the direction of comparison for the entire buffer
-(@code{diff-reverse-direction}).
+(@code{diff-reverse-direction}).  With a prefix argument, reverse the
+direction only inside the current region (@pxref{Mark}).  Reversing
+the direction means changing the hunks and the file-start headers to
+produce a patch that would change the ``new'' version into the ``old''
+one.
 
 @item C-c C-s
 @findex diff-split-hunk
-Split the hunk at point (@code{diff-split-hunk}).  This is for
-manually editing patches, and only works with the @dfn{unified diff
-format} produced by the @option{-u} or @option{--unified} options to
-the @command{diff} program.  If you need to split a hunk in the
address@hidden diff format} produced by the @option{-c} or
address@hidden options to @command{diff}, first convert the buffer
-to the unified diff format with @kbd{C-c C-u}.
+Split the hunk at point (@code{diff-split-hunk}) into two separate
+hunks.  This inserts a hunk header and modifies the header of the
+current hunk.  This command is useful for manually editing patches,
+and only works with the @dfn{unified diff format} produced by the
address@hidden or @option{--unified} options to the @command{diff}
+program.  If you need to split a hunk in the @dfn{context diff format}
+produced by the @option{-c} or @option{--context} options to
address@hidden, first convert the buffer to the unified diff format
+with @kbd{C-c C-u}.
 
 @item C-c C-d
 @findex diff-unified->context
 Convert the entire buffer to the @dfn{context diff format}
 (@code{diff-unified->context}).  With a prefix argument, convert only
-the text within the region.
+the hunks within the region.
 
 @item C-c C-u
 @findex diff-context->unified
 Convert the entire buffer to unified diff format
 (@code{diff-context->unified}).  With a prefix argument, convert
 unified format to context format.  When the mark is active, convert
-only the text within the region.
+only the hunks within the region.
 
 @item C-c C-w
 @findex diff-ignore-whitespace-hunk
-Re-diff the current hunk, disregarding changes in whitespace
+Re-generate the current hunk, disregarding changes in whitespace
 (@code{diff-ignore-whitespace-hunk}).
 
 @item C-x 4 A
@@ -1582,7 +1612,12 @@ that whitespace in both the patch and the patched source 
file(s).
 This command does not save the modifications that it makes, so you can
 decide whether to save the changes (the list of modified files is
 displayed in the echo area).  With a prefix argument, it tries to
-modify the original source files rather than the patched source files.
+modify the original (``old'') source files rather than the patched
+(``new'') source files.
+
address@hidden diff-font-lock-syntax
+  If address@hidden, fragments of source in hunks are highlighted
+according to the appropriate major mode.
 
 @node Copying and Naming
 @section Copying, Naming and Renaming Files
@@ -1668,10 +1703,12 @@ Dired rather than @code{delete-file}.  @xref{Dired 
Deletion}.
 
 @cindex trash
 @cindex recycle bin
address@hidden move-file-to-trash
   @kbd{M-x move-file-to-trash} moves a file into the system
 @dfn{Trash} (or @dfn{Recycle Bin}).  This is a facility available on
 most operating systems; files that are moved into the Trash can be
-brought back later if you change your mind.
+brought back later if you change your mind.  (The way to restore
+trashed files is system-dependent.)
 
 @vindex delete-by-moving-to-trash
   By default, Emacs deletion commands do @emph{not} use the Trash.  To
diff --git a/doc/emacs/fixit.texi b/doc/emacs/fixit.texi
index 8277278..fc61058 100644
--- a/doc/emacs/fixit.texi
+++ b/doc/emacs/fixit.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Fixit
diff --git a/doc/emacs/fortran-xtra.texi b/doc/emacs/fortran-xtra.texi
index fa5a3e6..30f7c42 100644
--- a/doc/emacs/fortran-xtra.texi
+++ b/doc/emacs/fortran-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 2004-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2004-2019 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index 6bbaae2..6001096 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Frames
@@ -899,6 +899,16 @@ input stream for each server.  Each server also has its 
own selected
 frame.  The commands you enter with a particular X server apply to
 that server's selected frame.
 
+  On multi-monitor displays it is possible to use the command
address@hidden:
+
address@hidden make-frame-on-monitor
address@hidden @kbd
address@hidden M-x make-frame-on-monitor @key{RET} @var{monitor} @key{RET}
+Create a new frame on monitor @var{monitor} whose screen area is
+a part of the current display.
address@hidden table
+
 @node Frame Parameters
 @section Frame Parameters
 @vindex default-frame-alist
diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi
index 0293967..ad16d72 100644
--- a/doc/emacs/glossary.texi
+++ b/doc/emacs/glossary.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Glossary
diff --git a/doc/emacs/gnu.texi b/doc/emacs/gnu.texi
index 4a42a64..fef4f71 100644
--- a/doc/emacs/gnu.texi
+++ b/doc/emacs/gnu.texi
@@ -1,4 +1,4 @@
address@hidden Copyright (C) 1985-1987, 1993, 1995, 2001-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993, 1995, 2001-2019 Free Software
 @c Foundation, Inc.
 @c
 @c Permission is granted to anyone to make or distribute verbatim copies
diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi
index 66673eb..4851659 100644
--- a/doc/emacs/help.texi
+++ b/doc/emacs/help.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Help
diff --git a/doc/emacs/indent.texi b/doc/emacs/indent.texi
index bf43909..5f40acb 100644
--- a/doc/emacs/indent.texi
+++ b/doc/emacs/indent.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Indentation
@@ -110,6 +110,10 @@ parentheses, or if the junction follows another newline.
 If there is a fill prefix, @kbd{M-^} deletes the fill prefix if it
 appears after the newline that is deleted.  @xref{Fill Prefix}.
 
+With a prefix argument, join the current line line to the following
+line.  If the region is active, and no prefix argument is given, join
+all lines in the region instead.
+
 @item C-M-\
 @kindex C-M-\
 @findex indent-region
diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi
index 4c47c8b..2d56f1d 100644
--- a/doc/emacs/killing.texi
+++ b/doc/emacs/killing.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 
diff --git a/doc/emacs/kmacro.texi b/doc/emacs/kmacro.texi
index 0151c81..65387ae 100644
--- a/doc/emacs/kmacro.texi
+++ b/doc/emacs/kmacro.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Keyboard Macros
@@ -241,10 +241,17 @@ determined by the customizable variable 
@code{kmacro-ring-max}.
 @section The Keyboard Macro Counter
 
   Each keyboard macro has an associated counter, which is initialized
-to 0 when you start defining the macro.  This counter allows you to
-insert a number into the buffer that depends on the number of times
-the macro has been called.  The counter is incremented each time its
-value is inserted into the buffer.
+to 0 when you start defining the macro.  This @dfn{current counter}
+allows you to insert a number into the buffer that depends on the
+number of times the macro has been called.  The counter is normally
+incremented each time its value is inserted into the buffer.
+
+In addition to the current counter, keyboard macros also maintain the
address@hidden counter}, which records the value the current counter
+had last time it was incremented or set.  Note that incrementing the
+current counter by zero, e.g., with @address@hidden 0 C-x C-k C-i}}, also
+records the value of the current counter as the previous counter
+value.
 
 @table @kbd
 @item @key{F3}
@@ -270,8 +277,8 @@ value of the keyboard macro's counter into the buffer, and 
increments
 the counter by 1.  (If you are not defining a macro, @key{F3} begins a
 macro definition instead.  @xref{Basic Keyboard Macro}.)  You can use
 a numeric prefix argument to specify a different increment.  If you
-just specify a @kbd{C-u} prefix, that is the same as an increment of
-zero: it inserts the current counter value without changing it.
+just specify a @kbd{C-u} prefix, that inserts the previous counter
+value, and doesn't change the current value.
 
   As an example, let us show how the keyboard macro counter can be
 used to build a numbered list.  Consider the following key sequence:
diff --git a/doc/emacs/m-x.texi b/doc/emacs/m-x.texi
index adf46ff..2b2be38 100644
--- a/doc/emacs/m-x.texi
+++ b/doc/emacs/m-x.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node M-x
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi
index 34b645d..d992095 100644
--- a/doc/emacs/macos.texi
+++ b/doc/emacs/macos.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 2000-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2000-2019 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Mac OS / GNUstep
 @appendix Emacs and macOS / GNUstep
@@ -170,8 +170,25 @@ the requested line (@code{ns-open-file-select-line}).
 This event occurs when a user drags an object from another application
 into an Emacs frame.  The default behavior is to open a file in the
 window under the mouse, or to insert text at point of the window under
-the mouse.  It may sometimes be necessary to use the @key{Meta} key in
-conjunction with dragging to force text insertion.
+the mouse.
+
+The sending application has some limited ability to decide how Emacs
+handles the sent object, but the user may override the default
+behaviour by holding one or more modifier key.
+
address@hidden @kbd
address@hidden control
+Insert as text in the current buffer.  If the object is a file, this
+will insert the filename.
address@hidden alt/option
+Attempt to open the object as though it is a file or URL.
address@hidden super/command
+Perform the default action for the type.  This can be useful when an
+application is overriding the default behaviour.
address@hidden table
+
+The modifier keys listed above are defined by macOS and are unaffected
+by user changes to the modifiers in Emacs.
 
 @item ns-change-font
 This event occurs when the user selects a font in a Nextstep font
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 4527c23..fd0119e 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual., Abbrevs, This is part of the Emacs 
manual., Top
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Maintaining
@@ -831,6 +831,14 @@ working tree containing the current VC fileset).  If you 
invoke this
 command from a Dired buffer, it applies to the working tree containing
 the directory.
 
address@hidden vc-root-version-diff
address@hidden C-u C-x v D
+  To compare two arbitrary revisions of the whole trees, call
address@hidden with a prefix argument: @kbd{C-u C-x v D}.  This
+prompts for two revision IDs (@pxref{VCS Concepts}), and displays a
+diff between those versions of the entire version-controlled directory
+trees (RCS, SCCS, CVS, and SRC do not support this feature).
+
 @vindex vc-diff-switches
   You can customize the @command{diff} options that @kbd{C-x v =} and
 @kbd{C-x v D} use for generating diffs.  The options used are taken
@@ -963,6 +971,7 @@ and the maximum number of revisions to display.
 Directory Mode}) or a Dired buffer (@pxref{Dired}), it applies to the
 file listed on the current line.
 
address@hidden C-x v L
 @findex vc-print-root-log
 @findex log-view-toggle-entry-display
   @kbd{C-x v L} (@code{vc-print-root-log}) displays a
@@ -1981,7 +1990,7 @@ table.
 @item M-x tags-query-replace @key{RET} @var{regexp} @key{RET} 
@var{replacement} @key{RET}
 Perform a @code{query-replace-regexp} on each file in the selected tags table.
 
address@hidden M-x multifile-continue
address@hidden M-x fileloop-continue
 Restart one of the last 2 commands above, from the current location of point.
 @end table
 
@@ -2017,9 +2026,9 @@ you can follow its progress.  As soon as it finds an 
occurrence,
 @code{tags-search} returns.  This command requires tags tables to be
 available (@pxref{Tags Tables}).
 
address@hidden multifile-continue
address@hidden fileloop-continue
   Having found one match with @code{tags-search}, you probably want to
-find all the rest.  @kbd{M-x multifile-continue} resumes the
+find all the rest.  @kbd{M-x fileloop-continue} resumes the
 @code{tags-search}, finding one more match.  This searches the rest of
 the current buffer, followed by the remaining files of the tags table.
 
@@ -2042,10 +2051,10 @@ default is to use the same setting as the value of
 single invocation of @kbd{M-x tags-query-replace}.  But often it is
 useful to exit temporarily, which you can do with any input event that
 has no special query replace meaning.  You can resume the query
-replace subsequently by typing @kbd{M-x multifile-continue}; this
+replace subsequently by typing @kbd{M-x fileloop-continue}; this
 command resumes the last tags search or replace command that you did.
 For instance, to skip the rest of the current file, you can type
address@hidden@kbd{M-> M-x multifile-continue}}.
address@hidden@kbd{M-> M-x fileloop-continue}}.
 
   Note that the commands described above carry out much broader
 searches than the @code{xref-find-definitions} family.  The
diff --git a/doc/emacs/mark.texi b/doc/emacs/mark.texi
index 626f9dd..aa75388 100644
--- a/doc/emacs/mark.texi
+++ b/doc/emacs/mark.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Mark
diff --git a/doc/emacs/mini.texi b/doc/emacs/mini.texi
index 6fc2890..820d3ba 100644
--- a/doc/emacs/mini.texi
+++ b/doc/emacs/mini.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Minibuffer
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index ab33caf..7d7065a 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @iftex
@@ -795,6 +795,10 @@ to @command{gpg}.  This will output the list of keys to the
 name is relative, Emacs searches the directories listed in
 @code{exec-path} (@pxref{Shell}).
 
+  If the default directory is remote (@pxref{Remote Files}), the
+default value is @file{/bin/sh}.  This can be changed by declaring
address@hidden connection-local (@pxref{Connection Variables}).
+
   To specify a coding system for @kbd{M-!} or @kbd{M-|}, use the command
 @kbd{C-x @key{RET} c} immediately beforehand.  @xref{Communication Coding}.
 
@@ -1693,7 +1697,9 @@ each one a unique @dfn{server name}, using the variable
 @code{server-name}.  For example, @kbd{M-x set-variable @key{RET}
 server-name @key{RET} "foo" @key{RET}} sets the server name to
 @samp{foo}.  The @code{emacsclient} program can specify a server by
-name, using the @samp{-s} option (@pxref{emacsclient Options}).
+name, using the @samp{-s} or the @samp{-f} option (@pxref{emacsclient
+Options}), depending on whether or not the server uses a TCP socket
+(@pxref{TCP Emacs server}).
 
   If you want to run multiple Emacs daemons (@pxref{Initial Options}),
 you can give each daemon its own server name like this:
@@ -1758,21 +1764,23 @@ use @kbd{M-x server-generate-key} to get a random key.
   When you start a TCP Emacs server, Emacs creates a @dfn{server file}
 containing the TCP information to be used by @command{emacsclient} to
 connect to the server.  The variable @code{server-auth-dir} specifies
-the directory containing the server file; by default, this is
+the default directory containing the server file; by default, this is
 @file{~/.emacs.d/server/}.  In the absence of a local socket with file
 permissions, the permissions of this directory determine which users
 can have their @command{emacsclient} processes talk to the Emacs
-server.
+server.  If @code{server-name} is an absolute file name, the server
+file is created where specified by that file name.
 
 @vindex address@hidden, environment variable}
   To tell @command{emacsclient} to connect to the server over TCP with
 a specific server file, use the @samp{-f} or @samp{--server-file}
 option, or set the @env{EMACS_SERVER_FILE} environment variable
 (@pxref{emacsclient Options}).  If @code{server-auth-dir} is set to a
-non-standard value, @command{emacsclient} needs an absolute file name
-to the server file, as the default @code{server-auth-dir} is
-hard-coded in @command{emacsclient} to be used as the directory for
-resolving relative filenames.
+non-standard value, or if @code{server-name} is set to an absolute
+file name, @command{emacsclient} needs an absolute file name to the
+server file, as the default @code{server-auth-dir} is hard-coded in
address@hidden to be used as the directory for resolving
+relative filenames.
 
 @node Invoking emacsclient
 @subsection Invoking @code{emacsclient}
@@ -1961,10 +1969,13 @@ evaluation performed is for side-effect rather than 
result.
 
 @item -s @var{server-name}
 @itemx address@hidden
-Connect to the Emacs server named @var{server-name}.  The server name
-is given by the variable @code{server-name} on the Emacs server.  If
-this option is omitted, @command{emacsclient} connects to the first
-server it finds.  (This option is not supported on MS-Windows.)
+Connect to the Emacs server named @var{server-name}.  (This option is
+not supported on MS-Windows.)  The server name is given by the
+variable @code{server-name} on the Emacs server.  If this option is
+omitted, @command{emacsclient} connects to the first server it finds.
+If you set @code{server-name} of the Emacs server to an absolute file
+name, give the same absolute file name as @var{server-name} to this
+option to instruct @command{emacsclient} to connect to that server.
 
 Alternatively, you can set the @env{EMACS_SOCKET_NAME} environment
 variable to point to the server socket.  (The command-line option
diff --git a/doc/emacs/modes.texi b/doc/emacs/modes.texi
index 2bbc17b..4505bb5 100644
--- a/doc/emacs/modes.texi
+++ b/doc/emacs/modes.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Modes
diff --git a/doc/emacs/msdos-xtra.texi b/doc/emacs/msdos-xtra.texi
index 64ce841..e0d3bcd 100644
--- a/doc/emacs/msdos-xtra.texi
+++ b/doc/emacs/msdos-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 2004-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2004-2019 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
diff --git a/doc/emacs/msdos.texi b/doc/emacs/msdos.texi
index c69c7d3..9fc4b62 100644
--- a/doc/emacs/msdos.texi
+++ b/doc/emacs/msdos.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Microsoft Windows
diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi
index 6c0c5b2..6a26667 100644
--- a/doc/emacs/mule.texi
+++ b/doc/emacs/mule.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1997, 1999-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 1997, 1999-2019 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node International
 @chapter International Character Set Support
@@ -397,7 +397,7 @@ messages.  But if your locale matches an entry in the 
variable
 coding system instead.  For example, if the locale @samp{ja_JP.PCK}
 matches @code{japanese-shift-jis} in
 @code{locale-preferred-coding-systems}, Emacs uses that encoding even
-though it might normally use @code{japanese-iso-8bit}.
+though it might normally use @code{utf-8}.
 
   You can override the language environment chosen at startup with
 explicit use of the command @code{set-language-environment}, or with
diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
index 43f5a84..26e6424 100644
--- a/doc/emacs/package.texi
+++ b/doc/emacs/package.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Packages
diff --git a/doc/emacs/picture-xtra.texi b/doc/emacs/picture-xtra.texi
index 9ebc78e..704cff1 100644
--- a/doc/emacs/picture-xtra.texi
+++ b/doc/emacs/picture-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 2004-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2004-2019 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in emacs-xtra.texi (when producing the
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index cfeb61e..c1ad5b5 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Programs
diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi
index 98eed06..1881b49 100644
--- a/doc/emacs/regs.texi
+++ b/doc/emacs/regs.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Registers
diff --git a/doc/emacs/rmail.texi b/doc/emacs/rmail.texi
index a17ef49..4901ca9 100644
--- a/doc/emacs/rmail.texi
+++ b/doc/emacs/rmail.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Rmail
@@ -318,7 +318,7 @@ effect of a @kbd{d} command in most cases.  It undeletes 
the current
 message if the current message is deleted.  Otherwise it moves backward
 to previous messages until a deleted message is found, and undeletes
 that message.  A numeric prefix argument serves as a repeat count, to
-allow deletion of several messages in a single command.
+allow undeletion of several messages in a single command.
 
   You can usually undo a @kbd{d} with a @kbd{u} because the @kbd{u}
 moves back to and undeletes the message that the @kbd{d} deleted.  But
diff --git a/doc/emacs/screen.texi b/doc/emacs/screen.texi
index 8f2be4b..67da9da 100644
--- a/doc/emacs/screen.texi
+++ b/doc/emacs/screen.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Screen
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index 801e8bb..a1c987c 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Search
@@ -315,7 +315,7 @@ string that failed to match is highlighted using the face
 
   At this point, there are several things you can do.  If your string
 was mistyped, use @key{DEL} to cancel a previous input item
-(@pxref{Basic Isearch}), @kbd{C-M-w} to erase one character at a time,
+(@pxref{Basic Isearch}), @kbd{C-M-d} to erase one character at a time,
 or @kbd{M-e} to edit it.  If you like the place you have found, you
 can type @key{RET} to remain there.  Or you can type @kbd{C-g}, which
 removes from the search string the characters that could not be found
@@ -548,12 +548,12 @@ an incremental search.  This feature is disabled if
 
 @item Motion Commands
 @cindex motion commands, during incremental search
-When @code{search-exit-option} is customized to @code{shift-move},
+When @code{isearch-yank-on-move} is customized to @code{shift},
 you can extend the search string by holding down the shift key while
 typing cursor motion commands.  It will yank text that ends at the new
 position after moving point in the current buffer.
 
-When @code{search-exit-option} is @code{move}, you can extend the
+When @code{isearch-yank-on-move} is @code{t}, you can extend the
 search string without using the shift key for cursor motion commands,
 but it applies only for certain motion command that have the
 @code{isearch-move} property on their symbols.
@@ -684,6 +684,8 @@ matching}) has no effect on them.
 @kindex M-s M-w
 @findex eww-search-words
 @vindex eww-search-prefix
address@hidden Internet search
address@hidden search Internet for keywords
   To search the Web for the text in region, type @kbd{M-s M-w}.  This
 command performs an Internet search for the words in region using the
 search engine whose @acronym{URL} is specified by the variable
@@ -972,11 +974,10 @@ character class inside a character alternative.  For 
instance,
 elisp, The Emacs Lisp Reference Manual}, for a list of character
 classes.
 
-To include a @samp{]} in a character set, you must make it the first
-character.  For example, @samp{[]a]} matches @samp{]} or @samp{a}.  To
-include a @samp{-}, write @samp{-} as the first or last character of the
-set, or put it after a range.  Thus, @samp{[]-]} matches both @samp{]}
-and @samp{-}.
+To include a @samp{]} in a character set, you must make it the first character.
+For example, @samp{[]a]} matches @samp{]} or @samp{a}.  To include a @samp{-},
+write @samp{-} as the last character of the set, tho you can also put it first
+or after a range.  Thus, @samp{[]-]} matches both @samp{]} and @samp{-}.
 
 To include @samp{^} in a set, put it anywhere but at the beginning of
 the set.  (At the beginning, it complements the set---see below.)
@@ -1872,11 +1873,13 @@ region instead.
 @findex flush-lines
 @item M-x flush-lines
 Prompt for a regexp, and delete each line that contains a match for
-it, operating on the text after point.  This command deletes the
-current line if it contains a match starting after point.  If the
-region is active, it operates on the region instead; if a line
-partially contained in the region contains a match entirely contained
-in the region, it is deleted.
+it, operating on the text after point.  When the command finishes,
+it prints the number of deleted matching lines.
+
+This command deletes the current line if it contains a match starting
+after point.  If the region is active, it operates on the region
+instead; if a line partially contained in the region contains a match
+entirely contained in the region, it is deleted.
 
 If a match is split across lines, @code{flush-lines} deletes all those
 lines.  It deletes the lines before starting to look for the next
diff --git a/doc/emacs/sending.texi b/doc/emacs/sending.texi
index 00b3c4d..c6b8912 100644
--- a/doc/emacs/sending.texi
+++ b/doc/emacs/sending.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Sending Mail
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 1e96163..9649278 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -1,6 +1,6 @@
 @c -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Text
diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi
index bb05378..1bdd9fa 100644
--- a/doc/emacs/trouble.texi
+++ b/doc/emacs/trouble.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @iftex
diff --git a/doc/emacs/vc-xtra.texi b/doc/emacs/vc-xtra.texi
index 17d6a3b..ca919e8 100644
--- a/doc/emacs/vc-xtra.texi
+++ b/doc/emacs/vc-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 2004-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2004-2019 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included in emacs-xtra.texi when producing the printed
diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi
index 35dd6d1..1c17695 100644
--- a/doc/emacs/vc1-xtra.texi
+++ b/doc/emacs/vc1-xtra.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 2004-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2004-2019 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @c
 @c This file is included either in vc-xtra.texi (when producing the
diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi
index 17ce4ad..ece5313 100644
--- a/doc/emacs/windows.texi
+++ b/doc/emacs/windows.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
address@hidden Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Windows
@@ -48,8 +48,8 @@ other windows at all.  However, there are other commands such 
as
 @kbd{C-x 4 b} that select a different window and switch buffers in it.
 Also, all commands that display information in a window, including
 (for example) @kbd{C-h f} (@code{describe-function}) and @kbd{C-x C-b}
-(@code{list-buffers}), work by switching buffers in a nonselected
-window without affecting the selected window.
+(@code{list-buffers}), usually work by displaying buffers in a
+nonselected window without affecting the selected window.
 
   When multiple windows show the same buffer, they can have different
 regions, because they can have different values of point.  However,
@@ -262,6 +262,8 @@ Delete all windows in the selected frame except the 
selected window
 Delete the selected window and kill the buffer that was showing in it
 (@code{kill-buffer-and-window}).  The last character in this key
 sequence is a zero.
address@hidden M-x delete-windows-on @key{RET} @var{buffer} @key{RET}
+Delete windows showing the specified @var{buffer}.
 @item C-x ^
 Make selected window taller (@code{enlarge-window}).
 @item C-x @}
@@ -297,6 +299,11 @@ selected window.
 whole frame.  (This command cannot be used while the minibuffer window
 is active; attempting to do so signals an error.)
 
+  @kbd{M-x delete-windows-on} deletes windows that show a specific
+buffer.  It prompts for the buffer, defaulting to the current buffer.
+With prefix argument of zero, @kbd{C-u 0}, this command deletes
+windows only on the current display's frames.
+
 @cindex resize window
 @cindex resizing windows
 @kindex C-x ^
@@ -347,11 +354,9 @@ heights of all the windows in the selected frame.
 in response to a user command.  There are several different ways in
 which commands do this.
 
-  Many commands, like @kbd{C-x C-f} (@code{find-file}), display the
-buffer by ``taking over'' the selected window, expecting that the
-user's attention will be diverted to that buffer.  These commands
-usually work by calling @code{switch-to-buffer} internally
-(@pxref{Select Buffer}).
+  Many commands, like @kbd{C-x C-f} (@code{find-file}), by default
+display the buffer by ``taking over'' the selected window, expecting
+that the user's attention will be diverted to that buffer.
 
   Some commands try to display intelligently, trying not to take
 over the selected window, e.g., by splitting off a new window and
@@ -374,10 +379,9 @@ key (@pxref{Pop Up Window}).
 
   Commands with names ending in @code{-other-frame} behave like
 @code{display-buffer}, except that they (i) never display in the
-selected window and (ii) prefer to create a new frame to display the
-desired buffer instead of splitting a window---as though the variable
address@hidden is set to @code{t} (@pxref{Window Choice}).
-Several of these commands are bound in the @kbd{C-x 5} prefix key.
+selected window and (ii) prefer to either create a new frame or use a
+window on some other frame to display the desired buffer.  Several of
+these commands are bound in the @kbd{C-x 5} prefix key.
 
 @menu
 * Window Choice::   How @code{display-buffer} works.
@@ -390,33 +394,61 @@ Several of these commands are bound in the @kbd{C-x 5} 
prefix key.
 
 The @code{display-buffer} command (as well as commands that call it
 internally) chooses a window to display by following the steps given
-below.  @xref{Choosing Window,,Choosing a Window for Display, elisp,
-The Emacs Lisp Reference Manual}, for details about how to alter this
-sequence of steps.
+below.  @xref{Choosing Window,,Choosing a Window for Displaying a
+Buffer, elisp, The Emacs Lisp Reference Manual}, for details about how
+to alter this sequence of steps.
 
 @itemize
address@hidden same-window-buffer-names
address@hidden same-window-regexps
 @item
-First, check if the buffer should be displayed in the selected window
-regardless of other considerations.  You can tell Emacs to do this by
-adding the desired buffer's name to the list
address@hidden, or adding a matching regular
-expression to the list @code{same-window-regexps}.  By default, these
-variables are @code{nil}, so this step is skipped.
+If the buffer should be displayed in the selected window regardless of
+other considerations, reuse the selected window.  By default, this
+step is skipped, but you can tell Emacs not to skip it by adding a
+regular expression matching the buffer's name together with a
+reference to the @code{display-buffer-same-window} action function
+(@pxref{Buffer Display Action Functions,,Action Functions for Buffer
+Display, elisp, The Emacs Lisp Reference Manual}) to the option
address@hidden (@pxref{Choosing Window,,Choosing a Window
+for Displaying a Buffer, elisp, The Emacs Lisp Reference Manual}).
+For example, to display the buffer @file{*scratch*} preferably in the
+selected window write:
+
address@hidden
address@hidden
+(customize-set-variable
+ 'display-buffer-alist
+ '("\\*scratch\\*" (display-buffer-same-window)))
address@hidden group
address@hidden example
+
+By default, @code{display-buffer-alist} is @code{nil}.
 
 @item
 Otherwise, if the buffer is already displayed in an existing window,
-reuse that window.  Normally, only windows on the selected frame
-are considered, but windows on other frames are also reusable if you
-change @code{pop-up-frames} (see below) to @code{t}.
+reuse that window.  Normally, only windows on the selected frame are
+considered, but windows on other frames are also reusable if you use
+the corresponding @code{reusable-frames} action alist entry
+(@pxref{Buffer Display Action Alists,,Action Alists for Buffer
+Display, elisp, The Emacs Lisp Reference Manual}).  See the
+next step for an example of how to do that.
 
address@hidden pop-up-frames
 @item
 Otherwise, optionally create a new frame and display the buffer there.
-By default, this step is skipped.  To enable it, change the variable
address@hidden to a address@hidden value.  The special value
address@hidden means to do this only on graphical displays.
+By default, this step is skipped.  To enable it, change the value of
+the option @code{display-buffer-base-action} (@pxref{Choosing
+Window,,Choosing a Window for Displaying a Buffer, elisp, The Emacs
+Lisp Reference Manual}) as follows:
+
address@hidden
address@hidden
+(customize-set-variable
+ 'display-buffer-base-action
+ '((display-buffer-reuse-window display-buffer-pop-up-frame)
+   (reusable-frames . 0)))
address@hidden group
address@hidden example
+
+This customization will also try to make the preceding step search for
+a reusable window on all visible or iconified frames.
 
 @item
 Otherwise, try to create a new window by splitting a window on the
@@ -436,9 +468,9 @@ window was not split before (to avoid excessive splitting).
 
 @item
 Otherwise, display the buffer in a window previously showing it.
-Normally, only windows on the selected frame are considered, but if
address@hidden is address@hidden the window may be also on another
-frame.
+Normally, only windows on the selected frame are considered, but with
+a suitable @code{reusable-frames} action alist entry (see above) the
+window may be also on another frame.
 
 @item
 Otherwise, display the buffer in an existing window on the selected
@@ -449,41 +481,35 @@ If all the above methods fail for whatever reason, create 
a new frame
 and display the buffer there.
 @end itemize
 
-A more advanced and flexible way to customize the behavior of
address@hidden is by using the option @code{display-buffer-alist}
-mentioned in the next section.
-
 
 @node Temporary Displays
 @subsection Displaying non-editable buffers.
address@hidden pop-up windows
 @cindex temporary windows
 
 Some buffers are shown in windows for perusal rather than for editing.
 Help commands (@pxref{Help}) typically use a buffer called @file{*Help*}
 for that purpose, minibuffer completion (@pxref{Completion}) uses a
-buffer called @file{*Completions*} instead.  Such buffers are usually
+buffer called @file{*Completions*}, etc.  Such buffers are usually
 displayed only for a short period of time.
 
   Normally, Emacs chooses the window for such temporary displays via
address@hidden as described above.  The @file{*Completions*}
-buffer, on the other hand, is normally displayed in a window at the
-bottom of the selected frame, regardless of the number of windows
-already shown on that frame.
address@hidden, as described in the previous subsection.  The
address@hidden buffer, on the other hand, is normally displayed
+in a window at the 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 customizing the variable
address@hidden (@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
-the previous section, use the following form in your initialization
-file (@pxref{Init File}):
+fashion, customize the variable @code{display-buffer-alist}
+(@pxref{Choosing Window,,Choosing a Window for Displaying a Buffer,
+elisp, The Emacs Lisp Reference Manual}) appropriately.  For example,
+to display @file{*Completions*} always below the selected window, use
+the following form in your initialization file (@pxref{Init File}):
 
 @example
 @group
 (customize-set-variable
  'display-buffer-alist
- '(("\\*Completions\\*" display-buffer-pop-up-window)))
+ '(("\\*Completions\\*" display-buffer-below-selected)))
 @end group
 @end example
 
@@ -491,10 +517,10 @@ file (@pxref{Init File}):
   The @file{*Completions*} buffer is also special in the sense that
 Emacs usually tries to make its window just as large as necessary to
 display all of its contents.  To resize windows showing other
-temporary displays like, for example, the @file{*Help*} buffer
-accordingly, turn on the minor mode (@pxref{Minor Modes})
address@hidden (@pxref{Temporary Displays,,Temporary
-Displays, elisp, The Emacs Lisp Reference Manual}).
+temporary displays, like, for example, the @file{*Help*} buffer, turn
+on the minor mode (@pxref{Minor Modes}) @code{temp-buffer-resize-mode}
+(@pxref{Temporary Displays,,Temporary Displays, elisp, The Emacs Lisp
+Reference Manual}).
 
 @vindex temp-buffer-max-height
 @vindex temp-buffer-max-width
@@ -502,7 +528,7 @@ Displays, elisp, The Emacs Lisp Reference Manual}).
 can be controlled by customizing the options
 @code{temp-buffer-max-height} and @code{temp-buffer-max-width}
 (@pxref{Temporary Displays,,Temporary Displays, elisp, The Emacs Lisp
-Reference Manual}) and cannot exceed the size of the containing frame.
+Reference Manual}), and cannot exceed the size of the containing frame.
 
 
 @node Window Convenience
@@ -534,7 +560,7 @@ buffer.  @xref{Follow Mode}.
 between neighboring windows in a frame.  @kbd{M-x windmove-right}
 selects the window immediately to the right of the currently selected
 one, and similarly for the left, up, and down
-counterparts.  @kbd{M-x windmove-default-keybindings} binds these
+counterparts.  @address@hidden windmove-default-keybindings}} binds these
 commands to @kbd{S-right} etc.; doing so disables shift selection for
 those keys (@pxref{Shift Selection}).
 
diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi
index 903090f..d8b70ef 100644
--- a/doc/emacs/xresources.texi
+++ b/doc/emacs/xresources.texi
@@ -1,5 +1,5 @@
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 1987, 1993-1995, 1997, 2001-2018 Free Software
address@hidden Copyright (C) 1987, 1993-1995, 1997, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node X Resources
diff --git a/doc/lispintro/ChangeLog.1 b/doc/lispintro/ChangeLog.1
index 9e15544..2df76f4 100644
--- a/doc/lispintro/ChangeLog.1
+++ b/doc/lispintro/ChangeLog.1
@@ -782,7 +782,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/doc/lispintro/Makefile.in b/doc/lispintro/Makefile.in
index e2a1229..37fffb8 100644
--- a/doc/lispintro/Makefile.in
+++ b/doc/lispintro/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1994-1999, 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-1999, 2001-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/doc/lispintro/README b/doc/lispintro/README
index c39f6d2..fd4ede1 100644
--- a/doc/lispintro/README
+++ b/doc/lispintro/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/doc/lispintro/cons-1.eps b/doc/lispintro/cons-1.eps
index cc1d5c7..dff7130 100644
--- a/doc/lispintro/cons-1.eps
+++ b/doc/lispintro/cons-1.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:26:58 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (address@hidden)
 
-% Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/cons-2.eps b/doc/lispintro/cons-2.eps
index 00d08e4..ccba320 100644
--- a/doc/lispintro/cons-2.eps
+++ b/doc/lispintro/cons-2.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:26:39 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (address@hidden)
 
-% Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/cons-2a.eps b/doc/lispintro/cons-2a.eps
index 26f690a..3beaa5b 100644
--- a/doc/lispintro/cons-2a.eps
+++ b/doc/lispintro/cons-2a.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Tue Mar 14 15:09:30 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (address@hidden)
 
-% Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/cons-3.eps b/doc/lispintro/cons-3.eps
index d75620e..6bae8f7 100644
--- a/doc/lispintro/cons-3.eps
+++ b/doc/lispintro/cons-3.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:25:41 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (address@hidden)
 
-% Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/cons-4.eps b/doc/lispintro/cons-4.eps
index 154df88..fd056b5 100644
--- a/doc/lispintro/cons-4.eps
+++ b/doc/lispintro/cons-4.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:25:06 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (address@hidden)
 
-% Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/cons-5.eps b/doc/lispintro/cons-5.eps
index d5c08ac..d3f7581 100644
--- a/doc/lispintro/cons-5.eps
+++ b/doc/lispintro/cons-5.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:27:28 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (address@hidden)
 
-% Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/drawers.eps b/doc/lispintro/drawers.eps
index e3a7f0a..4569b21 100644
--- a/doc/lispintro/drawers.eps
+++ b/doc/lispintro/drawers.eps
@@ -9,7 +9,7 @@
 %%EndComments
 %%BeginProlog
 
-% Copyright (C) 2001-2018 Free Software Foundation, Inc.
+% Copyright (C) 2001-2019 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/emacs-lisp-intro.texi 
b/doc/lispintro/emacs-lisp-intro.texi
index 0b0c0a1..519decb 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -113,7 +113,7 @@ Edition @value{edition-number}, @value{update-date}
 Distributed with Emacs version @value{EMACSVER}.
 @end ifnottex
 @sp 1
-Copyright @copyright{} 1990--1995, 1997, 2001--2018 Free Software
+Copyright @copyright{} 1990--1995, 1997, 2001--2019 Free Software
 Foundation, Inc.
 @sp 1
 
@@ -4636,7 +4636,7 @@ languages, not just Lisp, and C, and it works with 
non-programming
 text as well.  For example, @code{xref-find-definitions} will jump to
 the various nodes in the Texinfo source file of this document
 (provided that you've run the @command{etags} utility to record all
-the nodes in the manuals that come with Emacs; @pxref{Create tags
+the nodes in the manuals that come with Emacs; @pxref{Create Tags
 Table,,, emacs, The GNU Emacs Manual}).
 
 To use the @code{xref-find-definitions} command, type @kbd{M-.}
@@ -14825,7 +14825,7 @@ According to its documentation as shown by @kbd{C-h f} 
(the
 @code{describe-function} command), the @code{find-file-noselect}
 function reads the named file into a buffer and returns the buffer.
 (Its most recent version includes an optional @var{wildcards} argument,
-too, as well as another to read a file literally and an other you
+too, as well as another to read a file literally and another to
 suppress warning messages.  These optional arguments are irrelevant.)
 
 However, the @code{find-file-noselect} function does not select the
@@ -15599,7 +15599,7 @@ like this:
    (recursive-lengths-list-many-files
     (files-in-below-directory "/usr/local/src/emacs/lisp/"))
    '<)
-  (insert (format "%s" (current-time-string))))
+  (insert (current-time-string)))
 @end ignore
 
 @node Counting function definitions
diff --git a/doc/lispintro/lambda-1.eps b/doc/lispintro/lambda-1.eps
index 4b6d827..a78a60c 100644
--- a/doc/lispintro/lambda-1.eps
+++ b/doc/lispintro/lambda-1.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:31:53 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (address@hidden)
 
-% Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/lambda-2.eps b/doc/lispintro/lambda-2.eps
index 473785c..a7c2e7b 100644
--- a/doc/lispintro/lambda-2.eps
+++ b/doc/lispintro/lambda-2.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:33:09 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (address@hidden)
 
-% Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispintro/lambda-3.eps b/doc/lispintro/lambda-3.eps
index c1a2516..d73a9d6 100644
--- a/doc/lispintro/lambda-3.eps
+++ b/doc/lispintro/lambda-3.eps
@@ -4,7 +4,7 @@
 %%CreationDate: Wed Mar  8 14:33:49 1995
 %%Creator: Tgif-2.16-p4 by William Chia-Wei Cheng (address@hidden)
 
-% Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+% Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 %
 % This file is part of GNU Emacs.
 %
diff --git a/doc/lispref/ChangeLog.1 b/doc/lispref/ChangeLog.1
index 42240ae..a271d21 100644
--- a/doc/lispref/ChangeLog.1
+++ b/doc/lispref/ChangeLog.1
@@ -13989,7 +13989,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1998-2018 Free Software Foundation, Inc.
+  Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/doc/lispref/Makefile.in b/doc/lispref/Makefile.in
index 221f4f9..5de04a7 100644
--- a/doc/lispref/Makefile.in
+++ b/doc/lispref/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1990-1996, 1998-2018 Free Software Foundation, Inc.
+# Copyright (C) 1990-1996, 1998-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/doc/lispref/README b/doc/lispref/README
index cca4338..3e121bf 100644
--- a/doc/lispref/README
+++ b/doc/lispref/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2018 Free Software Foundation, Inc.  -*- outline -*-
+Copyright (C) 2001-2019 Free Software Foundation, Inc.  -*- outline -*-
 See the end of the file for license conditions.
 
 
diff --git a/doc/lispref/abbrevs.texi b/doc/lispref/abbrevs.texi
index 1e9471b..b67c014 100644
--- a/doc/lispref/abbrevs.texi
+++ b/doc/lispref/abbrevs.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1994, 1999, 2001-2018 Free Software 
Foundation,
address@hidden Copyright (C) 1990-1994, 1999, 2001-2019 Free Software 
Foundation,
 @c Inc.
 @c See the file elisp.texi for copying conditions.
 @node Abbrevs
@@ -473,7 +473,7 @@ Set the property @var{prop} of abbrev table @var{table} to 
value @var{val}.
 
 @defun abbrev-table-get table prop
 Return the property @var{prop} of abbrev table @var{table}, or @code{nil}
-if the abbrev has no such property.
+if @var{table} has no such property.
 @end defun
 
 The following properties have special meaning:
diff --git a/doc/lispref/anti.texi b/doc/lispref/anti.texi
index 556203b..6066e26 100644
--- a/doc/lispref/anti.texi
+++ b/doc/lispref/anti.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1999, 2002-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 1999, 2002-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 
 @c This node must have no pointers.
diff --git a/doc/lispref/back.texi b/doc/lispref/back.texi
index df39479..c4c3466 100644
--- a/doc/lispref/back.texi
+++ b/doc/lispref/back.texi
@@ -1,6 +1,6 @@
 \input texinfo  @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 2001-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2001-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @c
 @c %**start of header
diff --git a/doc/lispref/backups.texi b/doc/lispref/backups.texi
index 8ce8f61..6a5b6d1 100644
--- a/doc/lispref/backups.texi
+++ b/doc/lispref/backups.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1999, 2001-2018 Free Software 
Foundation,
address@hidden Copyright (C) 1990-1995, 1999, 2001-2019 Free Software 
Foundation,
 @c Inc.
 @c See the file elisp.texi for copying conditions.
 @node Backups and Auto-Saving
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index b2a4b0e..260f159 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Buffers
@@ -573,7 +573,6 @@ echo area; use @code{set-buffer-modified-p} (above) instead.
 This function returns @var{buffer}'s modification-count.  This is a
 counter that increments every time the buffer is modified.  If
 @var{buffer} is @code{nil} (or omitted), the current buffer is used.
-The counter can wrap around occasionally.
 @end defun
 
 @defun buffer-chars-modified-tick &optional buffer
@@ -658,7 +657,8 @@ visiting a file or if the time has been explicitly cleared 
by
 too.  For instance, in a Dired buffer listing a directory, it returns
 the last modification time of that directory, as recorded by Dired.
 
-If the buffer is not visiting a file, this function returns @minus{}1.
+If the buffer is visiting a file that doesn't exist, this function
+returns @minus{}1.
 @end defun
 
 @defun set-visited-file-modtime &optional time
@@ -935,6 +935,10 @@ This is a normal hook run whenever the buffer list 
changes.  Functions
 (@pxref{Creating Buffers}), @code{rename-buffer} (@pxref{Buffer Names}),
 @code{kill-buffer} (@pxref{Killing Buffers}), @code{bury-buffer} (see
 above) and @code{select-window} (@pxref{Selecting Windows}).
+
+Functions run by this hook should avoid calling @code{select-window}
+with a nil @var{norecord} argument or @code{with-temp-buffer} since
+either may lead to infinite recursion.
 @end defvar
 
 @node Creating Buffers
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index 427379b..cd44c1c 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Command Loop
@@ -1012,7 +1012,8 @@ If the last event came from a keyboard macro, the value 
is @code{macro}.
 sequence of text that has the @code{display} or @code{composition}
 property, or is invisible.  Therefore, after a command finishes and
 returns to the command loop, if point is within such a sequence, the
-command loop normally moves point to the edge of the sequence.
+command loop normally moves point to the edge of the sequence, making this
+sequence effectively intangible.
 
   A command can inhibit this feature by setting the variable
 @code{disable-point-adjustment}:
@@ -2879,6 +2880,14 @@ command's key sequence (as returned by, e.g., 
@code{this-command-keys}),
 as the events will already have been added once as they were read for
 the first time.  An element of the form @address@hidden(t . @var{event})}}
 forces @var{event} to be added to the current command's key sequence.
+
address@hidden not recording input events
address@hidden input events, prevent recording
+Elements read from this list are normally recorded by the
+record-keeping features (@pxref{Recording Input}) and while defining a
+keyboard macro (@pxref{Keyboard Macros}).  However, an element of the
+form @address@hidden(no-record . @var{event})}} causes @var{event} to be
+processed normally without recording it.
 @end defvar
 
 @defun listify-key-sequence key
diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi
index 6d21ca3..d9db55e 100644
--- a/doc/lispref/compile.texi
+++ b/doc/lispref/compile.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1994, 2001-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 1990-1994, 2001-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Byte Compilation
 @chapter Byte Compilation
diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi
index 0f7502f..5d4184e 100644
--- a/doc/lispref/control.texi
+++ b/doc/lispref/control.texi
@@ -1,11 +1,12 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Control Structures
 @chapter Control Structures
 @cindex special forms for control structures
address@hidden forms for control structures
 @cindex control structures
 
   A Lisp program consists of a set of @dfn{expressions}, or
@@ -48,6 +49,7 @@ structure constructs (@pxref{Macros}).
 @section Sequencing
 @cindex sequencing
 @cindex sequential execution
address@hidden forms for sequential execution
 
   Evaluating forms in the order they appear is the most common way
 control passes from one form to another.  In some contexts, such as in a
@@ -146,6 +148,7 @@ following @var{forms}, in textual order, returning the 
result of
 @node Conditionals
 @section Conditionals
 @cindex conditional evaluation
address@hidden forms, conditional
 
   Conditional control structures choose among alternatives.  Emacs Lisp
 has five conditional forms: @code{if}, which is much the same as in
@@ -419,64 +422,68 @@ This is not completely equivalent because it can evaluate 
@var{arg1} or
 @node Pattern-Matching Conditional
 @section Pattern-Matching Conditional
 @cindex pcase
address@hidden pattern matching
address@hidden pattern matching, programming style
 
 Aside from the four basic conditional forms, Emacs Lisp also
 has a pattern-matching conditional form, the @code{pcase} macro,
 a hybrid of @code{cond} and @code{cl-case}
 (@pxref{Conditionals,,,cl,Common Lisp Extensions})
 that overcomes their limitations and introduces
-the @dfn{pattern matching} programming style.
-First, the limitations:
+the @dfn{pattern matching programming style}.
+The limitations that @code{pcase} overcomes are:
 
 @itemize
address@hidden The @code{cond} form chooses among alternatives
-by evaluating the predicate @var{condition} of each
-of its clauses (@pxref{Conditionals}).
-The primary limitation is that variables let-bound in @var{condition}
-are not available to the clause's @var{body-forms}.
address@hidden
+The @code{cond} form chooses among alternatives by evaluating the
+predicate @var{condition} of each of its clauses
+(@pxref{Conditionals}).  The primary limitation is that variables
+let-bound in @var{condition} are not available to the clause's
address@hidden
 
 Another annoyance (more an inconvenience than a limitation)
 is that when a series of @var{condition} predicates implement
-equality tests, there is a lot of repeated code.
-For that, why not use @code{cl-case}?
+equality tests, there is a lot of repeated code.  (@code{cl-case}
+solves this inconvenience.)
 
 @item
 The @code{cl-case} macro chooses among alternatives by evaluating
 the equality of its first argument against a set of specific
 values.
-The limitations are two-fold:
+
+Its limitations are two-fold:
 
 @enumerate
address@hidden The equality tests use @code{eql}.
address@hidden The values must be known and written in advance.
address@hidden
+The equality tests use @code{eql}.
address@hidden
+The values must be known and written in advance.
 @end enumerate
 
 @noindent
 These render @code{cl-case} unsuitable for strings or compound
-data structures (e.g., lists or vectors).
-For that, why not use @code{cond}?
-(And here we end up in a circle.)
+data structures (e.g., lists or vectors).  (@code{cond} doesn't have
+these limitations, but it has others, see above.)
 @end itemize
 
 @noindent
 Conceptually, the @code{pcase} macro borrows the first-arg focus
 of @code{cl-case} and the clause-processing flow of @code{cond},
 replacing @var{condition} with a generalization of
-the equality test called @dfn{matching},
+the equality test which is a variant of @dfn{pattern matching},
 and adding facilities so that you can concisely express a
 clause's predicate, and arrange to share let-bindings between
 a clause's predicate and @var{body-forms}.
 
 The concise expression of a predicate is known as a @dfn{pattern}.
-When the predicate, called on the value of the first arg,
-returns address@hidden, the pattern matches the value
-(or sometimes ``the value matches the pattern'').
+When the predicate, called on the value of the first arg, returns
address@hidden, we say that ``the pattern matches the value'' (or
+sometimes ``the value matches the pattern'').
 
 @menu
-* The @code{pcase} macro: pcase Macro.  Plus examples and caveats.
+* The @code{pcase} macro: pcase Macro.  Includes examples and caveats.
 * Extending @code{pcase}: Extending pcase.  Define new kinds of patterns.
-* Backquote-Style Patterns: Backquote Patterns.  Structural matching.
+* Backquote-Style Patterns: Backquote Patterns.  Structural patterns matching.
+* Destructuring with pcase Patterns:: Using pcase patterns to extract 
subfields.
 @end menu
 
 @node pcase Macro
@@ -497,26 +504,30 @@ of the last of @var{body-forms} in the successful clause.
 Otherwise, @code{pcase} evaluates to @code{nil}.
 @end defmac
 
-The rest of this subsection
-describes different forms of core patterns,
-presents some examples,
-and concludes with important caveats on using the
-let-binding facility provided by some pattern forms.
-A core pattern can have the following forms:
address@hidden pcase pattern
+Each @var{pattern} has to be a @dfn{pcase pattern}, which can use
+either one of the core patterns defined below, or one of the patterns
+defined via @code{pcase-defmacro} (@pxref{Extending pcase}).
+
+The rest of this subsection describes different forms of core
+patterns, presents some examples, and concludes with important caveats
+on using the let-binding facility provided by some pattern forms.  A
+core pattern can have the following forms:
 
 @table @code
 
 @item _
 Matches any @var{expval}.
-This is known as @dfn{don't care} or @dfn{wildcard}.
+This is also known as @dfn{don't care} or @dfn{wildcard}.
 
 @item '@var{val}
-Matches if @var{expval} is @code{equal} to @var{val}.
+Matches if @var{expval} equals @var{val}.  The comparison is done as
+if by @code{equal} (@pxref{Equality Predicates}).
 
 @item @var{keyword}
 @itemx @var{integer}
 @itemx @var{string}
-Matches if @var{expval} is @code{equal} to the literal object.
+Matches if @var{expval} equals the literal object.
 This is a special case of @code{'@var{val}}, above,
 possible because literal objects of these types are self-quoting.
 
@@ -528,17 +539,17 @@ Matches any @var{expval}, and additionally let-binds 
@var{symbol} to
 If @var{symbol} is part of a sequencing pattern @var{seqpat}
 (e.g., by using @code{and}, below), the binding is also available to
 the portion of @var{seqpat} following the appearance of @var{symbol}.
-This usage has some caveats (@pxref{pcase-symbol-caveats,,caveats}).
+This usage has some caveats, see @ref{pcase-symbol-caveats,,caveats}.
 
 Two symbols to avoid are @code{t}, which behaves like @code{_}
-(above) and is deprecated, and @code{nil}, which signals error.
+(above) and is deprecated, and @code{nil}, which signals an error.
 Likewise, it makes no sense to bind keyword symbols
 (@pxref{Constant Variables}).
 
 @item (pred @var{function})
 Matches if the predicate @var{function} returns address@hidden
 when called on @var{expval}.
address@hidden can have one of the possible forms:
+the predicate @var{function} can have one of the following forms:
 
 @table @asis
 @item function name (a symbol)
@@ -565,20 +576,17 @@ the actual function call becomes: @address@hidden(= 42 
@var{expval})}}.
 @item (app @var{function} @var{pattern})
 Matches if @var{function} called on @var{expval} returns a
 value that matches @var{pattern}.
address@hidden can take one of the
-forms described for @code{pred}, above.
-Unlike @code{pred}, however,
address@hidden tests the result against @var{pattern},
-rather than against a boolean truth value.
address@hidden can take one of the forms described for @code{pred},
+above.  Unlike @code{pred}, however, @code{app} tests the result
+against @var{pattern}, rather than against a boolean truth value.
 
 @item (guard @var{boolean-expression})
 Matches if @var{boolean-expression} evaluates to address@hidden
 
 @item (let @var{pattern} @var{expr})
-Evaluates @var{expr} to get @var{exprval}
-and matches if @var{exprval} matches @var{pattern}.
-(It is called @code{let} because
address@hidden can bind symbols to values using @var{symbol}.)
+Evaluates @var{expr} to get @var{exprval} and matches if @var{exprval}
+matches @var{pattern}.  (It is called @code{let} because @var{pattern}
+can bind symbols to values using @var{symbol}.)
 @end table
 
 @cindex sequencing pattern
@@ -591,18 +599,16 @@ but instead of processing values, they process 
sub-patterns.
 
 @table @code
 @item (and @address@hidden)
-Attempts to match @address@hidden, in order,
-until one of them fails to match.
-In that case, @code{and} likewise fails to match,
-and the rest of the sub-patterns are not tested.
-If all sub-patterns match, @code{and} matches.
+Attempts to match @address@hidden, in order, until one of them
+fails to match.  In that case, @code{and} likewise fails to match, and
+the rest of the sub-patterns are not tested.  If all sub-patterns
+match, @code{and} matches.
 
 @item (or @var{pattern1} @address@hidden)
 Attempts to match @var{pattern1}, @var{pattern2}, @dots{}, in order,
-until one of them succeeds.
-In that case, @code{or} likewise matches,
-and the rest of the sub-patterns are not tested.
-(Note that there must be at least two sub-patterns.
+until one of them succeeds.  In that case, @code{or} likewise matches,
+and the rest of the sub-patterns are not tested.  (Note that there
+must be at least two sub-patterns.
 Simply @address@hidden(or @var{pattern1})}} signals error.)
 @c Issue: Is this correct and intended?
 @c        Are there exceptions, qualifications?
@@ -1037,12 +1043,11 @@ Both use a single backquote construct 
(@pxref{Backquote}).
 
 This subsection describes @dfn{backquote-style patterns},
 a set of builtin patterns that eases structural matching.
-For background, @xref{Pattern-Matching Conditional}.
+For background, @pxref{Pattern-Matching Conditional}.
 
address@hidden patterns} are a powerful set of
address@hidden pattern extensions (created using @code{pcase-defmacro})
-that make it easy to match @var{expval} against
-specifications of its @emph{structure}.
+Backquote-style patterns are a powerful set of @code{pcase} pattern
+extensions (created using @code{pcase-defmacro}) that make it easy to
+match @var{expval} against specifications of its @emph{structure}.
 
 For example, to match @var{expval} that must be a list of two
 elements whose first element is a specific string and the second
@@ -1166,10 +1171,110 @@ evaluation results:
 (evaluate '(sub 1 2) nil)                 @result{} error
 @end example
 
address@hidden Destructuring with pcase Patterns
address@hidden Destructuring with @code{pcase} Patterns
address@hidden destructuring with pcase patterns
+
+Pcase patterns not only express a condition on the form of the objects
+they can match, but they can also extract sub-fields of those objects.
+For example we can extract 2 elements from a list that is the value of
+the variable @code{my-list} with the following code:
+
address@hidden
+  (pcase my-list
+    (`(add ,x ,y)  (message "Contains %S and %S" x y)))
address@hidden example
+
+This will not only extract @code{x} and @code{y} but will additionally
+test that @code{my-list} is a list containing exactly 3 elements and
+whose first element is the symbol @code{add}.  If any of those tests
+fail, @code{pcase} will immediately return @code{nil} without calling
address@hidden
+
+Extraction of multiple values stored in an object is known as
address@hidden  Using @code{pcase} patterns allows to perform
address@hidden binding}, which is similar to a local binding
+(@pxref{Local Variables}), but gives values to multiple elements of
+a variable by extracting those values from an object of compatible
+structure.
+
+The macros described in this section use @code{pcase} patterns to
+perform destructuring binding.  The condition of the object to be of
+compatible structure means that the object must match the pattern,
+because only then the object's subfields can be extracted.  For
+example:
+
address@hidden
+  (pcase-let ((`(add ,x ,y) my-list))
+    (message "Contains %S and %S" x y))
address@hidden example
+
address@hidden
+does the same as the previous example, except that it directly tries
+to extract @code{x} and @code{y} from @code{my-list} without first
+verifying if @code{my-list} is a list which has the right number of
+elements and has @code{add} as its first element.  The precise
+behavior when the object does not actually match the pattern is
+undefined, although the body will not be silently skipped: either an
+error is signaled or the body is run with some of the variables
+potentially bound to arbitrary values like @code{nil}.
+
+The pcase patterns that are useful for destructuring bindings are
+generally those described in @ref{Backquote Patterns}, since they
+express a specification of the structure of objects that will match.
+
+For an alternative facility for destructuring binding, see
address@hidden
+
address@hidden pcase-let bindings address@hidden
+Perform destructuring binding of variables according to
address@hidden, and then evaluate @var{body}.
+
address@hidden is a list of bindings of the form @address@hidden(@var{pattern}
address@hidden)}}, where @var{exp} is an expression to evaluate and
address@hidden is a @code{pcase} pattern.
+
+All @var{exp}s are evaluated first, after which they are matched
+against their respective @var{pattern}, introducing new variable
+bindings that can then be used inside @var{body}.  The variable
+bindings are produced by destructuring binding of elements of
address@hidden to the values of the corresponding elements of the
+evaluated @var{exp}.
address@hidden defmac
+
address@hidden pcase-let* bindings address@hidden
+Perform destructuring binding of variables according to
address@hidden, and then evaluate @var{body}.
+
address@hidden is a list of bindings of the form @code{(@var{pattern}
address@hidden)}, where @var{exp} is an expression to evaluate and
address@hidden is a @code{pcase} pattern.  The variable bindings are
+produced by destructuring binding of elements of @var{pattern} to the
+values of the corresponding elements of the evaluated @var{exp}.
+
+Unlike @code{pcase-let}, but similarly to @code{let*}, each @var{exp}
+is matched against its corresponding @var{pattern} before processing
+the next element of @var{bindings}, so the variable bindings
+introduced in each one of the @var{bindings} are available in the
address@hidden of the @var{bindings} that follow it, additionally to
+being available in @var{body}.
address@hidden defmac
+
address@hidden pcase-dolist (pattern list) address@hidden
+Execute @var{body} once for each element of @var{list}, on each
+iteration performing a destructuring binding of variables in
address@hidden to the values of the corresponding subfields of the
+element of @var{list}.  The bindings are performed as if by
address@hidden  When @var{pattern} is a simple variable, this ends
+up being equivalent to @code{dolist} (@pxref{Iteration}).
address@hidden defmac
+
+
 @node Iteration
 @section Iteration
 @cindex iteration
 @cindex recursion
address@hidden forms, iteration
 
   Iteration means executing part of a program repetitively.  For
 example, you might want to repeat some computation once for each element
@@ -1394,6 +1499,7 @@ exited.
 
 @node Catch and Throw
 @subsection Explicit Nonlocal Exits: @code{catch} and @code{throw}
address@hidden forms for nonlocal exits
 
   Most control constructs affect only the flow of control within the
 construct itself.  The function @code{throw} is the exception to this
@@ -1765,6 +1871,7 @@ variables precisely as they were at the time of the error.
 @subsubsection Writing Code to Handle Errors
 @cindex error handler
 @cindex handling errors
address@hidden forms for handling errors
 
   The usual effect of signaling an error is to terminate the command
 that is running and return immediately to the Emacs editor command loop.
@@ -2134,6 +2241,7 @@ and their conditions.
 @node Cleanups
 @subsection Cleaning Up from Nonlocal Exits
 @cindex nonlocal exits, cleaning up
address@hidden forms for cleanup
 
   The @code{unwind-protect} construct is essential whenever you
 temporarily put a data structure in an inconsistent state; it permits
diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi
index 1cc7cb6..f71dedf 100644
--- a/doc/lispref/customize.texi
+++ b/doc/lispref/customize.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1997-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 1997-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Customization
 @chapter Customization Settings
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 89927db..9e43343 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1994, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1994, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Debugging
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index b4a4d6c..a97aabe 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 1990-1995, 1998-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Display
 @chapter Emacs Display
@@ -1034,8 +1034,8 @@ hiding certain lines on the screen.
 @cindex explicit selective display
   The first variant, explicit selective display, was designed for use in a Lisp
 program: it controls which lines are hidden by altering the text.  This kind of
-hiding is now obsolete; instead you can get the same effect with the
address@hidden property (@pxref{Invisible Text}).
+hiding is now obsolete and deprecated; instead you should use the
address@hidden property (@pxref{Invisible Text}) to get the same effect.
 
   In the second variant, the choice of lines to hide is made
 automatically based on indentation.  This variant is designed to be a
@@ -3079,10 +3079,17 @@ value, which inherits from @var{face}'s global 
definition.
 This function returns a list of all defined face names.
 @end defun
 
address@hidden face number
address@hidden face property of face symbols
 @defun face-id face
 This function returns the @dfn{face number} of face @var{face}.  This
 is a number that uniquely identifies a face at low levels within
 Emacs.  It is seldom necessary to refer to a face by its face number.
+However, functions that manipulate glyphs, such as
address@hidden and @code{glyph-face} (@pxref{Glyphs}) access
+the face numbers internally.  Note that the face number is stored as
+the value of the @code{face} property of the face symbol, so we
+recommend not to set that property of a face to any value of your own.
 @end defun
 
 @defun face-documentation face
@@ -3950,6 +3957,9 @@ fringe, and likewise @var{right} for the right fringe.  A 
value of
 @var{outside-margins} is address@hidden, that specifies that fringes
 should appear outside of the display margins.
 
+If @var{window} is not large enough to accommodate fringes of the
+desired width, this leaves the fringes of @var{window} unchanged.
+
 The values specified here may be later overridden by invoking
 @code{set-window-buffer} (@pxref{Buffers and Windows}) on @var{window}
 with its @var{keep-margins} argument @code{nil} or omitted.
@@ -4371,6 +4381,9 @@ vertical scroll bar.
 The possible values are @code{bottom}, @code{t}, which means to use the
 frame's default, and @code{nil} for no horizontal scroll bar.
 
+If @var{window} is not large enough to accommodate a scroll bar of the
+desired dimension, this leaves the corresponding scroll bar unchanged.
+
 The values specified here may be later overridden by invoking
 @code{set-window-buffer} (@pxref{Buffers and Windows}) on @var{window}
 with its @var{keep-margins} argument @code{nil} or omitted.
@@ -4887,6 +4900,16 @@ and the buffer position where the @code{display} 
property was found,
 respectively.  Both positions can be different when @code{object} is a
 string.
 
+Note that @var{condition} will only be evaluated when redisplay
+examines the text where this display spec is located, so this feature
+is best suited for conditions that are relatively stable, i.e.@:
+yield, for each particular buffer position, the same results on every
+evaluation.  If the results change for the same text location, e.g.,
+if the result depends on the position of point, then the conditional
+specification might not do what you want, because redisplay examines
+only those parts of buffer text where it has reasons to assume that
+something changed since the last display cycle.
+
 @node Display Margins
 @subsection Displaying in the Margins
 @cindex display margins
@@ -4950,6 +4973,9 @@ This function specifies the margin widths for window 
@var{window}, in
 character cell units.  The argument @var{left} controls the left
 margin, and @var{right} controls the right margin (default @code{0}).
 
+If @var{window} is not large enough to accommodate margins of the
+desired width, this leaves the margins of @var{window} unchanged.
+
 The values specified here may be later overridden by invoking
 @code{set-window-buffer} (@pxref{Buffers and Windows}) on @var{window}
 with its @var{keep-margins} argument @code{nil} or omitted.
@@ -5112,6 +5138,47 @@ This adds a shadow rectangle around the image.  The 
value,
 @var{relief} is negative, shadows are drawn so that the image appears
 as a pressed button; otherwise, it appears as an unpressed button.
 
address@hidden :width @var{width}, :height @var{height}
+The @code{:width} and @code{:height} keywords are used for scaling the
+image.  If only one of them is specified, the other one will be
+calculated so as to preserve the aspect ratio.  If both are specified,
+aspect ratio may not be preserved.
+
address@hidden :max-width @var{max-width}, :max-height @var{max-height}
+The @code{:max-width} and @code{:max-height} keywords are used for
+scaling if the size of the image exceeds these values.  If
address@hidden:width} is set, it will have precedence over @code{max-width},
+and if @code{:height} is set, it will have precedence over
address@hidden, but you can otherwise mix these keywords as you
+wish.
+
+If both @code{:max-width} and @code{:height} are specified, but
address@hidden:width} is not, preserving the aspect ratio might require that
+width exceeds @code{:max-width}.  If this happens, scaling will use a
+smaller value for the height so as to preserve the aspect ratio while
+not exceeding @code{:max-width}.  Similarly when both
address@hidden:max-height} and @code{:width} are specified, but @code{:height}
+is not.  For example, if you have a 200x100 image and specify that
address@hidden:width} should be 400 and @code{:max-height} should be 150,
+you'll end up with an image that is 300x150: Preserving the aspect
+ratio and not exceeding the ``max'' setting.  This combination of
+parameters is a useful way of saying ``display this image as large as
+possible, but no larger than the available display area''.
+
address@hidden :scale @var{scale}
+This should be a number, where values higher than 1 means to increase
+the size, and lower means to decrease the size, by multiplying both
+the width and height.  For instance, a value of 0.25 will make the
+image a quarter size of what it originally was.  If the scaling makes
+the image larger than specified by @code{:max-width} or
address@hidden:max-height}, the resulting size will not exceed those two
+values.  If both @code{:scale} and @code{:height}/@code{:width} are
+specified, the height/width will be adjusted by the specified scaling
+factor.
+
address@hidden :index @var{frame}
address@hidden Images}.
+
 @item :conversion @var{algorithm}
 This specifies a conversion algorithm that should be applied to the
 image before it is displayed; the value, @var{algorithm}, specifies
@@ -5251,6 +5318,16 @@ This function returns @code{t} if image @var{spec} has a 
mask bitmap.
 (@pxref{Input Focus}).
 @end defun
 
address@hidden image-scaling-p &optional frame
+This function returns @code{t} if @var{frame} supports image scaling.
address@hidden @code{nil} or omitted means to use the selected frame
+(@pxref{Input Focus}).
+
+If image scaling is not supported, @code{:width}, @code{:height},
address@hidden:scale}, @code{:max-width} and @code{:max-height} will only be
+usable through ImageMagick, if available (@pxref{ImageMagick Images}).
address@hidden defun
+
 @node XBM Images
 @subsection XBM Images
 @cindex XBM
@@ -5387,42 +5464,6 @@ color, which is used as the image's background color if 
the image
 supports transparency.  If the value is @code{nil}, it defaults to the
 frame's background color.
 
address@hidden :width @var{width}, :height @var{height}
-The @code{:width} and @code{:height} keywords are used for scaling the
-image.  If only one of them is specified, the other one will be
-calculated so as to preserve the aspect ratio.  If both are specified,
-aspect ratio may not be preserved.
-
address@hidden :max-width @var{max-width}, :max-height @var{max-height}
-The @code{:max-width} and @code{:max-height} keywords are used for
-scaling if the size of the image of the image exceeds these values.
-If @code{:width} is set it will have precedence over @code{max-width},
-and if @code{:height} is set it will have precedence over
address@hidden, but you can otherwise mix these keywords as you
-wish.  @code{:max-width} and @code{:max-height} will always preserve
-the aspect ratio.
-
-If both @code{:width} and @code{:max-height} has been set (but
address@hidden:height} has not been set), then @code{:max-height} will have
-precedence.  The same is the case for the opposite combination: The
-``max'' keyword has precedence.  That is, if you have a 200x100 image
-and specify that @code{:width} should be 400 and @code{:max-height}
-should be 150, you'll end up with an image that is 300x150: Preserving
-the aspect ratio and not exceeding the ``max'' setting.  This
-combination of parameters is a useful way of saying ``display this
-image as large as possible, but no larger than the available display
-area''.
-
address@hidden :scale @var{scale}
-This should be a number, where values higher than 1 means to increase
-the size, and lower means to decrease the size.  For instance, a value
-of 0.25 will make the image a quarter size of what it originally was.
-If the scaling makes the image larger than specified by
address@hidden:max-width} or @code{:max-height}, the resulting size will not
-exceed those two values.  If both @code{:scale} and
address@hidden:height}/@code{:width} are specified, the height/width will be
-adjusted by the specified scaling factor.
-
 @item :format @var{type}
 The value, @var{type}, should be a symbol specifying the type of the
 image data, as found in @code{image-format-suffixes}.  This is used
@@ -5431,9 +5472,6 @@ hint to ImageMagick to help it detect the image type.
 
 @item :rotation @var{angle}
 Specifies a rotation angle in degrees.
-
address@hidden :index @var{frame}
address@hidden Images}.
 @end table
 
 @node SVG Images
diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi
index 2aace03..2c0ee39 100644
--- a/doc/lispref/edebug.texi
+++ b/doc/lispref/edebug.texi
@@ -1,6 +1,6 @@
 @comment -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1992-1994, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1992-1994, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index 0b84629..e187596 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -99,7 +99,7 @@ This is the @cite{GNU Emacs Lisp Reference Manual}
 @end ifnottex
 corresponding to Emacs version @value{EMACSVER}.
 
-Copyright @copyright{} 1990--1996, 1998--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1990--1996, 1998--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -1045,9 +1045,7 @@ Windows
 * Cyclic Window Ordering::  Moving around the existing windows.
 * Buffers and Windows::     Each window displays the contents of a buffer.
 * Switching Buffers::       Higher-level functions for switching to a buffer.
-* Choosing Window::         How to choose a window for displaying a buffer.
-* Display Action Functions:: Subroutines for @code{display-buffer}.
-* Choosing Window Options:: Extra options affecting how buffers are displayed.
+* Displaying Buffers::      Displaying a buffer in a suitable window.
 * Window History::          Each window remembers the buffers displayed in it.
 * Dedicated Windows::       How to avoid displaying another buffer in
                               a specific window.
@@ -1069,6 +1067,18 @@ Windows
                               redisplay going past a certain point,
                               or window configuration changes.
 
+Displaying Buffers
+
+* Choosing Window::         How to choose a window for displaying a buffer.
+* Buffer Display Action Functions:: Support functions for buffer display.
+* Buffer Display Action Alists:: Alists for fine-tuning buffer display
+                              action functions.
+* Choosing Window Options:: Extra options affecting how buffers are displayed.
+* Precedence of Action Functions:: A tutorial explaining the precedence of
+                              buffer display action functions.
+* The Zen of Buffer Display:: How to avoid that buffers get lost in between
+                              windows.
+
 Side Windows
 
 * Displaying Buffers in Side Windows:: An action function for displaying
diff --git a/doc/lispref/errors.texi b/doc/lispref/errors.texi
index e61ea98..aa99b2b 100644
--- a/doc/lispref/errors.texi
+++ b/doc/lispref/errors.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1993, 1999, 2001-2018 Free Software 
Foundation,
address@hidden Copyright (C) 1990-1993, 1999, 2001-2019 Free Software 
Foundation,
 @c Inc.
 @c See the file elisp.texi for copying conditions.
 @node Standard Errors
diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi
index c9401be..db42dfb 100644
--- a/doc/lispref/eval.texi
+++ b/doc/lispref/eval.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1994, 1998, 2001-2018 Free Software 
Foundation,
address@hidden Copyright (C) 1990-1994, 1998, 2001-2019 Free Software 
Foundation,
 @c Inc.
 @c See the file elisp.texi for copying conditions.
 @node Evaluation
@@ -128,6 +128,7 @@ with the other types, which are self-evaluating forms.
 @cindex vector evaluation
 @cindex literal evaluation
 @cindex self-evaluating form
address@hidden form, self-evaluating
 
   A @dfn{self-evaluating form} is any form that is not a list or
 symbol.  Self-evaluating forms evaluate to themselves: the result of
@@ -180,6 +181,8 @@ program.  Here is an example:
 @node Symbol Forms
 @subsection Symbol Forms
 @cindex symbol evaluation
address@hidden symbol forms
address@hidden forms, symbol
 
   When a symbol is evaluated, it is treated as a variable.  The result
 is the variable's value, if it has one.  If the symbol has no value as
@@ -216,6 +219,7 @@ its value ordinarily cannot be changed.  @xref{Constant 
Variables}.
 @node Classifying Lists
 @subsection Classification of List Forms
 @cindex list form evaluation
address@hidden forms, list
 
   A form that is a nonempty list is either a function call, a macro
 call, or a special form, according to its first element.  These three
@@ -350,6 +354,7 @@ Here is how you could define @code{indirect-function} in 
Lisp:
 @subsection Evaluation of Function Forms
 @cindex function form evaluation
 @cindex function call
address@hidden forms, function call
 
   If the first element of a list being evaluated is a Lisp function
 object, byte-code object or primitive function object, then that list is
@@ -373,6 +378,7 @@ body form becomes the value of the function call.
 @node Macro Forms
 @subsection Lisp Macro Evaluation
 @cindex macro call evaluation
address@hidden forms, macro call
 
   If the first element of a list being evaluated is a macro object, then
 the list is a @dfn{macro call}.  When a macro call is evaluated, the
@@ -419,6 +425,7 @@ expansion.
 @node Special Forms
 @subsection Special Forms
 @cindex special forms
address@hidden forms, special
 @cindex evaluation of special forms
 
   A @dfn{special form} is a primitive function specially marked so that
@@ -540,6 +547,7 @@ described in @ref{Autoload}.
 
 @node Quoting
 @section Quoting
address@hidden forms, quote
 
   The special form @code{quote} returns its single argument, as written,
 without evaluating it.  This provides a way to include constant symbols
@@ -599,6 +607,7 @@ only part of a list, while computing and substituting other 
parts.
 @cindex backquote (list substitution)
 @cindex ` (list substitution)
 @findex `
address@hidden forms, backquote
 
   @dfn{Backquote constructs} allow you to quote a list, but
 selectively evaluate elements of that list.  In the simplest case, it
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 5682919..af16b1c 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Files
@@ -16,7 +16,7 @@ described in @ref{Backups and Auto-Saving}.
 names.  A file name is a string.  Most of these functions expand file
 name arguments using the function @code{expand-file-name}, so that
 @file{~} is handled correctly, as are relative file names (including
address@hidden/}).  @xref{File Name Expansion}.
address@hidden/} and the empty string).  @xref{File Name Expansion}.
 
   In addition, certain @dfn{magic} file names are handled specially.
 For example, when a remote file name is specified, Emacs accesses the
@@ -550,7 +550,7 @@ the functions in the list 
@code{after-insert-file-functions}.
 (@pxref{Coding Systems}) used for decoding the file's contents,
 including end-of-line conversion.  However, if the file contains null
 bytes, it is by default visited without any code conversions.
address@hidden and Coding Systems, inhibit-null-byte-detection}.
address@hidden and Coding Systems, inhibit-nul-byte-detection}.
 
 If @var{visit} is address@hidden, this function additionally marks the
 buffer as unmodified and sets up various fields in the buffer so that it
@@ -1306,7 +1306,7 @@ The file's @acronym{GID}, likewise 
(@code{file-attribute-group-id}).
 
 @item
 The time of last access as a Lisp timestamp
-(@code{file-attribute-status-change-time}).  The timestamp is in the
+(@code{file-attribute-access-time}).  The timestamp is in the
 style of @code{current-time} (@pxref{Time of Day}) and is truncated
 to that of the filesystem's timestamp resolution; for example, on some
 FAT-based filesystems, only the date of last access is recorded, so
@@ -2367,8 +2367,10 @@ start with @samp{~}.)  Otherwise, the current buffer's 
value of
 @end example
 
 If the part of @var{filename} before the first slash is
address@hidden, it expands to the value of the @env{HOME} environment
-variable (usually your home directory).  If the part before the first
address@hidden, it expands to your home directory, which is typically
+specified by the value of the @env{HOME} environment variable
+(@pxref{General Variables,,, emacs, The GNU Emacs Manual}).
+If the part before the first
 slash is @address@hidden and if @var{user} is a valid login name,
 it expands to @var{user}'s home directory.
 If you do not want this expansion for a relative @var{filename} that
@@ -2400,6 +2402,17 @@ This is for the sake of filesystems that have the 
concept of a
 superroot above the root directory @file{/}.  On other filesystems,
 @file{/../} is interpreted exactly the same as @file{/}.
 
+Expanding @file{.} or the empty string returns the default directory:
+
address@hidden
address@hidden
+(expand-file-name "." "/usr/spool/")
+     @result{} "/usr/spool"
+(expand-file-name "" "/usr/spool/")
+     @result{} "/usr/spool"
address@hidden group
address@hidden example
+
 Note that @code{expand-file-name} does @emph{not} expand environment
 variables; only @code{substitute-in-file-name} does that:
 
@@ -2510,9 +2523,9 @@ with @samp{/:}.
 @defmac file-name-quote name
 This macro adds the quotation prefix @samp{/:} to the file @var{name}.
 For a local file @var{name}, it prefixes @var{name} with @samp{/:}.
-If @var{name} is a remote file name, the local part of @var{name} is
-quoted.  If @var{name} is already a quoted file name, @var{name} is
-returned unchanged.
+If @var{name} is a remote file name, the local part of @var{name}
+(@pxref{Magic File Names}) is quoted.  If @var{name} is already a
+quoted file name, @var{name} is returned unchanged.
 
 @example
 @group
@@ -2691,8 +2704,8 @@ that remote host.  If such a directory does not exist, or
 @code{temporary-file-directory} is returned.
 @end defun
 
-In order to extract the local part of the path name from a temporary
-file, @code{file-local-name} could be used.
+In order to extract the local part of the file's name of a temporary
+file, use @code{file-local-name} (@pxref{Magic File Names}).
 
 @node File Name Completion
 @subsection File Name Completion
@@ -3065,7 +3078,7 @@ expression to define the class of names (all those that 
match the
 regular expression), plus a handler that implements all the primitive
 Emacs file operations for file names that match.
 
address@hidden file handler
address@hidden file name handler
 @vindex file-name-handler-alist
   The variable @code{file-name-handler-alist} holds a list of handlers,
 together with regular expressions that determine when to apply each
@@ -3169,6 +3182,7 @@ first, before handlers for jobs such as remote file 
access.
 @code{make-directory},
 @code{make-directory-internal},
 @code{make-nearby-temp-file},
address@hidden,
 @code{make-symbolic-link},@*
 @code{process-file},
 @code{rename-file}, @code{set-file-acl}, @code{set-file-modes},
@@ -3225,6 +3239,7 @@ first, before handlers for jobs such as remote file 
access.
 @code{make-auto-save-file-name},
 @address@hidden,
 @address@hidden,
address@hidden,
 @code{make-symbolic-link},
 @code{process-file},
 @code{rename-file}, @code{set-file-acl}, @code{set-file-modes},
@@ -3352,8 +3367,8 @@ If @code{file-remote-p} returns the same identifier for 
two different
 filenames, that means they are stored on the same file system and can
 be accessed locally with respect to each other.  This means, for
 example, that it is possible to start a remote process accessing both
-files at the same time.  Implementers of file handlers need to ensure
-this principle is valid.
+files at the same time.  Implementers of file name handlers need to
+ensure this principle is valid.
 
 @var{identification} specifies which part of the identifier shall be
 returned as string.  @var{identification} can be the symbol
@@ -3381,11 +3396,24 @@ non-magic directory to serve as its current directory, 
and this function
 is a good way to come up with one.
 @end defun
 
address@hidden local part of remote file name
 @defun file-local-name filename
-This function returns the local part of file @var{filename}.  For a
-remote @var{filename}, it returns a file name which could be used
-directly as argument of a remote process.  If @var{filename} is local,
-this function returns the file name.
+This function returns the @dfn{local part} of @var{filename}.  This is
+the part of the file's name that identifies it on the remote host, and
+is typically obtained by removing from the remote file name the parts
+that specify the remote host and the method of accessing it.  For
+example:
+
address@hidden
+(file-local-name "/ssh:@var{user}@@@var{host}:/foo/bar")
+     @result{} "/foo/bar"
address@hidden smallexample
+
+For a remote @var{filename}, this function returns a file name which
+could be used directly as an argument of a remote process
+(@pxref{Asynchronous Processes}, and @pxref{Synchronous Processes}),
+and as the program to run on the remote host.  If @var{filename} is
+local, this function returns it unchanged.
 @end defun
 
 @defopt remote-file-name-inhibit-cache
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index ba4b931..9b3e02f 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Frames
@@ -440,6 +440,17 @@ This function returns the attributes of the physical 
monitor
 dominating (see above) @var{frame}, which defaults to the selected frame.
 @end defun
 
+On multi-monitor displays it is possible to use the command
address@hidden to make frames on the specified monitor.
+
address@hidden Command make-frame-on-monitor monitor &optional display 
parameters
+This function creates and returns a new frame on @var{monitor} located
+on @var{display}, taking the other frame parameters from the alist
address@hidden  @var{monitor} should be the name of the physical
+monitor, the same string as returned by the function
address@hidden in the attribute @code{name}.
address@hidden should be the name of an X display (a string).
address@hidden deffn
 
 @node Frame Geometry
 @section Frame Geometry
@@ -503,7 +514,7 @@ Height |  | | Height                           | |  | Height
 In practice not all of the areas shown in the drawing will or may be
 present.  The meaning of these areas is described below.
 
address@hidden @samp
address@hidden @asis
 @item Outer Frame
 @cindex outer frame
 @cindex outer edges
@@ -1873,6 +1884,12 @@ minibuffer window to @code{t} and vice-versa, or from 
@code{t} to
 @code{nil}.  If the parameter specifies a minibuffer window already,
 setting it to @code{nil} has no effect.
 
+The special value @code{child-frame} means to make a minibuffer-only
+child frame (@pxref{Child Frames}) whose parent becomes the frame
+created.  As if specified as @code{nil}, Emacs will set this parameter
+to the minibuffer window of the child frame but will not select the
+child frame after its creation.
+
 @vindex address@hidden, a frame parameter}
 @item buffer-predicate
 The buffer-predicate function for this frame.  The function
@@ -3203,9 +3220,17 @@ top-level frame which also always appears on top of its 
parent
 window---the desktop's root window.  When a parent frame is iconified or
 made invisible (@pxref{Visibility of Frames}), its child frames are made
 invisible.  When a parent frame is deiconified or made visible, its
-child frames are made visible.  When a parent frame is about to be
-deleted (@pxref{Deleting Frames}), its child frames are recursively
-deleted before it.
+child frames are made visible.
+
+  When a parent frame is about to be deleted (@pxref{Deleting
+Frames}), its child frames are recursively deleted before it.  There
+is one exception to this rule: When the child frame serves as a
+surrogate minibuffer frame (@pxref{Minibuffers and Frames}) for
+another frame, it is retained until the parent frame has been deleted.
+If, at this time, no remaining frame uses the child frame as its
+minibuffer frame, Emacs will try to delete the child frame too.  If
+that deletion fails for whatever reason, the child frame is made a
+top-level frame.
 
   Whether a child frame can have a menu or tool bar is window-system or
 window manager dependent.  Most window-systems explicitly disallow menus
@@ -3261,11 +3286,11 @@ and should be preferred when specifying a address@hidden
 @code{drag-with-mode-line} parameter.
 
   When a child frame is used for displaying a buffer via
address@hidden (@pxref{Display Action Functions}),
-the frame's @code{auto-hide-function} parameter (@pxref{Frame
-Interaction Parameters}) can be set to a function, in order to
-appropriately deal with the frame when the window displaying the buffer
-shall be quit.
address@hidden (@pxref{Buffer Display Action
+Functions}), the frame's @code{auto-hide-function} parameter
+(@pxref{Frame Interaction Parameters}) can be set to a function, in
+order to appropriately deal with the frame when the window displaying
+the buffer shall be quit.
 
   When a child frame is used during minibuffer interaction, for example,
 to display completions in a separate window, the @code{minibuffer-exit}
diff --git a/doc/lispref/functions.texi b/doc/lispref/functions.texi
index 69e9919..222f863 100644
--- a/doc/lispref/functions.texi
+++ b/doc/lispref/functions.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Functions
@@ -1082,15 +1082,18 @@ This macro returns an anonymous function with argument 
list
 @var{args}, documentation string @var{doc} (if any), interactive spec
 @var{interactive} (if any), and body forms given by @var{body}.
 
-In effect, this macro makes @code{lambda} forms self-quoting:
-evaluating a form whose @sc{car} is @code{lambda} yields the form
-itself:
+Under dynamic binding, this macro effectively makes @code{lambda}
+forms self-quoting: evaluating a form whose @sc{car} is @code{lambda}
+yields the form itself:
 
 @example
 (lambda (x) (* x x))
      @result{} (lambda (x) (* x x))
 @end example
 
+Note that when evaluating under lexical binding the result is a
+closure object (@pxref{Closures}).
+
 The @code{lambda} form has one other effect: it tells the Emacs
 evaluator and byte-compiler that its argument is a function, by using
 @code{function} as a subroutine (see below).
diff --git a/doc/lispref/hash.texi b/doc/lispref/hash.texi
index 9c4b56d..5aaf312 100644
--- a/doc/lispref/hash.texi
+++ b/doc/lispref/hash.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1999, 2001-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 1999, 2001-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Hash Tables
 @chapter Hash Tables
diff --git a/doc/lispref/help.texi b/doc/lispref/help.texi
index 2688a2b..63a782c 100644
--- a/doc/lispref/help.texi
+++ b/doc/lispref/help.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Documentation
diff --git a/doc/lispref/hooks.texi b/doc/lispref/hooks.texi
index 0d50a29..7199246 100644
--- a/doc/lispref/hooks.texi
+++ b/doc/lispref/hooks.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1993, 1998, 2001-2018 Free Software 
Foundation,
address@hidden Copyright (C) 1990-1993, 1998, 2001-2019 Free Software 
Foundation,
 @c Inc.
 @c See the file elisp.texi for copying conditions.
 @node Standard Hooks
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 27bfbe8..8ebe47d 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1993, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1993, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node GNU Emacs Internals
@@ -48,24 +48,63 @@ environment.  After this step, the Emacs executable is no 
longer
 @dfn{bare}.
 
 @cindex dumping Emacs
address@hidden @option{--temacs} option, and dumping method
   Because it takes some time to load the standard Lisp files, the
 @file{temacs} executable usually isn't run directly by users.
-Instead, as one of the last steps of building Emacs, the command
address@hidden -batch -l loadup dump} is run.  The special @samp{dump}
-argument causes @command{temacs} to dump out an executable program,
-called @file{emacs}, which has all the standard Lisp files preloaded.
-(The @samp{-batch} argument prevents @file{temacs} from trying to
-initialize any of its data on the terminal, so that the tables of
-terminal information are empty in the dumped Emacs.)
+Instead, one of the last steps of building Emacs runs the command
address@hidden@samp{temacs -batch -l loadup address@hidden  The
+special option @option{--temacs} tells @command{temacs} how to record
+all the standard preloaded Lisp functions and variables, so that when
+you subsequently run Emacs, it will start much faster.  The
address@hidden option requires an argument @var{dump-method}, which
+can be one of the following:
+
address@hidden @samp
address@hidden pdump
address@hidden portable dump file
+Record the preloaded Lisp data in a @dfn{portable dump} file.  This
+method produces an additional data file which Emacs will load at
+startup.  The portable dump file is usually called @file{emacs.pdmp},
+and is installed in the Emacs @code{exec-directory} (@pxref{Help
+Functions}).  This method is the most preferred one, as it does not
+require Emacs to employ any special techniques of memory allocation,
+which might get in the way of various memory-layout techniques used by
+modern systems to enhance security and privacy.
+
address@hidden pbootstrap
address@hidden bootstrapping Emacs
+Like @samp{pdump}, but used while @dfn{bootstrapping} Emacs, when no
+previous Emacs binary and no @file{*.elc} byte-compiled Lisp files are
+available.  The produced portable dump file is usually named
address@hidden in this case.
+
address@hidden dump
address@hidden unexec
+This method causes @command{temacs} to dump out an executable program,
+called @file{emacs}, which has all the standard Lisp files already
+preloaded into it.  (The @samp{-batch} argument prevents
address@hidden from trying to initialize any of its data on the
+terminal, so that the tables of terminal information are empty in the
+dumped Emacs.)  This method is also known as @dfn{unexec}, because it
+produces a program file from a running process, and thus is in some
+sense the opposite of executing a program to start a process.
+
address@hidden bootstrap
+Like @samp{dump}, but used when bootstrapping Emacs with the
address@hidden method.
address@hidden table
 
 @cindex preloaded Lisp files
 @vindex preloaded-file-list
   The dumped @file{emacs} executable (also called a @dfn{pure} Emacs)
-is the one which is installed.  The variable
address@hidden stores a list of the Lisp files preloaded
-into the dumped Emacs.  If you port Emacs to a new operating system,
-and are not able to implement dumping, then Emacs must load
address@hidden each time it starts.
+is the one which is installed.  If the portable dumping was used to
+build Emacs, the @file{emacs} executable is actually an exact copy of
address@hidden, and the corresponding @file{emacs.pdmp} file is
+installed as well.  The variable @code{preloaded-file-list} stores a
+list of the preloaded Lisp files recorded in the portable dump file or
+in the dumped Emacs executable.  If you port Emacs to a new operating
+system, and are not able to implement dumping of any kind, then Emacs
+must load @file{loadup.el} each time it starts.
 
 @cindex build details
 @cindex deterministic build
@@ -161,14 +200,41 @@ In the unlikely event that you need a more general 
functionality than
 @code{custom-initialize-delay} provides, you can use
 @code{before-init-hook} (@pxref{Startup Summary}).
 
address@hidden dump-emacs-portable to-file &optional track-referrers
+This function dumps the current state of Emacs into a portable dump
+file @var{to-file}, using the @code{pdump} method.  Normally, the
+portable dump file is called @address@hidden, where
address@hidden is the name of the Emacs executable file.  The
+optional argument @var{track-referrers}, if address@hidden, causes the
+portable dumping process keep additional information to help track
+down the provenance of object types that are not yet supported by the
address@hidden method.
+
+If you want to use this function in an Emacs that was already dumped,
+you must run Emacs with the @samp{-batch} option.
address@hidden defun
+
 @defun dump-emacs to-file from-file
 @cindex unexec
 This function dumps the current state of Emacs into an executable file
address@hidden  It takes symbols from @var{from-file} (this is normally
-the executable file @file{temacs}).
address@hidden, using the @code{unexec} method.  It takes symbols from
address@hidden (this is normally the executable file @file{temacs}).
 
-If you want to use this function in an Emacs that was already dumped,
-you must run Emacs with @samp{-batch}.
+This function cannot be used in an Emacs that was already dumped.  If
+Emacs was built without @code{unexec} support, this function will not
+be available.
address@hidden defun
+
address@hidden pdumper-stats
+If the current Emacs session restored its state from a portable dump
+file, this function returns information about the dump file and the
+time it took to restore the Emacs state.  The value is an alist
address@hidden@code{((dumped-with-pdumper . t) (load-time . @var{time})
+(dump-file-name . @var{file}))}},
+where @var{file} is the name of the dump file, and @var{time} is the
+time in seconds it took to restore the state from the dump file.
+If the current session was not restored from a portable dump file, the
+value is nil.
 @end defun
 
 @node Pure Storage
@@ -1557,7 +1623,27 @@ purpose.
 @deftypefn Function bool should_quit (emacs_env address@hidden)
 This function returns @code{true} if the user wants to quit.  In that
 case, we recommend that your module function aborts any on-going
-processing and returns as soon as possible.
+processing and returns as soon as possible.  In most cases, use
address@hidden instead.
address@hidden deftypefn
+
+To process input events in addition to checking whether the user wants
+to quit, use the following function, which is available since Emacs
+27.1.
+
address@hidden
address@hidden Function enum emacs_process_input_result process_input 
(emacs_env address@hidden)
+This function processes pending input events.  It returns
address@hidden if the user wants to quit or an error
+occurred while processing signals.  In that case, we recommend that
+your module function aborts any on-going processing and returns as
+soon as possible.  If the module code may continue running,
address@hidden returns @code{emacs_process_input_continue}.  The
+return value is @code{emacs_process_input_continue} if and only if
+there is no pending nonlocal exit in @code{env}.  If the module
+continues after calling @code{process_input}, global state such as
+variable values and buffer content may have been modified in arbitrary
+ways.
 @end deftypefn
 
 @node Module Nonlocal
@@ -1622,7 +1708,7 @@ The last @acronym{API} function exited via @code{throw}.
 @end vtable
 @end deftypefn
 
address@hidden Function emacs_funcall_exit non_local_exit_get (emacs_env 
address@hidden, emacs_value address@hidden, emacs_value address@hidden)
address@hidden Function enum emacs_funcall_exit non_local_exit_get (emacs_env 
address@hidden, emacs_value address@hidden, emacs_value address@hidden)
 This function returns the kind of nonlocal exit condition stored in
 @var{env}, like @code{non_local_exit_check} does, but it also returns
 the full information about the nonlocal exit, if any.  If the return
@@ -1730,7 +1816,7 @@ frames, and processes fall into this category.
 
   Below there is a description of a few subtypes of @code{Lisp_Vectorlike}.
 Buffer object represents the text to display and edit.  Window is the part
-of display structure which shows the buffer or used as a container to
+of display structure which shows the buffer or is used as a container to
 recursively place other windows on the same frame.  (Do not confuse Emacs Lisp
 window object with the window as an entity managed by the user interface
 system like X; in Emacs terminology, the latter is called frame.)  Finally,
@@ -1757,7 +1843,8 @@ Here are some of the fields in @code{struct buffer_text}:
 
 @table @code
 @item beg
-The address of the buffer contents.
+The address of the buffer contents.  The buffer contents is a linear C
+array of @code{char}, with the gap somewhere in its midst.
 
 @item gpt
 @itemx gpt_byte
@@ -1781,8 +1868,8 @@ buffer-modification event, and is never otherwise changed;
 @code{save_modiff} contains the value of @code{modiff} the last time
 the buffer was visited or saved; @code{chars_modiff} counts only
 modifications to the characters in the buffer, ignoring all other
-kinds of changes; and @code{overlay_modiff} counts only modifications
-to the overlays.
+kinds of changes (such as text properties); and @code{overlay_modiff}
+counts only modifications to the buffer's overlays.
 
 @item beg_unchanged
 @itemx end_unchanged
@@ -1890,13 +1977,22 @@ position.
 
 @item name
 A Lisp string that names the buffer.  It is guaranteed to be unique.
address@hidden Names}.
address@hidden Names}.  This and the following fields have their names
+in the C struct definition end in a @code{_} to indicate that they
+should not be accessed directly, but via the @code{BVAR} macro, like
+this:
+
address@hidden
+  Lisp_Object buf_name = BVAR (buffer, name);
address@hidden example
 
 @item save_length
 The length of the file this buffer is visiting, when last read or
-saved.  This and other fields concerned with saving are not kept in
-the @code{buffer_text} structure because indirect buffers are never
-saved.
+saved.  It can have 2 special values: @minus{}1 means auto-saving was
+turned off in this buffer, and @minus{}2 means don't turn off
+auto-saving if buffer text shrinks a lot.  This and other fields
+concerned with saving are not kept in the @code{buffer_text} structure
+because indirect buffers are never saved.
 
 @item directory
 The directory for expanding relative file names.  This is the value of
@@ -2020,75 +2116,104 @@ if that window no longer displays this buffer.
 
 @table @code
 @item frame
-The frame that this window is on.
+The frame that this window is on, as a Lisp object.
+
address@hidden mini
+Non-zero if this window is a minibuffer window, a window showing the
+minibuffer or the echo area.
 
address@hidden mini_p
address@hidden if this window is a minibuffer window.
address@hidden pseudo_window_p
address@hidden pseudo window
+Non-zero if this window is a @dfn{pseudo window}.  A pseudo window is
+either a window used to display the menu bar or the tool bar (when
+Emacs uses toolkits that don't display their own menu bar and tool
+bar) or a window showing a tooltip on a tooltip frame.  Pseudo windows
+are in general not accessible from Lisp code.
 
 @item parent
-Internally, Emacs arranges windows in a tree; each group of siblings has
-a parent window whose area includes all the siblings.  This field points
-to a window's parent.
+Internally, Emacs arranges windows in a tree; each group of siblings
+has a parent window whose area includes all the siblings.  This field
+points to the window's parent in that tree, as a Lisp object.  For the
+root window of the tree and a minibuffer window this is always
address@hidden
 
 Parent windows do not display buffers, and play little role in display
-except to shape their child windows.  Emacs Lisp programs usually have
-no access to the parent windows; they operate on the windows at the
+except to shape their child windows.  Emacs Lisp programs cannot
+directly manipulate parent windows; they operate on the windows at the
 leaves of the tree, which actually display buffers.
 
address@hidden FIXME: These two slots and the 'buffer' slot below were replaced
address@hidden with a single slot 'contents' on 2013-03-28.  --xfq
address@hidden hchild
address@hidden vchild
-These fields contain the window's leftmost child and its topmost child
-respectively.  @code{hchild} is used if the window is subdivided
-horizontally by child windows, and @code{vchild} if it is subdivided
-vertically.  In a live window, only one of @code{hchild}, @code{vchild},
-and @code{buffer} (q.v.@:) is address@hidden
address@hidden contents
+For a leaf window and windows showing a tooltip, this is the buffer,
+as a Lisp object, that the window is displaying.  For an internal
+(``parent'') window, this is its first child window.  For a pseudo
+window showing a menu or tool bar this is @code{nil}.  It is also
address@hidden for a window that has been deleted.
 
 @item next
 @itemx prev
-The next sibling and previous sibling of this window.  @code{next} is
address@hidden if the window is the right-most or bottom-most in its group;
address@hidden is @code{nil} if it is the left-most or top-most in its
-group.
+The next and previous sibling of this window as Lisp objects.
address@hidden is @code{nil} if the window is the right-most or
+bottom-most in its group; @code{prev} is @code{nil} if it is the
+left-most or top-most in its group.  Whether the sibling is left/right
+or up/down is determined by the @code{horizontal} field of the
+sibling's parent: if it's non-zero, the siblings are arranged
+horizontally.
+
+As a special case, @code{next} of a frame's root window points to the
+frame's minibuffer window, provided this is not a minibuffer-only or
+minibuffer-less frame.  On such frames @code{prev} of the minibuffer
+window points to that frame's root window.  In any other case, the
+root window's @code{next} and the minibuffer window's (if present)
address@hidden fields are @code{nil}.
 
 @item left_col
 The left-hand edge of the window, measured in columns, relative to the
-leftmost column in the frame (column 0).
+leftmost column (column 0) of the window's native frame.
 
 @item top_line
 The top edge of the window, measured in lines, relative to the topmost
-line in the frame (line 0).
+line (line 0) of the window's native frame.
+
address@hidden pixel_left
address@hidden pixel_top
+The left-hand and top edges of this window, measured in pixels,
+relative to the top-left corner (0, 0) of the window's native frame.
 
 @item total_cols
 @itemx total_lines
-The width and height of the window, measured in columns and lines
-respectively.  The width includes the scroll bar and fringes, and/or
-the separator line on the right of the window (if any).
+The total width and height of the window, measured in columns and
+lines respectively.  The values include scroll bars and fringes,
+dividers and/or the separator line on the right of the window (if
+any).
 
address@hidden buffer
-The buffer that the window is displaying.
address@hidden pixel_width;
address@hidden pixel_height;
+The total width and height of the window measured in pixels.
 
 @item start
 A marker pointing to the position in the buffer that is the first
-character displayed in the window.
+character (in the logical order, @pxref{Bidirectional Display})
+displayed in the window.
 
 @item pointm
 @cindex window point internals
 This is the value of point in the current buffer when this window is
 selected; when it is not selected, it retains its previous value.
 
address@hidden old_pointm
+The value of @code{pointm} at the last redisplay time.
+
 @item force_start
 If this flag is address@hidden, it says that the window has been
-scrolled explicitly by the Lisp program.  This affects what the next
-redisplay does if point is off the screen: instead of scrolling the
-window to show the text around point, it moves point to a location that
-is on the screen.
+scrolled explicitly by the Lisp program, and the value of the the
+window's @code{start} was set for redisplay to honor.  This affects
+what the next redisplay does if point is off the screen: instead of
+scrolling the window to show the text around point, it moves point to
+a location that is on the screen.
 
address@hidden frozen_window_start_p
-This field is set temporarily to 1 to indicate to redisplay that
address@hidden of this window should not be changed, even if point
-gets invisible.
address@hidden optional_new_start
+This is similar to @code{force_start}, but the next redisplay will
+only obey it if point stays visible.
 
 @item start_at_line_beg
 address@hidden means current value of @code{start} was the beginning of a line
@@ -2114,30 +2239,36 @@ The buffer's value of point, as of the last time a 
redisplay completed
 in this window.
 
 @item last_had_star
-A address@hidden value means the window's buffer was modified when the
+A non-zero value means the window's buffer was modified when the
 window was last updated.
 
address@hidden vertical_scroll_bar
-This window's vertical scroll bar.
address@hidden vertical_scroll_bar_type
address@hidden horizontal_scroll_bar_type
+The types of this window's vertical and horizontal scroll bars.
+
address@hidden scroll_bar_width
address@hidden scroll_bar_height
+The width of this window's vertical scroll bar and the height of this
+window's horizontal scroll bar, in pixels.
 
 @item left_margin_cols
 @itemx right_margin_cols
 The widths of the left and right margins in this window.  A value of
address@hidden means no margin.
+zero means no margin.
 
 @item left_fringe_width
 @itemx right_fringe_width
-The widths of the left and right fringes in this window.  A value of
address@hidden or @code{t} means use the values of the frame.
+The pixel widths of the left and right fringes in this window.  A
+value of @minus{}1 means use the values of the frame.
 
 @item fringes_outside_margins
-A address@hidden value means the fringes outside the display margins;
+A non-zero value means the fringes outside the display margins;
 othersize they are between the margin and the text.
 
 @item window_end_pos
 This is computed as @code{z} minus the buffer position of the last glyph
 in the current matrix of the window.  The value is only valid if
address@hidden is not @code{nil}.
address@hidden is non-zero.
 
 @item window_end_bytepos
 The byte position corresponding to @code{window_end_pos}.
@@ -2147,16 +2278,17 @@ The window-relative vertical position of the line 
containing
 @code{window_end_pos}.
 
 @item window_end_valid
-This field is set to a address@hidden value if @code{window_end_pos} is truly
-valid.  This is @code{nil} if nontrivial redisplay is pre-empted, since in that
-case the display that @code{window_end_pos} was computed for did not get
-onto the screen.
+This field is set to a non-zero value if @code{window_end_pos} and
address@hidden are truly valid.  This is zero if nontrivial
+redisplay is pre-empted, since in that case the display that
address@hidden was computed for did not get onto the screen.
 
 @item cursor
 A structure describing where the cursor is in this window.
 
address@hidden last_cursor
-The value of @code{cursor} as of the last redisplay that finished.
address@hidden last_cursor_vpos
+The window-relative vertical position of the line showing the cursor
+as of the last redisplay that finished.
 
 @item phys_cursor
 A structure describing where the cursor of this window physically is.
@@ -2184,8 +2316,16 @@ the last redisplay.
 This is set to 1 during redisplay when this window must be updated.
 
 @item hscroll
-This is the number of columns that the display in the window is scrolled
-horizontally to the left.  Normally, this is 0.
+This is the number of columns that the display in the window is
+scrolled horizontally to the left.  Normally, this is 0.  When only
+the current line is hscrolled, this describes how much the current
+line is scrolled.
+
address@hidden min_hscroll
+Minimum value of @code{hscroll}, set by the user via
address@hidden (@pxref{Horizontal Scrolling}).  When only
+the current line is hscrolled, this describes the horizontal scrolling
+of lines other than the current one.
 
 @item vscroll
 Vertical scroll amount, in pixels.  Normally, this is 0.
@@ -2193,24 +2333,37 @@ Vertical scroll amount, in pixels.  Normally, this is 0.
 @item dedicated
 address@hidden if this window is dedicated to its buffer.
 
address@hidden combination_limit
+This window's combination limit, meaningful only for a parent window.
+If this is @code{t}, then it is not allowed to delete this window and
+recombine its child windows with other siblings of this window.
+
address@hidden window_parameters
+The alist of this window's parameters.
+
 @item display_table
 The window's display table, or @code{nil} if none is specified for it.
 
 @item update_mode_line
address@hidden means this window's mode line needs to be updated.
+Non-zero means this window's mode line needs to be updated.
+
address@hidden mode_line_height
address@hidden header_line_height
+The height in pixels of the mode line and the header line, or
address@hidden if not known.
 
 @item base_line_number
-The line number of a certain position in the buffer, or @code{nil}.
+The line number of a certain position in the buffer, or zero.
 This is used for displaying the line number of point in the mode line.
 
 @item base_line_pos
 The position in the buffer for which the line number is known, or
address@hidden meaning none is known.  If it is a buffer, don't display
+zero meaning none is known.  If it is @minus{}1, don't display
 the line number as long as the window shows that buffer.
 
 @item column_number_displayed
-The column number currently displayed in this window's mode line, or @code{nil}
-if column numbers are not being displayed.
+The column number currently displayed in this window's mode line, or
address@hidden if column numbers are not being displayed.
 
 @item current_matrix
 @itemx desired_matrix
@@ -2227,7 +2380,7 @@ Glyph matrices describing the current and desired display 
of this window.
 
 @table @code
 @item name
-A string, the name of the process.
+A Lisp string, the name of the process.
 
 @item command
 A list containing the command arguments that were used to start this
@@ -2235,10 +2388,10 @@ process.  For a network or serial process, it is 
@code{nil} if the
 process is running or @code{t} if the process is stopped.
 
 @item filter
-A function used to accept output from the process.
+A Lisp function used to accept output from the process.
 
 @item sentinel
-A function called whenever the state of the process changes.
+A Lisp function called whenever the state of the process changes.
 
 @item buffer
 The associated buffer of the process.
@@ -2265,7 +2418,8 @@ does not ask for confirmation about killing the process.
 The raw process status, as returned by the @code{wait} system call.
 
 @item status
-The process status, as @code{process-status} should return it.
+The process status, as @code{process-status} should return it.  This
+is a Lisp symbol, a cons cell, or a list.
 
 @item tick
 @itemx update_tick
@@ -2274,8 +2428,8 @@ needs to be reported, either by running the sentinel or 
by inserting a
 message in the process buffer.
 
 @item pty_flag
address@hidden if communication with the subprocess uses a pty;
address@hidden if it uses a pipe.
+Non-zero if communication with the subprocess uses a pty; zero if it
+uses a pipe.
 
 @item infd
 The file descriptor for input from the process.
diff --git a/doc/lispref/intro.texi b/doc/lispref/intro.texi
index 197f54e..2596e87 100644
--- a/doc/lispref/intro.texi
+++ b/doc/lispref/intro.texi
@@ -1,6 +1,6 @@
 @c -*-coding: utf-8-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1994, 2001-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 1990-1994, 2001-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 
 @node Introduction
@@ -530,6 +530,18 @@ directory (without cleaning).  This is only of relevance 
when
 developing Emacs.
 @end defvar
 
address@hidden emacs-repository-version
+A string that gives the repository revision from which Emacs was
+built.  If Emacs was built outside revision control, the value is
address@hidden
address@hidden defvar
+
address@hidden emacs-repository-branch
+A string that gives the repository branch from which Emacs was built.
+In the most cases this is @code{"master"}.  If Emacs was built outside
+revision control, the value is @code{nil}.
address@hidden defvar
+
 @node Acknowledgments
 @section Acknowledgments
 
diff --git a/doc/lispref/keymaps.texi b/doc/lispref/keymaps.texi
index d9d213d..6ad665a 100644
--- a/doc/lispref/keymaps.texi
+++ b/doc/lispref/keymaps.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1994, 1998-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 1990-1994, 1998-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Keymaps
 @chapter Keymaps
@@ -2502,7 +2502,7 @@ can do it this way:
 
   Emacs usually shows a @dfn{menu bar} at the top of each frame.
 @xref{Menu Bars,,,emacs, The GNU Emacs Manual}.  Menu bar items are
-subcommands of the fake function key @code{menu-bar}, as defined
+subcommands of the fake function key @key{MENU-BAR}, as defined
 in the active keymaps.
 
   To add an item to the menu bar, invent a fake function key of your
@@ -2554,9 +2554,10 @@ bar item:
 @end example
 
 @noindent
-Here, @code{edit} is the fake function key used by the global map for
-the @samp{Edit} menu bar item.  The main reason to suppress a global
-menu bar item is to regain space for mode-specific items.
+Here, @code{edit} is the symbol produced by a fake function key, it is
+used by the global map for the @samp{Edit} menu bar item.  The main
+reason to suppress a global menu bar item is to regain space for
+mode-specific items.
 
 @defvar menu-bar-final-items
 Normally the menu bar shows global items followed by items defined by the
@@ -2601,7 +2602,7 @@ If the value is @code{grow-only}, the tool bar expands 
automatically,
 but does not contract automatically.
 
   The tool bar contents are controlled by a menu keymap attached to a
-fake function key called @code{tool-bar} (much like the way the menu
+fake function key called @key{TOOL-BAR} (much like the way the menu
 bar is controlled).  So you define a tool bar item using
 @code{define-key}, like this:
 
diff --git a/doc/lispref/lay-flat.texi b/doc/lispref/lay-flat.texi
index da22159..1f12efe 100644
--- a/doc/lispref/lay-flat.texi
+++ b/doc/lispref/lay-flat.texi
@@ -1,6 +1,6 @@
 \input texinfo    @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 2001-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2001-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @c
 @comment %**start of header
diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi
index 1548dd4..746b464 100644
--- a/doc/lispref/lists.texi
+++ b/doc/lispref/lists.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Lists
@@ -656,7 +656,7 @@ resulting list.  Instead, the sequence becomes the final 
@sc{cdr}, like
 any other non-list final argument.
 
 @defun copy-tree tree &optional vecp
-This function returns a copy of the tree @code{tree}.  If @var{tree} is a
+This function returns a copy of the tree @var{tree}.  If @var{tree} is a
 cons cell, this makes a new cons cell with the same @sc{car} and
 @sc{cdr}, then recursively copies the @sc{car} and @sc{cdr} in the
 same way.
@@ -667,8 +667,20 @@ address@hidden, it copies vectors too (and operates 
recursively on
 their elements).
 @end defun
 
address@hidden flatten-tree tree
+This function returns a ``flattened'' copy of @var{tree}, that is,
+a list containing all the address@hidden terminal nodes, or leaves, of
+the tree of cons cells rooted at @var{tree}.  Leaves in the returned
+list are in the same order as in @var{tree}.
address@hidden defun
+
address@hidden
+(flatten-tree '(1 (2 . 3) nil (4 5 (6)) 7))
+    @result{}(1 2 3 4 5 6 7)
address@hidden example
+
 @defun number-sequence from &optional to separation
-This returns a list of numbers starting with @var{from} and
+This function returns a list of numbers starting with @var{from} and
 incrementing by @var{separation}, and ending at or just before
 @var{to}.  @var{separation} can be positive or negative and defaults
 to 1.  If @var{to} is @code{nil} or numerically equal to @var{from},
diff --git a/doc/lispref/loading.texi b/doc/lispref/loading.texi
index 6f15cd9..6f1213f 100644
--- a/doc/lispref/loading.texi
+++ b/doc/lispref/loading.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Loading
diff --git a/doc/lispref/macros.texi b/doc/lispref/macros.texi
index dbd35b4..a422ba9 100644
--- a/doc/lispref/macros.texi
+++ b/doc/lispref/macros.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998, 2001-2018 Free Software 
Foundation,
address@hidden Copyright (C) 1990-1995, 1998, 2001-2019 Free Software 
Foundation,
 @c Inc.
 @c See the file elisp.texi for copying conditions.
 @node Macros
diff --git a/doc/lispref/maps.texi b/doc/lispref/maps.texi
index fc40f28..bcf8f17 100644
--- a/doc/lispref/maps.texi
+++ b/doc/lispref/maps.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1993, 1999, 2001-2018 Free Software 
Foundation,
address@hidden Copyright (C) 1990-1993, 1999, 2001-2019 Free Software 
Foundation,
 @c Inc.
 @c See the file elisp.texi for copying conditions.
 @node Standard Keymaps
diff --git a/doc/lispref/markers.texi b/doc/lispref/markers.texi
index 349ec12..27fe141 100644
--- a/doc/lispref/markers.texi
+++ b/doc/lispref/markers.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Markers
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 5c66055..6c37fa9 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Minibuffers
@@ -1108,11 +1108,11 @@ different function to completely override the normal 
behavior of
 in the minibuffer to do completion.
 
 @defvar minibuffer-completion-table
-The value of this variable is the completion table used for completion
-in the minibuffer.  This is the global variable that contains what
address@hidden passes to @code{try-completion}.  It is used by
-minibuffer completion commands such as
address@hidden
+The value of this variable is the completion table (@pxref{Basic
+Completion}) used for completion in the minibuffer.  This is the
+global variable that contains what @code{completing-read} passes to
address@hidden  It is used by minibuffer completion commands
+such as @code{minibuffer-complete-word}.
 @end defvar
 
 @defvar minibuffer-completion-predicate
@@ -1770,7 +1770,8 @@ possible match, and ignore the match if the predicate 
returns
 @code{nil}.
 
 @item
-A flag specifying the type of completion operation to perform.  This
+A flag specifying the type of completion operation to perform; see
address@hidden Completion}, for the details of those operations.  This
 flag may be one of the following values.
 
 @table @code
@@ -1841,17 +1842,26 @@ the same as for @code{display-sort-function}.
 
 @defun completion-table-dynamic function &optional switch-buffer
 This function is a convenient way to write a function that can act as
-a programmed completion function.  The argument @var{function} should be
-a function that takes one argument, a string, and returns an alist of
-possible completions of it.  It is allowed to ignore the argument and
-return a full list of all possible completions.  You can think of
address@hidden as a transducer between that interface
+a programmed completion function.  The argument @var{function} should
+be a function that takes one argument, a string, and returns a
+completion table (@pxref{Basic Completion}) containing all the
+possible completions.  The table returned by @var{function} can also
+include elements that don't match the string argument; they are
+automatically filtered out by @code{completion-table-dynamic}.  In
+particular, @var{function} can ignore its argument and return a full
+list of all possible completions.  You can think of
address@hidden as a transducer between @var{function}
 and the interface for programmed completion functions.
 
 If the optional argument @var{switch-buffer} is address@hidden, and
 completion is performed in the minibuffer, @var{function} will be
 called with current buffer set to the buffer from which the minibuffer
 was entered.
+
+The return value of @code{completion-table-dynamic} is a function that
+can be used as the 2nd argument to @code{try-completion} and
address@hidden  Note that this function will always return
+empty metadata and trivial boundaries (@pxref{Programmed Completion}).
 @end defun
 
 @defun completion-table-with-cache function &optional ignore-case
@@ -1876,9 +1886,10 @@ Emacs Manual}.  This command uses the abnormal hook 
variable
 
 @defvar completion-at-point-functions
 The value of this abnormal hook should be a list of functions, which
-are used to compute a completion table for completing the text at
-point.  It can be used by major modes to provide mode-specific
-completion tables (@pxref{Major Mode Conventions}).
+are used to compute a completion table (@pxref{Basic Completion}) for
+completing the text at point.  It can be used by major modes to
+provide mode-specific completion tables (@pxref{Major Mode
+Conventions}).
 
 When the command @code{completion-at-point} runs, it calls the
 functions in the list one by one, without any argument.  Each function
@@ -2391,6 +2402,25 @@ will not work.  If you want to prevent resizing of 
minibuffer windows
 when displaying long messages, bind the @code{message-truncate-lines}
 variable instead (@pxref{Echo Area Customization}).
 
+The option @code{resize-mini-windows} does not affect the behavior of
+minibuffer-only frames (@pxref{Frame Layout}).  The following option
+allows to automatically resize such frames as well.
+
address@hidden resize-mini-frames
+If this is @code{nil}, minibuffer-only frames are never resized
+automatically.
+
+If this is a function, that function is called with the
+minibuffer-only frame to be resized as sole argument.  At the time
+this function is called, the buffer of the minibuffer window of that
+frame is the buffer whose contents will be shown the next time that
+window is redisplayed.  The function is expected to fit the frame to
+the buffer in some appropriate way.
+
+Any other address@hidden value means to resize minibuffer-only frames
+by calling @code{fit-frame-to-buffer} (@pxref{Resizing Windows}).
address@hidden defopt
+
 
 @node Minibuffer Contents
 @section Minibuffer Contents
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index 49b7e1e..1afbc5a 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Modes
@@ -1015,6 +1015,29 @@ list-processes}).  The listing command should create or 
switch to a
 buffer, turn on the derived mode, specify the tabulated data, and
 finally call @code{tabulated-list-print} to populate the buffer.
 
address@hidden tabulated-list-gui-sort-indicator-asc
+This variable specifies the character to be used on GUI frames as an
+indication that the column is sorted in the ascending order.
+
+Whenever you change the sort direction in Tabulated List buffers, this
+indicator toggles between ascending (``asc'') and descending (``desc'').
address@hidden defopt
+
address@hidden tabulated-list-gui-sort-indicator-desc
+Like @code{tabulated-list-gui-sort-indicator-asc}, but used when the
+column is sorted in the descending order.
address@hidden defopt
+
address@hidden tabulated-list-tty-sort-indicator-asc
+Like @code{tabulated-list-gui-sort-indicator-asc}, but used for
+text-mode frames.
address@hidden defopt
+
address@hidden tabulated-list-tty-sort-indicator-desc
+Like @code{tabulated-list-tty-sort-indicator-asc}, but used when the
+column is sorted in the descending order.
address@hidden defopt
+
 @defvar tabulated-list-format
 This buffer-local variable specifies the format of the Tabulated List
 data.  Its value should be a vector.  Each element of the vector
@@ -1121,6 +1144,65 @@ that tags placed via @code{tabulated-list-put-tag} will 
not be removed
 from entries that haven't changed (normally all tags are removed).
 @end defun
 
address@hidden tabulated-list-delete-entry
+This function deletes the entry at point.
+
+It returns a list @code{(@var{id} @var{cols})}, where @var{id} is the
+ID of the deleted entry and @var{cols} is a vector of its column
+descriptors.  It moves point to the beginning of the current line.  It
+returns @code{nil} if there is no entry at point.
+
+Note that this function only changes the buffer contents; it does not
+alter @code{tabulated-list-entries}.
address@hidden defun
+
address@hidden tabulated-list-get-id &optional pos
+This @code{defsubst} returns the ID object from
address@hidden (if that is a list) or from the list
+returned by @code{tabulated-list-entries} (if it is a function).  If
+omitted or @code{nil}, @var{pos} defaults to point.
address@hidden defun
+
address@hidden tabulated-list-get-entry &optional pos
+This @code{defsubst} returns the entry object from
address@hidden (if that is a list) or from the list
+returned by @code{tabulated-list-entries} (if it is a function).  This
+will be a vector for the ID at @var{pos}.  If there is no entry at
address@hidden, then the function returns @code{nil}.
address@hidden defun
+
address@hidden tabulated-list-use-header-line
address@hidden tabulated-list-header-overlay-p &optional POS
+This @code{defsubst} returns non-nil if there is a fake header at
address@hidden  A fake header is used if
address@hidden is @code{nil} to put the column
+names at the beginning of the buffer.  If omitted or @code{nil},
address@hidden defaults to @code{point-min}.
address@hidden defun
+
address@hidden tabulated-list-padding
address@hidden tabulated-list-put-tag tag &optional advance
+This function puts @var{tag} in the padding area of the current line.
+The padding area can be empty space at the beginning of the line, the
+width of which is governed by @code{tabulated-list-padding}.
address@hidden should be a string, with a length less than or equal to
address@hidden  If @var{advance} is non-nil, this
+function advances point by one line.
address@hidden defun
+
address@hidden tabulated-list-set-col col desc &optional change-entry-data
+This function changes the tabulated list entry at point, setting
address@hidden to @var{desc}.  @var{col} is the column number to change, or
+the name of the column to change.  @var{desc} is the new column
+descriptor, which is inserted via @code{tabulated-list-print-col}.
+
+If @var{change-entry-data} is non-nil, this function modifies the
+underlying data (usually the column descriptor in the list
address@hidden) by setting the column descriptor of the
+vector to @code{desc}.
address@hidden defun
+
+
 @node Generic Modes
 @subsection Generic Modes
 @cindex generic mode
@@ -1178,6 +1260,7 @@ the conventions listed above:
     (modify-syntax-entry ?\\ ".   " st)
     ;; Add 'p' so M-c on 'hello' leads to 'Hello', not 'hello'.
     (modify-syntax-entry ?' "w p" st)
+    @dots{}
     st)
   "Syntax table used while in `text-mode'.")
 @end group
@@ -1187,6 +1270,7 @@ the conventions listed above:
 (defvar text-mode-map
   (let ((map (make-sparse-keymap)))
     (define-key map "\e\t" 'ispell-complete-word)
+    @dots{}
     map)
   "Keymap for `text-mode'.
 Many other modes, such as `mail-mode', `outline-mode' and
@@ -1230,11 +1314,11 @@ illustrate how these modes are written.
 @smallexample
 @group
 ;; @r{Create mode-specific table variables.}
-(defvar lisp-mode-abbrev-table nil)
-(define-abbrev-table 'lisp-mode-abbrev-table ())
+(define-abbrev-table 'lisp-mode-abbrev-table ()
+  "Abbrev table for Lisp mode.")
 
 (defvar lisp-mode-syntax-table
-  (let ((table (copy-syntax-table emacs-lisp-mode-syntax-table)))
+  (let ((table (make-syntax-table lisp--mode-syntax-table)))
     (modify-syntax-entry ?\[ "_   " table)
     (modify-syntax-entry ?\] "_   " table)
     (modify-syntax-entry ?# "' 14" table)
@@ -1249,10 +1333,9 @@ each calls the following function to set various 
variables:
 
 @smallexample
 @group
-(defun lisp-mode-variables (&optional syntax keywords-case-insensitive)
+(defun lisp-mode-variables (&optional syntax keywords-case-insensitive elisp)
   (when syntax
     (set-syntax-table lisp-mode-syntax-table))
-  (setq local-abbrev-table lisp-mode-abbrev-table)
   @dots{}
 @end group
 @end smallexample
@@ -1263,8 +1346,7 @@ variable to handle Lisp comments:
 
 @smallexample
 @group
-  (make-local-variable 'comment-start)
-  (setq comment-start ";")
+  (setq-local comment-start ";")
   @dots{}
 @end group
 @end smallexample
@@ -1278,6 +1360,7 @@ common.  The following code sets up the common commands:
 @group
 (defvar lisp-mode-shared-map
   (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map prog-mode-map)
     (define-key map "\e\C-q" 'indent-sexp)
     (define-key map "\177" 'backward-delete-char-untabify)
     map)
@@ -1292,7 +1375,7 @@ And here is the code to set up the keymap for Lisp mode:
 @group
 (defvar lisp-mode-map
   (let ((map (make-sparse-keymap))
-       (menu-map (make-sparse-keymap "Lisp")))
+        (menu-map (make-sparse-keymap "Lisp")))
     (set-keymap-parent map lisp-mode-shared-map)
     (define-key map "\e\C-x" 'lisp-eval-defun)
     (define-key map "\C-c\C-z" 'run-lisp)
@@ -1316,17 +1399,13 @@ Blank lines separate paragraphs.  Semicolons start 
comments.
 
 address@hidden@}
 Note that `run-lisp' may be used either to start an inferior Lisp job
-or to switch back to an existing one.
+or to switch back to an existing one."
 @end group
-
 @group
-Entry to this mode calls the value of `lisp-mode-hook'
-if that value is non-nil."
   (lisp-mode-variables nil t)
-  (set (make-local-variable 'find-tag-default-function)
-       'lisp-find-tag-default)
-  (set (make-local-variable 'comment-start-skip)
-       "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
+  (setq-local find-tag-default-function 'lisp-find-tag-default)
+  (setq-local comment-start-skip
+              "\\(\\(^\\|[^\\\\\n]\\)\\(\\\\\\\\\\)*\\)\\(;+\\|#|\\) *")
   (setq imenu-case-fold-search t))
 @end group
 @end smallexample
@@ -1366,7 +1445,7 @@ The value of this variable is a list of all minor mode 
commands.
 @cindex conventions for writing minor modes
 
   There are conventions for writing minor modes just as there are for
-major modes.  These conventions are described below.  The easiest way to
+major modes (@pxref{Major Modes}).  These conventions are described below.  
The easiest way to
 follow them is to use the macro @code{define-minor-mode}.
 @xref{Defining Minor Modes}.
 
@@ -1477,10 +1556,10 @@ or like this, using @code{add-to-list} (@pxref{List 
Variables}):
 @end smallexample
 @end itemize
 
-  In addition, several major mode conventions apply to minor modes as
-well: those regarding the names of global symbols, the use of a hook at
-the end of the initialization function, and the use of keymaps and other
-tables.
+  In addition, several major mode conventions (@pxref{Major Mode
+Conventions}) apply to minor modes as well: those regarding the names
+of global symbols, the use of a hook at the end of the initialization
+function, and the use of keymaps and other tables.
 
   The minor mode should, if possible, support enabling and disabling via
 Custom (@pxref{Customization}).  To do this, the mode variable should be
diff --git a/doc/lispref/nonascii.texi b/doc/lispref/nonascii.texi
index 9fb5587..9c64c3c 100644
--- a/doc/lispref/nonascii.texi
+++ b/doc/lispref/nonascii.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1998-1999, 2001-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 1998-1999, 2001-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Non-ASCII Characters
 @chapter address@hidden Characters
@@ -287,12 +287,11 @@ unibyte string, it is returned unchanged.  Use this 
function for
 characters.
 @end defun
 
address@hidden FIXME: Should '@var{character}' be '@var{byte}'?
 @defun byte-to-string byte
 @cindex byte to string
 This function returns a unibyte string containing a single byte of
-character data, @var{character}.  It signals an error if
address@hidden is not an integer between 0 and 255.
+character data, @var{byte}.  It signals an error if @var{byte} is not
+an integer between 0 and 255.
 @end defun
 
 @defun multibyte-char-to-unibyte char
@@ -1379,7 +1378,7 @@ operates on the contents of @var{string} instead of bytes 
in the buffer.
 @end defun
 
 @cindex null bytes, and decoding text
address@hidden inhibit-null-byte-detection
address@hidden inhibit-nul-byte-detection
 If this variable has a address@hidden value, null bytes are ignored
 when detecting the encoding of a region or a string.  This allows the
 encoding of text that contains null bytes to be correctly detected,
@@ -1633,11 +1632,16 @@ coding system for a file based on its undecoded 
contents.
 
 Each function in this list should be written to look at text in the
 current buffer, but should not modify it in any way.  The buffer will
-contain undecoded text of parts of the file.  Each function should
-take one argument, @var{size}, which tells it how many characters to
-look at, starting from point.  If the function succeeds in determining
-a coding system for the file, it should return that coding system.
-Otherwise, it should return @code{nil}.
+contain the text of parts of the file.  Each function should take one
+argument, @var{size}, which tells it how many characters to look at,
+starting from point.  If the function succeeds in determining a coding
+system for the file, it should return that coding system.  Otherwise,
+it should return @code{nil}.
+
+The functions in this list could be called either when the file is
+visited and Emacs wants to decode its contents, and/or when the file's
+buffer is about to be saved and Emacs wants to determine how to encode
+its contents.
 
 If a file has a @samp{coding:} tag, that takes precedence, so these
 functions won't be called.
@@ -2116,9 +2120,9 @@ Return a 12-element vector of month names (locale items 
@code{MON_1}
 through @code{MON_12}).
 
 @item paper
-Return a list @code{(@var{width} @var{height})} for the default paper
-size measured in millimeters (locale items @code{PAPER_WIDTH} and
address@hidden).
+Return a list @address@hidden(@var{width} @var{height})}} of 2 integers, for
+the default paper size measured in millimeters (locale items
address@hidden and @code{_NL_PAPER_HEIGHT}).
 @end table
 
 If the system can't provide the requested information, or if
diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi
index d031136..fbdd83f 100644
--- a/doc/lispref/numbers.texi
+++ b/doc/lispref/numbers.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Numbers
@@ -313,14 +313,18 @@ and returns the result.  @var{x1} and @var{x2} must be 
floating point.
 
 @defun logb x
 This function returns the binary exponent of @var{x}.  More
-precisely, the value is the logarithm base 2 of @math{|x|}, rounded
-down to an integer.
+precisely, if @var{x} is finite and nonzero, the value is the
+logarithm base 2 of @math{|x|}, rounded down to an integer.
+If @var{x} is zero, infinite, or a NaN, the value is minus infinity,
+plus infinity, or a NaN respectively.
 
 @example
 (logb 10)
      @result{} 3
 (logb 10.0e20)
      @result{} 69
+(logb 0)
+     @result{} -1.0e+INF
 @end example
 @end defun
 
diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi
index a094003..745baac 100644
--- a/doc/lispref/objects.texi
+++ b/doc/lispref/objects.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Lisp Data Types
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index cb33757..59cd5a8 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node System Interface
@@ -1230,6 +1230,11 @@ groups on the system.  If Emacs cannot retrieve this 
information, the
 return value is @code{nil}.
 @end defun
 
address@hidden group-name gid
+This function returns the group name that corresponds to the numeric
+group ID @var{gid}, or @code{nil} if there is no such group.
address@hidden defun
+
 
 @node Time of Day
 @section Time of Day
@@ -1308,9 +1313,10 @@ This function returns the current time and date as a 
human-readable
 string.  The format does not vary for the initial part of the string,
 which contains the day of week, month, day of month, and time of day
 in that order: the number of characters used for these fields is
-always the same, so you can reliably
-use @code{substring} to extract them.  You should count
-characters from the beginning of the string rather than from the end,
+always the same, although (unless you require English weekday or
+month abbreviations regardless of locale) it is typically more
+convenient to use @code{format-time-string} than to extract
+fields from the output of @code{current-time-string},
 as the year might not have exactly four digits, and additional
 information may some day be added at the end.
 
@@ -1538,7 +1544,28 @@ Time values include @code{nil}, numbers, and Lisp 
timestamps
 
 @defun date-to-time string
 This function parses the time-string @var{string} and returns the
-corresponding Lisp timestamp.
+corresponding Lisp timestamp.  The argument @var{string} should represent
+a date-time, and should be in one of the forms recognized by
address@hidden (see below).  This function assumes the GMT
+timezone if @var{string} lacks an explicit timezone information.
address@hidden defun
+
address@hidden parse-time-string string
+This function parses the time-string @var{string} into a list of the
+following form:
+
address@hidden
+(@var{sec} @var{min} @var{hour} @var{day} @var{mon} @var{year} @var{dow} 
@var{dst} @var{tz})
address@hidden example
+
address@hidden
+The format of this list is the same as what @code{decode-time} accepts
+(@pxref{Time Conversion}), and is described in more detail there.  Any
+element that cannot be determined from the input will be set to
address@hidden  The argument @var{string} should resemble an RFC 822 (or later) 
or
+ISO 8601 string, like ``Fri, 25 Mar 2016 16:24:56 +0100'' or
+``1998-09-12T12:21:54-0200'', but this function will attempt to parse
+less well-formed time strings as well.
 @end defun
 
 @defun format-time-string format-string &optional time zone
@@ -1573,7 +1600,9 @@ This is a synonym for @samp{%m/%d/%y}.
 @item %e
 This stands for the day of month, blank-padded.
 @item %F
-This stands for the ISO 8601 date format, i.e., @samp{"%Y-%m-%d"}.
+This stands for the ISO 8601 date format, which is like
address@hidden except that any flags or field width override the
address@hidden and (after subtracting 6) the @samp{4}.
 @item %g
 This stands for the year corresponding to the ISO week within the century.
 @item %G
@@ -1653,7 +1682,9 @@ This stands for a single @samp{%}.
 @end table
 
 One or more flag characters can appear immediately after the @samp{%}.
address@hidden pads with zeros, @samp{_} pads with blanks, @samp{-}
address@hidden pads with zeros, @samp{+} pads with zeros and also puts
address@hidden before nonnegative year numbers with more than four digits,
address@hidden pads with blanks, @samp{-}
 suppresses padding, @samp{^} upper-cases letters, and @samp{#}
 reverses the case of letters.
 
diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi
index 37c1ee6..7244efb 100644
--- a/doc/lispref/package.texi
+++ b/doc/lispref/package.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 2010-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2010-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Packaging
 @chapter Preparing Lisp code for distribution
@@ -22,6 +22,7 @@ user-level features of the packaging system.
 * Simple Packages::         How to package a single .el file.
 * Multi-file Packages::     How to package multiple files.
 * Package Archives::        Maintaining package archives.
+* Archive Web Server::      Interfacing to an archive web server.
 @end menu
 
 @node Packaging Basics
@@ -249,7 +250,8 @@ dependency's version (a string).
 @end defun
 
   If the content directory contains a file named @file{README}, this
-file is used as the long description.
+file is used as the long description (overriding any @samp{;;;
+Commentary:} section).
 
   If the content directory contains a file named @file{dir}, this is
 assumed to be an Info directory file made with @command{install-info}.
@@ -311,8 +313,8 @@ access.  Such local archives are mainly useful for testing.
 
   A package archive is simply a directory in which the package files,
 and associated files, are stored.  If you want the archive to be
-reachable via HTTP, this directory must be accessible to a web server.
-How to accomplish this is beyond the scope of this manual.
+reachable via HTTP, this directory must be accessible to a web server;
address@hidden Web Server}.
 
   A convenient way to set up and update a package archive is via the
 @code{package-x} library.  This is included with Emacs, but not loaded
@@ -393,3 +395,28 @@ manual.  For more information on cryptographic keys and 
signing,
 @pxref{Top,, GnuPG, gnupg, The GNU Privacy Guard Manual}.  Emacs comes
 with an interface to GNU Privacy Guard, @pxref{Top,, EasyPG, epa,
 Emacs EasyPG Assistant Manual}.
+
address@hidden Archive Web Server
address@hidden Interfacing to an archive web server
address@hidden archive web server
+
+A web server providing access to a package archive must support the
+following queries:
+
address@hidden @asis
address@hidden archive-contents
+Return a lisp form describing the archive contents. The form is a list
+of 'package-desc' structures (see @file{package.el}), except the first
+element of the list is the archive version.
+
address@hidden <package name>-readme.txt
+Return the long description of the package.
+
address@hidden <file name>.sig
+Return the signature for the file.
+
address@hidden <file name>
+Return the file. This will be the tarball for a multi-file
+package, or the single file for a simple package.
+
address@hidden table
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index a09b6b6..527a3ab 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 1990-1995, 1998-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Positions
 @chapter Positions
diff --git a/doc/lispref/processes.texi b/doc/lispref/processes.texi
index d88c7fb..6be311b 100644
--- a/doc/lispref/processes.texi
+++ b/doc/lispref/processes.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Processes
@@ -423,27 +423,27 @@ be found in the definition of the @code{insert-directory} 
function:
 
 @defun process-file program &optional infile buffer display &rest args
 This function processes files synchronously in a separate process.  It
-is similar to @code{call-process}, but may invoke a file handler based
-on the value of the variable @code{default-directory}, which specifies
-the current working directory of the subprocess.
+is similar to @code{call-process}, but may invoke a file name handler
+based on the value of the variable @code{default-directory}, which
+specifies the current working directory of the subprocess.
 
 The arguments are handled in almost the same way as for
 @code{call-process}, with the following differences:
 
-Some file handlers may not support all combinations and forms of the
+Some file name handlers may not support all combinations and forms of the
 arguments @var{infile}, @var{buffer}, and @var{display}.  For example,
-some file handlers might behave as if @var{display} were @code{nil},
+some file name handlers might behave as if @var{display} were @code{nil},
 regardless of the value actually passed.  As another example, some
-file handlers might not support separating standard output and error
+file name handlers might not support separating standard output and error
 output by way of the @var{buffer} argument.
 
-If a file handler is invoked, it determines the program to run based
+If a file name handler is invoked, it determines the program to run based
 on the first argument @var{program}.  For instance, suppose that a
 handler for remote files is invoked.  Then the path that is used for
 searching for the program might be different from @code{exec-path}.
 
-The second argument @var{infile} may invoke a file handler.  The file
-handler could be different from the handler chosen for the
+The second argument @var{infile} may invoke a file name handler.  The file
+name handler could be different from the handler chosen for the
 @code{process-file} function itself.  (For example,
 @code{default-directory} could be on one remote host, and
 @var{infile} on a different remote host.  Or @code{default-directory}
@@ -459,7 +459,9 @@ present in @var{args}.  To avoid confusion, it may be best 
to avoid
 absolute file names in @var{args}, but rather to specify all file
 names as relative to @code{default-directory}.  The function
 @code{file-relative-name} is useful for constructing such relative
-file names.
+file names.  Alternatively, you can use @code{file-local-name}
+(@pxref{Magic File Names}) to obtain an absolute file name as seen
+from the remote host's perspective.
 @end defun
 
 @defvar process-file-side-effects
@@ -468,7 +470,7 @@ remote files.
 
 By default, this variable is always set to @code{t}, meaning that a
 call of @code{process-file} could potentially change any file on a
-remote host.  When set to @code{nil}, a file handler could optimize
+remote host.  When set to @code{nil}, a file name handler could optimize
 its behavior with respect to remote file attribute caching.
 
 You should only ever change this variable with a let-binding; never
@@ -612,10 +614,9 @@ these features.  However, for subprocesses used by Lisp 
programs for
 internal purposes (i.e., no user interaction with the subprocess is
 required), where significant amounts of data need to be exchanged
 between the subprocess and the Lisp program, it is often better to use
-a pipe, because pipes are more efficient, and because they are immune
-to stray character injections that ptys introduce for large (around
-500 byte) messages.  Also, the total number of ptys is limited on many
-systems, and it is good not to waste them unnecessarily.
+a pipe, because pipes are more efficient.  Also, the total number of
+ptys is limited on many systems, and it is good not to waste them
+unnecessarily.
 
 @defun make-process &rest args
 This function is the basic low-level primitive for starting
@@ -696,6 +697,12 @@ address@hidden value should be either a buffer or a pipe 
process
 created with @code{make-pipe-process}, described below.  If
 @var{stderr} is @code{nil}, standard error is mixed with standard
 output, and both are sent to @var{buffer} or @var{filter}.
+
address@hidden :file-handler @var{file-handler}
+If @var{file-handler} is address@hidden, then look for a file name
+handler for the current buffer's @code{default-directory}, and invoke
+that file name handler to make the process.  If there is no such
+handler, proceed as if @var{file-handler} were @code{nil}.
 @end table
 
 The original argument list, modified with the actual connection
@@ -703,9 +710,18 @@ information, is available via the @code{process-contact} 
function.
 
 The current working directory of the subprocess is set to the current
 buffer's value of @code{default-directory} if that is local (as
-determined by `unhandled-file-name-directory'), or "~" otherwise.  If
-you want to run a process in a remote directory use
address@hidden
+determined by @code{unhandled-file-name-directory}), or @file{~}
+otherwise.  If you want to run a process in a remote directory, pass
address@hidden:file-handler t} to @code{make-process}.  In that case, the
+current working directory is the local name component of
address@hidden (as determined by @code{file-local-name}).
+
+Depending on the implementation of the file name handler, it might not
+be possible to apply @var{filter} or @var{sentinel} to the resulting
+process object.  @xref{Filter Functions}, and @ref{Sentinels}.
+
+Some file name handlers may not support @code{make-process}.  In such
+cases, this function does nothing and returns @code{nil}.
 @end defun
 
 @defun make-pipe-process &rest args
@@ -821,22 +837,27 @@ subprocess running @var{program} in it, and returns its 
process
 object.
 
 The difference from @code{start-process} is that this function may
-invoke a file handler based on the value of @code{default-directory}.
+invoke a file name handler based on the value of @code{default-directory}.
 This handler ought to run @var{program}, perhaps on the local host,
 perhaps on a remote host that corresponds to @code{default-directory}.
 In the latter case, the local part of @code{default-directory} becomes
 the working directory of the process.
 
 This function does not try to invoke file name handlers for
address@hidden or for the rest of @var{args}.
-
-Depending on the implementation of the file handler, it might not be
address@hidden or for the rest of @var{args}.  For that reason, if
address@hidden or any of @var{args} use the remote-file syntax
+(@pxref{Magic File Names}), they must be converted either to file
+names relative to @code{default-directory}, or to names that identify
+the files locally on the remote host, by running them through
address@hidden
+
+Depending on the implementation of the file name handler, it might not be
 possible to apply @code{process-filter} or @code{process-sentinel} to
 the resulting process object.  @xref{Filter Functions}, and @ref{Sentinels}.
 
 @c FIXME  Can we find a better example (i.e., a more modern function
 @c that is actually documented).
-Some file handlers may not support @code{start-file-process} (for
+Some file name handlers may not support @code{start-file-process} (for
 example the function @code{ange-ftp-hook-function}).  In such cases,
 this function does nothing and returns @code{nil}.
 @end defun
@@ -1768,7 +1789,7 @@ system comes from @code{coding-system-for-read}, if that 
is
 address@hidden; or else from the defaulting mechanism (@pxref{Default
 Coding Systems}).  If the text output by a process contains null
 bytes, Emacs by default uses @code{no-conversion} for it; see
address@hidden and Coding Systems, inhibit-null-byte-detection}, for how to
address@hidden and Coding Systems, inhibit-nul-byte-detection}, for how to
 control this behavior.
 
   @strong{Warning:} Coding systems such as @code{undecided}, which
@@ -1806,7 +1827,8 @@ until output arrives from a process.
 This function allows Emacs to read pending output from processes.  The
 output is given to their filter functions.  If @var{process} is
 address@hidden then this function does not return until some output
-has been received from @var{process}.
+has been received from @var{process} or @var{process} has closed the
+connection.
 
 The arguments @var{seconds} and @var{millisec} let you specify timeout
 periods.  The former specifies a period measured in seconds and the
@@ -1831,10 +1853,32 @@ speech synthesis.
 
 The function @code{accept-process-output} returns address@hidden if it
 got output from @var{process}, or from any process if @var{process} is
address@hidden  It returns @code{nil} if the timeout expired before output
address@hidden; this can occur even after a process has exited if the
+corresponding connection contains buffered data.  The function returns
address@hidden if the timeout expired or the connection was closed before output
 arrived.
 @end defun
 
+If a connection from a process contains buffered data,
address@hidden can return address@hidden even after the
+process has exited.  Therefore, although the following loop:
+
address@hidden
+;; This loop contains a bug.
+(while (process-live-p process)
+  (accept-process-output process))
address@hidden example
+
address@hidden
+will often read all output from @var{process}, it has a race condition
+and can miss some output if @code{process-live-p} returns @code{nil}
+while the connection still contains data.  Better is to write the loop
+like this:
+
address@hidden
+(while (accept-process-output process))
address@hidden example
+
 @node Processes and Threads
 @subsection Processes and Threads
 @cindex processes, threads
@@ -2596,7 +2640,9 @@ Specify the host to connect to.  @var{host} should be a 
host name or
 Internet address, as a string, or the symbol @code{local} to specify
 the local host.  If you specify @var{host} for a server, it must
 specify a valid address for the local host, and only clients
-connecting to that address will be accepted.
+connecting to that address will be accepted.  When using @code{local},
+by default IPv4 will be used, specify a @var{family} of @code{ipv6} to
+override this.
 
 @item :service @var{service}
 @var{service} specifies a port number to connect to; or, for a server,
diff --git a/doc/lispref/records.texi b/doc/lispref/records.texi
index 81a5234..3a89b68 100644
--- a/doc/lispref/records.texi
+++ b/doc/lispref/records.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 2017-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2017-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Records
 @chapter Records
diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi
index 1b6b80d..0f31291 100644
--- a/doc/lispref/searching.texi
+++ b/doc/lispref/searching.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Searching and Matching
@@ -406,13 +406,13 @@ Note also that the usual regexp special characters are 
not special inside a
 character alternative.  A completely different set of characters is
 special inside character alternatives: @samp{]}, @samp{-} and @samp{^}.
 
-To include a @samp{]} in a character alternative, you must make it the
-first character.  For example, @samp{[]a]} matches @samp{]} or @samp{a}.
-To include a @samp{-}, write @samp{-} as the first or last character of
-the character alternative, or put it after a range.  Thus, @samp{[]-]}
-matches both @samp{]} and @samp{-}.  (As explained below, you cannot
-use @samp{\]} to include a @samp{]} inside a character alternative,
-since @samp{\} is not special there.)
+To include a @samp{]} in a character alternative, you must make it the first
+character.  For example, @samp{[]a]} matches @samp{]} or @samp{a}.  To include
+a @samp{-}, write @samp{-} as the last character of the character alternative,
+tho you can also put it first or after a range.  Thus, @samp{[]-]} matches both
address@hidden and @samp{-}.  (As explained below, you cannot use @samp{\]} to
+include a @samp{]} inside a character alternative, since @samp{\} is not
+special there.)
 
 To include @samp{^} in a character alternative, put it anywhere but at
 the beginning.
@@ -559,7 +559,7 @@ tabs, and other characters whose Unicode 
@samp{general-category}
 property (@pxref{Character Properties}) indicates they are spacing
 separators.
 @item [:cntrl:]
-This matches any @acronym{ASCII} control character.
+This matches any character whose code is in the range 0--31.
 @item [:digit:]
 This matches @samp{0} through @samp{9}.  Thus, @samp{[-+[:digit:]]}
 matches any digit, as well as @samp{+} and @samp{-}.
@@ -950,7 +950,7 @@ whitespace:
 @end defun
 
 @cindex optimize regexp
address@hidden regexp-opt strings &optional paren
address@hidden regexp-opt strings &optional paren keep-order
 This function returns an efficient regular expression that will match
 any of the strings in the list @var{strings}.  This is useful when you
 need to make matching or searching as fast as possible---for example,
@@ -960,6 +960,9 @@ possible.  A hand-tuned regular expression can sometimes be 
slightly
 more efficient, but is almost never worth the effort.}.
 @c E.g., see https://debbugs.gnu.org/2816
 
+If @var{strings} is the empty list, the return value is a regexp that
+never matches anything.
+
 The optional argument @var{paren} can be any of the following:
 
 @table @asis
@@ -985,8 +988,15 @@ if it is necessary to ensure that a postfix operator 
appended to
 it will apply to the whole expression.
 @end table
 
-The resulting regexp of @code{regexp-opt} is equivalent to but usually
-more efficient than that of a simplified version:
+The optional argument @var{keep-order}, if @code{nil} or omitted,
+allows the returned regexp to match the strings in any order.  If
address@hidden, the match is guaranteed to be performed in the order
+given, as if the strings were made into a regexp by joining them with
+the @samp{\|} operator.
+
+Up to reordering, the resulting regexp of @code{regexp-opt} is
+equivalent to but usually more efficient than that of a simplified
+version:
 
 @example
 (defun simplified-regexp-opt (strings &optional paren)
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index 6a6f4d5..a7f270c 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Sequences Arrays Vectors
@@ -782,10 +782,11 @@ before being sorted.  @var{function} is a function of one 
argument.
 @end defun
 
 
address@hidden seq-contains sequence elt &optional function
-  This function returns the first element in @var{sequence} that is equal to
address@hidden  If the optional argument @var{function} is address@hidden,
-it is a function of two arguments to use instead of the default @code{equal}.
address@hidden seq-contains-p sequence elt &optional function
+  This function returns address@hidden if at least one element in
address@hidden is equal to @var{elt}.  If the optional argument
address@hidden is address@hidden, it is a function of two arguments to
+use instead of the default @code{equal}.
 
 @example
 @group
@@ -1049,15 +1050,18 @@ that @var{sequence} can be a list, vector or string.  
This is
 primarily useful for side-effects.
 @end defmac
 
address@hidden seq-let arguments sequence address@hidden
address@hidden
address@hidden seq-let var-sequence val-sequence address@hidden
 @cindex sequence destructuring
-  This macro binds the variables defined in @var{arguments} to the
-elements of @var{sequence}.  @var{arguments} can themselves include
-sequences, allowing for nested destructuring.
+  This macro binds the variables defined in @var{var-sequence} to the
+values that are the corresponding elements of @var{val-sequence}.
+This is known as @dfn{destructuring binding}.  The elements of
address@hidden can themselves include sequences, allowing for
+nested destructuring.
 
-The @var{arguments} sequence can also include the @code{&rest} marker
-followed by a variable name to be bound to the rest of
address@hidden
+The @var{var-sequence} sequence can also include the @code{&rest}
+marker followed by a variable name to be bound to the rest of
address@hidden
 
 @example
 @group
@@ -1081,6 +1085,9 @@ followed by a variable name to be bound to the rest of
 @end group
 @result{} [3 4]
 @end example
+
+The @code{pcase} patterns provide an alternative facility for
+destructuring binding, see @ref{Destructuring with pcase Patterns}.
 @end defmac
 
 @defun seq-random-elt sequence
@@ -1771,6 +1778,11 @@ If the ring is full, this function removes the newest 
element to make
 room for the inserted element.
 @end defun
 
address@hidden ring-resize ring size
+Set the size of @var{ring} to @var{size}.  If the new size is smaller,
+then the oldest items in the ring are discarded.
address@hidden defun
+
 @cindex fifo data structure
   If you are careful not to exceed the ring size, you can
 use the ring as a first-in-first-out queue.  For example:
diff --git a/doc/lispref/streams.texi b/doc/lispref/streams.texi
index 032669c..600639f 100644
--- a/doc/lispref/streams.texi
+++ b/doc/lispref/streams.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1994, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1994, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Read and Print
diff --git a/doc/lispref/strings.texi b/doc/lispref/strings.texi
index 3558f17..521f163 100644
--- a/doc/lispref/strings.texi
+++ b/doc/lispref/strings.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Strings and Characters
diff --git a/doc/lispref/symbols.texi b/doc/lispref/symbols.texi
index 11e92f6..a214a2d 100644
--- a/doc/lispref/symbols.texi
+++ b/doc/lispref/symbols.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Symbols
diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi
index dcfade3..b0c04ef 100644
--- a/doc/lispref/syntax.texi
+++ b/doc/lispref/syntax.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Syntax Tables
@@ -556,8 +556,8 @@ the current syntax table in the usual way.
 
 @defvar parse-sexp-lookup-properties
 If this is address@hidden, the syntax scanning functions, like
address@hidden, pay attention to syntax text properties.
-Otherwise they use only the current syntax table.
address@hidden, pay attention to @code{syntax-table} text
+properties.  Otherwise they use only the current syntax table.
 @end defvar
 
 @defvar syntax-propertize-function
@@ -927,9 +927,9 @@ nicely.
 
 @defvar multibyte-syntax-as-symbol
 If this variable is address@hidden, @code{scan-sexps} treats all
address@hidden characters as symbol constituents regardless
-of what the syntax table says about them.  (However, text properties
-can still override the syntax.)
address@hidden characters as symbol constituents regardless of
+what the syntax table says about them.  (However, @code{syntax-table
+}text properties can still override the syntax.)
 @end defvar
 
 @defopt parse-sexp-ignore-comments
@@ -939,7 +939,6 @@ whitespace by the functions in this section and by 
@code{forward-sexp},
 @code{scan-lists} and @code{scan-sexps}.
 @end defopt
 
address@hidden parse-sexp-lookup-properties
 The behavior of @code{parse-partial-sexp} is also affected by
 @code{parse-sexp-lookup-properties} (@pxref{Syntax Properties}).
 
@@ -1042,8 +1041,8 @@ This function returns the syntax code for the raw syntax 
descriptor
 @var{syntax-code} component, masks off the high 16 bits which record
 the syntax flags, and returns the resulting integer.
 
-If @var{syntax} is @code{nil}, the return value is returns @code{nil}.
-This is so that the expression
+If @var{syntax} is @code{nil}, the return value is @code{nil}.  This
+is so that the expression
 
 @example
 (syntax-class (syntax-after pos))
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 6c38d8e..21c5a73 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 1990-1995, 1998-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Text
 @chapter Text
@@ -500,14 +500,14 @@ after point.  It leaves the mark after the inserted text. 
 The value
 is @code{nil}.
 @end deffn
 
address@hidden Command self-insert-command count
address@hidden Command self-insert-command count &optional char
 @cindex character insertion
 @cindex self-insertion
-This command inserts the last character typed; it does so @var{count}
-times, before point, and returns @code{nil}.  Most printing characters
-are bound to this command.  In routine use, @code{self-insert-command}
-is the most frequently called function in Emacs, but programs rarely use
-it except to install it on a keymap.
+This command inserts the character @var{char} (the last character typed);
+it does so @var{count} times, before point, and returns @code{nil}.
+Most printing characters are bound to this command.  In routine use,
address@hidden is the most frequently called function in Emacs,
+but programs rarely use it except to install it on a keymap.
 
 In an interactive call, @var{count} is the numeric prefix argument.
 
@@ -3496,9 +3496,14 @@ property is obsolete; use the @code{cursor-intangible} 
property instead.
 @kindex cursor-intangible @r{(text property)}
 @findex cursor-intangible-mode
 When the minor mode @code{cursor-intangible-mode} is turned on, point
-is moved away of any position that has a address@hidden
+is moved away from any position that has a address@hidden
 @code{cursor-intangible} property, just before redisplay happens.
 
address@hidden cursor-sensor-inhibit
+When the variable @code{cursor-sensor-inhibit} is address@hidden, the
address@hidden property and the
address@hidden property (described below) are ignored.
+
 @item field
 @kindex field @r{(text property)}
 Consecutive characters with the same @code{field} property constitute a
@@ -3680,6 +3685,9 @@ depending on whether the cursor is entering the text that 
has this
 property or leaving it.  The functions are called only when the minor
 mode @code{cursor-sensor-mode} is turned on.
 
+When the variable @code{cursor-sensor-inhibit} is address@hidden, the
address@hidden property is ignored.
+
 @item composition
 @kindex composition @r{(text property)}
 This text property is used to display a sequence of characters as a
@@ -4428,22 +4436,59 @@ all markers unrelocated.
   You can use the following function to replace the text of one buffer
 with the text of another buffer:
 
address@hidden Command replace-buffer-contents source
address@hidden Command replace-buffer-contents source &optional max-secs 
max-costs
 This function replaces the accessible portion of the current buffer
 with the accessible portion of the buffer @var{source}.  @var{source}
 may either be a buffer object or the name of a buffer.  When
 @code{replace-buffer-contents} succeeds, the text of the accessible
 portion of the current buffer will be equal to the text of the
-accessible portion of the @var{source} buffer.  This function attempts
-to keep point, markers, text properties, and overlays in the current
-buffer intact.  One potential case where this behavior is useful is
-external code formatting programs: they typically write the
-reformatted text into a temporary buffer or file, and using
address@hidden and @code{insert-buffer-substring} would destroy
-these properties.  However, the latter combination is typically
-faster.  @xref{Deletion}, and @ref{Insertion}.
+accessible portion of the @var{source} buffer.
+
+This function attempts to keep point, markers, text properties, and
+overlays in the current buffer intact.  One potential case where this
+behavior is useful is external code formatting programs: they
+typically write the reformatted text into a temporary buffer or file,
+and using @code{delete-region} and @code{insert-buffer-substring}
+would destroy these properties.  However, the latter combination is
+typically faster (@xref{Deletion}, and @ref{Insertion}).
+
+For its working, @code{replace-buffer-contents} needs to compare the
+contents of the original buffer with that of @code{source} which is a
+costly operation if the buffers are huge and there is a high number of
+differences between them.  In order to keep
address@hidden's runtime in bounds, it has two
+optional arguments.
+
address@hidden defines a hard boundary in terms of seconds.  If given
+and exceeded, it will fall back to @code{delete-region} and
address@hidden
+
address@hidden defines the quality of the difference computation.
+If the actual costs exceed this limit, heuristics are used to provide
+a faster but suboptimal solution.  The default value is 1000000.
+
address@hidden returns t if a non-destructive
+replacement could be performed.  Otherwise, i.e., if @code{max-secs}
+was exceeded, it returns nil.
 @end deffn
 
address@hidden replace-region-contents beg end replace-fn &optional max-secs 
max-costs
+This function replaces the region between @code{beg} and @code{end}
+using the given @code{replace-fn}.  The function @code{replace-fn} is
+run in the current buffer narrowed to the specified region and it
+should return either a string or a buffer replacing the region.
+
+The replacement is performed using @code{replace-buffer-contents} (see
+above) which also describes the @code{max-secs} and @code{max-costs}
+arguments and the return value.
+
+Note: If the replacement is a string, it will be placed in a temporary
+buffer so that @code{replace-buffer-contents} can operate on it.
+Therefore, if you already have the replacement in a buffer, it makes
+no sense to convert it to a string using @code{buffer-substring} or
+similar.
address@hidden defun
+
 @node Decompression
 @section Dealing With Compressed Data
 
@@ -5171,11 +5216,11 @@ class:
 
 @item A user interface for building JSONRPC applications
 
-In this scenario, the JSONRPC application instantiates
address@hidden objects of one of its concrete subclasses
-using @code{make-instance}.  To initiate a contact to the remote
-endpoint, the JSONRPC application passes this object to the functions
address@hidden'}, @code{jsonrpc-request} and
+In this scenario, the JSONRPC application selects a concrete subclass
+of @code{jsonrpc-connection}, and proceeds to create objects of that
+subclass using @code{make-instance}.  To initiate a contact to the
+remote endpoint, the JSONRPC application passes this object to the
+functions @code{jsonrpc-notify'}, @code{jsonrpc-request} and
 @code{jsonrpc-async-request}.  For handling remotely initiated
 contacts, which generally come in asynchronously, the instantiation
 should include @code{:request-dispatcher} and
diff --git a/doc/lispref/threads.texi b/doc/lispref/threads.texi
index c9d5f79..db68f91 100644
--- a/doc/lispref/threads.texi
+++ b/doc/lispref/threads.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 2012-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2012-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Threads
 @chapter Threads
@@ -17,9 +17,9 @@ correct programs should not rely on cooperative threading.
 
   Currently, thread switching will occur upon explicit request via
 @code{thread-yield}, when waiting for keyboard input or for process
-output (e.g., during @code{accept-process-output}), or during blocking
-operations relating to threads, such as mutex locking or
address@hidden
+output from asynchronous processes (e.g., during
address@hidden), or during blocking operations relating
+to threads, such as mutex locking or @code{thread-join}.
 
   Emacs Lisp provides primitives to create and control threads, and
 also to create and control mutexes and condition variables, useful for
diff --git a/doc/lispref/tips.texi b/doc/lispref/tips.texi
index 08cc10d..d41fe82 100644
--- a/doc/lispref/tips.texi
+++ b/doc/lispref/tips.texi
@@ -1,6 +1,6 @@
 @c -*- mode: texinfo; coding: utf-8 -*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1993, 1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1993, 1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Tips
@@ -679,10 +679,15 @@ starting double-quote is not part of the string!
 @cindex curly quotes
 @cindex curved quotes
 When a documentation string refers to a Lisp symbol, write it as it
-would be printed (which usually means in lower case), surrounding
-it with curved single quotes (@t{‘} and @t{’}).  There are
-two exceptions: write @code{t} and @code{nil} without surrounding
-punctuation.  For example: @samp{CODE can be ‘lambda’, nil, or t}.
+would be printed (which usually means in lower case), surrounding it
+with curved single quotes (@t{‘..’}).  There are two exceptions: write
address@hidden and @code{nil} without surrounding punctuation.  For example:
+
address@hidden
+ CODE can be ‘lambda’, nil, or t.
address@hidden example
+
address@hidden
 @xref{Quotation Marks,,, emacs, The GNU Emacs Manual}, for how to
 enter curved single quotes.
 
@@ -942,7 +947,7 @@ explains these conventions, starting with an example:
 @group
 ;;; foo.el --- Support for the Foo programming language
 
-;; Copyright (C) 2010-2018 Your Name
+;; Copyright (C) 2010-2019 Your Name
 @end group
 
 ;; Author: Your Name <yourname@@example.com>
diff --git a/doc/lispref/two-volume-cross-refs.txt 
b/doc/lispref/two-volume-cross-refs.txt
index b5379df..e3db8ff 100644
--- a/doc/lispref/two-volume-cross-refs.txt
+++ b/doc/lispref/two-volume-cross-refs.txt
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 See end for copying conditions.
 
 Two Volume Cross References
diff --git a/doc/lispref/two-volume.make b/doc/lispref/two-volume.make
index 07a6d2c..63c97c2 100644
--- a/doc/lispref/two-volume.make
+++ b/doc/lispref/two-volume.make
@@ -1,4 +1,4 @@
-# Copyright (C) 2007-2018 Free Software Foundation, Inc.
+# Copyright (C) 2007-2019 Free Software Foundation, Inc.
 # See end for copying conditions.
 
 # although it would be nice to use tex rather than pdftex to avoid
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index 6560660..aca7d2f 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 1990-1995, 1998-2019 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Variables
 @chapter Variables
@@ -2191,9 +2191,9 @@ This function looks for connection-local variables 
according to
 @var{criteria}, and immediately applies them in the current buffer.
 @end defun
 
address@hidden with-connection-local-profiles profiles &rest body
-All connection-local variables, which are specified by a connection
-profile in @var{profiles}, are applied.
address@hidden with-connection-local-variables &rest body
+All connection-local variables, which are specified by
address@hidden, are applied.
 
 After that, @var{body} is executed, and the connection-local variables
 are unwound.  Example:
@@ -2207,8 +2207,15 @@ are unwound.  Example:
 @end group
 
 @group
-(with-connection-local-profiles '(remote-perl)
-  do something useful)
+(connection-local-set-profiles
+  '(:application 'tramp :protocol "ssh" :machine "remotehost")
+  'remote-perl)
address@hidden group
+
address@hidden
+(let ((default-directory "/ssh:remotehost:/working/dir/"))
+  (with-connection-local-variables
+    do something useful))
 @end group
 @end example
 @end defmac
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 52bfbde..6b71632 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2018 Free Software
address@hidden Copyright (C) 1990-1995, 1998-1999, 2001-2019 Free Software
 @c Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @node Windows
@@ -25,9 +25,7 @@ is displayed in windows.
 * Cyclic Window Ordering::  Moving around the existing windows.
 * Buffers and Windows::     Each window displays the contents of a buffer.
 * Switching Buffers::       Higher-level functions for switching to a buffer.
-* Choosing Window::         How to choose a window for displaying a buffer.
-* Display Action Functions:: Subroutines for @code{display-buffer}.
-* Choosing Window Options:: Extra options affecting how buffers are displayed.
+* Displaying Buffers::      Displaying a buffer in a suitable window.
 * Window History::          Each window remembers the buffers displayed in it.
 * Dedicated Windows::       How to avoid displaying another buffer in
                               a specific window.
@@ -200,12 +198,13 @@ relationships between live windows.  The root node of a 
window tree is
 called the @dfn{root window}.  It can be either a live window (if the
 frame has just one window), or an internal window.
 
-  A minibuffer window (@pxref{Minibuffer Windows}) is not part of its
-frame's window tree unless the frame is a minibuffer-only frame.
-Nonetheless, most of the functions in this section accept the
-minibuffer window as an argument.  Also, the function
address@hidden described at the end of this section lists the
-minibuffer window alongside the actual window tree.
+  A minibuffer window (@pxref{Minibuffer Windows}) that is not alone
+on its frame does not have a parent window, so it strictly speaking is
+not part of its frame's window tree.  Nonetheless, it is a sibling
+window of the frame's root window, and thus can be reached via
address@hidden  Also, the function @code{window-tree}
+described at the end of this section lists the minibuffer window
+alongside the actual window tree.
 
 @defun frame-root-window &optional frame-or-window
 This function returns the root window for @var{frame-or-window}.  The
@@ -569,12 +568,6 @@ its pixel height is the pixel height of the screen areas 
spanned by its
 children.
 @end defun
 
address@hidden window-pixel-height-before-size-change &optional Lisp_Object 
&optional window
-This function returns the height of window @var{window} in pixels at the
-time @code{window-size-change-functions} was run for the last time on
address@hidden's frame (@pxref{Window Hooks}).
address@hidden defun
-
 @cindex window pixel width
 @cindex pixel width of a window
 @cindex total pixel width of a window
@@ -589,12 +582,6 @@ If @var{window} is an internal window, its pixel width is 
the width of
 the screen areas spanned by its children.
 @end defun
 
address@hidden window-pixel-width-before-size-change &optional Lisp_Object 
&optional window
-This function returns the width of window @var{window} in pixels at the
-time @code{window-size-change-functions} was run for the last time on
address@hidden's frame (@pxref{Window Hooks}).
address@hidden defun
-
 @cindex full-width window
 @cindex full-height window
   The following functions can be used to determine whether a given
@@ -1542,11 +1529,11 @@ direction as the existing window combination 
(otherwise, a new internal
 window is created anyway).
 
 @item window-size
-This means that @code{display-buffer} makes a new parent window when it
-splits a window and is passed a @code{window-height} or
address@hidden entry in the @var{alist} argument (@pxref{Display
-Action Functions}).  Otherwise, window splitting behaves as for a value
-of @code{nil}.
+This means that @code{display-buffer} makes a new parent window when
+it splits a window and is passed a @code{window-height} or
address@hidden entry in the @var{alist} argument (@pxref{Buffer
+Display Action Functions}).  Otherwise, window splitting behaves as
+for a value of @code{nil}.
 
 @item temp-buffer-resize
 In this case @code{with-temp-buffer-window} makes a new parent window
@@ -1771,7 +1758,7 @@ raise the frame or make sure input focus is directed to 
that frame.
 @xref{Input Focus}.
 @end defun
 
address@hidden select window hook
address@hidden select window hooks
 @cindex running a hook when a window gets selected
 For historical reasons, Emacs does not run a separate hook whenever a
 window gets selected.  Applications and internal routines often
@@ -1787,8 +1774,8 @@ useful.
   However, when its @var{norecord} argument is @code{nil},
 @code{select-window} updates the buffer list and thus indirectly runs
 the normal hook @code{buffer-list-update-hook} (@pxref{Buffer List}).
-Consequently, that hook provides a reasonable way to run a function
-whenever a window gets selected more ``permanently''.
+Consequently, that hook provides one way to run a function whenever a
+window gets selected more ``permanently''.
 
   Since @code{buffer-list-update-hook} is also run by functions that are
 not related to window management, it will usually make sense to save the
@@ -1800,6 +1787,13 @@ temporarily passes a address@hidden @var{norecord} 
argument.  If
 possible, the macro @code{with-selected-window} (see below) should be
 used in such cases.
 
+  Emacs also runs the hook @code{window-selection-change-functions}
+whenever the redisplay routine detects that another window has been
+selected since last redisplay.  @xref{Window Hooks}, for a detailed
+explanation.  @code{window-state-change-functions} (described in the
+same section) is another abnormal hook run after a different window
+has been selected but is triggered by other window changes as well.
+
 @cindex most recently selected windows
   The sequence of calls to @code{select-window} with a address@hidden
 @var{norecord} argument determines an ordering of windows by their
@@ -1879,7 +1873,7 @@ most recently used one (@pxref{Cyclic Window Ordering}).
 @cindex ordering of windows, cyclic
 @cindex window ordering, cyclic
 
-  When you use the command @kbd{C-x o} (@code{other-window}) to select
+  When you use the command @address@hidden o}} (@code{other-window}) to select
 some other window, it moves through live windows in a specific order.
 For any given configuration of windows, this order never varies.  It
 is called the @dfn{cyclic ordering of windows}.
@@ -1899,7 +1893,7 @@ if omitted or @code{nil}, it defaults to the selected 
window.
 The optional argument @var{minibuf} specifies whether minibuffer windows
 should be included in the cyclic ordering.  Normally, when @var{minibuf}
 is @code{nil}, a minibuffer window is included only if it is currently
-active; this matches the behavior of @kbd{C-x o}.  (Note that a
+active; this matches the behavior of @address@hidden o}}.  (Note that a
 minibuffer window is active as long as its minibuffer is in use; see
 @ref{Minibuffers}).
 
@@ -2083,7 +2077,8 @@ variables in the specified buffer.  However, if the 
optional argument
 @var{keep-margins} is address@hidden, it leaves @var{window}'s display
 margins, fringes and scroll bar settings alone.
 
-When writing an application, you should normally use the higher-level
+When writing an application, you should normally use
address@hidden (@pxref{Choosing Window}) or the higher-level
 functions described in @ref{Switching Buffers}, instead of calling
 @code{set-window-buffer} directly.
 
@@ -2168,7 +2163,6 @@ frame on its terminal, the buffer is replaced anyway.
 @node Switching Buffers
 @section Switching to a Buffer in a Window
 @cindex switching to a buffer
address@hidden displaying a buffer
 
 This section describes high-level functions for switching to a specified
 buffer in some window.  In general, ``switching to a buffer'' means to
@@ -2264,6 +2258,12 @@ selected window or never appeared in it before, or if
 buffer.
 @end defopt
 
address@hidden switch-to-buffer-obey-display-actions
+If this variable is address@hidden, @code{switch-to-buffer} respects
+display actions specified by @code{display-buffer-overriding-action},
address@hidden and other display related variables.
address@hidden defopt
+
 The next two commands are similar to @code{switch-to-buffer}, except for
 the described features.
 
@@ -2327,32 +2327,70 @@ unless @var{norecord} is address@hidden
 @end deffn
 
 
address@hidden Displaying Buffers
address@hidden Displaying a Buffer in a Suitable Window
address@hidden buffer display
address@hidden displaying a buffer
+
+This section describes lower-level functions Emacs uses to find or
+create a window for displaying a specified buffer.  The common
+workhorse of these functions is @code{display-buffer} which eventually
+handles all incoming requests for buffer display (@pxref{Choosing
+Window}).
+
+   @code{display-buffer} delegates the task of finding a suitable
+window to so-called action functions (@pxref{Buffer Display Action
+Functions}).  First, @code{display-buffer} compiles a so-called action
+alist---a special association list that action functions can use to
+fine-tune their behavior.  Then it passes that alist on to each action
+function it calls (@pxref{Buffer Display Action Alists}).
+
+   The behavior of @code{display-buffer} is highly customizable.  To
+understand how customizations are used in practice, you may wish to
+study examples illustrating the order of precedence which
address@hidden uses to call action functions (@pxref{Precedence
+of Action Functions}).  To avoid conflicts between Lisp programs
+calling @code{display-buffer} and user customizations of its behavior,
+it may make sense to follow a number of guidelines which are sketched
+in the final part of this section (@pxref{The Zen of Buffer Display}).
+
address@hidden
+* Choosing Window::         How to choose a window for displaying a buffer.
+* Buffer Display Action Functions:: Support functions for buffer display.
+* Buffer Display Action Alists:: Alists for fine-tuning buffer display.
+* Choosing Window Options:: Extra options affecting how buffers are displayed.
+* Precedence of Action Functions:: Examples to explain the precedence of
+                              action functions.
+* The Zen of Buffer Display:: How to avoid that buffers get lost in between
+                              windows.
address@hidden menu
+
+
 @node Choosing Window
address@hidden Choosing a Window for Display
address@hidden Choosing a Window for Displaying a Buffer
 
-  The command @code{display-buffer} flexibly chooses a window for
+The command @code{display-buffer} flexibly chooses a window for
 display, and displays a specified buffer in that window.  It can be
 called interactively, via the key binding @kbd{C-x 4 C-o}.  It is also
 used as a subroutine by many functions and commands, including
 @code{switch-to-buffer} and @code{pop-to-buffer} (@pxref{Switching
 Buffers}).
 
address@hidden buffer display display action
 @cindex display action
address@hidden action function, for @code{display-buffer}
address@hidden action alist, for @code{display-buffer}
   This command performs several complex steps to find a window to
 display in.  These steps are described by means of @dfn{display
-actions}, which have the form @code{(@var{function} . @var{alist})}.
-Here, @var{function} is either a function or a list of functions,
-which we refer to as @dfn{action functions}; @var{alist} is an
-association list, which we refer to as an @dfn{action alist}.
+actions}, which have the form @code{(@var{functions} . @var{alist})}.
+Here, @var{functions} is either a single function or a list of
+functions, referred to as ``action functions'' (@pxref{Buffer Display
+Action Functions}); and @var{alist} is an association list, referred
+to as ``action alist'' (@pxref{Buffer Display Action Alists}).
address@hidden Zen of Buffer Display}, for samples of display actions.
 
   An action function accepts two arguments: the buffer to display and
 an action alist.  It attempts to display the buffer in some window,
 picking or creating a window according to its own criteria.  If
 successful, it returns the window; otherwise, it returns @code{nil}.
address@hidden Action Functions}, for a list of predefined action
-functions.
 
   @code{display-buffer} works by combining display actions from
 several sources, and calling the action functions in turn, until one
@@ -2363,12 +2401,14 @@ value.
 This command makes @var{buffer-or-name} appear in some window, without
 selecting the window or making the buffer current.  The argument
 @var{buffer-or-name} must be a buffer or the name of an existing
-buffer.  The return value is the window chosen to display the buffer.
+buffer.  The return value is the window chosen to display the buffer,
+or @code{nil} if no suitable window was found.
 
 The optional argument @var{action}, if address@hidden, should normally
 be a display action (described above).  @code{display-buffer} builds a
 list of action functions and an action alist, by consolidating display
-actions from the following sources (in order):
+actions from the following sources (in order of their precedence,
+from highest to lowest):
 
 @itemize
 @item
@@ -2388,40 +2428,65 @@ The constant @code{display-buffer-fallback-action}.
 @end itemize
 
 @noindent
-Each action function is called in turn, passing the buffer as the
-first argument and the combined action alist as the second argument,
-until one of the functions returns address@hidden  The caller can
-pass @code{(allow-no-window . t)} as an element of the action alist to
-indicate its readiness to handle the case of not displaying the
-buffer in a window.
+In practice this means that @code{display-buffer} builds a list of all
+action functions specified by these display actions.  The first
+element of this list is the first action function specified by
address@hidden, if any.  Its last element is
address@hidden last action function
+specified by @code{display-buffer-fallback-action}.  Duplicates are
+not removed from this list---hence one and the same action function
+may be called multiple times during one call of @code{display-buffer}.
+
address@hidden calls the action functions specified by this
+list in turn, passing the buffer as the first argument and the
+combined action alist as the second argument, until one of the
+functions returns address@hidden  @xref{Precedence of Action
+Functions}, for examples how display actions specified by different
+sources are processed by @code{display-buffer}.
+
+Note that the second argument is always the list of @emph{all} action
+alist entries specified by the sources named above.  Hence, the first
+element of that list is the first action alist entry specified by
address@hidden, if any.  Its last element is
+the last alist entry of @code{display-buffer-base-action}, if any (the
+action alist of @code{display-buffer-fallback-action} is empty).
+
+Note also, that the combined action alist may contain duplicate
+entries and entries for the same key with different values.  As a
+rule, action functions always use the first association of a key they
+find.  Hence, the association an action function uses is not
+necessarily the association provided by the display action that
+specified that action function,
 
 The argument @var{action} can also have a address@hidden, non-list
 value.  This has the special meaning that the buffer should be
 displayed in a window other than the selected one, even if the
 selected window is already displaying it.  If called interactively
-with a prefix argument, @var{action} is @code{t}.
+with a prefix argument, @var{action} is @code{t}.  Lisp programs
+should always supply a list value.
 
 The optional argument @var{frame}, if address@hidden, specifies which
 frames to check when deciding whether the buffer is already displayed.
-It is equivalent to adding an element @code{(reusable-frames
-. @var{frame})} to the action alist of @var{action}.  @xref{Display
-Action Functions}.
+It is equivalent to adding an element @address@hidden(reusable-frames
+. @var{frame})}} to the action alist of @var{action} (@pxref{Buffer
+Display Action Alists}).  The @var{frame} argument is provided for
+compatibility reasons, Lisp programs should not use it.
 @end deffn
 
 @defvar display-buffer-overriding-action
 The value of this variable should be a display action, which is
 treated with the highest priority by @code{display-buffer}.  The
-default value is empty, i.e., @code{(nil . nil)}.
+default value is an empty display action, i.e., @address@hidden(nil . nil)}}.
 @end defvar
 
 @defopt display-buffer-alist
 The value of this option is an alist mapping conditions to display
 actions.  Each condition may be either a regular expression matching a
 buffer name or a function that takes two arguments: a buffer name and
-the @var{action} argument passed to @code{display-buffer}.  If the name
-of the buffer passed to @code{display-buffer} either matches a regular
-expression in this alist or the function specified by a condition
-returns address@hidden, then @code{display-buffer} uses the
+the @var{action} argument passed to @code{display-buffer}.  If either
+the name of the buffer passed to @code{display-buffer} matches a
+regular expression in this alist, or the function specified by a
+condition returns address@hidden, then @code{display-buffer} uses the
 corresponding display action to display the buffer.
 @end defopt
 
@@ -2437,13 +2502,19 @@ This display action specifies the fallback behavior for
 @end defvr
 
 
address@hidden Display Action Functions
address@hidden Action Functions for @code{display-buffer}
address@hidden Buffer Display Action Functions
address@hidden Action Functions for Buffer Display
address@hidden buffer display action function
address@hidden action function, for buffer display
 
-The following basic action functions are defined in Emacs.  Each of
-these functions takes two arguments: @var{buffer}, the buffer to
-display, and @var{alist}, an action alist.  Each action function
-returns the window if it succeeds, and @code{nil} if it fails.
+An @dfn{action function} is a function @code{display-buffer} calls for
+choosing a window to display a buffer.  Action functions take two
+arguments: @var{buffer}, the buffer to display, and @var{alist}, an
+action alist (@pxref{Buffer Display Action Alists}).  They are
+supposed to return a window displaying @var{buffer} if they succeed
+and @code{nil} if they fail.
+
+   The following basic action functions are defined in Emacs.
 
 @defun display-buffer-same-window buffer alist
 This function tries to display @var{buffer} in the selected window.
@@ -2453,57 +2524,105 @@ to another buffer (@pxref{Dedicated Windows}).  It 
also fails if
 @end defun
 
 @defun display-buffer-reuse-window buffer alist
-This function tries to display @var{buffer} by finding a window
-that is already displaying it.
+This function tries to display @var{buffer} by finding a window that
+is already displaying it.
 
 If @var{alist} has a address@hidden @code{inhibit-same-window} entry,
-the selected window is not eligible for reuse.  If @var{alist}
-contains a @code{reusable-frames} entry, its value determines which
-frames to search for a reusable window:
-
address@hidden @bullet
address@hidden
address@hidden means consider windows on the selected frame.
-(Actually, the last non-minibuffer frame.)
address@hidden
address@hidden means consider windows on all frames.
address@hidden
address@hidden means consider windows on all visible frames.
address@hidden
-0 means consider windows on all visible or iconified frames.
address@hidden
-A frame means consider windows on that frame only.
address@hidden itemize
-
-Note that these meanings differ slightly from those of the
address@hidden argument to @code{next-window} (@pxref{Cyclic Window
-Ordering}).
-
-If @var{alist} contains no @code{reusable-frames} entry, this function
-normally searches just the selected frame; however, if the variable
address@hidden is address@hidden, it searches all frames on the
-current terminal.  @xref{Choosing Window Options}.
-
-If this function chooses a window on another frame, it makes that frame
-visible and, unless @var{alist} contains an @code{inhibit-switch-frame}
-entry (@pxref{Choosing Window Options}), raises that frame if necessary.
+the selected window is not eligible for reuse.  The set of frames to
+search for a window already displaying @var{buffer} can be specified
+with the help of the @code{reusable-frames} action alist entry.  If
address@hidden contains no @code{reusable-frames} entry, this function
+searches just the selected frame.
+
+If this function chooses a window on another frame, it makes that
+frame visible and, unless @var{alist} contains an
address@hidden entry, raises that frame if necessary.
 @end defun
 
 @defun display-buffer-reuse-mode-window buffer alist
 This function tries to display @var{buffer} by finding a window
 that is displaying a buffer in a given mode.
 
-If @var{alist} contains a @code{mode} entry, its value is a major mode
-(a symbol) or a list of major modes.  If @var{alist} contains no
address@hidden entry, the current major mode of @var{buffer} is used.  A
-window is a candidate if it displays a buffer that derives from one of
-the given modes.
+If @var{alist} contains a @code{mode} entry, its value specifes a
+major mode (a symbol) or a list of major modes.  If @var{alist}
+contains no @code{mode} entry, the current major mode of @var{buffer}
+is used instead.  A window is a candidate if it displays a buffer
+whose mode derives from one of the modes specified thusly.
 
-The behavior is also controlled by entries for
+The behavior is also controlled by @var{alist} entries for
 @code{inhibit-same-window}, @code{reusable-frames} and
address@hidden as is done in the function
address@hidden
address@hidden, like @code{display-buffer-reuse-window}
+does.
address@hidden defun
+
address@hidden display-buffer-pop-up-window buffer alist
+This function tries to display @var{buffer} by splitting the largest
+or least recently-used window (usually located on the selected frame).
+It actually performs the split by calling the function specified by
address@hidden (@pxref{Choosing Window
+Options}).
+
+The size of the new window can be adjusted by supplying
address@hidden and @code{window-width} entries in @var{alist}.
+If @var{alist} contains a @code{preserve-size} entry, Emacs will also
+try to preserve the size of the new window during future resize
+operations (@pxref{Preserving Window Sizes}).
+
+This function fails if no window can be split.  More often than not,
+this happens because no window is large enough to allow splitting.
+Setting @code{split-height-threshold} or @code{split-width-threshold}
+to lower values may help in this regard.  Spliting also fails when the
+selected frame has an @code{unsplittable} frame parameter;
address@hidden Parameters}.
address@hidden defun
+
address@hidden display-buffer-in-previous-window buffer alist
+This function tries to display @var{buffer} in a window where it was
+previously displayed.  If @var{alist} has a address@hidden
address@hidden entry, the selected window is not eligible
+for reuse.  If @var{alist} contains a @code{reusable-frames} entry,
+its value determines which frames to search for a suitable window.
 
+If @var{alist} has a @code{previous-window} entry and the window
+specified by that entry is live and not dedicated to another buffer,
+that window will be preferred, even if it never showed @var{buffer}
+before.
address@hidden defun
+
address@hidden display-buffer-use-some-window buffer alist
+This function tries to display @var{buffer} by choosing an existing
+window and displaying the buffer in that window.  It can fail if all
+windows are dedicated to other buffers (@pxref{Dedicated Windows}).
address@hidden defun
+
address@hidden display-buffer-below-selected buffer alist
+This function tries to display @var{buffer} in a window below the
+selected window.  If there is a window below the selected one and that
+window already displays @var{buffer}, it reuses that window.
+
+If there is no such window, this function tries to create a new window
+by splitting the selected one, and displays @var{buffer} there.  It will
+also try to adjust that window's size provided @var{alist} contains a
+suitable @code{window-height} or @code{window-width} entry, see above.
+
+If splitting the selected window fails and there is a non-dedicated
+window below the selected one showing some other buffer, this function
+tries to use that window for showing @var{buffer}.
+
+If @var{alist} contains a @code{window-min-height} entry, this
+function ensures that the window used is or can become at least as
+high as specified by that entry's value.  Note that this is only a
+guarantee.  In order to actually resize the window used, @var{alist}
+must also provide an appropriate @code{window-height} entry.
address@hidden defun
+
address@hidden display-buffer-at-bottom buffer alist
+This function tries to display @var{buffer} in a window at the bottom
+of the selected frame.
+
+This either tries to split the window at the bottom of the frame or
+the frame's root window, or to reuse an existing window at the bottom
+of the selected frame.
 @end defun
 
 @defun display-buffer-pop-up-frame buffer alist
@@ -2511,37 +2630,37 @@ This function creates a new frame, and displays the 
buffer in that
 frame's window.  It actually performs the frame creation by calling
 the function specified in @code{pop-up-frame-function}
 (@pxref{Choosing Window Options}).  If @var{alist} contains a
address@hidden entry, the associated value
-is added to the newly created frame's parameters.
address@hidden entry, the associated value is added to
+the newly created frame's parameters.
 @end defun
 
 @defun display-buffer-in-child-frame buffer alist
 This function tries to display @var{buffer} in a child frame
-(@pxref{Child Frames}) of the selected frame, either reusing an existing
-child frame or by making a new one.  If @var{alist} has a address@hidden
address@hidden entry, the corresponding value is an alist
-of frame parameters to give the new frame.  A @code{parent-frame}
-parameter specifying the selected frame is provided by default.  If the
-child frame should be or become the child of another frame, a
-corresponding entry must be added to @var{alist}.
+(@pxref{Child Frames}) of the selected frame, either reusing an
+existing child frame or by making a new one.  If @var{alist} has a
address@hidden @code{child-frame-parameters} entry, the corresponding
+value is an alist of frame parameters to give the new frame.  A
address@hidden parameter specifying the selected frame is
+provided by default.  If the child frame should become the child of
+another frame, a corresponding entry must be added to @var{alist}.
 
 The appearance of child frames is largely dependent on the parameters
 provided via @var{alist}.  It is advisable to use at least ratios to
 specify the size (@pxref{Size Parameters}) and the position
-(@pxref{Position Parameters}) of the child frame and to add the
address@hidden in order to make sure that the child frame remains
-visible.  For other parameters that should be considered see @ref{Child
-Frames}.
+(@pxref{Position Parameters}) of the child frame, and to add a
address@hidden parameter (@pxref{Frame Interaction Parameters}), in
+order to make sure that the child frame remains visible.  For other
+parameters that should be considered see @ref{Child Frames}.
 @end defun
 
 @defun display-buffer-use-some-frame buffer alist
-This function tries to display @var{buffer} by trying to find a
-frame that meets a predicate (by default any frame other than the
-current frame).
+This function tries to display @var{buffer} by finding a frame that
+meets a predicate (by default any frame other than the selected
+frame).
 
-If this function chooses a window on another frame, it makes that frame
-visible and, unless @var{alist} contains an @code{inhibit-switch-frame}
-entry (@pxref{Choosing Window Options}), raises that frame if necessary.
+If this function chooses a window on another frame, it makes that
+frame visible and, unless @var{alist} contains an
address@hidden entry, raises that frame if necessary.
 
 If @var{alist} has a address@hidden @code{frame-predicate} entry, its
 value is a function taking one argument (a frame), returning
@@ -2549,237 +2668,328 @@ address@hidden if the frame is a candidate; this 
function replaces the
 default predicate.
 
 If @var{alist} has a address@hidden @code{inhibit-same-window} entry,
-the selected window is used; thus if the selected frame has a single
-window, it is not used.
+the selected window is not used; thus if the selected frame has a
+single window, it is not used.
 @end defun
 
address@hidden display-buffer-pop-up-window buffer alist
-This function tries to display @var{buffer} by splitting the largest
-or least recently-used window (typically one on the selected frame).
-It actually performs the split by calling the function specified in
address@hidden (@pxref{Choosing Window
-Options}).
-
-The size of the new window can be adjusted by supplying
address@hidden and @code{window-width} entries in @var{alist}.  To
-adjust the window's height, use an entry whose @sc{car} is
address@hidden and whose @sc{cdr} is one of:
-
address@hidden @bullet
address@hidden
address@hidden means to leave the height of the new window alone.
address@hidden display-buffer-no-window buffer alist
+If @var{alist} has a address@hidden @code{allow-no-window} entry, then
+this function does not display @var{buffer} and returns the symbol
address@hidden  This constitutes the only exception to the convention
+that an action function returns either @code{nil} or a window showing
address@hidden  If @var{alist} has no such @code{allow-no-window}
+entry, this function returns @code{nil}.
+
+If this function returns @code{fail}, @code{display-buffer} will skip
+the execution of any further display actions and return @code{nil}
+immediately.  If this function returns @code{nil},
address@hidden will continue with the next display action, if
+any.
 
address@hidden
-A number specifies the desired height of the new window.  An integer
-specifies the number of lines of the window.  A floating-point
-number gives the fraction of the window's height with respect to the
-height of the frame's root window.
+It is assumed that when a caller of @code{display-buffer} specifies a
address@hidden @code{allow-no-window} entry, it is also able to handle
+a @code{nil} return value.
address@hidden defun
 
address@hidden
-If the @sc{cdr} specifies a function, that function is called with one
-argument: the new window.  The function is supposed to adjust the
-height of the window; its return value is ignored.  Suitable functions
-are @code{shrink-window-if-larger-than-buffer} and
address@hidden, see @ref{Resizing Windows}.
address@hidden itemize
+Two other action functions are described in their proper
address@hidden (@pxref{Displaying
+Buffers in Side Windows}) and @code{display-buffer-in-atom-window}
+(@pxref{Atomic Windows}).
+
+
address@hidden Buffer Display Action Alists
address@hidden Action Alists for Buffer Display
address@hidden buffer display action alist
address@hidden action alist for buffer display
+
+An @dfn{action alist} is an association list mapping predefined
+symbols recognized by action functions to values these functions are
+supposed to interpret accordingly.  In each call,
address@hidden constructs a new, possibly empty action alist
+and passes that entire list on to any action function it calls.
+
+   By design, action functions are free in their interpretation of
+action alist entries.  In fact, some entries like
address@hidden or @code{previous-window} have a meaning only
+for one or a few action functions, and are ignored by the rest.  Other
+entries, like @code{inhibit-same-window} or @code{window-parameters},
+are supposed to be respected by most action functions, including those
+provided by application programs and external packages.
+
+   In the previous subsection we have described in detail how
+individual action functions interpret the action alist entries they
+care about.  Here we give a reference list of all known action alist
+entries according to their symbols, together with their values and
+action functions (@pxref{Buffer Display Action Functions}) that
+recognize them.  Throughout this list, the terms ``buffer'' will refer
+to the buffer @code{display-buffer} is supposed to display, and
+``value'' refers to the entry's value.
 
-To adjust the window's width, use an entry whose @sc{car} is
address@hidden and whose @sc{cdr} is one of:
address@hidden @code
address@hidden address@hidden, a buffer display action alist entry}
address@hidden inhibit-same-window
+If the value is address@hidden, this signals that the selected window
+must not be used for displaying the buffer.  All action functions that
+(re-)use an existing window should respect this entry.
+
address@hidden address@hidden, a buffer display action alist entry}
address@hidden previous-window
+The value must specify a window that may have displayed the buffer
+previously.  @code{display-buffer-in-previous-window} will give
+preference to such a window provided it is still live and not
+dedicated to another buffer.
+
address@hidden address@hidden, a buffer display action alist entry}
address@hidden mode
+The value is either a major mode or a list of major modes.
address@hidden may reuse a window whenever
+the value specified by this entry matches the major mode of that
+window's buffer.  Other action functions ignore such entries.
+
address@hidden address@hidden, a buffer display action alist entry}
address@hidden frame-predicate
+The value must be a function taking one argument (a frame), supposed
+to return address@hidden if that frame is a candidate for displaying
+the buffer.  This entry is used by
address@hidden
+
address@hidden address@hidden, a buffer display action alist entry}
address@hidden reusable-frames
+The value specifies the set of frames to search for a window that can
+be reused because it already displays the buffer.  It can be set as
+follows:
 
 @itemize @bullet
 @item
address@hidden means to leave the width of the new window alone.
-
address@hidden means consider only windows on the selected frame.
+(Actually, the last frame used that is not a minibuffer-only frame.)
 @item
-A number specifies the desired width of the new window.  An integer
-specifies the number of columns of the window.  A floating-point
-number gives the fraction of the window's width with respect to the
-width of the frame's root window.
-
address@hidden means consider windows on all frames.
address@hidden
address@hidden means consider windows on all visible frames.
 @item
-If the @sc{cdr} specifies a function, that function is called with one
-argument: the new window.  The function is supposed to adjust the width
-of the window; its return value is ignored.
+0 means consider windows on all visible or iconified frames.
address@hidden
+A frame means consider windows on that frame only.
 @end itemize
 
-If @var{alist} contains a @code{preserve-size} entry, Emacs will try to
-preserve the size of the new window during future resize operations
-(@pxref{Preserving Window Sizes}).  The @sc{cdr} of that entry must be a
-cons cell whose @sc{car}, if address@hidden, means to preserve the width
-of the window and whose @sc{cdr}, if address@hidden, means to preserve
-the height of the window.
-
-This function can fail if no window splitting can be performed for some
-reason (e.g., if the selected frame has an @code{unsplittable} frame
-parameter; @pxref{Buffer Parameters}).
address@hidden defun
+Note that the meaning of @code{nil} differs slightly from that of the
address@hidden argument to @code{next-window} (@pxref{Cyclic Window
+Ordering}).
 
address@hidden display-buffer-below-selected buffer alist
-This function tries to display @var{buffer} in a window below the
-selected window.  If there is a window below the selected one and that
-window already displays @var{buffer}, it reuses that window.
+A major client of this is @code{display-buffer-reuse-window}, but all
+other action functions that try to reuse a window are affected as
+well.
 
-If there is no such window, this function tries to create a new window
-by splitting the selected one and display @var{buffer} there.  It will
-also adjust that window's size provided @var{alist} contains a suitable
address@hidden or @code{window-width} entry, see above.
address@hidden address@hidden, a buffer display action alist entry}
address@hidden inhibit-switch-frame
+A address@hidden value prevents another frame from being raised or
+selected, if the window chosen by @code{display-buffer} is displayed
+there.  Primarily affected by this are
address@hidden and
address@hidden
address@hidden should be affected as well, but
+there is no guarantee that the window manager will comply.
+
address@hidden address@hidden, a buffer display action alist entry}
address@hidden window-parameters
+The value specifies an alist of window parameters to give the chosen
+window.  All action functions that choose a window should process this
+entry.
+
address@hidden address@hidden, a buffer display action alist entry}
address@hidden window-min-height
+The value specifies a minimum height of the window used, in lines.  If
+a window is not or cannot be made as high as specified by this entry,
+the window is not considered for use.  The only client of this entry
+is presently @code{display-buffer-below-selected}.
+
+Note that providing such an entry alone does not necessarily make the
+window as tall as specified by its value.  To actually resize an
+existing window or make a new window as tall as specified by that
+value, a @code{window-height} entry specifying that value should be
+provided as well.  Such a @code{window-height} entry can, however,
+specify a completely different value or ask the window height to be
+fit to that of its buffer in which case the @code{window-min-height}
+entry provides the guaranteed minimum height of the window used.
+
address@hidden address@hidden, a buffer display action alist entry}
address@hidden window-height
+The value specifies whether and how to adjust the height of the chosen
+window and can be one of the following:
 
-If splitting the selected window fails and there is a non-dedicated
-window below the selected one showing some other buffer, it uses that
-window for showing @var{buffer}.
address@hidden defun
address@hidden @bullet
address@hidden
address@hidden means to leave the height of the chosen window alone.
 
address@hidden display-buffer-in-previous-window buffer alist
-This function tries to display @var{buffer} in a window previously
-showing it.  If @var{alist} has a address@hidden
address@hidden entry, the selected window is not eligible
-for reuse.  If @var{alist} contains a @code{reusable-frames} entry, its
-value determines which frames to search for a suitable window as with
address@hidden
address@hidden
+An integer number specifies the desired total height of the chosen
+window in lines.
 
-If @var{alist} has a @code{previous-window} entry, the window
-specified by that entry will override any other window found by the
-methods above, even if that window never showed @var{buffer} before.
address@hidden defun
address@hidden
+A floating-point number specifies the fraction of the chosen window's
+desired total height with respect to the total height of its frame's
+root window.
 
address@hidden display-buffer-at-bottom buffer alist
-This function tries to display @var{buffer} in a window at the bottom
-of the selected frame.
address@hidden
+If the value specifies a function, that function is called with one
+argument---the chosen window.  The function is supposed to adjust the
+height of the window; its return value is ignored.  Suitable functions
+are @code{shrink-window-if-larger-than-buffer} and
address@hidden, see @ref{Resizing Windows}.
address@hidden itemize
 
-This either splits the window at the bottom of the frame or the
-frame's root window, or reuses an existing window at the bottom of the
-selected frame.
address@hidden defun
+By convention, the height of the chosen window is adjusted only if the
+window is part of a vertical combination (@pxref{Windows and Frames})
+to avoid changing the height of other, unrelated windows.  Also, this
+entry should be processed only under certain conditions which are
+specified right below this list.
 
address@hidden display-buffer-use-some-window buffer alist
-This function tries to display @var{buffer} by choosing an existing
-window and displaying the buffer in that window.  It can fail if all
-windows are dedicated to another buffer (@pxref{Dedicated Windows}).
address@hidden defun
address@hidden address@hidden, a buffer display action alist entry}
address@hidden window-width
+This entry is similar to the @code{window-height} entry described
+before, but used to adjust the chosen window's width instead.  The
+value can be one of the following:
 
address@hidden display-buffer-no-window buffer alist
-If @var{alist} has a address@hidden @code{allow-no-window} entry, then
-this function does not display @code{buffer}.  This allows you to
-override the default action and avoid displaying the buffer.  It is
-assumed that when the caller specifies a address@hidden
address@hidden value it can handle a @code{nil} value returned
-from @code{display-buffer} in this case.
address@hidden defun
address@hidden @bullet
address@hidden
address@hidden means to leave the width of the chosen window alone.
 
-If the @var{alist} argument of any of these functions contains a
address@hidden entry, @code{display-buffer} assigns the
-elements of the associated value as window parameters of the chosen
-window.
address@hidden
+An integer specifies the desired total width of the chosen window in
+columns.
 
-   To illustrate the use of action functions, consider the following
-example.
address@hidden
+A floating-point number specifies the fraction of the chosen window's
+desired total width with respect to the total width of the frame's
+root window.
 
address@hidden
address@hidden
-(display-buffer
- (get-buffer-create "*foo*")
- '((display-buffer-reuse-window
-    display-buffer-pop-up-window
-    display-buffer-pop-up-frame)
-   (reusable-frames . 0)
-   (window-height . 10) (window-width . 40)))
address@hidden group
address@hidden example
address@hidden
+If the value specifies a function, that function is called with one
+argument---the chosen window.  The function is supposed to adjust the
+width of the window; its return value is ignored.
address@hidden itemize
 
address@hidden
-Evaluating the form above will cause @code{display-buffer} to proceed as
-follows: If a buffer called *foo* already appears on a visible or
-iconified frame, it will reuse its window.  Otherwise, it will try to
-pop up a new window or, if that is impossible, a new frame and show the
-buffer there.  If all these steps fail, it will proceed using whatever
address@hidden and
address@hidden prescribe.
-
-   Furthermore, @code{display-buffer} will try to adjust a reused window
-(provided *foo* was put by @code{display-buffer} there before) or a
-popped-up window as follows: If the window is part of a vertical
-combination, it will set its height to ten lines.  Note that if, instead
-of the number 10, we specified the function
address@hidden, @code{display-buffer} would come up with a
-one-line window to fit the empty buffer.  If the window is part of a
-horizontal combination, it sets its width to 40 columns.  Whether a new
-window is vertically or horizontally combined depends on the shape of
-the window split and the values of
address@hidden, @code{split-height-threshold}
-and @code{split-width-threshold} (@pxref{Choosing Window Options}).
-
-   Now suppose we combine this call with a preexisting setup for
address@hidden as follows.
+By convention, the width of the chosen window is adjusted only if the
+window is part of a horizontal combination (@pxref{Windows and
+Frames}) to avoid changing the width of other, unrelated windows.
+Also, this entry should be processed under only certain conditions
+which are specified right below this list.
+
address@hidden address@hidden, a buffer display action alist entry}
address@hidden dedicated
+If address@hidden, such an entry tells @code{display-buffer} to mark
+any window it creates as dedicated to its buffer (@pxref{Dedicated
+Windows}).  It does that by calling @code{set-window-dedicated-p} with
+the chosen window as first argument and the entry's value as second.
+
address@hidden address@hidden, a buffer display action alist entry}
address@hidden preserve-size
+If address@hidden such an entry tells Emacs to preserve the size of
+the window chosen (@pxref{Preserving Window Sizes}).  The value should
+be either @address@hidden(t . nil)}} to preserve the width of the window,
address@hidden@code{(nil . t)}} to preserve its height or @address@hidden(t . 
t)}} to
+preserve both, its width and its height.  This entry should be
+processed only under certain conditions which are specified right
+after this list.
+
address@hidden address@hidden, a buffer display action alist entry}
address@hidden pop-up-frame-parameters
+The value specifies an alist of frame parameters to give a new frame,
+if one is created.  @code{display-buffer-pop-up-frame} is its one and
+only addressee.
+
address@hidden address@hidden, a buffer display action alist entry}
address@hidden parent-frame
+The value specifies the parent frame to be used when the buffer is
+displayed on a child frame.  This entry is used only by
address@hidden
+
address@hidden address@hidden, a buffer display action alist entry}
address@hidden child-frame-parameters
+The value specifies an alist of frame parameters to use when the buffer
+is displayed on a child frame.  This entry is used only by
address@hidden
+
address@hidden address@hidden, a buffer display action alist entry}
address@hidden side
+The value denotes the side of the frame or window where a new window
+displaying the buffer shall be created.  This entry is used by
address@hidden to indicate the side of the frame
+where a new side window shall be placed (@pxref{Displaying Buffers in
+Side Windows}).  It is also used by
address@hidden to indicate the side of an
+existing window where the new window shall be located (@pxref{Atomic
+Windows}).
 
address@hidden
address@hidden
-(let ((display-buffer-alist
-       (cons
-        '("\\*foo\\*"
-          (display-buffer-reuse-window display-buffer-below-selected)
-          (reusable-frames)
-          (window-height . 5))
-        display-buffer-alist)))
-  (display-buffer
-   (get-buffer-create "*foo*")
-   '((display-buffer-reuse-window
-      display-buffer-pop-up-window
-      display-buffer-pop-up-frame)
-     (reusable-frames . 0)
-     (window-height . 10) (window-width . 40))))
address@hidden group
address@hidden example
address@hidden address@hidden, a buffer display action alist entry}
address@hidden slot
+If address@hidden, the value specifies the slot of the side window
+supposed to display the buffer.  This entry is used only by
address@hidden
 
address@hidden
-This form will have @code{display-buffer} first try reusing a window
-that shows *foo* on the selected frame.  If there's no such window, it
-will try to split the selected window or, if that is impossible, use the
-window below the selected window.
address@hidden address@hidden, a buffer display action alist entry}
address@hidden window
+The value specifies a window that is in some way related to the window
+chosen by @code{display-buffer}.  This entry is currently used by
address@hidden to indicate the window on whose
+side the new window shall be created.
+
address@hidden address@hidden, a buffer display action alist entry}
address@hidden allow-no-window
+If the value is address@hidden, @code{display-buffer} does not
+necessarily have to display the buffer and the caller is prepared to
+accept that.  This entry is not intended for user customizations,
+since there is no guarantee that an arbitrary caller of
address@hidden will be able to handle the case that no window
+will display the buffer.  @code{display-buffer-no-window} is the only
+action function that cares about this entry.
address@hidden table
 
-   If there's no window below the selected one, or the window below the
-selected one is dedicated to its buffer, @code{display-buffer} will
-proceed as described in the previous example.  Note, however, that when
-it tries to adjust the height of any reused or popped-up window, it will
-in any case try to set its number of lines to 5 since that value
-overrides the corresponding specification in the @var{action} argument
-of @code{display-buffer}.
+By convention, the entries @code{window-height}, @code{window-width}
+and @code{preserve-size} are applied after the chosen window's buffer
+has been set up and if and only if that window never showed another
+buffer before.  More precisely, the latter means that the window must
+have been either created by the current @code{display-buffer} call or
+the window was created earlier by @code{display-buffer} to show the
+buffer and never was used to show another buffer until it was reused
+by the current invocation of @code{display-buffer}.
 
 
 @node Choosing Window Options
address@hidden Additional Options for Displaying Buffers
address@hidden Additional Options for Displaying Buffers
 
-The behavior of the standard display actions of @code{display-buffer}
-(@pxref{Choosing Window}) can be modified by a variety of user
-options.
+The behavior of buffer display actions (@pxref{Choosing Window}) can
+be further modified by the following user options.
 
 @defopt pop-up-windows
 If the value of this variable is address@hidden, @code{display-buffer}
 is allowed to split an existing window to make a new window for
 displaying in.  This is the default.
 
-This variable is provided mainly for backward compatibility.  It is
+This variable is provided for backward compatibility only.  It is
 obeyed by @code{display-buffer} via a special mechanism in
address@hidden, which only calls the action
-function @code{display-buffer-pop-up-window} (@pxref{Display Action
-Functions}) when the value is @code{nil}.  It is not consulted by
address@hidden itself, which the user may specify
-directly in @code{display-buffer-alist} etc.
address@hidden, which calls the action function
address@hidden (@pxref{Buffer Display Action
+Functions}) when the value of this option is address@hidden  It is
+not consulted by @code{display-buffer-pop-up-window} itself, which the
+user may specify directly in @code{display-buffer-alist} etc.
 @end defopt
 
 @defopt split-window-preferred-function
 This variable specifies a function for splitting a window, in order to
 make a new window for displaying a buffer.  It is used by the
 @code{display-buffer-pop-up-window} action function to actually split
-the window (@pxref{Display Action Functions}).
+the window.
 
-The default value is @code{split-window-sensibly}, which is documented
-below.  The value must be a function that takes one argument, a window,
-and return either a new window (which will be used to display the
-desired buffer) or @code{nil} (which means the splitting failed).
+The value must be a function that takes one argument, a window, and
+returns either a new window (which will be used to display the desired
+buffer) or @code{nil} (which means the splitting failed).  The default
+value is @code{split-window-sensibly}, which is documented next.
 @end defopt
 
 @defun split-window-sensibly &optional window
-This function tries to split @var{window}, and return the newly created
+This function tries to split @var{window} and return the newly created
 window.  If @var{window} cannot be split, it returns @code{nil}.  If
 @var{window} is omitted or @code{nil}, it defaults to the selected
 window.
@@ -2790,31 +3000,31 @@ placing the new window below, subject to the 
restriction imposed by
 @code{split-height-threshold} (see below), in addition to any other
 restrictions.  If that fails, it tries to split by placing the new
 window to the right, subject to @code{split-width-threshold} (see
-below).  If that fails, and the window is the only window on its
+below).  If that also fails, and the window is the only window on its
 frame, this function again tries to split and place the new window
 below, disregarding @code{split-height-threshold}.  If this fails as
 well, this function gives up and returns @code{nil}.
 @end defun
 
 @defopt split-height-threshold
-This variable, used by @code{split-window-sensibly}, specifies whether
-to split the window placing the new window below.  If it is an
+This variable specifies whether @code{split-window-sensibly} is
+allowed to split the window placing the new window below.  If it is an
 integer, that means to split only if the original window has at least
 that many lines.  If it is @code{nil}, that means not to split this
 way.
 @end defopt
 
 @defopt split-width-threshold
-This variable, used by @code{split-window-sensibly}, specifies whether
-to split the window placing the new window to the right.  If the value
-is an integer, that means to split only if the original window has at
-least that many columns.  If the value is @code{nil}, that means not
-to split this way.
+This variable specifies whether @code{split-window-sensibly} is
+allowed to split the window placing the new window to the right.  If
+the value is an integer, that means to split only if the original
+window has at least that many columns.  If the value is @code{nil},
+that means not to split this way.
 @end defopt
 
 @defopt even-window-sizes
 This variable, if address@hidden, causes @code{display-buffer} to even
-window sizes whenever it reuses an existing window and that window is
+window sizes whenever it reuses an existing window, and that window is
 adjacent to the selected one.
 
 If its value is @code{width-only}, sizes are evened only if the reused
@@ -2839,9 +3049,9 @@ search any visible or iconified frame, not just the 
selected frame.
 This variable is provided mainly for backward compatibility.  It is
 obeyed by @code{display-buffer} via a special mechanism in
 @code{display-buffer-fallback-action}, which calls the action function
address@hidden (@pxref{Display Action Functions})
-if the value is address@hidden  (This is done before attempting to
-split a window.)  This variable is not consulted by
address@hidden (@pxref{Buffer Display Action
+Functions}) if the value is address@hidden  (This is done before
+attempting to split a window.)  This variable is not consulted by
 @code{display-buffer-pop-up-frame} itself, which the user may specify
 directly in @code{display-buffer-alist} etc.
 @end defopt
@@ -2849,8 +3059,7 @@ directly in @code{display-buffer-alist} etc.
 @defopt pop-up-frame-function
 This variable specifies a function for creating a new frame, in order
 to make a new window for displaying a buffer.  It is used by the
address@hidden action function (@pxref{Display
-Action Functions}).
address@hidden action function.
 
 The value should be a function that takes no arguments and returns a
 frame, or @code{nil} if no frame could be created.  The default value
@@ -2860,30 +3069,670 @@ is a function that creates a frame using the 
parameters specified by
 
 @defopt pop-up-frame-alist
 This variable holds an alist of frame parameters (@pxref{Frame
-Parameters}), which is used by the default function in
+Parameters}), which is used by the function specified by
 @code{pop-up-frame-function} to make a new frame.  The default is
 @code{nil}.
address@hidden defopt
 
address@hidden same-window-buffer-names
-A list of buffer names for buffers that should be displayed in the
-selected window.  If a buffer's name is in this list,
address@hidden handles the buffer by showing it in the selected
-window.
+This option is provided for backward compatibility only.  Note, that
+when @code{display-buffer-pop-up-frame} calls the function specified
+by @code{pop-up-frame-function}, it prepends the value of all
address@hidden action alist entries to
address@hidden so that the values specified by the action
+alist entry effectively override any corresponding values of
address@hidden
+
+Hence, users should set up a @code{pop-up-frame-parameters} action
+alist entry in @code{display-buffer-alist} instead of customizing
address@hidden  Only this will guarantee that the value of
+a parameter specified by the user overrides the value of that
+parameter specified by the caller of @code{display-buffer}.
 @end defopt
 
address@hidden same-window-regexps
-A list of regular expressions that specify buffers that should be
-displayed in the selected window.  If the buffer's name matches any of
-the regular expressions in this list, @code{display-buffer} handles the
-buffer by showing it in the selected window.
address@hidden defopt
+   Many efforts in the design of @code{display-buffer} have been given
+to maintain compatibility with code that uses older options like
address@hidden, @code{pop-up-frames},
address@hidden, @code{same-window-buffer-names} and
address@hidden  Lisp Programs and users should refrain
+from using these options.  Above we already warned against customizing
address@hidden  Here we describe how to convert the
+remaining options to use display actions instead.
+
address@hidden @code
address@hidden pop-up-windows
address@hidden address@hidden, replacement for}
+This variable is @code{t} by default.  Instead of customizing it to
address@hidden and thus telling @code{display-buffer} what not to do, it's
+much better to list in @code{display-buffer-base-action} the action
+functions it should try instead as, for example:
+
address@hidden
address@hidden
+(customize-set-variable
+ 'display-buffer-base-action
+ '((display-buffer-reuse-window display-buffer-same-window
+    display-buffer-in-previous-window
+    display-buffer-use-some-window)))
address@hidden group
address@hidden example
+
address@hidden pop-up-frames
address@hidden address@hidden, replacement for}
+Instead of customizing this variable to @code{t}, customize
address@hidden, for example, as follows:
+
address@hidden
address@hidden
+(customize-set-variable
+ 'display-buffer-base-action
+ '((display-buffer-reuse-window display-buffer-pop-up-frame)
+   (reusable-frames . 0)))
address@hidden group
address@hidden example
+
address@hidden same-window-buffer-names
address@hidden same-window-regexps
address@hidden address@hidden, replacement for}
address@hidden address@hidden, replacement for}
+Instead of adding a buffer name or a regular expression to one of
+these options use a @code{display-buffer-alist} entry for that buffer
+specifying the action function @code{display-buffer-same-window}.
+
address@hidden
address@hidden
+(customize-set-variable
+ 'display-buffer-alist
+ (cons '("\\*foo\\*" (display-buffer-same-window))
+        display-buffer-alist))
address@hidden group
address@hidden example
address@hidden table
+
+
address@hidden Precedence of Action Functions
address@hidden Precedence of Action Functions
address@hidden precedence of buffer display action functions
address@hidden execution order of buffer display action functions
address@hidden buffer display action functions, precedence
+
+From the past subsections we already know that @code{display-buffer}
+must be supplied with a number of display actions (@pxref{Choosing
+Window}) in order to display a buffer.  In a completely uncustomized
+Emacs, these actions are specified by
address@hidden in the following order of
+precedence: Reuse a window, pop up a new window on the same frame, use
+a window previously showing the buffer, use some window and pop up a
+new frame.  (Note that the remaining actions named by
address@hidden are void in an uncustomized
+Emacs).
+
+Consider the following form:
+
address@hidden
+(display-buffer (get-buffer-create "*foo*"))
address@hidden example
+
address@hidden
+Evaluating this form in the buffer @file{*scratch*} of an uncustomized
+Emacs session will usually fail to reuse a window that shows
address@hidden already, but succeed in popping up a new window.
+Evaluating the same form again will now not cause any visible
address@hidden reused the window already showing
address@hidden because that action was applicable and had the highest
+precedence among all applicable actions.
+
+   Popping up a new window will fail if there is not enough space on
+the selected frame.  In an uncustomized Emacs it typically fails when
+there are already two windows on a frame.  For example, if you now
+type @address@hidden 1}} followed by @address@hidden 2}} and evaluate the form
+once more, @file{*foo*} should show up in the lower
address@hidden just used ``some'' window.  If, before
+typing @address@hidden 2}} you had typed @address@hidden o}}, @file{*foo*}
+would have been shown in the upper window because ``some'' window
+stands for the ``least recently used'' window and the selected window
+has been least recently used if and only if it is alone on its frame.
+
+   Let's assume you did not type @address@hidden o}} and @file{*foo*} is
+shown in the lower window.  Type @address@hidden o}} to get there followed
+by @address@hidden left}} and evaluate the form again.  This should
+display @file{*foo*} in the same, lower window because that window had
+already shown @file{*foo*} previously and was therefore chosen instead
+of some other window.
+
+  So far we have only observed the default behavior in an uncustomized
+Emacs session.  To see how this behavior can be customized, let's
+consider the option @code{display-buffer-base-action}.  It provides a
+very coarse customization which conceptually affects the display of
address@hidden buffer.  It can be used to supplement the actions supplied
+by @code{display-buffer-fallback-action} by reordering them or by
+adding actions that are not present there but fit more closely the
+user's editing practice.   However, it can also be used to change the
+default behavior in a more profound way.
+
+   Let's consider a user who, as a rule, prefers to display buffers on
+another frame.  Such a user might provide the following customization:
+
address@hidden
address@hidden
+(customize-set-variable
+ 'display-buffer-base-action
+ '((display-buffer-reuse-window display-buffer-pop-up-frame)
+   (reusable-frames . 0)))
address@hidden group
address@hidden example
+
address@hidden
+This setting will cause @code{display-buffer} to first try to find a
+window showing the buffer on a visible or iconified frame and, if no
+such frame exists, pop up a new frame.  You can observe this behavior
+on a graphical system by typing @address@hidden 1}} in the window showing
address@hidden and evaluating our canonical @code{display-buffer}
+form.  This will usually create (and give focus to) a new frame whose
+root window shows @file{*foo*}.  Iconify that frame and evaluate the
+canonical form again: @code{display-buffer} will reuse the window on
+the new frame (usually raising the frame and giving it focus too).
+
+   Only if creating a new frame fails, @code{display-buffer} will
+apply the actions supplied by @code{display-buffer-fallback-action}
+which means to again try reusing a window, popping up a new window and
+so on.  A trivial way to make frame creation fail is supplied by the
+following form:
+
address@hidden
address@hidden
+(let ((pop-up-frame-function 'ignore))
+  (display-buffer (get-buffer-create "*foo*")))
address@hidden group
address@hidden example
+
address@hidden
+We will forget about that form immediately after observing that it
+fails to create a new frame and uses a fallback action instead.
+
+   Note that @code{display-buffer-reuse-window} appears redundant in
+the customization of @code{display-buffer-base-action} because it is
+already part of @code{display-buffer-fallback-action} and should be
+tried there anyway.  However, that would fail because due to the
+precedence of @code{display-buffer-base-action} over
address@hidden, at that time
address@hidden would have already won the race.
+In fact, this:
+
address@hidden
address@hidden
+(customize-set-variable
+ 'display-buffer-base-action
+ '(display-buffer-pop-up-frame (reusable-frames . 0)))
address@hidden group
address@hidden example
+
address@hidden
+would cause @code{display-buffer} to @emph{always} pop up a new frame
+which is probably not what our user wants.
+
+   So far, we have only shown how @emph{users} can customize the
+default behavior of @code{display-buffer}.  Let us now see how
address@hidden can change the course of @code{display-buffer}.
+The canonical way to do that is to use the @var{action} argument of
address@hidden or a function that calls it, like, for example,
address@hidden (@pxref{Switching Buffers}).
+
+   Suppose an application wants to display @file{*foo*} preferably
+below the selected window (to immediately attract the attention of the
+user to the new window) or, if that fails, in a window at the bottom
+of the frame.  It could do that with a call like this:
+
address@hidden
address@hidden
+(display-buffer
+ (get-buffer-create "*foo*")
+ '((display-buffer-below-selected display-buffer-at-bottom)))
address@hidden group
address@hidden example
+
address@hidden
+In order to see how this new, modified form works, delete any frame
+showing @file{*foo*}, type @address@hidden 1}} followed by @address@hidden 2}} 
in the
+window showing @file{*scratch*}, and subsequently evaluate that form.
address@hidden should split the upper window, and show
address@hidden in the new window.  Alternatively, if after @address@hidden 2}}
+you had typed @address@hidden o}}, @code{display-buffer} would have split the
+window at the bottom instead.
+
+   Suppose now that, before evaluating the new form, you have made the
+selected window as small as possible, for example, by evaluating the
+form @code{(fit-window-to-buffer)} in that window.  In that case,
address@hidden would have failed to split the selected window
+and would have split the frame's root window instead, effectively
+displaying @file{*foo*} at the bottom of the frame.
+
+   In either case, evaluating the new form a second time should reuse
+the window already showing @file{*foo*} since both functions supplied
+by the @var{action} argument try to reuse such a window first.
+
+   By setting the @var{action} argument, an application effectively
+overrules any customization of @code{display-buffer-base-action}.  Our
+user can now either accept the choice of the application, or redouble
+by customizing the option @code{display-buffer-alist} as follows:
+
address@hidden
address@hidden
+(customize-set-variable
+ 'display-buffer-alist
+ '(("\\*foo\\*"
+    (display-buffer-reuse-window display-buffer-pop-up-frame))))
address@hidden group
address@hidden example
+
address@hidden
+Trying this with the new, modified form above in a configuration that
+does not show @file{*foo*} anywhere, will display @file{*foo*} on a
+separate frame, completely ignoring the @var{action} argument of
address@hidden
+
+   Note that we didn't care to specify a @code{reusable-frames} action
+alist entry in our specification of @code{display-buffer-alist}.
address@hidden always takes the first one it finds---in our
+case the one specified by @code{display-buffer-base-action}.  If we
+wanted to use a different specification, for example, to exclude
+iconified frames showing @file{*foo*} from the list of reusable ones,
+we would have to specify that separately, however:
+
address@hidden
address@hidden
+(customize-set-variable
+ 'display-buffer-alist
+ '(("\\*foo\\*"
+    (display-buffer-reuse-window display-buffer-pop-up-frame)
+    (reusable-frames . visible))))
address@hidden group
address@hidden example
+
address@hidden
+If you try this, you will notice that repeated attempts to display
address@hidden will succeed to reuse a frame only if that frame is
+visible.
+
+   The above example would allow the conclusion that users customize
address@hidden for the sole purpose to overrule the
address@hidden argument chosen by applications.  Such a conclusion would
+be incorrect.  @code{display-buffer-alist} is the standard option for
+users to direct the course of display of specific buffers in a
+preferred way regardless of whether the display is also guided by an
address@hidden argument.
+
+   We can, however, reasonably conclude that customizing
address@hidden differs from customizing
address@hidden in two major aspects: it is stronger
+because it overrides the @var{action} argument of
address@hidden, and it allows to explicitly specify the
+affected buffers.  In fact, displaying other buffers is not affected
+in any way by a customization for @file{*foo*}.  For example,
+
address@hidden
+(display-buffer (get-buffer-create "*bar*"))
address@hidden example
+
address@hidden
+continues being governed by the settings of
address@hidden and
address@hidden only.
+
+   We could stop with our examples here but Lisp programs still have
+an ace up their sleeves which they can use to overrule any
+customization of @code{display-buffer-alist}.  It's the variable
address@hidden which they can bind around
address@hidden calls as follows:
+
address@hidden
address@hidden
+(let ((display-buffer-overriding-action
+       '((display-buffer-same-window))))
+  (display-buffer
+   (get-buffer-create "*foo*")
+   '((display-buffer-below-selected display-buffer-at-bottom))))
address@hidden group
address@hidden example
+
address@hidden
+Evaluating this form will usually display @file{*foo*} in the selected
+window regardless of the @var{action} argument and any user
+customizations.  (Usually, an application will not bother to also
+provide an @var{action} argument.  Here it just serves to illustrate
+the fact that it gets overridden.)
+
+It might be illustrative to look at the list of action functions
address@hidden would have tried to display @file{*foo*} with
+the customizations we provided here.  The list (including comments
+explaining who added this and the subsequent elements) is:
+
address@hidden
address@hidden
+(display-buffer-same-window  ;; `display-buffer-overriding-action'
+ display-buffer-reuse-window ;; `display-buffer-alist'
+ display-buffer-pop-up-frame
+ display-buffer-below-selected ;; ACTION argument
+ display-buffer-at-bottom
+ display-buffer-reuse-window ;; `display-buffer-base-action'
+ display-buffer-pop-up-frame
+ display-buffer--maybe-same-window ;; `display-buffer-fallback-action'
+ display-buffer-reuse-window
+ display-buffer--maybe-pop-up-frame-or-window
+ display-buffer-in-previous-window
+ display-buffer-use-some-window
+ display-buffer-pop-up-frame)
address@hidden group
address@hidden example
+
address@hidden
+Note that among the internal functions listed here,
address@hidden is effectively ignored while
address@hidden actually runs
address@hidden
+
+The action alist passed in each function call is:
+
address@hidden
address@hidden
+((reusable-frames . visible)
+ (reusable-frames . 0))
address@hidden group
address@hidden example
+
address@hidden
+which shows that we have used the second specification of
address@hidden above, overriding the specification
+supplied by @code{display-buffer-base-action}.  Suppose our user had
+written that as
+
address@hidden
address@hidden
+(customize-set-variable
+ 'display-buffer-alist
+ '(("\\*foo\\*"
+    (display-buffer-reuse-window display-buffer-pop-up-frame)
+    (inhibit-same-window . t)
+    (reusable-frames . visible))))
address@hidden group
address@hidden example
+
address@hidden
+In this case the @code{inhibit-same-window} alist entry will
+successfully invalidate the @code{display-buffer-same-window}
+specification from @code{display-buffer-overriding-action} and
address@hidden will show @file{*foo*} on another frame.  To
+make @code{display-buffer-overriding-action} more robust in this
+regard, the application would have to specify an appropriate
address@hidden entry too, for example, as follows:
+
address@hidden
address@hidden
+(let ((display-buffer-overriding-action
+       '(display-buffer-same-window (inhibit-same-window . nil))))
+  (display-buffer (get-buffer-create "*foo*")))
address@hidden group
address@hidden example
+
address@hidden
+This last example shows that while the precedence order of action
+functions is fixed, as described in @ref{Choosing Window}, an action
+alist entry specified by a display action ranked lower in that order
+can affect the execution of a higher ranked display action.
+
+
address@hidden The Zen of Buffer Display
address@hidden The Zen of Buffer Display
address@hidden guidelines for buffer display
address@hidden writing buffer display actions
address@hidden buffer display conventions
+
+In its most simplistic form, a frame accommodates always one single
+window that can be used for displaying a buffer.  As a consequence, it
+is always the latest call of @code{display-buffer} that will have
+succeeded in placing its buffer there.
+
+   Since working with such a frame is not very practical, Emacs by
+default allows for more complex frame layouts controlled by the
+default values of the frame size and the @code{split-height-threshold}
+and @code{split-width-threshold} options.  Displaying a buffer not yet
+shown on a frame then either splits the single window on that frame or
+(re-)uses one of its two windows.
+
+   The default behavior is abandoned as soon as the user customizes
+one of these thresholds or manually changes the frame's layout.  The
+default behavior is also abandoned when calling @code{display-buffer}
+with a address@hidden @var{action} argument or the user customizes one
+of the options mentioned in the previous subsections.  Mastering
address@hidden soon may become a frustrating experience due to
+the plethora of applicable display actions and the resulting frame
+layouts.
+
+   However, refraining from using buffer display functions and falling
+back on a split & delete windows metaphor is not a good idea either.
+Buffer display functions give Lisp programs and users a framework to
+reconcile their different needs; no comparable framework exists for
+splitting and deleting windows.  Buffer display functions also allow
+to at least partially restore the layout of a frame when removing a
+buffer from it later (@pxref{Quitting Windows}).
+
+   Below we will give a number of guidelines to redeem the frustration
+mentioned above and thus to avoid literally losing buffers in-between
+the windows of a frame.
+
address@hidden @asis
address@hidden Write display actions without stress
+Writing display actions can be a pain because one has to lump together
+action functions and action alists in one huge list.  (Historical
+reasons prevented us from having @code{display-buffer} support
+separate arguments for these.)  It might help to memorize some basic
+forms like the ones listed below:
+
address@hidden
+'(nil (inhibit-same-window . t))
address@hidden example
+
address@hidden
+specifies an action alist entry only and no action function.  Its sole
+purpose is to inhibit a @code{display-buffer-same-window} function
+specified elsewhere from showing the buffer in the same window, see
+also the last example of the preceding subsection.
+
address@hidden
+'(display-buffer-below-selected)
address@hidden example
+
address@hidden
+on the other hand, specifies one action function and an empty action
+alist.  To combine the effects of the above two specifications one
+would write the form
+
address@hidden
+'(display-buffer-below-selected (inhibit-same-window . t))
address@hidden example
+
address@hidden
+to add another action function one would write
+
address@hidden
address@hidden
+'((display-buffer-below-selected display-buffer-at-bottom)
+  (inhibit-same-window . t))
address@hidden group
address@hidden example
+
address@hidden
+and to add another alist entry one would write
+
address@hidden
address@hidden
+'((display-buffer-below-selected display-buffer-at-bottom)
+  (inhibit-same-window . t)
+  (window-height . fit-window-to-buffer))
address@hidden group
address@hidden example
+
address@hidden
+That last form can be used as @var{action} argument of
address@hidden in the following way:
+
address@hidden
address@hidden
+(display-buffer
+ (get-buffer-create "*foo*")
+ '((display-buffer-below-selected display-buffer-at-bottom)
+   (inhibit-same-window . t)
+   (window-height . fit-window-to-buffer)))
address@hidden group
address@hidden example
+
address@hidden
+In a customization of @code{display-buffer-alist} it would be used as
+follows:
+
address@hidden
address@hidden
+(customize-set-variable
+ 'display-buffer-alist
+ '(("\\*foo\\*"
+    (display-buffer-below-selected display-buffer-at-bottom)
+    (inhibit-same-window . t)
+    (window-height . fit-window-to-buffer))))
address@hidden group
address@hidden example
+
address@hidden
+To add a customization for a second buffer one would then write:
+
address@hidden
address@hidden
+(customize-set-variable
+ 'display-buffer-alist
+ '(("\\*foo\\*"
+    (display-buffer-below-selected display-buffer-at-bottom)
+    (inhibit-same-window . t)
+    (window-height . fit-window-to-buffer))
+   ("\\*bar\\*"
+    (display-buffer-reuse-window display-buffer-pop-up-frame)
+    (reusable-frames . visible))))
address@hidden group
address@hidden example
+
address@hidden Treat each other with respect
address@hidden and @code{display-buffer-base-action} are
+user options---Lisp programs must never set or rebind them.
address@hidden, on the other hand, is
+reserved for applications---who seldom use that option and if they use
+it, then with utmost care.
+
+   Older implementations of @code{display-buffer} frequently caused
+users and applications to fight over the settings of user options like
address@hidden and @code{pop-up-windows} (@pxref{Choosing Window
+Options}).  This was one major reason for redesigning
address@hidden provide a clear framework specifying what
+users and applications should be allowed to do.
+
+   Lisp programs must be prepared that user customizations may
+cause buffers to get displayed in an unexpected way.  They should
+never assume in their subsequent behavior, that the buffer has been
+shown precisely the way they asked for in the @var{action} argument of
address@hidden
+
+   Users should not pose too many and too severe restrictions on how
+arbitrary buffers get displayed.  Otherwise, they will risk to lose
+the characteristics of showing a buffer for a certain purpose.
+Suppose a Lisp program has been written to compare different versions
+of a buffer in two windows side-by-side.  If the customization of
address@hidden prescribes that any such buffer should be
+always shown in or below the selected window, the program will have a
+hard time to set up the desired window configuration via
address@hidden
+
+   To specify a preference for showing an arbitrary buffer, users
+should customize @code{display-buffer-base-action}.  An example of how
+users who prefer working with multiple frames would do that was given
+in the previous subsection.  @code{display-buffer-alist} should be
+reserved for displaying specific buffers in a specific way.
+
address@hidden Consider reusing a window that already shows the buffer
+Generally, it's always a good idea for users and Lisp
+programmers to be prepared for the case that a window already shows
+the buffer in question and to reuse that window.  In the preceding
+subsection we have shown that failing to do so properly may cause
address@hidden to continuously pop up a new frame although a
+frame showing that buffer existed already.  In a few cases only, it
+might be undesirable to reuse a window, for example, when a different
+portion of the buffer should be shown in that window.
+
+   Hence, @code{display-buffer-reuse-window} is one action function
+that should be used as often as possible, both in @var{action}
+arguments and customizations.  An @code{inhibit-same-window} entry in
+the @var{action} argument usually takes care of the most common case
+where reusing a window showing the buffer should be avoided---that
+where the window in question is the selected one.
+
address@hidden Attract focus to the window chosen
+This is a no-brainer for people working with multiple frames---the
+frame showing the buffer will automatically raise and get focus unless
+an @code{inhibit-switch-frame} entry forbids it.  For single frame
+users this task can be considerably more difficult.  In particular,
address@hidden and
address@hidden can become obtrusive in this
+regard.  They split or use a seemingly arbitrary (often the largest or
+least recently used) window, distracting the user's attention.
+
+Some Lisp programs therefore try to choose a window at the bottom of
+the frame, for example, in order to display the buffer in vicinity of
+the minibuffer window where the user is expected to answer a question
+related to the new window.  For non-input related actions
address@hidden might be preferable because the
+selected window usually already has the user's attention.
+
address@hidden Handle subsequent invocations of @code{display-buffer}
address@hidden is not overly well suited for displaying several
+buffers in sequence and making sure that all these buffers are shown
+orderly in the resulting window configuration.  Again, the standard
+action functions @code{display-buffer-pop-up-window} and
address@hidden are not very suited for this
+purpose due to their somewhat chaotic nature in more complex
+configurations.
+
+   To produce a window configuration displaying multiple buffers (or
+different views of one and the same buffer) in one and the same
+display cycle, Lisp programmers will unavoidably have to write
+their own action functions.  A few tricks listed below might help in
+this regard.
+
address@hidden @bullet
address@hidden
+Making windows atomic (@pxref{Atomic Windows}) avoids breaking an
+existing window composition when popping up a new window.
+The new window will pop up outside the composition instead.
+
address@hidden
+Temporarily dedicating windows to their buffers (@pxref{Dedicated
+Windows}) avoids using a window for displaying a different
+buffer.  A non-dedicated window will be used instead.
+
address@hidden
+Calling @code{window-preserve-size} (@pxref{Preserving Window Sizes})
+will try to keep the size of the argument window unchanged when
+popping up a new window.  You have to make sure that another window in
+the same combination can be shrunk instead, though.
+
address@hidden
+Side windows (@pxref{Side Windows}) can be used for displaying
+specific buffers always in a window at the same position of a frame.
+This permits grouping buffers that do not compete for being shown at
+the same time on a frame and showing any such buffer in the same window
+without disrupting the display of other buffers.
+
address@hidden
+Child frames (@pxref{Child Frames}) can be used to display a buffer
+within the screen estate of the selected frame without disrupting that
+frame's window configuration and without the overhead associated with
+full-fledged frames as inflicted by @code{display-buffer-pop-up-frame}.
address@hidden itemize
address@hidden table
 
address@hidden same-window-p buffer-name
-This function returns @code{t} if displaying a buffer
-named @var{buffer-name} with @code{display-buffer} would
-put it in the selected window.
address@hidden defun
 
 @node Window History
 @section Window History
@@ -3053,6 +3902,9 @@ display.  Other functions do not treat @code{t} 
differently from any
 address@hidden value.
 @end defun
 
+You can also tell @code{display-buffer} to mark a window it creates as
+dedicated to its buffer by providing a suitable @code{dedicated}
+action alist entry (@pxref{Buffer Display Action Alists}).
 
 @node Quitting Windows
 @section Quitting Windows
@@ -3202,12 +4054,13 @@ main window is either a ``normal'' live window or 
specifies the area
 containing all the normal windows.
 
    In their most simple form of use, side windows allow to display
-specific buffers always in the same area of a frame.  Hence they can be
-regarded as a generalization of the concept provided by
address@hidden (@pxref{Display Action Functions}) to
-the remaining sides of a frame.  With suitable customizations, however,
-side windows can be also used to provide frame layouts similar to those
-found in so-called integrated development environments (IDEs).
+specific buffers always in the same area of a frame.  Hence they can
+be regarded as a generalization of the concept provided by
address@hidden (@pxref{Buffer Display Action
+Functions}) to the remaining sides of a frame.  With suitable
+customizations, however, side windows can be also used to provide
+frame layouts similar to those found in so-called integrated
+development environments (IDEs).
 
 @menu
 * Displaying Buffers in Side Windows:: An action function for displaying
@@ -3221,9 +4074,9 @@ found in so-called integrated development environments 
(IDEs).
 @node Displaying Buffers in Side Windows
 @subsection Displaying Buffers in Side Windows
 
-The following action function for @code{display-buffer} (@pxref{Display
-Action Functions}) creates or reuses a side window for displaying the
-specified buffer.
+The following action function for @code{display-buffer} (@pxref{Buffer
+Display Action Functions}) creates or reuses a side window for
+displaying the specified buffer.
 
 @defun display-buffer-in-side-window buffer alist
 This function displays @var{buffer} in a side window of the selected
@@ -3263,11 +4116,11 @@ explicitly provided via a @code{window-parameters} 
entry in @var{alist}.
 @end defun
 
 By default, side windows cannot be split via @code{split-window}
-(@pxref{Splitting Windows}).  Also, a side window is not reused or split
-by any buffer display action (@pxref{Display Action Functions}) unless
-it is explicitly specified as target of that action.  Note also that
address@hidden cannot make a side window the only window on
-its frame (@pxref{Deleting Windows}).
+(@pxref{Splitting Windows}).  Also, a side window is not reused or
+split by any buffer display action (@pxref{Buffer Display Action
+Functions}) unless it is explicitly specified as target of that
+action.  Note also that @code{delete-other-windows} cannot make a side
+window the only window on its frame (@pxref{Deleting Windows}).
 
    Once set up, side windows also change the behavior of the commands
 @code{switch-to-prev-buffer} and @code{switch-to-next-buffer}
@@ -3453,9 +4306,9 @@ retain their respective sizes when maximizing the frame, 
the variable
 @xref{Resizing Windows}.
 
    The last form also makes sure that none of the created side windows
-are accessible via @kbd{C-x o} by installing the @code{no-other-window}
+are accessible via @address@hidden o}} by installing the @code{no-other-window}
 parameter for each of these windows.  In addition, it makes sure that
-side windows are not deleted via @kbd{C-x 1} by installing the
+side windows are not deleted via @address@hidden 1}} by installing the
 @code{no-delete-other-windows} parameter for each of these windows.
 
    Since @code{dired} buffers have no fixed names, we use a special
@@ -3547,7 +4400,7 @@ does is to set the @code{window-atom} parameter of each 
descendant of
 
 To create a new atomic window from an existing live window or to add a
 new window to an existing atomic window, the following buffer display
-action function (@pxref{Display Action Functions}) can be used:
+action function (@pxref{Buffer Display Action Functions}) can be used:
 
 @defun display-buffer-in-atom-window buffer alist
 This function tries to display @var{buffer} in a new window that will be
@@ -4096,7 +4949,8 @@ fashion.
 @defopt scroll-up-aggressively
 Likewise, for scrolling up.  The value, @var{f}, specifies how far
 point should be placed from the bottom of the window; thus, as with
address@hidden, a larger value scrolls more aggressively.
address@hidden, a larger value scrolls more
+aggressively.
 @end defopt
 
 @defopt scroll-step
@@ -4846,10 +5700,6 @@ prevent the code in @var{forms} from opening new 
windows, because new
 windows might be opened in other frames (@pxref{Choosing Window}), and
 @code{save-window-excursion} only saves and restores the window
 configuration on the current frame.
-
-Do not use this macro in @code{window-size-change-functions}; exiting
-the macro triggers execution of @code{window-size-change-functions},
-leading to an endless loop.
 @end defmac
 
 @defun window-configuration-p object
@@ -4911,9 +5761,10 @@ This function puts the window state @var{state} into 
@var{window}.
 The argument @var{state} should be the state of a window returned by
 an earlier invocation of @code{window-state-get}, see above.  The
 optional argument @var{window} can be either a live window or an
-internal window (@pxref{Windows and Frames}) and defaults to the
-selected one.  If @var{window} is not live, it is replaced by a live
-window before putting @var{state} into it.
+internal window (@pxref{Windows and Frames}).  If @var{window} is not
+a live window, it is replaced by a new live window created on the same
+frame before putting @var{state} into it.  If @var{window} is @code{nil},
+it puts the window state into a new window.
 
 If the optional argument @var{ignore} is address@hidden, it means to ignore
 minimum window sizes and fixed-size restrictions.  If @var{ignore}
@@ -4967,10 +5818,10 @@ This function sets @var{window}'s value of 
@var{parameter} to
 is the selected window.
 @end defun
 
-By default, the functions that save and restore window configurations or the
-states of windows (@pxref{Window Configurations}) do not care about
-window parameters.  This means that when you change the value of a
-parameter within the body of a @code{save-window-excursion}, the
+By default, the functions that save and restore window configurations
+or the states of windows (@pxref{Window Configurations}) do not care
+about window parameters.  This means that when you change the value of
+a parameter within the body of a @code{save-window-excursion}, the
 previous value is not restored when that macro exits.  It also means
 that when you restore via @code{window-state-put} a window state saved
 earlier by @code{window-state-get}, all cloned windows have their
@@ -5159,27 +6010,26 @@ applications.  It might be replaced by an improved 
solution in future
 versions of Emacs.
 @end table
 
+
 @node Window Hooks
 @section Hooks for Window Scrolling and Changes
 @cindex hooks for window operations
 
-This section describes how a Lisp program can take action whenever a
-window displays a different part of its buffer or a different buffer.
-There are three actions that can change this: scrolling the window,
-switching buffers in the window, and changing the size of the window.
-The first two actions run @code{window-scroll-functions}; the last runs
address@hidden
+This section describes how Lisp programs can take action after a
+window has been scrolled or other window modifications occurred.  We
+first consider the case where a window shows a different part of its
+buffer.
 
 @defvar window-scroll-functions
 This variable holds a list of functions that Emacs should call before
-redisplaying a window with scrolling.  Displaying a different buffer in
-the window also runs these functions.
+redisplaying a window with scrolling.  Displaying a different buffer
+in a window and making a new window also call these functions.
 
-This variable is not a normal hook, because each function is called with
-two arguments: the window, and its new display-start position.  At the
-time of the call, the display-start position of the window argument is
-already set to its new value, and the buffer to be displayed in the
-window is already set as the current buffer.
+This variable is not a normal hook, because each function is called
+with two arguments: the window, and its new display-start position.
+At the time of the call, the display-start position of the argument
+window is already set to its new value, and the buffer to be displayed
+in the window is set as the current buffer.
 
 These functions must take care when using @code{window-end}
 (@pxref{Window Start and End}); if you need an up-to-date value, you
@@ -5190,65 +6040,294 @@ is scrolled.  It's not designed for that, and such use 
probably won't
 work.
 @end defvar
 
address@hidden run-window-scroll-functions &optional window
-This function calls @code{window-scroll-functions} for the specified
address@hidden, which defaults to the selected window.
address@hidden defun
+In addition, you can use @code{jit-lock-register} to register a Font
+Lock fontification function, which will be called whenever parts of a
+buffer are (re)fontified because a window was scrolled or its size
+changed.  @xref{Other Font Lock Variables}.
+
address@hidden window change functions
+   The remainder of this section covers six hooks that are called
+during redisplay provided a significant, non-scrolling change of a
+window has been detected.  For simplicity, these hooks and the
+functions they call will be collectively referred to as @dfn{window
+change functions}.
+
address@hidden window buffer change
+The first of these hooks is run after a @dfn{window buffer change} is
+detected, which means that a window was created, deleted or assigned
+another buffer.
+
address@hidden window-buffer-change-functions
+This variable specifies functions called during redisplay when window
+buffers have changed.  The value should be a list of functions that
+take one argument.
+
+Functions specified buffer-locally are called for any window showing
+the corresponding buffer if that window has been created or assigned
+that buffer since the last time window change functions were run.  In
+this case the window is passed as argument.
+
+Functions specified by the default value are called for a frame if at
+least one window on that frame has been added, deleted or assigned
+another buffer since the last time window change functions were run.
+In this case the frame is passed as argument.
address@hidden defvar
+
address@hidden window size change
+The second of these hooks is run when a @dfn{window size change} has
+been detected which means that a window was created, assigned another
+buffer, or changed its total size or that of its text area.
 
 @defvar window-size-change-functions
-This variable holds a list of functions to be called if the size of any
-window changes for any reason.  The functions are called once per
-redisplay, and once for each frame on which size changes have occurred.
-
-Each function receives the frame as its sole argument.  To find out
-whether a specific window has changed size, compare the return values of
address@hidden and
address@hidden respectively
address@hidden and
address@hidden for that window (@pxref{Window Sizes}).
-
-The buffer-local value of this hook is run once for the buffer and the
-frame in question, provided at least one window showing the buffer on
-that frame has changed its size.  As it still receives the frame as
-its sole argument, any function called on a buffer-local basis will be
-oblivious to which window(s) showing the buffer changed its (their)
-size and has to check out these windows by using the method described
-in the previous paragraph.
-
-These function are usually only called when at least one window was
-added or has changed size since the last time this hook was run for the
-associated frame.  In some rare cases this hook also runs when a window
-that was added intermittently has been deleted afterwards.  In these
-cases none of the windows on the frame will appear to have changed its
-size.
-
-You may use @code{save-selected-window} in these functions
-(@pxref{Selecting Windows}).  However, do not use
address@hidden (@pxref{Window Configurations}); exiting
-that macro counts as a size change, which would cause these functions to
-be called again.
+This variable specifies functions called during redisplay when a
+window size change occurred.  The value should be a list of functions
+that take one argument.
+
+Functions specified buffer-locally are called for any window showing
+the corresponding buffer if that window has been added or assigned
+another buffer or changed its total or body size since the last time
+window change functions were run.  In this case the window is passed
+as argument.
+
+Functions specified by the default value are called for a frame if at
+least one window on that frame has been added or assigned another
+buffer or changed its total or body size since the last time window
+change functions were run.  In this case the frame is passed as
+argument.
address@hidden defvar
+
address@hidden window selection change
+The third of these hooks is run when a @dfn{window selection change}
+has selected another window since the last redisplay.
+
address@hidden window-selection-change-functions
+This variable specifies functions called during redisplay when the
+selected window or a frame's selected window has changed.  The value
+should be a list of functions that take one argument.
+
+Functions specified buffer-locally are called for any window showing
+the corresponding buffer if that window has been selected or
+deselected (among all windows or among all windows on its frame) since
+the last time window change functions were run.  In this case the
+window is passed as argument.
+
+Functions specified by the default value are called for a frame if
+that frame has been selected or deselected or the frame's selected
+window has changed since the last time window change functions were
+run.  In this case the frame is passed as argument.
address@hidden defvar
+
address@hidden window state change
+The fourth of these hooks is run when a @dfn{window state change} has
+been detected, which means that at least one of the three preceding
+window changes has occurred.
+
address@hidden window-state-change-functions
+This variable specifies functions called during redisplay when a
+window buffer or size change occurred or the selected window or a
+frame's selected window has changed.  The value should be a list of
+functions that take one argument.
+
+Functions specified buffer-locally are called for any window showing
+the corresponding buffer if that window has been added or assigned
+another buffer, changed its total or body size or has been selected or
+deselected (among all windows or among all windows on its frame) since
+the last time window change functions were run.  In this case the
+window is passed as argument.
+
+Functions specified by the default value are called for a frame if at
+least one window on that frame has been added, deleted or assigned
+another buffer, changed its total or body size or that frame has been
+selected or deselected or the frame's selected window has changed
+since the last time window change functions were run.  In this case
+the frame is passed as argument.
+
+Functions specified by the default value are also run for a frame when
+that frame's window state change flag (see below) has been set since
+last redisplay.
 @end defvar
 
address@hidden window configuration change
+The fifth of these hooks is run when a @dfn{window configuration
+change} has been detected which means that either the buffer or the
+size of a window changed.  It differs from the four preceding hooks in
+the way it is run.
+
 @defvar window-configuration-change-hook
-A normal hook that is run every time the window configuration of a frame
-changes.  Window configuration changes include splitting and deleting
-windows, and the display of a different buffer in a window.  Resizing the
-frame or individual windows do not count as configuration changes.  Use
address@hidden, see above, when you want to track
-size changes that are not caused by the deletion or creation of windows.
-
-The buffer-local value of this hook is run once for each window on the
-affected frame, with the relevant window selected and its buffer
-current.  The global value of this hook is run once for the modified
-frame, with that frame selected.
+This variable specifies functions called during redisplay when either
+the buffer or the size of a window has changed.  The value should be a
+list of functions that take no argument.
+
+Functions specified buffer-locally are called for any window showing
+the corresponding buffer if at least one window on that frame has been
+added, deleted or assigned another buffer or changed its total or
+body size since the last time window change functions were run.  Each
+call is performed with the window showing the buffer temporarily
+selected and its buffer current.
+
+Functions specified by the default value are called for each frame if
+at least one window on that frame has been added, deleted or assigned
+another buffer or changed its total or body size since the last time
+window change functions were run.  Each call is performed with the
+frame temporarily selected and the selected window's buffer current.
 @end defvar
 
address@hidden run-window-configuration-change-hook &optional frame
-This function runs @code{window-configuration-change-hook} for the
-specified @var{frame}, which defaults to the selected frame.
+Finally, Emacs runs a normal hook that generalizes the behavior of
address@hidden
+
address@hidden window-state-change-hook
+The default value of this variable specifies functions called during
+redisplay when a window state change has been detected or the window
+state change flag has been set on at least one frame.  The value
+should be a list of functions that take no argument.
+
+Applications should put a function on this hook only if they want to
+react to changes that happened on (or have been signaled for) two or
+more frames since last redisplay.  In every other case, putting the
+function on @code{window-state-change-functions} should be preferred.
address@hidden defvar
+
+Window change functions are called during redisplay for each frame as
+follows: First, any buffer-local window buffer change function, window
+size change function, selected window change and window state change
+functions are called in this order.  Next, the default values for
+these functions are called in the same order.  Then any buffer-local
+window configuration change functions are called followed by functions
+specified by the default value of those functions.  Finally, functions
+on @code{window-state-change-hook} are run.
+
+   Window change functions are run for a specific frame only if a
+corresponding change was registered for that frame earlier.  Such
+changes include the creation or deletion of a window or the assignment
+of another buffer or size to a window.  Note that even when such a
+change has been registered, this does not mean that any of the hooks
+described above is run.  If, for example, a change was registered
+within the scope of a window excursion (@pxref{Window
+Configurations}), this will trigger a call of window change functions
+only if that excursion still persists at the time change functions are
+run.  If it is exited earlier, hooks will be run only if registered by
+a change outside the scope of that excursion.
+
address@hidden window state change flag
+   The @dfn{window state change flag} of a frame, if set, will cause
+the default values of @code{window-state-change-functions} (for that
+frame) and @code{window-state-change-hook} to be run during next
+redisplay regardless of whether a window state change actually
+occurred for that frame or not.  After running any functions on these
+hooks, the flag is reset for each frame.  Applications can set that
+flag and inspect its value using the following functions.
+
address@hidden set-frame-window-state-change &optional frame arg
+This function sets @var{frame}'s window state change flag if @var{arg}
+is address@hidden and resets it otherwise.  @var{frame} must be a live
+frame and defaults to the selected one.
 @end defun
 
-  In addition, you can use @code{jit-lock-register} to register a Font
-Lock fontification function, which will be called whenever parts of a
-buffer are (re)fontified because a window was scrolled or its size
-changed.  @xref{Other Font Lock Variables}.
address@hidden frame-window-state-change &optional frame
+This functions returns @code{t} if @var{frame}'s window state change
+flag is set and @code{nil} otherwise.  @var{frame} must be a live
+frame and defaults to the selected one.
address@hidden defun
+
+   While window change functions are run, the functions described next
+can be called to get more insight into what has changed for a specific
+window or frame since the last redisplay.  All these functions take a
+live window as single, optional argument, defaulting to the selected
+window.
+
address@hidden window-old-buffer &optional window
+This function returns the buffer shown in @var{window} at the last
+time window change functions were run for @var{window}'s frame.  If it
+returns @code{nil}, @var{window} has been created after that.  If it
+returns @code{t}, @var{window} was not shown at that time but has been
+restored from a previously saved window configuration afterwards.
+Otherwise, the return value is the buffer shown by @code{window} at
+that time.
address@hidden defun
+
address@hidden window-old-pixel-width &optional window
+This function returns the total pixel width of @var{window} the
+last time window change functions found @code{window} live on its
+frame.  It is zero if @code{window} was created after that.
address@hidden defun
+
address@hidden window-old-pixel-height &optional window
+This function returns the total pixel height of @var{window} the last
+time window change functions found @code{window} live on its frame.
+It is zero if @code{window} was created after that.
address@hidden defun
+
address@hidden window-old-body-pixel-width &optional window
+This function returns the pixel width of @var{window}'s text area the
+last time window change functions found @code{window} live on its
+frame.  It is zero if @code{window} was created after that.
address@hidden defun
+
address@hidden window-old-body-pixel-height &optional window
+This function returns the pixel height of @var{window}'s text area the
+last time window change functions found @code{window} live on its
+frame.  It is zero if @code{window} was created after that.
address@hidden defun
+
+In order to find out which window or frame was selected the last time
+window change functions were run, the following functions can be used:
+
address@hidden frame-old-selected-window &optional frame
+This function returns the selected window of @var{frame} at the last
+time window change functions were run.  If omitted or @code{nil}
address@hidden defaults to the selected frame.
address@hidden defun
+
address@hidden old-selected-window
+This function returns the selected window at the last time window
+change functions were run.
address@hidden defun
+
address@hidden old-selected-frame
+This function returns the selected frame at the last time window
+change functions were run.
address@hidden defun
+
+Note that window change functions provide no information about which
+windows have been deleted since the last time they were run.  If
+necessary, applications should remember any window showing a specific
+buffer in a local variable of that buffer and update it in a function
+run by the default values of any of the hooks that are run when a
+window buffer change was detected.
+
+   The following caveats should be considered when adding a function
+to window change functions:
+
address@hidden @bullet
address@hidden
+Some operations will not trigger a call of window change functions.
+These include showing another buffer in a minibuffer window or any
+change of a tooltip window.
+
address@hidden
+Window change functions should not create or delete windows or change
+the buffer, size or selection status of any window because there is no
+guarantee that the information about such a change will be propagated
+to other window change functions.  If at all, any such change should
+be executed only by the last function listed by the default value of
address@hidden
+
address@hidden
+Macros like @code{save-window-excursion}, @code{with-selected-window}
+or @code{with-current-buffer} can be used when running window change
+functions.
+
address@hidden
+Running window change functions does not save and restore match data.
+Unless running @code{window-configuration-change-hook} it does not
+save or restore the selected window or frame or the current buffer
+either.
+
address@hidden
+Any redisplay triggering the run of window change functions may be
+aborted.  If the abort occurs before window change functions have run
+to their completion, they will be run again with the previous values,
+that is, as if redisplay had not been performed.  If aborted later,
+they will be run with the new values, that is, as if redisplay had
+been actually performed.
address@hidden itemize
diff --git a/doc/man/ChangeLog.1 b/doc/man/ChangeLog.1
index b72837f..68e4112 100644
--- a/doc/man/ChangeLog.1
+++ b/doc/man/ChangeLog.1
@@ -176,7 +176,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2007-2018 Free Software Foundation, Inc.
+  Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/doc/man/ebrowse.1 b/doc/man/ebrowse.1
index c0245f8..b0448d4 100644
--- a/doc/man/ebrowse.1
+++ b/doc/man/ebrowse.1
@@ -82,7 +82,7 @@ should give you access to the complete manual.
 was written by Gerd Moellmann.
 .
 .SH COPYING
-Copyright 2008-2018 Free Software Foundation, Inc.
+Copyright 2008-2019 Free Software Foundation, Inc.
 .PP
 Permission is granted to make and distribute verbatim copies of this
 document provided the copyright notice and this permission notice are
diff --git a/doc/man/emacs.1.in b/doc/man/emacs.1.in
index e332fb4..11a3390 100644
--- a/doc/man/emacs.1.in
+++ b/doc/man/emacs.1.in
@@ -279,8 +279,8 @@ window's width, height, and position as specified.
 The geometry specification is in the standard X format; see
 .BR X (7)
 for more information.
-The width and height are specified in characters; the default is
-80 by 24.
+The width and height are specified in characters; the default for GUI
+frames is 80 by 36.
 See the Emacs manual, section "Options for Window Size and Position",
 for information on how window sizes interact
 with selecting or deselecting the tool bar and menu bar.
@@ -653,7 +653,7 @@ For detailed credits and acknowledgments, see the GNU Emacs 
manual.
 .
 .
 .SH COPYING
-Copyright 1995, 1999-2018 Free Software Foundation, Inc.
+Copyright 1995, 1999-2019 Free Software Foundation, Inc.
 .PP
 Permission is granted to make and distribute verbatim copies of this
 document provided the copyright notice and this permission notice are
diff --git a/doc/man/etags.1 b/doc/man/etags.1
index 558b249..7cc501c 100644
--- a/doc/man/etags.1
+++ b/doc/man/etags.1
@@ -281,7 +281,7 @@ Stallman.
 .BR vi ( 1 ).
 
 .SH COPYING
-Copyright 1992, 1999, 2001-2018 Free Software Foundation, Inc.
+Copyright 1992, 1999, 2001-2019 Free Software Foundation, Inc.
 .PP
 Permission is granted to make and distribute verbatim copies of this
 document provided the copyright notice and this permission notice are
diff --git a/doc/misc/ChangeLog.1 b/doc/misc/ChangeLog.1
index 9ef3f0e..9b25c90 100644
--- a/doc/misc/ChangeLog.1
+++ b/doc/misc/ChangeLog.1
@@ -12116,7 +12116,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993-1999, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1993-1999, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/doc/misc/Makefile.in b/doc/misc/Makefile.in
index fd07ea4..a03efaf 100644
--- a/doc/misc/Makefile.in
+++ b/doc/misc/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1994, 1996-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1996-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/doc/misc/ada-mode.texi b/doc/misc/ada-mode.texi
index ca62145..1ac90cd 100644
--- a/doc/misc/ada-mode.texi
+++ b/doc/misc/ada-mode.texi
@@ -4,7 +4,7 @@
 @include docstyle.texi
 
 @copying
-Copyright @copyright{} 1999--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1999--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/auth.texi b/doc/misc/auth.texi
index fcbc83e..a46e3d7 100644
--- a/doc/misc/auth.texi
+++ b/doc/misc/auth.texi
@@ -1,7 +1,5 @@
 \input texinfo                  @c -*-texinfo-*-
 
address@hidden gnus-overrides.texi
-
 @set VERSION 0.3
 
 @setfilename ../../info/auth.info
@@ -11,7 +9,7 @@
 @copying
 This file describes the Emacs auth-source library.
 
-Copyright @copyright{} 2008--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2008--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -109,6 +107,15 @@ The @code{user} is the user name.  It's known as 
@var{:user} in
 @code{auth-source-search} queries.  You can also use @code{login} and
 @code{account}.
 
+You can also use this file to specify client certificates to use when
+setting up TLS connections.  The format is:
address@hidden
+machine @var{mymachine} port @var{myport} key @var{key} cert @var{cert}
address@hidden example
+
address@hidden and @var{cert} are filenames containing the key and
+certificate to use respectively.
+
 You can use spaces inside a password or other token by surrounding the
 token with either single or double quotes.
 
diff --git a/doc/misc/autotype.texi b/doc/misc/autotype.texi
index 7e2476c..5eb45e2 100644
--- a/doc/misc/autotype.texi
+++ b/doc/misc/autotype.texi
@@ -11,7 +11,7 @@
 @c  @cindex autotypist
 
 @copying
-Copyright @copyright{} 1994--1995, 1999, 2001--2018
+Copyright @copyright{} 1994--1995, 1999, 2001--2019
 Free Software Foundation, Inc.
 
 @quotation
diff --git a/doc/misc/bovine.texi b/doc/misc/bovine.texi
index fc744eb..f138c47 100644
--- a/doc/misc/bovine.texi
+++ b/doc/misc/bovine.texi
@@ -24,7 +24,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 1999--2004, 2012--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1999--2004, 2012--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index f7b23d3..ca322f2 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -95,7 +95,7 @@ This file documents Calc, the GNU Emacs calculator, included 
with
 GNU Emacs @value{EMACSVER}.
 @end ifnotinfo
 
-Copyright @copyright{} 1990--1991, 2001--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1990--1991, 2001--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -1775,7 +1775,7 @@ evaluated first, then @samp{*}, then @samp{/}, then 
finally
 is equivalent to
 
 @example
-2 + ((3*4*5) / (6*(7^8)) - 9
+2 + ((3*4*5) / (6*(7^8))) - 9
 @end example
 
 @noindent
@@ -2026,7 +2026,7 @@ You can also ``unstore'' a variable when you are through 
with it:
 
 @smallexample
 @group
-2:  2 + 5 => 5
+2:  2 + 3 => 5
 1:  2 a + 2 b => 2 a + 2 b
     .
 
diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi
index 5a229c1..f73a7fb 100644
--- a/doc/misc/cc-mode.texi
+++ b/doc/misc/cc-mode.texi
@@ -148,7 +148,17 @@ CC Mode
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
 @comment Define an index for syntactic symbols.
address@hidden Version for Texinfo <= 4.x
address@hidden txicommandconditionals
address@hidden @c In texi2dvi, the @defindex would create an empty cc-mode.ss
+          @c For Info, unlike tex, @syncodeindex needs a matching @defindex.
 @defindex ss
address@hidden ifnottex
address@hidden ifclear
address@hidden Version for Texinfo >= 5.x
address@hidden txicommandconditionals
address@hidden ss
address@hidden ifset
 
 @comment Combine key, syntactic symbol and concept indices into one.
 @syncodeindex ss cp
@@ -157,7 +167,7 @@ CC Mode
 @copying
 This manual is for CC Mode in Emacs.
 
-Copyright @copyright{} 1995--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1995--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -2282,6 +2292,8 @@ method, ``Top-level commands or the customization 
interface''.
 
 If you make conflicting settings in several of these ways, the way
 that takes precedence is the one that appears latest in this list:
address@hidden Version of list for Texinfo <= 4.x
address@hidden txicommandconditionals
 @itemize @w{}
 @item
 @table @asis
@@ -2292,6 +2304,18 @@ that takes precedence is the one that appears latest in 
this list:
 @itemx File Local Variable setting
 @end table
 @end itemize
address@hidden ifclear
address@hidden Version of list for Texinfo >= 5.x
address@hidden txicommandconditionals
address@hidden @w{}
address@hidden Style
address@hidden File address@hidden earlier versions of @ccmode{}, a File Style 
setting took precedence over any other setting apart from a File Local Variable 
setting.}
address@hidden Top-level command or ``customization interface''
address@hidden Hook
address@hidden File Local Variable setting
address@hidden itemize
address@hidden ifset
+
 
 Here is a summary of the different ways of writing your configuration
 settings:
@@ -2548,7 +2572,7 @@ Basics}).
 @item
 The style variable @code{c-offsets-alist} (@pxref{c-offsets-alist}) is
 an association list with an element for each syntactic symbol.  It's
-handled a little differently from the other style variables.  It's
+handled a little differently from the other style variables.  Its
 default global binding is the empty list @code{nil}, rather than
 @code{set-from-style}.  Before the style system is initialized, you
 can add individual elements to @code{c-offsets-alist} by calling
@@ -5286,7 +5310,7 @@ The simplest and most used kind of ``offset'' setting in
 @defopt c-basic-offset
 @vindex basic-offset @r{(c-)}
 This style variable holds the basic offset between indentation levels.
-It's factory default is 4, but all the built-in styles set it
+Its factory default is 4, but all the built-in styles set it
 themselves, to some value between 2 (for @code{gnu} style) and 8 (for
 @code{bsd}, @code{linux}, and @code{python} styles).
 @end defopt
@@ -5614,9 +5638,9 @@ any problems writing custom line-up functions for AWK 
mode.
 
 The calling convention for line-up functions is described fully in
 @ref{Custom Line-Up}.  Roughly speaking, the return value is either an
-offset itself (such as @code{+} or @code{[0]}) or it's @code{nil},
-meaning ``this function is inappropriate in this case; try a
-different one''.  @xref{c-offsets-alist}.
+offset itself (such as @code{+} or @code{[0]}), another line-up
+function, or it's @code{nil}, meaning ``this function is inappropriate
+in this case - try a different one''.  @xref{c-offsets-alist}.
 
 The subsections below describe all the standard line-up functions,
 categorized by the sort of token the lining-up centers around.  For
@@ -5971,6 +5995,125 @@ brace block.
 
 @comment ------------------------------------------------------------
 
address@hidden c-lineup-2nd-brace-entry-in-arglist
address@hidden lineup-2nd-brace-entry-in-arglist (c-)
+Line up the second entry of a brace block under the first, when the
+first line is also contained in an arglist or an enclosing brace
address@hidden that line}.
+
+I.e. handle something like the following:
+
address@hidden
address@hidden
+set_line (line_t @address@hidden, address@hidden,
+                  address@hidden, address@hidden,       
@hereFn{brace-list-intro}
+                  address@hidden);
+         ^ enclosing parenthesis.
address@hidden group
address@hidden example
+                      
+
+The middle line of that example will have a syntactic context with
+three syntactic symbols, @code{arglist-cont-nonempty},
address@hidden, and @code{brace-list-entry} (@pxref{Brace
+List Symbols}).
+
+This function is intended for use in a list.  If the construct being
+analyzed isn't like the preceding, the function returns nil.
+Otherwise it returns the function
address@hidden, which the caller then uses
+to perform indentation.
+
address@hidden @code{brace-list-intro}.
address@hidden defun
+
address@hidden ------------------------------------------------------------
+
address@hidden c-lineup-class-decl-init-+
address@hidden lineup-class-decl-init-+ (c-)
+Line up the second entry of a class (etc.) initializer
address@hidden characters in from the identifier when:
address@hidden
address@hidden
+The type is a class, struct, union, etc. (but not an enum);
address@hidden
+There is a brace block in the type declaration, specifying it; and
address@hidden
+The first element of the initializer is on the same line as its
+opening brace.
address@hidden enumerate
+
+I.e. we have a construct like this:
+
address@hidden
address@hidden
+struct STR @{
+    int i; float f;
address@hidden str_1 = @{1, address@hidden,
+    str_2 = @{2,
+         3.1          @hereFn{brace-list-intro}
+    @};
+    @sssTBasicOffset{}
address@hidden group
address@hidden example
+        
+
+Note that the syntactic context of the @code{brace-list-intro} line
+also has a syntactic element with the symbol @code{brace-list-entry}
+(@pxref{Brace List Symbols}).
+
+This function is intended for use in a list.  If the above structure
+isn't present, the function returns nil, allowing a different offset
+specification to indent the line.
+
address@hidden @code{brace-list-intro}.
address@hidden defun
+
address@hidden ------------------------------------------------------------
+
address@hidden c-lineup-class-decl-init-after-brace
address@hidden lineup-class-decl-init-after-brace (c-)
+Line up the second entry of a class (etc.) initializer after its
+opening brace when:
address@hidden
address@hidden
+The type is a class, struct, union, etc. (but not an enum);
address@hidden
+There is a brace block in the type declaration, specifying it; and
address@hidden
+The first element of the initializer is on the same line as its
+opening brace.
address@hidden enumerate
+
+I.e. we have a construct like this:
+
address@hidden
address@hidden
+struct STR @{
+    int i; float f;
address@hidden str_1 = @{1, address@hidden,
+    str_2 = @{2,
+             3.1      @hereFn{brace-list-intro}
+    @};
address@hidden group
address@hidden example
+        
+
+Note that the syntactic context of the @code{brace-list-intro} line
+also has a syntactic element with the symbol @code{brace-list-entry}
+(@pxref{Brace List Symbols}).  Also note that this function works by
+returning the symbol @code{c-lineup-arglist-intro-after-paren}, which
+the caller then uses to perform the indentation.
+
+This function is intended for use in a list.  If the above structure
+isn't present, the function returns nil, allowing a different offset
+specification to indent the line.
+
address@hidden @code{brace-list-intro}.
address@hidden defun
+
address@hidden ------------------------------------------------------------
+
 @defun c-lineup-multi-inher
 @findex lineup-multi-inher @r{(c-)}
 Line up the classes in C++ multiple inheritance clauses and member
diff --git a/doc/misc/cl.texi b/doc/misc/cl.texi
index 6985f19..32b5076 100644
--- a/doc/misc/cl.texi
+++ b/doc/misc/cl.texi
@@ -7,7 +7,7 @@
 @copying
 This file documents the GNU Emacs Common Lisp emulation package.
 
-Copyright @copyright{} 1993, 2001--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1993, 2001--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/dbus.texi b/doc/misc/dbus.texi
index 5b14382..c7d4998 100644
--- a/doc/misc/dbus.texi
+++ b/doc/misc/dbus.texi
@@ -10,7 +10,7 @@
 @syncodeindex fn cp
 
 @copying
-Copyright @copyright{} 2007--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2007--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -1015,7 +1015,7 @@ but different to
 
 The value for a byte D-Bus type can be any integer in the range 0
 through 255.  If a character is used as argument, modifiers
-represented outside this range are stripped of.  For example,
+represented outside this range are stripped off.  For example,
 @code{:byte ?x} is equal to @code{:byte ?\M-x}, but it is not equal to
 @code{:byte ?\C-x} or @code{:byte ?\M-\C-x}.
 
diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi
index f65542f..b6a9d23 100644
--- a/doc/misc/dired-x.texi
+++ b/doc/misc/dired-x.texi
@@ -20,7 +20,7 @@
 @comment %**end of header (This is for running Texinfo on a region.)
 
 @copying
-Copyright @copyright{} 1994--1995, 1999, 2001--2018
+Copyright @copyright{} 1994--1995, 1999, 2001--2019
 Free Software Foundation, Inc.
 
 @quotation
diff --git a/doc/misc/ebrowse.texi b/doc/misc/ebrowse.texi
index b6f2c18..0d4a44e 100644
--- a/doc/misc/ebrowse.texi
+++ b/doc/misc/ebrowse.texi
@@ -11,7 +11,7 @@
 @copying
 This file documents Ebrowse, a C++ class browser for GNU Emacs.
 
-Copyright @copyright{} 2000--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2000--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/ede.texi b/doc/misc/ede.texi
index 42bedb1..7ab386c 100644
--- a/doc/misc/ede.texi
+++ b/doc/misc/ede.texi
@@ -6,7 +6,7 @@
 @copying
 This file describes EDE, the Emacs Development Environment.
 
-Copyright @copyright{} 1998--2001, 2004--2005, 2008--2018
+Copyright @copyright{} 1998--2001, 2004--2005, 2008--2019
 Free Software Foundation, Inc.
 
 @quotation
@@ -1038,7 +1038,7 @@ details on using @eieio{} to extending classes, and 
writing methods.
 
 If you intend to extend @ede{}, it is most likely that a new target type is
 needed in one of the existing project types.  The rest of this chapter
-will discuss extending the @code{ede-project} class, and it's targets.
+will discuss extending the @code{ede-project} class, and its targets.
 See @file{project-am.el} for basic details on adding targets to it.
 
 For the @code{ede-project} type, the core target class is called
@@ -1477,7 +1477,7 @@ Get the inode of the directory project @var{PROJ} is in.
 @end deffn
 
 @deffn Method ede-project-root :AFTER this
-If a project knows it's root, return it here.
+If a project knows its root, return it here.
 Allows for one-project-object-for-a-tree type systems.
 @end deffn
 
@@ -1486,7 +1486,7 @@ Find a subproject of @var{PROJ} that corresponds to 
@var{DIR}.
 @end deffn
 
 @deffn Method ede-project-root-directory :AFTER this &optional file
-If a project knows it's root, return it here.
+If a project knows its root, return it here.
 Allows for one-project-object-for-a-tree type systems.
 Optional @var{FILE} is the file to test.  It is ignored in preference
 of the anchor file for the project.
@@ -2516,7 +2516,7 @@ In sources for @var{THIS}, change version numbers to 
@var{VERSION}.
 @end deffn
 
 @deffn Method project-delete-target :AFTER ot
-Delete the current target @var{OT} from it's parent project.
+Delete the current target @var{OT} from its parent project.
 @end deffn
 
 @deffn Method ede-target-sourcecode :AFTER this
@@ -2715,7 +2715,7 @@ Converts all symbols into the objects to be used.
 @end deffn
 
 @deffn Method project-delete-target :AFTER this
-Delete the current target @var{THIS} from it's parent project.
+Delete the current target @var{THIS} from its parent project.
 @end deffn
 
 @deffn Method ede-proj-makefile-target-name :AFTER this
@@ -4013,7 +4013,7 @@ Type: @code{list}
 
 The commands used to execute this compiler.
 The object which uses this compiler will place these commands after
-it's rule definition.
+its rule definition.
 
 @item :autoconf
 Type: @code{list} @*
@@ -4125,7 +4125,7 @@ Type: @code{list}
 
 The commands used to execute this compiler.
 The object which uses this compiler will place these commands after
-it's rule definition.
+its rule definition.
 
 @item :objectextention
 Type: @code{string}
@@ -4265,7 +4265,7 @@ Type: @code{list}
 
 The commands used to execute this compiler.
 The object which uses this compiler will place these commands after
-it's rule definition.
+its rule definition.
 
 @item :objectextention
 Type: @code{string}
diff --git a/doc/misc/ediff.texi b/doc/misc/ediff.texi
index 746c4c8..c4ef1da 100644
--- a/doc/misc/ediff.texi
+++ b/doc/misc/ediff.texi
@@ -26,7 +26,7 @@
 This file documents Ediff, a comprehensive visual interface to Unix diff
 and patch utilities.
 
-Copyright @copyright{} 1995--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1995--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -210,11 +210,11 @@ ancestors.  Ediff selects only the files that are under 
version control.
 
 @item ediff-windows-wordwise
 @findex ediff-windows-wordwise
-Compare windows word-by-word.
+Compare text visible in 2 windows word-by-word.
 
 @item ediff-windows-linewise
 @findex ediff-windows-linewise
-Compare windows line-by-line.
+Compare text visible in 2 windows line-by-line.
 
 @item ediff-regions-wordwise
 @findex ediff-regions-wordwise
@@ -373,13 +373,12 @@ The commands @code{ediff-windows-wordwise},
 @code{ediff-windows-linewise}, @code{ediff-regions-wordwise} and
 @code{ediff-regions-linewise} do comparison on parts of existing Emacs
 buffers.  The commands @code{ediff-windows-wordwise} and
address@hidden are intended for relatively small segments
-of buffers (e.g., up to 100 lines, depending on the speed of your machine),
address@hidden could be slow on very large buffers,
 as they perform comparison on the basis of words rather than lines.
-(Word-wise comparison of large chunks of text can be slow.)
+(Word-wise comparison of large chunks of text is relatively expensive.)
 
-To compare large regions, use @code{ediff-regions-linewise}.  This
-command displays differences much like @code{ediff-files} and
+To compare very large regions, use @code{ediff-regions-linewise}.
+This command displays differences much like @code{ediff-files} and
 @code{ediff-buffers}.
 
 The functions @code{ediff-patch-file} and @code{ediff-patch-buffer} apply a
@@ -1148,7 +1147,7 @@ file (unlike what the @code{patch} utility would usually 
do).  Instead, the
 source file retains its name and the result of applying the patch is placed
 in a temporary file that has the suffix @file{_patched} attached.
 Generally, this applies to files that are handled using black magic, such
-as special file handlers (ange-ftp and some compression and encryption
+as special file name handlers (ange-ftp and some compression and encryption
 packages also use this method).
 
 Regular files are treated by the @code{patch} utility in the usual manner,
diff --git a/doc/misc/edt.texi b/doc/misc/edt.texi
index 754e3c8..74224e9 100644
--- a/doc/misc/edt.texi
+++ b/doc/misc/edt.texi
@@ -6,7 +6,7 @@
 @copying
 This file documents the EDT emulation package for Emacs.
 
-Copyright @copyright{} 1986, 1992, 1994--1995, 1999--2018
+Copyright @copyright{} 1986, 1992, 1994--1995, 1999--2019
 Free Software Foundation, Inc.
 
 @quotation
diff --git a/doc/misc/efaq-w32.texi b/doc/misc/efaq-w32.texi
index e18bb73..8e067a7 100644
--- a/doc/misc/efaq-w32.texi
+++ b/doc/misc/efaq-w32.texi
@@ -15,7 +15,7 @@ Answers to Frequently asked Questions about using Emacs on 
Microsoft Windows.
 @include emacsver.texi
 
 @copying
-Copyright @copyright{} 2008, 2010-2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2008, 2010-2019 Free Software Foundation, Inc.
 
 @quotation
 This list of frequently asked questions about GNU Emacs on MS Windows
diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi
index 0d4e4ba..485776e 100644
--- a/doc/misc/efaq.texi
+++ b/doc/misc/efaq.texi
@@ -12,7 +12,7 @@
 @c appreciate a notice if you do).
 
 @copying
-Copyright @copyright{} 2001--2018 Free Software Foundation, address@hidden
+Copyright @copyright{} 2001--2019 Free Software Foundation, address@hidden
 Copyright @copyright{} 1994, 1995, 1996, 1997, 1998, 1999, 2000
 Reuven M. address@hidden
 Copyright @copyright{} 1992, 1993 Steven address@hidden
@@ -2005,9 +2005,18 @@ or by invoking @code{server-start} from @file{.emacs}:
 (if (@var{some conditions are met}) (server-start))
 @end lisp
 
-When this is done, Emacs creates a Unix domain socket named
address@hidden in @file{/tmp/address@hidden See
address@hidden
+When this is done, Emacs by default creates a Unix domain socket named
address@hidden in a well-known directory, typically
address@hidden/emacs} if Emacs is running under an X Window System
+desktop and @file{$TMPDIR/address@hidden otherwise.  See the variable
address@hidden  Traditionally, Emacs used
address@hidden/address@hidden even when running under an X desktop;
+if you prefer this traditional (and less-secure) behavior, you
+can set the environment variable @env{EMACS_SOCKET_NAME} to
address@hidden/address@hidden/server} before invoking Emacs and
address@hidden, although it will be your responsibility to create
+the directory @samp{$TMPDIR/address@hidden with appropriate
+ownership and permissions.
 
 To get your news reader, mail reader, etc., to invoke
 @samp{emacsclient}, try setting the environment variable @code{EDITOR}
diff --git a/doc/misc/eieio.texi b/doc/misc/eieio.texi
index 689ff72..d03ee79 100644
--- a/doc/misc/eieio.texi
+++ b/doc/misc/eieio.texi
@@ -12,7 +12,7 @@
 @copying
 This manual documents EIEIO, an object framework for Emacs Lisp.
 
-Copyright @copyright{} 2007--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2007--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/emacs-gnutls.texi b/doc/misc/emacs-gnutls.texi
index a690ccf..add79d1 100644
--- a/doc/misc/emacs-gnutls.texi
+++ b/doc/misc/emacs-gnutls.texi
@@ -9,7 +9,7 @@
 @copying
 This file describes the Emacs GnuTLS integration.
 
-Copyright @copyright{} 2012--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2012--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -179,17 +179,35 @@ Just use @code{open-protocol-stream} or 
@code{open-network-stream}
 You should not have to use the @file{gnutls.el} functions directly.
 But you can test them with @code{open-gnutls-stream}.
 
address@hidden open-gnutls-stream name buffer host service &optional nowait
address@hidden open-gnutls-stream name buffer host service &optional parameters
 This function creates a buffer connected to a specific @var{host} and
address@hidden (port number or service name).  The parameters and their
-syntax are the same as those given to @code{open-network-stream}
-(@pxref{Network,, Network Connections, elisp, The Emacs Lisp Reference
-Manual}).  The connection process is called @var{name} (made unique if
-necessary).  This function returns the connection process.
-
-The @var{nowait} parameter means that the socket should be
-asynchronous, and the connection process will be returned to the
-caller before TLS negotiation has happened.
address@hidden (port number or service name).  The mandatory arguments
+and their syntax are the same as those given to
address@hidden (@pxref{Network,, Network Connections,
+elisp, The Emacs Lisp Reference Manual}).  The connection process is
+called @var{name} (made unique if necessary).  This function returns
+the connection process.
+
+The optional @var{parameters} argument is a list of keywords and
+values.  The only keywords which currently have any effect are
address@hidden:client-certificate} and @code{:nowait}.
+
+Passing @address@hidden:client certificate t}} triggers looking up of client
+certificates matching @var{host} and @var{service} using the
address@hidden library.  Any resulting client certificates are passed
+down to the lower TLS layers.  The format used by @file{.authinfo} to
+specify the per-server keys is described in @ref{Help for
+users,,auth-source, auth, Emacs auth-source Library}.
+
+Passing @address@hidden:nowait t}} means that the socket should be 
asynchronous,
+and the connection process will be returned to the caller before TLS
+negotiation has happened.
+
+For historical reasons @var{parameters} can also be a symbol, which is
+interpreted the same as passing a list containing @code{:nowait} and
+the value of that symbol.
+
+Example calls:
 
 @lisp
 ;; open a HTTPS connection
diff --git a/doc/misc/emacs-mime.texi b/doc/misc/emacs-mime.texi
index f46b2a7..dd651ff 100644
--- a/doc/misc/emacs-mime.texi
+++ b/doc/misc/emacs-mime.texi
@@ -1,7 +1,5 @@
 \input texinfo
 
address@hidden gnus-overrides.texi
-
 @setfilename ../../info/emacs-mime.info
 @settitle Emacs MIME Manual
 @include docstyle.texi
@@ -12,7 +10,7 @@
 @copying
 This file documents the Emacs MIME interface functionality.
 
-Copyright @copyright{} 1998--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1998--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -698,13 +696,15 @@ Translation}.
 A description of the part (@code{Content-Description}).
 
 @item creation-date
-RFC822 date when the part was created (@code{Content-Disposition}).
+Date when the part was created (@code{Content-Disposition}).
+This uses the format of RFC 822 or its successors.
 
 @item modification-date
-RFC822 date when the part was modified (@code{Content-Disposition}).
+RFC 822 (or later) date when the part was modified
+(@code{Content-Disposition}).
 
 @item read-date
-RFC822 date when the part was read (@code{Content-Disposition}).
+RFC 822 (or later) date when the part was read (@code{Content-Disposition}).
 
 @item recipients
 Who to encrypt/sign the part to.  This field is used to override any
@@ -754,7 +754,7 @@ be obtained.  Values include @samp{ftp}, @samp{anon-ftp}, 
@samp{tftp},
 @samp{localfile}, and @samp{mailserver}.  (@code{Content-Type}.)
 
 @item expiration
-The RFC822 date after which the file may no longer be fetched.
+RFC 822 (or later) date after which the file may no longer be fetched.
 (@code{Content-Type}.)
 
 @item size
@@ -1301,7 +1301,7 @@ on.  High-level functionality is dealt with in the first 
chapter
 @menu
 * rfc2045::      Encoding @code{Content-Type} headers.
 * rfc2231::      Parsing @code{Content-Type} headers.
-* ietf-drums::   Handling mail headers defined by RFC822bis.
+* ietf-drums::   Handling mail headers defined by RFC 2822.
 * rfc2047::      En/decoding encoded words in headers.
 * time-date::    Functions for parsing dates and manipulating time.
 * qp::           Quoted-Printable en/decoding.
@@ -1385,8 +1385,8 @@ Encode a parameter in headers likes @code{Content-Type} 
and
 @node ietf-drums
 @section ietf-drums
 
address@hidden is an IETF working group that is working on the replacement
-for RFC822.
address@hidden was an IETF working group that worked on Internet RFC 2822,
+the first successor to RFC 822 and a predecessor of the current email standard.
 
 The functions provided by this library include:
 
@@ -1597,7 +1597,7 @@ The five data representations used are the following:
 
 @table @var
 @item date
-An RFC822 (or similar) date string.  For instance: @code{"Sat Sep 12
+An RFC 822 (or similar) date string.  For instance: @code{"Sat Sep 12
 12:21:54 1998 +0200"}.
 
 @item time
@@ -1889,55 +1889,55 @@ in @file{/etc/mailcap} will ``win'' over an 
@samp{image/*} setting in
 The Emacs @acronym{MIME} library implements handling of various elements
 according to a (somewhat) large number of RFCs, drafts and standards
 documents.  This chapter lists the relevant ones.  They can all be
-fetched from @uref{http://quimby.gnus.org/notes/}.
+fetched from @uref{https://www.rfc-editor.org}.
 
 @table @dfn
address@hidden RFC822
address@hidden STD11
-Standard for the Format of ARPA Internet Text Messages.
address@hidden RFC 5322
+Internet Message Format
 
address@hidden RFC1036
-Standard for Interchange of USENET Messages
address@hidden RFC 5536
+Netnews Article Format
 
address@hidden RFC2045
address@hidden RFC 2045
 Format of Internet Message Bodies
 
address@hidden RFC2046
address@hidden RFC 2046
 Media Types
 
address@hidden RFC2047
address@hidden RFC 2047
 Message Header Extensions for address@hidden Text
 
address@hidden RFC2048
-Registration Procedures
address@hidden RFC 6838
+Media Type Specifications and Registration Procedures
 
address@hidden RFC2049
address@hidden RFC 4289
+Registration Procedures (obsoleting RFC 2048)
+
address@hidden RFC 2049
 Conformance Criteria and Examples
 
address@hidden RFC2231
address@hidden RFC 2231
 @acronym{MIME} Parameter Value and Encoded Word Extensions: Character Sets,
 Languages, and Continuations
 
address@hidden RFC1843
address@hidden RFC 1843
 HZ---A Data Format for Exchanging Files of Arbitrarily Mixed Chinese and
 @acronym{ASCII} characters
 
address@hidden draft-ietf-drums-msg-fmt-05.txt
-Draft for the successor of RFC822
-
address@hidden RFC2112
address@hidden RFC 2387
 The @acronym{MIME} Multipart/Related Content-type
 
address@hidden RFC1892
-The Multipart/Report Content Type for the Reporting of Mail System
address@hidden RFC 6522
address@hidden STD 73
+The Multipart/Report Media Type for the Reporting of Mail System
 Administrative Messages
 
address@hidden RFC2183
address@hidden RFC 2183
 Communicating Presentation Information in Internet Messages: The
 Content-Disposition Header Field
 
address@hidden RFC2646
-Documentation of the text/plain format parameter for flowed text.
address@hidden RFC 3676
+The Text/Plain Format and DelSp Parameters
 
 @end table
 
diff --git a/doc/misc/epa.texi b/doc/misc/epa.texi
index d5dfe70..330ce70 100644
--- a/doc/misc/epa.texi
+++ b/doc/misc/epa.texi
@@ -10,7 +10,7 @@
 @copying
 This file describes EasyPG Assistant @value{VERSION}.
 
-Copyright @copyright{} 2007--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2007--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/erc.texi b/doc/misc/erc.texi
index 55556c5..e1d2217 100644
--- a/doc/misc/erc.texi
+++ b/doc/misc/erc.texi
@@ -10,7 +10,7 @@
 @copying
 This manual is for ERC as distributed with Emacs @value{EMACSVER}.
 
-Copyright @copyright{} 2005--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2005--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/ert.texi b/doc/misc/ert.texi
index 6a34f5c..d2d8655 100644
--- a/doc/misc/ert.texi
+++ b/doc/misc/ert.texi
@@ -15,7 +15,7 @@
 @end direntry
 
 @copying
-Copyright @copyright{} 2008, 2010--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2008, 2010--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi
index c19d5e1..716b4b7 100644
--- a/doc/misc/eshell.texi
+++ b/doc/misc/eshell.texi
@@ -10,7 +10,7 @@
 @copying
 This manual is for Eshell, the Emacs shell.
 
-Copyright @copyright{} 1999--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1999--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -213,8 +213,8 @@ available in the Emacs Lisp library.  It does this by 
transforming the
 input line into a callable Lisp address@hidden see the Lisp form that will be 
invoked, type: @samp{eshell-parse-command "echo hello"}}
 
 The command can be either an Elisp function or an external command.
-Eshell looks first for an @ref{Aliases, alias} with the same name as the
-command, then a @ref{Built-ins, built-in command} or a function with the
+Eshell looks first for an alias (@pxref{Aliases}) with the same name as the
+command, then a built-in (@pxref{Built-ins}) or a function with the
 same name; if there is no match, it then tries to execute it as an
 external command.
 
@@ -253,7 +253,7 @@ eshell/ls is a compiled Lisp function in `em-ls.el'
 @end example
 
 If you want to discard a given built-in command, you could declare an
-alias, @ref{Aliases}.  Example:
+alias (@pxref{Aliases}).  Example:
 
 @example
 ~ $ which sudo
@@ -280,8 +280,7 @@ with no arguments, prints the current paths in this 
variable.
 
 @item alias
 @cmindex alias
-Define an alias (@pxref{Aliases}).  This does not add it to the aliases
-file.
+Define an alias (@pxref{Aliases}).  This adds it to the aliases file.
 
 @item clear
 @cmindex clear
@@ -419,7 +418,7 @@ Lisp functions, based on successful completion).
 
 @end table
 
address@hidden for the built-in variables @samp{$*}, @samp{$1},
address@hidden, for the built-in variables @samp{$*}, @samp{$1},
 @samp{$2}, @dots{}, in alias definitions.
 
 @node Variables
@@ -500,15 +499,14 @@ be directories @emph{and} files.  Eshell provides 
predefined completions
 for the built-in functions and some common external commands, and you
 can define your own for any command.
 
-Eshell completion also works for lisp forms and glob patterns. If the
-point is on a lisp form, then @key{TAB} will behave similarly to completion
-in @code{elisp-mode} and @code{lisp-interaction-mode}.  For glob
-patterns, If there are few enough possible completions of the patterns,
-they will be cycled when @key{TAB} is pressed, otherwise it will be removed
-from the input line and the possible completions will be listed.
+Eshell completion also works for lisp forms and glob patterns. If the point is
+on a lisp form, then @key{TAB} will behave similarly to completion in
address@hidden and @code{lisp-interaction-mode}.  For glob patterns, the
+pattern will be removed from the input line, and replaced by the
+completion.
 
-If you want to see the entire list of possible completions when it's
-below the cycling threshold, press @kbd{M-?}.
+If you want to see the entire list of possible completions (e.g. when it's
+below the @code{completion-cycle-threshold}), press @kbd{M-?}.
 
 @subsection pcomplete
 Pcomplete, short for programmable completion, is the completion
@@ -630,8 +628,8 @@ to @code{"hello"}.
 Eshell's globbing syntax is very similar to that of Zsh.  Users coming
 from Bash can still use Bash-style globbing, as there are no
 incompatibilities.  Most globbing is pattern-based expansion, but there
-is also predicate-based expansion.  See
address@hidden Generation, , , zsh, The Z Shell Manual}
+is also predicate-based expansion.  @xref{Filename Generation, , ,
+zsh, The Z Shell Manual},
 for full syntax.  To customize the syntax and behavior of globbing in
 Eshell see the address@hidden@xref{Easy Customization, , , emacs,
 The GNU Emacs Manual}.}
diff --git a/doc/misc/eudc.texi b/doc/misc/eudc.texi
index e41be86..117b62e 100644
--- a/doc/misc/eudc.texi
+++ b/doc/misc/eudc.texi
@@ -14,7 +14,7 @@ This file documents EUDC version 1.40.0.
 EUDC is the Emacs Unified Directory Client, a common interface to
 directory servers and contact information.
 
-Copyright @copyright{} 1998, 2000--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1998, 2000--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
index aa17eee..8dc58e8 100644
--- a/doc/misc/eww.texi
+++ b/doc/misc/eww.texi
@@ -8,7 +8,7 @@
 @copying
 This file documents the GNU Emacs Web Wowser (EWW) package.
 
-Copyright @copyright{} 2014--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2014--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -85,6 +85,10 @@ searched via @code{eww-search-prefix}.  The default search 
engine is
 either prefix the file name with @code{file://} or use the command
 @kbd{M-x eww-open-file}.
 
+  If you invoke @code{eww} with a prefix argument, as in @address@hidden
+M-x eww}}, it will create a new EWW buffer instead of reusing the
+default one, which is normally called @file{*eww*}.
+
 @findex eww-quit
 @findex eww-reload
 @findex eww-copy-page-url
@@ -118,16 +122,17 @@ variable-pitch fonts or not.  This sets the 
@code{shr-use-fonts} variable.
 @findex eww-toggle-colors
 @findex shr-use-colors
 @kindex F
-  The @kbd{C} command (@code{eww-toggle-colors}) toggles whether to use
+  The @kbd{M-C} command (@code{eww-toggle-colors}) toggles whether to use
 HTML-specified colors or not.  This sets the @code{shr-use-colors} variable.
 
 @findex eww-download
 @vindex eww-download-directory
 @kindex d
 @cindex Download
-  A URL under the point can be downloaded with @kbd{d}
-(@code{eww-download}).  The file will be written to the directory
-specified in @code{eww-download-directory} (Default: @file{~/Downloads/}).
+  A URL can be downloaded with @kbd{d} (@code{eww-download}).  This
+will download the link under point if there is one, or else the URL of
+the current page.  The file will be written to the directory specified
+in @code{eww-download-directory} (default: @file{~/Downloads/}).
 
 @findex eww-back-url
 @findex eww-forward-url
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi
index bda7e14..894203c 100644
--- a/doc/misc/flymake.texi
+++ b/doc/misc/flymake.texi
@@ -14,7 +14,7 @@
 This manual is for GNU Flymake (version @value{VERSION}, @value{UPDATED}),
 which is a universal on-the-fly syntax checker for GNU Emacs.
 
-Copyright @copyright{} 2004--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2004--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/forms.texi b/doc/misc/forms.texi
index 7046341..d669ed6 100644
--- a/doc/misc/forms.texi
+++ b/doc/misc/forms.texi
@@ -19,7 +19,7 @@
 @copying
 This file documents Forms mode, a form-editing major mode for GNU Emacs.
 
-Copyright @copyright{} 1989, 1997, 2001--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1989, 1997, 2001--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/gnus-coding.texi b/doc/misc/gnus-coding.texi
index 4590524..6affea4 100644
--- a/doc/misc/gnus-coding.texi
+++ b/doc/misc/gnus-coding.texi
@@ -8,7 +8,7 @@
 @syncodeindex pg cp
 
 @copying
-Copyright @copyright{} 2004--2005, 2007--2018 Free Software
+Copyright @copyright{} 2004--2005, 2007--2019 Free Software
 Foundation, Inc.
 
 @quotation
@@ -141,7 +141,7 @@ There are no Gnus dependencies in this file.
 There are no Gnus dependencies in this file.
 
 @item ietf-drums.el
-Functions for parsing RFC822bis headers.
+Functions for parsing RFC 2822 headers.
 @c As of 2005-10-21...
 There are no Gnus dependencies in this file.
 
@@ -227,161 +227,6 @@ ends (probably @file{nnml.el}, @file{nnfolder.el} and
 @c requires nnheader.
 
 
address@hidden Compatibility
-
-No Gnus and Gnus 5.10.10 and up should work on:
address@hidden @bullet
address@hidden
-Emacs 21.1 and up.
address@hidden
-XEmacs 21.4 and up.
address@hidden itemize
-
-Gnus 5.10.8 and below should work on:
address@hidden @bullet
address@hidden
-Emacs 20.7 and up.
address@hidden
-XEmacs 21.1 and up.
address@hidden itemize
-
address@hidden Gnus Maintenance Guide
address@hidden Gnus Maintenance Guide
-
address@hidden Stable and development versions
-
-The development of Gnus normally is done on the Git repository trunk
-as of April 19, 2010 (formerly it was done in CVS; the repository is
-at http://git.gnus.org), i.e., there are no separate branches to
-develop and test new features.  Most of the time, the trunk is
-developed quite actively with more or less daily changes.  Only after
-a new major release, e.g., 5.10.1, there's usually a feature period of
-several months.  After the release of Gnus 5.10.6 the development of
-new features started again on the trunk while the 5.10 series is
-continued on the stable branch (v5-10) from which more stable releases
-will be done when needed (5.10.8, @dots{}).  @ref{Gnus Development,
-,Gnus Development, gnus, The Gnus Newsreader}
-
-Stable releases of Gnus finally become part of Emacs.  E.g., Gnus 5.8
-became a part of Emacs 21 (relabeled to Gnus 5.9).  The 5.10 series
-became part of Emacs 22 as Gnus 5.11.
-
address@hidden Syncing
-
address@hidden Some MIDs related to this follow.  Use 
http://thread.gmane.org/MID
address@hidden (and click on the subject) to get the thread on Gmane.
-
address@hidden Some quotes from Miles Bader follow...
-
address@hidden <address@hidden>
address@hidden <address@hidden>
-
-In the past, the inclusion of Gnus into Emacs was quite cumbersome.  For
-each change made to Gnus in Emacs repository, it had to be checked that
-it was applied to the new Gnus version, too.  Else, bug fixes done in
-Emacs repository might have been lost.
-
-With the inclusion of Gnus 5.10, Miles Bader has set up an Emacs-Gnus
-gateway to ensure the bug fixes from Emacs CVS are propagated to Gnus
-CVS semi-automatically.
-
-After Emacs moved to bzr and Gnus moved to git, Katsumi Yamaoka has
-taken over the chore of keeping Emacs and Gnus in sync.  In general,
-changes made to one repository will usually be replicated in the other
-within a few days.
-
-Basically the idea is that the gateway will cause all common files in
-Emacs and Gnus v5-13 to be identical except when there's a very good
-reason (e.g., the Gnus version string in Emacs says @samp{5.11}, but
-the v5-13 version string remains @samp{5.13.x}).  Furthermore, all
-changes in these files in either Emacs or the v5-13 branch will be
-installed into the Gnus git trunk, again except where there's a good
-reason.
-
address@hidden (typically so far the only exception has been that the changes
address@hidden already exist in the trunk in modified form).
-Because of this, when the next major version of Gnus will be included in
-Emacs, it should be very easy---just plonk in the files from the Gnus
-trunk without worrying about lost changes from the Emacs tree.
-
-The effect of this is that as hacker, you should generally only have to
-make changes in one place:
-
address@hidden
address@hidden
-If it's a file which is thought of as being outside of Gnus (e.g., the
-new @file{encrypt.el}), you should probably make the change in the Emacs
-tree, and it will show up in the Gnus tree a few days later.
-
-If you don't have Emacs repository access (or it's inconvenient), you
-can change such a file in the v5-10 branch, and it should propagate to
-the Emacs repository---however, it will get some extra scrutiny (by
-Miles) to see if the changes are possibly controversial and need
-discussion on the mailing list.  Many changes are obvious bug-fixes
-however, so often there won't be any problem.
-
address@hidden
-If it's to a Gnus file, and it's important enough that it should be part
-of Emacs and the v5-10 branch, then you can make the change on the v5-10
-branch, and it will go into Emacs and the Gnus git trunk (a few days
-later).  The most prominent examples for such changes are bug-fixed
-including improvements on the documentation.
-
-If you know that there will be conflicts (perhaps because the affected
-source code is different in v5-10 and the Gnus git trunk), then you can
-install your change in both places, and when I try to sync them, there
-will be a conflict---however, since in most such cases there would be a
-conflict @emph{anyway}, it's often easier for me to resolve it simply if
-I see two @samp{identical} changes, and can just choose the proper one,
-rather than having to actually fix the code.
-
address@hidden
-For general Gnus development changes, of course you just make the
-change on the Gnus Git trunk and it goes into Emacs a few years
-later... :-)
-
address@hidden itemize
-
-Of course in any case, if you just can't wait for me to sync your
-change, you can commit it in more than one place and probably there will
-be no problem; usually the changes are textually identical anyway, so
-can be easily resolved automatically (sometimes I notice silly things in
-such multiple commits, like whitespace differences, and unify those ;-).
-
-
address@hidden I do Emacs->Gnus less often (than Gnus->Emacs) because it tends 
to
address@hidden require more manual work.
-
address@hidden By default I sync about once a week.  I also try to follow any 
Gnus
address@hidden threads on the mailing lists and make sure any changes being 
discussed
address@hidden are kept more up-to-date (so say 1-2 days delay for "topical" 
changes).
-
address@hidden <address@hidden>
-
address@hidden BTW, just to add even more verbose explanation about the syncing 
thing:
-
address@hidden Miscellanea
-
address@hidden @file{GNUS-NEWS}
-
-The @file{etc/GNUS-NEWS} is created from
address@hidden/misc/gnus-news.texi}.  Don't edit @file{etc/GNUS-NEWS}.
-Edit @file{doc/misc/gnus-news.texi}, type @command{make
-update-gnus-news} in the @file{lisp} directory and commit
address@hidden/GNUS-NEWS} and @file{doc/misc/gnus-news.texi}.
-
address@hidden Conventions for version information in defcustoms
-
-For new customizable variables introduced in Oort Gnus (including the
-v5-10 branch) use @code{:version "22.1" ;; Oort Gnus} (including the
-comment) or, e.g., @code{:version "22.2" ;; Gnus 5.10.10} if the feature
-was added for Emacs 22.2 and Gnus 5.10.10.
address@hidden
-If the variable is new in No Gnus use @code{:version "23.1" ;; No Gnus}.
-
-The same applies for customizable variables when its default value was
-changed.
-
 @node GNU Free Documentation License
 @appendix GNU Free Documentation License
 @include doclicense.texi
diff --git a/doc/misc/gnus-faq.texi b/doc/misc/gnus-faq.texi
index 2ae5a0a..075f521 100644
--- a/doc/misc/gnus-faq.texi
+++ b/doc/misc/gnus-faq.texi
@@ -1,7 +1,7 @@
 @c \input texinfo @c -*-texinfo-*-
 @c Uncomment 1st line before texing this file alone.
 @c %**start of header
address@hidden Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 @c
 @c @setfilename gnus-faq.info
 @c @settitle Frequently Asked Questions
@@ -284,7 +284,7 @@ what's this?
 @subsubheading Answer
 
 You get the message described in the q/a pair above while
-starting Gnus, right? It's an other symptom for the same
+starting Gnus, right? It's another symptom for the same
 problem, so read the answer above.
 
 @node FAQ 2-3
diff --git a/doc/misc/gnus-news.el b/doc/misc/gnus-news.el
deleted file mode 100644
index 301ea93..0000000
--- a/doc/misc/gnus-news.el
+++ /dev/null
@@ -1,115 +0,0 @@
-;;; gnus-news.el --- a hack to create GNUS-NEWS from texinfo source
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
-
-;; Author: Reiner Steib  <address@hidden>
-;; Keywords: tools
-
-;; This file is part of GNU Emacs.
-
-;; GNU Emacs is free software: you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; GNU Emacs is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;;; Code:
-
-(defvar gnus-news-header-disclaimer
-"GNUS NEWS -- history of user-visible changes.
-
-Copyright (C) 1999-2018 Free Software Foundation, Inc.
-See the end of the file for license conditions.
-
-Please send Gnus bug reports to address@hidden
-For older news, see Gnus info node \"New Features\".\n\n")
-
-(defvar gnus-news-trailer
-"
-* For older news, see Gnus info node \"New Features\".
-
-----------------------------------------------------------------------
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-\(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
-
-\nLocal variables:\nmode: outline
-paragraph-separate: \"[        ]*$\"\nend:\n")
-
-(defvar gnus-news-makeinfo-command "makeinfo")
-
-(defvar gnus-news-fill-column 80)
-
-(defvar gnus-news-makeinfo-switches
-  (concat " --no-headers --paragraph-indent=0"
-         " --no-validate" ;; Allow unresolved references.
-         " --fill-column=" (number-to-string
-                            (+ 3 ;; will strip leading spaces later
-                               (or gnus-news-fill-column 80)))))
-
-(defun batch-gnus-news ()
-  "Make GNUS-NEWS in batch mode."
-  (let (infile outfile)
-    (setq infile (car command-line-args-left)
-         command-line-args-left (cdr command-line-args-left)
-         outfile (car command-line-args-left)
-         command-line-args-left nil)
-    (if (and infile outfile)
-       (message "Creating `%s' from `%s'..." outfile infile)
-      (error "Not enough files given."))
-    (gnus-news-translate-file infile outfile)))
-
-(defun gnus-news-translate-file (infile outfile)
-  "Translate INFILE (texinfo) to OUTFILE (GNUS-NEWS)."
-  (let* ((dir (concat (or (getenv "srcdir") ".") "/"))
-        (infile (concat dir infile))
-        (buffer (find-file-noselect (concat dir outfile))))
-    (with-temp-buffer
-      ;; Could be done using 'texinfmt' stuff as in 'infohack.el'.
-      (insert
-       (shell-command-to-string
-       (concat gnus-news-makeinfo-command " "
-               gnus-news-makeinfo-switches " " infile)))
-      (goto-char (point-max))
-      (delete-char -1)
-      (goto-char (point-min))
-      (save-excursion
-       (while (re-search-forward "^   \\* " nil t)
-         (replace-match "\f\n* ")))
-      (save-excursion
-       (while (re-search-forward "^        \\* " nil t)
-         (replace-match "** ")))
-      (save-excursion
-       (while (re-search-forward "^     " nil t)
-         (replace-match "")))
-      ;; Avoid '*' from @ref at beginning of line:
-      (save-excursion
-       (while (re-search-forward "^\\*Note" nil t)
-         (replace-match " \\&")))
-      (goto-char (point-min))
-      (insert gnus-news-header-disclaimer)
-      (goto-char (point-max))
-      (insert gnus-news-trailer)
-      (write-region (point-min) (point-max) outfile))))
-
-;;; gnus-news.el ends here
diff --git a/doc/misc/gnus-news.texi b/doc/misc/gnus-news.texi
deleted file mode 100644
index 171f59a..0000000
--- a/doc/misc/gnus-news.texi
+++ /dev/null
@@ -1,371 +0,0 @@
address@hidden -*-texinfo-*-
-
address@hidden Copyright (C) 2004-2018 Free Software Foundation, Inc.
-
address@hidden    Permission is granted to anyone to make or distribute 
verbatim copies
address@hidden    of this document as received, in any medium, provided that the
address@hidden    copyright notice and this permission notice are preserved,
address@hidden    thus giving the recipient permission to redistribute in turn.
-
address@hidden    Permission is granted to distribute modified versions
address@hidden    of this document, or of portions of it,
address@hidden    under the above conditions, provided also that they
address@hidden    carry prominent notices stating who last changed them.
-
address@hidden This file contains a list of news features Gnus.  It is supposed 
to be
address@hidden included in 'gnus.texi'.  'GNUS-NEWS' is automatically generated 
from
address@hidden this file (see 'gnus-news.el').
-
address@hidden @bullet
-
address@hidden Supported Emacs versions
-The following Emacs versions are supported by No Gnus:
address@hidden @bullet
-
address@hidden Emacs 22 and up
address@hidden XEmacs 21.4
address@hidden XEmacs 21.5
address@hidden SXEmacs
-
address@hidden itemize
-
address@hidden Installation changes
-
address@hidden @bullet
address@hidden Upgrading from previous (stable) version if you have used No 
Gnus.
-
-If you have tried No Gnus (the unstable Gnus branch leading to this
-release) but went back to a stable version, be careful when upgrading
-to this version.  In particular, you will probably want to remove the
address@hidden/News/marks} directory (perhaps selectively), so that flags are
-read from your @file{~/.newsrc.eld} instead of from the stale marks
-file, where this release will store flags for nntp.  See a later entry
-for more information about nntp marks.  Note that downgrading isn't
-safe in general.
-
address@hidden Incompatibility when switching from Emacs 23 to Emacs 22
-In Emacs 23, Gnus uses Emacs's new internal coding system @code{utf-8-emacs}
-for saving articles drafts and @file{~/.newsrc.eld}.  These files may not
-be read correctly in Emacs 22 and below.  If you want to use Gnus across
-different Emacs versions, you may set @code{mm-auto-save-coding-system}
-to @code{emacs-mule}.
address@hidden FIXME: Untested.  (Or did anyone test it?)
address@hidden Cf. 
http://thread.gmane.org/gmane.emacs.gnus.general/66251/focus=66344
-
address@hidden Lisp files are now installed in @file{.../site-lisp/gnus/} by 
default.
-It defaulted to @file{.../site-lisp/} formerly.  In addition to this,
-the new installer issues a warning if other Gnus installations which
-will shadow the latest one are detected.  You can then remove those
-shadows manually or remove them using @code{make
-remove-installed-shadows}.
-
address@hidden The installation directory's name is allowed to have spaces 
and/or tabs.
address@hidden itemize
-
address@hidden New packages and libraries within Gnus
-
address@hidden @bullet
-
address@hidden New version of @code{nnimap}
-
address@hidden has been reimplemented in a mostly-compatible way.  See
-the Gnus manual for a description of the new interface.  In
-particular, @code{nnimap-inbox} and the client side split method has
-changed.
-
address@hidden Gnus includes the Emacs Lisp @acronym{SASL} library.
-
-This provides a clean @acronym{API} to @acronym{SASL} mechanisms from
-within Emacs.  The user visible aspects of this, compared to the earlier
-situation, include support for @address@hidden and
address@hidden   @xref{Top, ,Emacs SASL, sasl, Emacs SASL}.
-
address@hidden ManageSieve connections uses the @acronym{SASL} library by 
default.
-
-The primary change this brings is support for @acronym{DIGEST-MD5} and
address@hidden, when the server supports it.
-
address@hidden Gnus includes a password cache mechanism in password.el.
-
-It is enabled by default (see @code{password-cache}), with a short
-timeout of 16 seconds (see @code{password-cache-expiry}).  If
address@hidden is used as the @acronym{PGP} back end, the @acronym{PGP}
-passphrase is managed by this mechanism.  Passwords for ManageSieve
-connections are managed by this mechanism, after querying the user
-about whether to do so.
-
address@hidden Using EasyPG with Gnus
-When EasyPG, is available, Gnus will use it instead of @acronym{PGG}.
-EasyPG is an Emacs user interface to GNU Privacy Guard.  @xref{Top,
-,EasyPG Assistant user's manual, epa, EasyPG Assistant user's manual}.
-EasyPG is included in Emacs 23 and available separately as well.
address@hidden itemize
-
address@hidden Changes in group mode
address@hidden ************************
-
address@hidden @bullet
-
address@hidden
-Symbols like @code{gcc-self} now have the same precedence rules in
address@hidden as other ``real'' variables: The last match
-wins instead of the first match.
-
address@hidden
-Old intermediate incoming mail files (@file{Incoming*}) are deleted
-after a couple of days, not immediately.  @xref{Mail Source
-Customization}.
-(New in Gnus 5.10.10 / No Gnus 0.8)
address@hidden This entry is also present in the node "Oort Gnus".
-
address@hidden itemize
-
address@hidden Changes in summary and article mode
-
address@hidden @bullet
-
address@hidden There's now only one variable that determines how @acronym{HTML}
-is rendered: @code{mm-text-html-renderer}.
-
address@hidden Gnus now supports sticky article buffers.  Those are article 
buffers
-that are not reused when you select another article.  @xref{Sticky
-Articles}.
-
address@hidden @item Bookmarks
address@hidden FIXME: To be added
-
address@hidden Gnus can selectively display @samp{text/html} articles
-with a WWW browser with @kbd{K H}.  @xref{MIME Commands}.
-
address@hidden gnus-registry-marks
address@hidden FIXME: To be added
-
address@hidden International host names (@acronym{IDNA}) can now be decoded
-inside article bodies using @kbd{W i}
-(@code{gnus-summary-idna-message}).  This requires that GNU Libidn
-(@url{https://www.gnu.org/software/libidn/}) has been installed.
address@hidden FIXME: Also mention @code{message-use-idna}?
-
address@hidden The address@hidden group names handling has been much
-improved.  The back ends that fully support address@hidden group
-names are now @code{nntp}, @code{nnml}, and @code{nnrss}.  Also the
-agent, the cache, and the marks features work with those back ends.
address@hidden Group Names}.
-
address@hidden Gnus now displays @acronym{DNS} master files sent as text/dns
-using dns-mode.
-
address@hidden Gnus supports new limiting commands in the Summary buffer:
address@hidden/ r} (@code{gnus-summary-limit-to-replied}) and @kbd{/ R}
-(@code{gnus-summary-limit-to-recipient}).  @xref{Limiting}.
-
address@hidden You can now fetch all ticked articles from the server using
address@hidden t} (@code{gnus-summary-insert-ticked-articles}).  @xref{Summary
-Generation Commands}.
-
address@hidden Gnus supports a new sort command in the Summary buffer:
address@hidden C-s C-t} (@code{gnus-summary-sort-by-recipient}).  @xref{Summary
-Sorting}.
-
address@hidden @acronym{S/MIME} now features @acronym{LDAP} user certificate 
searches.
-You need to configure the server in @code{smime-ldap-host-list}.
-
address@hidden URLs inside address@hidden headers are retrieved and imported
-to your PGP key ring when you click on them.
-
address@hidden
-Picons can be displayed right from the textual address, see
address@hidden  @xref{Picons}.
-
address@hidden @acronym{ANSI} @acronym{SGR} control sequences can be transformed
-using @kbd{W A}.
-
address@hidden sequences are used in some Chinese hierarchies for
-highlighting articles (@code{gnus-article-treat-ansi-sequences}).
-
address@hidden Gnus now MIME decodes articles even when they lack 
"MIME-Version" header.
-This changes the default of @code{gnus-article-loose-mime}.
-
address@hidden @code{gnus-decay-scores} can be a regexp matching score files.
-For example, set it to @samp{\\.ADAPT\\'} and only adaptive score files
-will be decayed.  @xref{Score Decays}.
-
address@hidden Strings prefixing to the @code{To} and @code{Newsgroup} headers 
in
-summary lines when using @code{gnus-ignored-from-addresses} can be
-customized with @code{gnus-summary-to-prefix} and
address@hidden  @xref{To From Newsgroups}.
-
address@hidden You can replace @acronym{MIME} parts with external bodies.
-See @code{gnus-mime-replace-part} and @code{gnus-article-replace-part}.
address@hidden Commands}, @ref{Using MIME}.
-
address@hidden
-The option @code{mm-fill-flowed} can be used to disable treatment of
-format=flowed messages.  Also, flowed text is disabled when sending
-inline @acronym{PGP} signed messages.  @xref{Flowed text, ,Flowed text,
-emacs-mime, The Emacs MIME Manual}.  (New in Gnus 5.10.7)
address@hidden This entry is also present in the node "Oort Gnus".
-
address@hidden Now the new command @kbd{S W}
-(@code{gnus-article-wide-reply-with-original}) for a wide reply in the
-article buffer yanks a text that is in the active region, if it is set,
-as well as the @kbd{R} (@code{gnus-article-reply-with-original}) command.
-Note that the @kbd{R} command in the article buffer no longer accepts a
-prefix argument, which was used to make it do a wide reply.
address@hidden Keymap}.
-
address@hidden The new command @kbd{C-h b}
-(@code{gnus-article-describe-bindings}) used in the article buffer now
-shows not only the article commands but also the real summary commands
-that are accessible from the article buffer.
-
address@hidden itemize
-
address@hidden Changes in Message mode
-
address@hidden @bullet
address@hidden Gnus now defaults to saving all outgoing messages in per-month
-nnfolder archives.
-
address@hidden Gnus now supports the ``hashcash'' client puzzle anti-spam 
mechanism.
-Use @code{(setq message-generate-hashcash t)} to enable.
address@hidden
-
address@hidden You can now drag and drop attachments to the Message buffer.
-See @code{mml-dnd-protocol-alist} and @code{mml-dnd-attach-options}.
address@hidden, ,MIME, message, Message Manual}.
-
address@hidden The option @code{message-yank-empty-prefix} now controls how
-empty lines are prefixed in cited text.  @xref{Insertion Variables,
-,Insertion Variables, message, Message Manual}.
-
address@hidden Gnus uses narrowing to hide headers in Message buffers.
-The @code{References} header is hidden by default.  To make all
-headers visible, use @code{(setq message-hidden-headers nil)}.
address@hidden Headers, ,Message Headers, message, Message Manual}.
-
address@hidden You can highlight different levels of citations like in the
-article buffer.  See @code{gnus-message-highlight-citation}.
-
address@hidden @code{auto-fill-mode} is enabled by default in Message mode.
-See @code{message-fill-column}.  @xref{Various Message Variables, ,
-Message Headers, message, Message Manual}.
-
address@hidden You can now store signature files in a special directory
-named @code{message-signature-directory}.
-
address@hidden The option @code{message-citation-line-format} controls the 
format
-of the "Whomever writes:" line.  You need to set
address@hidden to
address@hidden as well.
address@hidden itemize
-
address@hidden Changes in Browse Server mode
-
address@hidden @bullet
address@hidden Gnus' sophisticated subscription methods are now available in
-Browse Server buffers as well using the variable
address@hidden
-
address@hidden itemize
-
-
address@hidden Changes in back ends
-
address@hidden @bullet
address@hidden The nntp back end stores article marks in @file{~/News/marks}.
-
-The directory can be changed using the (customizable) variable
address@hidden, and marks can be disabled using the
-(back end) variable @code{nntp-marks-is-evil}.  The advantage of this
-is that you can copy @file{~/News/marks} (using rsync, scp or
-whatever) to another Gnus installation, and it will realize what
-articles you have read and marked.  The data in @file{~/News/marks}
-has priority over the same data in @file{~/.newsrc.eld}.
-
address@hidden
-You can import and export your @acronym{RSS} subscriptions from
address@hidden files.  @xref{RSS}.
-
address@hidden @acronym{IMAP} identity (@acronym{RFC} 2971) is supported.
-
-By default, Gnus does not send any information about itself, but you can
-customize it using the variable @code{nnimap-id}.
-
address@hidden The @code{nnrss} back end now supports multilingual text.
address@hidden group names for the @code{nnrss} groups are also
-supported.  @xref{RSS}.
-
address@hidden Retrieving mail with @acronym{POP3} is supported over 
@acronym{SSL}/@acronym{TLS} and with StartTLS.
-
address@hidden The nnml back end allows other compression programs beside 
@file{gzip}
-for compressed message files.  @xref{Mail Spool}.
-
address@hidden The nnml back end supports group compaction.
-
-This feature, accessible via the functions
address@hidden (@kbd{G z} in the group buffer) and
address@hidden (@kbd{z} in the server buffer)
-renumbers all articles in a group, starting from 1 and removing gaps.
-As a consequence, you get a correct total article count (until
-messages are deleted again).
-
address@hidden @item nnmairix.el
address@hidden FIXME
-
address@hidden @item nnir.el
address@hidden FIXME
-
address@hidden itemize
-
address@hidden Appearance
address@hidden Maybe it's not worth to separate this from "Miscellaneous"?
-
address@hidden @bullet
-
address@hidden The tool bar has been updated to use GNOME icons.
-You can also customize the tool bars: @kbd{M-x customize-apropos @key{RET}
--tool-bar$} should get you started.  (Only for Emacs, not in XEmacs.)
address@hidden FIXME: Document this in the manual
-
address@hidden The tool bar icons are now (de)activated correctly
-in the group buffer, see the variable @code{gnus-group-update-tool-bar}.
-Its default value depends on your Emacs version.
address@hidden FIXME: Document this in the manual
-
address@hidden You can change the location of XEmacs's toolbars in Gnus buffers.
-See @code{gnus-use-toolbar} and @code{message-use-toolbar}.
-
address@hidden itemize
-
address@hidden Miscellaneous changes
-
address@hidden @bullet
address@hidden Having edited the select-method for the foreign server in the
-server buffer is immediately reflected to the subscription of the groups
-which use the server in question.  For instance, if you change
address@hidden into @samp{bar.example.com} from
address@hidden, Gnus will connect to the news host by way of the
-intermediate host @samp{bar.example.com} from next time.
-
address@hidden The @file{all.SCORE} file can be edited from the group buffer
-using @kbd{W e}.
-
address@hidden You can set 
@code{gnus-mark-copied-or-moved-articles-as-expirable}
-to a address@hidden value so that articles that have been read may be
-marked as expirable automatically when copying or moving them to a group
-that has auto-expire turned on.  The default is @code{nil} and copying
-and moving of articles behave as before; i.e., the expirable marks will
-be unchanged except that the marks will be removed when copying or
-moving articles to a group that has not turned auto-expire on.
address@hidden Mail}.
-
address@hidden NoCeM support has been removed.
-
address@hidden Carpal mode has been removed.
-
address@hidden itemize
-
address@hidden itemize
-
address@hidden gnus-news.texi ends here.
diff --git a/doc/misc/gnus-overrides.texi b/doc/misc/gnus-overrides.texi
deleted file mode 100644
index e69de29..0000000
diff --git a/doc/misc/gnus.texi b/doc/misc/gnus.texi
index fb9113f..b9c91a0 100644
--- a/doc/misc/gnus.texi
+++ b/doc/misc/gnus.texi
@@ -1,7 +1,5 @@
 \input texinfo
 
address@hidden gnus-overrides.texi
-
 @setfilename ../../info/gnus.info
 @settitle Gnus Manual
 @include docstyle.texi
@@ -10,7 +8,7 @@
 @syncodeindex pg cp
 
 @copying
-Copyright @copyright{} 1995--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1995--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -9418,7 +9416,7 @@ function must return @code{mid}, @code{mail}, 
@code{invalid} or
 @item gnus-button-mid-or-mail-heuristic
 @findex gnus-button-mid-or-mail-heuristic
 Function that guesses whether its argument is a message ID or a mail
-address.  Returns @code{mid} if it's a message IDs, @code{mail} if
+address.  Returns @code{mid} if it's a message ID, @code{mail} if
 it's a mail address, @code{ask} if unsure and @code{invalid} if the
 string is invalid.
 
@@ -9679,7 +9677,7 @@ Each article is divided into two parts---the head and the 
body.  The
 body can be divided into a signature part and a text part.  The variable
 that says what is to be considered a signature is
 @code{gnus-signature-separator}.  This is normally the standard
address@hidden $} as mandated by son-of-RFC 1036.  However, many people use
address@hidden $} as mandated by RFC 5536.  However, many people use
 non-standard signature separators, so this variable can also be a list
 of regular expressions to be tested, one by one.  (Searches are done
 from the end of the body towards the beginning.)  One likely value is:
@@ -15991,8 +15989,9 @@ Mailers and list servers are notorious for doing all 
sorts of really,
 really stupid things with mail.  ``Hey, RFC 822 doesn't explicitly
 prohibit us from adding the string @code{wE aRe ElItE!!!!!1!!} to the
 end of all lines passing through our server, so let's do that!!!!1!''
-Yes, but RFC 822 wasn't designed to be read by morons.  Things that were
-considered to be self-evident were not discussed.  So.  Here we are.
+Yes, but RFC 822 and its successors weren't designed to be read by
+morons.  Things that were considered to be self-evident were not
+discussed.  So.  Here we are.
 
 Case in point:  The German version of Microsoft Exchange adds @samp{AW:
 } to the subjects of replies instead of @samp{Re: }.  I could pretend to
@@ -17374,7 +17373,7 @@ Announcement messages from LANL Gov Announce.
 
 @cindex forwarded messages
 @item rfc822-forward
-A message forwarded according to RFC822.
+A message forwarded according to RFC 822 or its successors.
 
 @item outlook
 The Outlook mail box.
@@ -21468,6 +21467,18 @@ The prefix to remove from each file name returned by 
notmuch in order
 to get a group name (albeit with @samp{/} instead of @samp{.}).  This
 is a regular expression.
 
address@hidden nnir-notmuch-filter-group-names-function
+A function used to transform the names of groups being searched in,
+for use as a ``path:'' search keyword for notmuch.  If nil, the
+default, ``path:'' keywords are not used.  Otherwise, this should be a
+callable which accepts a single group name and returns a transformed
+name as notmuch expects to see it.  In many mail backends, for
+instance, dots in group names must be converted to forward slashes: to
+achieve this, set this option to
address@hidden
+(lambda (g) (replace-regexp-in-string "\\." "/" g))
address@hidden example
+
 @end table
 
 
@@ -26709,18 +26720,20 @@ with, of course.
 
 @table @strong
 
address@hidden RFC (2)822
address@hidden RFC 822
 @cindex RFC 822
 @cindex RFC 2822
-There are no known breaches of this standard.
address@hidden RFC 5322
+There are no known breaches of this standard or its successors
+(currently RFCs 2822 and 5322).
 
 @item RFC 1036
 @cindex RFC 1036
-There are no known breaches of this standard, either.
+There are no known breaches of this (now-obsolete) standard, either.
 
address@hidden Son-of-RFC 1036
address@hidden Son-of-RFC 1036
-We do have some breaches to this one.
address@hidden RFC 5536
address@hidden RFC 5536
+We do have some breaches of this standard, the successor of RFC 1036.
 
 @table @emph
 
@@ -26735,10 +26748,9 @@ it wasn't for the @code{X-Newsreader} header.
 
 @item USEFOR
 @cindex USEFOR
-USEFOR is an IETF working group writing a successor to RFC 1036, based
-on Son-of-RFC 1036.  They have produced a number of drafts proposing
-various changes to the format of news articles.  The Gnus towers will
-look into implementing the changes when the draft is accepted as an RFC.
+USEFOR was an IETF working group that produced Internet RFCs 5536 and 5537.
+The Gnus towers will look into implementing the changes embodied by these
+standards.
 
 @item MIME---RFC 2045--2049 etc
 @cindex @acronym{MIME}
@@ -27204,6 +27216,8 @@ actually are people who are using Gnus.  Who'd'a thunk 
it!
 * Ma Gnus::                     Celebrating 25 years of Gnus.
 @end menu
 
+For summaries of more recent changes, see the normal Emacs @file{NEWS} files.
+
 These lists are, of course, just @emph{short} overviews of the
 @emph{most} important new features.  No, really.  There are tons more.
 Yes, we have feeping creaturism in full effect.
@@ -28574,7 +28588,358 @@ A new command which starts Gnus offline in slave mode.
 New features in No Gnus:
 @c FIXME: Gnus 5.12?
 
address@hidden gnus-news.texi
address@hidden @bullet
+
address@hidden Supported Emacs versions
+The following Emacs versions are supported by No Gnus:
address@hidden @bullet
+
address@hidden Emacs 22 and up
address@hidden XEmacs 21.4
address@hidden XEmacs 21.5
address@hidden SXEmacs
+
address@hidden itemize
+
address@hidden Installation changes
+
address@hidden @bullet
address@hidden Upgrading from previous (stable) version if you have used No 
Gnus.
+
+If you have tried No Gnus (the unstable Gnus branch leading to this
+release) but went back to a stable version, be careful when upgrading
+to this version.  In particular, you will probably want to remove the
address@hidden/News/marks} directory (perhaps selectively), so that flags are
+read from your @file{~/.newsrc.eld} instead of from the stale marks
+file, where this release will store flags for nntp.  See a later entry
+for more information about nntp marks.  Note that downgrading isn't
+safe in general.
+
address@hidden Incompatibility when switching from Emacs 23 to Emacs 22
+In Emacs 23, Gnus uses Emacs's new internal coding system @code{utf-8-emacs}
+for saving articles drafts and @file{~/.newsrc.eld}.  These files may not
+be read correctly in Emacs 22 and below.  If you want to use Gnus across
+different Emacs versions, you may set @code{mm-auto-save-coding-system}
+to @code{emacs-mule}.
address@hidden FIXME: Untested.  (Or did anyone test it?)
address@hidden Cf. 
http://thread.gmane.org/gmane.emacs.gnus.general/66251/focus=66344
+
address@hidden Lisp files are now installed in @file{.../site-lisp/gnus/} by 
default.
+It defaulted to @file{.../site-lisp/} formerly.  In addition to this,
+the new installer issues a warning if other Gnus installations which
+will shadow the latest one are detected.  You can then remove those
+shadows manually or remove them using @code{make
+remove-installed-shadows}.
+
address@hidden The installation directory's name is allowed to have spaces 
and/or tabs.
address@hidden itemize
+
address@hidden New packages and libraries within Gnus
+
address@hidden @bullet
+
address@hidden New version of @code{nnimap}
+
address@hidden has been reimplemented in a mostly-compatible way.  See
+the Gnus manual for a description of the new interface.  In
+particular, @code{nnimap-inbox} and the client side split method has
+changed.
+
address@hidden Gnus includes the Emacs Lisp @acronym{SASL} library.
+
+This provides a clean @acronym{API} to @acronym{SASL} mechanisms from
+within Emacs.  The user visible aspects of this, compared to the earlier
+situation, include support for @address@hidden and
address@hidden   @xref{Top, ,Emacs SASL, sasl, Emacs SASL}.
+
address@hidden ManageSieve connections uses the @acronym{SASL} library by 
default.
+
+The primary change this brings is support for @acronym{DIGEST-MD5} and
address@hidden, when the server supports it.
+
address@hidden Gnus includes a password cache mechanism in password.el.
+
+It is enabled by default (see @code{password-cache}), with a short
+timeout of 16 seconds (see @code{password-cache-expiry}).  If
address@hidden is used as the @acronym{PGP} back end, the @acronym{PGP}
+passphrase is managed by this mechanism.  Passwords for ManageSieve
+connections are managed by this mechanism, after querying the user
+about whether to do so.
+
address@hidden Using EasyPG with Gnus
+When EasyPG, is available, Gnus will use it instead of @acronym{PGG}.
+EasyPG is an Emacs user interface to GNU Privacy Guard.  @xref{Top,
+,EasyPG Assistant user's manual, epa, EasyPG Assistant user's manual}.
+EasyPG is included in Emacs 23 and available separately as well.
address@hidden itemize
+
address@hidden Changes in group mode
address@hidden ************************
+
address@hidden @bullet
+
address@hidden
+Symbols like @code{gcc-self} now have the same precedence rules in
address@hidden as other ``real'' variables: The last match
+wins instead of the first match.
+
address@hidden
+Old intermediate incoming mail files (@file{Incoming*}) are deleted
+after a couple of days, not immediately.  @xref{Mail Source
+Customization}.
+(New in Gnus 5.10.10 / No Gnus 0.8)
address@hidden This entry is also present in the node "Oort Gnus".
+
address@hidden itemize
+
address@hidden Changes in summary and article mode
+
address@hidden @bullet
+
address@hidden There's now only one variable that determines how @acronym{HTML}
+is rendered: @code{mm-text-html-renderer}.
+
address@hidden Gnus now supports sticky article buffers.  Those are article 
buffers
+that are not reused when you select another article.  @xref{Sticky
+Articles}.
+
address@hidden @item Bookmarks
address@hidden FIXME: To be added
+
address@hidden Gnus can selectively display @samp{text/html} articles
+with a WWW browser with @kbd{K H}.  @xref{MIME Commands}.
+
address@hidden gnus-registry-marks
address@hidden FIXME: To be added
+
address@hidden International host names (@acronym{IDNA}) can now be decoded
+inside article bodies using @kbd{W i}
+(@code{gnus-summary-idna-message}).  This requires that GNU Libidn
+(@url{https://www.gnu.org/software/libidn/}) has been installed.
address@hidden FIXME: Also mention @code{message-use-idna}?
+
address@hidden The address@hidden group names handling has been much
+improved.  The back ends that fully support address@hidden group
+names are now @code{nntp}, @code{nnml}, and @code{nnrss}.  Also the
+agent, the cache, and the marks features work with those back ends.
address@hidden Group Names}.
+
address@hidden Gnus now displays @acronym{DNS} master files sent as text/dns
+using dns-mode.
+
address@hidden Gnus supports new limiting commands in the Summary buffer:
address@hidden/ r} (@code{gnus-summary-limit-to-replied}) and @kbd{/ R}
+(@code{gnus-summary-limit-to-recipient}).  @xref{Limiting}.
+
address@hidden You can now fetch all ticked articles from the server using
address@hidden t} (@code{gnus-summary-insert-ticked-articles}).  @xref{Summary
+Generation Commands}.
+
address@hidden Gnus supports a new sort command in the Summary buffer:
address@hidden C-s C-t} (@code{gnus-summary-sort-by-recipient}).  @xref{Summary
+Sorting}.
+
address@hidden @acronym{S/MIME} now features @acronym{LDAP} user certificate 
searches.
+You need to configure the server in @code{smime-ldap-host-list}.
+
address@hidden URLs inside address@hidden headers are retrieved and imported
+to your PGP key ring when you click on them.
+
address@hidden
+Picons can be displayed right from the textual address, see
address@hidden  @xref{Picons}.
+
address@hidden @acronym{ANSI} @acronym{SGR} control sequences can be transformed
+using @kbd{W A}.
+
address@hidden sequences are used in some Chinese hierarchies for
+highlighting articles (@code{gnus-article-treat-ansi-sequences}).
+
address@hidden Gnus now MIME decodes articles even when they lack 
"MIME-Version" header.
+This changes the default of @code{gnus-article-loose-mime}.
+
address@hidden @code{gnus-decay-scores} can be a regexp matching score files.
+For example, set it to @samp{\\.ADAPT\\'} and only adaptive score files
+will be decayed.  @xref{Score Decays}.
+
address@hidden Strings prefixing to the @code{To} and @code{Newsgroup} headers 
in
+summary lines when using @code{gnus-ignored-from-addresses} can be
+customized with @code{gnus-summary-to-prefix} and
address@hidden  @xref{To From Newsgroups}.
+
address@hidden You can replace @acronym{MIME} parts with external bodies.
+See @code{gnus-mime-replace-part} and @code{gnus-article-replace-part}.
address@hidden Commands}, @ref{Using MIME}.
+
address@hidden
+The option @code{mm-fill-flowed} can be used to disable treatment of
+format=flowed messages.  Also, flowed text is disabled when sending
+inline @acronym{PGP} signed messages.  @xref{Flowed text, ,Flowed text,
+emacs-mime, The Emacs MIME Manual}.  (New in Gnus 5.10.7)
address@hidden This entry is also present in the node "Oort Gnus".
+
address@hidden Now the new command @kbd{S W}
+(@code{gnus-article-wide-reply-with-original}) for a wide reply in the
+article buffer yanks a text that is in the active region, if it is set,
+as well as the @kbd{R} (@code{gnus-article-reply-with-original}) command.
+Note that the @kbd{R} command in the article buffer no longer accepts a
+prefix argument, which was used to make it do a wide reply.
address@hidden Keymap}.
+
address@hidden The new command @kbd{C-h b}
+(@code{gnus-article-describe-bindings}) used in the article buffer now
+shows not only the article commands but also the real summary commands
+that are accessible from the article buffer.
+
address@hidden itemize
+
address@hidden Changes in Message mode
+
address@hidden @bullet
address@hidden Gnus now defaults to saving all outgoing messages in per-month
+nnfolder archives.
+
address@hidden Gnus now supports the ``hashcash'' client puzzle anti-spam 
mechanism.
+Use @code{(setq message-generate-hashcash t)} to enable.
address@hidden
+
address@hidden You can now drag and drop attachments to the Message buffer.
+See @code{mml-dnd-protocol-alist} and @code{mml-dnd-attach-options}.
address@hidden, ,MIME, message, Message Manual}.
+
address@hidden The option @code{message-yank-empty-prefix} now controls how
+empty lines are prefixed in cited text.  @xref{Insertion Variables,
+,Insertion Variables, message, Message Manual}.
+
address@hidden Gnus uses narrowing to hide headers in Message buffers.
+The @code{References} header is hidden by default.  To make all
+headers visible, use @code{(setq message-hidden-headers nil)}.
address@hidden Headers, ,Message Headers, message, Message Manual}.
+
address@hidden You can highlight different levels of citations like in the
+article buffer.  See @code{gnus-message-highlight-citation}.
+
address@hidden @code{auto-fill-mode} is enabled by default in Message mode.
+See @code{message-fill-column}.  @xref{Various Message Variables, ,
+Message Headers, message, Message Manual}.
+
address@hidden You can now store signature files in a special directory
+named @code{message-signature-directory}.
+
address@hidden The option @code{message-citation-line-format} controls the 
format
+of the "Whomever writes:" line.  You need to set
address@hidden to
address@hidden as well.
address@hidden itemize
+
address@hidden Changes in Browse Server mode
+
address@hidden @bullet
address@hidden Gnus' sophisticated subscription methods are now available in
+Browse Server buffers as well using the variable
address@hidden
+
address@hidden itemize
+
+
address@hidden Changes in back ends
+
address@hidden @bullet
address@hidden The nntp back end stores article marks in @file{~/News/marks}.
+
+The directory can be changed using the (customizable) variable
address@hidden, and marks can be disabled using the
+(back end) variable @code{nntp-marks-is-evil}.  The advantage of this
+is that you can copy @file{~/News/marks} (using rsync, scp or
+whatever) to another Gnus installation, and it will realize what
+articles you have read and marked.  The data in @file{~/News/marks}
+has priority over the same data in @file{~/.newsrc.eld}.
+
address@hidden
+You can import and export your @acronym{RSS} subscriptions from
address@hidden files.  @xref{RSS}.
+
address@hidden @acronym{IMAP} identity (@acronym{RFC} 2971) is supported.
+
+By default, Gnus does not send any information about itself, but you can
+customize it using the variable @code{nnimap-id}.
+
address@hidden The @code{nnrss} back end now supports multilingual text.
address@hidden group names for the @code{nnrss} groups are also
+supported.  @xref{RSS}.
+
address@hidden Retrieving mail with @acronym{POP3} is supported over 
@acronym{SSL}/@acronym{TLS} and with StartTLS.
+
address@hidden The nnml back end allows other compression programs beside 
@file{gzip}
+for compressed message files.  @xref{Mail Spool}.
+
address@hidden The nnml back end supports group compaction.
+
+This feature, accessible via the functions
address@hidden (@kbd{G z} in the group buffer) and
address@hidden (@kbd{z} in the server buffer)
+renumbers all articles in a group, starting from 1 and removing gaps.
+As a consequence, you get a correct total article count (until
+messages are deleted again).
+
address@hidden @item nnmairix.el
address@hidden FIXME
+
address@hidden @item nnir.el
address@hidden FIXME
+
address@hidden itemize
+
address@hidden Appearance
address@hidden Maybe it's not worth to separate this from "Miscellaneous"?
+
address@hidden @bullet
+
address@hidden The tool bar has been updated to use GNOME icons.
+You can also customize the tool bars: @kbd{M-x customize-apropos @key{RET}
+-tool-bar$} should get you started.  (Only for Emacs, not in XEmacs.)
address@hidden FIXME: Document this in the manual
+
address@hidden The tool bar icons are now (de)activated correctly
+in the group buffer, see the variable @code{gnus-group-update-tool-bar}.
+Its default value depends on your Emacs version.
address@hidden FIXME: Document this in the manual
+
address@hidden You can change the location of XEmacs's toolbars in Gnus buffers.
+See @code{gnus-use-toolbar} and @code{message-use-toolbar}.
+
address@hidden itemize
+
address@hidden Miscellaneous changes
+
address@hidden @bullet
address@hidden Having edited the select-method for the foreign server in the
+server buffer is immediately reflected to the subscription of the groups
+which use the server in question.  For instance, if you change
address@hidden into @samp{bar.example.com} from
address@hidden, Gnus will connect to the news host by way of the
+intermediate host @samp{bar.example.com} from next time.
+
address@hidden The @file{all.SCORE} file can be edited from the group buffer
+using @kbd{W e}.
+
address@hidden You can set 
@code{gnus-mark-copied-or-moved-articles-as-expirable}
+to a address@hidden value so that articles that have been read may be
+marked as expirable automatically when copying or moving them to a group
+that has auto-expire turned on.  The default is @code{nil} and copying
+and moving of articles behave as before; i.e., the expirable marks will
+be unchanged except that the marks will be removed when copying or
+moving articles to a group that has not turned auto-expire on.
address@hidden Mail}.
+
address@hidden NoCeM support has been removed.
+
address@hidden Carpal mode has been removed.
+
address@hidden itemize
+
address@hidden itemize
+
 
 @node Ma Gnus
 @subsubsection Ma Gnus
@@ -29517,7 +29882,8 @@ header         = <text> eol
 @end example
 
 @cindex BNF
-(The version of BNF used here is the one used in RFC822.)
+(The version of extended BNF used here is ABNF, the one used in Internet RFCs.
+See RFC 5234.)
 
 If the return value is @code{nov}, the data buffer should contain
 @dfn{network overview database} lines.  These are basically fields
@@ -30315,7 +30681,7 @@ almost suspect that the author looked at the 
@acronym{NOV} specification and
 just shamelessly @emph{stole} the entire thing, and one would be right.
 
 @dfn{Header} is a severely overloaded term.  ``Header'' is used in
-RFC 1036 to talk about lines in the head of an article (e.g.,
+RFC 5536 to talk about lines in the head of an article (e.g.,
 @code{From}).  It is used by many people as a synonym for
 ``head''---``the header and the body''.  (That should be avoided, in my
 opinion.)  And Gnus uses a format internally that it calls ``header'',
diff --git a/doc/misc/htmlfontify.texi b/doc/misc/htmlfontify.texi
index c4cf7da..f1da878 100644
--- a/doc/misc/htmlfontify.texi
+++ b/doc/misc/htmlfontify.texi
@@ -10,7 +10,7 @@
 This manual documents Htmlfontify, a source code -> crosslinked +
 formatted + syntax colorized html transformer.
 
-Copyright @copyright{} 2002-2003, 2013-2018 Free Software Foundation,
+Copyright @copyright{} 2002-2003, 2013-2019 Free Software Foundation,
 Inc.
 
 @quotation
diff --git a/doc/misc/idlwave.texi b/doc/misc/idlwave.texi
index ca4d89c..fd48bc0 100644
--- a/doc/misc/idlwave.texi
+++ b/doc/misc/idlwave.texi
@@ -23,7 +23,7 @@ Emacs, and interacting with an IDL shell run as a subprocess.
 This is edition @value{EDITION} of the IDLWAVE User Manual for IDLWAVE
 @value{VERSION}.
 
-Copyright @copyright{} 1999--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1999--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/ido.texi b/doc/misc/ido.texi
index 098b28e..bb7e723 100644
--- a/doc/misc/ido.texi
+++ b/doc/misc/ido.texi
@@ -7,7 +7,7 @@
 @copying
 This file documents the Ido package for GNU Emacs.
 
-Copyright @copyright{} 2013-2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2013-2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/info.texi b/doc/misc/info.texi
index e277b13..e69779a 100644
--- a/doc/misc/info.texi
+++ b/doc/misc/info.texi
@@ -15,7 +15,7 @@
 This file describes how to use Info, the menu-driven GNU
 documentation system.
 
-Copyright @copyright{} 1989, 1992, 1996--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1989, 1992, 1996--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/mairix-el.texi b/doc/misc/mairix-el.texi
index 8d620c7..c45ed11 100644
--- a/doc/misc/mairix-el.texi
+++ b/doc/misc/mairix-el.texi
@@ -5,7 +5,7 @@
 @include docstyle.texi
 
 @copying
-Copyright @copyright{} 2008--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2008--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/message.texi b/doc/misc/message.texi
index 61eca75..7089bb5 100644
--- a/doc/misc/message.texi
+++ b/doc/misc/message.texi
@@ -1,7 +1,5 @@
 \input texinfo                  @c -*-texinfo-*-
 
address@hidden gnus-overrides.texi
-
 @setfilename ../../info/message.info
 @settitle Message Manual
 @include docstyle.texi
@@ -11,7 +9,7 @@
 @copying
 This file documents Message, the Emacs message composition mode.
 
-Copyright @copyright{} 1996--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1996--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/mh-e.texi b/doc/misc/mh-e.texi
index 8545525..9907095 100644
--- a/doc/misc/mh-e.texi
+++ b/doc/misc/mh-e.texi
@@ -25,7 +25,7 @@
 This is version @address@hidden of @cite{The MH-E
 Manual}, last updated @value{UPDATED}.
 
-Copyright @copyright{} 1995, 2001--2003, 2005--2018 Free Software
+Copyright @copyright{} 1995, 2001--2003, 2005--2019 Free Software
 Foundation, Inc.
 
 @c This dual license has been agreed upon by the FSF.
diff --git a/doc/misc/newsticker.texi b/doc/misc/newsticker.texi
index ac29ced..5db3f43 100644
--- a/doc/misc/newsticker.texi
+++ b/doc/misc/newsticker.texi
@@ -15,7 +15,7 @@ This manual documents Newsticker, a feed reader for Emacs.  It
 corresponds to Emacs version @value{EMACSVER}.
 
 @noindent
-Copyright @copyright{} 2004--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2004--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/nxml-mode.texi b/doc/misc/nxml-mode.texi
index 32b873e..edab900 100644
--- a/doc/misc/nxml-mode.texi
+++ b/doc/misc/nxml-mode.texi
@@ -9,7 +9,7 @@
 This manual documents nXML mode, an Emacs major mode for editing
 XML with RELAX NG support.
 
-Copyright @copyright{} 2007--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2007--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/octave-mode.texi b/doc/misc/octave-mode.texi
index 927a15d..d409b90 100644
--- a/doc/misc/octave-mode.texi
+++ b/doc/misc/octave-mode.texi
@@ -6,7 +6,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 1996--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1996--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/org.texi b/doc/misc/org.texi
index 9ea78f5..7862713 100644
--- a/doc/misc/org.texi
+++ b/doc/misc/org.texi
@@ -260,7 +260,7 @@
 @copying
 This manual is for Org version @value{VERSION}.
 
-Copyright @copyright{} 2004--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2004--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -13789,7 +13789,7 @@ Copyright information is printed on the back of the 
title page.
 
   This is a short example of a complete Texinfo file, version 1.0.
 
-  Copyright \copy 2018 Free Software Foundation, Inc.
+  Copyright \copy 2019 Free Software Foundation, Inc.
 @end example
 
 @node Info directory file
@@ -14066,7 +14066,7 @@ This manual is for GNU Sample (version 
@address@hidden@address@hidden@address@hidden,
   This manual is for GNU Sample (version 
@address@hidden@address@hidden@address@hidden,
   @address@hidden@address@hidden@address@hidden), which is an example in the 
Texinfo documentation.
 
-  Copyright \copy 2018 Free Software Foundation, Inc.
+  Copyright \copy 2019 Free Software Foundation, Inc.
 
   #+BEGIN_QUOTE
   Permission is granted to copy, distribute and/or modify this
diff --git a/doc/misc/pcl-cvs.texi b/doc/misc/pcl-cvs.texi
index fe50154..3379783 100644
--- a/doc/misc/pcl-cvs.texi
+++ b/doc/misc/pcl-cvs.texi
@@ -7,7 +7,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 1991--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1991--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/pgg.texi b/doc/misc/pgg.texi
index e5fe2fa..2fac24a 100644
--- a/doc/misc/pgg.texi
+++ b/doc/misc/pgg.texi
@@ -1,7 +1,5 @@
 \input texinfo                  @c -*-texinfo-*-
 
address@hidden gnus-overrides.texi
-
 @setfilename ../../info/pgg.info
 
 @set VERSION 0.1
@@ -12,7 +10,7 @@
 This file describes PGG @value{VERSION}, an Emacs interface to various
 PGP implementations.
 
-Copyright @copyright{} 2001, 2003--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2001, 2003--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/rcirc.texi b/doc/misc/rcirc.texi
index 0287054..bbcd0ed 100644
--- a/doc/misc/rcirc.texi
+++ b/doc/misc/rcirc.texi
@@ -6,7 +6,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 2006--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2006--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/reftex.texi b/doc/misc/reftex.texi
index 4367d77..baa8de4 100644
--- a/doc/misc/reftex.texi
+++ b/doc/misc/reftex.texi
@@ -46,7 +46,7 @@ This manual documents @RefTeX{} (version @value{VERSION}), a 
package
 to do labels, references, citations and indices for LaTeX documents
 with Emacs.
 
-Copyright @copyright{} 1997--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1997--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/remember.texi b/doc/misc/remember.texi
index 8e42708..e692f14 100644
--- a/doc/misc/remember.texi
+++ b/doc/misc/remember.texi
@@ -9,7 +9,7 @@
 @copying
 This manual is for Remember Mode, version 2.0
 
-Copyright @copyright{} 2001, 2004--2005, 2007--2018
+Copyright @copyright{} 2001, 2004--2005, 2007--2019
 Free Software Foundation, Inc.
 
 @quotation
diff --git a/doc/misc/sasl.texi b/doc/misc/sasl.texi
index 00e25f4..1d31150 100644
--- a/doc/misc/sasl.texi
+++ b/doc/misc/sasl.texi
@@ -1,7 +1,5 @@
 \input texinfo                  @c -*-texinfo-*-
 
address@hidden gnus-overrides.texi
-
 @setfilename ../../info/sasl.info
 
 @set VERSION 0.2
@@ -11,7 +9,7 @@
 @copying
 This file describes the Emacs SASL library, version @value{VERSION}.
 
-Copyright @copyright{} 2000, 2004--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2000, 2004--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/sc.texi b/doc/misc/sc.texi
index 453ccf2..7d53c6d 100644
--- a/doc/misc/sc.texi
+++ b/doc/misc/sc.texi
@@ -15,7 +15,7 @@
 This document describes Supercite, an Emacs package for citing and
 attributing replies to mail and news messages.
 
-Copyright @copyright{} 1993, 2001--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1993, 2001--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -851,7 +851,8 @@ scanned.  Info key-value pairs are created for each header 
found.  Also,
 such useful information as the author's name and email address are
 extracted.  If the variable @code{sc-mail-warn-if-non-rfc822-p} is
 address@hidden, then Supercite will warn you if it finds a mail header
-that does not conform to RFC822.  This is rare and indicates a problem
+that does not conform to RFC 822 (or later).
+This is rare and indicates a problem
 either with your MUA or the original author's MUA, or some MTA (mail
 transport agent) along the way.
 
diff --git a/doc/misc/sem-user.texi b/doc/misc/sem-user.texi
index 8484a7b..3fe104a 100644
--- a/doc/misc/sem-user.texi
+++ b/doc/misc/sem-user.texi
@@ -1,5 +1,5 @@
 @c This is part of the Semantic manual.
address@hidden Copyright (C) 1999-2005, 2007, 2009-2018 Free Software 
Foundation,
address@hidden Copyright (C) 1999-2005, 2007, 2009-2019 Free Software 
Foundation,
 @c Inc.
 @c See file semantic.texi for copying conditions.
 
diff --git a/doc/misc/semantic.texi b/doc/misc/semantic.texi
index 8d4920c..34afcba 100644
--- a/doc/misc/semantic.texi
+++ b/doc/misc/semantic.texi
@@ -25,7 +25,7 @@
 @copying
 This manual documents the Semantic library and utilities.
 
-Copyright @copyright{} 1999--2005, 2007, 2009--2018 Free Software
+Copyright @copyright{} 1999--2005, 2007, 2009--2019 Free Software
 Foundation, Inc.
 
 @quotation
diff --git a/doc/misc/ses.texi b/doc/misc/ses.texi
index aa4fe81..f98a3b1 100644
--- a/doc/misc/ses.texi
+++ b/doc/misc/ses.texi
@@ -12,7 +12,7 @@
 @copying
 This file documents @acronym{SES}: the Simple Emacs Spreadsheet.
 
-Copyright @copyright{} 2002--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2002--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/sieve.texi b/doc/misc/sieve.texi
index cad3cd8..2d07b0a 100644
--- a/doc/misc/sieve.texi
+++ b/doc/misc/sieve.texi
@@ -1,7 +1,5 @@
 \input texinfo                  @c -*-texinfo-*-
 
address@hidden gnus-overrides.texi
-
 @setfilename ../../info/sieve.info
 @settitle Emacs Sieve Manual
 @include docstyle.texi
@@ -12,7 +10,7 @@
 @copying
 This file documents the Emacs Sieve package, for server-side mail filtering.
 
-Copyright @copyright{} 2001--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2001--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/smtpmail.texi b/doc/misc/smtpmail.texi
index c338705..365f557 100644
--- a/doc/misc/smtpmail.texi
+++ b/doc/misc/smtpmail.texi
@@ -4,7 +4,7 @@
 @include docstyle.texi
 @syncodeindex vr fn
 @copying
-Copyright @copyright{} 2003--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2003--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/speedbar.texi b/doc/misc/speedbar.texi
index d67c4e6..503f9cd 100644
--- a/doc/misc/speedbar.texi
+++ b/doc/misc/speedbar.texi
@@ -5,7 +5,7 @@
 @syncodeindex fn cp
 
 @copying
-Copyright @copyright{} 1999--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1999--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/srecode.texi b/doc/misc/srecode.texi
index 7d8416e..9df11b4 100644
--- a/doc/misc/srecode.texi
+++ b/doc/misc/srecode.texi
@@ -16,7 +16,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 2007--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2007--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index 5840aff..667292a 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,12 +3,9 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2018-09-21.20}
+\def\texinfoversion{2019-03-23.11}
 %
-% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
-% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-% 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018
-% Free Software Foundation, Inc.
+% Copyright 1985, 1986, 1988, 1990-2019 Free Software Foundation, Inc.
 %
 % This texinfo.tex file is free software: you can redistribute it and/or
 % modify it under the terms of the GNU General Public License as
@@ -244,17 +241,7 @@
 %
 \def\finalout{\overfullrule=0pt }
 
-% Do @cropmarks to get crop marks.
-%
-\newif\ifcropmarks
-\let\cropmarks = \cropmarkstrue
-%
-% Dimensions to add cropmarks at corners.
-% Added by P. A. MacKay, 12 Nov. 1986
-%
 \newdimen\outerhsize \newdimen\outervsize % set by the paper size routines
-\newdimen\cornerlong  \cornerlong=1pc
-\newdimen\cornerthick \cornerthick=.3pt
 \newdimen\topandbottommargin \topandbottommargin=.75in
 
 % Output a mark which sets \thischapter, \thissection and \thiscolor.
@@ -270,8 +257,8 @@
 
 % \domark is called twice inside \chapmacro, to add one
 % mark before the section break, and one after.
-%   In the second call \prevchapterdefs is the same as \lastchapterdefs,
-% and \prevsectiondefs is the same as \lastsectiondefs.
+%   In the second call \prevchapterdefs is the same as \currentchapterdefs,
+% and \prevsectiondefs is the same as \currentsectiondefs.
 %   Then if the page is not broken at the mark, some of the previous
 % section appears on the page, and we can get the name of this section
 % from \firstmark for @everyheadingmarks top.
@@ -279,11 +266,11 @@
 %
 % See page 260 of The TeXbook.
 \def\domark{%
-  \toks0=\expandafter{\lastchapterdefs}%
-  \toks2=\expandafter{\lastsectiondefs}%
+  \toks0=\expandafter{\currentchapterdefs}%
+  \toks2=\expandafter{\currentsectiondefs}%
   \toks4=\expandafter{\prevchapterdefs}%
   \toks6=\expandafter{\prevsectiondefs}%
-  \toks8=\expandafter{\lastcolordefs}%
+  \toks8=\expandafter{\currentcolordefs}%
   \mark{%
                    \the\toks0 \the\toks2  % 0: marks for @everyheadingmarks top
       \noexpand\or \the\toks4 \the\toks6  % 1: for @everyheadingmarks bottom
@@ -300,19 +287,19 @@
 % @setcolor (or @url, or @link, etc.) between @contents and the very
 % first @chapter.
 \def\gettopheadingmarks{%
-  \ifcase0\topmark\fi
+  \ifcase0\the\savedtopmark\fi
   \ifx\thischapter\empty \ifcase0\firstmark\fi \fi
 }
 \def\getbottomheadingmarks{\ifcase1\botmark\fi}
-\def\getcolormarks{\ifcase2\topmark\fi}
+\def\getcolormarks{\ifcase2\the\savedtopmark\fi}
 
 % Avoid "undefined control sequence" errors.
-\def\lastchapterdefs{}
-\def\lastsectiondefs{}
-\def\lastsection{}
+\def\currentchapterdefs{}
+\def\currentsectiondefs{}
+\def\currentsection{}
 \def\prevchapterdefs{}
 \def\prevsectiondefs{}
-\def\lastcolordefs{}
+\def\currentcolordefs{}
 
 % Margin to add to right of even pages, to left of odd pages.
 \newdimen\bindingoffset
@@ -322,39 +309,57 @@
 % Main output routine.
 %
 \chardef\PAGE = 255
-\output = {\onepageout{\pagecontents\PAGE}}
+\newtoks\defaultoutput
+\defaultoutput = {\savetopmark\onepageout{\pagecontents\PAGE}}
+\output=\expandafter{\the\defaultoutput}
 
 \newbox\headlinebox
 \newbox\footlinebox
 
+% When outputting the double column layout for indices, an output routine
+% is run several times, which hides the original value of \topmark.  This
+% can lead to a page heading being output and duplicating the chapter heading
+% of the index.  Hence, save the contents of \topmark at the beginning of
+% the output routine.  The saved contents are valid until we actually
+% \shipout a page.
+%
+% (We used to run a short output routine to actually set \topmark and 
+% \firstmark to the right values, but if this was called with an empty page 
+% containing whatsits for writing index entries, the whatsits would be thrown 
+% away and the index auxiliary file would remain empty.)
+%
+\newtoks\savedtopmark
+\newif\iftopmarksaved
+\topmarksavedtrue
+\def\savetopmark{%
+  \iftopmarksaved\else
+    \global\savedtopmark=\expandafter{\topmark}%
+    \global\topmarksavedtrue
+  \fi
+}
+
 % \onepageout takes a vbox as an argument.
-% \shipout a vbox for a single page, adding an optional header, footer,
-% cropmarks, and footnote.  This also causes index entries for this page
-% to be written to the auxiliary files.
+% \shipout a vbox for a single page, adding an optional header, footer
+% and footnote.  This also causes index entries for this page to be written
+% to the auxiliary files.
 %
 \def\onepageout#1{%
-  \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi
+  \hoffset=\normaloffset
   %
   \ifodd\pageno  \advance\hoffset by \bindingoffset
   \else \advance\hoffset by -\bindingoffset\fi
   %
-  % Common context changes for both heading and footing.
-  % Do this outside of the \shipout so @code etc. will be expanded in
-  % the headline as they should be, not taken literally (outputting ''code).
-  \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars}
-  %
   % Retrieve the information for the headings from the marks in the page,
   % and call Plain TeX's \makeheadline and \makefootline, which use the
   % values in \headline and \footline.
   %
   % This is used to check if we are on the first page of a chapter.
-  \ifcase1\topmark\fi
+  \ifcase1\the\savedtopmark\fi
   \let\prevchaptername\thischaptername
   \ifcase0\firstmark\fi
   \let\curchaptername\thischaptername
   %
   \ifodd\pageno \getoddheadingmarks \else \getevenheadingmarks \fi
-  \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
   %
   \ifx\curchaptername\prevchaptername
     \let\thischapterheading\thischapter
@@ -365,7 +370,14 @@
     \def\thischapterheading{}%
   \fi
   %
+  % Common context changes for both heading and footing.
+  % Do this outside of the \shipout so @code etc. will be expanded in
+  % the headline as they should be, not taken literally (outputting ''code).
+  \def\commmonheadfootline{\let\hsize=\txipagewidth \texinfochars}
+  %
   \global\setbox\headlinebox = \vbox{\commmonheadfootline \makeheadline}%
+  %
+  \ifodd\pageno \getoddfootingmarks \else \getevenfootingmarks \fi
   \global\setbox\footlinebox = \vbox{\commmonheadfootline \makefootline}%
   %
   {%
@@ -374,37 +386,12 @@
     % take effect in \write's, yet the group defined by the \vbox ends
     % before the \shipout runs.
     %
-    \indexdummies         % don't expand commands in the output.
-    \normalturnoffactive  % \ in index entries must not stay \, e.g., if
-               % the page break happens to be in the middle of an example.
-               % We don't want .vr (or whatever) entries like this:
-               % \entry{{\indexbackslash }acronym}{32}{\code {\acronym}}
-               % "\acronym" won't work when it's read back in;
-               % it needs to be
-               % {\code {{\backslashcurfont }acronym}
+    \atdummies         % don't expand commands in the output.
+    \turnoffactive
     \shipout\vbox{%
       % Do this early so pdf references go to the beginning of the page.
       \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi
       %
-      \ifcropmarks \vbox to \outervsize\bgroup
-        \hsize = \outerhsize
-        \vskip-\topandbottommargin
-        \vtop to0pt{%
-          \line{\ewtop\hfil\ewtop}%
-          \nointerlineskip
-          \line{%
-            \vbox{\moveleft\cornerthick\nstop}%
-            \hfill
-            \vbox{\moveright\cornerthick\nstop}%
-          }%
-          \vss}%
-        \vskip\topandbottommargin
-        \line\bgroup
-          \hfil % center the page within the outer (page) hsize.
-          \ifodd\pageno\hskip\bindingoffset\fi
-          \vbox\bgroup
-      \fi
-      %
       \unvbox\headlinebox
       \pagebody{#1}%
       \ifdim\ht\footlinebox > 0pt
@@ -415,24 +402,9 @@
         \unvbox\footlinebox
       \fi
       %
-      \ifcropmarks
-          \egroup % end of \vbox\bgroup
-        \hfil\egroup % end of (centering) \line\bgroup
-        \vskip\topandbottommargin plus1fill minus1fill
-        \boxmaxdepth = \cornerthick
-        \vbox to0pt{\vss
-          \line{%
-            \vbox{\moveleft\cornerthick\nsbot}%
-            \hfill
-            \vbox{\moveright\cornerthick\nsbot}%
-          }%
-          \nointerlineskip
-          \line{\ewbot\hfil\ewbot}%
-        }%
-      \egroup % \vbox from first cropmarks clause
-      \fi
-    }% end of \shipout\vbox
-  }% end of group with \indexdummies
+    }%
+  }%
+  \global\topmarksavedfalse
   \advancepageno
   \ifnum\outputpenalty>-20000 \else\dosupereject\fi
 }
@@ -451,17 +423,6 @@
 address@hidden \kern-\dimen@ \vfil \fi}
 }
 
-% Here are the rules for the cropmarks.  Note that they are
-% offset so that the space between them is truly \outerhsize or \outervsize
-% (P. A. MacKay, 12 November, 1986)
-%
-\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong}
-\def\nstop{\vbox
-  {\hrule height\cornerthick depth\cornerlong width\cornerthick}}
-\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong}
-\def\nsbot{\vbox
-  {\hrule height\cornerlong depth\cornerthick width\cornerthick}}
-
 
 % Argument parsing
 
@@ -487,11 +448,10 @@
   }%
 }
 
-% First remove any @comment, then any @c comment.  Also remove a @texinfoc
-% comment (see \scanmacro for details).  Pass the result on to \argcheckspaces.
+% First remove any @comment, then any @c comment.  Pass the result on to 
+% \argcheckspaces.
 \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm}
-\def\argremovec#1\c#2\ArgTerm{\argremovetexinfoc #1\texinfoc\ArgTerm}
-\def\argremovetexinfoc#1\texinfoc#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
+\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm}
 
 % Each occurrence of `\^^M' or `<space>\^^M' is replaced by a single space.
 %
@@ -1163,6 +1123,16 @@ where each line of input produces a line of output.}
   \fi
 \fi
 
+\newif\ifpdforxetex
+\pdforxetexfalse
+\ifpdf
+  \pdforxetextrue
+\fi
+\ifx\XeTeXrevision\thisisundefined\else
+  \pdforxetextrue
+\fi
+
+
 % PDF uses PostScript string constants for the names of xref targets,
 % for display in the outlines, and in other places.  Thus, we have to
 % double any backslashes.  Otherwise, a name like "\node" will be
@@ -1219,7 +1189,7 @@ output) for that.)}
   % Set color, and create a mark which defines \thiscolor accordingly,
   % so that \makeheadline knows which color to restore.
   \def\setcolor#1{%
-    \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
+    \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
     \domark
     \pdfsetcolor{#1}%
   }
@@ -1227,7 +1197,7 @@ output) for that.)}
   \def\maincolor{\rgbBlack}
   \pdfsetcolor{\maincolor}
   \edef\thiscolor{\maincolor}
-  \def\lastcolordefs{}
+  \def\currentcolordefs{}
   %
   \def\makefootline{%
     \baselineskip24pt
@@ -1605,7 +1575,7 @@ output) for that.)}
   % Set color, and create a mark which defines \thiscolor accordingly,
   % so that \makeheadline knows which color to restore.
   \def\setcolor#1{%
-    \xdef\lastcolordefs{\gdef\noexpand\thiscolor{#1}}%
+    \xdef\currentcolordefs{\gdef\noexpand\thiscolor{#1}}%
     \domark
     \pdfsetcolor{#1}%
   }
@@ -1613,7 +1583,7 @@ output) for that.)}
   \def\maincolor{\rgbBlack}
   \pdfsetcolor{\maincolor}
   \edef\thiscolor{\maincolor}
-  \def\lastcolordefs{}
+  \def\currentcolordefs{}
   %
   \def\makefootline{%
     \baselineskip24pt
@@ -2876,7 +2846,7 @@ end
 
 % @t, explicit typewriter.
 \def\t#1{%
-  {\tt \rawbackslash \plainfrenchspacing #1}%
+  {\tt \plainfrenchspacing #1}%
   \null
 }
 
@@ -2903,7 +2873,6 @@ end
     % Turn off hyphenation.
     \nohyphenation
     %
-    \rawbackslash
     \plainfrenchspacing
     #1%
   }%
@@ -3090,41 +3059,33 @@ end
   \global\def/{\normalslash}
 }
 
-% we put a little stretch before and after the breakable chars, to help
-% line breaking of long url's.  The unequal skips make look better in
-% cmtt at least, especially for dots.
-\def\urefprestretchamount{.13em}
-\def\urefpoststretchamount{.1em}
-\def\urefprestretch{\urefprebreak \hskip0pt plus\urefprestretchamount\relax}
-\def\urefpoststretch{\urefpostbreak \hskip0pt plus\urefprestretchamount\relax}
-%
-\def\urefcodeamp{\urefprestretch \&\urefpoststretch}
-\def\urefcodedot{\urefprestretch .\urefpoststretch}
-\def\urefcodehash{\urefprestretch \#\urefpoststretch}
-\def\urefcodequest{\urefprestretch ?\urefpoststretch}
+\def\urefcodeamp{\urefprebreak \&\urefpostbreak}
+\def\urefcodedot{\urefprebreak .\urefpostbreak}
+\def\urefcodehash{\urefprebreak \#\urefpostbreak}
+\def\urefcodequest{\urefprebreak ?\urefpostbreak}
 \def\urefcodeslash{\futurelet\next\urefcodeslashfinish}
 {
   \catcode`\/=\active
   \global\def\urefcodeslashfinish{%
-    \urefprestretch \slashChar
+    \urefprebreak \slashChar
     % Allow line break only after the final / in a sequence of
     % slashes, to avoid line break between the slashes in http://.
-    \ifx\next/\else \urefpoststretch \fi
+    \ifx\next/\else \urefpostbreak \fi
   }
 }
 
-% One more complication: by default we'll break after the special
-% characters, but some people like to break before the special chars, so
-% allow that.  Also allow no breaking at all, for manual control.
+% By default we'll break after the special characters, but some people like to 
+% break before the special chars, so allow that.  Also allow no breaking at 
+% all, for manual control.
 % 
 \parseargdef\urefbreakstyle{%
   \def\txiarg{#1}%
   \ifx\txiarg\wordnone
     \def\urefprebreak{\nobreak}\def\urefpostbreak{\nobreak}
   \else\ifx\txiarg\wordbefore
-    \def\urefprebreak{\allowbreak}\def\urefpostbreak{\nobreak}
+    \def\urefprebreak{\urefallowbreak}\def\urefpostbreak{\nobreak}
   \else\ifx\txiarg\wordafter
-    \def\urefprebreak{\nobreak}\def\urefpostbreak{\allowbreak}
+    \def\urefprebreak{\nobreak}\def\urefpostbreak{\urefallowbreak}
   \else
     \errhelp = \EMsimple
     \errmessage{Unknown @urefbreakstyle setting `\txiarg'}%
@@ -3134,6 +3095,14 @@ end
 \def\wordbefore{before}
 \def\wordnone{none}
 
+% Allow a ragged right output to aid breaking long URL's.  Putting stretch in 
+% between characters of the URL doesn't look good.
+\def\urefallowbreak{%
+  \hskip 0pt plus 1fil\relax
+  \allowbreak
+  \hskip 0pt plus -1fil\relax
+}
+
 \urefbreakstyle after
 
 % @url synonym for @uref, since that's how everyone uses it.
@@ -3144,7 +3113,7 @@ end
 % So now @email is just like @uref, unless we are pdf.
 %
 %\def\email#1{\angleleft{\tt #1}\angleright}
-\ifpdf
+\ifpdforxetex
   \def\email#1{\doemail#1,,\finish}
   \def\doemail#1,#2,#3\finish{\begingroup
     \unsepspaces
@@ -3154,18 +3123,7 @@ end
     \endlink
   \endgroup}
 \else
-  \ifx\XeTeXrevision\thisisundefined
-    \let\email=\uref
-  \else
-    \def\email#1{\doemail#1,,\finish}
-    \def\doemail#1,#2,#3\finish{\begingroup
-      \unsepspaces
-      \pdfurl{mailto:#1}%
-      \setbox0 = \hbox{\ignorespaces #2}%
-      \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi
-      \endlink
-    \endgroup}
-  \fi
+  \let\email=\uref
 \fi
 
 % @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always),
@@ -4699,19 +4657,6 @@ end
   }
 }
 
-% We have this subroutine so that we can handle at least some @value's
-% properly in indexes (we call \makevalueexpandable in \indexdummies).
-% The command has to be fully expandable (if the variable is set), since
-% the result winds up in the index file.  This means that if the
-% variable's value contains other Texinfo commands, it's almost certain
-% it will fail (although perhaps we could fix that with sufficient work
-% to do a one-level expansion on the result, instead of complete).
-% 
-% Unfortunately, this has the consequence that when _ is in the *value*
-% of an @set, it does not print properly in the roman fonts (get the cmr
-% dot accent at position 126 instead).  No fix comes to mind, and it's
-% been this way since 2003 or earlier, so just ignore it.
-% 
 \def\expandablevalue#1{%
   \expandafter\ifx\csname SET#1\endcsname\relax
     {[No value for ``#1'']}%
@@ -4740,7 +4685,7 @@ end
 % if possible, otherwise sort late.
 \def\indexnofontsvalue#1{%
   \expandafter\ifx\csname SET#1\endcsname\relax
-    ZZZZZZZ
+    ZZZZZZZ%
   \else
     \csname SET#1\endcsname
   \fi
@@ -4890,23 +4835,8 @@ end
 \def\docodeindexxxx #1{\doind{\indexname}{\code{#1}}}
 
 
-% Used when writing an index entry out to an index file to prevent
-% expansion of Texinfo commands that can appear in an index entry.
-%
-\def\indexdummies{%
-  \escapechar = `\\     % use backslash in output files.
-  address@hidden
-  \definedummyletter\ %
-  %
-  % For texindex which always views { and } as separators.
-  \def\{{\lbracechar{}}%
-  \def\}{\rbracechar{}}%
-  %
-  % Do the redefinitions.
-  \definedummies
-}
-
-% Used for the aux and toc files, where @ is the escape character.
+% Used for the aux, toc and index files to prevent expansion of Texinfo 
+% commands.
 %
 \def\atdummies{%
   address@hidden
@@ -4936,8 +4866,7 @@ end
 \def\definedummyletter#1{\def#1{\string#1}}%
 \let\definedummyaccent\definedummyletter
 
-% Called from \indexdummies and \atdummies, to effectively prevent
-% the expansion of commands.
+% Called from \atdummies to prevent the expansion of commands.
 %
 \def\definedummies{%
   %
@@ -5102,11 +5031,9 @@ end
   \commondummyword\xref
 }
 
-% For testing: output @{ and @} in index sort strings as \{ and \}.
-\newif\ifusebracesinindexes
-
 \let\indexlbrace\relax
 \let\indexrbrace\relax
+\let\indexatchar\relax
 
 address@hidden
 \catcode`\\=13
@@ -5140,10 +5067,8 @@ end
   }
 
   \gdef\indexnonalnumreappear{%
-    \useindexbackslash
     \let-\normaldash
     \let<\normalless
-    address@hidden@}%
   }
 }
 
@@ -5254,36 +5179,16 @@ end
 
 
 
-\let\SETmarginindex=\relax % put index entries in margin (undocumented)?
-
-% Most index entries go through here, but \dosubind is the general case.
 % #1 is the index name, #2 is the entry text.
-\def\doind#1#2{\dosubind{#1}{#2}{}}
-
-% There is also \dosubind {index}{topic}{subtopic}
-% which makes an entry in a two-level index such as the operation index.
-% TODO: Two-level index?  Operation index?
-
-% Workhorse for all indexes.
-% #1 is name of index, #2 is stuff to put there, #3 is subentry --
-% empty if called from \doind, as we usually are (the main exception
-% is with most defuns, which call us directly).
-%
-\def\dosubind#1#2#3{%
+\def\doind#1#2{%
   \iflinks
   {%
-    \requireopenindexfile{#1}%
-    % Store the main index entry text (including the third arg).
-    \toks0 = {#2}%
-    % If third arg is present, precede it with a space.
-    \def\thirdarg{#3}%
-    \ifx\thirdarg\empty \else
-      \toks0 = \expandafter{\the\toks0 \space #3}%
-    \fi
     %
+    \requireopenindexfile{#1}%
     \edef\writeto{\csname#1indfile\endcsname}%
     %
-    \safewhatsit\dosubindwrite
+    \def\indextext{#2}%
+    \safewhatsit\doindwrite
   }%
   \fi
 }
@@ -5305,21 +5210,7 @@ end
 \fi}
 \def\indexisfl{fl}
 
-% Output \ as {\indexbackslash}, because \ is an escape character in
-% the index files.
-\let\indexbackslash=\relax
address@hidden \catcode`\\=\active
-  @address@hidden@address@hidden
-}
-
-% Definition for writing index entry text.
-\def\sortas#1{\ignorespaces}%
-
-% Definition for writing index entry sort key.  Should occur at the at
-% the beginning of the index entry, like
-%     @cindex @sortas{september} \september
-% The \ignorespaces takes care of following space, but there's no way
-% to remove space before it.
+% Definition for writing index entry sort key.
 {
 \catcode`\-=13
 \gdef\indexwritesortas{%
@@ -5330,51 +5221,121 @@ end
   \xdef\indexsortkey{#1}\endgroup}
 }
 
+\def\indexwriteseealso#1{
+  address@hidden
+}
 
-% Write the entry in \toks0 to the index file.
+% The default definitions
+\def\sortas#1{}%
+\def\seealso#1{\i{\putwordSeeAlso}\ #1}% for sorted index file only
+\def\putwordSeeAlso{see also}
+
+% Given index entry text like "aaa @subentry bbb @sortas{ZZZ}":
+%   * Set \bracedtext to "{aaa}{bbb}"
+%   * Set \fullindexsortkey to "aaa @subentry ZZZ"
+%   * If @seealso occurs, set \pagenumbertext
 %
-\def\dosubindwrite{%
-  % Put the index entry in the margin if desired.
-  \ifx\SETmarginindex\relax\else
-    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}%
+\def\splitindexentry#1{%
+  \gdef\fullindexsortkey{}%
+  \xdef\bracedtext{}%
+  \def\sep{}%
+  \def\seealso##1{}%
+  \expandafter\doindexsegment#1\subentry\finish\subentry
+}
+
+% append the results from the next segment
+\def\doindexsegment#1\subentry{%
+  \def\segment{#1}%
+  \ifx\segment\isfinish
+  \else
+    %
+    % Fully expand the segment, throwing away any @sortas directives, and 
+    % trim spaces.
+    \edef\trimmed{\segment}%
+    \edef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
+    %
+    \xdef\bracedtext{\bracedtext{\trimmed}}%
+    %
+    % Get the string to sort by.  Process the segment with all
+    % font commands turned off.
+    \bgroup
+      \let\sortas\indexwritesortas
+      \let\seealso\indexwriteseealso
+      \indexnofonts
+      % The braces around the commands are recognized by texindex.
+      \def\lbracechar{{\indexlbrace}}%
+      \def\rbracechar{{\indexrbrace}}%
+      \let\{=\lbracechar
+      \let\}=\rbracechar
+      address@hidden
+      address@hidden
+      %
+      \let\indexsortkey\empty
+      \global\let\pagenumbertext\empty
+      % Execute the segment and throw away the typeset output.  This executes
+      % any @sortas or @seealso commands in this segment.
+      \setbox\dummybox = \hbox{\segment}%
+      \ifx\indexsortkey\empty{%
+        \indexnonalnumdisappear
+        \xdef\trimmed{\segment}%
+        \xdef\trimmed{\expandafter\eatspaces\expandafter{\trimmed}}%
+        \xdef\indexsortkey{\trimmed}%
+        \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
+      }\fi
+      %
+      % Append to \fullindexsortkey.
+      \edef\tmp{\gdef\noexpand\fullindexsortkey{%
+                  \fullindexsortkey\sep\indexsortkey}}%
+      \tmp
+    \egroup
+    \def\sep{\subentry}%
+    %
+    \expandafter\doindexsegment
   \fi
+}
+\def\isfinish{\finish}%
+\newbox\dummybox % used above
+
+\let\subentry\relax
+
+% Write the entry in \toks0 to the index file.
+%
+\def\doindwrite{%
+  \maybemarginindex
   %
-  % Remember, we are within a group.
-  \indexdummies % Must do this here, since \bf, etc expand at this stage
-  \useindexbackslash % \indexbackslash isn't defined now so it will be output 
-                     % as is; and it will print as backslash.
-  % The braces around \indexbrace are recognized by texindex.
-  %
-  % Get the string to sort by, by processing the index entry with all
-  % font commands turned off.
-  {\indexnofonts
-   \def\lbracechar{{\indexlbrace}}%
-   \def\rbracechar{{\indexrbrace}}%
-   \let\{=\lbracechar
-   \let\}=\rbracechar
-   \indexnonalnumdisappear
-   \xdef\indexsortkey{}%
-   \let\sortas=\indexwritesortas
-   \edef\temp{\the\toks0}%
-   \setbox\dummybox = \hbox{\temp}% Make sure to execute any \sortas
-   \ifx\indexsortkey\empty
-     \xdef\indexsortkey{\temp}%
-     \ifx\indexsortkey\empty\xdef\indexsortkey{ }\fi
-   \fi
-  }%
+  \atdummies
+  %
+  % For texindex which always views { and } as separators.
+  \def\{{\lbracechar{}}%
+  \def\}{\rbracechar{}}%
+  %
+  % Split the entry into primary entry and any subentries, and get the index 
+  % sort key.
+  \splitindexentry\indextext
   %
   % Set up the complete index entry, with both the sort key and
   % the original text, including any font commands.  We write
   % three arguments to \entry to the .?? file (four in the
   % subentry case), texindex reduces to two when writing the .??s
   % sorted result.
+  %
   \edef\temp{%
     \write\writeto{%
-      \string\entry{\indexsortkey}{\noexpand\folio}{\the\toks0}}%
+      \string\entry{\fullindexsortkey}%
+        {\ifx\pagenumbertext\empty\noexpand\folio\else\pagenumbertext\fi}%
+        \bracedtext}%
   }%
   \temp
 }
-\newbox\dummybox % used above
+
+% Put the index entry in the margin if desired (undocumented).
+\def\maybemarginindex{%
+  \ifx\SETmarginindex\relax\else
+    \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \relax\indextext}}%
+  \fi
+}
+\let\SETmarginindex=\relax
+
 
 % Take care of unwanted page breaks/skips around a whatsit:
 %
@@ -5462,9 +5423,14 @@ end
 %  \entry {topic}{pagelist}
 %     for a topic that is used without subtopics
 %  \primary {topic}
+%  \entry {topic}{}
 %     for the beginning of a topic that is used with subtopics
 %  \secondary {subtopic}{pagelist}
 %     for each subtopic.
+%  \secondary {subtopic}{}
+%     for a subtopic with sub-subtopics
+%  \tertiary {subtopic}{subsubtopic}{pagelist}
+%     for each sub-subtopic.
 
 % Define the user-accessible indexing commands
 % @findex, @vindex, @kindex, @cindex.
@@ -5476,11 +5442,6 @@ end
 \def\tindex {\tpindex}
 \def\pindex {\pgindex}
 
-\def\cindexsub {\begingroup\obeylines\cindexsub}
-{\obeylines %
-\gdef\cindexsub "#1" #2^^M{\endgroup %
-\dosubind{cp}{#2}{#1}}}
-
 % Define the macros used in formatting output of the sorted index material.
 
 % @printindex causes a particular index (the ??s file) to get printed.
@@ -5494,14 +5455,10 @@ end
   \plainfrenchspacing
   \everypar = {}% don't want the \kern\-parindent from indentation suppression.
   %
-  % See if the index file exists and is nonempty.
-  % Change catcode of @ here so that if the index file contains
-  % \initial address@hidden
-  % as its first line, TeX doesn't complain about mismatched braces
-  % (because it thinks @} is a control sequence).
-  \catcode`\@ = 12
   % See comment in \requireopenindexfile.
   \def\indexname{#1}\ifx\indexname\indexisfl\def\indexname{f1}\fi
+  %
+  % See if the index file exists and is nonempty.
   \openin 1 \jobname.\indexname s
   \ifeof 1
     % \enddoublecolumns gets confused if there is no text in the index,
@@ -5511,8 +5468,6 @@ end
     \putwordIndexNonexistent
     \typeout{No file \jobname.\indexname s.}%
   \else
-    \catcode`\\ = 0
-    %
     % If the index file exists but is empty, then \openin leaves \ifeof
     % false.  We have to make TeX try to read something from the file, so
     % it can discover if there is anything in it.
@@ -5520,47 +5475,27 @@ end
     \ifeof 1
       \putwordIndexIsEmpty
     \else
-      % Index files are almost Texinfo source, but we use \ as the escape
-      % character.  It would be better to use @, but that's too big a change
-      % to make right now.
-      \def\indexbackslash{\ttbackslash}%
-      \let\indexlbrace\{   % Likewise, set these sequences for braces
-      \let\indexrbrace\}   % used in the sort key.
-      \begindoublecolumns
-      \let\dotheinsertentrybox\dotheinsertentryboxwithpenalty
-      %
-      % Read input from the index file line by line.
-      \loopdo
-        \ifeof1 \else
-          \read 1 to \nextline
-        \fi
-        %
-        \indexinputprocessing
-        \thisline
-        %
-        \ifeof1\else
-        \let\thisline\nextline
-      \repeat
-      %%
-      \enddoublecolumns
+      \expandafter\printindexzz\thisline\relax\relax\finish%
     \fi
   \fi
   \closein 1
 \endgroup}
-\def\loopdo#1\repeat{\def\body{#1}\loopdoxxx}
-\def\loopdoxxx{\let\next=\relax\body\let\next=\loopdoxxx\fi\next}
 
-\def\indexinputprocessing{%
-  \ifeof1
-    \let\firsttoken\relax
+% If the index file starts with a backslash, forgo reading the index
+% file altogether.  If somebody upgrades texinfo.tex they may still have
+% old index files using \ as the escape character.  Reading this would
+% at best lead to typesetting garbage, at worst a TeX syntax error.
+\def\printindexzz#1#2\finish{%
+  % NB this won't work if the index file starts with a group...
+  \uccode`\~=`\\ \uppercase{\if\noexpand~}\noexpand#1
+    \message{skipping sorted index file}%
+    (Skipped sorted index file in obsolete format)
   \else
-    \edef\act{\gdef\noexpand\firsttoken{\getfirsttoken\nextline}}%
-    \act
+    \begindoublecolumns
+    \input \jobname.\indexname s
+    \enddoublecolumns
   \fi
 }
-\def\getfirsttoken#1{\expandafter\getfirsttokenx#1\endfirsttoken}
-\long\def\getfirsttokenx#1#2\endfirsttoken{\noexpand#1}
-
 
 % These macros are used by the sorted index file itself.
 % Change them to control the appearance of the index.
@@ -5569,12 +5504,18 @@ end
 \catcode`\|=13 \catcode`\<=13 \catcode`\>=13 \catcode`\+=13 \catcode`\"=13
 \catcode`\$=3
 \gdef\initialglyphs{%
+  % special control sequences used in the index sort key
+  \let\indexlbrace\{%
+  \let\indexrbrace\}%
+  address@hidden
+  %
   % Some changes for non-alphabetic characters.  Using the glyphs from the
   % math fonts looks more consistent than the typewriter font used elsewhere
   % for these characters.
-  \def\indexbackslash{\math{\backslash}}%
-  \let\\=\indexbackslash
+  \uccode`\~=`\\ \uppercase{\def~{\math{\backslash}}}
   %
+  % In case @\ is used for backslash
+  \uppercase{\let\\=~}
   % Can't get bold backslash so don't use bold forward slash
   \catcode`\/=13
   \def/{{\secrmnotbold \normalslash}}%
@@ -5634,12 +5575,6 @@ end
 \def\entry{%
   \begingroup
     %
-    % For pdfTeX and XeTeX.
-    % The redefinition of \domark stops marks being added in \pdflink to 
-    % preserve coloured links across page boundaries.  Otherwise the marks
-    % would get in the way of \lastbox in \insertentrybox.
-    \let\domark\relax
-    %
     % Start a new paragraph if necessary, so our assignments below can't
     % affect previous text.
     \par
@@ -5672,35 +5607,31 @@ end
 \gdef\finishentry#1{%
     \egroup % end box A
     \dimen@ = \wd\boxA % Length of text of entry
-    \global\setbox\boxA=\hbox\bgroup\unhbox\boxA
-    % #1 is the page number.
-    %
-    % Get the width of the page numbers, and only use
-    % leaders if they are present.
-    \global\setbox\boxB = \hbox{#1}%
-    \ifdim\wd\boxB = 0pt
-      \null\nobreak\hfill\ %
-    \else
-      %
-      \null\nobreak\indexdotfill % Have leaders before the page number.
+    \global\setbox\boxA=\hbox\bgroup
+      \unhbox\boxA
+      % #1 is the page number.
       %
-      \ifpdf
-        \pdfgettoks#1.%
-        \hskip\skip\thinshrinkable\the\toksA
+      % Get the width of the page numbers, and only use
+      % leaders if they are present.
+      \global\setbox\boxB = \hbox{#1}%
+      \ifdim\wd\boxB = 0pt
+        \null\nobreak\hfill\ %
       \else
-        \ifx\XeTeXrevision\thisisundefined
-          \hskip\skip\thinshrinkable #1%
-        \else
+        %
+        \null\nobreak\indexdotfill % Have leaders before the page number.
+        %
+        \ifpdforxetex
           \pdfgettoks#1.%
           \hskip\skip\thinshrinkable\the\toksA
+        \else
+          \hskip\skip\thinshrinkable #1%
         \fi
       \fi
-    \fi
     \egroup % end \boxA
     \ifdim\wd\boxB = 0pt
-      \global\setbox\entrybox=\vbox{\unhbox\boxA}%
-    \else
-    \global\setbox\entrybox=\vbox\bgroup
+      \noindent\unhbox\boxA\par
+      \nobreak
+    \else\bgroup
       % We want the text of the entries to be aligned to the left, and the
       % page numbers to be aligned to the right.
       %
@@ -5766,55 +5697,11 @@ end
     \egroup % The \vbox
     \fi
   \endgroup
-  \dotheinsertentrybox
 }}
 
 \newskip\thinshrinkable
 \skip\thinshrinkable=.15em minus .15em
 
-\newbox\entrybox
-\def\insertentrybox{%
-  \ourunvbox\entrybox
-}
-
-% default definition
-\let\dotheinsertentrybox\insertentrybox
-
-% Use \lastbox to take apart vbox box by box, and add each sub-box
-% to the current vertical list.
-\def\ourunvbox#1{%
-\bgroup % for local binding of \delayedbox
-  % Remove the last box from box #1
-  \global\setbox#1=\vbox{%
-    \unvbox#1%
-    \unskip % remove any glue
-    \unpenalty
-    \global\setbox\interbox=\lastbox
-  }%
-  \setbox\delayedbox=\box\interbox
-  \ifdim\ht#1=0pt\else
-    \ourunvbox#1 % Repeat on what's left of the box
-    \nobreak
-  \fi
-  \box\delayedbox
-\egroup
-}
-\newbox\delayedbox
-\newbox\interbox
-
-% Used from \printindex.  \firsttoken should be the first token
-% after the \entry.  If it's not another \entry, we are at the last
-% line of a group of index entries, so insert a penalty to discourage
-% widowed index entries.
-\def\dotheinsertentryboxwithpenalty{%
-  \ifx\firsttoken\isentry
-  \else
-    \penalty 9000
-  \fi
-  \insertentrybox
-}
-\def\isentry{\entry}%
-
 % Like plain.tex's \dotfill, except uses up at least 1 em.
 % The filll stretch here overpowers both the fil and fill stretch to push
 % the page number to the right.
@@ -5824,24 +5711,15 @@ end
 
 \def\primary #1{\line{#1\hfil}}
 
-\newskip\secondaryindent \secondaryindent=0.5cm
-\def\secondary#1#2{{%
-  \parfillskip=0in
-  \parskip=0in
-  \hangindent=1in
-  \hangafter=1
-  \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill
-  \ifpdf
-    \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
-  \else
-    \ifx\XeTeXrevision\thisisundefined
-      #2
-    \else
-      \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph.
-    \fi
-  \fi
-  \par
-}}
+\def\secondary{\indententry{0.5cm}}
+\def\tertiary{\indententry{1cm}}
+
+\def\indententry#1#2#3{%
+  \bgroup
+  \leftskip=#1
+  \entry{#2}{#3}%
+  \egroup
+}
 
 % Define two-column mode, which we use to typeset indexes.
 % Adapted from the TeXbook, page 416, which is to say,
@@ -5851,60 +5729,21 @@ end
 \newbox\partialpage
 \newdimen\doublecolumnhsize
 
-% Use inside an output routine to save \topmark and \firstmark
-\def\savemarks{%
-  \global\savedtopmark=\expandafter{\topmark }%
-  \global\savedfirstmark=\expandafter{\firstmark }%
-}
-\newtoks\savedtopmark
-\newtoks\savedfirstmark
-
-% Set \topmark and \firstmark for next time \output runs.
-% Can't be run from withinside \output (because any material
-% added while an output routine is active, including 
-% penalties, is saved for after it finishes).  The page so far
-% should be empty, otherwise what's on it will be thrown away.
-\def\restoremarks{%
-  \mark{\the\savedtopmark}%
-  \bgroup\output = {%
-    \setbox\dummybox=\box\PAGE
-  }abc\eject\egroup
-  % "abc" because output routine doesn't fire for a completely empty page.
-  \mark{\the\savedfirstmark}%
-}
-
 \def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
   % If not much space left on page, start a new page.
   \ifdim\pagetotal>0.8\vsize\vfill\eject\fi
   %
   % Grab any single-column material above us.
   \output = {%
-    %
-    % Here is a possibility not foreseen in manmac: if we accumulate a
-    % whole lot of material, we might end up calling this \output
-    % routine twice in a row (see the doublecol-lose test, which is
-    % essentially a couple of indexes with @setchapternewpage off).  In
-    % that case we just ship out what is in \partialpage with the normal
-    % output routine.  Generally, \partialpage will be empty when this
-    % runs and this will be a no-op.  See the indexspread.tex test case.
-    \ifvoid\partialpage \else
-      \onepageout{\pagecontents\partialpage}%
-    \fi
+    \savetopmark
     %
     \global\setbox\partialpage = \vbox{%
       % Unvbox the main output page.
       \unvbox\PAGE
       \kern-\topskip \kern\baselineskip
     }%
-    \savemarks
   }%
   \eject % run that output routine to set \partialpage
-  \restoremarks
-  %
-  % We recover the two marks that the last output routine saved in order
-  % to propagate the information in marks added around a chapter heading,
-  % which could be otherwise be lost by the time the final page is output.
-  %
   %
   % Use the double-column output routine for subsequent pages.
   \output = {\doublecolumnout}%
@@ -5930,7 +5769,9 @@ end
     \divide\doublecolumnhsize by 2
   \hsize = \doublecolumnhsize
   %
-  % Double the \vsize as well.
+  % Get the available space for the double columns -- the normal
+  % (undoubled) page height minus any material left over from the
+  % previous page.
   \advance\vsize by -\ht\partialpage
   \vsize = 2\vsize
   %
@@ -5943,17 +5784,15 @@ end
 %
 \def\doublecolumnout{%
   %
+  \savetopmark
   \splittopskip=\topskip \splitmaxdepth=\maxdepth
-  % Get the available space for the double columns -- the normal
-  % (undoubled) page height minus any material left over from the
-  % previous page.
   \dimen@ = \vsize
   \divide\dimen@ by 2
   %
   % box0 will be the left-hand column, box2 the right.
   \setbox0=\vsplit\PAGE to\dimen@ \setbox2=\vsplit\PAGE to\dimen@
   \global\advance\vsize by 2\ht\partialpage
-  \onepageout\pagesofar
+  \onepageout\pagesofar % empty except for the first time we are called
   \unvbox\PAGE
   \penalty\outputpenalty
 }
@@ -6001,7 +5840,7 @@ end
   %
   \output = {%
     % Split the last of the double-column material.
-    \savemarks
+    \savetopmark
     \balancecolumns
   }%
   \eject % call the \output just set
@@ -6009,10 +5848,9 @@ end
     % Having called \balancecolumns once, we do not
     % want to call it again.  Therefore, reset \output to its normal
     % definition right away.
-    \global\output = {\onepageout{\pagecontents\PAGE}}%
+    \global\output=\expandafter{\the\defaultoutput}
     %
     \endgroup % started in \begindoublecolumns
-    \restoremarks
     % Leave the double-column material on the current page, no automatic
     % page break.
     \box\balancedcolumns
@@ -6036,13 +5874,14 @@ end
 \def\balancecolumns{%
   \setbox0 = \vbox{\unvbox\PAGE}% like \box255 but more efficient, see p.120.
   \dimen@ = \ht0
-  \advance\dimen@ by \topskip
-  \advance\dimen@ by-\baselineskip
-  \ifdim\dimen@<5\baselineskip
+  \ifdim\dimen@<7\baselineskip
     % Don't split a short final column in two.
     \setbox2=\vbox{}%
     \global\setbox\balancedcolumns=\vbox{\pagesofar}%
   \else
+    % double the leading vertical space
+    \advance\dimen@ by \topskip
+    \advance\dimen@ by-\baselineskip
     \divide\dimen@ by 2 % target to split to
     address@hidden = \dimen@
     \splittopskip = \topskip
@@ -6177,11 +6016,9 @@ end
 
 % @raisesections: treat @section as chapter, @subsection as section, etc.
 \def\raisesections{\global\advance\secbase by -1}
-\let\up=\raisesections % original BFox name
 
 % @lowersections: treat @chapter as section, @section as subsection, etc.
 \def\lowersections{\global\advance\secbase by 1}
-\let\down=\lowersections % original BFox name
 
 % we only have subsub.
 \chardef\maxseclevel = 3
@@ -6526,27 +6363,22 @@ end
   \expandafter\ifx\thisenv\titlepage\else
     \checkenv{}% chapters, etc., should not start inside an environment.
   \fi
-  % FIXME: \chapmacro is currently called from inside \titlepage when
-  % \setcontentsaftertitlepage to print the "Table of Contents" heading, but
-  % this should probably be done by \sectionheading with an option to print
-  % in chapter size.
-  %
   % Insert the first mark before the heading break (see notes for \domark).
-  \let\prevchapterdefs=\lastchapterdefs
-  \let\prevsectiondefs=\lastsectiondefs
-  \gdef\lastsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
+  \let\prevchapterdefs=\currentchapterdefs
+  \let\prevsectiondefs=\currentsectiondefs
+  \gdef\currentsectiondefs{\gdef\thissectionname{}\gdef\thissectionnum{}%
                         \gdef\thissection{}}%
   %
   \def\temptype{#2}%
   \ifx\temptype\Ynothingkeyword
-    \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
+    \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
                           \gdef\thischapter{\thischaptername}}%
   \else\ifx\temptype\Yomitfromtockeyword
-    \gdef\lastchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
+    \gdef\currentchapterdefs{\gdef\thischaptername{#1}\gdef\thischapternum{}%
                           \gdef\thischapter{}}%
   \else\ifx\temptype\Yappendixkeyword
     \toks0={#1}%
-    \xdef\lastchapterdefs{%
+    \xdef\currentchapterdefs{%
       \gdef\noexpand\thischaptername{\the\toks0}%
       \gdef\noexpand\thischapternum{\appendixletter}%
       % \noexpand\putwordAppendix avoids expanding indigestible
@@ -6557,7 +6389,7 @@ end
     }%
   \else
     \toks0={#1}%
-    \xdef\lastchapterdefs{%
+    \xdef\currentchapterdefs{%
       \gdef\noexpand\thischaptername{\the\toks0}%
       \gdef\noexpand\thischapternum{\the\chapno}%
       % \noexpand\putwordChapter avoids expanding indigestible
@@ -6577,18 +6409,18 @@ end
   %
   % Now the second mark, after the heading break.  No break points
   % between here and the heading.
-  \let\prevchapterdefs=\lastchapterdefs
-  \let\prevsectiondefs=\lastsectiondefs
+  \let\prevchapterdefs=\currentchapterdefs
+  \let\prevsectiondefs=\currentsectiondefs
   \domark
   %
   {%
     \chapfonts \rm
     \let\footnote=\errfootnoteheading % give better error message
     %
-    % Have to define \lastsection before calling \donoderef, because the
+    % Have to define \currentsection before calling \donoderef, because the
     % xref code eventually uses it.  On the other hand, it has to be called
     % after \pchapsepmacro, or the headline will change too soon.
-    \gdef\lastsection{#1}%
+    \gdef\currentsection{#1}%
     %
     % Only insert the separating space if we have a chapter/appendix
     % number, and don't print the unnumbered ``number''.
@@ -6677,10 +6509,10 @@ end
     \csname #2fonts\endcsname \rm
     %
     % Insert first mark before the heading break (see notes for \domark).
-    \let\prevsectiondefs=\lastsectiondefs
+    \let\prevsectiondefs=\currentsectiondefs
     \ifx\temptype\Ynothingkeyword
       \ifx\sectionlevel\seckeyword
-        \gdef\lastsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
+        
\gdef\currentsectiondefs{\gdef\thissectionname{#1}\gdef\thissectionnum{}%
                               \gdef\thissection{\thissectionname}}%
       \fi
     \else\ifx\temptype\Yomitfromtockeyword
@@ -6688,7 +6520,7 @@ end
     \else\ifx\temptype\Yappendixkeyword
       \ifx\sectionlevel\seckeyword
         \toks0={#1}%
-        \xdef\lastsectiondefs{%
+        \xdef\currentsectiondefs{%
           \gdef\noexpand\thissectionname{\the\toks0}%
           \gdef\noexpand\thissectionnum{#4}%
           % \noexpand\putwordSection avoids expanding indigestible
@@ -6701,7 +6533,7 @@ end
     \else
       \ifx\sectionlevel\seckeyword
         \toks0={#1}%
-        \xdef\lastsectiondefs{%
+        \xdef\currentsectiondefs{%
           \gdef\noexpand\thissectionname{\the\toks0}%
           \gdef\noexpand\thissectionnum{#4}%
           % \noexpand\putwordSection avoids expanding indigestible
@@ -6727,28 +6559,28 @@ end
     %
     % Now the second mark, after the heading break.  No break points
     % between here and the heading.
-    \global\let\prevsectiondefs=\lastsectiondefs
+    \global\let\prevsectiondefs=\currentsectiondefs
     \domark
     %
     % Only insert the space after the number if we have a section number.
     \ifx\temptype\Ynothingkeyword
       \setbox0 = \hbox{}%
       \def\toctype{unn}%
-      \gdef\lastsection{#1}%
+      \gdef\currentsection{#1}%
     \else\ifx\temptype\Yomitfromtockeyword
       % for @headings -- no section number, don't include in toc,
-      % and don't redefine \lastsection.
+      % and don't redefine \currentsection.
       \setbox0 = \hbox{}%
       \def\toctype{omit}%
       \let\sectionlevel=\empty
     \else\ifx\temptype\Yappendixkeyword
       \setbox0 = \hbox{#4\enspace}%
       \def\toctype{app}%
-      \gdef\lastsection{#1}%
+      \gdef\currentsection{#1}%
     \else
       \setbox0 = \hbox{#4\enspace}%
       \def\toctype{num}%
-      \gdef\lastsection{#1}%
+      \gdef\currentsection{#1}%
     \fi\fi\fi
     %
     % Write the toc entry (before \donoderef).  See comments in \chapmacro.
@@ -6838,13 +6670,8 @@ end
   % 1 and 2 (the page numbers aren't printed), and so are the first
   % two pages of the document.  Thus, we'd have two destinations named
   % `1', and two named `2'.
-  \ifpdf
+  \ifpdforxetex
     \global\pdfmakepagedesttrue
-  \else
-    \ifx\XeTeXrevision\thisisundefined
-    \else
-      \global\pdfmakepagedesttrue
-    \fi
   \fi
 }
 
@@ -7207,11 +7034,7 @@ end
 
 % @cartouche ... @end cartouche: draw rectangle w/rounded corners around
 % environment contents.
-\font\circle=lcircle10
-\newdimen\circthick
-\newdimen\cartouter\newdimen\cartinner
-\newskip\normbskip\newskip\normpskip\newskip\normlskip
-\circthick=\fontdimen8\circle
+
 %
 \def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth
 \def\ctr{{\hskip 6pt\circle\char'010}}
@@ -7226,7 +7049,18 @@ end
 %
 \newskip\lskip\newskip\rskip
 
+% only require the font if @cartouche is actually used
+\def\cartouchefontdefs{%
+  \font\circle=lcircle10\relax
+  \circthick=\fontdimen8\circle
+}
+\newdimen\circthick
+\newdimen\cartouter\newdimen\cartinner
+\newskip\normbskip\newskip\normpskip\newskip\normlskip
+
+
 \envdef\cartouche{%
+  \cartouchefontdefs
   \ifhmode\par\fi  % can't be in the midst of a paragraph.
   \startsavinginserts
   \lskip=\leftskip \rskip=\rightskip
@@ -7405,13 +7239,9 @@ end
 
 
 % @raggedright does more-or-less normal line breaking but no right
-% justification.  From plain.tex.  Don't stretch around special
-% characters in urls in this environment, since the stretch at the right
-% should be enough.
+% justification.  From plain.tex.
 \envdef\raggedright{%
   \rightskip0pt plus2.4em \spaceskip.3333em \xspaceskip.5em\relax
-  \def\urefprestretchamount{0pt}%
-  \def\urefpoststretchamount{0pt}%
 }
 \let\Eraggedright\par
 
@@ -7573,7 +7403,7 @@ end
   \nonfillstart
   \tt % easiest (and conventionally used) font for verbatim
   % The \leavevmode here is for blank lines.  Otherwise, we would
-  % never \starttabox and the \egroup would end verbatim mode.
+  % never \starttabbox and the \egroup would end verbatim mode.
   \def\par{\leavevmode\egroup\box\verbbox\endgraf}%
   \tabexpand
   \setupmarkupstyle{verbatim}%
@@ -7636,9 +7466,12 @@ end
   {%
     \makevalueexpandable
     \setupverbatim
-    \indexnofonts       % Allow `@@' and other weird things in file names.
-    \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
-    \input #1
+    {%
+      \indexnofonts       % Allow `@@' and other weird things in file names.
+      \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
+      \edef\tmp{\noexpand\input #1 }
+      \expandafter
+    }\tmp
     \afterenvbreak
   }%
 }
@@ -7783,6 +7616,21 @@ end
   \fi\fi
 }
 
+% \dosubind {index}{topic}{subtopic}
+%
+% If SUBTOPIC is present, precede it with a space, and call \doind.
+% (At some time during the 20th century, this made a two-level entry in an 
+% index such as the operation index.  Nobody seemed to notice the change in 
+% behaviour though.)
+\def\dosubind#1#2#3{%
+  \def\thirdarg{#3}%
+  \ifx\thirdarg\empty
+    \doind{#1}{#2}%
+  \else
+    \doind{#1}{#2\space#3}%
+  \fi
+}
+
 % Untyped functions:
 
 % @deffn category name args
@@ -7797,7 +7645,6 @@ end
 % \deffngeneral {subind}category name args
 %
 \def\deffngeneral#1#2 #3 #4\endheader{%
-  % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}.
   \dosubind{fn}{\code{#3}}{#1}%
   \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
 }
@@ -8085,36 +7932,18 @@ end
   }
 \fi
 
-% alias because \c means cedilla in @tex or @math
-\let\texinfoc=\c
-
-\newcount\savedcatcodeone
-\newcount\savedcatcodetwo
-
 % Used at the time of macro expansion.
 % Argument is macro body with arguments substituted
 \def\scanmacro#1{%
   \newlinechar`\^^M
   \def\xeatspaces{\eatspaces}%
   %
-  % Temporarily undo catcode changes of \printindex.  Set catcode of @ to
-  % 0 so that @-commands in macro expansions aren't printed literally when 
-  % formatting an index file, where \ is used as the escape character.
-  \savedcatcodeone=\catcode`\@
-  \savedcatcodetwo=\catcode`\\
-  address@hidden
-  \catcode`\\=\active
-  %
   % Process the macro body under the current catcode regime.
-  address@hidden
-  %
-  address@hidden
-  \catcode`\\=\savedcatcodetwo
+  address@hidden
   %
-  % The \texinfoc is to remove the \newlinechar added by \scantokens, and
-  % can be noticed by \parsearg.
-  %   We avoid surrounding the call to \scantokens with \bgroup and \egroup
-  % to allow macros to open or close groups themselves.
+  % The \comment is to remove the \newlinechar added by \scantokens, and
+  % can be noticed by \parsearg.  Note \c isn't used because this means 
cedilla 
+  % in math mode.
 }
 
 % Used for copying and captions
@@ -8215,12 +8044,14 @@ end
 \def\macroargctxt{%
   \scanctxt
   \catcode`\ =\active
+  address@hidden
   \catcode`\^^M=\other
   \catcode`\\=\active
 }
 
 \def\macrolineargctxt{% used for whole-line arguments without braces
   \scanctxt
+  address@hidden
   \catcode`\{=\other
   \catcode`\}=\other
 }
@@ -8784,9 +8615,21 @@ end
 % also remove a trailing comma, in case of something like this:
 % @node Help-Cross,  ,  , Cross-refs
 \def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse}
-\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}}
+\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}\omittopnode}
+
+% Used so that the @top node doesn't have to be wrapped in an @ifnottex
+% conditional.
+% \doignore goes to more effort to skip nested conditionals but we don't need 
+% that here.
+\def\omittopnode{%
+   \ifx\lastnode\wordTop
+   \expandafter\ignorenode\fi
+}
+\def\wordTop{Top}
+
+% Divert output to a box that is not output until the next @node command.
+\def\ignorenode{\setbox\dummybox\vbox\bgroup\def\node{\egroup\node}}
 
-\let\nwnode=\node
 \let\lastnode=\empty
 
 % Write a cross-reference definition for the current node.  #1 is the
@@ -8809,7 +8652,7 @@ end
 
 % \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an
 % anchor), which consists of three parts:
-% 1) NAME-title - the current sectioning name taken from \lastsection,
+% 1) NAME-title - the current sectioning name taken from \currentsection,
 %                 or the anchor name.
 % 2) NAME-snt   - section number and type, passed as the SNT arg, or
 %                 empty for anchors.
@@ -8831,7 +8674,7 @@ end
        address@hidden #1 of \setref, expanded by the \edef
          ##1}{##2}}% these are parameters of \writexrdef
       }%
-      \toks0 = \expandafter{\lastsection}%
+      \toks0 = \expandafter{\currentsection}%
       \immediate \writexrdef{title}{\the\toks0 }%
       \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc.
       \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, at \shipout
@@ -9261,19 +9104,6 @@ end
   \catcode`\^^]=\other
   \catcode`\^^^=\other
   \catcode`\^^_=\other
-  % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc.
-  % in xref tags, i.e., node names.  But since ^^e4 notation isn't
-  % supported in the main text, it doesn't seem desirable.  Furthermore,
-  % that is not enough: for node names that actually contain a ^
-  % character, we would end up writing a line like this: 'xrdef {'hat
-  % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first
-  % argument, and \hat is not an expandable control sequence.  It could
-  % all be worked out, but why?  Either we support ^^ or we don't.
-  %
-  % The other change necessary for this was to define \auxhat:
-  % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter
-  % and then to call \auxhat in \setq.
-  %
   \catcode`\^=\other
   %
   % Special characters.  Should be turned off anyway, but...
@@ -9291,14 +9121,7 @@ end
   \catcode`\%=\other
   \catcode`+=\other % avoid \+ for paranoia even though we've turned it off
   %
-  % This is to support \ in node names and titles, since the \
-  % characters end up in a \csname.  It's easier than
-  % leaving it active and making its active definition an actual \
-  % character.  What I don't understand is why it works in the *value*
-  % of the xrdef.  Seems like it should be a catcode12 \, and that
-  % should not typeset properly.  But it works, so I'm moving on for
-  % now.  --karl, 15jan04.
-  \catcode`\\=\other
+  \catcode`\\=\active
   %
   % @ is our escape character in .aux files, and we need braces.
   \catcode`\{=1
@@ -9629,13 +9452,13 @@ end
       \global\advance\floatno by 1
       %
       {%
-        % This magic value for \lastsection is output by \setref as the
+        % This magic value for \currentsection is output by \setref as the
         % XREFLABEL-title value.  \xrefX uses it to distinguish float
         % labels (which have a completely different output format) from
         % node and anchor labels.  And \xrdef uses it to construct the
         % lists of floats.
         %
-        \edef\lastsection{\floatmagic=\safefloattype}%
+        \edef\currentsection{\floatmagic=\safefloattype}%
         \setref{\floatlabel}{Yfloat}%
       }%
     \fi
@@ -9758,7 +9581,7 @@ end
 
 % #1 is the control sequence we are passed; we expand into a conditional
 % which is true if #1 represents a float ref.  That is, the magic
-% \lastsection value which we \setref above.
+% \currentsection value which we \setref above.
 %
 \def\iffloat#1{\expandafter\doiffloat#1==\finish}
 %
@@ -11246,21 +11069,14 @@ directory should work if nowhere else does.}
    \relax
 }
 
-% define all Unicode characters we know about, for the sake of @U.
+% Define all Unicode characters we know about.  This makes UTF-8 the default
+% input encoding and allows @U to work.
 \iftxinativeunicodecapable
   \nativeunicodechardefsatu
 \else
   \utfeightchardefs
 \fi
 
-
-% Make non-ASCII characters printable again for compatibility with
-% existing Texinfo documents that may use them, even without declaring a
-% document encoding.
-%
-\setnonasciicharscatcode \other
-
-
 \message{formatting,}
 
 \newdimen\defaultparindent \defaultparindent = 15pt
@@ -11576,11 +11392,9 @@ directory should work if nowhere else does.}
 % \backslashcurfont outputs one backslash character in current font,
 % as in \char`\\.
 \global\chardef\backslashcurfont=`\\
-\global\let\rawbackslashxx=\backslashcurfont  % let existing .??s files work
 
-% \realbackslash is an actual character `\' with catcode other, and
-% \doublebackslash is two of them (for the pdf outlines).
-{\catcode`\\=\other @address@hidden @address@hidden
+% \realbackslash is an actual character `\' with catcode other.
+{\catcode`\\=\other @address@hidden
 
 % In Texinfo, backslash is an active character; it prints the backslash
 % in fixed width font.
@@ -11598,10 +11412,8 @@ directory should work if nowhere else does.}
 @address@hidden@tt @ifmmode @mathchar29020 @else @backslashcurfont @fi}}
 @address@hidden = @ttbackslash % @backslashchar{} is for user documents.
 
-% \rawbackslash defines an active \ to do \backslashcurfont.
 % \otherbackslash defines an active \ to be a literal `\' character with
-% catcode other.  We switch back and forth between these.
address@hidden@address@hidden@backslashcurfont}
+% catcode other.
 @address@hidden@address@hidden
 
 % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
@@ -11673,7 +11485,7 @@ directory should work if nowhere else does.}
   @address@hidden @let\ = @ttbackslash @fi
   @catcode13=5 % regular end of line
   @enableemergencynewline
-  @address@hidden@texinfoc
+  @address@hidden@comment
   @address@hidden@originalparsearg
   % Also turn back on active characters that might appear in the input
   % file name, in case not using a pre-dumped format.
diff --git a/doc/misc/todo-mode.texi b/doc/misc/todo-mode.texi
index 1e4ea85..18e5a8f 100644
--- a/doc/misc/todo-mode.texi
+++ b/doc/misc/todo-mode.texi
@@ -9,7 +9,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 2013-2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2013-2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index f682055..ac5aa68 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -13,7 +13,7 @@
 @footnotestyle end
 
 @copying
-Copyright @copyright{} 1999--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1999--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
@@ -86,7 +86,6 @@ Archive}.
 For the end user:
 
 * Obtaining @value{tramp}::             How to obtain @value{tramp}.
-* History::                     History of @value{tramp}.
 @ifset installchapter
 * Installation::                Installing @value{tramp} with your Emacs.
 @end ifset
@@ -379,32 +378,6 @@ $ autoconf
 @end example
 
 
address@hidden History
address@hidden History of @value{tramp}
address@hidden history
address@hidden development history
-
address@hidden development started at the end of November 1998 as
address@hidden  It provided only one method of access.  It used
address@hidden for login and @command{scp} to transfer file contents.
-The name was changed to @file{rcp.el} before it got its present name
address@hidden  New methods of remote access were added, so was support
-for version control.
-
-April 2000 was the first time when multi-hop methods were added.  In
-July 2002, @value{tramp} unified file names with Ange address@hidden  In July
-2004, proxy hosts replaced multi-hop methods.  Running commands on
-remote hosts was introduced in December 2005.  Support for gateways
-since April 2007 (and removed in December 2016).  GVFS integration
-started in February 2009.  Remote commands on MS Windows hosts since
-September 2011.  Ad-hoc multi-hop methods (with a changed syntax)
-re-enabled in November 2011.  In November 2012, added Juergen
-Hoetzel's @file{tramp-adb.el}.  Archive file names are supported since
-December 2017.
-
-XEmacs support was stopped in January 2016.  Since March 2017,
address@hidden syntax mandates a method.
-
 @c Installation chapter is necessary only in case of standalone
 @c installation.  Text taken from trampinst.texi.
 @ifset installchapter
@@ -495,6 +468,19 @@ The method @option{sg} stands for ``switch group''; the 
changed group
 must be used here as user name.  The default host name is the same.
 
 
address@hidden Start Guide: @option{sudoedit} method}
address@hidden Using @command{sudoedit}
address@hidden method @option{sudoedit}
address@hidden @option{sudoedit} method
+
+The @option{sudoedit} method is similar to the @option{sudo} method.
+However, it is a different implementation: it does not keep an open
+session running in the background.  This is for security reasons; on
+the backside this method is less performant than the @option{sudo}
+method, it is restricted to the @samp{localhost} only, and it does not
+support external processes.
+
+
 @anchor{Quick Start Guide: @option{smb} method}
 @section Using @command{smbclient}
 @cindex method @option{smb}
@@ -562,6 +548,18 @@ be accessed via the @command{adb} command.  No user or 
host name is
 needed.  The file name syntax is @address@hidden,,/path/to/file}}.
 
 
address@hidden Start Guide: @option{rclone} method}
address@hidden Using @command{rclone}
address@hidden method @option{rclone}
address@hidden @option{rclone} method
+
+A convenient way to access system storages is the @command{rclone}
+program.  If you have configured a storage in @command{rclone} under a
+name @samp{storage} (for example), you could access it via the remote
+file name syntax @address@hidden,storage,/path/to/file}}.  User
+names are not needed.
+
+
 @node Configuration
 @chapter Configuring @value{tramp}
 @cindex configuration
@@ -721,11 +719,17 @@ the host returned by the function 
@command{(system-name)}.  See
 Similar to @option{su} method, @option{sudo} uses @command{sudo}.
 @command{sudo} must have sufficient rights to start a shell.
 
+For security reasons, a @option{sudo} connection is disabled after a
+predefined timeout (5 minutes per default).  This can be changed, see
address@hidden connection information}.
+
 @item @option{doas}
 @cindex method @option{doas}
 @cindex @option{doas} method
 
-This method is used on OpenBSD like the @command{sudo} command.
+This method is used on OpenBSD like the @command{sudo} command.  Like
+the @option{sudo} method, a @option{doas} connection is disabled after
+a predefined timeout.
 
 @item @option{sg}
 @cindex method @option{sg}
@@ -928,6 +932,30 @@ NAS hosts.  These dumb devices have severely restricted 
local shells,
 such as the @command{busybox} and do not host any other encode or
 decode programs.
 
address@hidden @option{sudoedit}
address@hidden method @option{sudoedit}
address@hidden @option{sudoedit} method
+
+The @option{sudoedit} method allows to edit a file as a different user
+on the local host.  You could regard this as @value{tramp}'s
+implementation of the @command{sudoedit}.  Contrary to the
address@hidden method, all magic file name functions are implemented by
+single @command{sudo @dots{}}  commands.  The purpose is to make
+editing such a file as secure as possible; there must be no session
+running in the Emacs background which could be attacked from inside
+Emacs.
+
+Consequently, external processes are not implemented.
+
+The host name of such remote file names must represent the local host.
+Since the default value is already proper, it is recommended not to
+use any host name in the remote file name, like
address@hidden@trampfn{sudoedit,,/path/to/file}} or
address@hidden@trampfn{sudoedit,user@@,/path/to/file}}.
+
+Like the @option{sudo} method, a @option{sudoedit} password expires
+after a predefined timeout.
+
 @item @option{ftp}
 @cindex method @option{ftp}
 @cindex @option{ftp} method
@@ -1048,6 +1076,48 @@ specified using @file{device#42} host name syntax or 
@value{tramp} can
 use the default value as declared in @command{adb} command.  Port
 numbers are not applicable to Android devices connected through address@hidden
 
+
address@hidden @option{rclone}
address@hidden method @option{rclone}
address@hidden @option{rclone} method
+
address@hidden tramp-rclone-program
+The program @command{rclone} allows to access different system
+storages in the cloud, see @url{https://rclone.org/} for a list of
+supported systems.  If the @command{rclone} program isn't found in
+your @env{PATH} environment variable, you can tell Tramp its absolute
+path via the user option @code{tramp-rclone-program}.
+
+A system storage must be configured via the @command{rclone config}
+command, outside Emacs.  If you have configured a storage in
address@hidden under a name @samp{storage} (for example), you could
+access it via the remote file name
+
address@hidden
address@hidden,storage,/path/to/file}
address@hidden example
+
+User names are part of the @command{rclone} configuration, and not
+needed in the remote file name.  If a user name is contained in the
+remote file name, it is ignored.
+
+Internally, Tramp mounts the remote system storage at location
address@hidden/tmp/tramp.rclone.storage}, with @file{storage} being the name
+of the configured system storage.
+
+Optional flags to the different @option{rclone} operations could be
+passed as connection property, @xref{Predefined connection
+information}.  Supported properties are @samp{mount-args},
address@hidden and @samp{moveto-args}.
+
+Access via @option{rclone} is slow.  If you have an alternative method
+for accessing the system storage, you shall prefer this.  @ref{GVFS
+based methods} for example, methods @option{gdrive} and
address@hidden
+
address@hidden: The @option{rclone} method is experimental, don't use
+it in production systems!
+
 @end table
 
 
@@ -1374,7 +1444,8 @@ connect to @samp{bastion.your.domain}, then:
 @end lisp
 
 @var{proxy} can take patterns @code{%h} or @code{%u} for @var{host} or
address@hidden respectively.
address@hidden respectively.  Ports or domains, if they are part of
+a hop file name, are not expanded by those patterns.
 
 To login as @samp{root} on remote hosts in the domain
 @samp{your.domain}, but login as @samp{root} is disabled for non-local
@@ -1490,6 +1561,74 @@ predefined methods.  Any part of this list can be 
modified with more
 suitable settings.  Refer to the Lisp documentation of that variable,
 accessible with @kbd{C-h v tramp-methods @key{RET}}.
 
+In the ELPA archives, there are several examples of such extensions.
+They can be installed with Emacs' Package Manager.  This includes
+
address@hidden @samp
address@hidden @item anything-tramp
address@hidden @item counsel-tramp
address@hidden @item helm-tramp
address@hidden Contact Masashí Míyaura <address@hidden>
+
address@hidden @item ibuffer-tramp.el
address@hidden Contact Svend Sorensen <svend@@ciffer.net>
+
address@hidden docker-tramp
address@hidden method @option{docker}
address@hidden @option{docker} method
+Integration for Docker containers.  A container is accessed via
address@hidden@trampfn{docker,user@@container,/path/to/file}}, where
address@hidden is the (optional) user that you want to use, and
address@hidden is the id or name of the container.
+
address@hidden kubernetes-tramp
address@hidden method @option{kubectl}
address@hidden @option{kubectl} method
+Integration for Docker containers deployed in a Kubernetes cluster.
+It is derived from @samp{docker-tramp}.  A container is accessed via
address@hidden@trampfn{kubectl,user@@container,/path/to/file}}, @samp{user}
+and @samp{container} have the same meaning as in @samp{docker-tramp}.
+
address@hidden lxc-tramp
address@hidden method @option{lxc}
address@hidden @option{lxc} method
+Integration for LXC containers.  A container is accessed via
address@hidden@trampfn{lxc,container,/path/to/file}}, @samp{container} has the
+same meaning as in @samp{docker-tramp}.  A @samp{user} specification
+is ignored.
+
address@hidden lxd-tramp
address@hidden method @option{lxd}
address@hidden @option{lxd} method
+Integration for LXD containers.  A container is accessed via
address@hidden@trampfn{lxd,user@@container,/path/to/file}}, @samp{user} and
address@hidden have the same meaning as in @samp{docker-tramp}.
+
address@hidden magit-tramp
address@hidden method @option{git}
address@hidden @option{git} method
+Browing git repositories with @code{magit}.  A versioned file is accessed via
address@hidden@trampfn{git,rev@@root-dir,/path/to/file}}. @samp{rev} is a git
+revision, and @samp{root-dir} is a virtual host name for the root
+directory, specified in @code{magit-tramp-hosts-alist}.
+
address@hidden tramp-hdfs
address@hidden method @option{hdfs}
address@hidden @option{hdfs} method
+Access of a hadoop/hdfs file system.  A file is accessed via
address@hidden@trampfn{hdfs,user@@node,/path/to/file}}, where @samp{user} is
+the user that you want to use, and @samp{node} is the name of the
+hadoop server.
+
address@hidden vagrant-tramp
address@hidden method @option{vagrant}
address@hidden @option{vagrant} method
+Convenience method to access vagrant boxes.  It is often used in
+multi-hop file names like
address@hidden@address@hidden|address@hidden@value{postfix}/path/to/file},
+where @samp{box} is the name of the vagrant box.
address@hidden table
+
 
 @node Customizing Completion
 @section Selecting config files for user/host name completion
@@ -1668,6 +1807,16 @@ by setting the user option 
@code{auth-source-save-behavior} to @code{nil}.
 @vindex auth-source-debug
 Set @code{auth-source-debug} to @code{t} to debug messages.
 
address@hidden ange-ftp-netrc-filename
address@hidden that @file{auth-source.el} is not used for @option{ftp}
+connections, because @value{tramp} passes the work to Ange address@hidden  If
+you want, for example, use your @file{~/.authinfo.gpg} authentication
+file, you must customize @code{ange-ftp-netrc-filename}:
+
address@hidden
+(customize-set-variable 'ange-ftp-netrc-filename "~/.authinfo.gpg")
address@hidden lisp
+
 
 @anchor{Caching passwords}
 @subsection Caching passwords
@@ -1747,6 +1896,24 @@ The parameters @code{tramp-remote-shell} and
 @code{tramp-remote-shell-login} in @code{tramp-methods} now have new
 values for the remote host.
 
+A common use case is to override the session timeout of a connection,
+that is the time (in seconds) after a connection is disabled, and must
+be reestablished.  This can be set for any connection; for the
address@hidden and @option{doas} methods there exist predefined values.
+A value of @code{nil} disables this feature.  For example:
+
address@hidden
address@hidden
+(add-to-list 'tramp-connection-properties
+             (list (regexp-quote "@trampfn{sudo,root@@system-name,}")
+                   "session-timeout" 30))
address@hidden group
address@hidden lisp
+
address@hidden
address@hidden stands here for the host returned by the function
address@hidden(system-name)}.
+
 @var{property} could also be any property found in
 @code{tramp-persistency-file-name}.
 
@@ -1812,6 +1979,39 @@ preserves the path value, which can be used to update
 shell supports the login argument @samp{-l}.
 @end defopt
 
+Starting with Emacs 26, @code{tramp-remote-path} can be set per host
+via connection-local
address@hidden
+variables, @xref{Connection Variables, , , emacs}.
address@hidden ifinfo
address@hidden
+variables.
address@hidden ifnotinfo
+You could define your own search directories like this:
+
address@hidden
address@hidden
+(connection-local-set-profile-variables 'remote-path-with-bin
+   '((tramp-remote-path . ("~/bin" tramp-default-remote-path))))
address@hidden group
+
address@hidden
+(connection-local-set-profile-variables 'remote-path-with-apply-pub-bin
+   '((tramp-remote-path . ("/appli/pub/bin" tramp-default-remote-path))))
address@hidden group
+
address@hidden
+(connection-local-set-profiles
+   '(:application tramp :machine "randomhost") 'remote-path-with-bin)
address@hidden group
+
address@hidden
+(connection-local-set-profiles
+   '(:application tramp :user "anotheruser" :machine "anotherhost")
+     'remote-path-with-apply-pub-bin)
address@hidden group
address@hidden lisp
+
 When remote search paths are changed, local @value{tramp} caches must
 be recomputed.  To force @value{tramp} to recompute afresh, call
 @kbd{M-x tramp-cleanup-this-connection @key{RET}} or friends
@@ -2609,11 +2809,16 @@ proxy @samp{bird@@bastion} to a remote file on 
@samp{you@@remotehost}:
 @kbd{C-x C-f @address@hidden@@bastion|address@hidden@@address@hidden/path 
@key{RET}}
 @end example
 
+Each involved method must be an inline method (@pxref{Inline methods}).
+
 @value{tramp} adds the ad-hoc definitions on the fly to
address@hidden and is available for re-use
-during that Emacs session.  Subsequent @value{tramp} connections to
-the same remote host can then use the shortcut form:
address@hidden@trampfn{ssh,you@@remotehost,/path}}.
address@hidden and is available for re-use during
+that Emacs session.  Subsequent @value{tramp} connections to the same
+remote host can then use the shortcut form:
address@hidden@trampfn{ssh,you@@remotehost,/path}}.  Ad-hoc definitions are
+removed from @code{tramp-default-proxies-alist} via the command
address@hidden tramp-cleanup-all-connections @key{RET}} (@pxref{Cleanup
+remote connections}).
 
 @defopt tramp-save-ad-hoc-proxies
 For ad-hoc definitions to be saved automatically in
@@ -2798,7 +3003,7 @@ Starting with Emacs 26, you could use connection-local 
variables for
 setting different values of @code{explicit-shell-file-name} for
 different remote hosts.
 @ifinfo
address@hidden Local Variables, , , elisp}
address@hidden Variables, , , emacs}
 @end ifinfo
 
 @lisp
@@ -2851,6 +3056,14 @@ host.  Example:
 @kbd{M-x auto-revert-tail-mode @key{RET}} runs similarly showing
 continuous output.
 
address@hidden uses the variables @code{shell-file-name} and
address@hidden in order to determine which shell to run.
+For remote hosts, their default values are @file{/bin/sh} and
address@hidden, respectively (except for the @option{adb} method, which
+uses @file{/system/bin/sh}).  Like the variables in the previous
+section, these variables can be changed via connection-local
+variables.
+
 
 @subsection Running @code{eshell} on a remote host
 @cindex @code{eshell}
@@ -2994,7 +3207,8 @@ interactively, this command lists active remote 
connections in the
 minibuffer.  Each connection is of the format
 @address@hidden,user@@host,}}.  Flushing remote connections also
 cleans the password cache (@pxref{Password handling}), file cache,
-connection cache (@pxref{Connection caching}), and connection buffers.
+connection cache (@pxref{Connection caching}), recentf cache
+(@pxref{File Conveniences, , , emacs}), and connection buffers.
 @end deffn
 
 @deffn Command tramp-cleanup-this-connection
@@ -3004,13 +3218,15 @@ as in @code{tramp-cleanup-connection}.
 
 @deffn Command tramp-cleanup-all-connections
 Flushes all active remote connection objects, the same as in
address@hidden
address@hidden  This command removes also ad-hoc
+proxy definitions (@pxref{Ad-hoc multi-hops}).
+
 @end deffn
 
 @deffn Command tramp-cleanup-all-buffers
 Just as for @code{tramp-cleanup-all-connections}, all remote
-connections are cleaned up in addition to killing buffers related to
-that remote connection.
+connections and ad-hoc proxy definition are cleaned up in addition to
+killing buffers related to that remote connection.
 @end deffn
 
 
@@ -3682,7 +3898,9 @@ Due to the remote shell saving tilde expansions triggered 
by
 @value{tramp} can suppress this behavior with the user option
 @code{tramp-histfile-override}.  When set to @code{t}, environment
 variable @env{HISTFILE} is unset, and environment variables
address@hidden and @env{HISTSIZE} are set to 0.
address@hidden and @env{HISTSIZE} are set to 0.  Don't use this
+with @command{bash} 5.0.0.  There is a bug in @command{bash} which
+lets @command{bash} die.
 
 Alternatively, @code{tramp-histfile-override} could be a string.
 Environment variable @env{HISTFILE} is set to this file name then.  Be
@@ -4035,7 +4253,7 @@ export EDITOR=/path/to/emacsclient.sh
 
 
 @item
-How to determine wheter a buffer is remote?
+How to determine whether a buffer is remote?
 
 The buffer-local variable @code{default-directory} tells this.  If the
 form @code{(file-remote-p default-directory)} returns address@hidden,
diff --git a/doc/misc/trampver.texi b/doc/misc/trampver.texi
index aac7243..5b1408a 100644
--- a/doc/misc/trampver.texi
+++ b/doc/misc/trampver.texi
@@ -2,12 +2,12 @@
 @c texi/trampver.texi.  Generated from trampver.texi.in by configure.
 
 @c This is part of the Emacs manual.
address@hidden Copyright (C) 2003-2018 Free Software Foundation, Inc.
address@hidden Copyright (C) 2003-2019 Free Software Foundation, Inc.
 @c See file doclicense.texi for copying conditions.
 
 @c In the Tramp GIT, the version number is auto-frobbed from tramp.el,
 @c and the bug report address is auto-frobbed from configure.ac.
address@hidden trampver 2.4.1-pre
address@hidden trampver 2.4.2-pre
 @set tramp-bug-report-address tramp-devel@@gnu.org
 
 @c Other flags from configuration.
diff --git a/doc/misc/url.texi b/doc/misc/url.texi
index eaeae60..0cdfcac 100644
--- a/doc/misc/url.texi
+++ b/doc/misc/url.texi
@@ -21,7 +21,7 @@
 @copying
 This is the manual for the @code{url} Emacs Lisp library.
 
-Copyright @copyright{} 1993--1999, 2002, 2004--2018 Free Software
+Copyright @copyright{} 1993--1999, 2002, 2004--2019 Free Software
 Foundation, Inc.
 
 @quotation
diff --git a/doc/misc/vhdl-mode.texi b/doc/misc/vhdl-mode.texi
index c0efdbf..8af6586 100644
--- a/doc/misc/vhdl-mode.texi
+++ b/doc/misc/vhdl-mode.texi
@@ -10,7 +10,7 @@
 @copying
 This file documents VHDL Mode, an Emacs mode for editing VHDL code.
 
-Copyright @copyright{} 1995--2008, 2010, 2012, 2015--2018 Free Software
+Copyright @copyright{} 1995--2008, 2010, 2012, 2015--2019 Free Software
 Foundation, Inc.
 
 @quotation
diff --git a/doc/misc/vip.texi b/doc/misc/vip.texi
index 92aea38..47a3f34 100644
--- a/doc/misc/vip.texi
+++ b/doc/misc/vip.texi
@@ -4,7 +4,7 @@
 @include docstyle.texi
 
 @copying
-Copyright @copyright{} 1987, 2001--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1987, 2001--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/viper.texi b/doc/misc/viper.texi
index e67734b..922c91b 100644
--- a/doc/misc/viper.texi
+++ b/doc/misc/viper.texi
@@ -8,7 +8,7 @@
 @include docstyle.texi
 
 @copying
-Copyright @copyright{} 1995--1997, 2001--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 1995--1997, 2001--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/widget.texi b/doc/misc/widget.texi
index bf21ac3..6d94768 100644
--- a/doc/misc/widget.texi
+++ b/doc/misc/widget.texi
@@ -9,7 +9,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 2000--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2000--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/doc/misc/wisent.texi b/doc/misc/wisent.texi
index 12bb09c..b404c2a 100644
--- a/doc/misc/wisent.texi
+++ b/doc/misc/wisent.texi
@@ -24,7 +24,7 @@
 @c %**end of header
 
 @copying
-Copyright @copyright{} 1988--1993, 1995, 1998--2004, 2007, 2012--2018
+Copyright @copyright{} 1988--1993, 1995, 1998--2004, 2007, 2012--2019
 Free Software Foundation, Inc.
 
 @c Since we are both GNU manuals, we do not need to ack each other here.
diff --git a/doc/misc/woman.texi b/doc/misc/woman.texi
index f8ddbd2..9c04a14 100644
--- a/doc/misc/woman.texi
+++ b/doc/misc/woman.texi
@@ -15,7 +15,7 @@
 This file documents WoMan: A program to browse Unix manual pages ``W.O.
 (without) man''.
 
-Copyright @copyright{} 2001--2018 Free Software Foundation, Inc.
+Copyright @copyright{} 2001--2019 Free Software Foundation, Inc.
 
 @quotation
 Permission is granted to copy, distribute and/or modify this document
diff --git a/etc/AUTHORS b/etc/AUTHORS
index a0cd4a7..73c5245 100644
--- a/etc/AUTHORS
+++ b/etc/AUTHORS
@@ -9,7 +9,7 @@ Aaron Ecay: changed ob-R.el ob-core.el org-src.el ox-latex.el 
nsterm.m
   ob-awk.el ob-exp.el ob-python.el ob-tangle.el org-bibtex.el org-id.el
   org.el org.texi package.el paren.el
 
-Aaron Jensen: changed frameset.el Info.plist.in nsterm.m
+Aaron Jensen: changed frameset.el nsterm.m Info.plist.in mouse.el
 
 Aaron Larson: co-wrote bibtex.el
 
@@ -93,10 +93,10 @@ Alakazam Petrofsky: changed hanoi.el
 Alan Mackenzie: wrote cc-awk.el
 and co-wrote cc-align.el cc-cmds.el cc-defs.el cc-engine.el cc-fonts.el
   cc-langs.el cc-mode.el cc-styles.el cc-vars.el
-and changed cc-mode.texi bytecomp.el subr.el edebug.el modes.texi
-  syntax.texi display.texi font-lock.el isearch.el programs.texi
-  follow.el help.el ispell.el lread.c control.texi cus-start.el doc.c
-  eval.c frames.texi help-fns.el lisp.el and 133 other files
+and changed cc-mode.texi bytecomp.el subr.el edebug.el follow.el
+  modes.texi syntax.texi display.texi font-lock.el isearch.el
+  programs.texi help.el ispell.el lread.c windows.texi control.texi
+  cus-start.el doc.c eval.c frames.texi help-fns.el and 134 other files
 
 Alan Modra: changed unexelf.c
 
@@ -108,9 +108,9 @@ Alan Shutko: changed diary-lib.el calendar.el bindings.el 
cal-hebrew.el
 
 Alan Third: wrote dabbrev-tests.el
 and changed nsterm.m nsfns.m nsterm.h nsmenu.m frame.el macfont.m
-  nsimage.m ns-win.el conf_post.h frame.c frame.h frames.texi keyboard.c
-  macfont.h macos.texi picture.el rect.el Info.plist.in battery.el
-  callproc.c configure.ac and 11 other files
+  nsimage.m ns-win.el xdisp.c Info.plist.in conf_post.h frame.c frame.h
+  frames.texi keyboard.c macfont.h macos.texi picture.el rect.el
+  battery.el callproc.c and 12 other files
 
 Alastair Burt: changed gnus-art.el smiley.el
 
@@ -128,7 +128,7 @@ Alexander Gramiak: changed faces.el display-line-numbers.el 
xt-mouse.el
   CTAGS.good ETAGS.good_1 ETAGS.good_2 ETAGS.good_3 ETAGS.good_4
   ETAGS.good_5 ETAGS.good_6 Makefile TAGTEST.EL cl-lib-tests.el
   cl-macs-tests.el cus-start.el custom.texi display.texi erc-list.el
-  ert-tests.el ert.el etags.c and 15 other files
+  ert-tests.el ert.el etags.c and 16 other files
 
 Alexander Haeckel: changed getset.el
 
@@ -162,7 +162,8 @@ Alexandre Veyrenc: changed fr-refcard.tex
 Alexandru Harsanyi: wrote soap-client.el soap-inspect.el
 and changed emacs3.py vc-hooks.el vc.el xml.el
 
-Alex Branham: changed bibtex.el dired-x.el dired.el eww.el
+Alex Branham: changed bibtex.el dired-x.el dired.el em-rebind.el eww.el
+  imenu.el modes.texi programs.texi
 
 Alex Coventry: changed files.el
 
@@ -203,8 +204,8 @@ Ali Bahrami: changed configure configure.ac sol2-10.h
 
 Alin C. Soare: changed lisp-mode.el hexl.el
 
-Allen Li: changed abbrev.el comint.el dired-x.el misc.texi
-  progmodes/compile.el subr.el
+Allen Li: changed abbrev.el bookmark.el comint.el dired-x.el misc.texi
+  nsm.el progmodes/compile.el subr.el
 
 Allen S. Rout: changed org-capture.el
 
@@ -365,8 +366,8 @@ Antonin Houska: changed newcomment.el
 Arash Esbati: changed reftex-vars.el reftex.el reftex-auc.el
   reftex-ref.el
 
-Ari Roponen: changed atimer.c doc.c hash.texi mule.texi package.el
-  startup.el subr.el svg.el time-date.el woman.el
+Ari Roponen: changed xterm.c atimer.c doc.c hash.texi image.c mule.texi
+  package.el startup.el subr.el svg.el time-date.el woman.el
 
 Arisawa Akihiro: changed characters.el coding.c epa-file.el japan-util.el
   language/tibetan.el message.el mm-decode.el mm-view.el ps-print.el
@@ -439,9 +440,10 @@ Bartosz Duszel: changed allout.el bib-mode.el cc-cmds.el 
hexl.el icon.el
   sendmail.el ses.el simple.el verilog-mode.el vi.el vip.el viper-cmd.el
   xscheme.el
 
-Basil L. Contovounesios: changed simple.el message.el css-mode-tests.el
-  css-mode.el customize.texi gnus-art.el json-tests.el json.el man.el
-  shr-color.el text.texi
+Basil L. Contovounesios: changed simple.el message.el sequences.texi
+  bibtex.el css-mode-tests.el css-mode.el customize.texi display.texi
+  gnus-art.el json-tests.el json.el lists.texi man.el modes.texi rcirc.el
+  shr-color.el text.texi url-handlers.el
 
 Bastian Beischer: changed include.el mru-bookmark.el refs.el
   semantic/complete.el senator.el
@@ -469,8 +471,9 @@ Benjamin Andresen: wrote ob-screen.el
 Benjamin Drieu: wrote pong.el
 and changed org-clock.el org.el
 
-Benjamin Riefenstahl: changed w32select.c emacs.c inc/ms-w32.h lisp.h
-  mac-win.el macterm.c mule-cmds.el runemacs.c tcl.el w32.c w32.h
+Benjamin Riefenstahl: changed w32select.c emacs.c image-mode.el image.el
+  inc/ms-w32.h lisp.h mac-win.el macterm.c mule-cmds.el runemacs.c tcl.el
+  w32.c w32.h
 
 Benjamin Rutt: co-wrote gnus-dired.el
 and changed vc.el gnus-msg.el message.el diff-mode.el ffap.el nnimap.el
@@ -668,10 +671,10 @@ Changwoo Ryu: changed files.el
 
 Chao-Hong Liu: changed TUTORIAL.cn TUTORIAL.zh
 
-Charles A. Roelli: changed nsterm.m display.texi nsfns.m nsterm.h
-  org-clock.el DEBUG INSTALL add-log.el anti.texi buffers.texi comint.el
-  data.c diff-mode.el eldoc.el files.el fill.el find-func.el flymake.el
-  frame.el internals.texi macfont.m and 13 other files
+Charles A. Roelli: changed nsterm.m display.texi isearch.el nsfns.m
+  nsterm.h org-clock.el search.texi simple.el DEBUG INSTALL add-log.el
+  anti.texi buffers.texi comint.el data.c diff-mode.el eldoc.el files.el
+  fill.el find-func.el flymake.el and 21 other files
 
 Charles Hannum: changed aix3-1.h aix3-2.h configure ibmrs6000.h
   keyboard.c netbsd.h pop.c sysdep.c systime.h systty.h xrdb.c
@@ -701,7 +704,8 @@ and changed simple.el display.texi xdisp.c files.el 
frames.texi
 
 Chris Chase: co-wrote idlw-shell.el idlwave.el
 
-Chris Feng: changed dispnew.c autoload.el frame.c process.c
+Chris Feng: changed dispnew.c autoload.el frame.c keyboard-tests.el
+  keyboard.c process.c
 
 Chris Foote: changed progmodes/python.el
 
@@ -778,7 +782,7 @@ Christophe Deleuze: changed icalendar.el
 
 Christoph Egger: changed configure.ac
 
-Christophe Junke: changed org-agenda.el org.el
+Christophe Junke: changed ido.el org-agenda.el org.el
 
 Christopher Allan Webber: changed gamegrid.el org-agenda.el tetris.el
 
@@ -872,7 +876,8 @@ Dale Sedivec: changed sgml-mode.el wisent/python.el
 Damien Cassou: wrote auth-source-pass-tests.el
 and co-wrote auth-source-pass.el auth-source-tests.el
 and changed seq-tests.el seq.el simple-tests.el simple.el auth-source.el
-  auth.texi imenu-tests.el imenu.el info.el isearch.el sequences.texi
+  auth.texi imenu-tests.el imenu.el info.el isearch.el rmc.el
+  sequences.texi
 
 Damien Elmes: changed erc.el erc-dcc.el erc-track.el erc-log.el
   erc-pcomplete.el README erc-button.el erc-nets.el erc-ring.el Makefile
@@ -928,12 +933,16 @@ and changed package-test.el package-x.el ange-ftp.el
 
 Daniel Jensen: changed apropos.el
 
+Daniel Kahn Gillmor: changed mml-sec.el
+
 Daniel Koning: changed artist.el commands.texi subr.el
 
 Daniel LaLiberte: wrote cust-print.el edebug.el isearch.el
 and co-wrote hideif.el
 and changed mlconvert.el eval-region.el
 
+Daniel Lopez: changed progmodes/compile.el
+
 Daniel Lublin: changed dns-mode.el
 
 Daniel McClanahan: changed lisp-mode.el
@@ -1129,7 +1138,7 @@ and changed imenu.el pgg-def.el xterm.c
 David O'Toole: wrote ox-publish.el
 and co-wrote ob-lisp.el
 
-David Pathakjee: changed minibuf.c
+David Pathakjee: changed emacs-lisp/debug.el minibuf.c
 
 David Ponce: wrote bovine/grammar.el cedet.el comp.el java-tags.el
   mode-local.el recentf.el ruler-mode.el semantic/grammar.el
@@ -1205,7 +1214,8 @@ Derek Upham: changed nxml-mode.el
 Detlev Zundel: wrote re-builder.el
 and changed buffer.c
 
-Devon Sean McCullough: changed url-http.el comint.el ns-win.el
+Devon Sean McCullough: changed url-http.el buff-menu.el comint.el
+  ns-win.el
 
 Dhruva Krishnamurthy: changed emacsclient.c fontset.c sound.c w32proc.c
 
@@ -1290,7 +1300,7 @@ and co-wrote color.el
 and changed cus-edit.el dired.el faces.el files.el help-mode.el imenu.el
   info.el isearch.el ls-lisp.el menu-bar.el modes.texi mouse.el
   ange-ftp.el apropos.el bindings.el bookmark.el custom.el descr-text.el
-  dired.texi etags.el finder.el and 14 other files
+  dired.texi etags.el finder.el and 15 other files
 
 E. Choroba: changed simple.el
 
@@ -1343,9 +1353,9 @@ Eli Zaretskii: wrote [bidirectional display in xdisp.c]
   chartab-tests.el coding-tests.el doc-tests.el etags-tests.el rxvt.el
   tty-colors.el
 and changed xdisp.c msdos.c w32.c display.texi w32fns.c simple.el
-  files.el fileio.c w32proc.c keyboard.c w32term.c files.texi text.texi
-  dispnew.c emacs.c frames.texi lisp.h dispextern.h process.c term.c
-  window.c and 1111 other files
+  files.el fileio.c keyboard.c w32proc.c files.texi w32term.c text.texi
+  dispnew.c frames.texi emacs.c dispextern.h lisp.h process.c term.c
+  window.c and 1125 other files
 
 Emanuele Giaquinta: changed configure.ac rxvt.el charset.c etags.c
   fontset.c frame.el gnus-faq.texi loadup.el lread.c sh-script.el
@@ -1366,11 +1376,11 @@ and changed ada-stmt.el
 Era Eriksson: changed bibtex.el dired.el json.el ses.el ses.texi shell.el
   tramp.el tramp.texi
 
-Eric Abrahamsen: changed eieio-base.el nnimap.el registry.el
+Eric Abrahamsen: changed eieio-base.el registry.el nnimap.el
   gnus-registry.el files.el files.texi windows.texi eieio-test-persist.el
-  eieio.el gnus-start.el nnir.el buffers.texi files-tests.el
-  gnus-bcklg.el gnus-group.el gnus-sum.el gnus.texi nnmairix.el org.el
-  org.texi ox-html.el ox-latex.el
+  eieio.el gnus-start.el gnus-sum.el gnus.texi nnir.el buffers.texi
+  checkdoc.el files-tests.el gnus-bcklg.el gnus-group.el nnmairix.el
+  org.el org.texi and 3 other files
 
 Eric Bélanger: changed image.c
 
@@ -1548,8 +1558,8 @@ Ferenc Wagner: changed nnweb.el
 
 Filipe Cabecinhas: changed nsterm.m
 
-Filipp Gunbin: changed autorevert.el shell.el cc-menus.el dired-aux.el
-  info.el info.texi
+Filipp Gunbin: changed autorevert.el shell.el auth-source-tests.el
+  auth-source.el cc-menus.el dired-aux.el info.el info.texi
 
 Flemming Hoejstrup Hansen: changed forms.el
 
@@ -1655,6 +1665,8 @@ Gary Delp: wrote mailpost.el (public domain)
 Gary D. Foster: wrote crisp.el scroll-all.el
 and changed gnus-group.el gnus-topic.el
 
+Gary Fredericks: changed window.el
+
 Gary Howell: changed server.el
 
 Gary Oberbrunner: changed gud.el
@@ -1668,11 +1680,11 @@ G Dinesh Dutt: changed etags.el
 Geert Kloosterman: changed which-func.el
 
 Gemini Lasswell: wrote edebug-tests.el kmacro-tests.el testcover-tests.el
-and changed edebug.el cl-macs.el cl-generic.el ert-x.el
+and changed edebug.el cl-macs.el cl-generic.el ert-x.el cl-print.el
   edebug-test-code.el edebug.texi eieio-compat.el generator.el subr.el
-  autorevert-tests.el filenotify-tests.el generator-tests.el kmacro.el
-  lread.c map-tests.el map.el pcase.el rst.el ses.el subr-tests.el
-  subr-x-tests.el and 4 other files
+  autorevert-tests.el cl-print-tests.el emacs-lisp/debug.el eval-tests.el
+  eval.c filenotify-tests.el generator-tests.el kmacro.el lread.c
+  map-tests.el map.el and 9 other files
 
 Geoff Gole: changed align.el ibuffer.el whitespace.el
 
@@ -1727,9 +1739,9 @@ Giuseppe Scrivano: changed browse-url.el buffer.c 
configure.ac sysdep.c
 Glenn Morris: wrote check-declare.el f90-tests.el vc-bzr-tests.el
 and changed configure.ac Makefile.in src/Makefile.in calendar.el
   diary-lib.el lisp/Makefile.in files.el rmail.el make-dist
-  progmodes/f90.el bytecomp.el simple.el authors.el emacs.texi
-  misc/Makefile.in admin.el startup.el lib-src/Makefile.in ack.texi
-  display.texi cal-menu.el and 1675 other files
+  progmodes/f90.el bytecomp.el simple.el authors.el admin.el emacs.texi
+  misc/Makefile.in startup.el lib-src/Makefile.in ack.texi display.texi
+  cal-menu.el and 1681 other files
 
 Glynn Clements: wrote gamegrid.el snake.el tetris.el
 
@@ -1775,7 +1787,7 @@ Grégory Mounié: changed man.el
 
 Gregory Neil Shapiro: changed mailabbrev.el
 
-Gregor Zattler: changed emacs-lisp-intro.texi
+Gregor Zattler: changed eshell.texi emacs-lisp-intro.texi
 
 Greg Stark: changed gnus-ems.el timezone.el
 
@@ -1974,8 +1986,8 @@ Ivan Radanov Ivanov: changed quail/cyrillic.el
 
 Ivan Shmakov: changed eww.el shr.el desktop.el eww.texi faces.el files.el
   cus-dep.el descr-text.el diff-mode.el enriched.el erc-track.el
-  facemenu.el files.texi misearch.el nndoc.el simple.el tar-mode.el
-  tcl.el tex-mode.el url-cookie.el
+  facemenu.el files.texi iso-transl.el misearch.el nndoc.el simple.el
+  tar-mode.el tcl.el tex-mode.el url-cookie.el
 
 Ivan Vilata i Balaguer: changed org-clock.el org.texi
 
@@ -2122,7 +2134,7 @@ Jay Belanger: changed calc.texi calc.el calc-ext.el 
calc-units.el
 
 Jay K. Adams: wrote jka-cmpr-hook.el jka-compr.el
 
-Jay Kamat: changed erc-goodies.el
+Jay Kamat: changed erc-goodies.el esh-opt.el
 
 Jay McCarthy: changed org-colview.el
 
@@ -2134,6 +2146,7 @@ and changed idlw-rinfo.el idlw-toolbar.el comint.el 
idlwave.texi vc.el
   mouse.el
 
 Jean-Christophe Helary: changed ns-win.el strings.texi subr-x.el
+  ucs-normalize.el
 
 Jean Haidouk: changed latin-alt.el latin-post.el latin-pre.el
 
@@ -2376,6 +2389,8 @@ John Paul Wallington: changed ibuffer.el ibuf-ext.el 
subr.el help-fns.el
   bytecomp.el cus-theme.el font-lock.el hexl.el ibuf-macs.el info.el
   minibuf.c re-builder.el simple.el startup.el and 135 other files
 
+John Shahid: changed easy-mmode.el term.c termhooks.h terminal.c
+
 John Sullivan: changed window.c
 
 John Tobey: changed gud.el
@@ -2415,6 +2430,9 @@ Jonathan I. Kamens: changed pop.c movemail.c rmail.el 
configure.ac b2m.pl
   vc.el gnus-sum.el jka-compr.el rmailout.el rnewspost.el sendmail.el
   simple.el timezone.el vc-hooks.el
 
+Jonathan Kyle Mitchell: changed em-dirs.el em-ls.el em-unix.el esh-cmd.el
+  esh-ext.el
+
 Jonathan Leech-Pepin: wrote ox-texinfo.el
 
 Jonathan Marchand: changed cpp-root.el
@@ -2438,6 +2456,8 @@ Joost Diepenmaat: changed org.el
 
 Joost Kremers: changed reftex-toc.el
 
+Jordan Wilson: changed doc-view.el
+
 Jorge A. Alfaro-Murillo: changed message.el
 
 Jorgen Schäfer: wrote erc-autoaway.el erc-goodies.el erc-spelling.el
@@ -2531,9 +2551,9 @@ and changed tramp-gvfs.el tramp-sh.el comint.el 
em-unix.el esh-util.el
 
 Juri Linkov: wrote files-x.el misearch.el replace-tests.el
 and changed isearch.el info.el replace.el simple.el progmodes/grep.el
-  dired-aux.el dired.el progmodes/compile.el startup.el faces.el files.el
+  dired.el dired-aux.el progmodes/compile.el startup.el faces.el files.el
   menu-bar.el bindings.el display.texi descr-text.el desktop.el comint.el
-  image-mode.el ispell.el man.el cus-edit.el and 357 other files
+  image-mode.el ispell.el man.el cus-edit.el and 359 other files
 
 Jussi Lahdenniemi: changed w32fns.c ms-w32.h msdos.texi w32.c w32.h
   w32console.c w32heap.c w32inevt.c w32term.h
@@ -2590,9 +2610,10 @@ Karl Eichwalder: changed Makefile.in add-log.el 
bookmark.el dired-aux.el
 Karl Fogel: wrote bookmark.el mail-hist.el saveplace.el
 and co-wrote pcvs.el
 and changed simple.el files.el doc-view.el image-mode.el info.el
-  vc-svn.el CONTRIBUTE INSTALL autogen.sh isearch.el menu-bar.el
-  simple-test.el subr.el tex-mode.el thingatpt.el INSTALL.REPO comint.el
-  configure configure.ac editfns.c electric-tests.el and 17 other files
+  vc-svn.el CONTRIBUTE INSTALL autogen.sh internals.texi isearch.el
+  menu-bar.el simple-test.el subr.el tex-mode.el thingatpt.el
+  INSTALL.REPO comint.el configure configure.ac editfns.c
+  and 18 other files
 
 Karl Heuer: changed keyboard.c lisp.h xdisp.c buffer.c xfns.c xterm.c
   alloc.c files.el frame.c configure.ac window.c data.c minibuf.c
@@ -2622,9 +2643,9 @@ Károly Lőrentey: changed xfns.c bindings.el keyboard.c 
menu-bar.el
 Katsuhiro Hermit Endo: changed gnus-group.el gnus-spec.el
 
 Katsumi Yamaoka: wrote canlock.el
-and changed gnus-art.el gnus-sum.el message.el mm-decode.el gnus.texi
-  mm-util.el mm-view.el gnus-util.el gnus-group.el gnus-msg.el shr.el
-  mml.el rfc2047.el gnus-start.el gnus.el nntp.el gnus-agent.el nnrss.el
+and changed gnus-art.el message.el gnus-sum.el mm-decode.el gnus.texi
+  mm-util.el mm-view.el gnus-util.el gnus-group.el gnus-msg.el mml.el
+  shr.el rfc2047.el gnus-start.el gnus.el nntp.el gnus-agent.el nnrss.el
   mm-uu.el nnmail.el emacs-mime.texi and 160 other files
 
 Kaushal Modi: changed files.el isearch.el apropos.el calc-yank.el
@@ -2858,7 +2879,7 @@ and co-wrote gnus-kill.el gnus-mh.el gnus-msg.el 
gnus-score.el
   rfc2047.el time-date.el
 and changed gnus.texi process.c gnus-ems.el subr.el gnutls.c gnus-cite.el
   pop3.el smtpmail.el display.texi files.el url-http.el gnus-xmas.el
-  simple.el auth-source.el image.c proto-stream.el gnutls.el dired.el
+  simple.el auth-source.el image.c gnutls.el proto-stream.el dired.el
   image.el text.texi nnrss.el and 318 other files
 
 Lars Rasmusson: changed ebrowse.c
@@ -2901,8 +2922,8 @@ Leo Liu: wrote calc-tests.el pcmpl-x.el
 and changed octave.el ido.el rcirc.el files.el subr.el lisp-mode.el
   eldoc.el simple.el flymake.el smie.el abbrev.el progmodes/python.el
   cfengine.el cl-extra.el cl-macs.el emacs-lisp/cl-lib.el fns.c
-  progmodes/compile.el register.el rng-valid.el window.el
-  and 164 other files
+  progmodes/compile.el register.el rng-valid.el thingatpt.el
+  and 166 other files
 
 Leonard H. Tower Jr.: changed rnews.el rnewspost.el emacsbug.el
   rmailout.el sendmail.el
@@ -3040,9 +3061,9 @@ and changed erc.el erc-dcc.el erc-speak.el Makefile 
erc-bbdb.el
 
 Mark A. Hershberger: changed xml.el nnrss.el mm-url.el cperl-mode.el
   isearch.el vc-bzr.el  NXML-NEWS cc-mode.texi compilation.txt ede.texi
-  eieio.texi esh-mode.el flymake.el gnus-group.el misc/Makefile.in
-  nxml-mode.texi progmodes/compile.el progmodes/python.el programs.texi
-  schema and 6 other files
+  eieio.texi esh-mode.el flymake.el gnus-group.el menu-bar.el
+  misc/Makefile.in nxml-mode.texi progmodes/compile.el
+  progmodes/python.el programs.texi and 8 other files
 
 Mark Davies: changed amdx86-64.h configure configure.ac hp800.h
   lib-src/Makefile.in netbsd.h ralloc.c sh3el.h sort.el
@@ -3113,7 +3134,7 @@ Markus Triska: wrote linum.el
 and changed bytecomp.el byte-opt.el doctor.el image-mode.el
   processes.texi calc-math.el emacs.c expand.el flymake.el flymake.texi
   flyspell.el handwrite.el internals.texi proced.el prolog.el ps-mode.el
-  speedbar.el subr.el tumme.el widget.texi xterm.c
+  speedbar.el subr.el tumme.el widget.texi windows.texi xterm.c
 
 Mark W. Eichin: changed keyboard.c xterm.c
 
@@ -3146,7 +3167,7 @@ Martin Pohlack: changed iimage.el pc-select.el
 Martin Rudalics: changed window.el window.c windows.texi frame.c
   frames.texi w32fns.c xdisp.c xterm.c w32term.c frame.el xfns.c help.el
   buffer.c display.texi cus-start.el dispnew.c frame.h mouse.el nsfns.m
-  window.h gtkutil.c and 201 other files
+  window.h gtkutil.c and 203 other files
 
 Martin Stjernholm: wrote cc-bytecomp.el
 and co-wrote cc-align.el cc-cmds.el cc-compat.el cc-defs.el cc-engine.el
@@ -3217,7 +3238,7 @@ Matthew Mundell: changed calendar.texi diary-lib.el 
files.texi
   objects.texi os.texi positions.texi searching.texi subr.el text.texi
   and 3 other files
 
-Matthias Dahl: changed faces.el
+Matthias Dahl: changed faces.el process.c process.h
 
 Matthias Förste: changed files.el
 
@@ -3249,6 +3270,8 @@ Matt Simmons: changed message.el
 Matt Swift: changed dired.el editfns.c lisp-mode.el mm-decode.el
   outline.el progmodes/compile.el rx.el simple.el startup.el
 
+Mauro Aranda: changed files.texi os.texi
+
 Maxime Edouard Robert Froumentin: changed gnus-art.el mml.el
 
 Max Mikhanosha: changed org-agenda.el org-habit.el org.el
@@ -3259,15 +3282,15 @@ Micah Anderson: changed spook.lines
 
 Michael Albinus: wrote autorevert-tests.el dbus-tests.el dbus.el
   filenotify-tests.el filenotify.el files-x-tests.el secrets.el
-  tramp-cmds.el tramp-compat.el tramp-ftp.el tramp-gvfs.el tramp-smb.el
-  tramp-tests.el url-tramp-tests.el url-tramp.el vc-tests.el xesam.el
-  zeroconf.el
+  shadowfile-tests.el tramp-cmds.el tramp-compat.el tramp-ftp.el
+  tramp-gvfs.el tramp-smb.el tramp-tests.el url-tramp-tests.el
+  url-tramp.el vc-tests.el xesam.el zeroconf.el
 and co-wrote tramp-cache.el tramp-sh.el tramp.el
 and changed tramp.texi tramp-adb.el trampver.el trampver.texi dbusbind.c
   file-notify-tests.el ange-ftp.el files.el dbus.texi files.texi
   autorevert.el tramp-fish.el kqueue.c tramp-gw.el tramp-imap.el os.texi
   configure.ac lisp.h gfilenotify.c inotify.c keyboard.c
-  and 217 other files
+  and 224 other files
 
 Michael Ben-Gershon: changed acorn.h configure.ac riscix1-1.h riscix1-2.h
   unexec.c
@@ -3300,8 +3323,8 @@ Michael Gschwind: wrote iso-cvt.el
 
 Michael Harnois: changed nnimap.el
 
-Michael Heerdegen: changed subr-x.el control.texi dired.el easy-mmode.el
-  eldoc.el pcase.el shr.el subr-x-tests.el wdired.el
+Michael Heerdegen: changed subr-x.el control.texi dired-aux.el dired.el
+  easy-mmode.el eldoc.el pcase.el shr.el subr-x-tests.el wdired.el
 
 Michael Hoffman: changed term.el xterm.el
 
@@ -3387,6 +3410,8 @@ and changed gnus-score.el
 
 Michihito Shigemura: changed sh-script.el
 
+Miciah Masters: changed rcirc.el rcirc.texi
+
 Microelectronics and Computer Technology Corporation: changed
   emacsclient.c etags.c lisp.h movemail.c rmail.el rmailedit.el
   rmailkwd.el rmailmsc.el rmailout.el rmailsum.el scribe.el server.el
@@ -3410,8 +3435,8 @@ Mike Haertel: changed 7300.h
 
 Mike Kazantsev: changed erc-dcc.el
 
-Mike Kupfer: changed mh-e.el emacs-mime.texi gnus-mh.el gnus.texi
-  mh-acros.el mh-comp.el mh-compat.el mh-e.texi mh-mime.el mh-utils.el
+Mike Kupfer: changed mh-comp.el mh-e.el emacs-mime.texi gnus-mh.el
+  gnus.texi mh-acros.el mh-compat.el mh-e.texi mh-mime.el mh-utils.el
 
 Mike Lamb: changed em-unix.el esh-util.el pcmpl-unix.el
 
@@ -3529,6 +3554,8 @@ Niall Mansfield: changed etags.c
 
 Nic Ferrier: changed ert.el tramp.el
 
+Nicholas Drozd: changed calc.texi
+
 Nicholas Maniscalco: changed term.el
 
 Nick Alcock: changed control.texi customize.texi display.texi files.el
@@ -3538,6 +3565,8 @@ Nick Alcock: changed control.texi customize.texi 
display.texi files.el
 Nick Dokos: changed org-table.el ox.el icalendar.el mh-search.el
   org-mobile.el org.el ox-ascii.el url-cache.el
 
+Nick Drozd: changed eww.el eww.texi
+
 Nick Helm: changed eldoc.el help.el help.texi whitespace-tests.el
   whitespace.el
 
@@ -3569,11 +3598,11 @@ Nicolas Graner: changed message.el
 Nicolas Petton: wrote map-tests.el map.el seq-tests.el seq.el
   thunk-tests.el thunk.el
 and co-wrote auth-source-pass.el auth-source-tests.el subr-tests.el
-and changed sequences.texi README configure.ac sed2v2.inp authors.el
-  emacs.png README.W32 emacs23.png arc-mode.el cl-extra.el emacs.svg
-  manoj-dark-theme.el Emacs.icns Makefile.in auth-source.el emacs.ico
-  fns.c make-tarball.txt obarray-tests.el obarray.el HISTORY
-  and 34 other files
+and changed README configure.ac sed2v2.inp sequences.texi authors.el
+  README.W32 emacs.png emacs23.png arc-mode.el cl-extra.el emacs.svg
+  manoj-dark-theme.el Emacs.icns HISTORY Makefile.in auth-source.el
+  emacs.ico fns.c make-tarball.txt obarray-tests.el obarray.el
+  and 35 other files
 
 Nicolas Richard: wrote cl-seq-tests.el cmds-tests.el replace-tests.el
 and changed ffap.el package.el byte-run.el help.el keyboard.c landmark.el
@@ -3616,11 +3645,11 @@ and changed rsz-mini.el emacs-buffer.gdb comint.el 
files.el Makefile
 
 Noah Lavine: changed tramp.el
 
-Noam Postavsky: changed progmodes/python.el lisp-mode.el xdisp.c
-  cl-macs.el emacs-lisp/debug.el data.c ert.el lisp-mode-tests.el
-  simple.el help-fns.el subr.el term.el bytecomp.el elisp-mode.el eval.c
-  ffap.el modes.texi search.c sh-script.el cl-preloaded.el cl-print.el
-  and 223 other files
+Noam Postavsky: changed lisp-mode.el progmodes/python.el xdisp.c
+  cl-macs.el lisp-mode-tests.el emacs-lisp/debug.el data.c simple.el
+  term.el ert.el subr.el help-fns.el bytecomp.el cl-print.el
+  elisp-mode.el eval.c ffap.el modes.texi search.c sh-script.el
+  cl-preloaded.el and 248 other files
 
 Nobuyoshi Nakada: co-wrote ruby-mode.el
 
@@ -3721,10 +3750,10 @@ and changed imenu.el make-mode.el
 
 Paul Eggert: wrote rcs2log
 and co-wrote cal-dst.el
-and changed lisp.h configure.ac alloc.c process.c fileio.c xdisp.c
-  editfns.c sysdep.c image.c keyboard.c emacs.c xterm.c data.c lread.c
+and changed lisp.h configure.ac alloc.c process.c fileio.c editfns.c
+  xdisp.c sysdep.c keyboard.c image.c emacs.c xterm.c data.c lread.c
   fns.c callproc.c Makefile.in gnulib.mk eval.c buffer.c frame.c
-  and 1596 other files
+  and 1608 other files
 
 Paul Fisher: changed fns.c
 
@@ -3883,6 +3912,8 @@ and changed package.el pcmpl-unix.el subr.el
 
 Philip Jackson: wrote find-cmd.el org-irc.el
 
+Philip K: changed ispell.el
+
 Philippe Schnoebelen: wrote gomoku.el mpuz.el
 
 Philippe Vaucher: changed callint.c composite.el debugging.texi
@@ -3898,11 +3929,11 @@ Philipp Rumpf: changed electric.el
 Philipp Stephani: wrote checkdoc-tests.el ediff-diff-tests.el
   eval-tests.el ido-tests.el lread-tests.el mouse-tests.el
   xt-mouse-tests.el
-and changed emacs-module.c eval.c bytecomp.el emacs-module-tests.el
-  files.el lread.c nsterm.m configure.ac editfns.c mod-test.c alloc.c
-  electric.el gtkutil.c lisp.h electric-tests.el emacs.c macfont.m
-  test/Makefile.in xt-mouse.el Makefile bytecomp-tests.el
-  and 95 other files
+and changed emacs-module.c eval.c bytecomp.el nsterm.m
+  emacs-module-tests.el files.el lread.c configure.ac editfns.c
+  mod-test.c alloc.c electric.el gtkutil.c lisp.h electric-tests.el
+  emacs.c macfont.m test/Makefile.in xt-mouse.el Makefile
+  bytecomp-tests.el and 96 other files
 
 Phillip Lord: wrote ps-print-tests.el
 and changed lisp/Makefile.in undo.c simple.el test/Makefile.in Makefile
@@ -3911,8 +3942,8 @@ and changed lisp/Makefile.in undo.c simple.el 
test/Makefile.in Makefile
   dired.el eieio-tests.el fileio.c htmlfontify.el
   make-test-deps.emacs-lisp reftex-tests.el and 168 other files
 
-Phil Sainty: changed derived.el easy-mmode.el lisp.el package.el
-  progmodes/grep.el simple.el subword.el term.el
+Phil Sainty: changed term.el derived.el easy-mmode.el lisp.el package.el
+  progmodes/grep.el simple.el subword.el
 
 Phil Sung: changed wdired.el dired.texi follow.el progmodes/python.el
 
@@ -3920,7 +3951,7 @@ Pierre Lorenzon: changed eieio-custom.el
 
 Pierre Poissinger: changed charset.c
 
-Pierre Téchoueyres: changed eieio-test-persist.el tramp-cmds.el
+Pierre Téchoueyres: changed eieio-test-persist.el epg.el tramp-cmds.el
 
 Pieter E.J. Pareit: wrote mixal-mode.el
 
@@ -3959,6 +3990,8 @@ Rafael Sepúlveda: changed TUTORIAL.es
 
 Raffael Mancini: changed misc.el
 
+Raimon Grau: changed replace.el thingatpt.el
+
 Rainer Orth: changed gtkutil.c lisp/Makefile.in
 
 Rainer Schöpf: changed osf1.h unexalpha.c alloc.c alpha.h buffer.c
@@ -4096,7 +4129,7 @@ Rick Frankel: changed ox-html.el ob-sql.el org.texi
 Rick Sladkey: wrote backquote.el
 and changed gud.el intervals.c intervals.h simple.el
 
-Rob Browning: changed tls.el configure.ac
+Rob Browning: changed tls.el configure.ac ibuffer-tests.el tramp-tests.el
 
 Rob Christie: changed nsmenu.m
 
@@ -4125,10 +4158,10 @@ Roberto Rodríguez: changed ada-mode.texi glossary.texi 
widget.texi
 
 Robert P. Goldman: changed org.texi ob-exp.el org.el ox-latex.el
 
-Robert Pluim: changed gtkutil.c misc.texi vc-git.el xfns.c xterm.c
-  bindings.el configure.ac desktop.el dired-x.texi epa.texi gnus-agent.el
-  gnus-demon.el gnus.texi ido.el image-mode.el minibuf.c minibuf.texi
-  org-agenda.el process.c progmodes/grep.el project.el and 8 other files
+Robert Pluim: changed gtkutil.c configure.ac files.texi dired-x.texi
+  ftfont.c misc.texi process.c vc-git.el xfns.c xterm.c bindings.el
+  desktop.el efaq.texi epa.texi filelock.c font.c ftcrfont.c
+  gnus-agent.el gnus-demon.el gnus.texi gtkutil.h and 19 other files
 
 Robert Thorpe: changed cus-start.el indent.el
 
@@ -4245,7 +4278,7 @@ Sam Kendall: changed etags.c etags.el
 
 Sam Steingold: wrote gulp.el midnight.el
 and changed progmodes/compile.el cl-indent.el simple.el vc-cvs.el vc.el
-  mouse.el files.el font-lock.el tex-mode.el vc-hg.el ange-ftp.el
+  mouse.el vc-hg.el files.el font-lock.el tex-mode.el ange-ftp.el
   sgml-mode.el window.el add-log.el bindings.el bookmark.el
   bug-reference.el calendar.el cperl-mode.el diary-lib.el dired.el
   and 152 other files
@@ -4293,6 +4326,8 @@ Scott Bender: co-wrote ns-win.el
 Scott Byer: co-wrote nnfolder.el
 and changed gnus-sum.el
 
+Scott Corley: changed scroll.c
+
 Scott Draves: wrote tq.el
 
 Scott Evans: changed rect.el
@@ -4354,6 +4389,8 @@ and changed ob-maxima.el ob-octave.el
 
 Sergey Poznyakoff: changed rmail.el mh-mime.el rmail.texi smtpmail.el
 
+Sergey Vinokurov: changed emacs-module-tests.el emacs-module.c mod-test.c
+
 Sergio Durigan Junior: changed eudcb-bbdb.el gdb-mi.el
 
 Sergio Martinez: changed nnimap.el
@@ -4381,8 +4418,8 @@ and changed gnus-art.el message.el gnus-sum.el 
gnus-msg.el gnus.el
   and 93 other files
 
 Shigeru Fukaya: wrote bytecomp-tests.el
-and changed apropos.el byte-opt.el bytecomp.el elint.el rx-new.el ses.el
-  subr.el texinfmt.el
+and changed apropos.el bs.el byte-opt.el bytecomp.el elint.el rx-new.el
+  ses.el subr.el texinfmt.el
 
 Shinichirou Sugou: changed etags.c
 
@@ -4407,7 +4444,8 @@ Simen Heggestøyl: wrote color-tests.el css-mode-tests.el 
dom-tests.el
   ring-tests.el rot13-tests.el sql-tests.el
 and changed css-mode.el json-tests.el json.el sgml-mode.el css-mode.css
   scss-mode.scss ring.el rot13.el scheme.el sql.el color.el files.el
-  js.el less-css-mode.el less-css-mode.less maintaining.texi
+  js.el less-css-mode.el less-css-mode.less maintaining.texi midnight.el
+  seq.el sequences.texi
 
 Simon Josefsson: wrote dig.el dns-mode.el flow-fill.el fringe.el imap.el
   mml-sec.el mml-smime.el password-cache.el rfc2104.el sieve-mode.el
@@ -4471,8 +4509,8 @@ Stefan Monnier: wrote bibtex-style.el bytecomp-tests.el 
bzrmerge.el
 and co-wrote font-lock.el gitmerge.el pcvs.el
 and changed subr.el simple.el keyboard.c lisp.h bytecomp.el files.el
   vc.el cl-macs.el xdisp.c alloc.c eval.c sh-script.el
-  progmodes/compile.el keymap.c tex-mode.el newcomment.el window.c
-  buffer.c lisp-mode.el lread.c vc-hooks.el and 1280 other files
+  progmodes/compile.el keymap.c tex-mode.el newcomment.el buffer.c
+  window.c lisp-mode.el lread.c vc-hooks.el and 1282 other files
 
 Stefano Facchini: changed gtkutil.c
 
@@ -4503,10 +4541,10 @@ Stephen A. Wood: changed fortran.el
 Stephen Berman: wrote todo-mode-tests.el
 and co-wrote todo-mode.el
 and changed todo-mode.texi diary-lib.el dired-tests.el doc-view.el
-  files.el minibuffer.el dired.el frames.texi hl-line.el info.el
-  menu-bar.el mouse.el otodo-mode.el subr.el .gitattributes allout.el
-  artist.el compile.texi cus-start.el descr-text.el dframe.el
-  and 39 other files
+  files.el minibuffer.el wdired-tests.el dired.el frames.texi hl-line.el
+  info.el menu-bar.el mouse.el otodo-mode.el subr.el .gitattributes
+  TUTORIAL allout.el artist.el compile.texi cus-start.el
+  and 43 other files
 
 Stephen C. Gilardi: changed configure.ac
 
@@ -4527,8 +4565,8 @@ and changed time-stamp.el mh-e.el mh-comp.el mh-utils.el 
mh-customize.el
 Stephen J. Turnbull: changed ediff-init.el strings.texi subr.el
 
 Stephen Leake: wrote elisp-mode-tests.el
-and changed ada-mode.el ada-xref.el elisp-mode.el mode-local.el xref.el
-  CONTRIBUTE vc-mtn.el window.el ada-mode.texi ada-prj.el cedet-global.el
+and changed ada-mode.el ada-xref.el elisp-mode.el mode-local.el window.el
+  xref.el CONTRIBUTE vc-mtn.el ada-mode.texi ada-prj.el cedet-global.el
   ede/generic.el ada-stmt.el cl-generic.el ede/locate.el files.texi
   project.el windows.texi INSTALL.REPO INSTALL.W64 align.el
   and 21 other files
@@ -4702,7 +4740,7 @@ and co-wrote hideshow.el
 and changed ewoc.el vc.el info.el processes.texi zone.el lisp-mode.el
   scheme.el text.texi vc-rcs.el display.texi fileio.c files.el vc-git.el
   MORE.STUFF TUTORIAL.it bindat.el cc-vars.el configure.ac dcl-mode.el
-  diff-mode.el dired.el and 163 other files
+  diff-mode.el dired.el and 169 other files
 
 Thierry Banel: co-wrote ob-C.el
 and changed calc-arith.el
@@ -4801,13 +4839,15 @@ Tino Calancha: wrote buff-menu-tests.el 
ediff-ptch-tests.el
   em-ls-tests.el ffap-tests.el hi-lock-tests.el ls-lisp-tests.el
   register-tests.el rmc-tests.el
 and changed ibuffer.el dired-tests.el ibuf-ext.el dired.el dired-aux.el
-  simple.el ibuffer-tests.el ls-lisp.el diff-mode.el ibuf-macs.el
-  cl-seq.el dired-x.el dired.texi ediff-ptch.el em-ls.el files.el
-  replace.el buff-menu.el cl.texi ediff-init.el files-tests.el
+  simple.el replace.el ibuffer-tests.el ls-lisp.el diff-mode.el
+  ibuf-macs.el cl-seq.el dired-x.el dired.texi ediff-ptch.el em-ls.el
+  files.el replace-tests.el buff-menu.el cl.texi ediff-init.el
   and 82 other files
 
 Titus von der Malsburg: changed simple.el window.el
 
+Tobias Bading: changed progmodes/compile.el
+
 Tobias C. Rittweiler: changed font-lock.el searching.texi sendmail.el
 
 Tobias Ringström: changed etags.c
@@ -4890,6 +4930,8 @@ Trent W. Buck: changed rcirc.el remember.el rx.el
 
 Trevor Murphy: changed gnus.texi nnimap.el org.el
 
+Trevor Spiteri: changed progmodes/grep.el
+
 Trey Jackson: changed spam-stat.el
 
 Triet Hoai Lai: changed vntelex.el viet-util.el vietnamese.el
@@ -4932,9 +4974,9 @@ and changed org-gnus.el smime.el
 Ulrich Leodolter: changed w32proc.c
 
 Ulrich Müller: changed configure.ac lib-src/Makefile.in src/Makefile.in
-  version.el doctor.el emacs.1 files.el gamegrid.el gud.el server.el
-  ChgPane.c ChgSel.c HELLO INSTALL Makefile.in XMakeAssoc.c authors.el
-  bytecomp.el calc-units.el case-table.el configure and 39 other files
+  version.el calc-units.el doctor.el emacs.1 files.el gamegrid.el gud.el
+  server.el ChgPane.c ChgSel.c HELLO INSTALL Makefile.in XMakeAssoc.c
+  authors.el bytecomp.el case-table.el configure and 39 other files
 
 Ulrich Neumerkel: changed xterm.c
 
@@ -4973,6 +5015,8 @@ Vibhav Pant: changed bytecomp.el byte-opt.el bytecode.c 
bytecomp-tests.el
   emacs-module.c erc-backend.el erc.el eshell.texi fns.c hangul.el
   image.c lisp.h lread.c print.c profiler.c xterm.c
 
+Victor J. Orlikowski: changed erc-dcc.el
+
 Victor Zandy: wrote zone.el
 
 Viktor Rosenfeld: changed ob-sql.el org.el
@@ -5032,6 +5076,8 @@ Warren Lynn: changed tramp-sh.el
 
 Wei-Wei Guo: co-wrote rst.el
 
+Wenjamin Petrenko: changed files-x.el
+
 Werner Benger: changed keyboard.c
 
 Werner Lemberg: wrote sisheng.el vntelex.el
@@ -5179,7 +5225,7 @@ Yu-ji Hosokawa: changed README.W32
 
 Yukihiro Matsumoto: co-wrote ruby-mode.el
 
-Yuri D'elia: changed message.el
+Yuri D'elia: changed message.el package.el
 
 Yuri Karaban: changed pop3.el
 
diff --git a/etc/CALC-NEWS b/etc/CALC-NEWS
index 04baf41..d00f136 100644
--- a/etc/CALC-NEWS
+++ b/etc/CALC-NEWS
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Calc is an advanced desk calculator for GNU Emacs.
@@ -10,18 +10,9 @@ Originally written by:
        San Jose CA 95134
        address@hidden, uunet!synaptx!daveg
 
-Currently maintained by:
+Calc was maintained for many years by:
      Jay Belanger <address@hidden>
 
-I am anxious to hear about your experiences using Calc.  Send mail to
-"address@hidden".  A bug report is most useful if you include the
-exact input and output that occurred, any modes in effect (such as the
-current precision), and so on.  If you find Calc is difficult to operate
-in any way, or if you have other suggestions, don't hesitate to let me
-know.  If you find errors (including simple typos) in the manual, let me
-know.  Even if you find no bugs at all I would love to hear your opinions.
-
-
 Summary of changes to "Calc"
 ------- -- ------- --  ----
 
diff --git a/etc/CENSORSHIP b/etc/CENSORSHIP
deleted file mode 100644
index cd779e4..0000000
--- a/etc/CENSORSHIP
+++ /dev/null
@@ -1,8 +0,0 @@
-Censoring my Software
-
-Note added March 2014:
-
-This file is obsolete and will be removed in future.
-Please update any references to use
-
-<https://www.gnu.org/philosophy/censoring-emacs.html>
diff --git a/etc/ChangeLog.1 b/etc/ChangeLog.1
index 09a2824..24b8b39 100644
--- a/etc/ChangeLog.1
+++ b/etc/ChangeLog.1
@@ -6891,7 +6891,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993-1999, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1993-1999, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/etc/DEBUG b/etc/DEBUG
index 1a9068b..d401d0b 100644
--- a/etc/DEBUG
+++ b/etc/DEBUG
@@ -1,6 +1,6 @@
 Debugging GNU Emacs
 
-Copyright (C) 1985, 2000-2018 Free Software Foundation, Inc.
+Copyright (C) 1985, 2000-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 ** Preliminaries
@@ -936,7 +936,7 @@ its own versions, and because the dumping process might be
 incompatible with the way these packages use to track allocated
 memory.  Here are some of the changes you might find necessary:
 
-  - Edit configure, to set system_malloc and CANNOT_DUMP to "yes".
+  - Make sure unexec is disabled, e.g., './configure --without-unexec'.
 
   - Configure with a different --prefix= option.  If you use GCC,
     version 2.7.2 is preferred, as some malloc debugging packages
diff --git a/etc/DISTRIB b/etc/DISTRIB
index 854b1c8..4b8e4de 100644
--- a/etc/DISTRIB
+++ b/etc/DISTRIB
@@ -1,7 +1,7 @@
                                                -*- text -*-
             GNU Emacs availability information
 
-Copyright (C) 1986-1993, 1995, 1998, 2000-2018 Free Software Foundation,
+Copyright (C) 1986-1993, 1995, 1998, 2000-2019 Free Software Foundation,
 Inc.
 See the end of the file for license conditions.
 
diff --git a/etc/ERC-NEWS b/etc/ERC-NEWS
index 864efa4..5331b9c 100644
--- a/etc/ERC-NEWS
+++ b/etc/ERC-NEWS
@@ -1,6 +1,6 @@
 ERC NEWS                                                       -*- outline -*-
 
-Copyright (C) 2006-2018 Free Software Foundation, Inc.
+Copyright (C) 2006-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 * For changes after ERC 5.3, see the main Emacs NEWS file
diff --git a/etc/ETAGS.EBNF b/etc/ETAGS.EBNF
index 23bb944..db96709 100644
--- a/etc/ETAGS.EBNF
+++ b/etc/ETAGS.EBNF
@@ -94,7 +94,7 @@ those.
 
 ===================== end of discussion of tag names =====================
 
-Copyright (C) 2002-2018 Free Software Foundation, Inc.
+Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 COPYING PERMISSIONS:
 
diff --git a/etc/ETAGS.README b/etc/ETAGS.README
index 0be4d44..82d4314 100644
--- a/etc/ETAGS.README
+++ b/etc/ETAGS.README
@@ -28,7 +28,7 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 
LIABILITY, OR TORT
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2018 Free Software
+Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2019 Free Software
 Foundation, Inc.
 
 This file is not considered part of GNU Emacs.
diff --git a/etc/FTP b/etc/FTP
deleted file mode 100644
index ebd2695..0000000
--- a/etc/FTP
+++ /dev/null
@@ -1,9 +0,0 @@
-For information about how to download GNU Emacs, please see:
-<https://www.gnu.org/software/emacs/>
-
-For general GNU software downloading, please see
-<https://www.gnu.org/order/ftp.html>
-
-Note added January 2014:
-This file is obsolete and will be removed in future.
-Please update any links to use the above URLs.
diff --git a/etc/GNU b/etc/GNU
deleted file mode 100644
index f8078d4..0000000
--- a/etc/GNU
+++ /dev/null
@@ -1,8 +0,0 @@
-The GNU Manifesto
-
-Note added March 2014:
-
-This file is obsolete and will be removed in future.
-Please update any references to use
-  info node `(emacs)Manifesto'
-instead.
diff --git a/etc/GNUS-NEWS b/etc/GNUS-NEWS
deleted file mode 100644
index 2ca5a9d..0000000
--- a/etc/GNUS-NEWS
+++ /dev/null
@@ -1,316 +0,0 @@
-GNUS NEWS -- history of user-visible changes.
-
-Copyright (C) 1999-2018 Free Software Foundation, Inc.
-See the end of the file for license conditions.
-
-Please send Gnus bug reports to address@hidden
-For older news, see Gnus info node "New Features".
-
-
-* Supported Emacs versions The following Emacs versions are supported by No
-Gnus:
-
-** Emacs 22 and up
-** XEmacs 21.4
-** XEmacs 21.5
-** SXEmacs
-
-
-* Installation changes
-
-** Upgrading from previous (stable) version if you have used No Gnus.
-
-If you have tried No Gnus (the unstable Gnus branch leading to this
-release) but went back to a stable version, be careful when upgrading to
-this version.  In particular, you will probably want to remove the
-'~/News/marks' directory (perhaps selectively), so that flags are read
-from your '~/.newsrc.eld' instead of from the stale marks file, where
-this release will store flags for nntp.  See a later entry for more
-information about nntp marks.  Note that downgrading isn't safe in
-general.
-
-** Incompatibility when switching from Emacs 23 to Emacs 22 In Emacs 23,
-Gnus uses Emacs's new internal coding system 'utf-8-emacs' for saving
-articles drafts and '~/.newsrc.eld'.  These files may not be read
-correctly in Emacs 22 and below.  If you want to use Gnus across
-different Emacs versions, you may set 'mm-auto-save-coding-system' to
-'emacs-mule'.
-
-** Lisp files are now installed in '.../site-lisp/gnus/' by default.  It
-defaulted to '.../site-lisp/' formerly.  In addition to this, the new
-installer issues a warning if other Gnus installations which will shadow
-the latest one are detected.  You can then remove those shadows manually
-or remove them using 'make remove-installed-shadows'.
-
-** The installation directory name is allowed to have spaces and/or tabs.
-
-
-* New packages and libraries within Gnus
-
-** New version of 'nnimap'
-
-'nnimap' has been reimplemented in a mostly-compatible way.  See the Gnus
-manual for a description of the new interface.  In particular,
-'nnimap-inbox' and the client side split method has changed.
-
-** Gnus includes the Emacs Lisp SASL library.
-
-This provides a clean API to SASL mechanisms from within Emacs.  The user
-visible aspects of this, compared to the earlier situation, include
-support for DIGEST-MD5 and NTLM.  *Note Emacs SASL: (sasl)Top.
-
-** ManageSieve connections uses the SASL library by default.
-
-The primary change this brings is support for DIGEST-MD5 and NTLM, when
-the server supports it.
-
-** Gnus includes a password cache mechanism in password.el.
-
-It is enabled by default (see 'password-cache'), with a short timeout of
-16 seconds (see 'password-cache-expiry').  If PGG is used as the PGP back
-end, the PGP passphrase is managed by this mechanism.  Passwords for
-ManageSieve connections are managed by this mechanism, after querying the
-user about whether to do so.
-
-** Using EasyPG with Gnus When EasyPG, is available, Gnus will use it
-instead of PGG.  EasyPG is an Emacs user interface to GNU Privacy Guard.
- *Note EasyPG Assistant user's manual: (epa)Top.  EasyPG is included in
-Emacs 23 and available separately as well.
-
-
-* Changes in group mode
-
-** Symbols like 'gcc-self' now have the same precedence rules in
-'gnus-parameters' as other "real" variables: The last match wins instead
-of the first match.
-
-** Old intermediate incoming mail files ('Incoming*') are deleted after a
-couple of days, not immediately.  *Note Mail Source Customization::.
-(New in Gnus 5.10.10 / No Gnus 0.8)
-
-
-* Changes in summary and article mode
-
-** There's now only one variable that determines how HTML is rendered:
-'mm-text-html-renderer'.
-
-** Gnus now supports sticky article buffers.  Those are article buffers that
-are not reused when you select another article.  *Note Sticky Articles::.
-
-** Gnus can selectively display 'text/html' articles with a WWW browser with
-'K H'.  *Note MIME Commands::.
-
-** International host names (IDNA) can now be decoded inside article bodies
-using 'W i' ('gnus-summary-idna-message').  This requires that GNU Libidn
-(<https://www.gnu.org/software/libidn/>) has been installed.
-
-** The non-ASCII group names handling has been much improved.  The back ends
-that fully support non-ASCII group names are now 'nntp', 'nnml', and
-'nnrss'.  Also the agent, the cache, and the marks features work with
-those back ends.  *Note Non-ASCII Group Names::.
-
-** Gnus now displays DNS master files sent as text/dns using dns-mode.
-
-** Gnus supports new limiting commands in the Summary buffer: '/ r'
-('gnus-summary-limit-to-replied') and '/ R'
-('gnus-summary-limit-to-recipient').  *Note Limiting::.
-
-** You can now fetch all ticked articles from the server using 'Y t'
-('gnus-summary-insert-ticked-articles').  *Note Summary Generation
-Commands::.
-
-** Gnus supports a new sort command in the Summary buffer: 'C-c C-s C-t'
-('gnus-summary-sort-by-recipient').  *Note Summary Sorting::.
-
-** S/MIME now features LDAP user certificate searches.  You need to
-configure the server in 'smime-ldap-host-list'.
-
-** URLs inside OpenPGP headers are retrieved and imported to your PGP key
-ring when you click on them.
-
-** Picons can be displayed right from the textual address, see
-'gnus-picon-style'.  *Note Picons::.
-
-** ANSI SGR control sequences can be transformed using 'W A'.
-
-ANSI sequences are used in some Chinese hierarchies for highlighting
-articles ('gnus-article-treat-ansi-sequences').
-
-** Gnus now MIME decodes articles even when they lack "MIME-Version" header.
-This changes the default of 'gnus-article-loose-mime'.
-
-** 'gnus-decay-scores' can be a regexp matching score files.  For example,
-set it to '\\.ADAPT\\'' and only adaptive score files will be decayed.
- *Note Score Decays::.
-
-** Strings prefixing to the 'To' and 'Newsgroup' headers in summary lines
-when using 'gnus-ignored-from-addresses' can be customized with
-'gnus-summary-to-prefix' and 'gnus-summary-newsgroup-prefix'.  *Note To
-From Newsgroups::.
-
-** You can replace MIME parts with external bodies.  See
-'gnus-mime-replace-part' and 'gnus-article-replace-part'.  *Note MIME
-Commands::, *note Using MIME::.
-
-** The option 'mm-fill-flowed' can be used to disable treatment of
-format=flowed messages.  Also, flowed text is disabled when sending
-inline PGP signed messages.  *Note Flowed text: (emacs-mime)Flowed text.
-(New in Gnus 5.10.7)
-
-** Now the new command 'S W' ('gnus-article-wide-reply-with-original') for a
-wide reply in the article buffer yanks a text that is in the active
-region, if it is set, as well as the 'R'
-('gnus-article-reply-with-original') command.  Note that the 'R' command
-in the article buffer no longer accepts a prefix argument, which was used
-to make it do a wide reply.  *Note Article Keymap::.
-
-** The new command 'C-h b' ('gnus-article-describe-bindings') used in the
-article buffer now shows not only the article commands but also the real
-summary commands that are accessible from the article buffer.
-
-
-* Changes in Message mode
-
-** Gnus now defaults to saving all outgoing messages in per-month nnfolder
-archives.
-
-** Gnus now supports the "hashcash" client puzzle anti-spam mechanism.  Use
-'(setq message-generate-hashcash t)' to enable.  *Note Hashcash::.
-
-** You can now drag and drop attachments to the Message buffer.  See
-'mml-dnd-protocol-alist' and 'mml-dnd-attach-options'.  *Note MIME:
-(message)MIME.
-
-** The option 'message-yank-empty-prefix' now controls how empty lines are
-prefixed in cited text.  *Note Insertion Variables: (message)Insertion
-Variables.
-
-** Gnus uses narrowing to hide headers in Message buffers.  The 'References'
-header is hidden by default.  To make all headers visible, use '(setq
-message-hidden-headers nil)'.  *Note Message Headers: (message)Message
-Headers.
-
-** You can highlight different levels of citations like in the article
-buffer.  See 'gnus-message-highlight-citation'.
-
-** 'auto-fill-mode' is enabled by default in Message mode.  See
-'message-fill-column'.  *Note Message Headers: (message)Various Message
-Variables.
-
-** You can now store signature files in a special directory named
-'message-signature-directory'.
-
-** The option 'message-citation-line-format' controls the format of the
-"Whomever writes:" line.  You need to set
-'message-citation-line-function' to
-'message-insert-formatted-citation-line' as well.
-
-
-* Changes in Browse Server mode
-
-** Gnus' sophisticated subscription methods are now available in Browse
-Server buffers as well using the variable
-'gnus-browse-subscribe-newsgroup-method'.
-
-
-* Changes in back ends
-
-** The nntp back end stores article marks in '~/News/marks'.
-
-The directory can be changed using the (customizable) variable
-'nntp-marks-directory', and marks can be disabled using the (back end)
-variable 'nntp-marks-is-evil'.  The advantage of this is that you can
-copy '~/News/marks' (using rsync, scp or whatever) to another Gnus
-installation, and it will realize what articles you have read and marked.
-The data in '~/News/marks' has priority over the same data in
-'~/.newsrc.eld'.
-
-** You can import and export your RSS subscriptions from OPML files.  *Note
-RSS::.
-
-** IMAP identity (RFC 2971) is supported.
-
-By default, Gnus does not send any information about itself, but you can
-customize it using the variable 'nnimap-id'.
-
-** The 'nnrss' back end now supports multilingual text.  Non-ASCII group
-names for the 'nnrss' groups are also supported.  *Note RSS::.
-
-** Retrieving mail with POP3 is supported over SSL/TLS and with StartTLS.
-
-** The nnml back end allows other compression programs beside 'gzip' for
-compressed message files.  *Note Mail Spool::.
-
-** The nnml back end supports group compaction.
-
-This feature, accessible via the functions 'gnus-group-compact-group' ('G
-z' in the group buffer) and 'gnus-server-compact-server' ('z' in the
-server buffer) renumbers all articles in a group, starting from 1 and
-removing gaps.  As a consequence, you get a correct total article count
-(until messages are deleted again).
-
-
-* Appearance
-
-** The tool bar has been updated to use GNOME icons.  You can also customize
-the tool bars: 'M-x customize-apropos RET -tool-bar$' should get you
-started.  (Only for Emacs, not in XEmacs.)
-
-** The tool bar icons are now (de)activated correctly in the group buffer,
-see the variable 'gnus-group-update-tool-bar'.  Its default value depends
-on your Emacs version.
-
-** You can change the location of XEmacs's toolbars in Gnus buffers.  See
-'gnus-use-toolbar' and 'message-use-toolbar'.
-
-
-* Miscellaneous changes
-
-** New user option 'gnus-rcvstore-options' provides a way to
-specify additional options when saving messages to an MH folder.
-
-** Having edited the select-method for the foreign server in the server
-buffer is immediately reflected to the subscription of the groups which
-use the server in question.  For instance, if you change
-'nntp-via-address' into 'bar.example.com' from 'foo.example.com', Gnus
-will connect to the news host by way of the intermediate host
-'bar.example.com' from next time.
-
-** The 'all.SCORE' file can be edited from the group buffer using 'W e'.
-
-** You can set 'gnus-mark-copied-or-moved-articles-as-expirable' to a
-non-'nil' value so that articles that have been read may be marked as
-expirable automatically when copying or moving them to a group that has
-auto-expire turned on.  The default is 'nil' and copying and moving of
-articles behave as before; i.e., the expirable marks will be unchanged
-except that the marks will be removed when copying or moving articles to
-a group that has not turned auto-expire on.  *Note Expiring Mail::.
-
-** NoCeM support has been removed.
-
-** Carpal mode has been removed.
-
-* For older news, see Gnus info node "New Features".
-
-----------------------------------------------------------------------
-
-This file is part of GNU Emacs.
-
-GNU Emacs is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-GNU Emacs is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
-
-
-Local variables:
-mode: outline
-paragraph-separate: "[         ]*$"
-end:
diff --git a/etc/HELLO b/etc/HELLO
index db7fd23..a56a73b 100644
--- a/etc/HELLO
+++ b/etc/HELLO
@@ -88,17 +88,17 @@ Telugu (తెలుగు)     నమస్కారం
 
 </x-charset>
 
-Japanese (日本語) こんにちは <x-charset><param>katakana-jisx0201</param>/ コンニチハ
+<x-charset><param>japanese-jisx0208</param>Japanese (日本語)      
こんにちは</x-charset> <x-charset><param>katakana-jisx0201</param>/ コンニチハ
 </x-charset><x-charset><param>chinese-gb2312</param>Chinese (中文,普通话,汉语)        
你好
 </x-charset><x-charset><param>chinese-big5-1</param>Cantonese (粵語,廣東話) 早晨, 你好
-</x-charset>Korean (한글)        안녕하세요 / 안녕하십니까
+</x-charset><x-charset><param>korean-ksc5601</param>Korean (한글)        안녕하세요 / 
안녕하십니까
 
-<x-charset><param>korean-ksc5601</param>
+</x-charset>
 
-</x-charset><x-charset><param>unicode</param>
+<x-charset><param>unicode</param>
 
 
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 
 This file is part of GNU Emacs.
diff --git a/etc/LINUX-GNU b/etc/LINUX-GNU
deleted file mode 100644
index 0f45e15..0000000
--- a/etc/LINUX-GNU
+++ /dev/null
@@ -1,8 +0,0 @@
-Linux and the GNU system
-
-Note added March 2014:
-
-This file is obsolete and will be removed in future.
-Please update any references to use
-
-<https://www.gnu.org/gnu/linux-and-gnu.html>
diff --git a/etc/MACHINES b/etc/MACHINES
index 0b736fb..2cb1bfd 100644
--- a/etc/MACHINES
+++ b/etc/MACHINES
@@ -1,6 +1,6 @@
 Emacs machines list
 
-Copyright (C) 1989-1990, 1992-1993, 1998, 2001-2018 Free Software
+Copyright (C) 1989-1990, 1992-1993, 1998, 2001-2019 Free Software
 Foundation, Inc.
 See the end of the file for license conditions.
 
diff --git a/etc/MH-E-NEWS b/etc/MH-E-NEWS
index f59823a..def0af1 100644
--- a/etc/MH-E-NEWS
+++ b/etc/MH-E-NEWS
@@ -1,6 +1,6 @@
 * COPYRIGHT
 
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 * Changes in MH-E 8.6
diff --git a/etc/MORE.STUFF b/etc/MORE.STUFF
deleted file mode 100644
index e3f2c16..0000000
--- a/etc/MORE.STUFF
+++ /dev/null
@@ -1,8 +0,0 @@
-More Neat Stuff for your Emacs
-
-Note added January 2014:
-
-This file is obsolete and will be removed in future.
-Please update any links to use
-  info node `(efaq)Packages that do not come with Emacs'
-instead.
diff --git a/etc/NEWS b/etc/NEWS
index ac23b3b..7486d6b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1,10 +1,10 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2017-2018 Free Software Foundation, Inc.
+Copyright (C) 2017-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
-Please send Emacs bug reports to address@hidden
-If possible, use M-x report-emacs-bug.
+Please send Emacs bug reports to 'address@hidden'.
+If possible, use 'M-x report-emacs-bug'.
 
 This file is about changes in Emacs version 27.
 
@@ -13,7 +13,7 @@ See files NEWS.26, NEWS.25, ..., NEWS.18, and NEWS.1-17 for 
changes
 in older Emacs versions.
 
 You can narrow news to a specific version by calling 'view-emacs-news'
-with a prefix argument or by typing C-u C-h C-n.
+with a prefix argument or by typing 'C-u C-h C-n'.
 
 Temporary note:
 +++ indicates that all necessary documentation updates are complete.
@@ -27,16 +27,22 @@ When you add a new item, use the appropriate mark if you 
are sure it applies,
 ** Emacs now uses GMP, the GNU Multiple Precision library.
 By default, if 'configure' does not find a suitable libgmp, it
 arranges for the included mini-gmp library to be built and used.
-The new 'configure' option --without-libgmp uses mini-gmp even if a
+The new 'configure' option '--without-libgmp' uses mini-gmp even if a
 suitable libgmp is available.
 
 ** The new configure option '--with-json' adds support for JSON using
-the Jansson library.  It is on by default; use 'configure
+the Jansson library.  It is on by default; use './configure
 --with-json=no' to build without Jansson support.  The new JSON
 functions 'json-serialize', 'json-insert', 'json-parse-string', and
 'json-parse-buffer' are typically much faster than their Lisp
 counterparts from json.el.
 
+** Several configure options now accept an option-argument 'ifavailable'.
+For example, './configure --with-xpm=ifavailable' now configures Emacs
+to attempt to use libxpm but to continue building even if libxpm is absent.
+The other affected options are --with-gif, --with-gnutls, --with-jpeg,
+--with-png, and --with-tiff.
+
 ** The etags program now uses the C library's regular expression matcher
 when possible, and a compatible regex substitute otherwise.  This will
 let developers maintain Emacs's own regex code without having to also
@@ -44,7 +50,7 @@ support other programs.  The new configure option 
'--without-included-regex'
 forces etags to use the C library's regex matcher even if the regex
 substitute ordinarily would be used to work around compatibility problems.
 
-** Emacs has been ported to the -fcheck-pointer-bounds option of GCC.
+** Emacs has been ported to the '-fcheck-pointer-bounds' option of GCC.
 This causes Emacs to check bounds of some arrays addressed by its
 internal pointers, which can be helpful when debugging the Emacs
 interpreter or modules that it uses.  If your platform supports it you
@@ -54,24 +60,29 @@ can enable it when configuring, e.g., './configure 
CFLAGS="-g3 -O2
 ** Emacs now normally uses a C pointer type instead of a C integer
 type to implement Lisp_Object, which is the fundamental machine word
 type internal to the Emacs Lisp interpreter.  This change aims to
-catch typos and support -fcheck-pointer-bounds.  The 'configure'
-option --enable-check-lisp-object-type is therefore no longer as
+catch typos and supports '-fcheck-pointer-bounds'.  The 'configure'
+option '--enable-check-lisp-object-type' is therefore no longer as
 useful and so is no longer enabled by default in developer builds,
 to reduce differences between developer and production builds.
 
-** Ibuffer
-
----
-*** All mode filters can now accept a list of symbols.
-This means you can now easily filter several major modes, as well
-as a single mode.
++++
+** Emacs now uses a "portable dumper" instead of unexec.
+This improves compatibility with memory allocation on modern systems,
+and in particular better supports the Address Space Layout
+Randomization (ASLR) feature, a security technique used by most modern
+operating systems.
 
-** Gnus
+Portable dumping can be disabled at configure time via the configure
+option '--with-dumping=unexec' (but we don't recommend that, unless
+the portable dumping doesn't work on your system for some
+reason---please report such systems to the Emacs developers as bugs).
 
-+++
-*** The nnimap backend now has support for IMAP namespaces.
-This feature can be enabled by setting the new 'nnimap-use-namespaces'
-server variable to non-nil.
+When built with the portable dumping support (which is the default),
+Emacs looks for the 'emacs.pdmp' file, generated during the build, in
+its data directory at startup, and loads the dumped state from there.
+The new command-line argument '--dump-file=FILE' allows to specify a
+non-default '.pdmp' file to load the state from; see the node "Initial
+Options" in the Emacs manual for more information.
 
 
 * Startup Changes in Emacs 27.1
@@ -89,7 +100,7 @@ We recommend against putting any customizations in this file 
that
 don't need to be set up before initializing installed add-on packages,
 because the early init file is read too early into the startup
 process, and some important parts of the Emacs session, such as
-window-system and other GUI features, are not yet set up, which could
+'window-system' and other GUI features, are not yet set up, which could
 make some customization fail to work.
 
 +++
@@ -113,20 +124,41 @@ work right without some adjustment:
 Units that are ordered after 'emacs.service' will only be started
 after Emacs has finished initialization and is ready for use.
 (If your Emacs is installed in a non-standard location and you copied the
-emacs.service file to eg ~/.config/systemd/user/, you will need to copy
+emacs.service file to eg "~/.config/systemd/user/", you will need to copy
 the new version of the file again.)
 
 
 * Changes in Emacs 27.1
 
+** emacsclient
+
 +++
-** emacsclient now supports the 'EMACS_SOCKET_NAME' environment variable.
+*** emacsclient now supports the 'EMACS_SOCKET_NAME' environment variable.
 The behavior is identical to 'EMACS_SERVER_FILE', in that the
 command-line value specified via '--socket-name' will override the
-environment, and the natural default to TMPDIR, then '/tmp', continues
+environment, and the natural default to TMPDIR, then "/tmp", continues
 to apply.
 
 +++
+*** Emacs and emacsclient now default to $XDG_RUNTIME_DIR/emacs
+as the directory for client/server sockets, if Emacs is running
+under an X Window System desktop that sets the XDG_RUNTIME_DIR
+environment variable to indicate where session sockets should go.
+To get the old, less-secure behavior, you can set the
+EMACS_SOCKET_NAME environment variable to an appropriate value.
+
+---
+*** When run by root, emacsclient no longer connects to non-root sockets.
+(Instead you can use Tramp methods to run root commands in a non-root Emacs.)
+
+---
+** Control of the threshold for using the 'distant-foreground' color.
+The threshold for color distance below which the 'distant-foreground'
+color of the face will be used instead of the foreground color can now
+be controlled via the new variable 'face-near-same-color-threshold'.
+The default value is 30000, as the previously hard-coded threshold.
+
++++
 ** The function 'read-passwd' uses '*' as default character to hide passwords.
 
 ---
@@ -136,7 +168,7 @@ it resizes the echo area as needed to accommodate the full 
tool-tip
 text.
 
 ---
-** Show modeline tooltips only if the corresponding action applies.
+** Show mode line tooltips only if the corresponding action applies.
 Customize the option 'mode-line-default-help-echo' to restore the old
 behavior where the tooltip text is also shown when the corresponding
 action does not apply.
@@ -186,6 +218,13 @@ or adjust the elements in that variable to only happen on 
the 'high'
 security level (assuming you use the 'medium' level).
 
 +++
+** Native GnuTLS connections can now use client certificates.
+Previously, this support was only available when using the external
+gnutls-cli command.  Call 'open-network-stream' with
+':client-certificate t' to trigger looking up of per-server
+certificates via 'auth-source'.
+
++++
 ** New function 'fill-polish-nobreak-p', to be used in 
'fill-nobreak-predicate'.
 It blocks line breaking after a one-letter word, also in the case when
 this word is preceded by a non-space, but non-alphanumeric character.
@@ -201,7 +240,19 @@ regular expression was previously invalid, but is now 
accepted:
 ** The German prefix and postfix input methods now support Capital sharp S.
 
 ---
-** New input methods hawaiian-postfix and hawaiian-prefix.
+** New input methods 'hawaiian-postfix' and 'hawaiian-prefix'.
+
+---
+** New input methods for several variants of the Sami language.
+The Sami input methods include: 'norwegian-sami-prefix',
+'bergsland-hasselbrink-sami-prefix', 'southern-sami-prefix',
+'ume-sami-prefix', 'northern-sami-prefix', 'inari-sami-prefix',
+'skolt-sami-prefix', and 'kildin-sami-prefix'.
+
++++
+** In Japanese environments that do not specify encodings and are not
+based on MS-Windows, the default encoding is now utf-8 instead of
+japanese-iso-8bit.
 
 +++
 ** New function 'exec-path'.
@@ -225,6 +276,33 @@ In addition to nil or non-nil, the value can now be a 
predicate
 function.  Follow mode uses this to control scrolling of its windows
 when the last screen line in a window is not fully visible.
 
++++
+** New variable 'emacs-repository-branch'.
+It reports the git branch from which Emacs was built.
+
++++
+** New user option 'switch-to-buffer-obey-display-actions'.
+When non-nil, 'switch-to-buffer' uses 'pop-to-buffer-same-window' that
+respects display actions specified by 'display-buffer-alist' and
+'display-buffer-overriding-action'.
+
+** New 'flex' completion style
+An implementation of popular "flx/fuzzy/scatter" completion which
+matches strings where the pattern appears as a subsequence.  Put
+simply, makes "foo" complete to both "barfoo" and "frodo".  Add 'flex'
+to 'completion-styles' or 'completion-category-overrides' to use it.
+
+** Connection-local variables
+
++++
+*** Connection-local variables are applied by default like file-local
+and directory-local variables.
+
++++
+*** The macro 'with-connection-local-variables' has been renamed from
+'with-connection-local-profiles'.  No argument 'profiles' needed any
+longer.
+
 
 * Editing Changes in Emacs 27.1
 
@@ -264,7 +342,7 @@ tables which do not have any non-system abbrevs to save.
 +++
 ** The new functions and commands 'text-property-search-forward' and
 'text-property-search-backward' have been added.  These provide an
-interface that's more like functions like @code{search-forward}.
+interface that's more like functions like 'search-forward'.
 
 ---
 ** More commands support noncontiguous rectangular regions, namely
@@ -278,44 +356,121 @@ file literally, as in 'find-file-literally', which 
speeds up
 navigation and editing of large files.
 
 ---
-** add-dir-local-variable now uses dotted pair notation syntax
-to write alists of variables to .dir-locals.el.  This is the same
-syntax that you can see in the example of a .dir-locals.el file
-in (info "(emacs) Directory Variables")
+** 'add-dir-local-variable' now uses dotted pair notation syntax to
+write alists of variables to ".dir-locals.el".  This is the same
+syntax that you can see in the example of a ".dir-locals.el" file in
+the node "(emacs) Directory Variables" of the user manual.
+
++++
+** Network connections using 'local can now use IPv6.
+'make-network-process' now uses the correct loopback address when
+asked to use :host 'local and :family 'ipv6.
+
++++
+** The new function `replace-region-contents' replaces the current
+region using a given replacement-function in a non-destructive manner
+(in terms of `replace-buffer-contents').
+
++++
+** The command `replace-buffer-contents' now has two optional
+arguments mitigating performance issues when operating on huge
+buffers.
+
+** The command 'delete-indentation' now operates on the active region.
+If the region is active, the command joins all the lines in the
+region.  When there's no active region, the command works on the
+current and the previous or the next line, as before.
 
++++
 
 * Changes in Specialized Modes and Packages in Emacs 27.1
 
+** doc-view-mode
+*** New commands doc-view-presentation and doc-view-fit-window-to-page
+*** Added support for password-protected PDF files
+
+** map.el
+*** Now also understands plists.
+*** Now defined via generic functions that can be extended via 'cl-defmethod'.
+*** Deprecate the 'map-put' macro in favor of a new 'map-put!' function.
+*** 'map-contains-key' now returns a boolean rather than the key.
+*** Deprecate the 'testfn' args of 'map-elt' and 'map-contains-key'.
+*** New generic function 'map-insert'.
+
++++
+** seq.el
+New convenience functions 'seq-first' and 'seq-rest' give easy access
+to respectively the first and all but the first elements of sequences.
+
+The new predicate function 'seq-contains-p' should be used instead of
+the now obsolete 'seq-contains'.
+
 ---
 ** Follow mode
 In the current follow group of windows, "ghost" cursors are no longer
 displayed in the non-selected follow windows.  To get the old behavior
-back, customize follow-hide-ghost-cursors to nil.
+back, customize 'follow-hide-ghost-cursors' to nil.
+
+** Windmove
+
+*** 'windmove-create-window' when non-nil makes a new window on moving off
+the edge of the frame.
+
+*** Windmove supports directional window display and selection.
+The new command 'windmove-display-default-keybindings' binds default
+keys with provided modifiers (by default, Shift-Meta) to the commands
+that display the next buffer in the window at the specified direction.
+This is like 'windmove-default-keybindings' that binds keys to commands
+that select the window in the specified direction, but additionally it
+displays the buffer from the next command in that window.  For example,
+'S-M-right C-h i' displays the *Info* buffer in the right window,
+creating the window if necessary.  A special key can be customized to
+display the buffer in the same window, for example, 'S-M-0 C-h e'
+displays the *Messages* buffer in the same window.
+
+*** Windmove also supports directional window deletion.
+The new command 'windmove-delete-default-keybindings' binds default
+keys with provided prefix (by default, 'C-x') and modifiers (by default,
+'Shift') to the commands that delete the window in the specified
+direction.  For example, 'C-x S-down' deletes the window below.
+With a prefix arg 'C-u', also kills the buffer in that window.
+With 'M-0', deletes the selected window and selects the window
+that was in the specified direction.
+
+*** New command 'windmove-swap-states-in-direction' binds default keys
+to the commands that swap the states of the selected window with the
+window in the specified direction.
 
 ** Octave mode
 The mode is automatically enabled in files that start with the
 'function' keyword.
 
 ** project.el
-*** New commands project-search and project-query-replace
+*** New commands 'project-search' and 'project-query-replace-regexp'.
 
 ** Etags
+
 +++
-*** 'next-file' is now an obsolete alias of tags-next-file
-*** tags-loop-revert-buffers is an obsolete alias of multifile-revert-buffers
-*** The tags-loop-continue function along with the tags-loop-operate and
-tags-loop-scan variables are now obsolete; use the new multifile-initialize and
-multifile-continue functions instead.
+*** 'next-file' is now an obsolete alias of 'tags-next-file'.
+
+*** 'tags-loop-revert-buffers' is an obsolete alias of
+'fileloop-revert-buffers'.
+
+*** The 'tags-loop-continue' function along with the
+'tags-loop-operate' and 'tags-loop-scan' variables are now obsolete;
+use the new 'fileloop-initialize' and 'fileloop-continue' functions
+instead.
 
----
 ** bibtex
+
+---
 *** New commands 'bibtex-next-entry' and 'bibtex-previous-entry'.
-In bibtex-mode-map, forward-paragraph and backward-paragraph are
+In 'bibtex-mode-map', 'forward-paragraph' and 'backward-paragraph' are
 remapped to these, respectively.
 
-+++
 ** Dired
 
++++
 *** New command 'dired-create-empty-file'.
 
 ** Change Logs and VC
@@ -329,9 +484,12 @@ still be used if it exists.)  Set the variable to nil to 
get the
 previous behavior of always creating a buffer that visits a ChangeLog
 file.
 
+*** New customizable variable 'vc-find-revision-no-save'.
+With non-nil, 'vc-find-revision' doesn't write the created buffer to file.
+
 *** New customizable variable 'vc-git-grep-template'.
 This new variable allows customizing the default arguments passed to
-git-grep when 'vc-git-grep' is used.
+'git-grep' when 'vc-git-grep' is used.
 
 *** Command 'vc-git-stash' now respects marks in the '*vc-dir*' buffer.
 When some files are marked, only those are stashed.
@@ -339,12 +497,57 @@ When no files are marked, all modified files are stashed, 
as before.
 
 *** The new hook 'vc-retrieve-tag-hook' runs after retrieving a tag.
 
-** diff-mode
-*** Hunks are now automatically refined by default.
-To disable it, set the new defcustom 'diff-font-lock-refine' to nil.
+---
+*** 'vc-hg' now invokes 'smerge-mode' when visiting files.
+Code that attempted to invoke 'smerge-mode' when visiting an Hg file
+with conflicts existed in earlier versions of Emacs, but incorrectly
+never detected a conflict due to invalid assumptions about cached
+values.
+
++++
+*** 'C-u C-x v D' ('vc-root-version-diff') prompts for two revisions
+and compares their entire trees.
+
+*** New user option 'vc-hg-revert-switches' specifies switches to pass
+to hg revert.
+
+*** 'C-x v M D' ('vc-diff-mergebase') and 'C-x v M L' ('vc-log-mergebase')
+print diffs and logs between the merge base (common ancestor) of two
+given revisions.
+
+** Diff mode
++++
+*** Hunks are now automatically refined by font-lock.
+To disable refinement, set the new defcustom 'diff-refine' to nil.
+To get back the old behavior where hunks are refined as you navigate
+through a diff, set 'diff-refine' to the symbol 'navigate'.
++++
+*** 'diff-auto-refine-mode' is deprecated in favor of 'diff-refine'.
+It is no longer enabled by default and binding it no longer has any
+effect.
+
++++
+*** Better syntax highlighting of Diff hunks.
+Fragments of source in Diff hunks are now by default highlighted
+according to the appropriate major mode.  Customize the new option
+'diff-font-lock-syntax' to nil to disable this.
 
 *** File headers can be shortened, mimicking Magit's diff format.
-To enable it, set the new defcustom 'diff-font-lock-prettify to t.
+To enable it, set the new defcustom 'diff-font-lock-prettify' to t.
+
++++
+*** Prefix arg of 'diff-goto-source' means jump to the old revision
+of the file under version control if point is on an old changed line,
+or to the new revision of the file otherwise.
+
+** Texinfo
+
++++
+*** New function for inserting @pxref, @xref, or @ref commands.
+The function 'address@hidden', bound to 'C-c C-c r' by
+default, inserts one of three types of references based on the text
+surrounding point, namely @pxref near a parenthesis, @xref at the
+start of a sentence or at (point-min), else @ref.
 
 ** Browse-url
 
@@ -359,7 +562,7 @@ shown in the currently selected window.
 Also, 'shell-strip-ctrl-m' is declared obsolete.
 
 +++
-*** 'C-c .' (comint-insert-previous-argument) no longer interprets '&'.
+*** 'C-c .' ('comint-insert-previous-argument') no longer interprets '&'.
 This feature caused problems when '&&' was present in the previous
 command.  Since this command emulates 'M-.' in Bash and zsh, neither
 of which treats '&' specially, the feature was removed for
@@ -377,27 +580,45 @@ end.
 
 ** SQL
 
-*** Installation of 'sql-indent' from ELPA is strongly encouraged.
-This package support sophisticated rules for properly indenting SQL
-statements.  SQL is not like other programming languages like C, Java,
-or Python where code is sparse and rules for formatting are fairly
-well established. Instead SQL is more like COBOL (from which it came)
-and code tends to be very dense and line ending decisions driven by
-syntax and line length considerations to make readable code.
-Experienced SQL developers may prefer to rely upon existing Emacs
-facilities for formatting code but the 'sql-indent' package provides
-facilities to aid more casual SQL developers layout queries and
-complex expressions.
-
-*** 'sql-use-indent-support' (default t) enables SQL indention support.
+*** SQL Indent Minor Mode
+
+SQL Mode now supports the ELPA 'sql-indent' package for assisting
+sophisticated SQL indenting rules.  Note, however, that SQL is not
+like other programming languages like C, Java, or Python where code is
+sparse and rules for formatting are fairly well established. Instead
+SQL is more like COBOL (from which it came) and code tends to be very
+dense and line ending decisions driven by syntax and line length
+considerations to make readable code.  Experienced SQL developers may
+prefer to rely upon existing Emacs facilities for formatting code but
+the 'sql-indent' package provides facilities to aid more casual SQL
+developers layout queries and complex expressions.
+
+**** 'sql-use-indent-support' (default t) enables SQL indention support.
 The 'sql-indent' package from ELPA must be installed to get the
 indentation support in 'sql-mode' and 'sql-interactive-mode'.
 
-*** 'sql-mode-hook' and 'sql-interactive-mode-hook' changed.
+**** 'sql-mode-hook' and 'sql-interactive-mode-hook' changed.
 Both hook variables have had 'sql-indent-enable' added to their
-default values. If youhave existing customizations to these variables,
+default values. If you have existing customizations to these variables,
 you should make sure that the new default entry is included.
 
+*** Connection Wallet
+
+Database passwords can now by stored in NETRC or JSON data files that
+may optionally be encrypted. When establishing an interactive session
+with the database via 'sql-connect' or a product specific function,
+like 'sql-mysql' or 'my-postgres', the password wallet will be
+searched for the password. The 'sql-product', 'sql-server',
+'sql-database', and the 'sql-username' will be used to identify the
+appropriate authorization. This eliminates the discouraged practice of
+embedding database passwords in your Emacs initialization.
+
+See the `auth-source' module for complete documentation on the file
+formats.  By default, the wallet file is expected to be in the
+`user-emacs-directory', named 'sql-wallet' or '.sql-wallet', with
+'.json' (JSON) or no (NETRC) suffix.  Both file formats can optionally
+be encrypted with GPG by adding an additional '.gpg' suffix.
+
 ** Term
 
 ---
@@ -417,16 +638,23 @@ Control whether Flymake starts checking the buffer on 
save.
 This enables more efficient backends.  See the docstring of
 'flymake-diagnostic-functions' or the Flymake manual for details.
 
+** Ruby
+
+*** The Rubocop Flymake diagnostic function will only run Lint cops if
+it can't find the config file.
+
+*** Rubocop is called with 'bundle exec' if Gemfile mentions it.
+
 ** Package
 
 *** New function 'package-get-version' lets packages query their own version.
-Example use in auctex.el: (defconst auctex-version (package-get-version))
+Example use in auctex.el: '(defconst auctex-version (package-get-version))'
 
 *** New 'package-quickstart' feature.
 When 'package-quickstart' is non-nil, package.el precomputes a big autoloads
 file so that activation of packages can be done much faster, which can speed up
 your startup significantly.
-It also causes variables like package-user-dir and package-load-list to be
+It also causes variables like 'package-user-dir' and 'package-load-list' to be
 consulted when 'package-quickstart-refresh' is run rather than at startup so
 you don't need to set them in your early init file.
 
@@ -448,6 +676,15 @@ for example.
 This command finds definitions of the identifier at the place of a
 mouse click event, and is intended to be bound to a mouse event.
 
++++
+*** Changing 'xref-marker-ring-length' works after 'xref.el' is loaded.
+Previously, setting 'xref-marker-ring-length' would only take effect
+if set before 'xref.el' was loaded.
+
+---
+*** xref-find-definitions now sets the mark at the buffer position
+where it was invoked
+
 ** Ecomplete
 
 *** The ecomplete sorting has changed to a decay-based algorithm.
@@ -458,6 +695,17 @@ Of course it will still find it if you have it in 
~/.ecompleterc
 
 ** Gnus
 
+---
+*** Gnus now maps imaps to 993 only on old MS-Windows versions.
+The nnimap backend used to do this unconditionally to work around
+problems on old versions of MS-Windows.  This is now done only for
+Windows XP and older.
+
++++
+*** The nnimap backend now has support for IMAP namespaces.
+This feature can be enabled by setting the new 'nnimap-use-namespaces'
+server variable to non-nil.
+
 +++
 *** A prefix argument to 'gnus-summary-limit-to-score' will limit reverse.
 Limit to articles with score at below.
@@ -482,6 +730,11 @@ See the concept index in the Gnus manual for the 
'match-list' entry.
 article(s) to a pre-existing Message buffer, or create a new Message
 buffer with the article(s) attached.
 
+---
+*** New option 'nnir-notmuch-filter-group-names-function'.
+This option controls whether and how to use Gnus search groups as
+'path:' search terms to 'notmuch'.
+
 ** erc
 
 ---
@@ -494,6 +747,16 @@ and its value has been changed to Duck Duck Go.
 
 ** eww/shr
 
++++
+*** The 'eww' command can now create a new EWW buffer.
+Invoking the command with a prefix argument will cause it to create a
+new EWW buffer for the URL instead of reusing the default one.
+
++++
+*** The 'd' ('eww-download') command now falls back to current page's URL.
+If this command is invoked with no URL at point, it now downloads the
+current page instead of signaling an error.
+
 *** When opening external links in eww/shr (typically with the
 'C-u RET' keystroke on a link), the link will be flashed with the new
 'shr-selected-link' face to give the user feedback that the command
@@ -504,6 +767,9 @@ has been executed.
 If set, shr will not render tags with attribute 'aria-hidden="true"'.
 This attribute is meant to tell screen readers to ignore a tag.
 
+---
+*** 'shr-tag-ol' now respects the ordered list 'start' attribute.
+
 ** Htmlfontify
 
 *** The functions 'hfy-color', 'hfy-color-vals' and
@@ -514,7 +780,7 @@ and 'hfy-rgb-txt-color-map' have been renamed from names 
that used
 +++
 ** Enriched mode supports the 'charset' text property.
 You can add or modify the 'charset' text properties of text using the
-Edit->Text Properties->Special Properties menu, or by invoking the
+'Edit->Text Properties->Special Properties' menu, or by invoking the
 'facemenu-set-charset' command.  Documents in Enriched mode will be
 saved with the charset properties, and those properties will be
 restored when the file is visited.
@@ -522,9 +788,9 @@ restored when the file is visited.
 ** Smtpmail
 
 Authentication mechanisms can be added via external packages, by
-defining new cl-defmethod of smtpmail-try-auth-method.
+defining new 'cl-defmethod' of 'smtpmail-try-auth-method'.
 
-** Footnote-mode
+** Footnote mode
 
 *** Support Hebrew-style footnotes
 *** Footnote text lines are now aligned.
@@ -564,7 +830,7 @@ directories in the destination.
 ** Help
 
 ---
-*** Output format of 'C-h l' (view-lossage) has changed.
+*** Output format of 'C-h l' ('view-lossage') has changed.
 For convenience, 'view-lossage' now displays the last keystrokes
 and commands in the same format as the edit buffer of
 'edit-last-kbd-macro'.  This makes it possible to copy the lines from
@@ -578,43 +844,77 @@ can now be searched via 'C-s'.
 ** Ibuffer
 
 ---
-*** New filter ibuffer-filter-by-process; bound to '/E'.
+*** New filter 'ibuffer-filter-by-process'; bound to '/E'.
+
+---
+*** All mode filters can now accept a list of symbols.
+This means you can now easily filter several major modes, as well
+as a single mode.
 
 ** Search and Replace
 
-*** lazy-highlight-buffer highlights matches in the full buffer.
-It is useful in combination with lazy-highlight-cleanup customized to nil
+*** Isearch supports a prefix argument for 'C-s' ('isearch-repeat-forward')
+and 'C-r' ('isearch-repeat-backward').  With a prefix argument, these
+commands repeat the search for the specified occurrence of the search string.
+A negative argument repeats the search in the opposite direction.
+This makes possible also to use a prefix argument for 'M-s .'
+('isearch-forward-symbol-at-point') to find the next Nth symbol.
+
+*** To go to the first/last occurrence of the current search string
+is possible now with new commands 'isearch-beginning-of-buffer' and
+'isearch-end-of-buffer' bound to 'M-s M-<' and 'M-s M->' in Isearch.
+With a numeric argument, they go to the Nth absolute occurrence
+counting from the beginning/end of the buffer.  This complements
+'C-s'/'C-r' that searches for the next Nth relative occurrence
+with a numeric argument.
+
+*** 'isearch-lazy-count' shows the current match number and total number
+of matches in the Isearch prompt.  Customizable variables
+'lazy-count-prefix-format' and 'lazy-count-suffix-format' define the
+format of the current and the total number of matches in the prompt's
+prefix and suffix respectively.
+
+*** 'lazy-highlight-buffer' highlights matches in the full buffer.
+It is useful in combination with 'lazy-highlight-cleanup' customized to nil
 to leave matches highlighted in the whole buffer after exiting isearch.
-Also when lazy-highlight-buffer prepares highlighting in the buffer,
+Also when 'lazy-highlight-buffer' prepares highlighting in the buffer,
 navigation through the matches without flickering is more smooth.
-lazy-highlight-buffer-max-at-a-time controls the number of matches to
+'lazy-highlight-buffer-max-at-a-time' controls the number of matches to
 highlight in one iteration while processing the full buffer.
 
 +++
 *** New isearch bindings.
 
-'C-M-w' in isearch changed from isearch-del-char to the new function
-isearch-yank-symbol-or-char.  isearch-del-char is now bound to
+'C-M-w' in isearch changed from 'isearch-del-char' to the new function
+'isearch-yank-symbol-or-char'.  'isearch-del-char' is now bound to
 'C-M-d'.
 
 +++
-*** 'search-exit-option' provides new options 'move' and 'shift-move'
+*** New variable 'isearch-yank-on-move' provides options 't' and 'shift'
 to extend the search string by yanking text that ends at the new
-position after moving point in the current buffer.  'shift-move'
-extends the search string by motion commands while holding down
-the shift key.
+position after moving point in the current buffer.  'shift' extends
+the search string by motion commands while holding down the shift key.
+
+*** 'isearch-allow-scroll' provides new option 'unlimited' to allow
+scrolling any distance off screen.
 
 ---
 *** Isearch now remembers the regexp-based search mode for words/symbols
 and case-sensitivity together with search strings in the search ring.
 
+---
+*** Isearch now has its own tool-bar and menu-bar menu.
+
++++
+*** flush-lines prints and returns the number of deleted matching lines.
+
 ** Debugger
 
 +++
 *** The Lisp Debugger is now based on 'backtrace-mode'.
 Backtrace mode adds fontification and commands for changing the
-appearance of backtrace frames.  See the node "Backtraces" in the Elisp
-manual for documentation of the new mode and its commands.
+appearance of backtrace frames.  See the node "(elisp) Backtraces" in
+the Elisp manual for documentation of the new mode and its commands.
 
 ** Edebug
 
@@ -628,8 +928,8 @@ globally or for individual definitions.
 +++
 *** Edebug's backtrace buffer now uses 'backtrace-mode'.
 Backtrace mode adds fontification, links and commands for changing the
-appearance of backtrace frames.  See the node "Backtraces" in the Elisp
-manual for documentation of the new mode and its commands.
+appearance of backtrace frames.  See the node "(elisp) Backtraces" in
+the Elisp manual for documentation of the new mode and its commands.
 
 The binding of 'd' in Edebug's keymap is now 'edebug-pop-to-backtrace'
 which replaces 'edebug-backtrace'.  Consequently Edebug's backtrace
@@ -646,7 +946,7 @@ been instrumented by Edebug.
 the XTerm window title.  This feature is experimental and is disabled
 by default.
 
-** grep
+** Grep
 
 +++
 *** rgrep, lgrep and zrgrep now hide part of the command line
@@ -665,8 +965,8 @@ less verbose by removing non-essential information.
 +++
 *** ERT's backtrace buffer now uses 'backtrace-mode'.
 Backtrace mode adds fontification and commands for changing the
-appearance of backtrace frames.  See the node "Backtraces" in the Elisp
-manual for documentation of the new mode and its commands.
+appearance of backtrace frames.  See the node "(elisp) Backtraces" in
+the Elisp manual for documentation of the new mode and its commands.
 
 ** Gamegrid
 
@@ -703,11 +1003,16 @@ It can be used to set any buffer as the next one to be 
used by
 
 ---
 *** The default value of 'nxml-sexp-element-flag' is now t.
-This means that pressing C-M-SPACE now selects the entire tree by
+This means that pressing 'C-M-SPACE' now selects the entire tree by
 default, and not just the opening element.
 
 ** Eshell
 
+*** TAB completion uses the standard completion-at-point rather than pcomplete
+Its UI is slightly different but can be customized to behave similarly,
+e.g. Pcomplete's default cycling can be obtained with
+(setq completion-cycle-threshold 5).
+
 ---
 *** Expansion of history event designators is disabled by default.
 To restore the old behavior, use
@@ -719,23 +1024,35 @@ To restore the old behavior, use
 *** The function 'eshell-uniquify-list' has been renamed from
 'eshell-uniqify-list'.
 
-*** The function eshell/kill is now able to handle signal switches.
-Previously eshell/kill would fail if provided a kill signal to send to the
-process.  It now accepts signals specified either by name or by its number.
+*** The function 'eshell/kill' is now able to handle signal switches.
+Previously 'eshell/kill' would fail if provided a kill signal to send
+to the process.  It now accepts signals specified either by name or by
+its number.
+
+---
+*** Emacs now follows symlinks in history-related files.
+The files specified by 'eshell-history-file-name' and
+'eshell-last-dir-ring-file-name' can include symlinks; these are now
+followed when Emacs writes the relevant history variables to the disk.
 
 ** Shell
 
 ---
 *** Program name completion inside remote shells works now as expected.
 
++++
+*** The variable 'shell-file-name' can be set now as connection-local
+variable for remote shells.  It still defaults to "/bin/sh".
+
 ** Pcomplete
+
 *** The function 'pcomplete-uniquify-list' has been renamed from
 'pcomplete-uniqify-list'.
 
 ** Auth-source
 
 ---
-*** The Secret Service backend supports the :create key now.
+*** The Secret Service backend supports the ':create' key now.
 
 ** Tramp
 
@@ -744,6 +1061,16 @@ process.  It now accepts signals specified either by name 
or by its number.
 or NextCloud hosted files and directories.
 
 +++
+*** New connection method "rclone", which allows to access system
+storages via the 'rclone' program.  This feature is experimental.
+
++++
+*** New connection method "sudoedit", which allows to edit local files
+with different user credentials.  Contrary to the "sudo" method, no
+session is run permanently in the background.  This is for security
+reasons.
+
++++
 *** Connection methods "obex" and "synce" are removed, because they
 are obsoleted in GVFS.
 
@@ -753,7 +1080,7 @@ are obsoleted in GVFS.
 +++
 *** During user and host name completion in the minibuffer, results
 from auth-source search are taken into account.  This can be disabled
-by setting user option 'tramp-completion-use-auth-sources' to nil.
+by setting the user option 'tramp-completion-use-auth-sources' to nil.
 
 +++
 *** The user option 'tramp-ignored-file-name-regexp' allows to disable
@@ -761,7 +1088,20 @@ Tramp for some look-alike remote file names.
 
 +++
 *** For some connection methods, like "su" or "sudo", the host name in
-ad-hoc multi-hop file names must match the previous hop.
+ad-hoc multi-hop file names must match the previous hop.  Default host
+names are adjusted to the host name from the previous hop.
+
++++
+*** For the connection methods "sudo" and "doas" there exists a
+timeout, after which the underlying session is disabled.  This is for
+security reasons.
+
+** Rcirc
+
+---
+*** New user option 'rcirc-url-max-length'.
+Setting this option to an integer causes URLs displayed in Rcirc
+buffers to be truncated to that many characters.
 
 ** Register
 ---
@@ -847,30 +1187,65 @@ backtrace with 'b'.
 
 ---
 ** thingatpt.el supports a new "thing" called 'uuid'.
-A symbol 'uuid' can be passed to thing-at-point and it returns the
+A symbol 'uuid' can be passed to 'thing-at-point' and it returns the
 UUID at point.
 
-
 ** Interactive automatic highlighting
 
 +++
 *** 'highlight-regexp' can now highlight subexpressions.
-The now command accepts a prefix numeric argument to choose the
+The new command accepts a prefix numeric argument to choose the
 subexpression.
 
+** Mouse display of minor mode menu
+
+---
+*** 'minor-mode-menu-from-indicator' now displays full minor mode name.
+When there is no menu for a mode, display the mode name after the
+indicator instead of just the indicator (which is sometimes cryptic).
+
+** rx
+
+---
+*** rx now handles raw bytes in character alternatives correctly,
+when given in a string.  Previously, '(any "\x80-\xff")' would match
+characters U+0080...U+00FF.  Now the expression matches raw bytes in
+the 128...255 range, as expected.
+
+** Frames
+
++++
+*** New command 'make-frame-on-monitor' makes a frame on the specified monitor.
+
++++
+*** New value of 'minibuffer' frame parameter 'child-frame'.
+This allows to create and parent immediately a minibuffer-only child
+frame when making a frame.
+
+** Tabulated List mode
+
++++
+*** New user options for tabulated list sort indicators.
+You can now customize which sorting indicator character to display
+near the current column in Tabulated Lists (see variables
+'tabulated-list-gui-sort-indicator-asc',
+'tabulated-list-gui-sort-indicator-desc',
+'tabulated-list-tty-sort-indicator-asc', and
+'tabulated-list-tty-sort-indicator-desc').
+
 
 * New Modes and Packages in Emacs 27.1
 
-** multifile.el lets one setup multifile operations like search&replace
+** fileloop.el lets one setup multifile operations like search&replace.
 
 +++
 ** Emacs can now visit files in archives as if they were directories.
 This feature uses Tramp and works only on systems which support GVFS,
-i.e. GNU/Linux, roughly spoken.  See the chapter "(tramp) Archive file
+i.e. GNU/Linux, roughly spoken.  See the node "(tramp) Archive file
 names" in the Tramp manual for full documentation of these facilities.
 
 +++
-** New library for writing JSONRPC applications (https://jsonrpc.org)
+** New library for writing JSONRPC applications (https://jsonrpc.org).
 The 'jsonrpc' library enables writing Emacs Lisp applications that
 rely on this protocol.  Since the protocol is designed to be
 transport-agnostic, the library provides an API to implement new
@@ -882,19 +1257,19 @@ used by the Language Server Protocol (LSP), is readily 
available.
 ** Backtrace mode improves viewing of Elisp backtraces.
 Backtrace mode adds pretty printing, fontification and ellipsis
 expansion to backtrace buffers produced by the Lisp debugger, Edebug
-and ERT.  See the node "Backtraces" in the Elisp manual for
+and ERT.  See the node "(elisp) Backtraces" in the Elisp manual for
 documentation of the new mode and its commands.
 
 
 * Incompatible Lisp Changes in Emacs 27.1
 
-** define-fringe-bitmap is always defined, even when Emacs is built
+** 'define-fringe-bitmap' is always defined, even when Emacs is built
 without any GUI support.
 
 ---
 ** Just loading a theme's file no longer activates the theme's settings.
 Loading a theme with 'M-x load-theme' still activates the theme, as it
-did before.  However, loading the theme's file with "M-x load-file",
+did before.  However, loading the theme's file with 'M-x load-file',
 or using 'require' or 'load' in a Lisp program, doesn't actually apply
 the theme's settings until you either invoke 'M-x enable-theme' or
 type 'M-x load-theme'.  (In a Lisp program, calling 'enable-theme' or
@@ -907,7 +1282,14 @@ default applied immediately.
 The variable 'custom--inhibit-theme-enable' controls this behavior;
 its default value changed in Emacs 27.1.
 
-** The 'repetitions' argument of 'benchmark-run' can now also be a variable.
+** The REPETITIONS argument of 'benchmark-run' can now also be a variable.
+
+** Interpretation of relative HOME directory has changed.
+If $HOME is set to a relative file name, 'expand-file-name' now
+interprets it relative to the directory where Emacs was started, not
+relative to the 'default-directory' of the current buffer.  We recommend
+always setting $HOME to an absolute file name, so that its meaning is
+independent of where Emacs was started.
 
 ** The FILENAME argument to 'file-name-base' is now mandatory and no
 longer defaults to 'buffer-file-name'.
@@ -932,6 +1314,10 @@ old-style backquotes as new-style, bind the new variable
 integer, Emacs now signals an error if the number is too large for the
 implementation to format.
 
+** logb now returns infinity when given an infinite or zero argument,
+and returns a NaN when given a NaN.  Formerly, it returned an extreme
+fixnum for such arguments.
+
 ---
 ** Some functions and variables obsolete since Emacs 22 have been removed:
 archive-mouse-extract, assoc-ignore-case, assoc-ignore-representation,
@@ -972,16 +1358,34 @@ default-directory-alist, dired-default-directory,
 dired-default-directory-alist, dired-enable-local-variables,
 dired-hack-local-variables, dired-local-variables-file, dired-omit-here-always.
 
-** garbage collection no longer treats miscellaneous objects specially;
+** Garbage collection no longer treats miscellaneous objects specially;
 they are now allocated like any other pseudovector.  As a result, the
 'garbage-collect' and 'memory-use-count' functions no longer return a
 'misc' component, and the 'misc-objects-consed' variable has been
 removed.
 
++++
+** Reversed character ranges are no longer permitted in rx.
+Previously, ranges where the starting character is greater than the
+ending character were silently omitted.
+For example, '(rx (any "@z-a" (?9 . ?0)))' would match '@' only.
+Now, such rx expressions generate an error.
+
 
 * Lisp Changes in Emacs 27.1
 
-** lookup-key can take a list of keymaps as argument.
+** i18n (internationalization)
+
+*** ngettext can be used now to return the right plural form
+according to the given numeric value.
+
++++
+** inhibit-null-byte-detection is renamed to inhibit-nul-byte-detection
+
++++
+** 'self-insert-command' takes the char to insert as (optional) argument.
+
+** 'lookup-key' can take a list of keymaps as argument.
 
 +++
 ** 'condition-case' now accepts 't' to match any error symbol.
@@ -1015,25 +1419,26 @@ overflow error if this limit is exceeded.
 Several primitive functions formerly returned floats or lists of
 integers to represent integers that did not fit into fixnums.  These
 functions now simply return integers instead.  Affected functions
-include functions like encode-char that compute code-points, functions
-like file-attributes that compute file sizes and other attributes,
-functions like process-id that compute process IDs, and functions like
-user-uid and group-gid that compute user and group IDs.
+include functions like 'encode-char' that compute code-points, functions
+like 'file-attributes' that compute file sizes and other attributes,
+functions like 'process-id' that compute process IDs, and functions like
+'user-uid' and 'group-gid' that compute user and group IDs.
 
 +++
 ** Although the default timestamp format is still (HI LO US PS),
 it is planned to change in a future Emacs version, to exploit bignums.
 The documentation has been updated to mention that the timestamp
 format may change and that programs should use functions like
-format-time-string, decode-time, and encode-time rather than probing
-the innards of a timestamp directly, or creating a timestamp by hand.
+'format-time-string', 'decode-time', and 'encode-time' rather than
+probing the innards of a timestamp directly, or creating a timestamp
+by hand.
 
 +++
-** encode-time supports a new API (encode-time TIME &optional FORM).
+** 'encode-time' supports a new API '(encode-time TIME &optional FORM)'.
 This can convert decoded times and Lisp time values to Lisp timestamps
-of various forms, including a new timestamp form (TICKS . HZ), where
+of various forms, including a new timestamp form '(TICKS . HZ)', where
 TICKS is an integer and HZ is a positive integer denoting a clock
-frequency.  The old encode-time API is still supported.
+frequency.  The old 'encode-time' API is still supported.
 
 +++
 ** 'time-add', 'time-subtract', and 'time-less-p' now accept
@@ -1043,7 +1448,13 @@ floating-point operators do.
 +++
 ** New function 'time-equal-p' compares time values for equality.
 
-** define-minor-mode automatically documents the meaning of ARG.
++++
+** 'format-time-string' supports a new conversion specifier flag '+'
+that acts like the '0' flag but also puts a '+' before nonnegative
+years containing more than four digits.  This is for compatibility
+with POSIX.1-2017.
+
+** 'define-minor-mode' automatically documents the meaning of ARG.
 
 +++
 ** The function 'recenter' now accepts an additional optional argument.
@@ -1086,32 +1497,72 @@ On terminal emulators that support the feature, Emacs 
can now support
 ** Window-specific face remapping.
 Face specifications (of the kind used in 'face-remapping-alist')
 now support filters, allowing faces to vary between different windows
-displaying the same buffer.  See the Info node "Face Remapping" of the
-Emacs Lisp Reference manual for more detail.
+displaying the same buffer.  See the node "(elisp) Face Remapping"
+of the Emacs Lisp Reference manual for more detail.
+
++++
+** Window change functions have been redesigned.
+
+Hooks reacting to window changes run now only when redisplay detects
+that a change has actually occurred.  Six hooks are now provided:
+'window-buffer-change-functions' (run after window buffers have
+changed), 'window-size-change-functions' (run after a window was
+assigned a new buffer or size), 'window-configuration-change-hook'
+(like the former but run also when a window was deleted),
+'window-selection-change-functions' (run when the selected window
+changed) and 'window-state-change-functions' and
+'window-state-change-hook' (run when any of the preceding ones is
+run).  Applications can enforce running the latter two using the new
+function 'set-frame-window-state-change'.  'window-scroll-functions'
+are unaffected by these changes.
+
+In addition, a number of functions now allow the caller to detect what
+has changed since last redisplay: 'window-old-buffer' returns for any
+window the buffer it showed at that time.  ‘old-selected-window’ and
+'old-selected-frame' return the window and frame that were selected
+during last redisplay.  'window-old-pixel-width' (renamed from
+'window-pixel-width-before-size-change'), 'window-old-pixel-height'
+(renamed from 'window-pixel-height-before-size-change'),
+'window-old-body-pixel-width' and 'window-old-body-pixel-height'
+return the total and body sizes of any window during last redisplay.
+
+See the section "(elisp) Window Hooks" in the Elisp manual for a
+detailed explanation of the new behavior.
 
 +++
-** Special handling of buffer-local 'window-size-change-functions'.
-A buffer-local value of this hook is now run only if at least one
-window showing the buffer has changed its size.
+*** New option 'resize-mini-frames'.
+This option allows to automatically resize minibuffer-only frames
+similarly to how minibuffer windows are resized on "normal" frames.
 
 +++
-** The function assoc-delete-all now takes an optional predicate argument.
+** New buffer display action alist entry 'dedicated'.
+Such an entry allows to specify the dedicated status of a window
+created by 'display-buffer'.
+
++++
+** New buffer display action alist entry 'window-min-height'.
+Such an entry allows to specify a minimum height of the window used
+for displaying a buffer.  'display-buffer-below-selected' is the only
+action function to respect it at the moment.
+
++++
+** The function 'assoc-delete-all' now takes an optional predicate argument.
 
 +++
 ** New function 'string-distance' to calculate the Levenshtein distance
 between two strings.
 
 ** 'print-quoted' now defaults to t, so if you want to see
-(quote x) instead of 'x you will have to bind it to nil where applicable.
+'(quote x)' instead of 'x you will have to bind it to nil where applicable.
 
 +++
-** Numbers formatted via %o or %x may now be formatted as signed integers.
-This avoids problems in calls like (read (format "#x%x" -1)), and is
-more compatible with bignums, a planned feature.  To get this
-behavior, set the experimental variable binary-as-unsigned to nil,
+** Numbers formatted via '%o' or '%x' are now formatted as signed integers.
+This avoids problems in calls like '(read (format "#x%x" -1))', and is
+more compatible with bignums.  To get the traditional machine-dependent
+behavior, set the experimental variable 'binary-as-unsigned' to t,
 and if the new behavior breaks your code please email
address@hidden  Because %o and %x can now format signed
-integers, they now support the + and space flags.
address@hidden  Because '%o' and '%x' can now format signed
+integers, they now support the '+' and space flags.
 
 ** To avoid confusion caused by "smart quotes", the reader signals an
 error when reading Lisp symbols which begin with one of the following
@@ -1124,7 +1575,7 @@ backslash.  For example:
 
 +++
 ** Omitting variables after '&optional' and '&rest' is now allowed.
-For example (defun foo (&optional)) is no longer an error.  This is
+For example '(defun foo (&optional))' is no longer an error.  This is
 sometimes convenient when writing macros.  See the ChangeLog entry
 titled "Allow '&rest' or '&optional' without following variable
 (Bug#29165)" for a full listing of which arglists are accepted across
@@ -1133,8 +1584,8 @@ versions.
 ** Internal parsing commands now use 'syntax-ppss' and disregard
 'open-paren-in-column-0-is-defun-start'.  This affects mostly things like
 '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 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 passed to Emacs.
@@ -1144,6 +1595,10 @@ socket has been passed to Emacs.
 instead of just Microsoft platforms.  This fixes a 'get-free-disk-space'
 bug on OS X 10.8 and later.
 
+---
+** The function 'get-free-disk-space' returns now a non-nil value for
+remote systems, which support this check.
+
 +++
 ** 'memory-limit' now returns a better estimate of memory consumption.
 
@@ -1154,18 +1609,14 @@ each around a sequence of lisp forms, given a region.  
This is
 useful when a function makes a possibly large number of repetitive
 changes and the change hooks are time consuming.
 
----
-** The function 'get-free-disk-space' returns now a non-nil value for
-remote systems, which support this check.
-
 +++
 ** 'eql', 'make-hash-table', etc. now treat NaNs consistently.
 Formerly, some of these functions ignored signs and significands of
 NaNs.  Now, all these functions treat NaN signs and significands as
-significant.  For example, (eql 0.0e+NaN -0.0e+NaN) now returns nil
+significant.  For example, '(eql 0.0e+NaN -0.0e+NaN)' now returns nil
 because the two NaNs have different signs; formerly it returned t.
 Also, Emacs now reads and prints NaN significands; e.g., if X is a
-NaN, (format "%s" X) now returns "0.0e+NaN", "1.0e+NaN", etc.,
+NaN, '(format "%s" X)' now returns "0.0e+NaN", "1.0e+NaN", etc.,
 depending on X's significand.
 
 +++
@@ -1173,14 +1624,19 @@ depending on X's significand.
 If the optional third argument is non-nil, 'make-string' will produce
 a multibyte string even if its second argument is an ASCII character.
 
-** (format "%d" X) no longer mishandles a floating-point number X that
+** '(format "%d" X)' no longer mishandles a floating-point number X that
 does not fit in a machine integer.
 
+---
+** New coding-system 'ibm038'.
+This is the International EBCDIC encoding, also available as aliases
+'ebcdic-int' and 'cp038'.
+
 +++
-** In the DST slot, encode-time and parse-time-string now return -1
+** In the DST slot, 'encode-time' and 'parse-time-string' now return -1
 if it is not known whether daylight saving time is in effect.
-Formerly they were inconsistent: encode-time returned t in this
-situation, whereas parse-time-string returned nil.  Now they
+Formerly they were inconsistent: 'encode-time' returned t in this
+situation, whereas 'parse-time-string' returned nil.  Now they
 consistently use use nil to mean that DST is not in effect, and use -1
 to mean that it is not known whether DST is in effect.
 
@@ -1188,6 +1644,16 @@ to mean that it is not known whether DST is in effect.
 'json-insert', 'json-parse-string', and 'json-parse-buffer'.  These
 are implemented in C using the Jansson library.
 
++++
+** New function 'ring-resize'.
+'ring-resize' can be used to grow or shrink a ring.
+
++++
+** New function 'flatten-tree'.
+'flatten-list' is provided as an alias. These functions take a tree
+and 'flatten' it such that the result is a list of all the terminal
+nodes.
+
 ** Mailcap
 
 ---
@@ -1197,26 +1663,33 @@ file name extensions.
 
 *** The default way the list of possible external viewers for MIME
 types is sorted and chosen has changed.  Earlier, the most specific
-viewer was chosen, even if there was a general override in ~/.mailcap.
-For instance, if /etc/mailcap has an entry for image/gif, that one
-will be chosen even if you have an entry for image/* in your
-~/.mailcap file.  But with the new method, entries from ~/.mailcap
+viewer was chosen, even if there was a general override in "~/.mailcap".
+For instance, if "/etc/mailcap" has an entry for "image/gif", that one
+will be chosen even if you have an entry for "image/*" in your
+"~/.mailcap" file.  But with the new method, entries from "~/.mailcap"
 overrides all system and Emacs-provided defaults.  To get the old
 method back, set 'mailcap-prefer-mailcap-viewers' to nil.
 
 ** URL
 
-*** The file: handler no longer looks for index.html in directories if
-you ask it for a file:///dir URL.  Since this is a low-level library,
-such decisions (if they are to be made at all) are left to
-higher-level functions.
+*** The 'file:' handler no longer looks for "index.html" in
+directories if you ask it for a "file:///dir" URL.  Since this is a
+low-level library, such decisions (if they are to be made at all) are
+left to higher-level functions.
 
-** image-mode
+** Image mode
 
-*** image-mode started using ImageMagick by default for all images
+*** 'image-mode' started using ImageMagick by default for all images
 some years back.  It now respects 'imagemagick-types-inhibit' as a way
 to disable that.
 
+---
+*** Some image-mode variables are now buffer-local.
+The image parameters 'image-transform-rotation',
+'image-transform-scale' and 'image-transform-resize' are now declared
+buffer-local, so each buffer could have its own values for these
+parameters.
+
 ** The function 'load' now behaves correctly when loading modules.
 Specifically, it puts the module name into 'load-history', prints
 loading messages if requested, and protects against recursive loads.
@@ -1233,6 +1706,46 @@ where there's no better alternative.  We believe that 
the incorrect
 uses of this function all but disappeared by now, so we are
 un-obsoleting it.
 
++++
+** New function 'group-name' returns a group name corresponding to GID.
+
++++
+** 'make-process' now takes a keyword argument ':file-handler'; if
+that is non-nil, it will look for a file name handler for the current
+buffer's 'default-directory' and invoke that file name handler to make
+the process.  That way 'make-process' can start remote processes.
+
++++
+** Emacs now supports resizing (scaling) of images without ImageMagick.
+All modern systems are supported by this feature.  (On GNU and Unix
+systems, Cairo drawing or the XRender extension to X11 is required for
+this to be available; the configure script will test for it and, if
+found, enable scaling.)
+
+The new function 'image-scaling-p' can be used to test whether any
+given frame supports resizing.
+
++++
+** (locale-info 'paper) now returns the paper size on systems that support it.
+This is currently supported on GNUish hosts and on modern versions of
+MS-Windows.
+
+** New module environment function 'process_input' to process user
+input while module code is running.
+
++++
+** The function 'regexp-opt' accepts an additional optional argument.
+By default, the regexp returned by 'regexp-opt' may match the strings
+in any order.  If the new third argument is non-nil, the match is
+guaranteed to be performed in the order given, as if the strings were
+made into a regexp by joining them with '\|'.
+
++++
+** The function 'regexp-opt', when given an empty list of strings, now
+returns a regexp that never matches anything, which is an identity for
+this operation.  Previously, the empty string was returned in this
+case.
+
 
 * Changes in Emacs 27.1 on Non-Free Operating Systems
 
@@ -1266,6 +1779,20 @@ versions of MS-Windows.  Set this variable to 50 if for 
some reason
 you need the old behavior (and please report such situations to Emacs
 developers).
 
+---
+** New variable 'w32-multibyte-code-page'.
+This variable holds the value of the multibyte code page used by the
+system.  It is usually zero, which indicates that 'w32-ansi-code-page'
+is being used, except in Far Eastern locales.  When this variable is
+non-zero, Emacs at startup sets 'locale-coding-system' to the
+corresponding encoding, instead of using 'w32-ansi-code-page'.
+
++++
+** On NS the behaviour of drag and drop can now be modified by use of
+modifier keys in line with Apples guidelines.  This makes the drag and
+drop behaviour more consistent, as previously the sending application
+was able to 'set' modifiers without the knowledge of the user.
+
 
 ----------------------------------------------------------------------
 This file is part of GNU Emacs.
diff --git a/etc/NEWS.1-17 b/etc/NEWS.1-17
index c74cc3d..758ef65 100644
--- a/etc/NEWS.1-17
+++ b/etc/NEWS.1-17
@@ -1,10 +1,10 @@
 GNU Emacs NEWS -- history of user-visible changes.  26-Mar-1986
 
-Copyright (C) 1985-1986, 2006-2018 Free Software Foundation, Inc.
+Copyright (C) 1985-1986, 2006-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
-This file is about changes in emacs versions 1 through 17.
+This file is about changes in Emacs versions 1 through 17.
 
 
 
diff --git a/etc/NEWS.18 b/etc/NEWS.18
index 81b1a39..fe2f8c8 100644
--- a/etc/NEWS.18
+++ b/etc/NEWS.18
@@ -1,10 +1,10 @@
 GNU Emacs NEWS -- history of user-visible changes.  17-Aug-1988
 
-Copyright (C) 1988, 2006-2018 Free Software Foundation, Inc.
+Copyright (C) 1988, 2006-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
-This file is about changes in emacs version 18.
+This file is about changes in Emacs version 18.
 
 
 
diff --git a/etc/NEWS.19 b/etc/NEWS.19
index 1f84e87..757d029 100644
--- a/etc/NEWS.19
+++ b/etc/NEWS.19
@@ -1,10 +1,10 @@
 GNU Emacs NEWS -- history of user-visible changes.  1992.
 
-Copyright (C) 1993-1995, 2001, 2006-2018 Free Software Foundation, Inc.
+Copyright (C) 1993-1995, 2001, 2006-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
-This file is about changes in emacs versions 19.
+This file is about changes in Emacs versions 19.
 
 
 
diff --git a/etc/NEWS.20 b/etc/NEWS.20
index 398148b..931e227 100644
--- a/etc/NEWS.20
+++ b/etc/NEWS.20
@@ -1,13 +1,13 @@
 GNU Emacs NEWS -- history of user-visible changes.  2006-05-31
 
-Copyright (C) 1999-2001, 2006-2018 Free Software Foundation, Inc.
+Copyright (C) 1999-2001, 2006-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
 Please send Emacs bug reports to address@hidden
 If possible, use M-x report-emacs-bug.
 
-This file is about changes in emacs version 20.
+This file is about changes in Emacs version 20.
 
 
 
diff --git a/etc/NEWS.21 b/etc/NEWS.21
index ea4f421..d078fb1 100644
--- a/etc/NEWS.21
+++ b/etc/NEWS.21
@@ -1,10 +1,10 @@
 GNU Emacs NEWS -- history of user-visible changes.  2006-05-31
 
-Copyright (C) 2000-2018 Free Software Foundation, Inc.
+Copyright (C) 2000-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
-This file is about changes in emacs version 21.
+This file is about changes in Emacs version 21.
 
 
 
diff --git a/etc/NEWS.22 b/etc/NEWS.22
index 26054d2..675b144 100644
--- a/etc/NEWS.22
+++ b/etc/NEWS.22
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Emacs bug reports to address@hidden
diff --git a/etc/NEWS.23 b/etc/NEWS.23
index 181dad7..bbc81d2 100644
--- a/etc/NEWS.23
+++ b/etc/NEWS.23
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2007-2018 Free Software Foundation, Inc.
+Copyright (C) 2007-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Emacs bug reports to address@hidden
diff --git a/etc/NEWS.24 b/etc/NEWS.24
index 9ace7ce..9150e49 100644
--- a/etc/NEWS.24
+++ b/etc/NEWS.24
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2010-2018 Free Software Foundation, Inc.
+Copyright (C) 2010-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Emacs bug reports to address@hidden
diff --git a/etc/NEWS.25 b/etc/NEWS.25
index 4ae5ece..98aec3c 100644
--- a/etc/NEWS.25
+++ b/etc/NEWS.25
@@ -1,6 +1,6 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2014-2018 Free Software Foundation, Inc.
+Copyright (C) 2014-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Emacs bug reports to address@hidden
diff --git a/etc/NEWS.26 b/etc/NEWS.26
index dfafe7c..f570f75 100644
--- a/etc/NEWS.26
+++ b/etc/NEWS.26
@@ -1,10 +1,10 @@
 GNU Emacs NEWS -- history of user-visible changes.
 
-Copyright (C) 2016-2018 Free Software Foundation, Inc.
+Copyright (C) 2016-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
-Please send Emacs bug reports to address@hidden
-If possible, use M-x report-emacs-bug.
+Please send Emacs bug reports to 'address@hidden'.
+If possible, use 'M-x report-emacs-bug'.
 
 This file is about changes in Emacs version 26.
 
@@ -13,19 +13,17 @@ See files NEWS.25, NEWS.24, ..., NEWS.18, and NEWS.1-17 for 
changes
 in older Emacs versions.
 
 You can narrow news to a specific version by calling 'view-emacs-news'
-with a prefix argument or by typing C-u C-h C-n.
+with a prefix argument or by typing 'C-u C-h C-n'.
 
 
 * Installation Changes in Emacs 26.2
 
----
 ** Building Emacs with the '--with-xwidgets' option now requires WebKit2.
 To build Emacs with xwidgets support, you will need to install the
 webkit2gtk-4.0 package; version 2.12 or later is required.
 (This change was actually made in Emacs 26.1, but was not called out
 in its NEWS.)
 
-+++
 ** Installing Emacs now installs the emacs-module.h file.
 The emacs-module.h file is now installed in the system-wide include
 directory as part of the Emacs installation.  This allows to build
@@ -37,10 +35,8 @@ Emacs modules outside of the Emacs source tree.
 
 * Changes in Emacs 26.2
 
----
 ** Emacs is now compliant with the latest version 11.0 of the Unicode Standard.
 
----
 ** New variable 'xft-ignore-color-fonts'.
 Default t means don't try to load color fonts when using Xft, as they
 often cause crashes.  Set it to nil if you really need those fonts.
@@ -51,29 +47,41 @@ often cause crashes.  Set it to nil if you really need 
those fonts.
 
 * Changes in Specialized Modes and Packages in Emacs 26.2
 
+** Dired
+
+*** The 'Z' command on a directory name compresses all of its files.
+It produces a compressed '.tar.gz' archive with all the files in the
+directory and all of its subdirectories.  For symmetry, 'Z' on a
+'.tar.gz' or a '.tgz' archive extracts all the archived files into the
+current directory; thus, typing 'Z' on a '.tar.gz' archive created by
+a previous 'Z' command will extract the archived files into a
+directory whose name is the archive name sans the '.tar.gz' extension.
+(This change was actually made in Emacs 25.1 but was only
+partially called out in its NEWS; 'tgz' handling was added in 26.1.)
+
 ** Ibuffer
 
----
 *** New toggle 'ibuffer-do-toggle-lock', bound to 'L'.
 
 ** Imenu
 
----
 *** The value for 'imenu-auto-rescan-maxout' has been increased to 600000.
 
 ** Gnus
 
----
 *** Mailutils movemail will now be used if found at runtime.
-The default value of mail-source-movemail-program is now "movemail".
+The default value of 'mail-source-movemail-program' is now "movemail".
 This ensures that the movemail program from GNU Mailutils will be used
 if found in 'exec-path', even if it was not found at build time.  To
-use a different program, customize mail-source-movemail-program to the
+use a different program, customize 'mail-source-movemail-program' to the
 absolute file name of the desired executable.
 
+** Shadowfile
+
+*** shadowfile.el has been rewritten to support Tramp file names.
+
 ** Shell mode
 
----
 *** Shell mode buffers now have 'scroll-conservatively' set to 101.
 This is so as to better emulate the scrolling behavior of a text
 terminal when new output is added to the screen buffer.  To get back
@@ -84,13 +92,11 @@ in its NEWS.)
 
 ** VC
 
----
 *** VC support for Mercurial was improved.
 Emacs now avoids invoking 'hg' as much as possible, for faster operation.
 (This and the following changes were actually made in Emacs 26.1, but
 were not called out in its NEWS.)
 
----
 **** New vc-hg options.
 The new option 'vc-hg-parse-hg-data-structures' controls whether vc-hg
 will try parsing the Mercurial data structures directly instead of
@@ -102,34 +108,27 @@ The new option 
'vc-hg-use-file-version-for-mode-line-version' controls
 whether the version shown on the mode line is that of the visited file
 or of the repository working copy.
 
----
-**** Display of Mercurial revisions in the mode-line has changed.
+**** Display of Mercurial revisions in the mode line has changed.
 Previously, the mode line displayed the local number (1, 2, 3, ...) of
 the revision.  Starting with Emacs 26.1, the default has changed, and
 it now shows the global revision number, in the form of its changeset
 hash value.  To get back the previous behavior, customize the new
 option 'vc-hg-symbolic-revision-styles' to the value '("{rev}")'.
 
----
-** shadowfile.el has been rewritten to support Tramp file names.
-
 
 * New Modes and Packages in Emacs 26.2
 
 
 * Incompatible Lisp Changes in Emacs 26.2
 
----
 ** shadowfile config files have changed their syntax.
 Existing files "~/.emacs.d/shadows" and "~/.emacs.d/shadow_todo" must
 be removed prior using the changed 'shadow-*' commands.
 
-+++
 ** 'thread-alive-p' has been renamed to 'thread-live-p'.
 The old name is an alias of the new name.  Future Emacs version will
 obsolete it.
 
----
 ** 'while-no-input' does not return due to input from subprocesses.
 Input that arrived from subprocesses while some code executed inside
 the 'while-no-input' form injected an internal buffer-switch event
@@ -142,28 +141,30 @@ remove 'buffer-switch' from the list of events in
 
 * Lisp Changes in Emacs 26.2
 
-+++
 ** The new function 'read-answer' accepts either long or short answers
 depending on the new customizable variable 'read-answer-short'.
 
-+++
 ** New function 'assoc-delete-all'.
 Like 'assq-delete-all', but uses 'equal' for comparison.
 
----
 ** The function 'thing-at-point' behaves as before Emacs 26.1.
 The behavior of 'thing-at-point' when called with argument 'list' has
 changed in Emacs 26.1, in that it didn't consider text inside comments
 and strings as a potential list.  This change is now reverted, and
 'thing-at-point' behaves like it did before Emacs 26.1.
 
-To cater to use cases where comments and strings are to be ignored
+** To cater to use cases where comments and strings are to be ignored
 when looking for a list, the function 'list-at-point' now takes an
 optional argument to do so.
 
 
 * Changes in Emacs 26.2 on Non-Free Operating Systems
 
+** macOS features can now be detected at run-time as well as at
+build-time.  See nextstep/INSTALL for details.
+(This change was actually made in Emacs 26.1, but was undocumented and
+not called out in its NEWS.)
+
 
 * Installation Changes in Emacs 26.1
 
@@ -175,11 +176,11 @@ version 2.6.6 or later.
 
 ** The new option 'configure --with-mailutils' causes Emacs to rely on
 GNU Mailutils to retrieve email.  It is recommended, and is the
-default if GNU Mailutils is installed.  When --with-mailutils is not
+default if GNU Mailutils is installed.  When '--with-mailutils' is not
 in effect, the Emacs build procedure by default continues to build and
 install a limited 'movemail' substitute that retrieves POP3 email only
 via insecure channels.  To avoid this problem, use either
---with-mailutils or --without-pop when configuring; --without-pop
+'--with-mailutils' or '--without-pop' when configuring; '--without-pop'
 is the default on platforms other than native MS-Windows.
 
 ** The new option 'configure --enable-gcc-warnings=warn-only' causes
@@ -779,6 +780,9 @@ zone name instead of the numeric form.  The '%z' format 
continues to
 be the numeric form.  The new behavior is compatible with
 'format-time-string'.
 
+*** New user option 'gnus-rcvstore-options' provides a way to
+specify additional options when saving messages to an MH folder.
+
 ** Ibuffer
 
 *** New command 'ibuffer-jump'.
diff --git a/etc/NEXTSTEP b/etc/NEXTSTEP
index f4f2c2e..e5555a9 100644
--- a/etc/NEXTSTEP
+++ b/etc/NEXTSTEP
@@ -1,4 +1,4 @@
-Copyright (C) 2008-2018 Free Software Foundation, Inc.
+Copyright (C) 2008-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 This file contains information about GNU Emacs on "Nextstep" platforms.
diff --git a/etc/NXML-NEWS b/etc/NXML-NEWS
index 250ee17..8bae9b0 100644
--- a/etc/NXML-NEWS
+++ b/etc/NXML-NEWS
@@ -1,4 +1,4 @@
-Copyright (C) 2007-2018 Free Software Foundation, Inc.
+Copyright (C) 2007-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/etc/ORDERS b/etc/ORDERS
deleted file mode 100644
index 1df755d..0000000
--- a/etc/ORDERS
+++ /dev/null
@@ -1,8 +0,0 @@
-Printed copies of Emacs manuals
-
-Note added January 2014:
-
-This file is obsolete and will be removed in future.
-Please update any links to use
-  info node `(emacs)Printed Books'
-instead.
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index 013c7b1..2497501 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -3,7 +3,7 @@ ORG NEWS -- history of user-visible changes.   -*- mode: org; 
coding: utf-8 -*-
 #+LINK: doc https://orgmode.org/worg/doc.html#%s
 #+LINK: git https://code.orgmode.org/bzg/org-mode/commit/%s
 
-Copyright (C) 2012-2018 Free Software Foundation, Inc.
+Copyright (C) 2012-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 Please send Org bug reports to mailto:address@hidden
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index 0cbcca4..785e6e1 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -1,6 +1,6 @@
 Known Problems with GNU Emacs
 
-Copyright (C) 1987-1989, 1993-1999, 2001-2018 Free Software Foundation,
+Copyright (C) 1987-1989, 1993-1999, 2001-2019 Free Software Foundation,
 Inc.
 See the end of the file for license conditions.
 
@@ -1833,6 +1833,12 @@ term/xterm.el) for more details.
 
 ** GNU/Linux
 
+*** GNU/Linux: profiler-report outputs nothing.
+
+A few versions of the Linux kernel have timer bugs that break CPU
+profiling; see Bug#34235.  To fix the problem, upgrade to one of the
+kernel versions 4.14.97, 4.19.19, or 4.20.6, or later.
+
 *** GNU/Linux: Process output is corrupted.
 
 There is a bug in Linux kernel 2.6.10 PTYs that can cause emacs to
diff --git a/etc/README b/etc/README
index 9a85ce1..ca6f38e 100644
--- a/etc/README
+++ b/etc/README
@@ -7,5 +7,5 @@ COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 File: emacs.icon
   Author: Sun Microsystems, Inc
-  Copyright (C) 1999, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1999, 2001-2019 Free Software Foundation, Inc.
   License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/TERMS b/etc/TERMS
index cea5932..19b8757 100644
--- a/etc/TERMS
+++ b/etc/TERMS
@@ -1,4 +1,4 @@
-Copyright (C) 1999, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1999, 2001-2019 Free Software Foundation, Inc.
 See the end of the file for copying permissions.
 
 This file describes what you must or might want to do to termcap entries
diff --git a/etc/THE-GNU-PROJECT b/etc/THE-GNU-PROJECT
deleted file mode 100644
index d2aa155..0000000
--- a/etc/THE-GNU-PROJECT
+++ /dev/null
@@ -1,8 +0,0 @@
-The GNU Project
-
-Note added March 2014:
-
-This file is obsolete and will be removed in future.
-Please update any references to use
-
-<https://www.gnu.org/gnu/thegnuproject.html>
diff --git a/etc/TODO b/etc/TODO
index de57974..ccb82cd 100644
--- a/etc/TODO
+++ b/etc/TODO
@@ -1,6 +1,6 @@
 Emacs TODO List                                                   -*-outline-*-
 
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/etc/WHY-FREE b/etc/WHY-FREE
deleted file mode 100644
index cd2c2fc..0000000
--- a/etc/WHY-FREE
+++ /dev/null
@@ -1,8 +0,0 @@
-Why Software Should Not Have Owners
-
-Note added March 2014:
-
-This file is obsolete and will be removed in future.
-Please update any references to use
-
-<https://www.gnu.org/philosophy/why-free.html>
diff --git a/etc/charsets/README b/etc/charsets/README
index 6366cf7..0cf0368 100644
--- a/etc/charsets/README
+++ b/etc/charsets/README
@@ -1,6 +1,6 @@
 # README file for charset mapping files in this directory.
 
-# Copyright (C) 2003-2018 Free Software Foundation, Inc.
+# Copyright (C) 2003-2019 Free Software Foundation, Inc.
 # Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 #   National Institute of Advanced Industrial Science and Technology (AIST)
 #   Registration Number H13PRO009
diff --git a/etc/compilation.txt b/etc/compilation.txt
index 00bd0eb..eccdfa7 100644
--- a/etc/compilation.txt
+++ b/etc/compilation.txt
@@ -625,7 +625,7 @@ Compilation segmentation fault at Thu Jul 13 10:55:49
 Compilation finished at Thu Jul 21 15:02:15
 
 
-Copyright (C) 2004-2018 Free Software Foundation, Inc.
+Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 COPYING PERMISSIONS:
 
diff --git a/etc/edt-user.el b/etc/edt-user.el
index 535b066..5aede6b 100644
--- a/etc/edt-user.el
+++ b/etc/edt-user.el
@@ -1,6 +1,6 @@
 ;;; edt-user.el --- Sample user customizations for Emacs EDT emulation
 
-;; Copyright (C) 1986, 1992-1993, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1986, 1992-1993, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Kevin Gallagher <address@hidden>
diff --git a/etc/emacs-buffer.gdb b/etc/emacs-buffer.gdb
index 6bb37f3..efbf75d 100644
--- a/etc/emacs-buffer.gdb
+++ b/etc/emacs-buffer.gdb
@@ -1,6 +1,6 @@
 # emacs-buffer.gdb --- gdb macros for recovering buffers from emacs coredumps
 
-# Copyright (C) 2005-2018 Free Software Foundation, Inc.
+# Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 # Author: Noah Friedman <address@hidden>
 # Created: 2005-04-28
diff --git a/etc/emacs.appdata.xml b/etc/emacs.appdata.xml
index f4ef0e7..6898de3 100644
--- a/etc/emacs.appdata.xml
+++ b/etc/emacs.appdata.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Copyright (C) 2014-2018 Free Software Foundation, Inc. -->
+<!-- Copyright (C) 2014-2019 Free Software Foundation, Inc. -->
 <component type="desktop-application">
  <id>org.gnu.emacs</id>
  <metadata_license>GFDL-1.3+</metadata_license>
diff --git a/etc/enriched.txt b/etc/enriched.txt
index bf3e91a..839dd2f 100644
--- a/etc/enriched.txt
+++ b/etc/enriched.txt
@@ -253,7 +253,7 @@ it.</indent>
 
 
 
-Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 
 COPYING PERMISSIONS:
 
diff --git a/etc/forms/forms-d2.el b/etc/forms/forms-d2.el
index 57ace61..eeca3c0 100644
--- a/etc/forms/forms-d2.el
+++ b/etc/forms/forms-d2.el
@@ -1,6 +1,6 @@
 ;;; forms-d2.el --- demo forms-mode
 
-;; Copyright (C) 1991, 1994-1997, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1991, 1994-1997, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Johan Vromans <address@hidden>
diff --git a/etc/gnus-tut.txt b/etc/gnus-tut.txt
index cc6f71d..d9ea4f6 100644
--- a/etc/gnus-tut.txt
+++ b/etc/gnus-tut.txt
@@ -24,7 +24,7 @@ was done by moi, yours truly, your humble servant, Lars Magne
 Ingebrigtsen.  If you have a WWW browser, you can investigate to your
 heart's delight at <URL:http://www.ifi.uio.no/~larsi/larsi.html>.
 
-;; Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
diff --git a/etc/grep.txt b/etc/grep.txt
index 75187b9..d01f994 100644
--- a/etc/grep.txt
+++ b/etc/grep.txt
@@ -97,7 +97,7 @@ grep -nH -e "xyzxyz" ../info/*
 
 
 
-Copyright (C) 2005-2018 Free Software Foundation, Inc.
+Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 COPYING PERMISSIONS:
 
diff --git a/etc/images/README b/etc/images/README
index 34e145e..5989a77 100644
--- a/etc/images/README
+++ b/etc/images/README
@@ -27,19 +27,19 @@ COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 File: mh-logo.xpm
   Author: Satyaki Das
-  Copyright (C) 2003-2018 Free Software Foundation, Inc.
+  Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 Files: gnus.pbm
   Author: Luis Fernandes <address@hidden>
-  Copyright (C) 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 Files: splash.png, splash.svg, splash.pbm, splash.xpm
   Author: Francesc Rocher <address@hidden>
-  Copyright (C) 2008-2018 Free Software Foundation, Inc.
+  Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 Files: checked.xpm, unchecked.xpm
   Author: Chong Yidong <address@hidden>
-  Copyright (C) 2010-2018 Free Software Foundation, Inc.
+  Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 
 * The following icons are from GTK+ 2.x. They are not part of Emacs, but
diff --git a/etc/images/checked.xpm b/etc/images/checked.xpm
index 8d34be2..6ec8c5d 100644
--- a/etc/images/checked.xpm
+++ b/etc/images/checked.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-/* Copyright (C) 2010-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2010-2019 Free Software Foundation, Inc.
  *
  * Author: Chong Yidong <address@hidden>
  *
diff --git a/etc/images/custom/README b/etc/images/custom/README
index e28576a..498f168 100644
--- a/etc/images/custom/README
+++ b/etc/images/custom/README
@@ -6,5 +6,5 @@ COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 Files: down.xpm down-pushed.xpm right.xpm right-pushed.xpm
 Author: Juri Linkov
-Copyright (C) 2008-2018 Free Software Foundation, Inc.
+Copyright (C) 2008-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/ezimage/README b/etc/images/ezimage/README
index d30b35c..512cfb9 100644
--- a/etc/images/ezimage/README
+++ b/etc/images/ezimage/README
@@ -7,5 +7,5 @@ Files: bits.xpm bitsbang.xpm box-minus.xpm box-plus.xpm
        tag-gt.xpm tag-minus.xpm tag-plus.xpm tag-type.xpm tag-v.xpm
        tag.xpm unlock.xpm
 Author: Eric M. Ludlam
-Copyright (C) 1999-2018 Free Software Foundation, Inc.
+Copyright (C) 1999-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/gnus/README b/etc/images/gnus/README
index a6a5274..b41a944 100644
--- a/etc/images/gnus/README
+++ b/etc/images/gnus/README
@@ -7,7 +7,7 @@ COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 Files: important.xpm, unimportant.xpm
 Author: Simon Josefsson <address@hidden>
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 Files: catchup.pbm catchup.xpm cu-exit.pbm cu-exit.xpm
   describe-group.pbm describe-group.xpm exit-gnus.pbm exit-gnus.xpm
@@ -21,11 +21,11 @@ Files: catchup.pbm catchup.xpm cu-exit.pbm cu-exit.xpm
   unsubscribe.pbm unsubscribe.xpm uu-decode.pbm uu-decode.xpm
   uu-post.pbm uu-post.xpm
 Author: Luis Fernandes <address@hidden>
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 Files: gnus.png, gnus.svg
   Author: Francesc Rocher <address@hidden>
-  Copyright (C) 2008-2018 Free Software Foundation, Inc.
+  Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 
 * The following icons are from GNOME 2.x. They are not part of Emacs,
diff --git a/etc/images/gnus/gnus.svg b/etc/images/gnus/gnus.svg
index 4c1e9e8..ed70274 100644
--- a/etc/images/gnus/gnus.svg
+++ b/etc/images/gnus/gnus.svg
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!-- Gnu Emacs Logo
 
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
    Author: Francesc Rocher <address@hidden>
 
diff --git a/etc/images/gud/README b/etc/images/gud/README
index 7d36e33..dd63cce 100644
--- a/etc/images/gud/README
+++ b/etc/images/gud/README
@@ -1,7 +1,7 @@
 COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 The following icons were created by Nick Roberts <address@hidden>.
-Copyright (C) 2002-2018 Free Software Foundation, Inc.
+Copyright (C) 2002-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
 
   break.pbm, nexti.pbm, go.pbm, pp.pbm, print.pbm, pstar.pbm, remove.pbm
@@ -31,7 +31,7 @@ their copyright assignment included the icons.
 The following icons are converted from the Insight Windows style icon
 set in src/gdb/gdbtk/library/images2.
 
-Copyright (C) 2002-2018 Free Software Foundation, Inc.
+Copyright (C) 2002-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
 
   cont.pbm and cont.xpm were converted from continue.gif
@@ -47,7 +47,7 @@ License: GNU General Public License version 3 or later (see 
COPYING)
 The following icons are created from the Insight Windows style icon
 set in src/gdb/gdbtk/library/images2.
 
-Copyright (C) 2002-2018 Free Software Foundation, Inc.
+Copyright (C) 2002-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
 
   rcont.xpm rfinish.xpm
diff --git a/etc/images/icons/README b/etc/images/icons/README
index 6f61c0b..55bb1fa 100644
--- a/etc/images/icons/README
+++ b/etc/images/icons/README
@@ -6,7 +6,7 @@ Files: hicolor/16x16/apps/emacs.png hicolor/24x24/apps/emacs.png
        hicolor/scalable/mimetypes/emacs-document.svg
 
 Author: Nicolas Petton <address@hidden>
-Copyright (C) 2015-2018 Free Software Foundation, Inc.
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
 
 Files: hicolor/16x16/apps/emacs23.png hicolor/24x24/apps/emacs23.png
@@ -14,7 +14,7 @@ Files: hicolor/16x16/apps/emacs23.png 
hicolor/24x24/apps/emacs23.png
        hicolor/128x128/apps/emacs23.png hicolor/scalable/apps/emacs23.svg
 
 Author: Kentaro Ohkouchi <address@hidden>
-Copyright (C) 2007-2018 Free Software Foundation, Inc.
+Copyright (C) 2007-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
 
 
@@ -22,7 +22,7 @@ Files: hicolor/16x16/apps/emacs22.png 
hicolor/24x24/apps/emacs22.png
        hicolor/32x32/apps/emacs22.png hicolor/48x48/apps/emacs22.png
 
 Author: Andrew Zhilin <address@hidden>
-Copyright (C) 2005-2018 Free Software Foundation, Inc.
+Copyright (C) 2005-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
 
 Files: allout-widgets-dark-bg/closed.png
@@ -71,5 +71,5 @@ Files: allout-widgets-dark-bg/closed.png
        allout-widgets-light-bg/through-descender.xpm
 
 Author: Ken Manheimer <address@hidden>
-Copyright (C) 2011-2018 Free Software Foundation, Inc.
+Copyright (C) 2011-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/icons/hicolor/scalable/apps/emacs.svg 
b/etc/images/icons/hicolor/scalable/apps/emacs.svg
index fdb7d64..e3e3b33 100644
--- a/etc/images/icons/hicolor/scalable/apps/emacs.svg
+++ b/etc/images/icons/hicolor/scalable/apps/emacs.svg
@@ -15,7 +15,7 @@
      id="metadata70"><rdf:RDF><cc:Work
          rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
            rdf:resource="http://purl.org/dc/dcmitype/StillImage"; 
/><dc:title></dc:title></cc:Work></rdf:RDF></metadata><!-- Gnu Emacs Icon
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
    Author: Nicolas Petton <address@hidden>
 
diff --git a/etc/images/icons/hicolor/scalable/apps/emacs23.svg 
b/etc/images/icons/hicolor/scalable/apps/emacs23.svg
index 35623e7..7303fb9 100644
--- a/etc/images/icons/hicolor/scalable/apps/emacs23.svg
+++ b/etc/images/icons/hicolor/scalable/apps/emacs23.svg
@@ -10,7 +10,7 @@
    id="svg4768"
    xml:space="preserve">
 <!-- Gnu Emacs Icon
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
    This file is part of GNU Emacs.
 
diff --git a/etc/images/icons/hicolor/scalable/mimetypes/emacs-document23.svg 
b/etc/images/icons/hicolor/scalable/mimetypes/emacs-document23.svg
index 12ab02a..6588596 100644
--- a/etc/images/icons/hicolor/scalable/mimetypes/emacs-document23.svg
+++ b/etc/images/icons/hicolor/scalable/mimetypes/emacs-document23.svg
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!-- Gnu Emacs Document Icon
 
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
    This file is part of GNU Emacs.
 
diff --git a/etc/images/mh-logo.xpm b/etc/images/mh-logo.xpm
index a627421..fe88c46 100644
--- a/etc/images/mh-logo.xpm
+++ b/etc/images/mh-logo.xpm
@@ -1,7 +1,7 @@
 /* XPM */
 /* MH-E Logo
  *
- * Copyright (C) 2003-2018 Free Software Foundation, Inc.
+ * Copyright (C) 2003-2019 Free Software Foundation, Inc.
  *
  * Author: Satyaki Das
  *
diff --git a/etc/images/mpc/README b/etc/images/mpc/README
index 8d91e24..05821ef 100644
--- a/etc/images/mpc/README
+++ b/etc/images/mpc/README
@@ -2,5 +2,5 @@ COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 Files: add.xpm ffwd.xpm next.xpm pause.xpm play.xpm prev.xpm rewind.xpm 
stop.xpm
 Author: Stefan Monnier <address@hidden>
-Copyright (C) 2009-2018 Free Software Foundation, Inc.
+Copyright (C) 2009-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/newsticker/README b/etc/images/newsticker/README
index 290f714..9128e84 100644
--- a/etc/images/newsticker/README
+++ b/etc/images/newsticker/README
@@ -4,5 +4,5 @@ Files: browse-url.xpm get-all.xpm mark-immortal.xpm 
mark-read.xpm
        narrow.xpm next-feed.xpm next-item.xpm prev-feed.xpm
        prev-item.xpm rss-feed.png rss-feed.svg update.xpm
 Author: Ulf Jasper
-Copyright (C) 2011-2018 Free Software Foundation, Inc.
+Copyright (C) 2011-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/smilies/README b/etc/images/smilies/README
index 5387d3b..3033df3 100644
--- a/etc/images/smilies/README
+++ b/etc/images/smilies/README
@@ -3,5 +3,5 @@ Files: blink.pbm blink.xpm braindamaged.xpm cry.xpm dead.xpm 
evil.xpm
        sad.xpm smile.pbm smile.xpm wry.pbm wry.xpm
 Authors: Reiner Steib, Simon Josefsson, Kai Grossjohann, Alex
          Schroeder, Oliver Scholz, Per Abrahamsen, Kim F. Storm.
-Copyright (C) 1999-2018 Free Software Foundation, Inc.
+Copyright (C) 1999-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/smilies/grayscale/README 
b/etc/images/smilies/grayscale/README
index d83c059..acb2c66 100644
--- a/etc/images/smilies/grayscale/README
+++ b/etc/images/smilies/grayscale/README
@@ -3,5 +3,5 @@ Files: blink.xpm braindamaged.xpm cry.xpm dead.xpm evil.xpm 
forced.xpm
        frown.xpm grin.xpm indifferent.xpm reverse-smile.xpm sad.xpm
        smile.xpm wry.xpm
 Author: Adam Sjøgren
-Copyright (C) 2007-2018 Free Software Foundation, Inc.
+Copyright (C) 2007-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/smilies/medium/README b/etc/images/smilies/medium/README
index d83c059..acb2c66 100644
--- a/etc/images/smilies/medium/README
+++ b/etc/images/smilies/medium/README
@@ -3,5 +3,5 @@ Files: blink.xpm braindamaged.xpm cry.xpm dead.xpm evil.xpm 
forced.xpm
        frown.xpm grin.xpm indifferent.xpm reverse-smile.xpm sad.xpm
        smile.xpm wry.xpm
 Author: Adam Sjøgren
-Copyright (C) 2007-2018 Free Software Foundation, Inc.
+Copyright (C) 2007-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/splash.svg b/etc/images/splash.svg
index 9a08f16..f21f1dc 100644
--- a/etc/images/splash.svg
+++ b/etc/images/splash.svg
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!-- Gnu Emacs Logo
 
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
    Author: Francesc Rocher <address@hidden>
    Based on the original work by Luis Fernandes <address@hidden>
diff --git a/etc/images/tree-widget/default/README 
b/etc/images/tree-widget/default/README
index 07a1dcb..7632e16 100644
--- a/etc/images/tree-widget/default/README
+++ b/etc/images/tree-widget/default/README
@@ -5,5 +5,5 @@ Files: close.png close.xpm empty.png empty.xpm end-guide.png 
end-guide.xpm
        no-guide.png no-guide.xpm no-handle.png no-handle.xpm open.png
        open.xpm
 Author: David Ponce <address@hidden>
-Copyright (C) 2004-2018 Free Software Foundation, Inc.
+Copyright (C) 2004-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/tree-widget/folder/README 
b/etc/images/tree-widget/folder/README
index c4a97ff..49198e0 100644
--- a/etc/images/tree-widget/folder/README
+++ b/etc/images/tree-widget/folder/README
@@ -5,5 +5,5 @@ Files:  close.png close.xpm empty.png empty.xpm end-guide.png
         leaf.png leaf.xpm no-guide.png no-guide.xpm no-handle.png
         no-handle.xpm open.png open.xpm
 Author: David Ponce <address@hidden>
-Copyright (C) 2004-2018 Free Software Foundation, Inc.
+Copyright (C) 2004-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
diff --git a/etc/images/unchecked.xpm b/etc/images/unchecked.xpm
index c364375..b51ee3d 100644
--- a/etc/images/unchecked.xpm
+++ b/etc/images/unchecked.xpm
@@ -1,5 +1,5 @@
 /* XPM */
-/* Copyright (C) 2010-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2010-2019 Free Software Foundation, Inc.
  *
  * Author: Chong Yidong <address@hidden>
  *
diff --git a/etc/org/README b/etc/org/README
index 7c175e3..496ccb0 100644
--- a/etc/org/README
+++ b/etc/org/README
@@ -1,7 +1,7 @@
 The files OrgOdtContentTemplate.xml and OrgOdtStyles.xml have the
 following copyright information:
 
-Copyright (C) 2010-2018 Free Software Foundation, Inc.
+Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 These files are part of GNU Emacs.
 
diff --git a/etc/ps-prin0.ps b/etc/ps-prin0.ps
index 70ed268..16ead7f 100644
--- a/etc/ps-prin0.ps
+++ b/etc/ps-prin0.ps
@@ -1,7 +1,7 @@
 % === BEGIN ps-print prologue 0
 % version: 6.0
 
-% Copyright (C) 2000-2018 Free Software Foundation, Inc.
+% Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 % This file is part of GNU Emacs.
 
diff --git a/etc/ps-prin1.ps b/etc/ps-prin1.ps
index 8ac2951..8588d5d 100644
--- a/etc/ps-prin1.ps
+++ b/etc/ps-prin1.ps
@@ -1,7 +1,7 @@
 % === BEGIN ps-print prologue 1
 % version: 6.1
 
-% Copyright (C) 2000-2018 Free Software Foundation, Inc.
+% Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 % This file is part of GNU Emacs.
 
diff --git a/etc/refcards/Makefile b/etc/refcards/Makefile
index a3c8e55..469e8fa 100644
--- a/etc/refcards/Makefile
+++ b/etc/refcards/Makefile
@@ -1,6 +1,6 @@
 ### Makefile for Emacs refcards
 
-## Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+## Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 ## This file is part of GNU Emacs.
 #
diff --git a/etc/refcards/README b/etc/refcards/README
index 1c3e5be..9e85830 100644
--- a/etc/refcards/README
+++ b/etc/refcards/README
@@ -1,4 +1,4 @@
-Copyright (C) 2013-2018 Free Software Foundation, Inc.
+Copyright (C) 2013-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
@@ -32,7 +32,7 @@ it is reproduced here for convenience.
 
 File: gnus-logo.eps, gnus-logo.pdf
   Author: Luis Fernandes <address@hidden>
-  Copyright (C) 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 2001-2019 Free Software Foundation, Inc.
   License: GNU General Public License version 3 or later (see COPYING)
 
 
diff --git a/etc/refcards/calccard.tex b/etc/refcards/calccard.tex
index 08c9cf7..2b85536 100644
--- a/etc/refcards/calccard.tex
+++ b/etc/refcards/calccard.tex
@@ -20,7 +20,7 @@
 % Typical command to format:  tex calccard.tex
 % Typical command to print (3 cols):  dvips -t landscape calccard.dvi
 
-% Copyright (C) 1987, 1992, 2001-2018 Free Software Foundation, Inc.
+% Copyright (C) 1987, 1992, 2001-2019 Free Software Foundation, Inc.
 
 % This document is free software: you can redistribute it and/or modify
 % it under the terms of the GNU General Public License as published by
diff --git a/etc/refcards/cs-dired-ref.tex b/etc/refcards/cs-dired-ref.tex
index a0a173d..172a2c6 100644
--- a/etc/refcards/cs-dired-ref.tex
+++ b/etc/refcards/cs-dired-ref.tex
@@ -1,6 +1,6 @@
 % Reference Card for Dired -*- coding: utf-8 -*-
 
-% Copyright (C) 2000-2018 Free Software Foundation, Inc.
+% Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 % Author: Evgeny Roubinchtein <address@hidden>
 % Czech translation: Pavel Janík <address@hidden>, March 2001
diff --git a/etc/refcards/cs-refcard.tex b/etc/refcards/cs-refcard.tex
index 499e74d..ca7d833 100644
--- a/etc/refcards/cs-refcard.tex
+++ b/etc/refcards/cs-refcard.tex
@@ -1,6 +1,6 @@
 % Reference Card for GNU Emacs -*- coding: utf-8 -*-
 
-% Copyright (C) 1987, 1993, 1996-1997, 2001-2018 Free Software
+% Copyright (C) 1987, 1993, 1996-1997, 2001-2019 Free Software
 % Foundation, Inc.
 
 % Author: Stephen Gildea <address@hidden>
diff --git a/etc/refcards/cs-survival.tex b/etc/refcards/cs-survival.tex
index 574e5d2..b91c9c9 100644
--- a/etc/refcards/cs-survival.tex
+++ b/etc/refcards/cs-survival.tex
@@ -1,6 +1,6 @@
 % Title:  GNU Emacs Survival Card -*- coding: utf-8 -*-
 
-% Copyright (C) 2000-2018 Free Software Foundation, Inc.
+% Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 % Author: Wlodek Bzyl <address@hidden>
 % Czech translation: Pavel Janík <address@hidden>, March 2001
diff --git a/etc/refcards/de-refcard.tex b/etc/refcards/de-refcard.tex
index 7ea0968..06b6efe 100644
--- a/etc/refcards/de-refcard.tex
+++ b/etc/refcards/de-refcard.tex
@@ -1,6 +1,6 @@
 % Reference Card for GNU Emacs
 
-% Copyright (C) 1987, 1993, 1996, 2000-2018 Free Software Foundation,
+% Copyright (C) 1987, 1993, 1996, 2000-2019 Free Software Foundation,
 % Inc.
 
 % Author: Stephen Gildea <address@hidden>
diff --git a/etc/refcards/dired-ref.tex b/etc/refcards/dired-ref.tex
index 1e659dc..370ab84 100644
--- a/etc/refcards/dired-ref.tex
+++ b/etc/refcards/dired-ref.tex
@@ -1,6 +1,6 @@
 % Reference Card for Dired
 
-% Copyright (C) 2000-2018 Free Software Foundation, Inc.
+% Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 % Author: Evgeny Roubinchtein <address@hidden>
 
diff --git a/etc/refcards/emacsver.tex.in b/etc/refcards/emacsver.tex.in
index 674f90c..9c2680c 100644
--- a/etc/refcards/emacsver.tex.in
+++ b/etc/refcards/emacsver.tex.in
@@ -2,4 +2,4 @@
 address@hidden@}           % major version of emacs
 %% This one should not be automatically updated;
 %% M-x set-copyright in admin.el handles it.
-\def\year{2018}                             % latest copyright year
+\def\year{2019}                             % latest copyright year
diff --git a/etc/refcards/fr-dired-ref.tex b/etc/refcards/fr-dired-ref.tex
index 013f872..fbd9f89 100644
--- a/etc/refcards/fr-dired-ref.tex
+++ b/etc/refcards/fr-dired-ref.tex
@@ -1,6 +1,6 @@
 % Reference Card for Dired -*- coding: utf-8 -*-
 
-% Copyright (C) 2000-2018 Free Software Foundation, Inc.
+% Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 % Author: Evgeny Roubinchtein <address@hidden>
 % French translation: Eric Jacoboni
diff --git a/etc/refcards/fr-refcard.tex b/etc/refcards/fr-refcard.tex
index 24f3c93..0ebf791 100644
--- a/etc/refcards/fr-refcard.tex
+++ b/etc/refcards/fr-refcard.tex
@@ -1,6 +1,6 @@
 % Reference Card for GNU Emacs
 
-% Copyright (C) 1987, 1993, 1996-1997, 2001-2018 Free Software
+% Copyright (C) 1987, 1993, 1996-1997, 2001-2019 Free Software
 % Foundation, Inc.
 
 % Author: Stephen Gildea <address@hidden>
diff --git a/etc/refcards/fr-survival.tex b/etc/refcards/fr-survival.tex
index a622642..2075549 100644
--- a/etc/refcards/fr-survival.tex
+++ b/etc/refcards/fr-survival.tex
@@ -1,7 +1,7 @@
 %&tex
 % Title:  GNU Emacs Survival Card
 
-% Copyright (C) 2000-2018 Free Software Foundation, Inc.
+% Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 % Author: Wlodek Bzyl <address@hidden>
 % French translation:  \'Eric Jacoboni <address@hidden>, November 2001
diff --git a/etc/refcards/gnus-logo.eps b/etc/refcards/gnus-logo.eps
index 44a1b7b..fd2fea2 100644
--- a/etc/refcards/gnus-logo.eps
+++ b/etc/refcards/gnus-logo.eps
@@ -1,5 +1,5 @@
 %!PS-Adobe-2.0 EPSF-2.0
-% Copyright (C) 2000-2018 Free Software Foundation, Inc.
+% Copyright (C) 2000-2019 Free Software Foundation, Inc.
 %
 % Author: Luis Fernandes <address@hidden>
 %
diff --git a/etc/refcards/gnus-refcard.tex b/etc/refcards/gnus-refcard.tex
index 422c3d9..a16f48d 100644
--- a/etc/refcards/gnus-refcard.tex
+++ b/etc/refcards/gnus-refcard.tex
@@ -120,7 +120,7 @@
 %% Gnus logo by Luis Fernandes.
 \newcommand{\Copyright}{%
   \begin{center}
-    Copyright \copyright\ 1995, 2000, 2002--2018 Free Software Foundation, 
Inc.\\*
+    Copyright \copyright\ 1995, 2000, 2002--2019 Free Software Foundation, 
Inc.\\*
   \end{center}
 
   Released under the terms of the GNU General Public License version 3 or 
later.
diff --git a/etc/refcards/orgcard.tex b/etc/refcards/orgcard.tex
index 91cc03f..ae4e26c 100644
--- a/etc/refcards/orgcard.tex
+++ b/etc/refcards/orgcard.tex
@@ -17,7 +17,7 @@
 \pdflayout=(0l)
 
 % Nothing else needs to be changed below this line.
-% Copyright (C) 1987, 1993, 1996-1997, 2001-2018 Free Software
+% Copyright (C) 1987, 1993, 1996-1997, 2001-2019 Free Software
 % Foundation, Inc.
 
 % This document is free software: you can redistribute it and/or modify
diff --git a/etc/refcards/pdflayout.sty b/etc/refcards/pdflayout.sty
index e2fd4e0..b2ca739 100644
--- a/etc/refcards/pdflayout.sty
+++ b/etc/refcards/pdflayout.sty
@@ -1,4 +1,4 @@
-% Copyright (C) 2007-2018 Free Software Foundation, Inc.
+% Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 % This file is part of GNU Emacs.
 
diff --git a/etc/refcards/pl-refcard.tex b/etc/refcards/pl-refcard.tex
index ce5f603..578a8f6 100644
--- a/etc/refcards/pl-refcard.tex
+++ b/etc/refcards/pl-refcard.tex
@@ -1,7 +1,7 @@
 %&mex
 % Reference Card for GNU Emacs
 
-% Copyright (C) 1999, 2001-2018 Free Software Foundation, Inc.
+% Copyright (C) 1999, 2001-2019 Free Software Foundation, Inc.
 
 % Author: Stephen Gildea <address@hidden>
 % Polish translation: W{\l}odek Bzyl <address@hidden>
diff --git a/etc/refcards/pt-br-refcard.tex b/etc/refcards/pt-br-refcard.tex
index 50cf511..04ce77d 100644
--- a/etc/refcards/pt-br-refcard.tex
+++ b/etc/refcards/pt-br-refcard.tex
@@ -1,6 +1,6 @@
 % Reference Card for GNU Emacs
 
-% Copyright (C) 1987, 1993, 1996-1997, 2002-2004, 2006-2018 Free
+% Copyright (C) 1987, 1993, 1996-1997, 2002-2004, 2006-2019 Free
 % Software Foundation, Inc.
 
 % Author: Stephen Gildea <address@hidden>
diff --git a/etc/refcards/refcard.tex b/etc/refcards/refcard.tex
index 74db197..5089133 100644
--- a/etc/refcards/refcard.tex
+++ b/etc/refcards/refcard.tex
@@ -1,6 +1,6 @@
 % Reference Card for GNU Emacs
 
-% Copyright (C) 1987, 1993, 1996-1997, 2001-2018 Free Software
+% Copyright (C) 1987, 1993, 1996-1997, 2001-2019 Free Software
 % Foundation, Inc.
 
 % Author: Stephen Gildea <address@hidden>
diff --git a/etc/refcards/ru-refcard.tex b/etc/refcards/ru-refcard.tex
index 0c4cfbe..43c18d5 100644
--- a/etc/refcards/ru-refcard.tex
+++ b/etc/refcards/ru-refcard.tex
@@ -1,4 +1,4 @@
-% Copyright (C) 1997, 2002-2018 Free Software Foundation, Inc.
+% Copyright (C) 1997, 2002-2019 Free Software Foundation, Inc.
 
 % Author: Stephen Gildea <address@hidden>
 % Russian translation: Alex Ott <address@hidden>
@@ -41,7 +41,7 @@
 \setlength{\ColThreeWidth}{25mm}
 
 \newcommand{\versionemacs}[0]{27} % version of Emacs this is for
-\newcommand{\cyear}[0]{2018}       % copyright year
+\newcommand{\cyear}[0]{2019}       % copyright year
 
 \newcommand\shortcopyrightnotice[0]{\vskip 1ex plus 2 fill
   \centerline{\footnotesize \copyright\ \cyear\ Free Software Foundation, Inc.
diff --git a/etc/refcards/sk-dired-ref.tex b/etc/refcards/sk-dired-ref.tex
index 334a51c..7b550d2 100644
--- a/etc/refcards/sk-dired-ref.tex
+++ b/etc/refcards/sk-dired-ref.tex
@@ -1,6 +1,6 @@
 % Reference Card for Dired -*- coding: utf-8 -*-
 
-% Copyright (C) 2000-2018 Free Software Foundation, Inc.
+% Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 % Author: Evgeny Roubinchtein <address@hidden>
 % Czech translation: Pavel Janík <address@hidden>, March 2001
diff --git a/etc/refcards/sk-refcard.tex b/etc/refcards/sk-refcard.tex
index 7f83332..823913a 100644
--- a/etc/refcards/sk-refcard.tex
+++ b/etc/refcards/sk-refcard.tex
@@ -1,6 +1,6 @@
 % Reference Card for GNU Emacs -*- coding: utf-8 -*-
 
-% Copyright (C) 1987, 1993, 1996-1997, 2001-2018 Free Software
+% Copyright (C) 1987, 1993, 1996-1997, 2001-2019 Free Software
 % Foundation, Inc.
 
 % Author: Stephen Gildea <address@hidden>
diff --git a/etc/refcards/sk-survival.tex b/etc/refcards/sk-survival.tex
index b063708..b63a618 100644
--- a/etc/refcards/sk-survival.tex
+++ b/etc/refcards/sk-survival.tex
@@ -1,6 +1,6 @@
 % Title:  GNU Emacs Survival Card -*- coding: utf-8 -*-
 
-% Copyright (C) 2000-2018 Free Software Foundation, Inc.
+% Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 % Author: Wlodek Bzyl <address@hidden>
 % Czech translation: Pavel Janík <address@hidden>, March 2001
diff --git a/etc/refcards/survival.tex b/etc/refcards/survival.tex
index 63fdde1..5dbe788 100644
--- a/etc/refcards/survival.tex
+++ b/etc/refcards/survival.tex
@@ -1,7 +1,7 @@
 %&tex
 % Title:  GNU Emacs Survival Card
 
-% Copyright (C) 2000-2018 Free Software Foundation, Inc.
+% Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 % Author: Wlodek Bzyl <address@hidden>
 
diff --git a/etc/refcards/vipcard.tex b/etc/refcards/vipcard.tex
index a5e47d0..87cf4ad 100644
--- a/etc/refcards/vipcard.tex
+++ b/etc/refcards/vipcard.tex
@@ -1,6 +1,6 @@
 % Quick Reference Card for VIP
 
-% Copyright (C) 1987, 2001-2018 Free Software Foundation, Inc.
+% Copyright (C) 1987, 2001-2019 Free Software Foundation, Inc.
 
 % Author: Masahiko Sato <address@hidden>, <address@hidden>
 
diff --git a/etc/refcards/viperCard.tex b/etc/refcards/viperCard.tex
index 7cf6533..fb116d4 100644
--- a/etc/refcards/viperCard.tex
+++ b/etc/refcards/viperCard.tex
@@ -1,6 +1,6 @@
 % ViperCard -- The Reference Card for Viper under GNU Emacs and XEmacs
 
-% Copyright (C) 1995-1997, 2001-2018 Free Software Foundation, Inc.
+% Copyright (C) 1995-1997, 2001-2019 Free Software Foundation, Inc.
 
 % Author: Michael Kifer <address@hidden> (Viper)
 %      Aamod Sane <address@hidden> (VIP 4.3)
diff --git a/etc/schema/locate.rnc b/etc/schema/locate.rnc
index 0aec85c..e31eb1f 100644
--- a/etc/schema/locate.rnc
+++ b/etc/schema/locate.rnc
@@ -1,4 +1,4 @@
-# Copyright (C) 2003-2004, 2007-2018 Free Software Foundation, Inc.
+# Copyright (C) 2003-2004, 2007-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/etc/schema/relaxng.rnc b/etc/schema/relaxng.rnc
index ff030c9..125d2e2 100644
--- a/etc/schema/relaxng.rnc
+++ b/etc/schema/relaxng.rnc
@@ -1,6 +1,6 @@
 # RELAX NG XML syntax expressed in RELAX NG Compact syntax.
 
-# Copyright (C) 2003-2004, 2007-2018 Free Software Foundation, Inc.
+# Copyright (C) 2003-2004, 2007-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/etc/schema/schemas.xml b/etc/schema/schemas.xml
index 6121b7d..a9c14dd 100644
--- a/etc/schema/schemas.xml
+++ b/etc/schema/schemas.xml
@@ -1,4 +1,4 @@
-<!-- Copyright (C) 2003-2004, 2007-2018 Free Software Foundation, Inc.
+<!-- Copyright (C) 2003-2004, 2007-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/etc/ses-example.ses b/etc/ses-example.ses
index fb06e62..665ec48 100644
--- a/etc/ses-example.ses
+++ b/etc/ses-example.ses
@@ -205,7 +205,7 @@ Sales summary - Acme fundraising
 ;;; ses--symbolic-formulas: (("Eastern area") ("West-district") 
("North&South") ("Other"))
 ;;; End:
 
-;;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;;; COPYING PERMISSIONS:
 ;;; 
diff --git a/etc/srecode/c.srt b/etc/srecode/c.srt
index 7d05ade..d1710c9 100644
--- a/etc/srecode/c.srt
+++ b/etc/srecode/c.srt
@@ -1,6 +1,6 @@
 ;;; c.srt --- SRecode templates for c-mode
 
-;; Copyright (C) 2007-2010, 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2010, 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/etc/srecode/cpp.srt b/etc/srecode/cpp.srt
index b5acac1..79b62b3 100644
--- a/etc/srecode/cpp.srt
+++ b/etc/srecode/cpp.srt
@@ -1,6 +1,6 @@
 ;;; cpp.srt --- SRecode templates for c++-mode
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/etc/srecode/default.srt b/etc/srecode/default.srt
index 1fc37c2..693cc95 100644
--- a/etc/srecode/default.srt
+++ b/etc/srecode/default.srt
@@ -1,6 +1,6 @@
 ;;; default.srt --- SRecode templates for srecode-template-mode
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/etc/srecode/doc-cpp.srt b/etc/srecode/doc-cpp.srt
index a696711..f7a0af6 100644
--- a/etc/srecode/doc-cpp.srt
+++ b/etc/srecode/doc-cpp.srt
@@ -1,6 +1,6 @@
 ;; doc-c.srt --- SRecode templates for "document" applications
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/etc/srecode/doc-default.srt b/etc/srecode/doc-default.srt
index 019191a..1f1cb4e 100644
--- a/etc/srecode/doc-default.srt
+++ b/etc/srecode/doc-default.srt
@@ -1,6 +1,6 @@
 ;; doc-default.srt --- SRecode templates for "document" applications
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/etc/srecode/doc-java.srt b/etc/srecode/doc-java.srt
index b4a76d1..659a8e9 100644
--- a/etc/srecode/doc-java.srt
+++ b/etc/srecode/doc-java.srt
@@ -1,6 +1,6 @@
 ;; doc-java.srt --- SRecode templates for "document" applications
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/etc/srecode/ede-autoconf.srt b/etc/srecode/ede-autoconf.srt
index 17e9a0e..1f5a271 100644
--- a/etc/srecode/ede-autoconf.srt
+++ b/etc/srecode/ede-autoconf.srt
@@ -1,6 +1,6 @@
 ;;; ede/templates/autoconf.srt --- Templates for autoconf used by EDE
 
-;; Copyright (C) 2010, 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010, 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/etc/srecode/ede-make.srt b/etc/srecode/ede-make.srt
index da0f02d..edf34a0 100644
--- a/etc/srecode/ede-make.srt
+++ b/etc/srecode/ede-make.srt
@@ -1,6 +1,6 @@
 ;; ede-make.srt --- SRecode templates for Makefiles used by EDE.
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/etc/srecode/el.srt b/etc/srecode/el.srt
index e0a54a7..5d5a2ec 100644
--- a/etc/srecode/el.srt
+++ b/etc/srecode/el.srt
@@ -1,6 +1,6 @@
 ;;; el.srt --- SRecode templates for Emacs Lisp mode
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Ludlam <address@hidden>
 
diff --git a/etc/srecode/getset-cpp.srt b/etc/srecode/getset-cpp.srt
index c7032cf..cdb06dc 100644
--- a/etc/srecode/getset-cpp.srt
+++ b/etc/srecode/getset-cpp.srt
@@ -1,6 +1,6 @@
 ;;; getset-cpp.srt --- SRecode templates for C++ class getter/setters.
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/etc/srecode/java.srt b/etc/srecode/java.srt
index df19192..f9e67b7 100644
--- a/etc/srecode/java.srt
+++ b/etc/srecode/java.srt
@@ -1,6 +1,6 @@
 ;; java.srt
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/etc/srecode/make.srt b/etc/srecode/make.srt
index 509ec0d..1288acb 100644
--- a/etc/srecode/make.srt
+++ b/etc/srecode/make.srt
@@ -1,6 +1,6 @@
 ;; make.srt
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/etc/srecode/template.srt b/etc/srecode/template.srt
index 464b11f..a651e32 100644
--- a/etc/srecode/template.srt
+++ b/etc/srecode/template.srt
@@ -1,6 +1,6 @@
 ;;; template.srt --- Templates for Semantic Recoders
 
-;; Copyright (C) 2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Ludlam <address@hidden>
 
diff --git a/etc/srecode/test.srt b/etc/srecode/test.srt
index b09f2f1..79f9dd0 100644
--- a/etc/srecode/test.srt
+++ b/etc/srecode/test.srt
@@ -1,6 +1,6 @@
 ;; test.srt --- SRecode templates for testing
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/etc/srecode/texi.srt b/etc/srecode/texi.srt
index d214567..d696cc0 100644
--- a/etc/srecode/texi.srt
+++ b/etc/srecode/texi.srt
@@ -1,6 +1,6 @@
 ;; texi.srt --- SRecode templates for Texinfo
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/etc/srecode/wisent.srt b/etc/srecode/wisent.srt
index 0c92d73..40fe942 100644
--- a/etc/srecode/wisent.srt
+++ b/etc/srecode/wisent.srt
@@ -1,6 +1,6 @@
 ;; wisent.srt --- SRecode templates for Emacs/WISENT grammar files.
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/etc/themes/adwaita-theme.el b/etc/themes/adwaita-theme.el
index 415db8a..73ef7b6 100644
--- a/etc/themes/adwaita-theme.el
+++ b/etc/themes/adwaita-theme.el
@@ -1,6 +1,6 @@
 ;;; adwaita-theme.el --- Tango-based custom theme for faces
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: William Stevenson <address@hidden>
 
diff --git a/etc/themes/deeper-blue-theme.el b/etc/themes/deeper-blue-theme.el
index 0700f4f..d04a270 100644
--- a/etc/themes/deeper-blue-theme.el
+++ b/etc/themes/deeper-blue-theme.el
@@ -1,6 +1,6 @@
 ;;; deeper-blue-theme.el --- Custom theme for faces
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Scott Frazer <address@hidden>
 
diff --git a/etc/themes/dichromacy-theme.el b/etc/themes/dichromacy-theme.el
index bfced43..b361fe5 100644
--- a/etc/themes/dichromacy-theme.el
+++ b/etc/themes/dichromacy-theme.el
@@ -1,6 +1,6 @@
 ;;; dichromacy-theme.el --- color theme suitable for color-blind users
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Chong Yidong <address@hidden>
 
diff --git a/etc/themes/leuven-theme.el b/etc/themes/leuven-theme.el
index c3c6665..d544f28 100644
--- a/etc/themes/leuven-theme.el
+++ b/etc/themes/leuven-theme.el
@@ -1,6 +1,6 @@
 ;;; leuven-theme.el --- Awesome Emacs color theme on white background
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Fabrice Niessen <(concat "fniessen" at-sign "pirilampo.org")>
 ;; URL: https://github.com/fniessen/emacs-leuven-theme
diff --git a/etc/themes/light-blue-theme.el b/etc/themes/light-blue-theme.el
index ba00db6..3060dcf 100644
--- a/etc/themes/light-blue-theme.el
+++ b/etc/themes/light-blue-theme.el
@@ -1,6 +1,6 @@
 ;;; light-blue-theme.el --- Custom theme for faces
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Drew Adams <address@hidden>
 
diff --git a/etc/themes/manoj-dark-theme.el b/etc/themes/manoj-dark-theme.el
index ddcaa0b..b6bf9bf 100644
--- a/etc/themes/manoj-dark-theme.el
+++ b/etc/themes/manoj-dark-theme.el
@@ -1,6 +1,6 @@
 ;;; manoj-dark.el --- A dark theme from Manoj
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Manoj Srivastava <address@hidden>
 ;; Keywords: lisp, faces
diff --git a/etc/themes/misterioso-theme.el b/etc/themes/misterioso-theme.el
index 6c1eec0..cac76d6 100644
--- a/etc/themes/misterioso-theme.el
+++ b/etc/themes/misterioso-theme.el
@@ -1,6 +1,6 @@
 ;;; misterioso-theme.el --- Custom face theme for Emacs
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Sebastian Hermida
 
diff --git a/etc/themes/tango-dark-theme.el b/etc/themes/tango-dark-theme.el
index dae77a5..bd99790 100644
--- a/etc/themes/tango-dark-theme.el
+++ b/etc/themes/tango-dark-theme.el
@@ -1,6 +1,6 @@
 ;;; tango-dark-theme.el --- Tango-based custom theme for faces
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Authors: Chong Yidong <address@hidden>
 ;;          Jan Moringen <address@hidden>
diff --git a/etc/themes/tango-theme.el b/etc/themes/tango-theme.el
index 4fe2480..12d4db3f 100644
--- a/etc/themes/tango-theme.el
+++ b/etc/themes/tango-theme.el
@@ -1,6 +1,6 @@
 ;;; tango-theme.el --- Tango-based custom theme for faces
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Authors: Chong Yidong <address@hidden>
 ;;          Jan Moringen <address@hidden>
diff --git a/etc/themes/tsdh-dark-theme.el b/etc/themes/tsdh-dark-theme.el
index c216750..5482ced 100644
--- a/etc/themes/tsdh-dark-theme.el
+++ b/etc/themes/tsdh-dark-theme.el
@@ -1,6 +1,6 @@
 ;;; tsdh-dark-theme.el --- Tassilo's dark custom theme
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/etc/themes/tsdh-light-theme.el b/etc/themes/tsdh-light-theme.el
index ce9d1a2..8e6a79f 100644
--- a/etc/themes/tsdh-light-theme.el
+++ b/etc/themes/tsdh-light-theme.el
@@ -1,6 +1,6 @@
 ;;; tsdh-light-theme.el --- Tassilo's light custom theme
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/etc/themes/wheatgrass-theme.el b/etc/themes/wheatgrass-theme.el
index 8d34c28..2e18eb9 100644
--- a/etc/themes/wheatgrass-theme.el
+++ b/etc/themes/wheatgrass-theme.el
@@ -1,6 +1,6 @@
 ;;; wheatgrass-theme.el --- custom theme for faces
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/etc/themes/whiteboard-theme.el b/etc/themes/whiteboard-theme.el
index fe46cb0..75c6c1c 100644
--- a/etc/themes/whiteboard-theme.el
+++ b/etc/themes/whiteboard-theme.el
@@ -1,6 +1,6 @@
 ;;; whiteboard-theme.el --- Custom theme for faces
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Scott Frazer <address@hidden>
 
diff --git a/etc/themes/wombat-theme.el b/etc/themes/wombat-theme.el
index 00f29bb..c56700f 100644
--- a/etc/themes/wombat-theme.el
+++ b/etc/themes/wombat-theme.el
@@ -1,6 +1,6 @@
 ;;; wombat-theme.el --- Custom face theme for Emacs
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Kristoffer Grönlund <address@hidden>
 
diff --git a/etc/tutorials/TUTORIAL b/etc/tutorials/TUTORIAL
index ac3ab76..3f5f116 100644
--- a/etc/tutorials/TUTORIAL
+++ b/etc/tutorials/TUTORIAL
@@ -704,7 +704,7 @@ Emacs deletes its auto save file.
 If the computer crashes, you can recover your auto-saved editing by
 finding the file normally (the file you were editing, not the auto
 save file) and then typing M-x recover-this-file <Return>.  When it
-asks fo confirmation, type yes<Return> to go ahead and recover the
+asks for confirmation, type yes<Return> to go ahead and recover the
 auto-save data.
 
 
@@ -1116,7 +1116,7 @@ starting with the one written by Stuart Cracraft for the 
original Emacs.
 This version of the tutorial is a part of GNU Emacs.  It is copyrighted
 and comes with permission to distribute copies on certain conditions:
 
-  Copyright (C) 1985, 1996, 1998, 2001-2018 Free Software Foundation,
+  Copyright (C) 1985, 1996, 1998, 2001-2019 Free Software Foundation,
   Inc.
 
   This file is part of GNU Emacs.
diff --git a/etc/tutorials/TUTORIAL.bg b/etc/tutorials/TUTORIAL.bg
index f31ce57..fa7f743 100644
--- a/etc/tutorials/TUTORIAL.bg
+++ b/etc/tutorials/TUTORIAL.bg
@@ -1162,7 +1162,7 @@ Dired ви позволява да гледате списъка от файло
 This version of the tutorial, like GNU Emacs, is copyrighted, and
 comes with permission to distribute copies on certain conditions:
 
-  Copyright (C) 1985, 1996, 1998, 2001-2018 Free Software Foundation,
+  Copyright (C) 1985, 1996, 1998, 2001-2019 Free Software Foundation,
   Inc.
 
   This file is part of GNU Emacs.
diff --git a/etc/tutorials/TUTORIAL.cn b/etc/tutorials/TUTORIAL.cn
index b2efa6e..e927ac2 100644
--- a/etc/tutorials/TUTORIAL.cn
+++ b/etc/tutorials/TUTORIAL.cn
@@ -997,7 +997,7 @@ starting with the one written by Stuart Cracraft for the 
original Emacs.
 This version of the tutorial is a part of GNU Emacs.  It is copyrighted
 and comes with permission to distribute copies on certain conditions:
 
-  Copyright (C) 1985, 1996, 1998, 2001-2018 Free Software Foundation,
+  Copyright (C) 1985, 1996, 1998, 2001-2019 Free Software Foundation,
   Inc.
 
   This file is part of GNU Emacs.
@@ -1026,7 +1026,7 @@ using, writing, and sharing free software!
 
 本篇指南是 GNU Emacs 的一部分,并允许在下列条件的约束下发行其拷贝:
 
-   Copyright (C) 1985, 1996, 1998, 2001-2018 Free Software Foundation,
+   Copyright (C) 1985, 1996, 1998, 2001-2019 Free Software Foundation,
    Inc.
 
    本文件为 GNU Emacs 的一部分。
diff --git a/etc/tutorials/TUTORIAL.cs b/etc/tutorials/TUTORIAL.cs
index 7dc0d31..ac0faba 100644
--- a/etc/tutorials/TUTORIAL.cs
+++ b/etc/tutorials/TUTORIAL.cs
@@ -1015,7 +1015,7 @@ tutoriálem napsaným Stuartem Cracraftem pro původní Emacs.
 Tato verze tutoriálu je, podobně jako GNU Emacs, chráněna copyrightem a
 je šířena se svolením distribuovat kopie za jistých podmínek:
 
-Copyright (C) 1985, 1996, 1998, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 1998, 2001-2019 Free Software Foundation, Inc.
 
    Každému je zaručeno právo vytvářet a distribuovat přesné kopie tohoto
    dokumentu tak, jak jej obdržel, na jakémkoliv médiu, s tím, že bude
diff --git a/etc/tutorials/TUTORIAL.de b/etc/tutorials/TUTORIAL.de
index 94d13bd..d1b5a48 100644
--- a/etc/tutorials/TUTORIAL.de
+++ b/etc/tutorials/TUTORIAL.de
@@ -1458,7 +1458,7 @@ Beachten Sie bitte, dass im Zweifelsfalle das englische 
Original
 dieser Urheberrechtsnotiz gültig ist (zu finden in der Datei
 TUTORIAL).
 
-   Copyright (C) 1985, 1996-1997, 2001-2018 Free Software Foundation,
+   Copyright (C) 1985, 1996-1997, 2001-2019 Free Software Foundation,
    Inc.
 
    Diese Datei ist ein Bestandteil von GNU Emacs.
diff --git a/etc/tutorials/TUTORIAL.eo b/etc/tutorials/TUTORIAL.eo
index 37a79f0..1854020 100644
--- a/etc/tutorials/TUTORIAL.eo
+++ b/etc/tutorials/TUTORIAL.eo
@@ -1081,7 +1081,7 @@ la dosiero verkita de Stuart Cracraft por la originala 
Emakso.
 kopirajton, kaj venas kun permeso por disdoni kopiojn se certaj
 kondiĉoj estas observataj:
 
-   Copyright (C) 1985, 1999, 2001-2002, 2005, 2007-2018 Free Software
+   Copyright (C) 1985, 1999, 2001-2002, 2005, 2007-2019 Free Software
    Foundation, Inc.
 
    Ĉi tiu dosiero estas parto de "GNU Emacs".
diff --git a/etc/tutorials/TUTORIAL.es b/etc/tutorials/TUTORIAL.es
index 50b99c4..fba873a 100644
--- a/etc/tutorials/TUTORIAL.es
+++ b/etc/tutorials/TUTORIAL.es
@@ -1204,7 +1204,7 @@ Por favor, en caso de duda, solo es válido el original en 
inglés de la
 siguiente nota de derechos de reproducción (que puede encontrar en el
 archivo TUTORIAL).
 
-Copyright (C) 1985, 1996, 1998, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 1998, 2001-2019 Free Software Foundation, Inc.
 
    Se permite a cualquiera hacer o distribuir copias literales de este
    documento como se recibe, en cualquier medio, siempre que la nota
diff --git a/etc/tutorials/TUTORIAL.fr b/etc/tutorials/TUTORIAL.fr
index 07a2802..732ca22 100644
--- a/etc/tutorials/TUTORIAL.fr
+++ b/etc/tutorials/TUTORIAL.fr
@@ -1202,7 +1202,7 @@ Cette version du didacticiel, comme GNU Emacs, est placée 
sous
 droit d'auteur, et vous pouvez en distribuer des copies sous certaines
 conditions :
 
-Copyright (C) 1985, 1996, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 2001-2019 Free Software Foundation, Inc.
 
    Chacun peut créer ou distribuer des copies de ce document tel qu'il
    l'a reçu, sur n'importe quel support, pourvu que la note de
diff --git a/etc/tutorials/TUTORIAL.he b/etc/tutorials/TUTORIAL.he
index 652bc0d..5422ca1 100644
--- a/etc/tutorials/TUTORIAL.he
+++ b/etc/tutorials/TUTORIAL.he
@@ -1004,7 +1004,7 @@ find-file.
 גירסה זו של השיעור הינה חלק מחבילת GNU Emacs. היא מוגנת בזכויות יוצרים
 וניתנת להעתקה והפצת עותקים בתנאים מסויימים כדלקמן:
 
-                       Copyright (C) 2010-2018 Free Software Foundation, Inc.
+                       Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ‏GNU Emacs הינו תכנה חפשית; זכותכם להפיצו ו\או לשנותו בכפוף לתנאי
 הרשיון GNU General Public License, כפי שהוא יוצא לאור ע״י Free
diff --git a/etc/tutorials/TUTORIAL.it b/etc/tutorials/TUTORIAL.it
index cea1dcb..84f0ca5 100644
--- a/etc/tutorials/TUTORIAL.it
+++ b/etc/tutorials/TUTORIAL.it
@@ -1203,7 +1203,7 @@ distribuito con il permesso di farne copie a determinate 
condizioni:
    indicativo, restando comunque inteso il fatto che è quella
    originale a fare fede.
 
-Copyright (C) 2003-2018 Free Software Foundation, Inc.
+Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
    È permesso a chiunque copiare e distribuire attraverso ogni mezzo
    copie fedeli di questo documento così come viene ricevuto, a
diff --git a/etc/tutorials/TUTORIAL.ja b/etc/tutorials/TUTORIAL.ja
index f0b0e08..401d9c2 100644
--- a/etc/tutorials/TUTORIAL.ja
+++ b/etc/tutorials/TUTORIAL.ja
@@ -1062,7 +1062,7 @@ starting with the one written by Stuart Cracraft for the 
original Emacs.
 This version of the tutorial, like GNU Emacs, is copyrighted, and
 comes with permission to distribute copies on certain conditions:
 
-Copyright (C) 1985, 1996, 1998, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 1998, 2001-2019 Free Software Foundation, Inc.
 
    Permission is granted to anyone to make or distribute verbatim copies
    of this document as received, in any medium, provided that the
diff --git a/etc/tutorials/TUTORIAL.ko b/etc/tutorials/TUTORIAL.ko
index 480a8ac..c95d944 100644
--- a/etc/tutorials/TUTORIAL.ko
+++ b/etc/tutorials/TUTORIAL.ko
@@ -981,7 +981,7 @@ C-x C-s와 (META쇠나 EDIT쇠 혹은 교체쇠가 있으면) <ESC>v와 같은 
 GNU 이맥스와 같이 이 지침서 판은 저작권이 있으며 특정한 조건을 만족할
 때에 복사본을 배포할 수 있는 허가를 갖고 나온 것이다:
 
-Copyright (C) 1985, 1996, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 2001-2019 Free Software Foundation, Inc.
 
    이 문서는 이 저작권 공고와 허용 공고가 그대로 유지되고, 배포자가
    수취자에게 이 공고에 따라 허용되는 것처럼 또 재분배하는 것을
diff --git a/etc/tutorials/TUTORIAL.nl b/etc/tutorials/TUTORIAL.nl
index 9e3d0e6..4a525cc 100644
--- a/etc/tutorials/TUTORIAL.nl
+++ b/etc/tutorials/TUTORIAL.nl
@@ -1209,7 +1209,7 @@ Deze versie van de inleiding is onderdeel van GNU Emacs.  
Het valt
 onder copyright.  Je mag deze inleiding verspreiden onder bepaalde
 voorwaarden:
 
-  Copyright (C) 1985, 1996, 1998, 2001-2018 Free Software Foundation,
+  Copyright (C) 1985, 1996, 1998, 2001-2019 Free Software Foundation,
   Inc.
 
   Dit bestand is onderdeel van GNU Emacs.
@@ -1239,7 +1239,7 @@ Engels origineel van de copyrightmelding en condities:
 This version of the tutorial is a part of GNU Emacs.  It is copyrighted
 and comes with permission to distribute copies on certain conditions:
 
-  Copyright (C) 1985, 1996, 1998, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1985, 1996, 1998, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/etc/tutorials/TUTORIAL.pl b/etc/tutorials/TUTORIAL.pl
index 6a476ff..5d9fb2a 100644
--- a/etc/tutorials/TUTORIAL.pl
+++ b/etc/tutorials/TUTORIAL.pl
@@ -1209,7 +1209,7 @@ z pomocą Ryszarda Kubiaka i Janusza S. Bienia 
<address@hidden>.
 Ta wersja samouczka, podobnie jak GNU Emacs, jest chroniona prawem
 autorskim, ale wolno ją kopiować pod następującymi warunkami:
 
-Copyright (C) 1985, 1994, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1985, 1994, 2001-2019 Free Software Foundation, Inc.
 
 Zezwala się na wykonywanie lub rozpowszechnianie
 wiernych kopii tego dokumentu w otrzymanej formie, na dowolnym
diff --git a/etc/tutorials/TUTORIAL.pt_BR b/etc/tutorials/TUTORIAL.pt_BR
index 461fe12..f8db6b0 100644
--- a/etc/tutorials/TUTORIAL.pt_BR
+++ b/etc/tutorials/TUTORIAL.pt_BR
@@ -1056,7 +1056,7 @@ Essa versão do tutorial foi originalmente traduzida por 
Marcelo Toledo
 <address@hidden> e como o GNU Emacs, tem um copyright, e vem
 com uma permissão de distribuição de cópias nas seguintes condições:
 
-Copyright (C) 2004-2018 Free Software Foundation, Inc.
+Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
    Permissão é garantida a qualquer um para fazer ou distribuir cópias
    integrais deste documento como recebido, em qualquer meio, deixando
diff --git a/etc/tutorials/TUTORIAL.ro b/etc/tutorials/TUTORIAL.ro
index f744c27..0e7981f 100644
--- a/etc/tutorials/TUTORIAL.ro
+++ b/etc/tutorials/TUTORIAL.ro
@@ -4,7 +4,7 @@ Mulţumiri Aidei Hulubei <address@hidden> pentru corecturi şi 
sugestii.
 
 Această versiune a fost produsă plecând de la versiunea în limba
 engleză, care este
-Copyright (c) 1985, 2013-2018 Free Software Foundation, Inc.
+Copyright (c) 1985, 2013-2019 Free Software Foundation, Inc.
 
 Citiţi acum versiunea românească a tutorialului de Emacs.
 
@@ -1082,7 +1082,7 @@ continuare noţita de copyright originală în limba engleză.
 This version of the tutorial, like GNU Emacs, is copyrighted, and
 comes with permission to distribute copies on certain conditions:
 
-Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 
    Permission is granted to anyone to make or distribute verbatim copies
    of this document as received, in any medium, provided that the
diff --git a/etc/tutorials/TUTORIAL.ru b/etc/tutorials/TUTORIAL.ru
index 73c6dd9..ba3a5c2 100644
--- a/etc/tutorials/TUTORIAL.ru
+++ b/etc/tutorials/TUTORIAL.ru
@@ -1105,7 +1105,7 @@ Dired позволяет вам отображать список файлов 
 (copyrighted) и приходит с ограничениями распространения копий со
 следующими соглашениями:
 
-Copyright (C) 1985, 1996, 1998, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 1998, 2001-2019 Free Software Foundation, Inc.
 
    Permission is granted to anyone to make or distribute verbatim copies
    of this document as received, in any medium, provided that the
diff --git a/etc/tutorials/TUTORIAL.sk b/etc/tutorials/TUTORIAL.sk
index daa4e93..8121814 100644
--- a/etc/tutorials/TUTORIAL.sk
+++ b/etc/tutorials/TUTORIAL.sk
@@ -1074,7 +1074,7 @@ tútorialom napísaným Stuartom Cracraftom pre pôvodný 
Emacs.
 Táto verzia tútorialu je, podobne ako GNU Emacs, chránená copyrightom
 a je šírená s povolením distribuovať kópie za istých podmienok:
 
-Copyright (C) 1985, 1996, 1998, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 1998, 2001-2019 Free Software Foundation, Inc.
 
    Každému je zaručené právo vytvárať a distribuovať presné kópie tohto
    dokumentu tak, ako ho dostal, na akomkoľvek médiu, s tým, že bude
diff --git a/etc/tutorials/TUTORIAL.sl b/etc/tutorials/TUTORIAL.sl
index 0f0dd12..7e189b6 100644
--- a/etc/tutorials/TUTORIAL.sl
+++ b/etc/tutorials/TUTORIAL.sl
@@ -1119,7 +1119,7 @@ Emacs. V slovenščino ga je prevedel Primož Peterlin.
 To besedilo, kot sam GNU Emacs, je avtorsko delo, in njegovo
 razmnoževanje in razširjanje je dovoljeno pod naslednjimi pogoji:
 
-Copyright © 1985, 1996, 1998, 2001-2018 Free Software Foundation, Inc.
+Copyright © 1985, 1996, 1998, 2001-2019 Free Software Foundation, Inc.
 
   Ta datoteka je del paketa GNU Emacs.
 
diff --git a/etc/tutorials/TUTORIAL.sv b/etc/tutorials/TUTORIAL.sv
index 74ecf45..10a1877 100644
--- a/etc/tutorials/TUTORIAL.sv
+++ b/etc/tutorials/TUTORIAL.sv
@@ -1140,7 +1140,7 @@ Lidell översatte den till Svenska.
 This version of the tutorial, like GNU Emacs, is copyrighted, and
 comes with permission to distribute copies on certain conditions:
 
-Copyright (C) 1985, 1996, 1998, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 1998, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/etc/tutorials/TUTORIAL.th b/etc/tutorials/TUTORIAL.th
index 1f24467..1fc8a4a 100644
--- a/etc/tutorials/TUTORIAL.th
+++ b/etc/tutorials/TUTORIAL.th
@@ -964,7 +964,7 @@ starting with the one written by Stuart Cracraft for the 
original Emacs.
 This version of the tutorial, like GNU Emacs, is copyrighted, and
 comes with permission to distribute copies on certain conditions:
 
-Copyright (C) 1985, 1996, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 2001-2019 Free Software Foundation, Inc.
 
    Permission is granted to anyone to make or distribute verbatim copies
    of this document as received, in any medium, provided that the
diff --git a/etc/tutorials/TUTORIAL.zh b/etc/tutorials/TUTORIAL.zh
index 4bbdc60..778338e 100644
--- a/etc/tutorials/TUTORIAL.zh
+++ b/etc/tutorials/TUTORIAL.zh
@@ -1049,7 +1049,7 @@ issue here>」。
 這個版本的快速指南和 GNU Emacs 一樣都是版權化的,並且允許在某些條件下
 散佈其拷貝:
 
-Copyright (C) 1985, 1996, 1998, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1985, 1996, 1998, 2001-2019 Free Software Foundation, Inc.
 
    Permission is granted to anyone to make or distribute verbatim copies
    of this document as received, in any medium, provided that the
diff --git a/leim/ChangeLog.1 b/leim/ChangeLog.1
index c3904db..c11ba30 100644
--- a/leim/ChangeLog.1
+++ b/leim/ChangeLog.1
@@ -2578,7 +2578,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1997-1999, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1997-1999, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/leim/Makefile.in b/leim/Makefile.in
index 1657ccf..4307d50 100644
--- a/leim/Makefile.in
+++ b/leim/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1997-2018 Free Software Foundation, Inc.
+# Copyright (C) 1997-2019 Free Software Foundation, Inc.
 # Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 #   2006, 2007, 2008, 2009, 2010, 2011
 #   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -84,7 +84,8 @@ MISC= \
        ${leimdir}/quail/PY.el          \
        ${leimdir}/quail/ZIRANMA.el     \
        ${leimdir}/quail/CTLau.el       \
-       ${leimdir}/quail/CTLau-b5.el
+       ${leimdir}/quail/CTLau-b5.el    \
+       ${srcdir}/../lisp/language/pinyin.el
 
 ## All the generated .el files.
 TIT_MISC = ${TIT_GB} ${TIT_BIG5} ${MISC}
@@ -142,6 +143,9 @@ ${leimdir}/ja-dic/ja-dic.el: $(srcdir)/SKK-DIC/SKK-JISYO.L
        $(AM_V_GEN)$(RUN_EMACS) -batch -l ja-dic-cnv \
          -f batch-skkdic-convert -dir "$(leimdir)/ja-dic" "$<"
 
+${srcdir}/../lisp/language/pinyin.el: ${srcdir}/MISC-DIC/pinyin.map
+       $(AM_V_GEN)${RUN_EMACS} -l titdic-cnv -f pinyin-convert $< $@
+
 
 .PHONY: bootstrap-clean distclean maintainer-clean extraclean
 
diff --git a/leim/README b/leim/README
index da1f6a5..7bf3041 100644
--- a/leim/README
+++ b/leim/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/leim/leim-ext.el b/leim/leim-ext.el
index 495d971..de30a70 100644
--- a/leim/leim-ext.el
+++ b/leim/leim-ext.el
@@ -1,6 +1,6 @@
 ;; leim-ext.el -- extra leim configuration     -*- coding:utf-8; -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H13PRO009
diff --git a/lib-src/ChangeLog.1 b/lib-src/ChangeLog.1
index b002f28..d5a7d46 100644
--- a/lib-src/ChangeLog.1
+++ b/lib-src/ChangeLog.1
@@ -8609,7 +8609,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1988-1999, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1988-1999, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index ecb9208..387a6e3 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2018 Free Software
+# Copyright (C) 1985, 1987-1988, 1993-1994, 2001-2019 Free Software
 # Foundation, Inc.
 
 # This file is part of GNU Emacs.
@@ -167,7 +167,7 @@ UTILITIES = profile${EXEEXT} hexl${EXEEXT} \
            $(if $(with_mailutils), , movemail${EXEEXT}) \
             $(and $(use_gamedir), update-game-score${EXEEXT})
 
-DONT_INSTALL= make-docfile${EXEEXT}
+DONT_INSTALL= make-docfile${EXEEXT} make-fingerprint${EXEEXT}
 
 # Like UTILITIES, but they're not system-dependent, and should not be
 #  deleted by the distclean target.
@@ -204,8 +204,6 @@ address@hidden@
 address@hidden@
 ## empty or -lrt or -lposix4 if HAVE_CLOCK_GETTIME
 LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
-## empty or -lrt or -lposix4 if HAVE_FDATASYNC
-LIB_FDATASYNC = @LIB_FDATASYNC@
 ## empty or -lwsock2 for MinGW
 address@hidden@
 
@@ -387,6 +385,9 @@ profile${EXEEXT}: ${srcdir}/profile.c $(NTLIB) $(config_h)
 make-docfile${EXEEXT}: ${srcdir}/make-docfile.c $(NTLIB) $(config_h)
        $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< $(NTLIB) $(LOADLIBES) -o $@
 
+make-fingerprint${EXEEXT}: ${srcdir}/make-fingerprint.c $(NTLIB) $(config_h)
+       $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< $(NTLIB) $(LOADLIBES) -o $@
+
 movemail${EXEEXT}: ${srcdir}/movemail.c pop.o $(NTLIB) $(config_h)
        $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} ${MOVE_FLAGS} $< pop.o \
          $(NTLIB) $(LOADLIBES) $(LIBS_MOVE) -o $@
@@ -396,12 +397,12 @@ pop.o: ${srcdir}/pop.c ${srcdir}/pop.h 
${srcdir}/../lib/min-max.h $(config_h)
 
 emacsclient${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(config_h)
        $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $< \
-          -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) $(LIB_FDATASYNC) \
+          -DVERSION="\"${version}\"" $(NTLIB) $(LOADLIBES) \
           $(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@
 
 emacsclientw${EXEEXT}: ${srcdir}/emacsclient.c $(NTLIB) $(CLIENTRES) 
$(config_h)
        $(AM_V_CCLD)$(CC) ${ALL_CFLAGS} $(CLIENTRES) -mwindows $< \
-          -DVERSION="\"${version}\"" $(LOADLIBES) $(LIB_FDATASYNC) \
+          -DVERSION="\"${version}\"" $(LOADLIBES) \
           $(LIB_WSOCK32) $(LIBS_ECLIENT) -o $@
 
 NTINC = ${srcdir}/../nt/inc
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index 33af4f0..938b405 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -1,6 +1,6 @@
 /* ebrowse.c --- parsing files for the ebrowse C++ browser
 
-Copyright (C) 1992-2018 Free Software Foundation, Inc.
+Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -187,7 +187,8 @@ enum token
   STATIC_CAST,                 /* static_cast */
   TYPEID,                      /* typeid */
   USING,                       /* using */
-  WCHAR                                /* wchar_t */
+  WCHAR,                       /* wchar_t */
+  FINAL                         /* final */
 };
 
 /* Storage classes, in a wider sense.  */
@@ -471,7 +472,7 @@ static struct sym *add_sym (const char *, struct sym *);
 static void add_global_defn (char *, char *, int, unsigned, int, int, int);
 static void add_global_decl (char *, char *, int, unsigned, int, int, int);
 static struct member *add_member (struct sym *, char *, int, int, unsigned);
-static void class_definition (struct sym *, int, int, int);
+static void class_definition (struct sym *, const char *, int, int, int);
 static char *operator_name (int *);
 static void parse_qualified_param_ident_or_type (char **);
 
@@ -2035,6 +2036,7 @@ token_string (int t)
     case USING:                        return "using";
     case WCHAR:                        return "wchar_t";
     case YYEOF:                 return "EOF";
+    case FINAL:                 return "final";
 
     default:
       if (t < 255)
@@ -2140,6 +2142,7 @@ init_scanner (void)
   insert_keyword ("explicit", EXPLICIT);
   insert_keyword ("extern", EXTERN);
   insert_keyword ("false", FALSE);
+  insert_keyword ("final", FINAL);
   insert_keyword ("float", FLOAT);
   insert_keyword ("for", FOR);
   insert_keyword ("friend", FRIEND);
@@ -2501,9 +2504,9 @@ member (struct sym *cls, int vis)
   char *regexp = NULL;
   int pos;
   int is_constructor;
-  int anonymous = 0;
   int flags = 0;
   int class_tag;
+  char *class_name;
   int type_seen = 0;
   int paren_seen = 0;
   unsigned hash = 0;
@@ -2626,7 +2629,7 @@ member (struct sym *cls, int vis)
           class_tag = LA1;
           type_seen = 1;
           MATCH ();
-          anonymous = 1;
+          class_name = NULL;
 
           /* More than one ident here to allow for MS-DOS specialties
              like `_export class' etc.  The last IDENT seen counts
@@ -2634,14 +2637,33 @@ member (struct sym *cls, int vis)
          while (!LOOKING_AT4 (YYEOF, ';', ':', '{'))
            {
              if (LOOKING_AT (IDENT))
-               anonymous = 0;
-             MATCH ();
+                {
+                  if (class_name)
+                    {
+                      int size = strlen (yytext);
+
+                      if(strlen (class_name) < size)
+                        {
+                          class_name = (char *) xrealloc(class_name, size + 1);
+                        }
+
+                      memcpy(class_name, yytext, size + 1);
+                    }
+                  else
+                    {
+                      class_name = xstrdup(yytext);
+                    }
+                }
+
+              MATCH ();
            }
 
           if (LOOKING_AT2 (':', '{'))
-           class_definition (anonymous ? NULL : cls, class_tag, flags, 1);
+           class_definition (class_name ? cls : NULL, class_name ? class_name 
: yytext, class_tag, flags, 1);
           else
             skip_to (';');
+
+          free(class_name);
           break;
 
         case INT:       case CHAR:      case LONG:      case UNSIGNED:
@@ -2997,7 +3019,7 @@ parse_qualified_param_ident_or_type (char **last_id)
    Current lookahead is the class name.  */
 
 static void
-class_definition (struct sym *containing, int tag, int flags, int nested)
+class_definition (struct sym *containing, const char *class_name, int tag, int 
flags, int nested)
 {
   struct sym *current;
   struct sym *base_class;
@@ -3009,7 +3031,7 @@ class_definition (struct sym *containing, int tag, int 
flags, int nested)
     current = NULL;
   else
     {
-      current = add_sym (yytext, containing);
+      current = add_sym (class_name, containing);
       current->pos = BUFFER_POS ();
       current->regexp = matching_regexp ();
       current->filename = filename;
@@ -3292,8 +3314,8 @@ declaration (int flags)
 static int
 globals (int start_flags)
 {
-  int anonymous;
   int class_tk;
+  char *class_name;
   int flags = start_flags;
 
   for (;;)
@@ -3362,7 +3384,7 @@ globals (int start_flags)
         case CLASS: case STRUCT: case UNION:
           class_tk = LA1;
           MATCH ();
-          anonymous = 1;
+          class_name = NULL;
 
           /* More than one ident here to allow for MS-DOS and OS/2
              specialties like `far', `_Export' etc.  Some C++ libs
@@ -3371,19 +3393,37 @@ globals (int start_flags)
          while (!LOOKING_AT4 (YYEOF, ';', ':', '{'))
            {
              if (LOOKING_AT (IDENT))
-               anonymous = 0;
+                {
+                  if (class_name)
+                    {
+                      int size = strlen (yytext);
+
+                      if(strlen (class_name) < size)
+                        {
+                          class_name = (char *) xrealloc(class_name, size + 1);
+                        }
+
+                      memcpy(class_name, yytext, size + 1);
+                    }
+                  else
+                    {
+                      class_name = xstrdup(yytext);
+                    }
+                }
+
              MATCH ();
            }
 
           /* Don't add anonymous unions.  */
-          if (LOOKING_AT2 (':', '{') && !anonymous)
-              class_definition (NULL, class_tk, flags, 0);
+          if (LOOKING_AT2 (':', '{') && class_name)
+            class_definition (NULL, class_name, class_tk, flags, 0);
           else
             {
               if (skip_to (';') == ';')
                 MATCH ();
             }
 
+          free(class_name);
           flags = start_flags;
           break;
 
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 42b8dd6..f476840 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -1,6 +1,6 @@
 /* Client process that communicates with GNU Emacs acting as server.
 
-Copyright (C) 1986-1987, 1994, 1999-2018 Free Software Foundation, Inc.
+Copyright (C) 1986-1987, 1994, 1999-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -27,146 +27,136 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 # undef _WINSOCK_H
 
 # include <malloc.h>
-# include <stdlib.h>
 # include <windows.h>
 # include <commctrl.h>
 # include <io.h>
 # include <winsock2.h>
 
-# define NO_SOCKETS_IN_FILE_SYSTEM
-
 # define HSOCKET SOCKET
 # define CLOSE_SOCKET closesocket
-# define INITIALIZE() (initialize_sockets ())
+# define INITIALIZE() initialize_sockets ()
 
 char *w32_getenv (const char *);
-#define egetenv(VAR) w32_getenv(VAR)
+# define egetenv(VAR) w32_getenv (VAR)
+
+# undef signal
 
 #else /* !WINDOWSNT */
 
 # ifdef HAVE_NTGUI
-# include <windows.h>
-# endif /* HAVE_NTGUI */
+#  include <windows.h>
+# endif
 
 # include "syswait.h"
 
-# ifdef HAVE_INET_SOCKETS
-#  include <netinet/in.h>
-#  ifdef HAVE_SOCKETS
-#    include <sys/types.h>
-#    include <sys/socket.h>
-#    include <sys/un.h>
-#  endif /* HAVE_SOCKETS */
-# endif
 # include <arpa/inet.h>
+# include <fcntl.h>
+# include <netinet/in.h>
+# include <sys/socket.h>
+# include <sys/un.h>
 
-# define INVALID_SOCKET -1
+# define SOCKETS_IN_FILE_SYSTEM
+
+# define INVALID_SOCKET (-1)
 # define HSOCKET int
 # define CLOSE_SOCKET close
 # define INITIALIZE()
 
-#define egetenv(VAR) getenv(VAR)
+# define egetenv(VAR) getenv (VAR)
 
 #endif /* !WINDOWSNT */
 
-#undef signal
-
-#include <stdarg.h>
 #include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
+#include <errno.h>
 #include <getopt.h>
-#include <unistd.h>
-
+#include <inttypes.h>
 #include <pwd.h>
-#include <sys/stat.h>
 #include <signal.h>
-#include <errno.h>
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <unistd.h>
 
+#include <dosname.h>
+#include <intprops.h>
+#include <min-max.h>
 #include <unlocked-io.h>
 
 #ifndef VERSION
 #define VERSION "unspecified"
 #endif
-
-
-#ifndef EXIT_SUCCESS
-#define EXIT_SUCCESS 0
-#endif
-
-#ifndef EXIT_FAILURE
-#define EXIT_FAILURE 1
-#endif
 
-/* Additional space when allocating buffers for filenames, etc.  */
-#define EXTRA_SPACE 100
-
-#ifdef min
-#undef min
+/* Work around GCC bug 88251.  */
+#if GNUC_PREREQ (7, 0, 0)
+# pragma GCC diagnostic ignored "-Wformat-truncation=2"
 #endif
-#define min(x, y) (((x) < (y)) ? (x) : (y))
 
 
 /* Name used to invoke this program.  */
-const char *progname;
+static char const *progname;
 
 /* The first argument to main.  */
-int main_argc;
+static int main_argc;
 
 /* The second argument to main.  */
-char **main_argv;
+static char *const *main_argv;
 
-/* Nonzero means don't wait for a response from Emacs.  --no-wait.  */
-int nowait = 0;
+/* True means don't wait for a response from Emacs.  --no-wait.  */
+static bool nowait;
 
-/* Nonzero means don't print messages for successful operations.  --quiet.  */
-int quiet = 0;
+/* True means don't print messages for successful operations.  --quiet.  */
+static bool quiet;
 
-/* Nonzero means don't print values returned from emacs. --suppress-output.  */
-int suppress_output = 0;
+/* True means don't print values returned from emacs. --suppress-output.  */
+static bool suppress_output;
 
-/* Nonzero means args are expressions to be evaluated.  --eval.  */
-int eval = 0;
+/* True means args are expressions to be evaluated.  --eval.  */
+static bool eval;
 
-/* Nonzero means don't open a new frame.  Inverse of --create-frame.  */
-int current_frame = 1;
+/* True means open a new frame.  --create-frame etc.  */
+static bool create_frame;
 
 /* The display on which Emacs should work.  --display.  */
-const char *display = NULL;
+static char const *display;
 
 /* The alternate display we should try if Emacs does not support display.  */
-const char *alt_display = NULL;
+static char const *alt_display;
 
 /* The parent window ID, if we are opening a frame via XEmbed.  */
-char *parent_id = NULL;
+static char *parent_id;
 
-/* Nonzero means open a new Emacs frame on the current terminal.  */
-int tty = 0;
+/* True means open a new Emacs frame on the current terminal.  */
+static bool tty;
 
 /* If non-NULL, the name of an editor to fallback to if the server
    is not running.  --alternate-editor.   */
-const char *alternate_editor = NULL;
+static char *alternate_editor;
 
+#ifdef SOCKETS_IN_FILE_SYSTEM
 /* If non-NULL, the filename of the UNIX socket.  */
-const char *socket_name = NULL;
+static char const *socket_name;
+#endif
 
 /* If non-NULL, the filename of the authentication file.  */
-const char *server_file = NULL;
+static char const *server_file;
 
 /* If non-NULL, the tramp prefix emacs must use to find the files.  */
-const char *tramp_prefix = NULL;
+static char const *tramp_prefix;
 
-/* PID of the Emacs server process.  */
-int emacs_pid = 0;
+/* If nonzero, PID of the Emacs server process.  */
+static pid_t emacs_pid;
 
 /* If non-NULL, a string that should form a frame parameter alist to
    be used for the new frame.  */
-const char *frame_parameters = NULL;
+static char const *frame_parameters;
 
 static _Noreturn void print_help_and_exit (void);
 
+/* Long command-line options.  */
 
-struct option longopts[] =
+static struct option const longopts[] =
 {
   { "no-wait", no_argument,       NULL, 'n' },
   { "quiet",   no_argument,       NULL, 'q' },
@@ -179,7 +169,7 @@ struct option longopts[] =
   { "create-frame", no_argument,   NULL, 'c' },
   { "alternate-editor", required_argument, NULL, 'a' },
   { "frame-parameters", required_argument, NULL, 'F' },
-#ifndef NO_SOCKETS_IN_FILE_SYSTEM
+#ifdef SOCKETS_IN_FILE_SYSTEM
   { "socket-name",     required_argument, NULL, 's' },
 #endif
   { "server-file",     required_argument, NULL, 'f' },
@@ -189,6 +179,15 @@ struct option longopts[] =
   { 0, 0, 0, 0 }
 };
 
+/* Short options, in the same order as the corresponding long options.
+   There is no '-p' short option.  */
+static char const shortopts[] =
+  "nqueHVtca:F:"
+#ifdef SOCKETS_IN_FILE_SYSTEM
+  "s:"
+#endif
+  "f:d:T:";
+
 
 /* Like malloc but get fatal error if memory is exhausted.  */
 
@@ -219,9 +218,8 @@ xrealloc (void *ptr, size_t size)
 }
 
 /* Like strdup but get a fatal error if memory is exhausted. */
-char *xstrdup (const char *) ATTRIBUTE_MALLOC;
 
-char *
+static char * ATTRIBUTE_MALLOC
 xstrdup (const char *s)
 {
   char *result = strdup (s);
@@ -234,7 +232,7 @@ xstrdup (const char *s)
 }
 
 /* From sysdep.c */
-#if !defined (HAVE_GET_CURRENT_DIR_NAME) || defined 
(BROKEN_GET_CURRENT_DIR_NAME)
+#if !defined HAVE_GET_CURRENT_DIR_NAME || defined BROKEN_GET_CURRENT_DIR_NAME
 
 char *get_current_dir_name (void);
 
@@ -245,20 +243,20 @@ char *
 get_current_dir_name (void)
 {
   char *buf;
-  const char *pwd;
   struct stat dotstat, pwdstat;
   /* If PWD is accurate, use it instead of calling getcwd.  PWD is
      sometimes a nicer name, and using it may avoid a fatal error if a
      parent directory is searchable but not readable.  */
-    if ((pwd = egetenv ("PWD")) != 0
+  char const *pwd = egetenv ("PWD");
+  if (pwd
       && (IS_DIRECTORY_SEP (*pwd) || (*pwd && IS_DEVICE_SEP (pwd[1])))
       && stat (pwd, &pwdstat) == 0
       && stat (".", &dotstat) == 0
       && dotstat.st_ino == pwdstat.st_ino
       && dotstat.st_dev == pwdstat.st_dev
-#ifdef MAXPATHLEN
+# ifdef MAXPATHLEN
       && strlen (pwd) < MAXPATHLEN
-#endif
+# endif
       )
     {
       buf = xmalloc (strlen (pwd) + 1);
@@ -296,7 +294,7 @@ get_current_dir_name (void)
 
 #ifdef WINDOWSNT
 
-#define REG_ROOT "SOFTWARE\\GNU\\Emacs"
+# define REG_ROOT "SOFTWARE\\GNU\\Emacs"
 
 char *w32_get_resource (HKEY, const char *, LPDWORD);
 
@@ -310,7 +308,8 @@ w32_get_resource (HKEY predefined, const char *key, LPDWORD 
type)
   char *result = NULL;
   DWORD cbData;
 
-  if (RegOpenKeyEx (predefined, REG_ROOT, 0, KEY_READ, &hrootkey) == 
ERROR_SUCCESS)
+  if (RegOpenKeyEx (predefined, REG_ROOT, 0, KEY_READ, &hrootkey)
+      == ERROR_SUCCESS)
     {
       if (RegQueryValueEx (hrootkey, key, NULL, NULL, NULL, &cbData)
          == ERROR_SUCCESS)
@@ -439,8 +438,8 @@ w32_execvp (const char *path, char **argv)
   return execvp (path, argv);
 }
 
-#undef execvp
-#define execvp w32_execvp
+# undef execvp
+# define execvp w32_execvp
 
 /* Emulation of ttyname for Windows.  */
 const char *ttyname (int);
@@ -487,7 +486,7 @@ message (bool is_error, const char *format, ...)
 }
 
 /* Decode the options from argv and argc.
-   The global variable `optind' will say how many arguments we used up.  */
+   The global variable 'optind' will say how many arguments we used up.  */
 
 static void
 decode_options (int argc, char **argv)
@@ -495,17 +494,10 @@ decode_options (int argc, char **argv)
   alternate_editor = egetenv ("ALTERNATE_EDITOR");
   tramp_prefix = egetenv ("EMACSCLIENT_TRAMP");
 
-  while (1)
+  while (true)
     {
-      int opt = getopt_long_only (argc, argv,
-#ifndef NO_SOCKETS_IN_FILE_SYSTEM
-                            "VHnequa:s:f:d:F:tcT:",
-#else
-                            "VHnequa:f:d:F:tcT:",
-#endif
-                            longopts, 0);
-
-      if (opt == EOF)
+      int opt = getopt_long_only (argc, argv, shortopts, longopts, NULL);
+      if (opt < 0)
        break;
 
       switch (opt)
@@ -519,7 +511,7 @@ decode_options (int argc, char **argv)
          alternate_editor = optarg;
          break;
 
-#ifndef NO_SOCKETS_IN_FILE_SYSTEM
+#ifdef SOCKETS_IN_FILE_SYSTEM
        case 's':
          socket_name = optarg;
          break;
@@ -538,19 +530,19 @@ decode_options (int argc, char **argv)
          break;
 
        case 'n':
-         nowait = 1;
+         nowait = true;
          break;
 
        case 'e':
-         eval = 1;
+         eval = true;
          break;
 
        case 'q':
-         quiet = 1;
+         quiet = true;
          break;
 
        case 'u':
-         suppress_output = 1;
+         suppress_output = true;
          break;
 
        case 'V':
@@ -559,17 +551,17 @@ decode_options (int argc, char **argv)
          break;
 
         case 't':
-          tty = 1;
-         current_frame = 0;
+         tty = true;
+         create_frame = true;
           break;
 
         case 'c':
-          current_frame = 0;
+         create_frame = true;
           break;
 
        case 'p':
          parent_id = optarg;
-          current_frame = 0;
+         create_frame = true;
          break;
 
        case 'H':
@@ -593,7 +585,7 @@ decode_options (int argc, char **argv)
 
   /* If the -c option is used (without -t) and no --display argument
      is provided, try $DISPLAY.
-     Without the -c option, we used to set `display' to $DISPLAY by
+     Without the -c option, we used to set 'display' to $DISPLAY by
      default, but this changed the default behavior and is sometimes
      inconvenient.  So we force users to use "--display $DISPLAY" if
      they want Emacs to connect to their current display.
@@ -602,7 +594,7 @@ decode_options (int argc, char **argv)
      reflected in the DISPLAY variable.  If the user didn't give us an
      explicit display, try this platform-specific after trying the
      display in DISPLAY (if any).  */
-  if (!current_frame && !tty && !display)
+  if (create_frame && !tty && !display)
     {
       /* Set these here so we use a default_display only when the user
          didn't give us an explicit display.  */
@@ -622,24 +614,24 @@ decode_options (int argc, char **argv)
     }
 
   /* A null-string display is invalid.  */
-  if (display && strlen (display) == 0)
+  if (display && !display[0])
     display = NULL;
 
   /* If no display is available, new frames are tty frames.  */
-  if (!current_frame && !display)
-    tty = 1;
+  if (create_frame && !display)
+    tty = true;
 
 #ifdef WINDOWSNT
   /* Emacs on Windows does not support graphical and text terminal
      frames in the same instance.  So, treat the -t and -c options as
      equivalent, and open a new frame on the server's terminal.
-     Ideally, we would only set tty = 1 when the serve is running in a
+     Ideally, we would set tty = true only if the server is running in a
      console, but alas we don't know that.  As a workaround, always
      ask for a tty frame, and let server.el figure it out.  */
-  if (!current_frame)
+  if (create_frame)
     {
       display = NULL;
-      tty = 1;
+      tty = true;
     }
 #endif /* WINDOWSNT */
 }
@@ -674,7 +666,7 @@ The following OPTIONS are accepted:\n\
                        Visit the file in the given display\n\
 ", "\
 --parent-id=ID          Open in parent window ID, via XEmbed\n"
-#ifndef NO_SOCKETS_IN_FILE_SYSTEM
+#ifdef SOCKETS_IN_FILE_SYSTEM
 "-s SOCKET, --socket-name=SOCKET\n\
                        Set filename of the UNIX socket for communication\n"
 #endif
@@ -705,14 +697,15 @@ fail (void)
       size_t new_argv_size = extra_args_size;
       char **new_argv = xmalloc (new_argv_size);
       char *s = xstrdup (alternate_editor);
-      unsigned toks = 0;
+      ptrdiff_t toks = 0;
 
       /* Unpack alternate_editor's space-separated tokens into new_argv.  */
       for (char *tok = s; tok != NULL && *tok != '\0';)
         {
           /* Allocate new token.  */
           ++toks;
-          new_argv = xrealloc (new_argv, new_argv_size + toks * sizeof (char 
*));
+          new_argv = xrealloc (new_argv,
+                              new_argv_size + toks * sizeof (char *));
 
           /* Skip leading delimiters, and set separator, skipping any
              opening quote.  */
@@ -740,39 +733,26 @@ fail (void)
 }
 
 
-#if !defined (HAVE_SOCKETS) || !defined (HAVE_INET_SOCKETS)
-
-int
-main (int argc, char **argv)
-{
-  main_argc = argc;
-  main_argv = argv;
-  progname = argv[0];
-  message (true, "%s: Sorry, the Emacs server is supported only\n"
-          "on systems with Berkeley sockets.\n",
-          argv[0]);
-  fail ();
-}
-
-#else /* HAVE_SOCKETS && HAVE_INET_SOCKETS */
-
-#define AUTH_KEY_LENGTH      64
-#define SEND_BUFFER_SIZE   4096
-
-/* Buffer to accumulate data to send in TCP connections.  */
-char send_buffer[SEND_BUFFER_SIZE + 1];
-int sblen = 0; /* Fill pointer for the send buffer.  */
-/* Socket used to communicate with the Emacs server process.  */
-HSOCKET emacs_socket = 0;
+#ifdef SOCKETS_IN_FILE_SYSTEM
+static void act_on_signals (HSOCKET);
+#else
+static void act_on_signals (HSOCKET s) {}
+static void init_signals (void) {}
+#endif
 
-/* On Windows, the socket library was historically separate from the
-   standard C library, so errors are handled differently.  */
+enum { AUTH_KEY_LENGTH = 64 };
 
 static void
 sock_err_message (const char *function_name)
 {
 #ifdef WINDOWSNT
-  char* msg = NULL;
+  /* On Windows, the socket library was historically separate from the
+     standard C library, so errors are handled differently.  */
+
+  if (w32_window_app () && alternate_editor)
+    return;
+
+  char *msg = NULL;
 
   FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM
                  | FORMAT_MESSAGE_ALLOCATE_BUFFER
@@ -788,39 +768,47 @@ sock_err_message (const char *function_name)
 }
 
 
-/* Let's send the data to Emacs when either
-   - the data ends in "\n", or
+/* Send to S the data in *DATA when either
+   - the data's last byte is '\n', or
    - the buffer is full (but this shouldn't happen)
-   Otherwise, we just accumulate it.  */
+   Otherwise, just accumulate the data.  */
 static void
 send_to_emacs (HSOCKET s, const char *data)
 {
-  size_t dlen;
+  enum { SEND_BUFFER_SIZE = 4096 };
 
-  if (!data)
-    return;
+  /* Buffer to accumulate data to send in TCP connections.  */
+  static char send_buffer[SEND_BUFFER_SIZE + 1];
+
+  /* Fill pointer for the send buffer.  */
+  static int sblen;
 
-  dlen = strlen (data);
-  while (*data)
+  for (ptrdiff_t dlen = strlen (data); dlen != 0; )
     {
-      size_t part = min (dlen, SEND_BUFFER_SIZE - sblen);
+      int part = min (dlen, SEND_BUFFER_SIZE - sblen);
       memcpy (&send_buffer[sblen], data, part);
       data += part;
       sblen += part;
 
       if (sblen == SEND_BUFFER_SIZE
-         || (sblen > 0 && send_buffer[sblen-1] == '\n'))
+         || (0 < sblen && send_buffer[sblen - 1] == '\n'))
        {
-         int sent = send (s, send_buffer, sblen, 0);
-         if (sent < 0)
+         int sent;
+         while ((sent = send (s, send_buffer, sblen, 0)) < 0)
            {
-             message (true, "%s: failed to send %d bytes to socket: %s\n",
-                      progname, sblen, strerror (errno));
-             fail ();
+             if (errno != EINTR)
+               {
+                 message (true, "%s: failed to send %d bytes to socket: %s\n",
+                          progname, sblen, strerror (errno));
+                 fail ();
+               }
+             /* Act on signals not requiring communication to Emacs,
+                but defer action on the others to avoid confusing the
+                communication currently in progress.  */
+             act_on_signals (INVALID_SOCKET);
            }
-         if (sent != sblen)
-           memmove (send_buffer, &send_buffer[sent], sblen - sent);
          sblen -= sent;
+         memmove (send_buffer, &send_buffer[sent], sblen);
        }
 
       dlen -= part;
@@ -837,33 +825,21 @@ static void
 quote_argument (HSOCKET s, const char *str)
 {
   char *copy = xmalloc (strlen (str) * 2 + 1);
-  const char *p;
-  char *q;
-
-  p = str;
-  q = copy;
-  while (*p)
+  char *q = copy;
+  if (*str == '-')
+    *q++ = '&', *q++ = *str++;
+  for (; *str; str++)
     {
-      if (*p == ' ')
-       {
-         *q++ = '&';
-         *q++ = '_';
-         p++;
-       }
-      else if (*p == '\n')
-       {
-         *q++ = '&';
-         *q++ = 'n';
-         p++;
-       }
-      else
-       {
-         if (*p == '&' || (*p == '-' && p == str))
-           *q++ = '&';
-         *q++ = *p++;
-       }
+      char c = *str;
+      if (c == ' ')
+       *q++ = '&', c = '_';
+      else if (c == '\n')
+       *q++ = '&', c = 'n';
+      else if (c == '&')
+       *q++ = '&';
+      *q++ = c;
     }
-  *q++ = 0;
+  *q = 0;
 
   send_to_emacs (s, copy);
 
@@ -871,65 +847,35 @@ quote_argument (HSOCKET s, const char *str)
 }
 
 
-/* The inverse of quote_argument.  Removes quoting in string STR by
-   modifying the string in place.   Returns STR.  */
+/* The inverse of quote_argument.  Remove quoting in string STR by
+   modifying the addressed string in place.  Return STR.  */
 
 static char *
 unquote_argument (char *str)
 {
-  char *p, *q;
-
-  if (! str)
-    return str;
+  char const *p = str;
+  char *q = str;
+  char c;
 
-  p = str;
-  q = str;
-  while (*p)
+  do
     {
-      if (*p == '&')
-        {
-          p++;
-          if (*p == '&')
-            *p = '&';
-          else if (*p == '_')
-            *p = ' ';
-          else if (*p == 'n')
-            *p = '\n';
-          else if (*p == '-')
-            *p = '-';
-        }
-      *q++ = *p++;
+      c = *p++;
+      if (c == '&')
+       {
+         c = *p++;
+         if (c == '_')
+           c = ' ';
+         else if (c == 'n')
+           c = '\n';
+       }
+      *q++ = c;
     }
-  *q = 0;
+  while (c);
+
   return str;
 }
 
 
-static int
-file_name_absolute_p (const char *filename)
-{
-  /* Sanity check, it shouldn't happen.  */
-  if (! filename) return false;
-
-  /* /xxx is always an absolute path.  */
-  if (filename[0] == '/') return true;
-
-  /* Empty filenames (which shouldn't happen) are relative.  */
-  if (filename[0] == '\0') return false;
-
-#ifdef WINDOWSNT
-  /* X:\xxx is always absolute.  */
-  if (isalpha ((unsigned char) filename[0])
-      && filename[1] == ':' && (filename[2] == '\\' || filename[2] == '/'))
-    return true;
-
-  /* Both \xxx and \\xxx\yyy are absolute.  */
-  if (filename[0] == '\\') return true;
-#endif
-
-  return false;
-}
-
 #ifdef WINDOWSNT
 /* Wrapper to make WSACleanup a cdecl, as required by atexit.  */
 void __cdecl close_winsock (void);
@@ -957,44 +903,45 @@ initialize_sockets (void)
 #endif /* WINDOWSNT */
 
 
+/* If the home directory is HOME, return the configuration file with
+   basename CONFIG_FILE.  Fail if there is no home directory or if the
+   configuration file could not be opened.  */
+
+static FILE *
+open_config (char const *home, char const *config_file)
+{
+  if (!home)
+    return NULL;
+  ptrdiff_t homelen = strlen (home);
+  static char const emacs_d_server[] = "/.emacs.d/server/";
+  ptrdiff_t suffixsize = sizeof emacs_d_server + strlen (config_file);
+  char *configname = xmalloc (homelen + suffixsize);
+  strcpy (stpcpy (stpcpy (configname, home), emacs_d_server), config_file);
+
+  FILE *config = fopen (configname, "rb");
+  free (configname);
+  return config;
+}
+
 /* Read the information needed to set up a TCP comm channel with
    the Emacs server: host, port, and authentication string.  */
 
-static int
+static bool
 get_server_config (const char *config_file, struct sockaddr_in *server,
                   char *authentication)
 {
   char dotted[32];
   char *port;
-  FILE *config = NULL;
+  FILE *config;
 
-  if (file_name_absolute_p (config_file))
+  if (IS_ABSOLUTE_FILE_NAME (config_file))
     config = fopen (config_file, "rb");
   else
     {
-      const char *home = egetenv ("HOME");
-
-      if (home)
-        {
-         char *path = xmalloc (strlen (home) + strlen (config_file)
-                               + EXTRA_SPACE);
-         char *z = stpcpy (path, home);
-         z = stpcpy (z, "/.emacs.d/server/");
-         strcpy (z, config_file);
-          config = fopen (path, "rb");
-         free (path);
-        }
+      config = open_config (egetenv ("HOME"), config_file);
 #ifdef WINDOWSNT
-      if (!config && (home = egetenv ("APPDATA")))
-        {
-         char *path = xmalloc (strlen (home) + strlen (config_file)
-                               + EXTRA_SPACE);
-         char *z = stpcpy (path, home);
-         z = stpcpy (z, "/.emacs.d/server/");
-         strcpy (z, config_file);
-          config = fopen (path, "rb");
-         free (path);
-        }
+      if (!config)
+       config = open_config (egetenv ("APPDATA"), config_file);
 #endif
     }
 
@@ -1010,6 +957,7 @@ get_server_config (const char *config_file, struct 
sockaddr_in *server,
       exit (EXIT_FAILURE);
     }
 
+  memset (server, 0, sizeof *server);
   server->sin_family = AF_INET;
   server->sin_addr.s_addr = inet_addr (dotted);
   server->sin_port = htons (atoi (port));
@@ -1025,46 +973,64 @@ get_server_config (const char *config_file, struct 
sockaddr_in *server,
   return true;
 }
 
+/* Like socket (DOMAIN, TYPE, PROTOCOL), except arrange for the
+   resulting file descriptor to be close-on-exec.  */
+
+static HSOCKET
+cloexec_socket (int domain, int type, int protocol)
+{
+#ifdef SOCK_CLOEXEC
+  return socket (domain, type | SOCK_CLOEXEC, protocol);
+#else
+  HSOCKET s = socket (domain, type, protocol);
+# ifndef WINDOWSNT
+  if (0 <= s)
+    fcntl (s, F_SETFD, FD_CLOEXEC);
+# endif
+  return s;
+#endif
+}
+
 static HSOCKET
 set_tcp_socket (const char *local_server_file)
 {
-  HSOCKET s;
-  struct sockaddr_in server;
-  struct linger l_arg = {1, 1};
+  union {
+    struct sockaddr_in in;
+    struct sockaddr sa;
+  } server;
+  struct linger l_arg = { .l_onoff = 1, .l_linger = 1 };
   char auth_string[AUTH_KEY_LENGTH + 1];
 
-  if (! get_server_config (local_server_file, &server, auth_string))
+  if (! get_server_config (local_server_file, &server.in, auth_string))
     return INVALID_SOCKET;
 
-  if (server.sin_addr.s_addr != inet_addr ("127.0.0.1") && !quiet)
+  if (server.in.sin_addr.s_addr != inet_addr ("127.0.0.1") && !quiet)
     message (false, "%s: connected to remote socket at %s\n",
-             progname, inet_ntoa (server.sin_addr));
+            progname, inet_ntoa (server.in.sin_addr));
 
   /* Open up an AF_INET socket.  */
-  if ((s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
+  HSOCKET s = cloexec_socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
+  if (s < 0)
     {
       /* Since we have an alternate to try out, this is not an error
         yet; popping out a modal dialog at this stage would make -a
         option totally useless for emacsclientw -- the user will
         still get an error message if the alternate editor fails.  */
-#ifdef WINDOWSNT
-      if(!(w32_window_app () && alternate_editor))
-#endif
       sock_err_message ("socket");
       return INVALID_SOCKET;
     }
 
   /* Set up the socket.  */
-  if (connect (s, (struct sockaddr *) &server, sizeof server) < 0)
+  if (connect (s, &server.sa, sizeof server.in) != 0)
     {
-#ifdef WINDOWSNT
-      if(!(w32_window_app () && alternate_editor))
-#endif
       sock_err_message ("connect");
+      CLOSE_SOCKET (s);
       return INVALID_SOCKET;
     }
 
-  setsockopt (s, SOL_SOCKET, SO_LINGER, (char *) &l_arg, sizeof l_arg);
+  /* The cast to 'const char *' is to avoid a compiler warning when
+     compiling for MS-Windows sockets.  */
+  setsockopt (s, SOL_SOCKET, SO_LINGER, (const char *) &l_arg, sizeof l_arg);
 
   /* Send the authentication.  */
   auth_string[AUTH_KEY_LENGTH] = '\0';
@@ -1077,44 +1043,38 @@ set_tcp_socket (const char *local_server_file)
 }
 
 
-/* Returns 1 if PREFIX is a prefix of STRING. */
-static int
+/* Return true if PREFIX is a prefix of STRING. */
+static bool
 strprefix (const char *prefix, const char *string)
 {
   return !strncmp (prefix, string, strlen (prefix));
 }
 
-/* Get tty name and type.  If successful, return the type in TTY_TYPE
-   and the name in TTY_NAME, and return 1.  Otherwise, fail if NOABORT
-   is zero, or return 0 if NOABORT is non-zero.  */
+/* Get tty name and type.  If successful, store the type into
+   *TTY_TYPE and the name into *TTY_NAME, and return true.
+   Otherwise, fail if NOABORT is zero, or return false if NOABORT.  */
 
-static int
-find_tty (const char **tty_type, const char **tty_name, int noabort)
+static bool
+find_tty (const char **tty_type, const char **tty_name, bool noabort)
 {
   const char *type = egetenv ("TERM");
-  const char *name = ttyname (fileno (stdout));
+  const char *name = ttyname (STDOUT_FILENO);
 
   if (!name)
     {
       if (noabort)
-       return 0;
-      else
-       {
-         message (true, "%s: could not get terminal name\n", progname);
-         fail ();
-       }
+       return false;
+      message (true, "%s: could not get terminal name\n", progname);
+      fail ();
     }
 
   if (!type)
     {
       if (noabort)
-       return 0;
-      else
-       {
-         message (true, "%s: please set the TERM variable to your terminal 
type\n",
-                  progname);
-         fail ();
-       }
+       return false;
+      message (true, "%s: please set the TERM variable to your terminal 
type\n",
+              progname);
+      fail ();
     }
 
   const char *inside_emacs = egetenv ("INSIDE_EMACS");
@@ -1122,300 +1082,416 @@ find_tty (const char **tty_type, const char 
**tty_name, int noabort)
       && strprefix ("eterm", type))
     {
       if (noabort)
-       return 0;
-      else
-       {
-         /* This causes nasty, MULTI_KBOARD-related input lockouts. */
-         message (true, "%s: opening a frame in an Emacs term buffer"
-                  " is not supported\n", progname);
-         fail ();
-       }
+       return false;
+      /* This causes nasty, MULTI_KBOARD-related input lockouts. */
+      message (true, ("%s: opening a frame in an Emacs term buffer"
+                     " is not supported\n"),
+              progname);
+      fail ();
     }
 
   *tty_name = name;
   *tty_type = type;
-  return 1;
+  return true;
 }
 
+/* Return the process group if in the foreground, the negative of the
+   process group if in the background, and zero if there is no
+   foreground process group for the controlling terminal.
+   Unfortunately, use of this function introduces an unavoidable race,
+   since whether the process is in the foreground or background can
+   change at any time.  */
+
+static pid_t
+process_grouping (void)
+{
+#ifdef SOCKETS_IN_FILE_SYSTEM
+  pid_t tcpgrp = tcgetpgrp (STDOUT_FILENO);
+  if (0 <= tcpgrp)
+    {
+      pid_t pgrp = getpgrp ();
+      return tcpgrp == pgrp ? pgrp : -pgrp;
+    }
+#endif
+  return 0;
+}
 
-#if !defined (NO_SOCKETS_IN_FILE_SYSTEM)
+#ifdef SOCKETS_IN_FILE_SYSTEM
 
-/* Three possibilities:
-   2 - can't be `stat'ed               (sets errno)
-   1 - isn't owned by us
+/* Return the file status of NAME, ordinarily a socket.
+   It should be owned by UID.  Return one of the following:
+  >0 - 'stat' failed with this errno value
+  -1 - isn't owned by us
    0 - success: none of the above */
 
 static int
-socket_status (const char *name)
+socket_status (const char *name, uid_t uid)
 {
   struct stat statbfr;
 
-  if (stat (name, &statbfr) == -1)
-    return 2;
+  if (stat (name, &statbfr) != 0)
+    return errno;
 
-  if (statbfr.st_uid != geteuid ())
-    return 1;
+  if (statbfr.st_uid != uid)
+    return -1;
 
   return 0;
 }
 
 
-/* A signal handler that passes the signal to the Emacs process.
-   Useful for SIGWINCH.  */
-
+/* Signal handlers merely set a flag, to avoid race conditions on
+   POSIXish systems.  Non-POSIX platforms lacking sigaction make do
+   with traditional calls to 'signal'; races are rare so this usually
+   works.  Although this approach may treat multiple deliveries of SIG
+   as a single delivery and may act on signals in a different order
+   than received, that is OK for emacsclient.  Also, this approach may
+   omit output if a printf call is interrupted by a signal, but printf
+   output is not that important (emacsclient does not check for printf
+   errors, after all) so this is also OK for emacsclient.  */
+
+/* Reinstall for SIG the signal handler HANDLER if needed.  It is
+   needed on a non-POSIX or traditional platform where an interrupt
+   resets the signal handler to SIG_DFL.  */
 static void
-pass_signal_to_emacs (int signalnum)
+reinstall_handler_if_needed (int sig, void (*handler) (int))
 {
-  int old_errno = errno;
+# ifndef SA_RESETHAND
+  /* This is a platform without POSIX's sigaction.  */
+  signal (sig, handler);
+# endif
+}
+
+/* Flags for each signal, and handlers that set the flags.  */
 
-  if (emacs_pid)
-    kill (emacs_pid, signalnum);
+static sig_atomic_t volatile
+  got_sigcont, got_sigtstp, got_sigttou, got_sigwinch;
 
-  signal (signalnum, pass_signal_to_emacs);
-  errno = old_errno;
+static void
+handle_sigcont (int sig)
+{
+  got_sigcont = 1;
+  reinstall_handler_if_needed (sig, handle_sigcont);
+}
+static void
+handle_sigtstp (int sig)
+{
+  got_sigtstp = 1;
+  reinstall_handler_if_needed (sig, handle_sigtstp);
+}
+static void
+handle_sigttou (int sig)
+{
+  got_sigttou = 1;
+  reinstall_handler_if_needed (sig, handle_sigttou);
+}
+static void
+handle_sigwinch (int sig)
+{
+  got_sigwinch = 1;
+  reinstall_handler_if_needed (sig, handle_sigwinch);
 }
 
-/* Signal handler for SIGCONT; notify the Emacs process that it can
-   now resume our tty frame.  */
+/* Install for signal SIG the handler HANDLER.  However, if FLAG is
+   non-null and if the signal is currently being ignored, do not
+   install the handler and keep *FLAG zero.  */
 
 static void
-handle_sigcont (int signalnum)
+install_handler (int sig, void (*handler) (int), sig_atomic_t volatile *flag)
 {
-  int old_errno = errno;
-  pid_t pgrp = getpgrp ();
-  pid_t tcpgrp = tcgetpgrp (1);
-
-  if (tcpgrp == pgrp)
+# ifdef SA_RESETHAND
+  if (flag)
     {
-      /* We are in the foreground.  */
-      send_to_emacs (emacs_socket, "-resume \n");
+      struct sigaction oact;
+      if (sigaction (sig, NULL, &oact) == 0 && oact.sa_handler == SIG_IGN)
+       return;
     }
-  else if (0 <= tcpgrp && tty)
+  struct sigaction act = { .sa_handler = handler };
+  sigemptyset (&act.sa_mask);
+  sigaction (sig, &act, NULL);
+# else
+  void (*ohandler) (int) = signal (sig, handler);
+  if (flag)
     {
-      /* We are in the background; cancel the continue.  */
-      kill (-pgrp, SIGTTIN);
+      if (ohandler == SIG_IGN)
+       {
+         signal (sig, SIG_IGN);
+         /* While HANDLER was mistakenly installed a signal may have
+            arrived and set *FLAG, so clear *FLAG now.  */
+         *flag = 0;
+       }
     }
-
-  signal (signalnum, handle_sigcont);
-  errno = old_errno;
+# endif
 }
 
-/* Signal handler for SIGTSTP; notify the Emacs process that we are
-   going to sleep.  Normally the suspend is initiated by Emacs via
-   server-handle-suspend-tty, but if the server gets out of sync with
-   reality, we may get a SIGTSTP on C-z.  Handling this signal and
-   notifying Emacs about it should get things under control again.  */
+/* Initial installation of signal handlers.  */
 
 static void
-handle_sigtstp (int signalnum)
+init_signals (void)
 {
-  int old_errno = errno;
-  sigset_t set;
-
-  if (emacs_socket)
-    send_to_emacs (emacs_socket, "-suspend \n");
-
-  /* Unblock this signal and call the default handler by temporarily
-     changing the handler and resignaling.  */
-  sigprocmask (SIG_BLOCK, NULL, &set);
-  sigdelset (&set, signalnum);
-  signal (signalnum, SIG_DFL);
-  raise (signalnum);
-  sigprocmask (SIG_SETMASK, &set, NULL); /* Let's the above signal through. */
-  signal (signalnum, handle_sigtstp);
-
-  errno = old_errno;
+  install_handler (SIGCONT, handle_sigcont, &got_sigcont);
+  install_handler (SIGTSTP, handle_sigtstp, &got_sigtstp);
+  install_handler (SIGTTOU, handle_sigttou, &got_sigttou);
+  install_handler (SIGWINCH, handle_sigwinch, &got_sigwinch);
+  /* Don't mess with SIGINT and SIGQUIT, as Emacs has no way to
+     determine which terminal the signal came from.  C-g is a normal
+     input event on secondary terminals.  */
 }
 
+/* Act on delivered tty-related signal SIG that normally has handler
+   HANDLER.  EMACS_SOCKET connects to Emacs.  */
 
-/* Set up signal handlers before opening a frame on the current tty.  */
+static void
+act_on_tty_signal (int sig, void (*handler) (int), HSOCKET emacs_socket)
+{
+  /* Notify Emacs that we are going to sleep.  Normally the suspend is
+     initiated by Emacs via server-handle-suspend-tty, but if the
+     server gets out of sync with reality, we may get a SIGTSTP on
+     C-z.  Handling this signal and notifying Emacs about it should
+     get things under control again.  */
+  send_to_emacs (emacs_socket, "-suspend \n");
+
+  /* Execute the default action by temporarily changing handling to
+     the default and resignaling.  */
+  install_handler (sig, SIG_DFL, NULL);
+  raise (sig);
+  install_handler (sig, handler, NULL);
+}
+
+/* Act on delivered signals if possible.  If EMACS_SOCKET is valid,
+   use it to communicate to Emacs.  */
 
 static void
-init_signals (void)
+act_on_signals (HSOCKET emacs_socket)
 {
-  /* Set up signal handlers. */
-  signal (SIGWINCH, pass_signal_to_emacs);
-
-  /* Don't pass SIGINT and SIGQUIT to Emacs, because it has no way of
-     deciding which terminal the signal came from.  C-g is now a
-     normal input event on secondary terminals.  */
-#if 0
-  signal (SIGINT, pass_signal_to_emacs);
-  signal (SIGQUIT, pass_signal_to_emacs);
-#endif
+  while (true)
+    {
+      bool took_action = false;
+
+      if (emacs_socket != INVALID_SOCKET)
+       {
+         if (got_sigcont)
+           {
+             got_sigcont = 0;
+             took_action = true;
+             pid_t grouping = process_grouping ();
+             if (grouping < 0)
+               {
+                 if (tty)
+                   {
+                     /* Cancel the continue.  */
+                     kill (grouping, SIGTTIN);
+                   }
+               }
+             else
+               send_to_emacs (emacs_socket, "-resume \n");
+           }
+
+         if (got_sigtstp)
+           {
+             got_sigtstp = 0;
+             took_action = true;
+             act_on_tty_signal (SIGTSTP, handle_sigtstp, emacs_socket);
+           }
+         if (got_sigttou)
+           {
+             got_sigttou = 0;
+             took_action = true;
+             act_on_tty_signal (SIGTTOU, handle_sigttou, emacs_socket);
+           }
+       }
 
-  signal (SIGCONT, handle_sigcont);
-  signal (SIGTSTP, handle_sigtstp);
-  signal (SIGTTOU, handle_sigtstp);
+      if (emacs_pid && got_sigwinch)
+       {
+         got_sigwinch = 0;
+         took_action = true;
+         kill (emacs_pid, SIGWINCH);
+       }
+
+      if (!took_action)
+       break;
+    }
 }
 
+/* Create in SOCKNAME (of size SOCKNAMESIZE) a name for a local socket.
+   The first TMPDIRLEN bytes of SOCKNAME are already initialized to be
+   the name of a temporary directory.  Use UID and SERVER_NAME to
+   concoct the name.  Return the total length of the name if successful,
+   -1 if it does not fit (and store a truncated name in that case).
+   Fail if TMPDIRLEN is out of range.  */
+
+static int
+local_sockname (char *sockname, int socknamesize, int tmpdirlen,
+               uintmax_t uid, char const *server_name)
+{
+  /* If ! (0 <= TMPDIRLEN && TMPDIRLEN < SOCKNAMESIZE) the truncated
+     temporary directory name is already in SOCKNAME, so nothing more
+     need be stored.  */
+  if (0 <= tmpdirlen)
+    {
+      int remaining = socknamesize - tmpdirlen;
+      if (0 < remaining)
+       {
+         int suffixlen = snprintf (&sockname[tmpdirlen], remaining,
+                                   "/emacs%"PRIuMAX"/%s", uid, server_name);
+         if (0 <= suffixlen && suffixlen < remaining)
+           return tmpdirlen + suffixlen;
+       }
+    }
+  return -1;
+}
+
+/* Create a local socket for SERVER_NAME and connect it to Emacs.  If
+   SERVER_NAME is a file name component, the local socket name
+   relative to a well-known location in a temporary directory.
+   Otherwise, the local socket name is SERVER_NAME.  */
 
 static HSOCKET
-set_local_socket (const char *local_socket_name)
+set_local_socket (char const *server_name)
 {
-  HSOCKET s;
-  struct sockaddr_un server;
+  union {
+    struct sockaddr_un un;
+    struct sockaddr sa;
+  } server = {{ .sun_family = AF_UNIX }};
+  char *sockname = server.un.sun_path;
+  enum { socknamesize = sizeof server.un.sun_path };
+  int tmpdirlen = -1;
+  int socknamelen = -1;
+  uid_t uid = geteuid ();
+
+  if (strchr (server_name, '/')
+      || (ISSLASH ('\\') && strchr (server_name, '\\')))
+    socknamelen = snprintf (sockname, socknamesize, "%s", server_name);
+  else
+    {
+      /* socket_name is a file name component.  */
+      char const *xdg_runtime_dir = egetenv ("XDG_RUNTIME_DIR");
+      if (xdg_runtime_dir)
+       socknamelen = snprintf (sockname, socknamesize, "%s/emacs/%s",
+                               xdg_runtime_dir, server_name);
+      else
+       {
+         char const *tmpdir = egetenv ("TMPDIR");
+         if (tmpdir)
+           tmpdirlen = snprintf (sockname, socknamesize, "%s", tmpdir);
+         else
+           {
+# ifdef DARWIN_OS
+#  ifndef _CS_DARWIN_USER_TEMP_DIR
+#   define _CS_DARWIN_USER_TEMP_DIR 65537
+#  endif
+             size_t n = confstr (_CS_DARWIN_USER_TEMP_DIR,
+                                 sockname, socknamesize);
+             if (0 < n && n < (size_t) -1)
+               tmpdirlen = min (n - 1, socknamesize);
+# endif
+             if (tmpdirlen < 0)
+               tmpdirlen = snprintf (sockname, socknamesize, "/tmp");
+           }
+         socknamelen = local_sockname (sockname, socknamesize, tmpdirlen,
+                                       uid, server_name);
+       }
+    }
 
-  /* Open up an AF_UNIX socket in this person's home directory.  */
-  if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
+  if (! (0 <= socknamelen && socknamelen < socknamesize))
     {
-      message (true, "%s: socket: %s\n", progname, strerror (errno));
-      return INVALID_SOCKET;
+      message (true, "%s: socket-name %s... too long\n", progname, sockname);
+      fail ();
     }
 
-  server.sun_family = AF_UNIX;
+  /* See if the socket exists, and if it's owned by us. */
+  int sock_status = socket_status (sockname, uid);
+  if (sock_status)
+    {
+      /* Failing that, see if LOGNAME or USER exist and differ from
+        our euid.  If so, look for a socket based on the UID
+        associated with the name.  This is reminiscent of the logic
+        that init_editfns uses to set the global Vuser_full_name.  */
 
-  {
-    int sock_status;
-    int saved_errno;
-    const char *server_name = local_socket_name;
-    const char *tmpdir = NULL;
-    char *tmpdir_storage = NULL;
-    char *socket_name_storage = NULL;
+      char const *user_name = egetenv ("LOGNAME");
 
-    if (!strchr (local_socket_name, '/') && !strchr (local_socket_name, '\\'))
-      {
-       /* socket_name is a file name component.  */
-       long uid = geteuid ();
-       tmpdir = egetenv ("TMPDIR");
-       if (!tmpdir)
-          {
-#ifdef DARWIN_OS
-#ifndef _CS_DARWIN_USER_TEMP_DIR
-#define _CS_DARWIN_USER_TEMP_DIR 65537
-#endif
-            size_t n = confstr (_CS_DARWIN_USER_TEMP_DIR, NULL, (size_t) 0);
-            if (n > 0)
-              {
-               tmpdir = tmpdir_storage = xmalloc (n);
-               confstr (_CS_DARWIN_USER_TEMP_DIR, tmpdir_storage, n);
-              }
-            else
-#endif
-              tmpdir = "/tmp";
-          }
-       socket_name_storage =
-         xmalloc (strlen (tmpdir) + strlen (server_name) + EXTRA_SPACE);
-       char *z = stpcpy (socket_name_storage, tmpdir);
-       z += sprintf (z, "/emacs%ld/", uid);
-       strcpy (z, server_name);
-       local_socket_name = socket_name_storage;
-      }
+      if (!user_name)
+       user_name = egetenv ("USER");
 
-    if (strlen (local_socket_name) < sizeof (server.sun_path))
-      strcpy (server.sun_path, local_socket_name);
-    else
-      {
-        message (true, "%s: socket-name %s too long\n",
-                 progname, local_socket_name);
-        fail ();
-      }
+      if (user_name)
+       {
+         struct passwd *pw = getpwnam (user_name);
 
-    /* See if the socket exists, and if it's owned by us. */
-    sock_status = socket_status (server.sun_path);
-    saved_errno = errno;
-    if (sock_status && tmpdir)
-      {
-       /* Failing that, see if LOGNAME or USER exist and differ from
-          our euid.  If so, look for a socket based on the UID
-          associated with the name.  This is reminiscent of the logic
-          that init_editfns uses to set the global Vuser_full_name.  */
-
-       const char *user_name = egetenv ("LOGNAME");
-
-       if (!user_name)
-         user_name = egetenv ("USER");
-
-       if (user_name)
-         {
-           struct passwd *pw = getpwnam (user_name);
-
-           if (pw && (pw->pw_uid != geteuid ()))
-             {
-               /* We're running under su, apparently. */
-               long uid = pw->pw_uid;
-               char *user_socket_name
-                 = xmalloc (strlen (tmpdir) + strlen (server_name)
-                            + EXTRA_SPACE);
-               char *z = stpcpy (user_socket_name, tmpdir);
-               z += sprintf (z, "/emacs%ld/", uid);
-               strcpy (z, server_name);
-
-               if (strlen (user_socket_name) < sizeof (server.sun_path))
-                 strcpy (server.sun_path, user_socket_name);
-               else
-                 {
-                   message (true, "%s: socket-name %s too long\n",
-                            progname, user_socket_name);
-                   exit (EXIT_FAILURE);
-                 }
-               free (user_socket_name);
-
-               sock_status = socket_status (server.sun_path);
-                saved_errno = errno;
-             }
-           else
-             errno = saved_errno;
-         }
-      }
+         if (pw && pw->pw_uid != uid)
+           {
+             /* We're running under su, apparently. */
+             socknamelen = local_sockname (sockname, socknamesize, tmpdirlen,
+                                           pw->pw_uid, server_name);
+             if (socknamelen < 0)
+               {
+                 message (true, "%s: socket-name %s... too long\n",
+                          progname, sockname);
+                 exit (EXIT_FAILURE);
+               }
 
-    free (socket_name_storage);
-    free (tmpdir_storage);
+             sock_status = socket_status (sockname, uid);
+           }
+       }
+    }
 
-    switch (sock_status)
-      {
-      case 1:
-       /* There's a socket, but it isn't owned by us.  This is OK if
-          we are root. */
-       if (0 != geteuid ())
-         {
-           message (true, "%s: Invalid socket owner\n", progname);
-           return INVALID_SOCKET;
-         }
-       break;
+  if (sock_status == 0)
+    {
+      HSOCKET s = cloexec_socket (AF_UNIX, SOCK_STREAM, 0);
+      if (s < 0)
+       {
+         message (true, "%s: socket: %s\n", progname, strerror (errno));
+         return INVALID_SOCKET;
+       }
+      if (connect (s, &server.sa, sizeof server.un) != 0)
+       {
+         message (true, "%s: connect: %s\n", progname, strerror (errno));
+         CLOSE_SOCKET (s);
+         return INVALID_SOCKET;
+       }
 
-      case 2:
-       /* `stat' failed */
-       if (saved_errno == ENOENT)
-         message (true,
-                  "%s: can't find socket; have you started the server?\n\
-To start the server in Emacs, type \"M-x server-start\".\n",
-                  progname);
-       else
-         message (true, "%s: can't stat %s: %s\n",
-                  progname, server.sun_path, strerror (saved_errno));
-       return INVALID_SOCKET;
-      }
-  }
+      struct stat connect_stat;
+      if (fstat (s, &connect_stat) != 0)
+       sock_status = errno;
+      else if (connect_stat.st_uid == uid)
+       return s;
+      else
+       sock_status = -1;
 
-  if (connect (s, (struct sockaddr *) &server, strlen (server.sun_path) + 2)
-      < 0)
-    {
-      message (true, "%s: connect: %s\n", progname, strerror (errno));
-      return INVALID_SOCKET;
+      CLOSE_SOCKET (s);
     }
 
-  return s;
+  if (sock_status < 0)
+    message (true, "%s: Invalid socket owner\n", progname);
+  else if (sock_status == ENOENT)
+    message (true,
+            ("%s: can't find socket; have you started the server?\n"
+             "%s: To start the server in Emacs,"
+             " type \"M-x server-start\".\n"),
+            progname, progname);
+  else
+    message (true, "%s: can't stat %s: %s\n",
+            progname, sockname, strerror (sock_status));
+
+  return INVALID_SOCKET;
 }
-#endif /* ! NO_SOCKETS_IN_FILE_SYSTEM */
+#endif /* SOCKETS_IN_FILE_SYSTEM */
 
 static HSOCKET
-set_socket (int no_exit_if_error)
+set_socket (bool no_exit_if_error)
 {
   HSOCKET s;
   const char *local_server_file = server_file;
 
   INITIALIZE ();
 
-#ifndef NO_SOCKETS_IN_FILE_SYSTEM
-  /* Explicit --socket-name argument.  */
+#ifdef SOCKETS_IN_FILE_SYSTEM
   if (!socket_name)
     socket_name = egetenv ("EMACS_SOCKET_NAME");
 
   if (socket_name)
     {
+      /* Explicit --socket-name argument, or environment variable.  */
       s = set_local_socket (socket_name);
-      if ((s != INVALID_SOCKET) || no_exit_if_error)
+      if (s != INVALID_SOCKET || no_exit_if_error)
        return s;
       message (true, "%s: error accessing socket \"%s\"\n",
               progname, socket_name);
@@ -1430,7 +1506,7 @@ set_socket (int no_exit_if_error)
   if (local_server_file)
     {
       s = set_tcp_socket (local_server_file);
-      if ((s != INVALID_SOCKET) || no_exit_if_error)
+      if (s != INVALID_SOCKET || no_exit_if_error)
        return s;
 
       message (true, "%s: error accessing server file \"%s\"\n",
@@ -1438,7 +1514,7 @@ set_socket (int no_exit_if_error)
       exit (EXIT_FAILURE);
     }
 
-#ifndef NO_SOCKETS_IN_FILE_SYSTEM
+#ifdef SOCKETS_IN_FILE_SYSTEM
   /* Implicit local socket.  */
   s = set_local_socket ("server");
   if (s != INVALID_SOCKET)
@@ -1447,12 +1523,12 @@ set_socket (int no_exit_if_error)
 
   /* Implicit server file.  */
   s = set_tcp_socket ("server");
-  if ((s != INVALID_SOCKET) || no_exit_if_error)
+  if (s != INVALID_SOCKET || no_exit_if_error)
     return s;
 
   /* No implicit or explicit socket, and no alternate editor.  */
   message (true, "%s: No socket or alternate editor.  Please use:\n\n"
-#ifndef NO_SOCKETS_IN_FILE_SYSTEM
+#ifdef SOCKETS_IN_FILE_SYSTEM
 "\t--socket-name\n"
 #endif
 "\t--server-file      (or environment variable EMACS_SERVER_FILE)\n\
@@ -1549,7 +1625,7 @@ w32_give_focus (void)
 
 /* Start the emacs daemon and try to connect to it.  */
 
-static void
+static HSOCKET
 start_daemon_and_retry_set_socket (void)
 {
 #ifndef WINDOWSNT
@@ -1560,22 +1636,17 @@ start_daemon_and_retry_set_socket (void)
 
   if (dpid > 0)
     {
-      pid_t w;
-      w = waitpid (dpid, &status, WUNTRACED | WCONTINUED);
+      pid_t w = waitpid (dpid, &status, WUNTRACED | WCONTINUED);
 
-      if ((w == -1) || !WIFEXITED (status) || WEXITSTATUS (status))
+      if (w < 0 || !WIFEXITED (status) || WEXITSTATUS (status))
        {
          message (true, "Error: Could not start the Emacs daemon\n");
          exit (EXIT_FAILURE);
        }
 
       /* Try connecting, the daemon should have started by now.  */
-      message (true, "Emacs daemon should have started, trying to connect 
again\n");
-      if ((emacs_socket = set_socket (1)) == INVALID_SOCKET)
-       {
-         message (true, "Error: Cannot connect even after starting the Emacs 
daemon\n");
-         exit (EXIT_FAILURE);
-       }
+      message (true,
+              "Emacs daemon should have started, trying to connect again\n");
     }
   else if (dpid < 0)
     {
@@ -1590,6 +1661,7 @@ start_daemon_and_retry_set_socket (void)
       d_argv[0] = emacs;
       d_argv[1] = daemon_option;
       d_argv[2] = 0;
+# ifdef SOCKETS_IN_FILE_SYSTEM
       if (socket_name != NULL)
        {
          /* Pass  --daemon=socket_name as argument.  */
@@ -1599,8 +1671,10 @@ start_daemon_and_retry_set_socket (void)
          strcpy (stpcpy (daemon_arg, deq), socket_name);
          d_argv[1] = daemon_arg;
        }
+# endif
       execvp ("emacs", d_argv);
       message (true, "%s: error starting emacs daemon\n", progname);
+      exit (EXIT_FAILURE);
     }
 #else  /* WINDOWSNT */
   DWORD wait_result;
@@ -1666,27 +1740,29 @@ start_daemon_and_retry_set_socket (void)
   if (!w32_window_app ())
     message (true,
             "Emacs daemon should have started, trying to connect again\n");
-  if ((emacs_socket = set_socket (1)) == INVALID_SOCKET)
+#endif /* WINDOWSNT */
+
+  HSOCKET emacs_socket = set_socket (true);
+  if (emacs_socket == INVALID_SOCKET)
     {
       message (true,
               "Error: Cannot connect even after starting the Emacs daemon\n");
       exit (EXIT_FAILURE);
     }
-#endif /* WINDOWSNT */
+  return emacs_socket;
 }
 
 int
 main (int argc, char **argv)
 {
-  int rl = 0, needlf = 0;
-  char *cwd, *str;
-  char string[BUFSIZ+1];
-  int start_daemon_if_needed;
-  int exit_status = EXIT_SUCCESS;
-
   main_argc = argc;
   main_argv = argv;
-  progname = argv[0];
+  progname = argv[0] ? argv[0] : "emacsclient";
+
+  int rl = 0;
+  bool skiplf = true;
+  char string[BUFSIZ + 1];
+  int exit_status = EXIT_SUCCESS;
 
 #ifdef HAVE_NTGUI
   /* On Windows 7 and later, we need to explicitly associate
@@ -1694,44 +1770,43 @@ main (int argc, char **argv)
      association does no harm if we're not actually connecting to an
      Emacs using a window display.  */
   w32_set_user_model_id ();
-#endif /* HAVE_NTGUI */
+#endif
 
   /* Process options.  */
   decode_options (argc, argv);
 
-  if ((argc - optind < 1) && !eval && current_frame)
+  if (! (optind < argc || eval || create_frame))
     {
-      message (true, "%s: file name or argument required\n"
-              "Try '%s --help' for more information\n",
+      message (true, ("%s: file name or argument required\n"
+                     "Try '%s --help' for more information\n"),
               progname, progname);
       exit (EXIT_FAILURE);
     }
 
-#ifndef WINDOWSNT
+#ifdef SOCKETS_IN_FILE_SYSTEM
   if (tty)
     {
-      pid_t pgrp = getpgrp ();
-      pid_t tcpgrp = tcgetpgrp (1);
-      if (0 <= tcpgrp && tcpgrp != pgrp)
-       kill (-pgrp, SIGTTIN);
+      pid_t grouping = process_grouping ();
+      if (grouping < 0)
+       kill (grouping, SIGTTIN);
     }
-#endif /* !WINDOWSNT */
+#endif
 
   /* If alternate_editor is the empty string, start the emacs daemon
      in case of failure to connect.  */
-  start_daemon_if_needed = (alternate_editor
-                           && (alternate_editor[0] == '\0'));
+  bool start_daemon_if_needed = alternate_editor && !alternate_editor[0];
 
-  emacs_socket = set_socket (alternate_editor || start_daemon_if_needed);
+  HSOCKET emacs_socket = set_socket (alternate_editor
+                                    || start_daemon_if_needed);
   if (emacs_socket == INVALID_SOCKET)
     {
       if (! start_daemon_if_needed)
        fail ();
 
-      start_daemon_and_retry_set_socket ();
+      emacs_socket = start_daemon_and_retry_set_socket ();
     }
 
-  cwd = get_current_dir_name ();
+  char *cwd = get_current_dir_name ();
   if (cwd == 0)
     {
       message (true, "%s: %s\n", progname,
@@ -1742,16 +1817,15 @@ main (int argc, char **argv)
 #ifdef HAVE_NTGUI
   if (display && !strcmp (display, "w32"))
   w32_give_focus ();
-#endif /* HAVE_NTGUI */
+#endif
 
   /* Send over our environment and current directory. */
-  if (!current_frame)
+  if (create_frame)
     {
-      int i;
-      for (i = 0; environ[i]; i++)
+      for (char *const *e = environ; *e; e++)
         {
           send_to_emacs (emacs_socket, "-env ");
-          quote_argument (emacs_socket, environ[i]);
+          quote_argument (emacs_socket, *e);
           send_to_emacs (emacs_socket, " ");
         }
     }
@@ -1767,7 +1841,7 @@ main (int argc, char **argv)
   if (nowait)
     send_to_emacs (emacs_socket, "-nowait ");
 
-  if (current_frame)
+  if (!create_frame)
     send_to_emacs (emacs_socket, "-current-frame ");
 
   if (display)
@@ -1784,7 +1858,7 @@ main (int argc, char **argv)
       send_to_emacs (emacs_socket, " ");
     }
 
-  if (frame_parameters && !current_frame)
+  if (frame_parameters && create_frame)
     {
       send_to_emacs (emacs_socket, "-frame-parameters ");
       quote_argument (emacs_socket, frame_parameters);
@@ -1794,15 +1868,16 @@ main (int argc, char **argv)
   /* Unless we are certain we don't want to occupy the tty, send our
      tty information to Emacs.  For example, in daemon mode Emacs may
      need to occupy this tty if no other frame is available.  */
-  if (!current_frame || !eval)
+  if (create_frame || !eval)
     {
       const char *tty_type, *tty_name;
 
       if (find_tty (&tty_type, &tty_name, !tty))
        {
-#if !defined (NO_SOCKETS_IN_FILE_SYSTEM)
+         /* Install signal handlers before opening a frame on the
+            current tty.  */
          init_signals ();
-#endif
+
          send_to_emacs (emacs_socket, "-tty ");
          quote_argument (emacs_socket, tty_name);
          send_to_emacs (emacs_socket, " ");
@@ -1811,13 +1886,12 @@ main (int argc, char **argv)
        }
     }
 
-  if (!current_frame && !tty)
+  if (create_frame && !tty)
     send_to_emacs (emacs_socket, "-window-system ");
 
-  if ((argc - optind > 0))
+  if (optind < argc)
     {
-      int i;
-      for (i = optind; i < argc; i++)
+      for (int i = optind; i < argc; i++)
        {
 
          if (eval)
@@ -1829,11 +1903,15 @@ main (int argc, char **argv)
               continue;
             }
 
-          if (*argv[i] == '+')
+         char *p = argv[i];
+         if (*p == '+')
             {
-             char *p = argv[i] + 1;
-             while (isdigit ((unsigned char) *p) || *p == ':') p++;
-             if (*p == 0)
+             unsigned char c;
+             do
+               c = *++p;
+             while (isdigit (c) || c == ':');
+
+             if (c == 0)
                 {
                   send_to_emacs (emacs_socket, "-position ");
                   quote_argument (emacs_socket, argv[i]);
@@ -1842,7 +1920,7 @@ main (int argc, char **argv)
                 }
             }
 #ifdef WINDOWSNT
-         else if (! file_name_absolute_p (argv[i])
+         else if (! IS_ABSOLUTE_FILE_NAME (argv[i])
                   && (isalpha (argv[i][0]) && argv[i][1] == ':'))
            /* Windows can have a different default directory for each
               drive, so the cwd passed via "-dir" is not sufficient
@@ -1863,7 +1941,7 @@ main (int argc, char **argv)
 #endif
 
           send_to_emacs (emacs_socket, "-file ");
-         if (tramp_prefix && file_name_absolute_p (argv[i]))
+         if (tramp_prefix && IS_ABSOLUTE_FILE_NAME (argv[i]))
            quote_argument (emacs_socket, tramp_prefix);
           quote_argument (emacs_socket, argv[i]);
           send_to_emacs (emacs_socket, " ");
@@ -1872,10 +1950,10 @@ main (int argc, char **argv)
   else if (eval)
     {
       /* Read expressions interactively.  */
-      while ((str = fgets (string, BUFSIZ, stdin)))
+      while (fgets (string, BUFSIZ, stdin))
        {
          send_to_emacs (emacs_socket, "-eval ");
-         quote_argument (emacs_socket, str);
+         quote_argument (emacs_socket, string);
        }
       send_to_emacs (emacs_socket, " ");
     }
@@ -1883,26 +1961,21 @@ main (int argc, char **argv)
   send_to_emacs (emacs_socket, "\n");
 
   /* Wait for an answer. */
-  if (!eval && !tty && !nowait && !quiet)
+  if (!eval && !tty && !nowait && !quiet && 0 <= process_grouping ())
     {
       printf ("Waiting for Emacs...");
-      needlf = 2;
+      skiplf = false;
     }
   fflush (stdout);
-  while (fdatasync (1) != 0 && errno == EINTR)
-    continue;
 
   /* Now, wait for an answer and print any messages.  */
   while (exit_status == EXIT_SUCCESS)
     {
-      char *p, *end_p;
       do
-        {
-          errno = 0;
-          rl = recv (emacs_socket, string, BUFSIZ, 0);
-        }
-      /* If we receive a signal (e.g. SIGWINCH, which we pass
-        through to Emacs), on some OSes we get EINTR and must retry. */
+       {
+         act_on_signals (emacs_socket);
+         rl = recv (emacs_socket, string, BUFSIZ, 0);
+       }
       while (rl < 0 && errno == EINTR);
 
       if (rl <= 0)
@@ -1911,7 +1984,8 @@ main (int argc, char **argv)
       string[rl] = '\0';
 
       /* Loop over all NL-terminated messages.  */
-      for (end_p = p = string; end_p != NULL && *end_p != '\0'; p = end_p)
+      char *p = string;
+      for (char *end_p = p; end_p && *end_p != '\0'; p = end_p)
        {
          end_p = strchr (p, '\n');
          if (end_p != NULL)
@@ -1920,7 +1994,7 @@ main (int argc, char **argv)
           if (strprefix ("-emacs-pid ", p))
             {
               /* -emacs-pid PID: The process id of the Emacs process. */
-              emacs_pid = strtol (p + strlen ("-emacs-pid"), NULL, 10);
+             emacs_pid = strtoumax (p + strlen ("-emacs-pid"), NULL, 10);
             }
           else if (strprefix ("-window-system-unsupported ", p))
             {
@@ -1934,8 +2008,8 @@ main (int argc, char **argv)
                 }
               else
                 {
-                  nowait = 0;
-                  tty = 1;
+                  nowait = false;
+                  tty = true;
                 }
 
               goto retry;
@@ -1945,11 +2019,10 @@ main (int argc, char **argv)
               /* -print STRING: Print STRING on the terminal. */
              if (!suppress_output)
                {
-                 str = unquote_argument (p + strlen ("-print "));
-                 if (needlf)
-                   printf ("\n");
-                 printf ("%s", str);
-                 needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != 
'\n';
+                 char *str = unquote_argument (p + strlen ("-print "));
+                 printf (&"\n%s"[skiplf], str);
+                 if (str[0])
+                   skiplf = str[strlen (str) - 1] == '\n';
                }
            }
           else if (strprefix ("-print-nonl ", p))
@@ -1958,47 +2031,44 @@ main (int argc, char **argv)
                  Used to continue a preceding -print command.  */
              if (!suppress_output)
                {
-                 str = unquote_argument (p + strlen ("-print-nonl "));
+                 char *str = unquote_argument (p + strlen ("-print-nonl "));
                  printf ("%s", str);
-                 needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != 
'\n';
+                 if (str[0])
+                   skiplf = str[strlen (str) - 1] == '\n';
                }
             }
           else if (strprefix ("-error ", p))
             {
               /* -error DESCRIPTION: Signal an error on the terminal. */
-              str = unquote_argument (p + strlen ("-error "));
-              if (needlf)
+              char *str = unquote_argument (p + strlen ("-error "));
+              if (!skiplf)
                 printf ("\n");
               fprintf (stderr, "*ERROR*: %s", str);
-              needlf = str[0] == '\0' ? needlf : str[strlen (str) - 1] != '\n';
+              if (str[0])
+               skiplf = str[strlen (str) - 1] == '\n';
               exit_status = EXIT_FAILURE;
             }
-#ifdef SIGSTOP
+#ifndef WINDOWSNT
          else if (strprefix ("-suspend ", p))
            {
              /* -suspend: Suspend this terminal, i.e., stop the process. */
-             if (needlf)
+             if (!skiplf)
                printf ("\n");
-             needlf = 0;
+             skiplf = true;
              kill (0, SIGSTOP);
            }
 #endif
          else
            {
              /* Unknown command. */
-             if (needlf)
-               printf ("\n");
-             needlf = 0;
-             printf ("*ERROR*: Unknown message: %s\n", p);
+             printf (&"\n*ERROR*: Unknown message: %s\n"[skiplf], p);
+             skiplf = true;
            }
        }
     }
 
-  if (needlf)
+  if (!skiplf && 0 <= process_grouping ())
     printf ("\n");
-  fflush (stdout);
-  while (fdatasync (1) != 0 && errno == EINTR)
-    continue;
 
   if (rl < 0)
     exit_status = EXIT_FAILURE;
@@ -2006,5 +2076,3 @@ main (int argc, char **argv)
   CLOSE_SOCKET (emacs_socket);
   return exit_status;
 }
-
-#endif /* HAVE_SOCKETS && HAVE_INET_SOCKETS */
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 102d867..362897f 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -28,7 +28,7 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
SOFTWARE, EVEN
 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2018 Free Software
+Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2019 Free Software
 Foundation, Inc.
 
 This file is not considered part of GNU Emacs.
diff --git a/lib-src/hexl.c b/lib-src/hexl.c
index d67dd4c..99a1132 100644
--- a/lib-src/hexl.c
+++ b/lib-src/hexl.c
@@ -1,5 +1,5 @@
 /* Convert files for Emacs Hexl mode.
-   Copyright (C) 1989, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1989, 2001-2019 Free Software Foundation, Inc.
 
 Author: Keith Gabryelski (according to authors.el)
 
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 23728e7..ccd245e 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -1,6 +1,6 @@
 /* Generate doc-string file for GNU Emacs from source files.
 
-Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2018 Free Software
+Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -700,7 +700,7 @@ write_globals (void)
       switch (globals[i].type)
        {
        case EMACS_INTEGER:
-         type = "EMACS_INT";
+         type = "intmax_t";
          break;
        case BOOLEAN:
          type = "bool";
@@ -1107,6 +1107,9 @@ scan_c_stream (FILE *infile)
                g->flags |= DEFUN_noreturn;
              if (strstr (input_buffer, "const"))
                g->flags |= DEFUN_const;
+
+             /* Although the noinline attribute is no longer used,
+                leave its support in, in case it's needed later.  */
              if (strstr (input_buffer, "noinline"))
                g->flags |= DEFUN_noinline;
            }
diff --git a/lib-src/make-fingerprint.c b/lib-src/make-fingerprint.c
new file mode 100644
index 0000000..d310366
--- /dev/null
+++ b/lib-src/make-fingerprint.c
@@ -0,0 +1,113 @@
+/* Hash inputs and generate C file with the digest.
+
+Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2016, 2018-2019
+Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
+
+
+/* The arguments given to this program are all the object files that
+ go into building GNU Emacs.  There is no special search logic to find
+ the files.  */
+
+#include <config.h>
+
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sysstdio.h>
+#include <sha256.h>
+#include <getopt.h>
+
+#ifdef WINDOWSNT
+/* Defined to be sys_fopen in ms-w32.h, but only #ifdef emacs, so this
+   is really just insurance.  */
+#undef fopen
+#include <direct.h>
+#endif /* WINDOWSNT */
+
+int
+main (int argc, char **argv)
+{
+  int c;
+  bool raw = false;
+  while (0 <= (c = getopt (argc, argv, "rh")))
+    {
+      switch (c)
+        {
+        case 'r':
+          raw = true;
+          break;
+        case 'h':
+          printf ("make-fingerprint [-r] FILES...: compute a hash\n");
+          return 0;
+        default:
+          return 1;
+        }
+    }
+
+  struct sha256_ctx ctx;
+  sha256_init_ctx (&ctx);
+
+  for (int i = optind; i < argc; ++i)
+    {
+      FILE *f = fopen (argv[i], "r" FOPEN_BINARY);
+      if (!f)
+        {
+          fprintf (stderr, "%s: Error: could not open %s\n",
+                   argv[0], argv[i]);
+          return 1;
+        }
+
+      char buf[128*1024];
+      do
+        {
+          size_t chunksz = fread (buf, 1, sizeof (buf), f);
+          if (ferror (f))
+            {
+              fprintf (stderr, "%s: Error: could not read %s\n",
+                       argv[0], argv[i]);
+              return 1;
+            }
+          sha256_process_bytes (buf, chunksz, &ctx);
+        } while (!feof (f));
+      fclose (f);
+    }
+
+  uint8_t digest[32];
+  sha256_finish_ctx (&ctx, digest);
+
+  if (raw)
+    {
+      for (int i = 0; i < 32; ++i)
+        printf ("%02X", digest[i]);
+    }
+  else
+    {
+      printf ("#include \"fingerprint.h\"\n");
+      printf ("\n");
+      printf ("const uint8_t fingerprint[32] = { ");
+      for (int i = 0; i < 32; ++i)
+        printf ("%s0x%02X", i ? ", " : "", digest[i]);
+      printf (" };\n");
+    }
+
+  return EXIT_SUCCESS;
+}
+
+/* make-fingerprint.c ends here */
diff --git a/lib-src/movemail.c b/lib-src/movemail.c
index 7a37e16..109e998 100644
--- a/lib-src/movemail.c
+++ b/lib-src/movemail.c
@@ -1,7 +1,7 @@
 /* movemail foo bar -- move file foo to file bar,
    locking file foo the way /bin/mail respects.
 
-Copyright (C) 1986, 1992-1994, 1996, 1999, 2001-2018 Free Software
+Copyright (C) 1986, 1992-1994, 1996, 1999, 2001-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/lib-src/ntlib.c b/lib-src/ntlib.c
index 4ca521d..dbafc47 100644
--- a/lib-src/ntlib.c
+++ b/lib-src/ntlib.c
@@ -1,6 +1,6 @@
 /* Utility and Unix shadow routines for GNU Emacs support programs on NT.
 
-Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
 Author: Geoff Voelker (address@hidden)
 Created: 10-8-94
diff --git a/lib-src/ntlib.h b/lib-src/ntlib.h
index e6df31d..fd5a0d2 100644
--- a/lib-src/ntlib.h
+++ b/lib-src/ntlib.h
@@ -1,5 +1,5 @@
 /* Utility and Unix shadow routines for GNU Emacs support programs on NT.
-   Copyright (C) 1994, 2002-2018 Free Software Foundation, Inc.
+   Copyright (C) 1994, 2002-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/lib-src/pop.c b/lib-src/pop.c
index 731f951..c14808d 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -1,6 +1,6 @@
 /* pop.c: client routines for talking to a POP3-protocol post-office server
 
-Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2018 Free Software
+Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2019 Free Software
 Foundation, Inc.
 
 Author: Jonathan Kamens <address@hidden>
diff --git a/lib-src/pop.h b/lib-src/pop.h
index dca85b8..81fa459 100644
--- a/lib-src/pop.h
+++ b/lib-src/pop.h
@@ -1,5 +1,5 @@
 /* pop.h: Header file for the "pop.c" client POP3 protocol.
-   Copyright (C) 1991, 1993, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1993, 2001-2019 Free Software Foundation, Inc.
 
 Author:  Jonathan Kamens <address@hidden>
 
diff --git a/lib-src/profile.c b/lib-src/profile.c
index 649eb04..257008e 100644
--- a/lib-src/profile.c
+++ b/lib-src/profile.c
@@ -1,5 +1,5 @@
 /* profile.c --- generate periodic events for profiling of Emacs Lisp code.
-   Copyright (C) 1992, 1994, 1999, 2001-2018 Free Software Foundation,
+   Copyright (C) 1992, 1994, 1999, 2001-2019 Free Software Foundation,
    Inc.
 
 Author: Boaz Ben-Zvi <address@hidden>
diff --git a/lib-src/rcs2log b/lib-src/rcs2log
index e459d35..2368780 100755
--- a/lib-src/rcs2log
+++ b/lib-src/rcs2log
@@ -2,7 +2,7 @@
 
 # RCS to ChangeLog generator
 
-# Copyright (C) 1992-1998, 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 1992-1998, 2001-2019 Free Software Foundation, Inc.
 
 # Author: Paul Eggert <address@hidden>
 
@@ -20,7 +20,7 @@
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 
-Copyright='Copyright (C) 2018 Free Software Foundation, Inc.
+Copyright='Copyright (C) 2019 Free Software Foundation, Inc.
 This program comes with NO WARRANTY, to the extent permitted by law.
 You may redistribute copies of this program
 under the terms of the GNU General Public License.
diff --git a/lib-src/update-game-score.c b/lib-src/update-game-score.c
index 050a4da..8a6f46b 100644
--- a/lib-src/update-game-score.c
+++ b/lib-src/update-game-score.c
@@ -1,6 +1,6 @@
 /* update-game-score.c --- Update a score file
 
-Copyright (C) 2002-2018 Free Software Foundation, Inc.
+Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 Author: Colin Walters <address@hidden>
 
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 7dba31b..f2d20356 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright 2017-2018 Free Software Foundation, Inc.
+# Copyright 2017-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/lib/_Noreturn.h b/lib/_Noreturn.h
index c44ad89..7594e4b 100644
--- a/lib/_Noreturn.h
+++ b/lib/_Noreturn.h
@@ -1,8 +1,15 @@
-#if !defined _Noreturn && __STDC_VERSION__ < 201112
-# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
-      || 0x5110 <= __SUNPRO_C)
+#ifndef _Noreturn
+# if (defined __cplusplus \
+      && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
+          || (defined _MSC_VER && 1900 <= _MSC_VER)))
+#  define _Noreturn [[noreturn]]
+# elif ((!defined __cplusplus || defined __clang__)                     \
+        && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)  \
+            || 4 < __GNUC__ + (7 <= __GNUC_MINOR__)))
+   /* _Noreturn works as-is.  */
+# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
 #  define _Noreturn __attribute__ ((__noreturn__))
-# elif 1200 <= _MSC_VER
+# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
 #  define _Noreturn __declspec (noreturn)
 # else
 #  define _Noreturn
diff --git a/lib/acl-errno-valid.c b/lib/acl-errno-valid.c
index 96577eb..99ddf3b 100644
--- a/lib/acl-errno-valid.c
+++ b/lib/acl-errno-valid.c
@@ -1,6 +1,6 @@
 /* Test whether ACLs are well supported on this system.
 
-   Copyright 2013-2018 Free Software Foundation, Inc.
+   Copyright 2013-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/acl-internal.c b/lib/acl-internal.c
index 92e7b9b..cc42183 100644
--- a/lib/acl-internal.c
+++ b/lib/acl-internal.c
@@ -1,6 +1,6 @@
 /* Test whether a file has a nontrivial ACL.  -*- coding: utf-8 -*-
 
-   Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/acl-internal.h b/lib/acl-internal.h
index 2da7c5a..05833ef 100644
--- a/lib/acl-internal.h
+++ b/lib/acl-internal.h
@@ -1,6 +1,6 @@
 /* Internal implementation of access control lists.  -*- coding: utf-8 -*-
 
-   Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/acl.h b/lib/acl.h
index d0c122c..904606d 100644
--- a/lib/acl.h
+++ b/lib/acl.h
@@ -1,6 +1,6 @@
 /* acl.c - access control lists
 
-   Copyright (C) 2002, 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2008-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/acl_entries.c b/lib/acl_entries.c
index ce730d4..19ac3c3 100644
--- a/lib/acl_entries.c
+++ b/lib/acl_entries.c
@@ -1,6 +1,6 @@
 /* Return the number of entries in an ACL.
 
-   Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/alloca.in.h b/lib/alloca.in.h
index 5ad8af8..a581d58 100644
--- a/lib/alloca.in.h
+++ b/lib/alloca.in.h
@@ -1,6 +1,6 @@
 /* Memory allocation on the stack.
 
-   Copyright (C) 1995, 1999, 2001-2004, 2006-2018 Free Software Foundation,
+   Copyright (C) 1995, 1999, 2001-2004, 2006-2019 Free Software Foundation,
    Inc.
 
    This program is free software; you can redistribute it and/or modify it
@@ -36,6 +36,12 @@
 
 #ifndef alloca
 # ifdef __GNUC__
+   /* Some version of mingw have an <alloca.h> that causes trouble when
+      included after 'alloca' gets defined as a macro.  As a workaround, 
include
+      this <alloca.h> first and define 'alloca' as a macro afterwards.  */
+#  if (defined _WIN32 && ! defined __CYGWIN__) && @HAVE_ALLOCA_H@
+#   include_next <alloca.h>
+#  endif
 #  define alloca __builtin_alloca
 # elif defined _AIX
 #  define alloca __alloca
diff --git a/lib/allocator.h b/lib/allocator.h
index ab312f5..5a632ba 100644
--- a/lib/allocator.h
+++ b/lib/allocator.h
@@ -1,6 +1,6 @@
 /* Memory allocators such as malloc+free.
 
-   Copyright (C) 2011-2018 Free Software Foundation, Inc.
+   Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/arg-nonnull.h b/lib/arg-nonnull.h
index 5f03408..ad8c26c 100644
--- a/lib/arg-nonnull.h
+++ b/lib/arg-nonnull.h
@@ -1,5 +1,5 @@
 /* A C macro for declaring that specific arguments must not be NULL.
-   Copyright (C) 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published
diff --git a/lib/at-func.c b/lib/at-func.c
index 55e4b8c..d2e6319 100644
--- a/lib/at-func.c
+++ b/lib/at-func.c
@@ -1,5 +1,5 @@
 /* Define at-style functions like fstatat, unlinkat, fchownat, etc.
-   Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/binary-io.c b/lib/binary-io.c
index f9cc4dd..01e0bf6 100644
--- a/lib/binary-io.c
+++ b/lib/binary-io.c
@@ -1,5 +1,5 @@
 /* Binary mode I/O.
-   Copyright 2017-2018 Free Software Foundation, Inc.
+   Copyright 2017-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/binary-io.h b/lib/binary-io.h
index 1f21fc0..720b08c 100644
--- a/lib/binary-io.h
+++ b/lib/binary-io.h
@@ -1,5 +1,5 @@
 /* Binary mode I/O.
-   Copyright (C) 2001, 2003, 2005, 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2003, 2005, 2008-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/byteswap.in.h b/lib/byteswap.in.h
index 547e384..273855d 100644
--- a/lib/byteswap.in.h
+++ b/lib/byteswap.in.h
@@ -1,5 +1,5 @@
 /* byteswap.h - Byte swapping
-   Copyright (C) 2005, 2007, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2009-2019 Free Software Foundation, Inc.
    Written by Oskar Liljeblad <address@hidden>, 2005.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/c++defs.h b/lib/c++defs.h
index 72ff1ff..87d0716 100644
--- a/lib/c++defs.h
+++ b/lib/c++defs.h
@@ -1,5 +1,5 @@
 /* C++ compatible function declaration macros.
-   Copyright (C) 2010-2018 Free Software Foundation, Inc.
+   Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published
diff --git a/lib/c-ctype.h b/lib/c-ctype.h
index d55d4f6..4d52176 100644
--- a/lib/c-ctype.h
+++ b/lib/c-ctype.h
@@ -5,7 +5,7 @@
    <ctype.h> functions' behaviour depends on the current locale set via
    setlocale.
 
-   Copyright (C) 2000-2003, 2006, 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2000-2003, 2006, 2008-2019 Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/lib/c-strcase.h b/lib/c-strcase.h
index 41f439e..b67c9b5 100644
--- a/lib/c-strcase.h
+++ b/lib/c-strcase.h
@@ -1,5 +1,5 @@
 /* Case-insensitive string comparison functions in C locale.
-   Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2018 Free Software
+   Copyright (C) 1995-1996, 2001, 2003, 2005, 2009-2019 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/lib/c-strcasecmp.c b/lib/c-strcasecmp.c
index 2b1ac99..ec50f1a 100644
--- a/lib/c-strcasecmp.c
+++ b/lib/c-strcasecmp.c
@@ -1,5 +1,5 @@
 /* c-strcasecmp.c -- case insensitive string comparator in C locale
-   Copyright (C) 1998-1999, 2005-2006, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2006, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/c-strncasecmp.c b/lib/c-strncasecmp.c
index 8151c1a..513c353 100644
--- a/lib/c-strncasecmp.c
+++ b/lib/c-strncasecmp.c
@@ -1,5 +1,5 @@
 /* c-strncasecmp.c -- case insensitive string comparator in C locale
-   Copyright (C) 1998-1999, 2005-2006, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 1998-1999, 2005-2006, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/careadlinkat.c b/lib/careadlinkat.c
index b5ae905..e56d503 100644
--- a/lib/careadlinkat.c
+++ b/lib/careadlinkat.c
@@ -1,6 +1,6 @@
 /* Read symbolic links into a buffer without size limitation, relative to fd.
 
-   Copyright (C) 2001, 2003-2004, 2007, 2009-2018 Free Software Foundation,
+   Copyright (C) 2001, 2003-2004, 2007, 2009-2019 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h
index 051d3ed..68b69aa 100644
--- a/lib/careadlinkat.h
+++ b/lib/careadlinkat.h
@@ -1,6 +1,6 @@
 /* Read symbolic links into a buffer without size limitation, relative to fd.
 
-   Copyright (C) 2011-2018 Free Software Foundation, Inc.
+   Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/cdefs.h b/lib/cdefs.h
index 2d620cc..96d2616 100644
--- a/lib/cdefs.h
+++ b/lib/cdefs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -139,7 +139,7 @@
    Headers that should use flexible arrays only if they're "real"
    (e.g. only if they won't affect sizeof()) should test
    #if __glibc_c99_flexarr_available.  */
-#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
+#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc
 # define __flexarr     []
 # define __glibc_c99_flexarr_available 1
 #elif __GNUC_PREREQ (2,97)
@@ -340,7 +340,7 @@
    semantics.
 
    clang++ identifies itself as gcc-4.2, but has support for GNU inlining
-   semantics, that can be checked fot by using the __GNUC_STDC_INLINE_ and
+   semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
    __GNUC_GNU_INLINE__ macro definitions.  */
 #if (!defined __cplusplus || __GNUC_PREREQ (4,3) \
      || (defined __clang__ && (defined __GNUC_STDC_INLINE__ \
diff --git a/lib/cloexec.c b/lib/cloexec.c
index 238ab18..db42576 100644
--- a/lib/cloexec.c
+++ b/lib/cloexec.c
@@ -1,6 +1,6 @@
 /* cloexec.c - set or clear the close-on-exec descriptor flag
 
-   Copyright (C) 1991, 2004-2006, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 1991, 2004-2006, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/cloexec.h b/lib/cloexec.h
index 5902805..06ad945 100644
--- a/lib/cloexec.h
+++ b/lib/cloexec.h
@@ -1,6 +1,6 @@
 /* cloexec.c - set or clear the close-on-exec descriptor flag
 
-   Copyright (C) 2004, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/close-stream.c b/lib/close-stream.c
index 3d5a52e..5458c4f 100644
--- a/lib/close-stream.c
+++ b/lib/close-stream.c
@@ -1,6 +1,6 @@
 /* Close a stream, with nicer error checking than fclose's.
 
-   Copyright (C) 1998-2002, 2004, 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 1998-2002, 2004, 2006-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/count-leading-zeros.h b/lib/count-leading-zeros.h
index efb0851..e5ac2e1 100644
--- a/lib/count-leading-zeros.h
+++ b/lib/count-leading-zeros.h
@@ -1,5 +1,5 @@
 /* count-leading-zeros.h -- counts the number of leading 0 bits in a word.
-   Copyright (C) 2012-2018 Free Software Foundation, Inc.
+   Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/count-one-bits.h b/lib/count-one-bits.h
index ae1872b..0056994 100644
--- a/lib/count-one-bits.h
+++ b/lib/count-one-bits.h
@@ -1,5 +1,5 @@
 /* count-one-bits.h -- counts the number of 1-bits in a word.
-   Copyright (C) 2007-2018 Free Software Foundation, Inc.
+   Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/count-trailing-zeros.h b/lib/count-trailing-zeros.h
index a4c7848..3f78696 100644
--- a/lib/count-trailing-zeros.h
+++ b/lib/count-trailing-zeros.h
@@ -1,5 +1,5 @@
 /* count-trailing-zeros.h -- counts the number of trailing 0 bits in a word.
-   Copyright 2013-2018 Free Software Foundation, Inc.
+   Copyright 2013-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/diffseq.h b/lib/diffseq.h
index 9244729..c6aac3d 100644
--- a/lib/diffseq.h
+++ b/lib/diffseq.h
@@ -1,6 +1,6 @@
 /* Analyze differences between two vectors.
 
-   Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2018 Free Software
+   Copyright (C) 1988-1989, 1992-1995, 2001-2004, 2006-2019 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/dirent.in.h b/lib/dirent.in.h
index 2ab25af..a3c8eb3 100644
--- a/lib/dirent.in.h
+++ b/lib/dirent.in.h
@@ -1,5 +1,5 @@
 /* A GNU-like <dirent.h>.
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/dirfd.c b/lib/dirfd.c
index 19c8046..bc858fd 100644
--- a/lib/dirfd.c
+++ b/lib/dirfd.c
@@ -1,6 +1,6 @@
 /* dirfd.c -- return the file descriptor associated with an open DIR*
 
-   Copyright (C) 2001, 2006, 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2006, 2008-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/dosname.h b/lib/dosname.h
index fef3b6d..c0ab684 100644
--- a/lib/dosname.h
+++ b/lib/dosname.h
@@ -1,6 +1,6 @@
 /* File names on MS-DOS/Windows systems.
 
-   Copyright (C) 2000-2001, 2004-2006, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2000-2001, 2004-2006, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/dtotimespec.c b/lib/dtotimespec.c
index dcbd280..a8ff04a 100644
--- a/lib/dtotimespec.c
+++ b/lib/dtotimespec.c
@@ -1,6 +1,6 @@
 /* Convert double to timespec.
 
-   Copyright (C) 2011-2018 Free Software Foundation, Inc.
+   Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/dup2.c b/lib/dup2.c
index c7d1767..d3aafa4 100644
--- a/lib/dup2.c
+++ b/lib/dup2.c
@@ -1,6 +1,6 @@
 /* Duplicate an open file descriptor to a specified file descriptor.
 
-   Copyright (C) 1999, 2004-2007, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2004-2007, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/errno.in.h b/lib/errno.in.h
index b95c4e9..3bd27f1 100644
--- a/lib/errno.in.h
+++ b/lib/errno.in.h
@@ -1,6 +1,6 @@
 /* A POSIX-like <errno.h>.
 
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/euidaccess.c b/lib/euidaccess.c
index de5d82b..fece4cf 100644
--- a/lib/euidaccess.c
+++ b/lib/euidaccess.c
@@ -1,6 +1,6 @@
 /* euidaccess -- check if effective user id can access file
 
-   Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2018 Free
+   Copyright (C) 1990-1991, 1995, 1998, 2000, 2003-2006, 2008-2019 Free
    Software Foundation, Inc.
 
    This file is part of the GNU C Library.
diff --git a/lib/execinfo.in.h b/lib/execinfo.in.h
index 83e1b28..def124e 100644
--- a/lib/execinfo.in.h
+++ b/lib/execinfo.in.h
@@ -1,6 +1,6 @@
 /* Information about executables.
 
-   Copyright (C) 2012-2018 Free Software Foundation, Inc.
+   Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
index 79b7fd6..79ef186 100644
--- a/lib/explicit_bzero.c
+++ b/lib/explicit_bzero.c
@@ -1,5 +1,5 @@
 /* Erasure of sensitive data, generic implementation.
-   Copyright (C) 2016-2018 Free Software Foundation, Inc.
+   Copyright (C) 2016-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/faccessat.c b/lib/faccessat.c
index 8aab786..6c63e61 100644
--- a/lib/faccessat.c
+++ b/lib/faccessat.c
@@ -1,5 +1,5 @@
 /* Check the access rights of a file relative to an open directory.
-   Copyright (C) 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/fcntl.c b/lib/fcntl.c
index 74e0f5d..51f62ef 100644
--- a/lib/fcntl.c
+++ b/lib/fcntl.c
@@ -1,6 +1,6 @@
 /* Provide file descriptor control.
 
-   Copyright (C) 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -545,7 +545,7 @@ rpl_fcntl_DUPFD_CLOEXEC (int fd, int target)
 #ifdef __KLIBC__
 
 static int
-klibc_fcntl (int fd, int action, /* arg */...);
+klibc_fcntl (int fd, int action, /* arg */...)
 {
   va_list arg_ptr;
   int arg;
diff --git a/lib/fcntl.in.h b/lib/fcntl.in.h
index a1e7d35..eb70dc6 100644
--- a/lib/fcntl.in.h
+++ b/lib/fcntl.in.h
@@ -1,6 +1,6 @@
 /* Like <fcntl.h>, but with non-working flags defined to 0.
 
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/fdatasync.c b/lib/fdatasync.c
deleted file mode 100644
index c474e3d..0000000
--- a/lib/fdatasync.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Emulate fdatasync on platforms that lack it.
-
-   Copyright (C) 2011-2018 Free Software Foundation, Inc.
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public
-   License as published by the Free Software Foundation; either
-   version 3 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
-
-#include <config.h>
-#include <unistd.h>
-
-int
-fdatasync (int fd)
-{
-  /* This does more work than strictly necessary, but is the best we
-     can do portably.  */
-  return fsync (fd);
-}
diff --git a/lib/fdopendir.c b/lib/fdopendir.c
index 9adefd2..b65588a 100644
--- a/lib/fdopendir.c
+++ b/lib/fdopendir.c
@@ -1,5 +1,5 @@
 /* provide a replacement fdopendir function
-   Copyright (C) 2004-2018 Free Software Foundation, Inc.
+   Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/filemode.c b/lib/filemode.c
index 574e994..71f2b82 100644
--- a/lib/filemode.c
+++ b/lib/filemode.c
@@ -1,6 +1,6 @@
 /* filemode.c -- make a string describing file modes
 
-   Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2018 Free
+   Copyright (C) 1985, 1990, 1993, 1998-2000, 2004, 2006, 2009-2019 Free
    Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/filemode.h b/lib/filemode.h
index f9d1d21..5ae9da0 100644
--- a/lib/filemode.h
+++ b/lib/filemode.h
@@ -1,6 +1,6 @@
 /* Make a string describing file modes.
 
-   Copyright (C) 1998-1999, 2003, 2006, 2009-2018 Free Software Foundation,
+   Copyright (C) 1998-1999, 2003, 2006, 2009-2019 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/filevercmp.c b/lib/filevercmp.c
index 9e9b440..aebe088 100644
--- a/lib/filevercmp.c
+++ b/lib/filevercmp.c
@@ -1,7 +1,7 @@
 /*
    Copyright (C) 1995 Ian Jackson <address@hidden>
    Copyright (C) 2001 Anthony Towns <address@hidden>
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/filevercmp.h b/lib/filevercmp.h
index 5e59456..23766f0 100644
--- a/lib/filevercmp.h
+++ b/lib/filevercmp.h
@@ -1,7 +1,7 @@
 /*
    Copyright (C) 1995 Ian Jackson <address@hidden>
    Copyright (C) 2001 Anthony Towns <address@hidden>
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/flexmember.h b/lib/flexmember.h
index 7e3f598..0d65f6d 100644
--- a/lib/flexmember.h
+++ b/lib/flexmember.h
@@ -1,6 +1,6 @@
 /* Sizes of structs with flexible array members.
 
-   Copyright 2016-2018 Free Software Foundation, Inc.
+   Copyright 2016-2019 Free Software Foundation, Inc.
 
    This file is part of the GNU C Library.
 
diff --git a/lib/fpending.c b/lib/fpending.c
index de370d4..3c01285 100644
--- a/lib/fpending.c
+++ b/lib/fpending.c
@@ -1,5 +1,5 @@
 /* fpending.c -- return the number of pending output bytes on a stream
-   Copyright (C) 2000, 2004, 2006-2007, 2009-2018 Free Software Foundation,
+   Copyright (C) 2000, 2004, 2006-2007, 2009-2019 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/fpending.h b/lib/fpending.h
index 2ff26bc..097a3ef 100644
--- a/lib/fpending.h
+++ b/lib/fpending.h
@@ -1,6 +1,6 @@
 /* Declare __fpending.
 
-   Copyright (C) 2000, 2003, 2005-2006, 2009-2018 Free Software Foundation,
+   Copyright (C) 2000, 2003, 2005-2006, 2009-2019 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/fstatat.c b/lib/fstatat.c
index 63ceceb..019d3c6 100644
--- a/lib/fstatat.c
+++ b/lib/fstatat.c
@@ -1,6 +1,6 @@
 /* Work around an fstatat bug on Solaris 9.
 
-   Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -36,10 +36,14 @@ orig_fstatat (int fd, char const *filename, struct stat 
*buf, int flags)
 }
 #endif
 
+#ifdef __osf__
 /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
    eliminates this include because of the preliminary #include <sys/stat.h>
    above.  */
-#include "sys/stat.h"
+# include "sys/stat.h"
+#else
+# include <sys/stat.h>
+#endif
 
 #include "stat-time.h"
 
diff --git a/lib/fsusage.c b/lib/fsusage.c
index 6920f85..7ddeb52 100644
--- a/lib/fsusage.c
+++ b/lib/fsusage.c
@@ -1,6 +1,6 @@
 /* fsusage.c -- return space usage of mounted file systems
 
-   Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2018 Free Software
+   Copyright (C) 1991-1992, 1996, 1998-1999, 2002-2006, 2009-2019 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
@@ -46,9 +46,6 @@
 # if HAVE_SYS_STATFS_H
 #  include <sys/statfs.h>
 # endif
-# if HAVE_DUSTAT_H              /* AIX PS/2 */
-#  include <sys/dustat.h>
-# endif
 #endif
 
 /* Many space usage primitives use all 1 bits to denote a value that is
@@ -151,21 +148,6 @@ get_fs_usage (char const *file, char const *disk, struct 
fs_usage *fsp)
                         ? PROPAGATE_ALL_ONES (fsd.f_frsize)
                         : PROPAGATE_ALL_ONES (fsd.f_bsize));
 
-#elif defined STAT_STATFS2_FS_DATA      /* Ultrix */
-
-  struct fs_data fsd;
-
-  if (statfs (file, &fsd) != 1)
-    return -1;
-
-  fsp->fsu_blocksize = 1024;
-  fsp->fsu_blocks = PROPAGATE_ALL_ONES (fsd.fd_req.btot);
-  fsp->fsu_bfree = PROPAGATE_ALL_ONES (fsd.fd_req.bfree);
-  fsp->fsu_bavail = PROPAGATE_TOP_BIT (fsd.fd_req.bfreen);
-  fsp->fsu_bavail_top_bit_set = EXTRACT_TOP_BIT (fsd.fd_req.bfreen) != 0;
-  fsp->fsu_files = PROPAGATE_ALL_ONES (fsd.fd_req.gtot);
-  fsp->fsu_ffree = PROPAGATE_ALL_ONES (fsd.fd_req.gfree);
-
 #elif defined STAT_STATFS3_OSF1         /* OSF/1 */
 
   struct statfs fsd;
@@ -219,12 +201,7 @@ get_fs_usage (char const *file, char const *disk, struct 
fs_usage *fsp)
 
   fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_fsize);
 
-#elif defined STAT_STATFS4              /* SVR3, Dynix, old Irix, old AIX, \
-                                           Dolphin */
-
-# if !_AIX && !defined _SEQUENT_ && !defined DOLPHIN
-#  define f_bavail f_bfree
-# endif
+#elif defined STAT_STATFS4              /* SVR3, old Irix */
 
   struct statfs fsd;
 
@@ -234,7 +211,7 @@ get_fs_usage (char const *file, char const *disk, struct 
fs_usage *fsp)
   /* Empirically, the block counts on most SVR3 and SVR3-derived
      systems seem to always be in terms of 512-byte blocks,
      no matter what value f_bsize has.  */
-# if _AIX || defined _CRAY
+# if defined _CRAY
    fsp->fsu_blocksize = PROPAGATE_ALL_ONES (fsd.f_bsize);
 # else
    fsp->fsu_blocksize = 512;
@@ -258,30 +235,3 @@ get_fs_usage (char const *file, char const *disk, struct 
fs_usage *fsp)
   (void) disk;  /* avoid argument-unused warning */
   return 0;
 }
-
-#if defined _AIX && defined _I386
-/* AIX PS/2 does not supply statfs.  */
-
-int
-statfs (char *file, struct statfs *fsb)
-{
-  struct stat stats;
-  struct dustat fsd;
-
-  if (stat (file, &stats) != 0)
-    return -1;
-  if (dustat (stats.st_dev, 0, &fsd, sizeof (fsd)))
-    return -1;
-  fsb->f_type   = 0;
-  fsb->f_bsize  = fsd.du_bsize;
-  fsb->f_blocks = fsd.du_fsize - fsd.du_isize;
-  fsb->f_bfree  = fsd.du_tfree;
-  fsb->f_bavail = fsd.du_tfree;
-  fsb->f_files  = (fsd.du_isize - 2) * fsd.du_inopb;
-  fsb->f_ffree  = fsd.du_tinode;
-  fsb->f_fsid.val[0] = fsd.du_site;
-  fsb->f_fsid.val[1] = fsd.du_pckno;
-  return 0;
-}
-
-#endif /* _AIX && _I386 */
diff --git a/lib/fsusage.h b/lib/fsusage.h
index 65daa73..1d550bc 100644
--- a/lib/fsusage.h
+++ b/lib/fsusage.h
@@ -1,6 +1,6 @@
 /* fsusage.h -- declarations for file system space usage info
 
-   Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2018 Free Software
+   Copyright (C) 1991-1992, 1997, 2003-2006, 2009-2019 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/fsync.c b/lib/fsync.c
index ecacb0b..bfb6d28 100644
--- a/lib/fsync.c
+++ b/lib/fsync.c
@@ -7,7 +7,7 @@
 
    Written by Richard W.M. Jones <rjones.at.redhat.com>
 
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
diff --git a/lib/ftoastr.c b/lib/ftoastr.c
index a6899b2..55f1e02 100644
--- a/lib/ftoastr.c
+++ b/lib/ftoastr.c
@@ -1,6 +1,6 @@
 /* floating point to accurate string
 
-   Copyright (C) 2010-2018 Free Software Foundation, Inc.
+   Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -40,9 +40,7 @@
 # define FLOAT_PREC_BOUND _GL_LDBL_PREC_BOUND
 # define FTOASTR ldtoastr
 # define PROMOTED_FLOAT long double
-# if HAVE_C99_STRTOLD
-#  define STRTOF strtold
-# endif
+# define STRTOF strtold
 #elif LENGTH == 2
 # define FLOAT double
 # define FLOAT_DIG DBL_DIG
@@ -63,7 +61,7 @@
 # endif
 #endif
 
-/* On pre-C99 hosts, approximate strtof and strtold with strtod.  This
+/* On pre-C99 hosts, approximate strtof with strtod.  This
    may generate one or two extra digits, but that's better than not
    working at all.  */
 #ifndef STRTOF
diff --git a/lib/ftoastr.h b/lib/ftoastr.h
index 2d78358..752e3c4 100644
--- a/lib/ftoastr.h
+++ b/lib/ftoastr.h
@@ -1,6 +1,6 @@
 /* floating point to accurate string
 
-   Copyright (C) 2010-2018 Free Software Foundation, Inc.
+   Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/get-permissions.c b/lib/get-permissions.c
index 3b98451..99b4664 100644
--- a/lib/get-permissions.c
+++ b/lib/get-permissions.c
@@ -1,6 +1,6 @@
 /* Get permissions of a file.  -*- coding: utf-8 -*-
 
-   Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/getdtablesize.c b/lib/getdtablesize.c
index ac05bc4..03a9243 100644
--- a/lib/getdtablesize.c
+++ b/lib/getdtablesize.c
@@ -1,5 +1,5 @@
 /* getdtablesize() function: Return maximum possible file descriptor value + 1.
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
    Written by Bruno Haible <address@hidden>, 2008.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/getgroups.c b/lib/getgroups.c
index ec137c1..d8c77e9 100644
--- a/lib/getgroups.c
+++ b/lib/getgroups.c
@@ -1,6 +1,6 @@
 /* provide consistent interface to getgroups for systems that don't allow N==0
 
-   Copyright (C) 1996, 1999, 2003, 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1999, 2003, 2006-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -58,8 +58,8 @@ int posix_getgroups (int, gid_t []) __asm ("_getgroups");
 #  define getgroups posix_getgroups
 # endif
 
-/* On at least Ultrix 4.3 and NextStep 3.2, getgroups (0, NULL) always
-   fails.  On other systems, it returns the number of supplemental
+/* On at least NeXTstep 3.2, getgroups (0, NULL) always fails.
+   On other systems, it returns the number of supplemental
    groups for the process.  This function handles that special case
    and lets the system-provided function handle all others.  However,
    it can fail with ENOMEM if memory is tight.  It is unspecified
diff --git a/lib/getloadavg.c b/lib/getloadavg.c
index 578316e..08c14ef 100644
--- a/lib/getloadavg.c
+++ b/lib/getloadavg.c
@@ -1,6 +1,6 @@
 /* Get the system load averages.
 
-   Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2018 Free Software
+   Copyright (C) 1985-1989, 1991-1995, 1997, 1999-2000, 2003-2019 Free Software
    Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with gnulib.
@@ -47,29 +47,25 @@
    N_NAME_POINTER               The nlist n_name element is a pointer,
                                 not an array.
    HAVE_STRUCT_NLIST_N_UN_N_NAME 'n_un.n_name' is member of 'struct nlist'.
-   LINUX_LDAV_FILE              [__linux__, __CYGWIN__]: File containing
-                                load averages.
+   LINUX_LDAV_FILE              [__linux__, __ANDROID__, __CYGWIN__]: File
+                                containing load averages.
 
    Specific system predefines this file uses, aside from setting
    default values if not emacs:
 
    apollo
    BSD                          Real BSD, not just BSD-like.
-   convex
    DGUX
    eunice                       UNIX emulator under VMS.
    hpux
    __MSDOS__                    No-op for MSDOS.
    NeXT
    sgi
-   sequent                      Sequent Dynix 3.x.x (BSD)
-   _SEQUENT_                    Sequent DYNIX/ptx 1.x.x (SYSV)
-   sony_news                    NEWS-OS (works at least for 4.1C)
    UMAX
    UMAX4_3
    VMS
    _WIN32                       Native Windows (possibly also defined on 
Cygwin)
-   __linux__                    Linux: assumes /proc file system mounted.
+   __linux__, __ANDROID__       Linux: assumes /proc file system mounted.
                                 Support from Michael K. Johnson.
    __CYGWIN__                   Cygwin emulates linux /proc/loadavg.
    __NetBSD__                   NetBSD: assumes /kern file system mounted.
@@ -101,11 +97,6 @@
 #  define WINDOWS32
 # endif
 
-# if !defined (BSD) && defined (ultrix)
-/* Ultrix behaves like BSD on Vaxen.  */
-#  define BSD
-# endif
-
 # ifdef NeXT
 /* NeXT in the 2.{0,1,2} releases defines BSD in <sys/param.h>, which
    conflicts with the definition understood in this file, that this
@@ -145,10 +136,6 @@
 #  define MORE_BSD
 # endif
 
-# if defined (ultrix) && defined (mips)
-#  define decstation
-# endif
-
 # if defined (__SVR4) && !defined (SVR4)
 #  define SVR4
 # endif
@@ -172,13 +159,6 @@
 #  include <sys/table.h>
 # endif
 
-/* UTek's /bin/cc on the 4300 has no architecture specific cpp define by
-   default, but _MACH_IND_SYS_TYPES is defined in <sys/types.h>.  Combine
-   that with a couple of other things and we'll have a unique match.  */
-# if !defined (tek4300) && defined (unix) && defined (m68k) && defined 
(mc68000) && defined (mc68020) && defined (_MACH_IND_SYS_TYPES)
-#  define tek4300                       /* Define by emacs, but not by other 
users.  */
-# endif
-
 
 /* VAX C can't handle multi-line #ifs, or lines longer than 256 chars.  */
 # ifndef LOAD_AVE_TYPE
@@ -191,14 +171,6 @@
 #   define LOAD_AVE_TYPE long
 #  endif
 
-#  ifdef decstation
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  ifdef _SEQUENT_
-#   define LOAD_AVE_TYPE long
-#  endif
-
 #  ifdef sgi
 #   define LOAD_AVE_TYPE long
 #  endif
@@ -207,41 +179,14 @@
 #   define LOAD_AVE_TYPE long
 #  endif
 
-#  ifdef sony_news
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  ifdef sequent
-#   define LOAD_AVE_TYPE long
-#  endif
-
 #  ifdef OSF_ALPHA
 #   define LOAD_AVE_TYPE long
 #  endif
 
-#  if defined (ardent) && defined (titan)
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  ifdef tek4300
-#   define LOAD_AVE_TYPE long
-#  endif
-
-#  if defined (alliant) && defined (i860) /* Alliant FX/2800 */
-#   define LOAD_AVE_TYPE long
-#  endif
-
 #  if defined _AIX && ! defined HAVE_LIBPERFSTAT
 #   define LOAD_AVE_TYPE long
 #  endif
 
-#  ifdef convex
-#   define LOAD_AVE_TYPE double
-#   ifndef LDAV_CVT
-#    define LDAV_CVT(n) (n)
-#   endif
-#  endif
-
 # endif /* No LOAD_AVE_TYPE.  */
 
 # ifdef OSF_ALPHA
@@ -251,13 +196,6 @@
 #  define FSCALE 1024.0
 # endif
 
-# if defined (alliant) && defined (i860) /* Alliant FX/2800 */
-/* <sys/param.h> defines an incorrect value for FSCALE on an
-   Alliant FX/2800 Concentrix 2.2, according to address@hidden  */
-#  undef FSCALE
-#  define FSCALE 100.0
-# endif
-
 
 # ifndef FSCALE
 
@@ -267,25 +205,17 @@
 #   define FSCALE 2048.0
 #  endif
 
-#  if defined (MIPS) || defined (SVR4) || defined (decstation)
+#  if defined (MIPS) || defined (SVR4)
 #   define FSCALE 256
 #  endif
 
-#  if defined (sgi) || defined (sequent)
+#  if defined (sgi)
 /* Sometimes both MIPS and sgi are defined, so FSCALE was just defined
    above under #ifdef MIPS.  But we want the sgi value.  */
 #   undef FSCALE
 #   define FSCALE 1000.0
 #  endif
 
-#  if defined (ardent) && defined (titan)
-#   define FSCALE 65536.0
-#  endif
-
-#  ifdef tek4300
-#   define FSCALE 100.0
-#  endif
-
 #  if defined _AIX && !defined HAVE_LIBPERFSTAT
 #   define FSCALE 65536.0
 #  endif
@@ -307,24 +237,16 @@
 # endif
 
 
-# if !defined (KERNEL_FILE) && defined (sequent)
-#  define KERNEL_FILE "/dynix"
-# endif
-
 # if !defined (KERNEL_FILE) && defined (hpux)
 #  define KERNEL_FILE "/hp-ux"
 # endif
 
-# if !defined (KERNEL_FILE) && (defined (_SEQUENT_) || defined (MIPS) || 
defined (SVR4) || defined (ISC) || defined (sgi) || (defined (ardent) && 
defined (titan)))
+# if !defined (KERNEL_FILE) && (defined (MIPS) || defined (SVR4) || defined 
(ISC) || defined (sgi))
 #  define KERNEL_FILE "/unix"
 # endif
 
 
-# if !defined (LDAV_SYMBOL) && defined (alliant)
-#  define LDAV_SYMBOL "_Loadavg"
-# endif
-
-# if !defined (LDAV_SYMBOL) && ((defined (hpux) && !defined (hp9000s300)) || 
defined (_SEQUENT_) || defined (SVR4) || defined (ISC) || defined (sgi) || 
(defined (ardent) && defined (titan)) || (defined (_AIX) && 
!defined(HAVE_LIBPERFSTAT)))
+# if !defined (LDAV_SYMBOL) && (defined (hpux) || defined (SVR4) || defined 
(ISC) || defined (sgi) || (defined (_AIX) && !defined(HAVE_LIBPERFSTAT)))
 #  define LDAV_SYMBOL "avenrun"
 # endif
 
@@ -341,7 +263,7 @@
 # ifdef LOAD_AVE_TYPE
 
 #  ifndef __VMS
-#   ifndef __linux__
+#   if !(defined __linux__ || defined __ANDROID__)
 #    ifndef NLIST_STRUCT
 #     include <a.out.h>
 #    else /* NLIST_STRUCT */
@@ -364,7 +286,7 @@
 #    ifndef LDAV_SYMBOL
 #     define LDAV_SYMBOL "_avenrun"
 #    endif /* LDAV_SYMBOL */
-#   endif /* __linux__ */
+#   endif /* __linux__ || __ANDROID__ */
 
 #  else /* __VMS */
 
@@ -437,7 +359,8 @@
 #  include <sys/dg_sys_info.h>
 # endif
 
-# if (defined __linux__ || defined __CYGWIN__ || defined SUNOS_5        \
+# if (defined __linux__ || defined __ANDROID__ \
+      || defined __CYGWIN__ || defined SUNOS_5 \
       || (defined LOAD_AVE_TYPE && ! defined __VMS))
 #  include <fcntl.h>
 # endif
@@ -466,7 +389,7 @@ static bool getloadavg_initialized;
 /* Offset in kmem to seek to read load average, or 0 means invalid.  */
 static long offset;
 
-#  if ! defined __VMS && ! defined sgi && ! defined __linux__
+#  if ! defined __VMS && ! defined sgi && ! (defined __linux__ || defined 
__ANDROID__)
 static struct nlist name_list[2];
 #  endif
 
@@ -501,17 +424,17 @@ getloadavg (double loadavg[], int nelem)
   int saved_errno;
 
   kc = kstat_open ();
-  if (kc == 0)
+  if (kc == NULL)
     return -1;
   ksp = kstat_lookup (kc, "unix", 0, "system_misc");
-  if (ksp == 0)
+  if (ksp == NULL)
     return -1;
   if (kstat_read (kc, ksp, 0) == -1)
     return -1;
 
 
   kn = kstat_data_lookup (ksp, "avenrun_1min");
-  if (kn == 0)
+  if (kn == NULL)
     {
       /* Return -1 if no load average information is available.  */
       nelem = 0;
@@ -524,14 +447,14 @@ getloadavg (double loadavg[], int nelem)
   if (nelem >= 2)
     {
       kn = kstat_data_lookup (ksp, "avenrun_5min");
-      if (kn != 0)
+      if (kn != NULL)
         {
           loadavg[elem++] = (double) kn->value.ul / FSCALE;
 
           if (nelem >= 3)
             {
               kn = kstat_data_lookup (ksp, "avenrun_15min");
-              if (kn != 0)
+              if (kn != NULL)
                 loadavg[elem++] = (double) kn->value.ul / FSCALE;
             }
         }
@@ -576,8 +499,8 @@ getloadavg (double loadavg[], int nelem)
   }
 # endif
 
-# if !defined (LDAV_DONE) && (defined (__linux__) || defined (__CYGWIN__))
-                                              /* Linux without glibc, Cygwin */
+# if !defined (LDAV_DONE) && (defined __linux__ || defined __ANDROID__ || 
defined __CYGWIN__)
+                                      /* Linux without glibc, Android, Cygwin 
*/
 #  define LDAV_DONE
 #  undef LOAD_AVE_TYPE
 
@@ -632,7 +555,7 @@ getloadavg (double loadavg[], int nelem)
 
   return elem;
 
-# endif /* __linux__ || __CYGWIN__ */
+# endif /* __linux__ || __ANDROID__ || __CYGWIN__ */
 
 # if !defined (LDAV_DONE) && defined (__NetBSD__)          /* NetBSD < 0.9 */
 #  define LDAV_DONE
@@ -921,7 +844,7 @@ getloadavg (double loadavg[], int nelem)
 
 #   ifndef SUNOS_5
       if (
-#    if !(defined (_AIX) && !defined (ps2))
+#    if !defined (_AIX)
           nlist (KERNEL_FILE, name_list)
 #    else  /* _AIX */
           knlist (name_list, 1, sizeof (name_list[0]))
@@ -972,7 +895,7 @@ getloadavg (double loadavg[], int nelem)
       /* We pass 0 for the kernel, corefile, and swapfile names
          to use the currently running kernel.  */
       kd = kvm_open (0, 0, 0, O_RDONLY, 0);
-      if (kd != 0)
+      if (kd != NULL)
         {
           /* nlist the currently running kernel.  */
           kvm_nlist (kd, name_list);
diff --git a/lib/getopt-cdefs.in.h b/lib/getopt-cdefs.in.h
index 12b5a87..049145b 100644
--- a/lib/getopt-cdefs.in.h
+++ b/lib/getopt-cdefs.in.h
@@ -1,5 +1,5 @@
 /* getopt-on-non-glibc compatibility macros.
-   Copyright (C) 1989-2018 Free Software Foundation, Inc.
+   Copyright (C) 1989-2019 Free Software Foundation, Inc.
    This file is part of gnulib.
    Unlike most of the getopt implementation, it is NOT shared
    with the GNU C Library.
diff --git a/lib/getopt-core.h b/lib/getopt-core.h
index e51b6c7..6360ad6 100644
--- a/lib/getopt-core.h
+++ b/lib/getopt-core.h
@@ -1,5 +1,5 @@
 /* Declarations for getopt (basic, portable features only).
-   Copyright (C) 1989-2018 Free Software Foundation, Inc.
+   Copyright (C) 1989-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library and is also part of gnulib.
    Patches to this file should be submitted to both projects.
 
diff --git a/lib/getopt-ext.h b/lib/getopt-ext.h
index cb41206..13cb007 100644
--- a/lib/getopt-ext.h
+++ b/lib/getopt-ext.h
@@ -1,5 +1,5 @@
 /* Declarations for getopt (GNU extensions).
-   Copyright (C) 1989-2018 Free Software Foundation, Inc.
+   Copyright (C) 1989-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library and is also part of gnulib.
    Patches to this file should be submitted to both projects.
 
diff --git a/lib/getopt-pfx-core.h b/lib/getopt-pfx-core.h
index c62f9e2..8fac269 100644
--- a/lib/getopt-pfx-core.h
+++ b/lib/getopt-pfx-core.h
@@ -1,5 +1,5 @@
 /* getopt (basic, portable features) gnulib wrapper header.
-   Copyright (C) 1989-2018 Free Software Foundation, Inc.
+   Copyright (C) 1989-2019 Free Software Foundation, Inc.
    This file is part of gnulib.
    Unlike most of the getopt implementation, it is NOT shared
    with the GNU C Library.
diff --git a/lib/getopt-pfx-ext.h b/lib/getopt-pfx-ext.h
index 753f129..0e21aef 100644
--- a/lib/getopt-pfx-ext.h
+++ b/lib/getopt-pfx-ext.h
@@ -1,5 +1,5 @@
 /* getopt (GNU extensions) gnulib wrapper header.
-   Copyright (C) 1989-2018 Free Software Foundation, Inc.
+   Copyright (C) 1989-2019 Free Software Foundation, Inc.
    This file is part of gnulib.
    Unlike most of the getopt implementation, it is NOT shared
    with the GNU C Library.
diff --git a/lib/getopt.c b/lib/getopt.c
index 11e36ee..8ee075a 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -1,5 +1,5 @@
 /* Getopt for GNU.
-   Copyright (C) 1987-2018 Free Software Foundation, Inc.
+   Copyright (C) 1987-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library and is also part of gnulib.
    Patches to this file should be submitted to both projects.
 
diff --git a/lib/getopt.in.h b/lib/getopt.in.h
index 5fb58dd..c77f34c 100644
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -1,5 +1,5 @@
 /* Declarations for getopt.
-   Copyright (C) 1989-2018 Free Software Foundation, Inc.
+   Copyright (C) 1989-2019 Free Software Foundation, Inc.
    This file is part of gnulib.
    Unlike most of the getopt implementation, it is NOT shared
    with the GNU C Library, which supplies a different version of
diff --git a/lib/getopt1.c b/lib/getopt1.c
index 9c7fff4..883aa6b 100644
--- a/lib/getopt1.c
+++ b/lib/getopt1.c
@@ -1,5 +1,5 @@
 /* getopt_long and getopt_long_only entry points for GNU getopt.
-   Copyright (C) 1987-2018 Free Software Foundation, Inc.
+   Copyright (C) 1987-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library and is also part of gnulib.
    Patches to this file should be submitted to both projects.
 
diff --git a/lib/getopt_int.h b/lib/getopt_int.h
index b0e9a6d..e63706f 100644
--- a/lib/getopt_int.h
+++ b/lib/getopt_int.h
@@ -1,5 +1,5 @@
 /* Internal declarations for getopt.
-   Copyright (C) 1989-2018 Free Software Foundation, Inc.
+   Copyright (C) 1989-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library and is also part of gnulib.
    Patches to this file should be submitted to both projects.
 
diff --git a/lib/gettext.h b/lib/gettext.h
index f2d7458..c7c0fdb 100644
--- a/lib/gettext.h
+++ b/lib/gettext.h
@@ -1,5 +1,5 @@
 /* Convenience header for conditional use of GNU <libintl.h>.
-   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2018 Free Software
+   Copyright (C) 1995-1998, 2000-2002, 2004-2006, 2009-2019 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
@@ -184,9 +184,16 @@ npgettext_aux (const char *domain,
 
 #include <string.h>
 
-#if (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
-     /* || __STDC_VERSION__ == 199901L
-        || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ )
+/* GNULIB_NO_VLA can be defined to disable use of VLAs even if supported.
+   This relates to the -Wvla and -Wvla-larger-than warnings, enabled in
+   the default GCC many warnings set.  This allows programs to disable use
+   of VLAs, which may be unintended, or may be awkward to support portably,
+   or may have security implications due to non-deterministic stack usage.  */
+
+#if (!defined GNULIB_NO_VLA \
+     && (((__GNUC__ >= 3 || __GNUG__ >= 2) && !defined __STRICT_ANSI__) \
+     /*  || (__STDC_VERSION__ == 199901L && !defined __HP_cc)
+         || (__STDC_VERSION__ >= 201112L && !defined __STDC_NO_VLA__) */ ))
 # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 1
 #else
 # define _LIBGETTEXT_HAVE_VARIABLE_SIZE_ARRAYS 0
diff --git a/lib/gettime.c b/lib/gettime.c
index bb59c44..1fd153f 100644
--- a/lib/gettime.c
+++ b/lib/gettime.c
@@ -1,6 +1,6 @@
 /* gettime -- get the system clock
 
-   Copyright (C) 2002, 2004-2007, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004-2007, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c
index 1bd50fa..e728bf4 100644
--- a/lib/gettimeofday.c
+++ b/lib/gettimeofday.c
@@ -1,6 +1,6 @@
 /* Provide gettimeofday for systems that don't have it or for which it's 
broken.
 
-   Copyright (C) 2001-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2005-2007, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -72,10 +72,10 @@ gettimeofday (struct timeval *restrict tv, void *restrict 
tz)
 
   /* On native Windows, there are two ways to get the current time:
      GetSystemTimeAsFileTime
-     <https://msdn.microsoft.com/en-us/library/ms724397.aspx>
+     
<https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime>
      or
      GetSystemTimePreciseAsFileTime
-     <https://msdn.microsoft.com/en-us/library/hh706895.aspx>.
+     
<https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>.
      GetSystemTimeAsFileTime produces values that jump by increments of
      15.627 milliseconds (!) on average.
      Whereas GetSystemTimePreciseAsFileTime values usually jump by 1 or 2
@@ -92,7 +92,7 @@ gettimeofday (struct timeval *restrict tv, void *restrict tz)
     GetSystemTimeAsFileTime (&current_time);
 
   /* Convert from FILETIME to 'struct timeval'.  */
-  /* FILETIME: <https://msdn.microsoft.com/en-us/library/ms724284.aspx> */
+  /* FILETIME: 
<https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime>
 */
   ULONGLONG since_1601 =
     ((ULONGLONG) current_time.dwHighDateTime << 32)
     | (ULONGLONG) current_time.dwLowDateTime;
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 982d3c5..0d9a885 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -1,5 +1,5 @@
 ## DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2018 Free Software Foundation, Inc.
+# Copyright (C) 2002-2019 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -82,6 +82,7 @@
 #  crypto/sha512-buffer \
 #  d-type \
 #  diffseq \
+#  dosname \
 #  dtoastr \
 #  dtotimespec \
 #  dup2 \
@@ -91,7 +92,6 @@
 #  faccessat \
 #  fcntl \
 #  fcntl-h \
-#  fdatasync \
 #  fdopendir \
 #  filemode \
 #  filevercmp \
@@ -176,7 +176,6 @@ BUILD_DETAILS = @BUILD_DETAILS@
 BYTESWAP_H = @BYTESWAP_H@
 CAIRO_CFLAGS = @CAIRO_CFLAGS@
 CAIRO_LIBS = @CAIRO_LIBS@
-CANNOT_DUMP = @CANNOT_DUMP@
 CC = @CC@
 CFLAGS = @CFLAGS@
 CFLAGS_SOUND = @CFLAGS_SOUND@
@@ -197,6 +196,7 @@ DBUS_OBJ = @DBUS_OBJ@
 DEFS = @DEFS@
 DESLIB = @DESLIB@
 DOCMISC_W32 = @DOCMISC_W32@
+DUMPING = @DUMPING@
 ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
@@ -431,6 +431,7 @@ GNULIB_STRSTR = @GNULIB_STRSTR@
 GNULIB_STRTOD = @GNULIB_STRTOD@
 GNULIB_STRTOIMAX = @GNULIB_STRTOIMAX@
 GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_STRTOLD = @GNULIB_STRTOLD@
 GNULIB_STRTOLL = @GNULIB_STRTOLL@
 GNULIB_STRTOULL = @GNULIB_STRTOULL@
 GNULIB_STRTOUMAX = @GNULIB_STRTOUMAX@
@@ -478,6 +479,7 @@ GTK_CFLAGS = @GTK_CFLAGS@
 GTK_LIBS = @GTK_LIBS@
 GTK_OBJ = @GTK_OBJ@
 GZIP_PROG = @GZIP_PROG@
+HAVE_ALLOCA_H = @HAVE_ALLOCA_H@
 HAVE_ALPHASORT = @HAVE_ALPHASORT@
 HAVE_ATOLL = @HAVE_ATOLL@
 HAVE_C99_STDINT_H = @HAVE_C99_STDINT_H@
@@ -556,6 +558,7 @@ HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@
 HAVE_GRANTPT = @HAVE_GRANTPT@
 HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@
 HAVE_IMAXDIV_T = @HAVE_IMAXDIV_T@
+HAVE_INITSTATE = @HAVE_INITSTATE@
 HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
 HAVE_LCHMOD = @HAVE_LCHMOD@
 HAVE_LCHOWN = @HAVE_LCHOWN@
@@ -566,6 +569,7 @@ HAVE_LSTAT = @HAVE_LSTAT@
 HAVE_MAKEINFO = @HAVE_MAKEINFO@
 HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
 HAVE_MBSLEN = @HAVE_MBSLEN@
+HAVE_MBTOWC = @HAVE_MBTOWC@
 HAVE_MEMCHR = @HAVE_MEMCHR@
 HAVE_MEMPCPY = @HAVE_MEMPCPY@
 HAVE_MKDIRAT = @HAVE_MKDIRAT@
@@ -613,6 +617,7 @@ HAVE_SCANDIR = @HAVE_SCANDIR@
 HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@
 HAVE_SETENV = @HAVE_SETENV@
 HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@
+HAVE_SETSTATE = @HAVE_SETSTATE@
 HAVE_SIGACTION = @HAVE_SIGACTION@
 HAVE_SIGHANDLER_T = @HAVE_SIGHANDLER_T@
 HAVE_SIGINFO_T = @HAVE_SIGINFO_T@
@@ -630,6 +635,7 @@ HAVE_STRPBRK = @HAVE_STRPBRK@
 HAVE_STRPTIME = @HAVE_STRPTIME@
 HAVE_STRSEP = @HAVE_STRSEP@
 HAVE_STRTOD = @HAVE_STRTOD@
+HAVE_STRTOLD = @HAVE_STRTOLD@
 HAVE_STRTOLL = @HAVE_STRTOLL@
 HAVE_STRTOULL = @HAVE_STRTOULL@
 HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@
@@ -730,7 +736,6 @@ LIB_ACL = @LIB_ACL@
 LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
 LIB_EACCESS = @LIB_EACCESS@
 LIB_EXECINFO = @LIB_EXECINFO@
-LIB_FDATASYNC = @LIB_FDATASYNC@
 LIB_MATH = @LIB_MATH@
 LIB_PTHREAD = @LIB_PTHREAD@
 LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@
@@ -860,6 +865,7 @@ REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
 REPLACE_GETPASS = @REPLACE_GETPASS@
 REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
 REPLACE_GMTIME = @REPLACE_GMTIME@
+REPLACE_INITSTATE = @REPLACE_INITSTATE@
 REPLACE_ISATTY = @REPLACE_ISATTY@
 REPLACE_LCHOWN = @REPLACE_LCHOWN@
 REPLACE_LINK = @REPLACE_LINK@
@@ -895,6 +901,7 @@ REPLACE_PUTENV = @REPLACE_PUTENV@
 REPLACE_PWRITE = @REPLACE_PWRITE@
 REPLACE_QSORT_R = @REPLACE_QSORT_R@
 REPLACE_RAISE = @REPLACE_RAISE@
+REPLACE_RANDOM = @REPLACE_RANDOM@
 REPLACE_RANDOM_R = @REPLACE_RANDOM_R@
 REPLACE_READ = @REPLACE_READ@
 REPLACE_READLINK = @REPLACE_READLINK@
@@ -907,6 +914,7 @@ REPLACE_RENAMEAT = @REPLACE_RENAMEAT@
 REPLACE_RMDIR = @REPLACE_RMDIR@
 REPLACE_SELECT = @REPLACE_SELECT@
 REPLACE_SETENV = @REPLACE_SETENV@
+REPLACE_SETSTATE = @REPLACE_SETSTATE@
 REPLACE_SLEEP = @REPLACE_SLEEP@
 REPLACE_SNPRINTF = @REPLACE_SNPRINTF@
 REPLACE_SPRINTF = @REPLACE_SPRINTF@
@@ -928,6 +936,7 @@ REPLACE_STRSTR = @REPLACE_STRSTR@
 REPLACE_STRTOD = @REPLACE_STRTOD@
 REPLACE_STRTOIMAX = @REPLACE_STRTOIMAX@
 REPLACE_STRTOK_R = @REPLACE_STRTOK_R@
+REPLACE_STRTOLD = @REPLACE_STRTOLD@
 REPLACE_STRTOUMAX = @REPLACE_STRTOUMAX@
 REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@
 REPLACE_SYMLINK = @REPLACE_SYMLINK@
@@ -1010,6 +1019,7 @@ XMKMF = @XMKMF@
 XOBJ = @XOBJ@
 XRANDR_CFLAGS = @XRANDR_CFLAGS@
 XRANDR_LIBS = @XRANDR_LIBS@
+XRENDER_LIBS = @XRENDER_LIBS@
 XWIDGETS_OBJ = @XWIDGETS_OBJ@
 X_TOOLKIT_TYPE = @X_TOOLKIT_TYPE@
 ac_ct_CC = @ac_ct_CC@
@@ -1050,7 +1060,6 @@ gl_GNULIB_ENABLED_a9786850e999ae65a836a6041e8e5ed1 = 
@gl_GNULIB_ENABLED_a9786850
 gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36 = 
@gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36@
 gl_GNULIB_ENABLED_cloexec = @gl_GNULIB_ENABLED_cloexec@
 gl_GNULIB_ENABLED_dirfd = @gl_GNULIB_ENABLED_dirfd@
-gl_GNULIB_ENABLED_dosname = @gl_GNULIB_ENABLED_dosname@
 gl_GNULIB_ENABLED_euidaccess = @gl_GNULIB_ENABLED_euidaccess@
 gl_GNULIB_ENABLED_getdtablesize = @gl_GNULIB_ENABLED_getdtablesize@
 gl_GNULIB_ENABLED_getgroups = @gl_GNULIB_ENABLED_getgroups@
@@ -1141,7 +1150,7 @@ ifneq (,$(GL_GENERATE_ALLOCA_H))
 alloca.h: alloca.in.h $(top_builddir)/config.status
        $(AM_V_GEN)rm -f address@hidden $@ && \
        { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
-         cat $(srcdir)/alloca.in.h; \
+         sed -e 's|@''HAVE_ALLOCA_H''@|$(HAVE_ALLOCA_H)|g' < 
$(srcdir)/alloca.in.h; \
        } > address@hidden && \
        mv -f address@hidden $@
 else
@@ -1403,9 +1412,7 @@ endif
 ## begin gnulib module dosname
 ifeq (,$(OMIT_GNULIB_MODULE_dosname))
 
-ifneq (,$(gl_GNULIB_ENABLED_dosname))
 
-endif
 EXTRA_DIST += dosname.h
 
 endif
@@ -1588,17 +1595,6 @@ EXTRA_DIST += fcntl.in.h
 endif
 ## end   gnulib module fcntl-h
 
-## begin gnulib module fdatasync
-ifeq (,$(OMIT_GNULIB_MODULE_fdatasync))
-
-
-EXTRA_DIST += fdatasync.c
-
-EXTRA_libgnu_a_SOURCES += fdatasync.c
-
-endif
-## end   gnulib module fdatasync
-
 ## begin gnulib module fdopendir
 ifeq (,$(OMIT_GNULIB_MODULE_fdopendir))
 
@@ -2554,6 +2550,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e 's/@''GNULIB_SECURE_GETENV''@/$(GNULIB_SECURE_GETENV)/g' \
              -e 's/@''GNULIB_SETENV''@/$(GNULIB_SETENV)/g' \
              -e 's/@''GNULIB_STRTOD''@/$(GNULIB_STRTOD)/g' \
+             -e 's/@''GNULIB_STRTOLD''@/$(GNULIB_STRTOLD)/g' \
              -e 's/@''GNULIB_STRTOLL''@/$(GNULIB_STRTOLL)/g' \
              -e 's/@''GNULIB_STRTOULL''@/$(GNULIB_STRTOULL)/g' \
              -e 's/@''GNULIB_SYSTEM_POSIX''@/$(GNULIB_SYSTEM_POSIX)/g' \
@@ -2567,7 +2564,9 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \
              -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \
              -e 's|@''HAVE_GRANTPT''@|$(HAVE_GRANTPT)|g' \
+             -e 's|@''HAVE_INITSTATE''@|$(HAVE_INITSTATE)|g' \
              -e 's|@''HAVE_DECL_INITSTATE''@|$(HAVE_DECL_INITSTATE)|g' \
+             -e 's|@''HAVE_MBTOWC''@|$(HAVE_MBTOWC)|g' \
              -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \
              -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \
              -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \
@@ -2585,8 +2584,10 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \
              -e 's|@''HAVE_SECURE_GETENV''@|$(HAVE_SECURE_GETENV)|g' \
              -e 's|@''HAVE_DECL_SETENV''@|$(HAVE_DECL_SETENV)|g' \
+             -e 's|@''HAVE_SETSTATE''@|$(HAVE_SETSTATE)|g' \
              -e 's|@''HAVE_DECL_SETSTATE''@|$(HAVE_DECL_SETSTATE)|g' \
              -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \
+             -e 's|@''HAVE_STRTOLD''@|$(HAVE_STRTOLD)|g' \
              -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \
              -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \
              -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' 
\
@@ -2595,6 +2596,7 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e 's|@''HAVE_DECL_UNSETENV''@|$(HAVE_DECL_UNSETENV)|g' \
              -e 's|@''REPLACE_CALLOC''@|$(REPLACE_CALLOC)|g' \
              -e 
's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \
+             -e 's|@''REPLACE_INITSTATE''@|$(REPLACE_INITSTATE)|g' \
              -e 's|@''REPLACE_MALLOC''@|$(REPLACE_MALLOC)|g' \
              -e 's|@''REPLACE_MBTOWC''@|$(REPLACE_MBTOWC)|g' \
              -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \
@@ -2602,11 +2604,14 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) \
              -e 's|@''REPLACE_PTSNAME_R''@|$(REPLACE_PTSNAME_R)|g' \
              -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \
              -e 's|@''REPLACE_QSORT_R''@|$(REPLACE_QSORT_R)|g' \
+             -e 's|@''REPLACE_RANDOM''@|$(REPLACE_RANDOM)|g' \
              -e 's|@''REPLACE_RANDOM_R''@|$(REPLACE_RANDOM_R)|g' \
              -e 's|@''REPLACE_REALLOC''@|$(REPLACE_REALLOC)|g' \
              -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \
              -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \
+             -e 's|@''REPLACE_SETSTATE''@|$(REPLACE_SETSTATE)|g' \
              -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \
+             -e 's|@''REPLACE_STRTOLD''@|$(REPLACE_STRTOLD)|g' \
              -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \
              -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \
              -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \
diff --git a/lib/group-member.c b/lib/group-member.c
index 3747dfe..ad61cf0 100644
--- a/lib/group-member.c
+++ b/lib/group-member.c
@@ -1,6 +1,6 @@
 /* group-member.c -- determine whether group id is in calling user's group list
 
-   Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2018 Free Software
+   Copyright (C) 1994, 1997-1998, 2003, 2005-2006, 2009-2019 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/ieee754.in.h b/lib/ieee754.in.h
index 316ac03..a079e59 100644
--- a/lib/ieee754.in.h
+++ b/lib/ieee754.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/ignore-value.h b/lib/ignore-value.h
index 95eac1c..7e3b4c1 100644
--- a/lib/ignore-value.h
+++ b/lib/ignore-value.h
@@ -1,6 +1,6 @@
 /* ignore a function return without a compiler warning.  -*- coding: utf-8 -*-
 
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/intprops.h b/lib/intprops.h
index cdaf658..1a44ae5 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -1,6 +1,6 @@
 /* intprops.h -- properties of integer types
 
-   Copyright (C) 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published
diff --git a/lib/inttypes.in.h b/lib/inttypes.in.h
index c7d7968..d3c735c 100644
--- a/lib/inttypes.in.h
+++ b/lib/inttypes.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2006-2019 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Derek Price.
    This file is part of gnulib.
 
diff --git a/lib/libc-config.h b/lib/libc-config.h
index d7b4093..57c6966 100644
--- a/lib/libc-config.h
+++ b/lib/libc-config.h
@@ -1,6 +1,6 @@
 /* System definitions for code taken from the GNU C Library
 
-   Copyright 2017-2018 Free Software Foundation, Inc.
+   Copyright 2017-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
diff --git a/lib/limits.in.h b/lib/limits.in.h
index 89d7195..39750b3 100644
--- a/lib/limits.in.h
+++ b/lib/limits.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <limits.h>.
 
-   Copyright 2016-2018 Free Software Foundation, Inc.
+   Copyright 2016-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
diff --git a/lib/localtime-buffer.c b/lib/localtime-buffer.c
index df11f43..b65ea45 100644
--- a/lib/localtime-buffer.c
+++ b/lib/localtime-buffer.c
@@ -1,6 +1,6 @@
 /* Provide access to the last buffer returned by localtime() or gmtime().
 
-   Copyright (C) 2001-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2005-2007, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -34,6 +34,7 @@ struct tm *localtime_buffer_addr = &tm_zero_buffer;
 
 struct tm *
 rpl_localtime (time_t const *timep)
+#undef localtime
 {
   struct tm *tm = localtime (timep);
 
@@ -46,6 +47,7 @@ rpl_localtime (time_t const *timep)
 /* Same as above, since gmtime and localtime use the same buffer.  */
 struct tm *
 rpl_gmtime (time_t const *timep)
+#undef gmtime
 {
   struct tm *tm = gmtime (timep);
 
diff --git a/lib/localtime-buffer.h b/lib/localtime-buffer.h
index f381ff0..031111a 100644
--- a/lib/localtime-buffer.h
+++ b/lib/localtime-buffer.h
@@ -1,6 +1,6 @@
 /* Provide access to the last buffer returned by localtime() or gmtime().
 
-   Copyright (C) 2001-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2003, 2005-2007, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/lstat.c b/lib/lstat.c
index 5873bbd..a3e40d8 100644
--- a/lib/lstat.c
+++ b/lib/lstat.c
@@ -1,6 +1,6 @@
 /* Work around a bug of lstat on some systems
 
-   Copyright (C) 1997-2006, 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 1997-2006, 2008-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -42,10 +42,14 @@ orig_lstat (const char *filename, struct stat *buf)
 }
 
 /* Specification.  */
+# ifdef __osf__
 /* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
    eliminates this include because of the preliminary #include <sys/stat.h>
    above.  */
-# include "sys/stat.h"
+#  include "sys/stat.h"
+# else
+#  include <sys/stat.h>
+# endif
 
 # include "stat-time.h"
 
diff --git a/lib/md5.c b/lib/md5.c
index 554d421..5c8bcf9 100644
--- a/lib/md5.c
+++ b/lib/md5.c
@@ -1,6 +1,6 @@
 /* Functions to compute MD5 message digest of files or memory blocks.
    according to the definition of MD5 in RFC 1321 from April 1992.
-   Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2018 Free Software
+   Copyright (C) 1995-1997, 1999-2001, 2005-2006, 2008-2019 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
diff --git a/lib/md5.h b/lib/md5.h
index db031aa..478a27b 100644
--- a/lib/md5.h
+++ b/lib/md5.h
@@ -1,6 +1,6 @@
 /* Declaration of functions and data types used for MD5 sum computing
    library functions.
-   Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2018 Free Software
+   Copyright (C) 1995-1997, 1999-2001, 2004-2006, 2008-2019 Free Software
    Foundation, Inc.
    This file is part of the GNU C Library.
 
diff --git a/lib/memrchr.c b/lib/memrchr.c
index 99acfd9..9602283 100644
--- a/lib/memrchr.c
+++ b/lib/memrchr.c
@@ -1,6 +1,6 @@
 /* memrchr -- find the last occurrence of a byte in a memory block
 
-   Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2018 Free Software
+   Copyright (C) 1991, 1993, 1996-1997, 1999-2000, 2003-2019 Free Software
    Foundation, Inc.
 
    Based on strlen implementation by Torbjorn Granlund (address@hidden),
@@ -68,7 +68,7 @@ __memrchr (void const *s, int c_in, size_t n)
     if (*--char_ptr == c)
       return (void *) char_ptr;
 
-  longword_ptr = (const longword *) char_ptr;
+  longword_ptr = (const void *) char_ptr;
 
   /* All these elucidatory comments refer to 4-byte longwords,
      but the theory applies equally well to any size longwords.  */
diff --git a/lib/minmax.h b/lib/minmax.h
index 33a5305..d7f6bea 100644
--- a/lib/minmax.h
+++ b/lib/minmax.h
@@ -1,5 +1,5 @@
 /* MIN, MAX macros.
-   Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2018 Free Software
+   Copyright (C) 1995, 1998, 2001, 2003, 2005, 2009-2019 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/lib/mkostemp.c b/lib/mkostemp.c
index df9ecf8..bbfe9db 100644
--- a/lib/mkostemp.c
+++ b/lib/mkostemp.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2018 Free Software
+/* Copyright (C) 1998-1999, 2001, 2005-2007, 2009-2019 Free Software
    Foundation, Inc.
    This file is derived from the one in the GNU C Library.
 
diff --git a/lib/mktime-internal.h b/lib/mktime-internal.h
index 31cf3a4..d13d89c 100644
--- a/lib/mktime-internal.h
+++ b/lib/mktime-internal.h
@@ -1,6 +1,6 @@
 /* mktime variant that also uses an offset guess
 
-   Copyright 2016-2018 Free Software Foundation, Inc.
+   Copyright 2016-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public
diff --git a/lib/mktime.c b/lib/mktime.c
index 557712f..e3783d7 100644
--- a/lib/mktime.c
+++ b/lib/mktime.c
@@ -1,5 +1,5 @@
 /* Convert a 'struct tm' to a time_t value.
-   Copyright (C) 1993-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Paul Eggert <address@hidden>.
 
@@ -17,12 +17,6 @@
    License along with the GNU C Library; if not, see
    <https://www.gnu.org/licenses/>.  */
 
-/* Define this to 1 to have a standalone program to test this implementation of
-   mktime.  */
-#ifndef DEBUG_MKTIME
-# define DEBUG_MKTIME 0
-#endif
-
 /* The following macros influence what gets defined when this file is compiled:
 
    Macro/expression            Which gnulib module    This compilation unit
@@ -34,12 +28,10 @@
    || NEED_MKTIME_WINDOWS
 
    NEED_MKTIME_INTERNAL        mktime-internal        mktime_internal
-
-   DEBUG_MKTIME                (defined manually)     my_mktime, main
  */
 
-#if !defined _LIBC && !DEBUG_MKTIME
-# include <config.h>
+#ifndef _LIBC
+# include <libc-config.h>
 #endif
 
 /* Assume that leap seconds are possible, unless told otherwise.
@@ -51,6 +43,7 @@
 
 #include <time.h>
 
+#include <errno.h>
 #include <limits.h>
 #include <stdbool.h>
 #include <stdlib.h>
@@ -59,13 +52,6 @@
 #include <intprops.h>
 #include <verify.h>
 
-#if DEBUG_MKTIME
-# include <stdio.h>
-/* Make it work even if the system's libc has its own mktime routine.  */
-# undef mktime
-# define mktime my_mktime
-#endif /* DEBUG_MKTIME */
-
 #ifndef NEED_MKTIME_INTERNAL
 # define NEED_MKTIME_INTERNAL 0
 #endif
@@ -73,7 +59,7 @@
 # define NEED_MKTIME_WINDOWS 0
 #endif
 #ifndef NEED_MKTIME_WORKING
-# define NEED_MKTIME_WORKING DEBUG_MKTIME
+# define NEED_MKTIME_WORKING 0
 #endif
 
 #include "mktime-internal.h"
@@ -86,7 +72,7 @@ my_tzset (void)
   /* Rectify the value of the environment variable TZ.
      There are four possible kinds of such values:
        - Traditional US time zone names, e.g. "PST8PDT".  Syntax: see
-         <https://msdn.microsoft.com/en-us/library/90s5c885.aspx>
+         
<https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tzset>
        - Time zone names based on geography, that contain one or more
          slashes, e.g. "Europe/Moscow".
        - Time zone names based on geography, without slashes, e.g.
@@ -119,11 +105,12 @@ my_tzset (void)
 #if defined _LIBC || NEED_MKTIME_WORKING || NEED_MKTIME_INTERNAL
 
 /* A signed type that can represent an integer number of years
-   multiplied by three times the number of seconds in a year.  It is
+   multiplied by four times the number of seconds in a year.  It is
    needed when converting a tm_year value times the number of seconds
-   in a year.  The factor of three comes because these products need
+   in a year.  The factor of four comes because these products need
    to be subtracted from each other, and sometimes with an offset
-   added to them, without worrying about overflow.
+   added to them, and then with another timestamp added, without
+   worrying about overflow.
 
    Much of the code uses long_int to represent time_t values, to
    lessen the hassle of dealing with platforms where time_t is
@@ -131,12 +118,12 @@ my_tzset (void)
    time_t values that mktime can generate even on platforms where
    time_t is excessively wide.  */
 
-#if INT_MAX <= LONG_MAX / 3 / 366 / 24 / 60 / 60
+#if INT_MAX <= LONG_MAX / 4 / 366 / 24 / 60 / 60
 typedef long int long_int;
 #else
 typedef long long int long_int;
 #endif
-verify (INT_MAX <= TYPE_MAXIMUM (long_int) / 3 / 366 / 24 / 60 / 60);
+verify (INT_MAX <= TYPE_MAXIMUM (long_int) / 4 / 366 / 24 / 60 / 60);
 
 /* Shift A right by B bits portably, by dividing A by 2**B and
    truncating towards minus infinity.  B should be in the range 0 <= B
@@ -210,9 +197,10 @@ isdst_differ (int a, int b)
    were not adjusted between the timestamps.
 
    The YEAR values uses the same numbering as TP->tm_year.  Values
-   need not be in the usual range.  However, YEAR1 must not overflow
-   when multiplied by three times the number of seconds in a year, and
-   likewise for YDAY1 and three times the number of seconds in a day.  */
+   need not be in the usual range.  However, YEAR1 - YEAR0 must not
+   overflow even when multiplied by three times the number of seconds
+   in a year, and likewise for YDAY1 - YDAY0 and three times the
+   number of seconds in a day.  */
 
 static long_int
 ydhms_diff (long_int year1, long_int yday1, int hour1, int min1, int sec1,
@@ -247,43 +235,25 @@ long_int_avg (long_int a, long_int b)
   return shr (a, 1) + shr (b, 1) + ((a | b) & 1);
 }
 
-/* Return a time_t value corresponding to (YEAR-YDAY HOUR:MIN:SEC),
-   assuming that T corresponds to *TP and that no clock adjustments
-   occurred between *TP and the desired time.
-   Although T and the returned value are of type long_int,
-   they represent time_t values and must be in time_t range.
-   If TP is null, return a value not equal to T; this avoids false matches.
+/* Return a long_int value corresponding to (YEAR-YDAY HOUR:MIN:SEC)
+   minus *TP seconds, assuming no clock adjustments occurred between
+   the two timestamps.
+
    YEAR and YDAY must not be so large that multiplying them by three times the
    number of seconds in a year (or day, respectively) would overflow long_int.
-   If the returned value would be out of range, yield the minimal or
-   maximal in-range value, except do not yield a value equal to T.  */
+   *TP should be in the usual range.  */
 static long_int
-guess_time_tm (long_int year, long_int yday, int hour, int min, int sec,
-              long_int t, const struct tm *tp)
+tm_diff (long_int year, long_int yday, int hour, int min, int sec,
+        struct tm const *tp)
 {
-  if (tp)
-    {
-      long_int result;
-      long_int d = ydhms_diff (year, yday, hour, min, sec,
-                              tp->tm_year, tp->tm_yday,
-                              tp->tm_hour, tp->tm_min, tp->tm_sec);
-      if (! INT_ADD_WRAPV (t, d, &result))
-       return result;
-    }
-
-  /* Overflow occurred one way or another.  Return the nearest result
-     that is actually in range, except don't report a zero difference
-     if the actual difference is nonzero, as that would cause a false
-     match; and don't oscillate between two values, as that would
-     confuse the spring-forward gap detector.  */
-  return (t < long_int_avg (mktime_min, mktime_max)
-         ? (t <= mktime_min + 1 ? t + 1 : mktime_min)
-         : (mktime_max - 1 <= t ? t - 1 : mktime_max));
+  return ydhms_diff (year, yday, hour, min, sec,
+                    tp->tm_year, tp->tm_yday,
+                    tp->tm_hour, tp->tm_min, tp->tm_sec);
 }
 
 /* Use CONVERT to convert T to a struct tm value in *TM.  T must be in
-   range for time_t.  Return TM if successful, NULL if T is out of
-   range for CONVERT.  */
+   range for time_t.  Return TM if successful, NULL (setting errno) on
+   failure.  */
 static struct tm *
 convert_time (struct tm *(*convert) (const time_t *, struct tm *),
              long_int t, struct tm *tm)
@@ -295,47 +265,48 @@ convert_time (struct tm *(*convert) (const time_t *, 
struct tm *),
 /* Use CONVERT to convert *T to a broken down time in *TP.
    If *T is out of range for conversion, adjust it so that
    it is the nearest in-range value and then convert that.
-   A value is in range if it fits in both time_t and long_int.  */
+   A value is in range if it fits in both time_t and long_int.
+   Return TP on success, NULL (setting errno) on failure.  */
 static struct tm *
 ranged_convert (struct tm *(*convert) (const time_t *, struct tm *),
                long_int *t, struct tm *tp)
 {
-  struct tm *r;
-  if (*t < mktime_min)
-    *t = mktime_min;
-  else if (mktime_max < *t)
-    *t = mktime_max;
-  r = convert_time (convert, *t, tp);
-
-  if (!r && *t)
+  long_int t1 = (*t < mktime_min ? mktime_min
+                : *t <= mktime_max ? *t : mktime_max);
+  struct tm *r = convert_time (convert, t1, tp);
+  if (r)
     {
-      long_int bad = *t;
-      long_int ok = 0;
+      *t = t1;
+      return r;
+    }
+  if (errno != EOVERFLOW)
+    return NULL;
 
-      /* BAD is a known unconvertible value, and OK is a known good one.
-        Use binary search to narrow the range between BAD and OK until
-        they differ by 1.  */
-      while (true)
-       {
-         long_int mid = long_int_avg (ok, bad);
-         if (mid != ok && mid != bad)
-           break;
-         r = convert_time (convert, mid, tp);
-         if (r)
-           ok = mid;
-         else
-           bad = mid;
-       }
+  long_int bad = t1;
+  long_int ok = 0;
+  struct tm oktm; oktm.tm_sec = -1;
 
-      if (!r && ok)
-       {
-         /* The last conversion attempt failed;
-            revert to the most recent successful attempt.  */
-         r = convert_time (convert, ok, tp);
-       }
+  /* BAD is a known out-of-range value, and OK is a known in-range one.
+     Use binary search to narrow the range between BAD and OK until
+     they differ by 1.  */
+  while (true)
+    {
+      long_int mid = long_int_avg (ok, bad);
+      if (mid == ok || mid == bad)
+       break;
+      if (convert_time (convert, mid, tp))
+       ok = mid, oktm = *tp;
+      else if (errno != EOVERFLOW)
+       return NULL;
+      else
+       bad = mid;
     }
 
-  return r;
+  if (oktm.tm_sec < 0)
+    return NULL;
+  *t = ok;
+  *tp = oktm;
+  return tp;
 }
 
 
@@ -344,13 +315,14 @@ ranged_convert (struct tm *(*convert) (const time_t *, 
struct tm *),
    Use *OFFSET to keep track of a guess at the offset of the result,
    compared to what the result would be for UTC without leap seconds.
    If *OFFSET's guess is correct, only one CONVERT call is needed.
+   If successful, set *TP to the canonicalized struct tm;
+   otherwise leave *TP alone, return ((time_t) -1) and set errno.
    This function is external because it is used also by timegm.c.  */
 time_t
 __mktime_internal (struct tm *tp,
                   struct tm *(*convert) (const time_t *, struct tm *),
                   mktime_offset_t *offset)
 {
-  long_int t, gt, t0, t1, t2, dt;
   struct tm tm;
 
   /* The maximum number of probes (calls to CONVERT) should be enough
@@ -370,7 +342,7 @@ __mktime_internal (struct tm *tp,
   int isdst = tp->tm_isdst;
 
   /* 1 if the previous probe was DST.  */
-  int dst2;
+  int dst2 = 0;
 
   /* Ensure that mon is in range, and set year accordingly.  */
   int mon_remainder = mon % 12;
@@ -398,7 +370,7 @@ __mktime_internal (struct tm *tp,
   if (LEAP_SECONDS_POSSIBLE)
     {
       /* Handle out-of-range seconds specially,
-        since ydhms_tm_diff assumes every minute has 60 seconds.  */
+        since ydhms_diff assumes every minute has 60 seconds.  */
       if (sec < 0)
        sec = 0;
       if (59 < sec)
@@ -409,33 +381,46 @@ __mktime_internal (struct tm *tp,
      time.  */
 
   INT_SUBTRACT_WRAPV (0, off, &negative_offset_guess);
-  t0 = ydhms_diff (year, yday, hour, min, sec,
-                  EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0, negative_offset_guess);
+  long_int t0 = ydhms_diff (year, yday, hour, min, sec,
+                           EPOCH_YEAR - TM_YEAR_BASE, 0, 0, 0,
+                           negative_offset_guess);
+  long_int t = t0, t1 = t0, t2 = t0;
 
   /* Repeatedly use the error to improve the guess.  */
 
-  for (t = t1 = t2 = t0, dst2 = 0;
-       (gt = guess_time_tm (year, yday, hour, min, sec, t,
-                           ranged_convert (convert, &t, &tm)),
-       t != gt);
-       t1 = t2, t2 = t, t = gt, dst2 = tm.tm_isdst != 0)
-    if (t == t1 && t != t2
-       && (tm.tm_isdst < 0
-           || (isdst < 0
-               ? dst2 <= (tm.tm_isdst != 0)
-               : (isdst != 0) != (tm.tm_isdst != 0))))
-      /* We can't possibly find a match, as we are oscillating
-        between two values.  The requested time probably falls
-        within a spring-forward gap of size GT - T.  Follow the common
-        practice in this case, which is to return a time that is GT - T
-        away from the requested time, preferring a time whose
-        tm_isdst differs from the requested value.  (If no tm_isdst
-        was requested and only one of the two values has a nonzero
-        tm_isdst, prefer that value.)  In practice, this is more
-        useful than returning -1.  */
-      goto offset_found;
-    else if (--remaining_probes == 0)
-      return -1;
+  while (true)
+    {
+      if (! ranged_convert (convert, &t, &tm))
+       return -1;
+      long_int dt = tm_diff (year, yday, hour, min, sec, &tm);
+      if (dt == 0)
+       break;
+
+      if (t == t1 && t != t2
+         && (tm.tm_isdst < 0
+             || (isdst < 0
+                 ? dst2 <= (tm.tm_isdst != 0)
+                 : (isdst != 0) != (tm.tm_isdst != 0))))
+       /* We can't possibly find a match, as we are oscillating
+          between two values.  The requested time probably falls
+          within a spring-forward gap of size DT.  Follow the common
+          practice in this case, which is to return a time that is DT
+          away from the requested time, preferring a time whose
+          tm_isdst differs from the requested value.  (If no tm_isdst
+          was requested and only one of the two values has a nonzero
+          tm_isdst, prefer that value.)  In practice, this is more
+          useful than returning -1.  */
+       goto offset_found;
+
+      remaining_probes--;
+      if (remaining_probes == 0)
+       {
+         __set_errno (EOVERFLOW);
+         return -1;
+       }
+
+      t1 = t2, t2 = t, t += dt, dst2 = tm.tm_isdst != 0;
+    }
 
   /* We have a match.  Check whether tm.tm_isdst has the requested
      value, if any.  */
@@ -477,25 +462,38 @@ __mktime_internal (struct tm *tp,
            if (! INT_ADD_WRAPV (t, delta * direction, &ot))
              {
                struct tm otm;
-               ranged_convert (convert, &ot, &otm);
+               if (! ranged_convert (convert, &ot, &otm))
+                 return -1;
                if (! isdst_differ (isdst, otm.tm_isdst))
                  {
                    /* We found the desired tm_isdst.
                       Extrapolate back to the desired time.  */
-                   t = guess_time_tm (year, yday, hour, min, sec, ot, &otm);
-                   ranged_convert (convert, &t, &tm);
-                   goto offset_found;
+                   long_int gt = ot + tm_diff (year, yday, hour, min, sec,
+                                               &otm);
+                   if (mktime_min <= gt && gt <= mktime_max)
+                     {
+                       if (convert_time (convert, gt, &tm))
+                         {
+                           t = gt;
+                           goto offset_found;
+                         }
+                       if (errno != EOVERFLOW)
+                         return -1;
+                     }
                  }
              }
          }
+
+      __set_errno (EOVERFLOW);
+      return -1;
     }
 
  offset_found:
   /* Set *OFFSET to the low-order bits of T - T0 - NEGATIVE_OFFSET_GUESS.
      This is just a heuristic to speed up the next mktime call, and
      correctness is unaffected if integer overflow occurs here.  */
-  INT_SUBTRACT_WRAPV (t, t0, &dt);
-  INT_SUBTRACT_WRAPV (dt, negative_offset_guess, offset);
+  INT_SUBTRACT_WRAPV (t, t0, offset);
+  INT_SUBTRACT_WRAPV (*offset, negative_offset_guess, offset);
 
   if (LEAP_SECONDS_POSSIBLE && sec_requested != tm.tm_sec)
     {
@@ -505,8 +503,12 @@ __mktime_internal (struct tm *tp,
       sec_adjustment -= sec;
       sec_adjustment += sec_requested;
       if (INT_ADD_WRAPV (t, sec_adjustment, &t)
-         || ! (mktime_min <= t && t <= mktime_max)
-         || ! convert_time (convert, t, &tm))
+         || ! (mktime_min <= t && t <= mktime_max))
+       {
+         __set_errno (EOVERFLOW);
+         return -1;
+       }
+      if (! convert_time (convert, t, &tm))
        return -1;
     }
 
@@ -545,146 +547,3 @@ weak_alias (mktime, timelocal)
 libc_hidden_def (mktime)
 libc_hidden_weak (timelocal)
 #endif
-
-#if DEBUG_MKTIME
-
-static int
-not_equal_tm (const struct tm *a, const struct tm *b)
-{
-  return ((a->tm_sec ^ b->tm_sec)
-         | (a->tm_min ^ b->tm_min)
-         | (a->tm_hour ^ b->tm_hour)
-         | (a->tm_mday ^ b->tm_mday)
-         | (a->tm_mon ^ b->tm_mon)
-         | (a->tm_year ^ b->tm_year)
-         | (a->tm_yday ^ b->tm_yday)
-         | isdst_differ (a->tm_isdst, b->tm_isdst));
-}
-
-static void
-print_tm (const struct tm *tp)
-{
-  if (tp)
-    printf ("%04d-%02d-%02d %02d:%02d:%02d yday %03d wday %d isdst %d",
-           tp->tm_year + TM_YEAR_BASE, tp->tm_mon + 1, tp->tm_mday,
-           tp->tm_hour, tp->tm_min, tp->tm_sec,
-           tp->tm_yday, tp->tm_wday, tp->tm_isdst);
-  else
-    printf ("0");
-}
-
-static int
-check_result (time_t tk, struct tm tmk, time_t tl, const struct tm *lt)
-{
-  if (tk != tl || !lt || not_equal_tm (&tmk, lt))
-    {
-      printf ("mktime (");
-      print_tm (lt);
-      printf (")\nyields (");
-      print_tm (&tmk);
-      printf (") == %ld, should be %ld\n", (long int) tk, (long int) tl);
-      return 1;
-    }
-
-  return 0;
-}
-
-int
-main (int argc, char **argv)
-{
-  int status = 0;
-  struct tm tm, tmk, tml;
-  struct tm *lt;
-  time_t tk, tl, tl1;
-  char trailer;
-
-  /* Sanity check, plus call tzset.  */
-  tl = 0;
-  if (! localtime (&tl))
-    {
-      printf ("localtime (0) fails\n");
-      status = 1;
-    }
-
-  if ((argc == 3 || argc == 4)
-      && (sscanf (argv[1], "%d-%d-%d%c",
-                 &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &trailer)
-         == 3)
-      && (sscanf (argv[2], "%d:%d:%d%c",
-                 &tm.tm_hour, &tm.tm_min, &tm.tm_sec, &trailer)
-         == 3))
-    {
-      tm.tm_year -= TM_YEAR_BASE;
-      tm.tm_mon--;
-      tm.tm_isdst = argc == 3 ? -1 : atoi (argv[3]);
-      tmk = tm;
-      tl = mktime (&tmk);
-      lt = localtime_r (&tl, &tml);
-      printf ("mktime returns %ld == ", (long int) tl);
-      print_tm (&tmk);
-      printf ("\n");
-      status = check_result (tl, tmk, tl, lt);
-    }
-  else if (argc == 4 || (argc == 5 && strcmp (argv[4], "-") == 0))
-    {
-      time_t from = atol (argv[1]);
-      time_t by = atol (argv[2]);
-      time_t to = atol (argv[3]);
-
-      if (argc == 4)
-       for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
-         {
-           lt = localtime_r (&tl, &tml);
-           if (lt)
-             {
-               tmk = tml;
-               tk = mktime (&tmk);
-               status |= check_result (tk, tmk, tl, &tml);
-             }
-           else
-             {
-               printf ("localtime_r (%ld) yields 0\n", (long int) tl);
-               status = 1;
-             }
-           tl1 = tl + by;
-           if ((tl1 < tl) != (by < 0))
-             break;
-         }
-      else
-       for (tl = from; by < 0 ? to <= tl : tl <= to; tl = tl1)
-         {
-           /* Null benchmark.  */
-           lt = localtime_r (&tl, &tml);
-           if (lt)
-             {
-               tmk = tml;
-               tk = tl;
-               status |= check_result (tk, tmk, tl, &tml);
-             }
-           else
-             {
-               printf ("localtime_r (%ld) yields 0\n", (long int) tl);
-               status = 1;
-             }
-           tl1 = tl + by;
-           if ((tl1 < tl) != (by < 0))
-             break;
-         }
-    }
-  else
-    printf ("Usage:\
-\t%s YYYY-MM-DD HH:MM:SS [ISDST] # Test given time.\n\
-\t%s FROM BY TO # Test values FROM, FROM+BY, ..., TO.\n\
-\t%s FROM BY TO - # Do not test those values (for benchmark).\n",
-           argv[0], argv[0], argv[0]);
-
-  return status;
-}
-
-#endif /* DEBUG_MKTIME */
-
-/*
-Local Variables:
-compile-command: "gcc -DDEBUG_MKTIME -I. -Wall -W -O2 -g mktime.c -o mktime"
-End:
-*/
diff --git a/lib/nstrftime.c b/lib/nstrftime.c
index 46e806e..bc84da5 100644
--- a/lib/nstrftime.c
+++ b/lib/nstrftime.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -180,7 +180,7 @@ extern char *tzname[];
           if (digits == 0 && _n < _w)                                         \
             {                                                                 \
               size_t _delta = width - _n;                                     \
-              if (pad == L_('0'))                                             \
+              if (pad == L_('0') || pad == L_('+'))                           \
                 memset_zero (p, _delta);                                      \
               else                                                            \
                 memset_space (p, _delta);                                     \
@@ -418,7 +418,7 @@ iso_week_days (int yday, int wday)
 
 static size_t __strftime_internal (STREAM_OR_CHAR_T *, STRFTIME_ARG (size_t)
                                    const CHAR_T *, const struct tm *,
-                                   bool, bool *
+                                   bool, int, int, bool *
                                    extra_args_spec LOCALE_PARAM);
 
 /* Write information from TP into S according to the format
@@ -433,8 +433,8 @@ my_strftime (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t 
maxsize)
              const struct tm *tp extra_args_spec LOCALE_PARAM)
 {
   bool tzset_called = false;
-  return __strftime_internal (s, STRFTIME_ARG (maxsize) format, tp,
-                              false, &tzset_called extra_args LOCALE_ARG);
+  return __strftime_internal (s, STRFTIME_ARG (maxsize) format, tp, false,
+                              0, -1, &tzset_called extra_args LOCALE_ARG);
 }
 #if defined _LIBC && ! FPRINTFTIME
 libc_hidden_def (my_strftime)
@@ -446,7 +446,8 @@ libc_hidden_def (my_strftime)
 static size_t
 __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG (size_t maxsize)
                      const CHAR_T *format,
-                     const struct tm *tp, bool upcase, bool *tzset_called
+                     const struct tm *tp, bool upcase,
+                     int yr_spec, int width, bool *tzset_called
                      extra_args_spec LOCALE_PARAM)
 {
 #if defined _LIBC && defined USE_IN_EXTENDED_LOCALE_MODEL
@@ -558,7 +559,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
     if (hour12 == 0)
       hour12 = 12;
 
-  for (f = format; *f != '\0'; ++f)
+  for (f = format; *f != '\0'; width = -1, f++)
     {
       int pad = 0;              /* Padding for number ('-', '_', or 0).  */
       int modifier;             /* Field modifier ('E', 'O', or 0).  */
@@ -576,12 +577,12 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
                  + (sizeof (int) < sizeof (time_t)
                     ? INT_STRLEN_BOUND (time_t)
                     : INT_STRLEN_BOUND (int))];
-      int width = -1;
       bool to_lowcase = false;
       bool to_uppcase = upcase;
       size_t colons;
       bool change_case = false;
       int format_char;
+      int subwidth;
 
 #if DO_MULTIBYTE && !defined COMPILE_WIDE
       switch (*f)
@@ -679,6 +680,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
               /* This influences the number formats.  */
             case L_('_'):
             case L_('-'):
+            case L_('+'):
             case L_('0'):
               pad = *f;
               continue;
@@ -697,7 +699,6 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
           break;
         }
 
-      /* As a GNU extension we allow the field width to be specified.  */
       if (ISDIGIT (*f))
         {
           width = 0;
@@ -743,12 +744,16 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
             }                                                                 \
           while (0)
 #define DO_SIGNED_NUMBER(d, negative, v) \
+          DO_MAYBE_SIGNED_NUMBER (d, negative, v, do_signed_number)
+#define DO_YEARISH(d, negative, v) \
+          DO_MAYBE_SIGNED_NUMBER (d, negative, v, do_yearish)
+#define DO_MAYBE_SIGNED_NUMBER(d, negative, v, label) \
           do                                                                  \
             {                                                                 \
               digits = d;                                                     \
               negative_number = negative;                                     \
               u_number_value = v;                                             \
-              goto do_signed_number;                                          \
+              goto label;                                                     \
             }                                                                 \
           while (0)
 
@@ -850,7 +855,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
           if (modifier == L_('O'))
             goto bad_format;
 #ifdef _NL_CURRENT
-          if (! (modifier == 'E'
+          if (! (modifier == L_('E')
                  && (*(subfmt =
                        (const CHAR_T *) _NL_CURRENT (LC_TIME,
                                                      NLW(ERA_D_T_FMT)))
@@ -861,15 +866,17 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
 #endif
 
         subformat:
+          subwidth = -1;
+        subformat_width:
           {
             size_t len = __strftime_internal (NULL, STRFTIME_ARG ((size_t) -1)
-                                              subfmt,
-                                              tp, to_uppcase, tzset_called
+                                              subfmt, tp, to_uppcase,
+                                              pad, subwidth, tzset_called
                                               extra_args LOCALE_ARG);
             add (len, __strftime_internal (p,
                                            STRFTIME_ARG (maxsize - i)
-                                           subfmt,
-                                           tp, to_uppcase, tzset_called
+                                           subfmt, tp, to_uppcase,
+                                           pad, subwidth, tzset_called
                                            extra_args LOCALE_ARG));
           }
           break;
@@ -930,7 +937,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
           {
             int century = tp->tm_year / 100 + TM_YEAR_BASE / 100;
             century -= tp->tm_year % 100 < 0 && 0 < century;
-            DO_SIGNED_NUMBER (2, tp->tm_year < - TM_YEAR_BASE, century);
+            DO_YEARISH (2, tp->tm_year < - TM_YEAR_BASE, century);
           }
 
         case L_('x'):
@@ -939,7 +946,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
 #ifdef _NL_CURRENT
           if (! (modifier == L_('E')
                  && (*(subfmt =
-                       (const CHAR_T *)_NL_CURRENT (LC_TIME, NLW(ERA_D_FMT)))
+                       (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(ERA_D_FMT)))
                      != L_('\0'))))
             subfmt = (const CHAR_T *) _NL_CURRENT (LC_TIME, NLW(D_FMT));
           goto subformat;
@@ -971,9 +978,17 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
           always_output_a_sign = true;
           goto do_number_body;
 
+        do_yearish:
+          if (pad == 0)
+            pad = yr_spec;
+          always_output_a_sign
+            = (pad == L_('+')
+               && ((digits == 2 ? 99 : 9999) < u_number_value
+                   || digits < width));
+          goto do_maybe_signed_number;
+
         do_number_spacepad:
-          /* Force '_' flag unless overridden by '0' or '-' flag.  */
-          if (pad != L_('0') && pad != L_('-'))
+          if (pad == 0)
             pad = L_('_');
 
         do_number:
@@ -983,6 +998,8 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
 
         do_signed_number:
           always_output_a_sign = false;
+
+        do_maybe_signed_number:
           tz_colon_mask = 0;
 
         do_number_body:
@@ -1087,8 +1104,19 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
         case L_('F'):
           if (modifier != 0)
             goto bad_format;
+          if (pad == 0 && width < 0)
+            {
+              pad = L_('+');
+              subwidth = 4;
+            }
+          else
+            {
+              subwidth = width - 6;
+              if (subwidth < 0)
+                subwidth = 0;
+            }
           subfmt = L_("%Y-%m-%d");
-          goto subformat;
+          goto subformat_width;
 
         case L_('H'):
           if (modifier == L_('E'))
@@ -1297,17 +1325,18 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
               case L_('g'):
                 {
                   int yy = (tp->tm_year % 100 + year_adjust) % 100;
-                  DO_NUMBER (2, (0 <= yy
-                                 ? yy
-                                 : tp->tm_year < -TM_YEAR_BASE - year_adjust
-                                 ? -yy
-                                 : yy + 100));
+                  DO_YEARISH (2, false,
+                              (0 <= yy
+                               ? yy
+                               : tp->tm_year < -TM_YEAR_BASE - year_adjust
+                               ? -yy
+                               : yy + 100));
                 }
 
               case L_('G'):
-                DO_SIGNED_NUMBER (4, tp->tm_year < -TM_YEAR_BASE - year_adjust,
-                                  (tp->tm_year + (unsigned int) TM_YEAR_BASE
-                                   + year_adjust));
+                DO_YEARISH (4, tp->tm_year < -TM_YEAR_BASE - year_adjust,
+                            (tp->tm_year + (unsigned int) TM_YEAR_BASE
+                             + year_adjust));
 
               default:
                 DO_NUMBER (2, days / 7 + 1);
@@ -1327,7 +1356,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
           DO_NUMBER (1, tp->tm_wday);
 
         case L_('Y'):
-          if (modifier == 'E')
+          if (modifier == L_('E'))
             {
 #if HAVE_STRUCT_ERA_ENTRY
               struct era_entry *era = _nl_get_era_entry (tp HELPER_LOCALE_ARG);
@@ -1338,6 +1367,8 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
 # else
                   subfmt = era->era_format;
 # endif
+                  if (pad == 0)
+                    pad = yr_spec;
                   goto subformat;
                 }
 #else
@@ -1347,8 +1378,8 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
           if (modifier == L_('O'))
             goto bad_format;
 
-          DO_SIGNED_NUMBER (4, tp->tm_year < -TM_YEAR_BASE,
-                            tp->tm_year + (unsigned int) TM_YEAR_BASE);
+          DO_YEARISH (4, tp->tm_year < -TM_YEAR_BASE,
+                      tp->tm_year + (unsigned int) TM_YEAR_BASE);
 
         case L_('y'):
           if (modifier == L_('E'))
@@ -1358,7 +1389,9 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
               if (era)
                 {
                   int delta = tp->tm_year - era->start_date[0];
-                  DO_NUMBER (1, (era->offset
+                  if (pad == 0)
+                    pad = yr_spec;
+                  DO_NUMBER (2, (era->offset
                                  + delta * era->absolute_direction));
                 }
 #else
@@ -1370,7 +1403,7 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
             int yy = tp->tm_year % 100;
             if (yy < 0)
               yy = tp->tm_year < - TM_YEAR_BASE ? -yy : yy + 100;
-            DO_NUMBER (2, yy);
+            DO_YEARISH (2, false, yy);
           }
 
         case L_('Z'):
@@ -1438,28 +1471,10 @@ __strftime_internal (STREAM_OR_CHAR_T *s, STRFTIME_ARG 
(size_t maxsize)
 # endif
 
                 ltm = *tp;
+                ltm.tm_wday = -1;
                 lt = mktime_z (tz, &ltm);
-
-                if (lt == (time_t) -1)
-                  {
-                    /* mktime returns -1 for errors, but -1 is also a
-                       valid time_t value.  Check whether an error really
-                       occurred.  */
-                    struct tm tm;
-
-                    if (! localtime_rz (tz, &lt, &tm)
-                        || ((ltm.tm_sec ^ tm.tm_sec)
-                            | (ltm.tm_min ^ tm.tm_min)
-                            | (ltm.tm_hour ^ tm.tm_hour)
-                            | (ltm.tm_mday ^ tm.tm_mday)
-                            | (ltm.tm_mon ^ tm.tm_mon)
-                            | (ltm.tm_year ^ tm.tm_year)))
-                      break;
-                  }
-
-                if (! localtime_rz (0, &lt, &gtm))
+                if (ltm.tm_wday < 0 || ! localtime_rz (0, &lt, &gtm))
                   break;
-
                 diff = tm_diff (&ltm, &gtm);
               }
 #endif
diff --git a/lib/open.c b/lib/open.c
index 792e258..6552605 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -1,5 +1,5 @@
 /* Open a descriptor to a file.
-   Copyright (C) 2007-2018 Free Software Foundation, Inc.
+   Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/openat-priv.h b/lib/openat-priv.h
index 5d53df1..7b90eef 100644
--- a/lib/openat-priv.h
+++ b/lib/openat-priv.h
@@ -1,6 +1,6 @@
 /* Internals for openat-like functions.
 
-   Copyright (C) 2005-2006, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/openat-proc.c b/lib/openat-proc.c
index 87137ee..da76e2b 100644
--- a/lib/openat-proc.c
+++ b/lib/openat-proc.c
@@ -1,6 +1,6 @@
 /* Create /proc/self/fd-related names for subfiles of open directories.
 
-   Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/openat.h b/lib/openat.h
index 945e032..f23b371 100644
--- a/lib/openat.h
+++ b/lib/openat.h
@@ -1,5 +1,5 @@
 /* provide a replacement openat function
-   Copyright (C) 2004-2006, 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2004-2006, 2008-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/pipe2.c b/lib/pipe2.c
index c16d935..15a5dec 100644
--- a/lib/pipe2.c
+++ b/lib/pipe2.c
@@ -1,5 +1,5 @@
 /* Create a pipe, with specific opening flags.
-   Copyright (C) 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/pselect.c b/lib/pselect.c
index 33b2719..ae010aa 100644
--- a/lib/pselect.c
+++ b/lib/pselect.c
@@ -1,6 +1,6 @@
 /* pselect - synchronous I/O multiplexing
 
-   Copyright 2011-2018 Free Software Foundation, Inc.
+   Copyright 2011-2019 Free Software Foundation, Inc.
 
    This file is part of gnulib.
 
diff --git a/lib/pthread_sigmask.c b/lib/pthread_sigmask.c
index 3bb92ca..3e40cfc 100644
--- a/lib/pthread_sigmask.c
+++ b/lib/pthread_sigmask.c
@@ -1,5 +1,5 @@
 /* POSIX compatible signal blocking for threads.
-   Copyright (C) 2011-2018 Free Software Foundation, Inc.
+   Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/putenv.c b/lib/putenv.c
index 801e372..81085e9 100644
--- a/lib/putenv.c
+++ b/lib/putenv.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2018 Free Software
+/* Copyright (C) 1991, 1994, 1997-1998, 2000, 2003-2019 Free Software
    Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C
diff --git a/lib/qcopy-acl.c b/lib/qcopy-acl.c
index ee482ef..cf75080 100644
--- a/lib/qcopy-acl.c
+++ b/lib/qcopy-acl.c
@@ -1,6 +1,6 @@
 /* Copy access control list from one file to another.  -*- coding: utf-8 -*-
 
-   Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/readlink.c b/lib/readlink.c
index 924e00d..bf71109 100644
--- a/lib/readlink.c
+++ b/lib/readlink.c
@@ -1,5 +1,5 @@
 /* Stub for readlink().
-   Copyright (C) 2003-2007, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2003-2007, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/readlinkat.c b/lib/readlinkat.c
index 35179e2..c0f3e59 100644
--- a/lib/readlinkat.c
+++ b/lib/readlinkat.c
@@ -1,5 +1,5 @@
 /* Read a symlink relative to an open directory.
-   Copyright (C) 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 0b05a63..892139a 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -1,5 +1,5 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <address@hidden>.
 
@@ -233,9 +233,7 @@ re_compile_pattern (const char *pattern, size_t length,
     return NULL;
   return gettext (__re_error_msgid + __re_error_msgid_idx[(int) ret]);
 }
-#ifdef _LIBC
 weak_alias (__re_compile_pattern, re_compile_pattern)
-#endif
 
 /* Set by 're_set_syntax' to the current regexp syntax to recognize.  Can
    also be assigned to arbitrarily: each pattern buffer stores its own
@@ -260,9 +258,7 @@ re_set_syntax (reg_syntax_t syntax)
   re_syntax_options = syntax;
   return ret;
 }
-#ifdef _LIBC
 weak_alias (__re_set_syntax, re_set_syntax)
-#endif
 
 int
 re_compile_fastmap (struct re_pattern_buffer *bufp)
@@ -281,9 +277,7 @@ re_compile_fastmap (struct re_pattern_buffer *bufp)
   bufp->fastmap_accurate = 1;
   return 0;
 }
-#ifdef _LIBC
 weak_alias (__re_compile_fastmap, re_compile_fastmap)
-#endif
 
 static inline void
 __attribute__ ((always_inline))
@@ -464,7 +458,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t 
*init_state,
    the return codes and their meanings.)  */
 
 int
-regcomp (regex_t *_Restrict_ preg, const char *_Restrict_ pattern, int cflags)
+regcomp (regex_t *__restrict preg, const char *__restrict pattern, int cflags)
 {
   reg_errcode_t ret;
   reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED
@@ -515,16 +509,14 @@ regcomp (regex_t *_Restrict_ preg, const char *_Restrict_ 
pattern, int cflags)
 
   return (int) ret;
 }
-#ifdef _LIBC
 libc_hidden_def (__regcomp)
 weak_alias (__regcomp, regcomp)
-#endif
 
 /* Returns a message corresponding to an error code, ERRCODE, returned
    from either regcomp or regexec.   We don't use PREG here.  */
 
 size_t
-regerror (int errcode, const regex_t *_Restrict_ preg, char *_Restrict_ errbuf,
+regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf,
          size_t errbuf_size)
 {
   const char *msg;
@@ -555,9 +547,7 @@ regerror (int errcode, const regex_t *_Restrict_ preg, char 
*_Restrict_ errbuf,
 
   return msg_size;
 }
-#ifdef _LIBC
 weak_alias (__regerror, regerror)
-#endif
 
 
 #ifdef RE_ENABLE_I18N
@@ -657,10 +647,8 @@ regfree (regex_t *preg)
   re_free (preg->translate);
   preg->translate = NULL;
 }
-#ifdef _LIBC
 libc_hidden_def (__regfree)
 weak_alias (__regfree, regfree)
-#endif
 
 /* Entry points compatible with 4.2 BSD regex library.  We don't define
    them unless specifically requested.  */
@@ -1812,8 +1800,8 @@ peek_token (re_token_t *token, re_string_t *input, 
reg_syntax_t syntax)
   token->word_char = 0;
 #ifdef RE_ENABLE_I18N
   token->mb_partial = 0;
-  if (input->mb_cur_max > 1 &&
-      !re_string_first_byte (input, re_string_cur_idx (input)))
+  if (input->mb_cur_max > 1
+      && !re_string_first_byte (input, re_string_cur_idx (input)))
     {
       token->type = CHARACTER;
       token->mb_partial = 1;
@@ -2000,8 +1988,8 @@ peek_token (re_token_t *token, re_string_t *input, 
reg_syntax_t syntax)
       token->type = OP_PERIOD;
       break;
     case '^':
-      if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE)) &&
-         re_string_cur_idx (input) != 0)
+      if (!(syntax & (RE_CONTEXT_INDEP_ANCHORS | RE_CARET_ANCHORS_HERE))
+         && re_string_cur_idx (input) != 0)
        {
          char prev = re_string_peek_byte (input, -1);
          if (!(syntax & RE_NEWLINE_ALT) || prev != '\n')
@@ -2011,8 +1999,8 @@ peek_token (re_token_t *token, re_string_t *input, 
reg_syntax_t syntax)
       token->opr.ctx_type = LINE_FIRST;
       break;
     case '$':
-      if (!(syntax & RE_CONTEXT_INDEP_ANCHORS) &&
-         re_string_cur_idx (input) + 1 != re_string_length (input))
+      if (!(syntax & RE_CONTEXT_INDEP_ANCHORS)
+         && re_string_cur_idx (input) + 1 != re_string_length (input))
        {
          re_token_t next;
          re_string_skip_bytes (input, 1);
@@ -2046,8 +2034,8 @@ peek_token_bracket (re_token_t *token, re_string_t 
*input, reg_syntax_t syntax)
   token->opr.c = c;
 
 #ifdef RE_ENABLE_I18N
-  if (input->mb_cur_max > 1 &&
-      !re_string_first_byte (input, re_string_cur_idx (input)))
+  if (input->mb_cur_max > 1
+      && !re_string_first_byte (input, re_string_cur_idx (input)))
     {
       token->type = CHARACTER;
       return 1;
@@ -2345,8 +2333,8 @@ parse_expression (re_string_t *regexp, regex_t *preg, 
re_token_t *token,
        }
       FALLTHROUGH;
     case OP_CLOSE_SUBEXP:
-      if ((token->type == OP_CLOSE_SUBEXP) &&
-         !(syntax & RE_UNMATCHED_RIGHT_PAREN_ORD))
+      if ((token->type == OP_CLOSE_SUBEXP)
+         && !(syntax & RE_UNMATCHED_RIGHT_PAREN_ORD))
        {
          *err = REG_ERPAREN;
          return NULL;
diff --git a/lib/regex.c b/lib/regex.c
index 2a86e10..eab7a48 100644
--- a/lib/regex.c
+++ b/lib/regex.c
@@ -1,5 +1,5 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <address@hidden>.
 
@@ -20,10 +20,10 @@
 #ifndef _LIBC
 # include <libc-config.h>
 
-# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
+# if __GNUC_PREREQ (4, 6)
 #  pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
 # endif
-# if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__
+# if __GNUC_PREREQ (4, 3)
 #  pragma GCC diagnostic ignored "-Wold-style-definition"
 #  pragma GCC diagnostic ignored "-Wtype-limits"
 # endif
diff --git a/lib/regex.h b/lib/regex.h
index f2ac950..77ac1a5 100644
--- a/lib/regex.h
+++ b/lib/regex.h
@@ -1,6 +1,6 @@
 /* Definitions for data structures and routines for the regular
    expression library.
-   Copyright (C) 1985, 1989-2018 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1989-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/regex_internal.c b/lib/regex_internal.c
index f13def3..b592f06 100644
--- a/lib/regex_internal.c
+++ b/lib/regex_internal.c
@@ -1,5 +1,5 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <address@hidden>.
 
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index b0e49cd..a3aedda 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -1,5 +1,5 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <address@hidden>.
 
@@ -144,13 +144,8 @@
 # define __mbrtowc mbrtowc
 # define __wcrtomb wcrtomb
 # define __regfree regfree
-# define attribute_hidden
 #endif /* not _LIBC */
 
-#if __GNUC__ < 3 + (__GNUC_MINOR__ < 1)
-# define __attribute__(arg)
-#endif
-
 #ifndef SSIZE_MAX
 # define SSIZE_MAX ((ssize_t) (SIZE_MAX / 2))
 #endif
@@ -868,23 +863,6 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx)
 }
 #endif /* RE_ENABLE_I18N */
 
-#ifndef __GNUC_PREREQ
-# if defined __GNUC__ && defined __GNUC_MINOR__
-#  define __GNUC_PREREQ(maj, min) \
-         ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
-# else
-#  define __GNUC_PREREQ(maj, min) 0
-# endif
-#endif
-
-#if __GNUC_PREREQ (3,4)
-# undef __attribute_warn_unused_result__
-# define __attribute_warn_unused_result__ \
-   __attribute__ ((__warn_unused_result__))
-#else
-# define __attribute_warn_unused_result__ /* empty */
-#endif
-
 #ifndef FALLTHROUGH
 # if __GNUC__ < 7
 #  define FALLTHROUGH ((void) 0)
diff --git a/lib/regexec.c b/lib/regexec.c
index 8b82ea5..f464869 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -1,5 +1,5 @@
 /* Extended regular expression matching and search library.
-   Copyright (C) 2002-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Isamu Hasegawa <address@hidden>.
 
@@ -189,7 +189,7 @@ static reg_errcode_t extend_buffers (re_match_context_t 
*mctx, int min_len);
    We return 0 if we find a match and REG_NOMATCH if not.  */
 
 int
-regexec (const regex_t *_Restrict_ preg, const char *_Restrict_ string,
+regexec (const regex_t *__restrict preg, const char *__restrict string,
         size_t nmatch, regmatch_t pmatch[], int eflags)
 {
   reg_errcode_t err;
@@ -232,8 +232,8 @@ __typeof__ (__regexec) __compat_regexec;
 
 int
 attribute_compat_text_section
-__compat_regexec (const regex_t *_Restrict_ preg,
-                 const char *_Restrict_ string, size_t nmatch,
+__compat_regexec (const regex_t *__restrict preg,
+                 const char *__restrict string, size_t nmatch,
                  regmatch_t pmatch[], int eflags)
 {
   return regexec (preg, string, nmatch, pmatch,
@@ -1293,8 +1293,10 @@ proceed_next_node (const re_match_context_t *mctx, Idx 
nregs, regmatch_t *regs,
              else if (naccepted)
                {
                  char *buf = (char *) re_string_get_buffer (&mctx->input);
-                 if (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx,
-                             naccepted) != 0)
+                 if (mctx->input.valid_len - *pidx < naccepted
+                     || (memcmp (buf + regs[subexp_idx].rm_so, buf + *pidx,
+                                 naccepted)
+                         != 0))
                    return -1;
                }
            }
@@ -2202,12 +2204,12 @@ sift_states_iter_mb (const re_match_context_t *mctx, 
re_sift_context_t *sctx,
   int naccepted;
   /* Check the node can accept "multi byte".  */
   naccepted = check_node_accept_bytes (dfa, node_idx, &mctx->input, str_idx);
-  if (naccepted > 0 && str_idx + naccepted <= max_str_idx &&
-      !STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + naccepted],
-                           dfa->nexts[node_idx]))
+  if (naccepted > 0 && str_idx + naccepted <= max_str_idx
+      && !STATE_NODE_CONTAINS (sctx->sifted_states[str_idx + naccepted],
+                              dfa->nexts[node_idx]))
     /* The node can't accept the "multi byte", or the
        destination was already thrown away, then the node
-       could't accept the current input "multi byte".   */
+       couldn't accept the current input "multi byte".   */
     naccepted = 0;
   /* Otherwise, it is sure that the node could accept
      'naccepted' bytes input.  */
@@ -2783,8 +2785,11 @@ get_subexp (re_match_context_t *mctx, Idx bkref_node, 
Idx bkref_str_idx)
            return REG_ESPACE;
          err = get_subexp_sub (mctx, sub_top, sub_last, bkref_node,
                                bkref_str_idx);
+         buf = (const char *) re_string_get_buffer (&mctx->input);
          if (err == REG_NOMATCH)
            continue;
+         if (__glibc_unlikely (err != REG_NOERROR))
+           return err;
        }
     }
   return REG_NOERROR;
@@ -3777,10 +3782,10 @@ check_node_accept_bytes (const re_dfa_t *dfa, Idx 
node_idx,
       /* FIXME: I don't think this if is needed, as both '\n'
         and '\0' are char_len == 1.  */
       /* '.' accepts any one character except the following two cases.  */
-      if ((!(dfa->syntax & RE_DOT_NEWLINE) &&
-          re_string_byte_at (input, str_idx) == '\n') ||
-         ((dfa->syntax & RE_DOT_NOT_NULL) &&
-          re_string_byte_at (input, str_idx) == '\0'))
+      if ((!(dfa->syntax & RE_DOT_NEWLINE)
+          && re_string_byte_at (input, str_idx) == '\n')
+         || ((dfa->syntax & RE_DOT_NOT_NULL)
+             && re_string_byte_at (input, str_idx) == '\0'))
        return 0;
       return char_len;
     }
diff --git a/lib/root-uid.h b/lib/root-uid.h
index 4af7d95..eebfa94 100644
--- a/lib/root-uid.h
+++ b/lib/root-uid.h
@@ -1,6 +1,6 @@
 /* The user ID that always has appropriate privileges in the POSIX sense.
 
-   Copyright 2012-2018 Free Software Foundation, Inc.
+   Copyright 2012-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/save-cwd.c b/lib/save-cwd.c
index 5020fac..a7c4745 100644
--- a/lib/save-cwd.c
+++ b/lib/save-cwd.c
@@ -1,6 +1,6 @@
 /* save-cwd.c -- Save and restore current working directory.
 
-   Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2018 Free Software
+   Copyright (C) 1995, 1997-1998, 2003-2006, 2009-2019 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/save-cwd.h b/lib/save-cwd.h
index 88c8505..2fa6e75 100644
--- a/lib/save-cwd.h
+++ b/lib/save-cwd.h
@@ -1,6 +1,6 @@
 /* Save and restore current working directory.
 
-   Copyright (C) 1995, 1997-1998, 2003, 2009-2018 Free Software
+   Copyright (C) 1995, 1997-1998, 2003, 2009-2019 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/set-permissions.c b/lib/set-permissions.c
index a415e13..38cd30a 100644
--- a/lib/set-permissions.c
+++ b/lib/set-permissions.c
@@ -1,6 +1,6 @@
 /* Set permissions of a file.  -*- coding: utf-8 -*-
 
-   Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/sha1.c b/lib/sha1.c
index cd79dfa..d94c437 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -1,7 +1,7 @@
 /* sha1.c - Functions to compute SHA1 message digest of files or
    memory blocks according to the NIST specification FIPS-180-1.
 
-   Copyright (C) 2000-2001, 2003-2006, 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2000-2001, 2003-2006, 2008-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
diff --git a/lib/sha1.h b/lib/sha1.h
index 9419750..617f7b0 100644
--- a/lib/sha1.h
+++ b/lib/sha1.h
@@ -1,6 +1,6 @@
 /* Declarations of functions and data types used for SHA1 sum
    library functions.
-   Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2018 Free Software
+   Copyright (C) 2000-2001, 2003, 2005-2006, 2008-2019 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
diff --git a/lib/sha256.c b/lib/sha256.c
index c518517..721e944 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -1,7 +1,7 @@
 /* sha256.c - Functions to compute SHA256 and SHA224 message digest of files or
    memory blocks according to the NIST specification FIPS-180-2.
 
-   Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/sha256.h b/lib/sha256.h
index 19ed3cc..b1ccb2a 100644
--- a/lib/sha256.h
+++ b/lib/sha256.h
@@ -1,6 +1,6 @@
 /* Declarations of functions and data types used for SHA256 and SHA224 sum
    library functions.
-   Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/sha512.c b/lib/sha512.c
index e854951..e7f5bd5 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -1,7 +1,7 @@
 /* sha512.c - Functions to compute SHA512 and SHA384 message digest of files or
    memory blocks according to the NIST specification FIPS-180-2.
 
-   Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/sha512.h b/lib/sha512.h
index 2c39ab1..7e8cc28 100644
--- a/lib/sha512.h
+++ b/lib/sha512.h
@@ -1,6 +1,6 @@
 /* Declarations of functions and data types used for SHA512 and SHA384 sum
    library functions.
-   Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2008-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/sig2str.c b/lib/sig2str.c
index 72b075e..cd5bd4d 100644
--- a/lib/sig2str.c
+++ b/lib/sig2str.c
@@ -1,6 +1,6 @@
 /* sig2str.c -- convert between signal names and numbers
 
-   Copyright (C) 2002, 2004, 2006, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2006, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/sig2str.h b/lib/sig2str.h
index 69887d4..32e0d26 100644
--- a/lib/sig2str.h
+++ b/lib/sig2str.h
@@ -1,6 +1,6 @@
 /* sig2str.h -- convert between signal names and numbers
 
-   Copyright (C) 2002, 2005, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2005, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/signal.in.h b/lib/signal.in.h
index 7d4927b..a6960a2 100644
--- a/lib/signal.in.h
+++ b/lib/signal.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <signal.h>.
 
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/stat-time.h b/lib/stat-time.h
index 69ebe85..38a1f55 100644
--- a/lib/stat-time.h
+++ b/lib/stat-time.h
@@ -1,6 +1,6 @@
 /* stat-related time functions.
 
-   Copyright (C) 2005, 2007, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2005, 2007, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -171,7 +171,7 @@ get_stat_birthtime (struct stat const *st _GL_UNUSED)
 #elif defined _WIN32 && ! defined __CYGWIN__
   /* Native Windows platforms (but not Cygwin) put the "file creation
      time" in st_ctime (!).  See
-     <https://msdn.microsoft.com/en-us/library/14h5k7ff(VS.80).aspx>.  */
+     
<https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/stat-functions>.
  */
 # if _GL_WINDOWS_STAT_TIMESPEC
   t = st->st_ctim;
 # else
diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h
index bbfa9ac..d988d7c 100644
--- a/lib/stdalign.in.h
+++ b/lib/stdalign.in.h
@@ -1,6 +1,6 @@
 /* A substitute for ISO C11 <stdalign.h>.
 
-   Copyright 2011-2018 Free Software Foundation, Inc.
+   Copyright 2011-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/stddef.in.h b/lib/stddef.in.h
index 8329a9b..5aad121 100644
--- a/lib/stddef.in.h
+++ b/lib/stddef.in.h
@@ -1,6 +1,6 @@
 /* A substitute for POSIX 2008 <stddef.h>, for platforms that have issues.
 
-   Copyright (C) 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/stdint.in.h b/lib/stdint.in.h
index 94e7c81..21dd8d2 100644
--- a/lib/stdint.in.h
+++ b/lib/stdint.in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2002, 2004-2018 Free Software Foundation, Inc.
+/* Copyright (C) 2001-2002, 2004-2019 Free Software Foundation, Inc.
    Written by Paul Eggert, Bruno Haible, Sam Steingold, Peter Burwood.
    This file is part of gnulib.
 
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
index 393ef0c..4260468 100644
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -1,5 +1,5 @@
 /* Implementation details of FILE streams.
-   Copyright (C) 2007-2008, 2010-2018 Free Software Foundation, Inc.
+   Copyright (C) 2007-2008, 2010-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -61,6 +61,11 @@
 #  define _r pub._r
 #  define _w pub._w
 # elif defined __ANDROID__ /* Android */
+#  ifdef __LP64__
+#   define _gl_flags_file_t int
+#  else
+#   define _gl_flags_file_t short
+#  endif
   /* Up to this commit from 2015-10-12
      
<https://android.googlesource.com/platform/bionic.git/+/f0141dfab10a4b332769d52fa76631a64741297a>
      the innards of FILE were public, and fp_ub could be defined like for 
OpenBSD,
@@ -70,8 +75,8 @@
 #  define fp_ ((struct { unsigned char *_p; \
                          int _r; \
                          int _w; \
-                         int _flags; \
-                         int _file; \
+                         _gl_flags_file_t _flags; \
+                         _gl_flags_file_t _file; \
                          struct { unsigned char *_base; size_t _size; } _bf; \
                          int _lbfsize; \
                          void *_cookie; \
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index ff7c9c8..4a8aa55 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <stdio.h>.
 
-   Copyright (C) 2004, 2007-2018 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2007-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -118,6 +118,13 @@
 # include <unistd.h>
 #endif
 
+/* Android 4.3 declares renameat in <sys/stat.h>, not in <stdio.h>.  */
+/* But in any case avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_RENAMEAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
+    && ! defined __GLIBC__
+# include <sys/stat.h>
+#endif
+
 /* MSVC declares 'perror' in <stdlib.h>, not in <stdio.h>.  We must include
    it before we  #define perror rpl_perror.  */
 /* But in any case avoid namespace pollution on glibc systems.  */
diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h
index 441c018..f829525 100644
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <stdlib.h>.
 
-   Copyright (C) 1995, 2001-2004, 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2004, 2006-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -306,9 +306,18 @@ _GL_WARN_ON_USE (malloc, "malloc is not POSIX compliant 
everywhere - "
 _GL_FUNCDECL_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
 _GL_CXXALIAS_RPL (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
 # else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
+#  endif
 _GL_CXXALIAS_SYS (mbtowc, int, (wchar_t *pwc, const char *s, size_t n));
 # endif
 _GL_CXXALIASWARN (mbtowc);
+#elif defined GNULIB_POSIXCHECK
+# undef mbtowc
+# if HAVE_RAW_DECL_MBTOWC
+_GL_WARN_ON_USE (mbtowc, "mbtowc is not portable - "
+                 "use gnulib module mbtowc for portability");
+# endif
 #endif
 
 #if @GNULIB_MKDTEMP@
@@ -573,10 +582,19 @@ _GL_WARN_ON_USE (qsort_r, "qsort_r is not portable - "
 
 
 #if @GNULIB_RANDOM@
-# if address@hidden@
+# if @REPLACE_RANDOM@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef random
+#   define random rpl_random
+#  endif
+_GL_FUNCDECL_RPL (random, long, (void));
+_GL_CXXALIAS_RPL (random, long, (void));
+# else
+#  if address@hidden@
 _GL_FUNCDECL_SYS (random, long, (void));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (random, long, (void));
+# endif
 _GL_CXXALIASWARN (random);
 #elif defined GNULIB_POSIXCHECK
 # undef random
@@ -587,10 +605,19 @@ _GL_WARN_ON_USE (random, "random is unportable - "
 #endif
 
 #if @GNULIB_RANDOM@
-# if address@hidden@
+# if @REPLACE_RANDOM@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef srandom
+#   define srandom rpl_srandom
+#  endif
+_GL_FUNCDECL_RPL (srandom, void, (unsigned int seed));
+_GL_CXXALIAS_RPL (srandom, void, (unsigned int seed));
+# else
+#  if address@hidden@
 _GL_FUNCDECL_SYS (srandom, void, (unsigned int seed));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (srandom, void, (unsigned int seed));
+# endif
 _GL_CXXALIASWARN (srandom);
 #elif defined GNULIB_POSIXCHECK
 # undef srandom
@@ -601,31 +628,52 @@ _GL_WARN_ON_USE (srandom, "srandom is unportable - "
 #endif
 
 #if @GNULIB_RANDOM@
-# if address@hidden@ || address@hidden@
+# if @REPLACE_INITSTATE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef initstate
+#   define initstate rpl_initstate
+#  endif
+_GL_FUNCDECL_RPL (initstate, char *,
+                  (unsigned int seed, char *buf, size_t buf_size)
+                  _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (initstate, char *,
+                  (unsigned int seed, char *buf, size_t buf_size));
+# else
+#  if address@hidden@ || address@hidden@
 _GL_FUNCDECL_SYS (initstate, char *,
                   (unsigned int seed, char *buf, size_t buf_size)
                   _GL_ARG_NONNULL ((2)));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (initstate, char *,
                   (unsigned int seed, char *buf, size_t buf_size));
+# endif
 _GL_CXXALIASWARN (initstate);
 #elif defined GNULIB_POSIXCHECK
 # undef initstate
-# if HAVE_RAW_DECL_INITSTATE_R
+# if HAVE_RAW_DECL_INITSTATE
 _GL_WARN_ON_USE (initstate, "initstate is unportable - "
                  "use gnulib module random for portability");
 # endif
 #endif
 
 #if @GNULIB_RANDOM@
-# if address@hidden@ || address@hidden@
+# if @REPLACE_SETSTATE@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   undef setstate
+#   define setstate rpl_setstate
+#  endif
+_GL_FUNCDECL_RPL (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (setstate, char *, (char *arg_state));
+# else
+#  if address@hidden@ || address@hidden@
 _GL_FUNCDECL_SYS (setstate, char *, (char *arg_state) _GL_ARG_NONNULL ((1)));
-# endif
+#  endif
 _GL_CXXALIAS_SYS (setstate, char *, (char *arg_state));
+# endif
 _GL_CXXALIASWARN (setstate);
 #elif defined GNULIB_POSIXCHECK
 # undef setstate
-# if HAVE_RAW_DECL_SETSTATE_R
+# if HAVE_RAW_DECL_SETSTATE
 _GL_WARN_ON_USE (setstate, "setstate is unportable - "
                  "use gnulib module random for portability");
 # endif
@@ -881,6 +929,7 @@ _GL_WARN_ON_USE (setenv, "setenv is unportable - "
 #  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #   define strtod rpl_strtod
 #  endif
+#  define GNULIB_defined_strtod_function 1
 _GL_FUNCDECL_RPL (strtod, double, (const char *str, char **endp)
                                   _GL_ARG_NONNULL ((1)));
 _GL_CXXALIAS_RPL (strtod, double, (const char *str, char **endp));
@@ -900,6 +949,32 @@ _GL_WARN_ON_USE (strtod, "strtod is unportable - "
 # endif
 #endif
 
+#if @GNULIB_STRTOLD@
+ /* Parse a 'long double' from STRING, updating ENDP if appropriate.  */
+# if @REPLACE_STRTOLD@
+#  if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#   define strtold rpl_strtold
+#  endif
+#  define GNULIB_defined_strtold_function 1
+_GL_FUNCDECL_RPL (strtold, long double, (const char *str, char **endp)
+                                        _GL_ARG_NONNULL ((1)));
+_GL_CXXALIAS_RPL (strtold, long double, (const char *str, char **endp));
+# else
+#  if address@hidden@
+_GL_FUNCDECL_SYS (strtold, long double, (const char *str, char **endp)
+                                        _GL_ARG_NONNULL ((1)));
+#  endif
+_GL_CXXALIAS_SYS (strtold, long double, (const char *str, char **endp));
+# endif
+_GL_CXXALIASWARN (strtold);
+#elif defined GNULIB_POSIXCHECK
+# undef strtold
+# if HAVE_RAW_DECL_STRTOLD
+_GL_WARN_ON_USE (strtold, "strtold is unportable - "
+                 "use gnulib module strtold for portability");
+# endif
+#endif
+
 #if @GNULIB_STRTOLL@
 /* Parse a signed integer whose textual representation starts at STRING.
    The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0,
diff --git a/lib/stpcpy.c b/lib/stpcpy.c
index 61239e9..a1d32fd 100644
--- a/lib/stpcpy.c
+++ b/lib/stpcpy.c
@@ -1,5 +1,5 @@
 /* stpcpy.c -- copy a string and return pointer to end of new string
-   Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2018 Free Software
+   Copyright (C) 1992, 1995, 1997-1998, 2006, 2009-2019 Free Software
    Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C 
Library.
diff --git a/lib/strftime.h b/lib/strftime.h
index af73767..e4a720b 100644
--- a/lib/strftime.h
+++ b/lib/strftime.h
@@ -1,6 +1,6 @@
 /* declarations for strftime.c
 
-   Copyright (C) 2002, 2004, 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2008-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/string.in.h b/lib/string.in.h
index 29f4ba6..4a9292f 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -1,6 +1,6 @@
 /* A GNU-like <string.h>.
 
-   Copyright (C) 1995-1996, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1995-1996, 2001-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/strtoimax.c b/lib/strtoimax.c
index 69e3a99..87b080c 100644
--- a/lib/strtoimax.c
+++ b/lib/strtoimax.c
@@ -1,6 +1,6 @@
 /* Convert string representation of a number into an intmax_t value.
 
-   Copyright (C) 1999, 2001-2004, 2006, 2009-2018 Free Software Foundation,
+   Copyright (C) 1999, 2001-2004, 2006, 2009-2019 Free Software Foundation,
    Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/strtol.c b/lib/strtol.c
index f6f5c32..1d920af 100644
--- a/lib/strtol.c
+++ b/lib/strtol.c
@@ -1,6 +1,6 @@
 /* Convert string representation of a number into an integer value.
 
-   Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2018 Free Software
+   Copyright (C) 1991-1992, 1994-1999, 2003, 2005-2007, 2009-2019 Free Software
    Foundation, Inc.
 
    NOTE: The canonical source of this file is maintained with the GNU C
diff --git a/lib/strtoll.c b/lib/strtoll.c
index 8aa10f4..038362a 100644
--- a/lib/strtoll.c
+++ b/lib/strtoll.c
@@ -1,5 +1,5 @@
 /* Function to parse a 'long long int' from text.
-   Copyright (C) 1995-1997, 1999, 2001, 2009-2018 Free Software Foundation,
+   Copyright (C) 1995-1997, 1999, 2001, 2009-2019 Free Software Foundation,
    Inc.
    This file is part of the GNU C Library.
 
diff --git a/lib/symlink.c b/lib/symlink.c
index c1c4b40..16432ee 100644
--- a/lib/symlink.c
+++ b/lib/symlink.c
@@ -1,5 +1,5 @@
 /* Stub for symlink().
-   Copyright (C) 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/sys_select.in.h b/lib/sys_select.in.h
index 154e570..4cf7cfc 100644
--- a/lib/sys_select.in.h
+++ b/lib/sys_select.in.h
@@ -1,5 +1,5 @@
 /* Substitute for <sys/select.h>.
-   Copyright (C) 2007-2018 Free Software Foundation, Inc.
+   Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/sys_stat.in.h b/lib/sys_stat.in.h
index 6ae6ac5..9ddd1a8 100644
--- a/lib/sys_stat.in.h
+++ b/lib/sys_stat.in.h
@@ -1,5 +1,5 @@
 /* Provide a more complete sys/stat.h header file.
-   Copyright (C) 2005-2018 Free Software Foundation, Inc.
+   Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -54,9 +54,16 @@
 
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
+/* Before doing "#define mknod rpl_mknod" below, we need to include all
+   headers that may declare mknod().  OS/2 kLIBC declares mknod() in
+   <unistd.h>, not in <sys/stat.h>.  */
+#ifdef __KLIBC__
+# include <unistd.h>
+#endif
+
 /* Before doing "#define mkdir rpl_mkdir" below, we need to include all
    headers that may declare mkdir().  Native Windows platforms declare mkdir
-   in <io.h> and/or <direct.h>, not in <unistd.h>.  */
+   in <io.h> and/or <direct.h>, not in <sys/stat.h>.  */
 #if defined _WIN32 && ! defined __CYGWIN__
 # include <io.h>     /* mingw32, mingw64 */
 # include <direct.h> /* mingw64, MSVC 9 */
diff --git a/lib/sys_time.in.h b/lib/sys_time.in.h
index b4a0e49..5397688 100644
--- a/lib/sys_time.in.h
+++ b/lib/sys_time.in.h
@@ -1,6 +1,6 @@
 /* Provide a more complete sys/time.h.
 
-   Copyright (C) 2007-2018 Free Software Foundation, Inc.
+   Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/sys_types.in.h b/lib/sys_types.in.h
index 7f8c1c4..237e206 100644
--- a/lib/sys_types.in.h
+++ b/lib/sys_types.in.h
@@ -1,6 +1,6 @@
 /* Provide a more complete sys/types.h.
 
-   Copyright (C) 2011-2018 Free Software Foundation, Inc.
+   Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/tempname.c b/lib/tempname.c
index da81263..be62ed9 100644
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -1,6 +1,6 @@
 /* tempname.c - generate the name of a temporary file.
 
-   Copyright (C) 1991-2003, 2005-2007, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 1991-2003, 2005-2007, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/tempname.h b/lib/tempname.h
index 4020c73..fb203d3 100644
--- a/lib/tempname.h
+++ b/lib/tempname.h
@@ -1,6 +1,6 @@
 /* Create a temporary file or directory.
 
-   Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/time-internal.h b/lib/time-internal.h
index 3a83623..57f2e78 100644
--- a/lib/time-internal.h
+++ b/lib/time-internal.h
@@ -1,6 +1,6 @@
 /* Time internal interface
 
-   Copyright 2015-2018 Free Software Foundation, Inc.
+   Copyright 2015-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/time.in.h b/lib/time.in.h
index cda16c6..dd3b212 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -1,6 +1,6 @@
 /* A more-standard <time.h>.
 
-   Copyright (C) 2007-2018 Free Software Foundation, Inc.
+   Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -48,7 +48,7 @@
 
 /* The definition of _GL_WARN_ON_USE is copied here.  */
 
-/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
+/* Some systems don't define struct timespec (e.g., AIX 4.1).
    Or they define it with the wrong member names or define it in <sys/time.h>
    (e.g., FreeBSD circa 1997).  Stock Mingw prior to 3.0 does not define it,
    but the pthreads-win32 library defines it in <pthread.h>.  */
diff --git a/lib/time_r.c b/lib/time_r.c
index 3029780..a701ccc 100644
--- a/lib/time_r.c
+++ b/lib/time_r.c
@@ -1,6 +1,6 @@
 /* Reentrant time functions like localtime_r.
 
-   Copyright (C) 2003, 2006-2007, 2010-2018 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2006-2007, 2010-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/time_rz.c b/lib/time_rz.c
index 5293c7c..42ae3d3 100644
--- a/lib/time_rz.c
+++ b/lib/time_rz.c
@@ -1,6 +1,6 @@
 /* Time zone functions such as tzalloc and localtime_rz
 
-   Copyright 2015-2018 Free Software Foundation, Inc.
+   Copyright 2015-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/timegm.c b/lib/timegm.c
index 9d9ab11..2ca5744 100644
--- a/lib/timegm.c
+++ b/lib/timegm.c
@@ -1,6 +1,6 @@
 /* Convert UTC calendar time to simple time.  Like mktime but assumes UTC.
 
-   Copyright (C) 1994-2018 Free Software Foundation, Inc.
+   Copyright (C) 1994-2019 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
diff --git a/lib/timespec-add.c b/lib/timespec-add.c
index 1913b97..e0a9f12 100644
--- a/lib/timespec-add.c
+++ b/lib/timespec-add.c
@@ -1,6 +1,6 @@
 /* Add two struct timespec values.
 
-   Copyright (C) 2011-2018 Free Software Foundation, Inc.
+   Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/timespec-sub.c b/lib/timespec-sub.c
index 9eac36e..48434e8 100644
--- a/lib/timespec-sub.c
+++ b/lib/timespec-sub.c
@@ -1,6 +1,6 @@
 /* Subtract two struct timespec values.
 
-   Copyright (C) 2011-2018 Free Software Foundation, Inc.
+   Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/timespec.h b/lib/timespec.h
index cc49668..26f1bc1 100644
--- a/lib/timespec.h
+++ b/lib/timespec.h
@@ -1,6 +1,6 @@
 /* timespec -- System time interface
 
-   Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2018 Free Software
+   Copyright (C) 2000, 2002, 2004-2005, 2007, 2009-2019 Free Software
    Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
diff --git a/lib/u64.h b/lib/u64.h
index 498b7f9..bb2f6ed 100644
--- a/lib/u64.h
+++ b/lib/u64.h
@@ -1,6 +1,6 @@
 /* uint64_t-like operations that work even on hosts lacking uint64_t
 
-   Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index 66f254d..7778d25 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -1,5 +1,5 @@
 /* Substitute for and wrapper around <unistd.h>.
-   Copyright (C) 2003-2018 Free Software Foundation, Inc.
+   Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -68,9 +68,11 @@
 # include <stdio.h>
 #endif
 
-/* Cygwin 1.7.1 declares unlinkat in <fcntl.h>, not in <unistd.h>.  */
+/* Cygwin 1.7.1 and Android 4.3 declare unlinkat in <fcntl.h>, not in
+   <unistd.h>.  */
 /* But avoid namespace pollution on glibc systems.  */
-#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) && defined __CYGWIN__ \
+#if (@GNULIB_UNLINKAT@ || defined GNULIB_POSIXCHECK) \
+    && (defined __CYGWIN__ || defined __ANDROID__) \
     && ! defined __GLIBC__
 # include <fcntl.h>
 #endif
@@ -113,6 +115,13 @@
 # include <netdb.h>
 #endif
 
+/* Android 4.3 declares fchownat in <sys/stat.h>, not in <unistd.h>.  */
+/* But avoid namespace pollution on glibc systems.  */
+#if (@GNULIB_FCHOWNAT@ || defined GNULIB_POSIXCHECK) && defined __ANDROID__ \
+    && !defined __GLIBC__
+# include <sys/stat.h>
+#endif
+
 /* MSVC defines off_t in <sys/types.h>.
    May also define off_t to a 64-bit type on native Windows.  */
 #if address@hidden@ || @WINDOWS_64_BIT_OFF_T@
diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h
index e3f0fcf..ee1c062 100644
--- a/lib/unlocked-io.h
+++ b/lib/unlocked-io.h
@@ -1,6 +1,6 @@
 /* Prefer faster, non-thread-safe stdio functions if available.
 
-   Copyright (C) 2001-2004, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2004, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lib/utimens.c b/lib/utimens.c
index f6c4fe3..c9b65ef 100644
--- a/lib/utimens.c
+++ b/lib/utimens.c
@@ -1,6 +1,6 @@
 /* Set file access and modification times.
 
-   Copyright (C) 2003-2018 Free Software Foundation, Inc.
+   Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
@@ -288,8 +288,8 @@ fdutimens (int fd, char const *file, struct timespec const 
timespec[2])
 
 #ifdef USE_SETFILETIME
   /* On native Windows, use SetFileTime(). See
-     <https://msdn.microsoft.com/en-us/library/ms724933.aspx>
-     <https://msdn.microsoft.com/en-us/library/ms724284.aspx>  */
+     
<https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-setfiletime>
+     
<https://docs.microsoft.com/en-us/windows/desktop/api/minwinbase/ns-minwinbase-filetime>
  */
   if (0 <= fd)
     {
       HANDLE handle;
@@ -307,10 +307,10 @@ fdutimens (int fd, char const *file, struct timespec 
const timespec[2])
       if (ts == NULL || ts[0].tv_nsec == UTIME_NOW || ts[1].tv_nsec == 
UTIME_NOW)
         {
           /* GetSystemTimeAsFileTime
-             <https://msdn.microsoft.com/en-us/library/ms724397.aspx>.
+             
<https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimeasfiletime>.
              It would be overkill to use
              GetSystemTimePreciseAsFileTime
-             <https://msdn.microsoft.com/en-us/library/hh706895.aspx>.  */
+             
<https://docs.microsoft.com/en-us/windows/desktop/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime>.
  */
           GetSystemTimeAsFileTime (&current_time);
         }
 
diff --git a/lib/utimens.h b/lib/utimens.h
index a24e62c..b174096 100644
--- a/lib/utimens.h
+++ b/lib/utimens.h
@@ -1,6 +1,6 @@
 /* Set file access and modification times.
 
-   Copyright 2012-2018 Free Software Foundation, Inc.
+   Copyright 2012-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
diff --git a/lib/verify.h b/lib/verify.h
index 3b57dde..6930645 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -1,6 +1,6 @@
 /* Compile-time assert-like macros.
 
-   Copyright (C) 2005-2006, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2005-2006, 2009-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
    here generates easier-to-read diagnostics when verify (R) fails.
 
    Define _GL_HAVE_STATIC_ASSERT to 1 if static_assert works as per C++11.
-   This will likely be supported by future GCC versions, in C++ mode.
+   This is supported by GCC 6.1.0 and later, in C++ mode.
 
    Use this only with GCC.  If we were willing to slow 'configure'
    down we could also use it with other compilers, but since this
@@ -36,9 +36,7 @@
      && !defined __cplusplus)
 # define _GL_HAVE__STATIC_ASSERT 1
 #endif
-/* The condition (99 < __GNUC__) is temporary, until we know about the
-   first G++ release that supports static_assert.  */
-#if (99 < __GNUC__) && defined __cplusplus
+#if (6 <= __GNUC__) && defined __cplusplus
 # define _GL_HAVE_STATIC_ASSERT 1
 #endif
 
diff --git a/lib/vla.h b/lib/vla.h
index 5c9735f..8f5dea7 100644
--- a/lib/vla.h
+++ b/lib/vla.h
@@ -1,6 +1,6 @@
 /* vla.h - variable length arrays
 
-   Copyright 2014-2018 Free Software Foundation, Inc.
+   Copyright 2014-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -17,6 +17,20 @@
 
    Written by Paul Eggert.  */
 
+/* The VLA_ELEMS macro does not allocate variable-length arrays (VLAs),
+   so it does not have the security or performance issues commonly
+   associated with VLAs.  VLA_ELEMS is for exploiting a C11 feature
+   where a function can start like this:
+
+     double scan_array (int n, double v[static n])
+
+   to require a caller to pass a vector V with at least N elements;
+   this allows better static checking and performance in some cases.
+   In C11 this feature means that V is a VLA, so the feature is
+   supported only if __STDC_NO_VLA__ is defined, and for compatibility
+   to platforms that do not support VLAs, VLA_ELEMS (n) expands to
+   nothing when __STDC_NO_VLA__ is not defined.  */
+
 /* A function's argument must point to an array with at least N elements.
    Example: 'int main (int argc, char *argv[VLA_ELEMS (argc)]);'.  */
 
@@ -25,3 +39,15 @@
 #else
 # define VLA_ELEMS(n) static n
 #endif
+
+/* Although C99 requires support for variable-length arrays (VLAs),
+   some C compilers never supported VLAs and VLAs are optional in C11.
+   VLAs are controversial because their allocation may be unintended
+   or awkward to support, and large VLAs might cause security or
+   performance problems.  GCC can diagnose the use of VLAs via the
+   -Wvla and -Wvla-larger-than warnings options, and defining the
+   macro GNULIB_NO_VLA disables the allocation of VLAs in Gnulib code.
+
+   The VLA_ELEMS macro is unaffected by GNULIB_NO_VLA, since it does
+   not allocate VLAs.  Programs that use VLA_ELEMS should be compiled
+   with 'gcc -Wvla-larger-than' instead of with 'gcc -Wvla'.  */
diff --git a/lib/warn-on-use.h b/lib/warn-on-use.h
index 72d67cc..7d11a15 100644
--- a/lib/warn-on-use.h
+++ b/lib/warn-on-use.h
@@ -1,5 +1,5 @@
 /* A C macro for emitting warnings if a function is used.
-   Copyright (C) 2010-2018 Free Software Foundation, Inc.
+   Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published
diff --git a/lib/xalloc-oversized.h b/lib/xalloc-oversized.h
index 3426e10..e3068c8 100644
--- a/lib/xalloc-oversized.h
+++ b/lib/xalloc-oversized.h
@@ -1,6 +1,6 @@
 /* xalloc-oversized.h -- memory allocation size checking
 
-   Copyright (C) 1990-2000, 2003-2004, 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 1990-2000, 2003-2004, 2006-2019 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
diff --git a/lisp/ChangeLog.1 b/lisp/ChangeLog.1
index 060d018..ac4c49b 100644
--- a/lisp/ChangeLog.1
+++ b/lisp/ChangeLog.1
@@ -3244,7 +3244,7 @@
                Set current buffer variables from defaults
                in case user's init file has changed them.
 
-  Copyright (C) 1985-1986, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1985-1986, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.10 b/lisp/ChangeLog.10
index 7ea47f9..8aa56b1 100644
--- a/lisp/ChangeLog.10
+++ b/lisp/ChangeLog.10
@@ -23541,7 +23541,7 @@ See ChangeLog.9 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 2001-2018 Free Software Foundation, Inc.
+    Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.11 b/lisp/ChangeLog.11
index 2eb2286..2884381 100644
--- a/lisp/ChangeLog.11
+++ b/lisp/ChangeLog.11
@@ -14321,7 +14321,7 @@ See ChangeLog.10 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2003-2011, 2013-2018 Free Software Foundation, Inc.
+  Copyright (C) 2003-2011, 2013-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.12 b/lisp/ChangeLog.12
index 3c12d5b..0c0349c 100644
--- a/lisp/ChangeLog.12
+++ b/lisp/ChangeLog.12
@@ -8873,7 +8873,7 @@
 2006-06-06  Nick Roberts  <address@hidden>
 
        * progmodes/gud.el (gud-running): Fix doc string.
-       (gud-menu-map): Use :visible instead fo :enable for debugger test.
+       (gud-menu-map): Use :visible instead of :enable for debugger test.
        (gud-tooltip-modes): Add python-mode.
        (gud-tooltip-print-command): Add pdb.  Remove perldb.
 
@@ -33334,7 +33334,7 @@ See ChangeLog.11 for earlier changes.
 ;; add-log-time-zone-rule: t
 ;; End:
 
-    Copyright (C) 2005-2018 Free Software Foundation, Inc.
+    Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.13 b/lisp/ChangeLog.13
index f088edc..9f81264 100644
--- a/lisp/ChangeLog.13
+++ b/lisp/ChangeLog.13
@@ -16697,7 +16697,7 @@ See ChangeLog.12 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2007-2018 Free Software Foundation, Inc.
+  Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.14 b/lisp/ChangeLog.14
index 84a2a25..370ed58 100644
--- a/lisp/ChangeLog.14
+++ b/lisp/ChangeLog.14
@@ -20547,7 +20547,7 @@ See ChangeLog.13 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 2008-2018 Free Software Foundation, Inc.
+    Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.15 b/lisp/ChangeLog.15
index c4d7be5..b22661f 100644
--- a/lisp/ChangeLog.15
+++ b/lisp/ChangeLog.15
@@ -22802,7 +22802,7 @@ See ChangeLog.14 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2009-2018 Free Software Foundation, Inc.
+  Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.16 b/lisp/ChangeLog.16
index 279ee3e..3e2ddd9 100644
--- a/lisp/ChangeLog.16
+++ b/lisp/ChangeLog.16
@@ -25223,7 +25223,7 @@ See ChangeLog.15 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2011-2018 Free Software Foundation, Inc.
+  Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.17 b/lisp/ChangeLog.17
index 64b9a14..ed3b4a9 100644
--- a/lisp/ChangeLog.17
+++ b/lisp/ChangeLog.17
@@ -26294,7 +26294,7 @@ See ChangeLog.16 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2011-2018 Free Software Foundation, Inc.
+  Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.2 b/lisp/ChangeLog.2
index a5a654a..e8675b9 100644
--- a/lisp/ChangeLog.2
+++ b/lisp/ChangeLog.2
@@ -3992,7 +3992,7 @@
 
 See ChangeLog.1 for earlier changes.
 
-    Copyright (C) 1986-1988, 2001-2018 Free Software Foundation, Inc.
+    Copyright (C) 1986-1988, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.3 b/lisp/ChangeLog.3
index ae91947..38e6844 100644
--- a/lisp/ChangeLog.3
+++ b/lisp/ChangeLog.3
@@ -12433,7 +12433,7 @@ See ChangeLog.2 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 1989, 1993, 2001-2018 Free Software Foundation, Inc.
+    Copyright (C) 1989, 1993, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.4 b/lisp/ChangeLog.4
index 0374e1b..74f09e5 100644
--- a/lisp/ChangeLog.4
+++ b/lisp/ChangeLog.4
@@ -8934,7 +8934,7 @@ See ChangeLog.3 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+    Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.5 b/lisp/ChangeLog.5
index 3a68421..0976a15 100644
--- a/lisp/ChangeLog.5
+++ b/lisp/ChangeLog.5
@@ -9268,7 +9268,7 @@ See ChangeLog.4 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 1994-1995, 2001-2018 Free Software Foundation, Inc.
+    Copyright (C) 1994-1995, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.6 b/lisp/ChangeLog.6
index 0d0df58..d68e6fc 100644
--- a/lisp/ChangeLog.6
+++ b/lisp/ChangeLog.6
@@ -8021,7 +8021,7 @@ See ChangeLog.5 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 1995-1996, 2001-2018 Free Software Foundation, Inc.
+    Copyright (C) 1995-1996, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.7 b/lisp/ChangeLog.7
index 27cbe10..b8e0f10 100644
--- a/lisp/ChangeLog.7
+++ b/lisp/ChangeLog.7
@@ -12376,7 +12376,7 @@
        when turning on Encoded-kbd mode, and recover it when turning off
        Encoded-kbd mode.  Set encoded-kbd-iso2022-designations correctly.
        (encoded-kbd-self-insert-iso2022-7bit): Call charset-dimension
-       instead fo charset-bytes.
+       instead of charset-bytes.
        (encoded-kbd-self-insert-iso2022-8bit): Likewise.
 
        * language/china-util.el (setup-chinese-gb-environment): Do not
@@ -23110,7 +23110,7 @@ See ChangeLog.6 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-       Copyright (C) 1997-1998, 2001-2018 Free Software Foundation,
+       Copyright (C) 1997-1998, 2001-2019 Free Software Foundation,
        Inc.
 
   This file is part of GNU Emacs.
diff --git a/lisp/ChangeLog.8 b/lisp/ChangeLog.8
index 13c7f65..cd09053 100644
--- a/lisp/ChangeLog.8
+++ b/lisp/ChangeLog.8
@@ -9992,7 +9992,7 @@ See ChangeLog.7 for earlier changes.
 ;; add-log-time-zone-rule: t
 ;; End:
 
-    Copyright (C) 1999, 2001-2018 Free Software Foundation, Inc.
+    Copyright (C) 1999, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/ChangeLog.9 b/lisp/ChangeLog.9
index 87d3818..ebf9509 100644
--- a/lisp/ChangeLog.9
+++ b/lisp/ChangeLog.9
@@ -20685,7 +20685,7 @@ See ChangeLog.8 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-    Copyright (C) 2000-2011, 2013-2018 Free Software Foundation, Inc.
+    Copyright (C) 2000-2011, 2013-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index c447598..9bcd5a8 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 2000-2018 Free Software Foundation, Inc.
+# Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -220,7 +220,7 @@ update-subdirs:
           $(srcdir)/../build-aux/update-subdirs $$file; \
        done;
 
-.PHONY: updates repo-update update-authors update-gnus-news
+.PHONY: updates repo-update update-authors
 
 # Some modes of make-dist use this.
 updates: update-subdirs autoloads finder-data custom-deps
@@ -233,17 +233,12 @@ updates: update-subdirs autoloads finder-data custom-deps
 # this directory's autoloads rule.
 repo-update: compile finder-data custom-deps
 
-# Update etc/AUTHORS and etc/GNUS-NEWS.
+# Update etc/AUTHORS
 
 update-authors:
        $(emacs) -L "$(top_srcdir)/admin" -l authors \
          -f batch-update-authors "$(top_srcdir)/etc/AUTHORS" "$(top_srcdir)"
 
-update-gnus-news:
-       $(emacs) -L "$(top_srcdir)/doc/misc" -l gnus-news -f batch-gnus-news \
-         "$(top_srcdir)/doc/misc/gnus-news.texi" \
-         "$(top_srcdir)/etc/GNUS-NEWS"
-
 FORCE:
 .PHONY: FORCE
 
@@ -321,14 +316,16 @@ compile-targets: $(TARGETS)
 # Compile all the Elisp files that need it.  Beware: it approximates
 # 'no-byte-compile', so watch out for false-positives!
 compile-main: gen-lisp compile-clean
-       @(cd $(lisp) && \
+       @(cd $(lisp) &&                              \
        els=`echo "${SUBDIRS_REL} " | sed -e 's|/\./|/|g' -e 's|/\. | |g' -e 
's| |/*.el |g'`; \
-       for el in ${MAIN_FIRST} $$els; do \
-         test -f $$el || continue; \
-         test ! -f $${el}c && GREP_OPTIONS= grep '^;.*no-byte-compile: t' $$el 
> /dev/null && continue; \
-         echo "$${el}c"; \
-       done | xargs $(XARGS_LIMIT) echo) | \
-       while read chunk; do \
+       for el in ${MAIN_FIRST} $$els; do            \
+         test -f $$el || continue;                  \
+         test ! -f $${el}c &&                       \
+             GREP_OPTIONS= grep '^;.*[^a-zA-Z]no-byte-compile: *t' $$el > 
/dev/null && \
+             continue;                              \
+         echo "$${el}c";                            \
+       done | xargs $(XARGS_LIMIT) echo) |          \
+       while read chunk; do                         \
          $(MAKE) compile-targets TARGETS="$$chunk"; \
        done
 
@@ -350,7 +347,9 @@ compile-clean:
 ## with ../src.  See comments above for loaddefs.
 gen-lisp: leim semantic
 
-leim:
+# (re)compile titdic-cnv before recursing into `leim` since its used to
+# generate some of the Quail source files from tables.
+leim: $(lisp)/international/titdic-cnv.elc
        $(MAKE) -C ../leim all EMACS="$(EMACS)"
 
 semantic:
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 20a967d..855d80c 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -1,6 +1,6 @@
 ;;; abbrev.el --- abbrev mode commands for Emacs -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1987, 1992, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1985-1987, 1992, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: address@hidden
@@ -147,11 +147,12 @@ Otherwise display all abbrevs."
 (defun edit-abbrevs ()
   "Alter abbrev definitions by editing a list of them.
 Selects a buffer containing a list of abbrev definitions with
-point located in the abbrev table of current buffer.
+point located in the abbrev table for the current buffer, and
+turns on `edit-abbrevs-mode' in that buffer.
 You can edit them and type \\<edit-abbrevs-map>\\[edit-abbrevs-redefine] to 
redefine abbrevs
 according to your editing.
-Buffer contains a header line for each abbrev table,
- which is the abbrev table name in parentheses.
+The abbrevs editing buffer contains a header line for each
+abbrev table, which is the abbrev table name in parentheses.
 This is followed by one line per abbrev in that table:
 NAME   USECOUNT   EXPANSION   HOOK
 where NAME and EXPANSION are strings with quotes,
@@ -1036,7 +1037,9 @@ SORTFUN is passed to `sort' to change the default 
ordering."
 ;; Keep it after define-abbrev-table, since define-derived-mode uses
 ;; define-abbrev-table.
 (define-derived-mode edit-abbrevs-mode fundamental-mode "Edit-Abbrevs"
-  "Major mode for editing the list of abbrev definitions.")
+  "Major mode for editing the list of abbrev definitions.
+This mode is for editing abbrevs in a buffer prepared by `edit-abbrevs',
+which see.")
 
 (provide 'abbrev)
 
diff --git a/lisp/align.el b/lisp/align.el
index 941fa3a..fd88d0e 100644
--- a/lisp/align.el
+++ b/lisp/align.el
@@ -1,6 +1,6 @@
 ;;; align.el --- align text to a specific column, by regexp -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 ;; Maintainer: address@hidden
@@ -399,7 +399,7 @@ The possible settings for `align-region-separate' are:
                   (lambda (end reverse)
                     (funcall (if reverse 're-search-backward
                                're-search-forward)
-                             (concat "[^ \t\n\\\\]"
+                             (concat "[^ \t\n\\]"
                                      (regexp-quote comment-start)
                                      "\\(.+\\)$") end t))))
      (modes    . align-open-comment-modes))
@@ -438,7 +438,7 @@ The possible settings for `align-region-separate' are:
      (tab-stop . nil))
 
     (perl-assignment
-     (regexp   . ,(concat "[^=!^&*-+<>/| \t\n]\\(\\s-*\\)=[~>]?"
+     (regexp   . ,(concat "[^=!^&*+<>/| \t\n-]\\(\\s-*\\)=[~>]?"
                          "\\(\\s-*\\)\\([^>= \t\n]\\|$\\)"))
      (group    . (1 2))
      (modes    . align-perl-modes)
@@ -452,7 +452,7 @@ The possible settings for `align-region-separate' are:
      (tab-stop . nil))
 
     (make-assignment
-     (regexp   . "^\\s-*\\w+\\(\\s-*\\):?=\\(\\s-*\\)\\([^\t\n \\\\]\\|$\\)")
+     (regexp   . "^\\s-*\\w+\\(\\s-*\\):?=\\(\\s-*\\)\\([^\t\n \\]\\|$\\)")
      (group    . (1 2))
      (modes    . '(makefile-mode))
      (tab-stop . nil))
@@ -759,7 +759,7 @@ The following attributes are meaningful:
          (lambda (end reverse)
            (funcall (if reverse 're-search-backward
                       're-search-forward)
-                    (concat "[^ \t\n\\\\]"
+                    (concat "[^ \t\n\\]"
                             (regexp-quote comment-start)
                             "\\(.+\\)$") end t))))
      (modes  . align-open-comment-modes))
diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el
index 5abd978..67fce32 100644
--- a/lisp/allout-widgets.el
+++ b/lisp/allout-widgets.el
@@ -1,6 +1,6 @@
 ;; allout-widgets.el --- Visually highlight allout outline structure.
 
-;; Copyright (C) 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Ken Manheimer <ken dot manheimer at gmail...>
 ;; Maintainer: Ken Manheimer <ken dot manheimer at gmail...>
diff --git a/lisp/allout.el b/lisp/allout.el
index a123ece..b3b87e5 100644
--- a/lisp/allout.el
+++ b/lisp/allout.el
@@ -1,6 +1,6 @@
 ;;; allout.el --- extensive outline mode for use alone and with other modes
 
-;; Copyright (C) 1992-1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Ken Manheimer <ken dot manheimer at gmail...>
 ;; Maintainer: Ken Manheimer <ken dot manheimer at gmail...>
@@ -4351,7 +4351,7 @@ subtopics into siblings of the item."
             (let ((children-chart (allout-chart-subtree 1)))
               (if (listp (car children-chart))
                   ;; whoops:
-                  (setq children-chart (allout-flatten children-chart)))
+                  (setq children-chart (flatten-tree children-chart)))
               (save-excursion
                 (dolist (child-point children-chart)
                   (goto-char child-point)
@@ -5788,7 +5788,7 @@ BULLET string, and a list of TEXT strings for the body."
                                        ; "\end{verbatim}" in text,
                                        ; it's special:
        (if (and body-content
-                (setq bop (string-match "\\end{verbatim}" curr-line)))
+                (setq bop (string-match "\\\\end{verbatim}" curr-line)))
            (setq curr-line (concat (substring curr-line 0 bop)
                                    ">"
                                    (substring curr-line bop))))
@@ -6547,14 +6547,7 @@ If BEG is bigger than END we return 0."
   (apply 'concat
          (mapcar (lambda (char) (if (= char ?%) "%%" (char-to-string char)))
                  string)))
-;;;_  : lists
-;;;_   > allout-flatten (list)
-(defun allout-flatten (list)
-  "Return a list of all atoms in list."
-  ;; classic.
-  (cond ((null list) nil)
-        ((atom (car list)) (cons (car list) (allout-flatten (cdr list))))
-        (t (append (allout-flatten (car list)) (allout-flatten (cdr list))))))
+(define-obsolete-function-alias 'allout-flatten #'flatten-tree "27.1")
 ;;;_  : Compatibility:
 ;;;_   : xemacs undo-in-progress provision:
 (unless (boundp 'undo-in-progress)
diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el
index 6fb7acf..d3b8d06 100644
--- a/lisp/ansi-color.el
+++ b/lisp/ansi-color.el
@@ -1,6 +1,6 @@
 ;;; ansi-color.el --- translate ANSI escape sequences into faces -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <address@hidden>
 ;; Maintainer: Alex Schroeder <address@hidden>
diff --git a/lisp/apropos.el b/lisp/apropos.el
index b774036..1b86f5b 100644
--- a/lisp/apropos.el
+++ b/lisp/apropos.el
@@ -1,6 +1,6 @@
 ;;; apropos.el --- apropos commands for users and programmers
 
-;; Copyright (C) 1989, 1994-1995, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1989, 1994-1995, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Joe Wells <address@hidden>
@@ -681,19 +681,19 @@ the output includes key-bindings of commands."
             (re (concat "\\(?:\\`\\|[\\/]\\)" (regexp-quote file)
                         "\\(\\.\\|\\'\\)")))
         (while (and lh (null lh-entry))
-          (if (and (caar lh) (string-match re (caar lh)))
+          (if (and (stringp (caar lh)) (string-match re (caar lh)))
               (setq lh-entry (car lh))
             (setq lh (cdr lh)))))
       (unless lh-entry (error "Unknown library `%s'" file)))
     (dolist (x (cdr lh-entry))
       (pcase (car-safe x)
        ;; (autoload (push (cdr x) autoloads))
-       (`require (push (cdr x) requires))
-       (`provide (push (cdr x) provides))
-        (`t nil) ; Skip "was an autoload" entries.
+       ('require (push (cdr x) requires))
+       ('provide (push (cdr x) provides))
+        ('t nil) ; Skip "was an autoload" entries.
         ;; FIXME: Print information about each individual method: both
         ;; its docstring and specializers (bug#21422).
-        (`cl-defmethod (push (cadr x) provides))
+        ('cl-defmethod (push (cadr x) provides))
        (_ (push (or (cdr-safe x) x) symbols))))
     (let ((apropos-pattern "")) ;Dummy binding for apropos-symbols-internal.
       (apropos-symbols-internal
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index 50048c0..6a58d61 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -1,6 +1,6 @@
 ;;; arc-mode.el --- simple editing of archives
 
-;; Copyright (C) 1995, 1997-1998, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1995, 1997-1998, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Morten Welinder <address@hidden>
@@ -637,7 +637,7 @@ the mode is invalid.  If ERROR is nil then nil will be 
returned."
 
 (defun archive-unixdate (low high)
   "Stringify Unix (LOW HIGH) date."
-  (let* ((time (cons high low))
+  (let* ((time (list high low))
         (str (current-time-string time)))
     (format "%s-%s-%s"
            (substring str 8 10)
@@ -646,8 +646,7 @@ the mode is invalid.  If ERROR is nil then nil will be 
returned."
 
 (defun archive-unixtime (low high)
   "Stringify Unix (LOW HIGH) time."
-  (let ((str (current-time-string (cons high low))))
-    (substring str 11 19)))
+  (format-time-string "%H:%M:%S" (list high low)))
 
 (defun archive-get-lineno ()
   (if (>= (point) archive-file-list-start)
@@ -969,8 +968,8 @@ using `make-temp-file', and the generated name is returned."
                   (jka-compr-inhibit t))
               (write-region (point-min) (point-max) tmpfile nil 'quiet))
             (erase-buffer)
-            (let ((coding-system-for-read 'no-conversion))
-              (insert-file-contents tmpfile)))
+            (set-buffer-multibyte t)
+            (insert-file-contents tmpfile))
         (delete-file tmpfile)))))
 
 (defun archive-file-name-handler (op &rest args)
@@ -1535,7 +1534,7 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
     (apply #'vector (nreverse files))))
 
 (defun archive-arc-rename-entry (newname descr)
-  (if (string-match "[:\\\\/]" newname)
+  (if (string-match "[:\\/]" newname)
       (error "File names in arc files must not contain a directory component"))
   (if (> (length newname) 12)
       (error "File names in arc files are limited to 12 characters"))
@@ -2017,7 +2016,7 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
       (call-process "lsar" nil t nil "-l" (or file copy))
       (if copy (delete-file copy))
       (goto-char (point-min))
-      (re-search-forward "^\\(\s+=+\s?+\\)+\n")
+      (re-search-forward "^\\(\s+=+\s*\\)+\n")
       (while (looking-at (concat "^\s+[0-9.]+\s+D?-+\s+"   ; Flags
                                  "\\([0-9-]+\\)\s+"        ; Size
                                  "\\([-0-9.%]+\\|-+\\)\s+" ; Ratio
@@ -2066,7 +2065,7 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
       ;; The code below assumes the name is relative and may do undesirable
       ;; things otherwise.
       (error "Can't extract files with non-relative names")
-    (archive-extract-by-file archive name `("unar" "-no-directory" "-o") 
"Successfully extracted")))
+    (archive-extract-by-file archive name '("unar" "-no-directory" "-o") 
"Successfully extracted")))
 
 ;;; Section: Rar self-extracting .exe archives.
 
diff --git a/lisp/array.el b/lisp/array.el
index 242511b..2fffe01 100644
--- a/lisp/array.el
+++ b/lisp/array.el
@@ -1,6 +1,6 @@
 ;;; array.el --- array editing commands for GNU Emacs
 
-;; Copyright (C) 1987, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1987, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: David M. Brown
 ;; Maintainer: address@hidden
diff --git a/lisp/auth-source-pass.el b/lisp/auth-source-pass.el
index cebe8c2..4283ed0 100644
--- a/lisp/auth-source-pass.el
+++ b/lisp/auth-source-pass.el
@@ -1,6 +1,6 @@
 ;;; auth-source-pass.el --- Integrate auth-source with password-store -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2015, 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015, 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Damien Cassou <address@hidden>,
 ;;         Nicolas Petton <address@hidden>
@@ -134,12 +134,12 @@ ENTRY is the name of a password-store entry."
 (defun auth-source-pass--parse-secret (contents)
   "Parse the password-store data in the string CONTENTS and return its secret.
 The secret is the first line of CONTENTS."
-  (car (split-string contents "\\\n" t)))
+  (car (split-string contents "\n" t)))
 
 (defun auth-source-pass--parse-data (contents)
   "Parse the password-store data in the string CONTENTS and return an alist.
 CONTENTS is the contents of a password-store formatted file."
-  (let ((lines (split-string contents "\\\n" t "\\\s")))
+  (let ((lines (split-string contents "\n" t "[ \t]+")))
     (seq-remove #'null
                 (mapcar (lambda (line)
                           (let ((pair (mapcar (lambda (s) (string-trim s))
@@ -189,7 +189,7 @@ often."
   (let ((store-dir (expand-file-name "~/.password-store/")))
     (mapcar
      (lambda (file) (file-name-sans-extension (file-relative-name file 
store-dir)))
-     (directory-files-recursively store-dir "\.gpg$"))))
+     (directory-files-recursively store-dir "\\.gpg$"))))
 
 (defun auth-source-pass--find-all-by-entry-name (entryname user)
   "Search the store for all entries either matching ENTRYNAME/USER or 
ENTRYNAME.
diff --git a/lisp/auth-source.el b/lisp/auth-source.el
index fd529b3..74c4491 100644
--- a/lisp/auth-source.el
+++ b/lisp/auth-source.el
@@ -1,6 +1,6 @@
 ;;; auth-source.el --- authentication sources for Gnus and Emacs -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Ted Zlatanov <address@hidden>
 ;; Keywords: news
@@ -167,7 +167,7 @@ let-binding."
 (defcustom auth-source-save-behavior 'ask
   "If set, auth-source will respect it for save behavior."
   :version "23.2" ;; No Gnus
-  :type `(choice
+  :type '(choice
           :tag "auth-source new token save behavior"
           (const :tag "Always save" t)
           (const :tag "Never save" nil)
@@ -200,7 +200,7 @@ Note that if EPA/EPG is not available, this should NOT be 
used."
 (defcustom auth-source-do-cache t
   "Whether auth-source should cache information with `password-cache'."
   :version "23.2" ;; No Gnus
-  :type `boolean)
+  :type 'boolean)
 
 (defcustom auth-source-debug nil
   "Whether auth-source should log debug messages.
@@ -214,7 +214,7 @@ for passwords).
 If the value is a function, debug messages are logged by calling
  that function using the same arguments as `message'."
   :version "23.2" ;; No Gnus
-  :type `(choice
+  :type '(choice
           :tag "auth-source debugging mode"
           (const :tag "Log using `message' to the *Messages* buffer" t)
           (const :tag "Log all trivia with `message' to the *Messages* buffer"
diff --git a/lisp/autoarg.el b/lisp/autoarg.el
index 4bf5785..97e9d6b 100644
--- a/lisp/autoarg.el
+++ b/lisp/autoarg.el
@@ -1,6 +1,6 @@
 ;;; autoarg.el --- make digit keys supply prefix args
 
-;; Copyright (C) 1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author:  Dave Love <address@hidden>
 ;; Created: 1998-09-04
diff --git a/lisp/autoinsert.el b/lisp/autoinsert.el
index cb0d151..f7ecfe2 100644
--- a/lisp/autoinsert.el
+++ b/lisp/autoinsert.el
@@ -1,6 +1,6 @@
 ;;; autoinsert.el --- automatic mode-dependent insertion of text into new files
 
-;; Copyright (C) 1985-1987, 1994-1995, 1998, 2000-2018 Free Software
+;; Copyright (C) 1985-1987, 1994-1995, 1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Charlie Martin <address@hidden>
diff --git a/lisp/autorevert.el b/lisp/autorevert.el
index fc3469e..bc7c616 100644
--- a/lisp/autorevert.el
+++ b/lisp/autorevert.el
@@ -1,6 +1,6 @@
 ;;; autorevert.el --- revert buffers when files on disk change  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1997-1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren
 ;; Keywords: convenience
@@ -515,32 +515,44 @@ will use an up-to-date value of `auto-revert-interval'"
 
 (defun auto-revert-notify-add-watch ()
   "Enable file notification for current buffer's associated file."
-  ;; We can assume that `buffer-file-name' and
-  ;; `auto-revert-notify-watch-descriptor' are non-nil.
+  ;; We can assume that `auto-revert-notify-watch-descriptor' is nil.
   (unless (or auto-revert-notify-watch-descriptor
               (string-match auto-revert-notify-exclude-dir-regexp
                            (expand-file-name default-directory))
              (file-symlink-p (or buffer-file-name default-directory)))
-    (setq auto-revert-notify-watch-descriptor
-         (ignore-errors
-           (if buffer-file-name
-               (file-notify-add-watch
-                (expand-file-name buffer-file-name default-directory)
-                '(change attribute-change)
-                'auto-revert-notify-handler)
-             (file-notify-add-watch
-              (expand-file-name default-directory)
-              '(change)
-              'auto-revert-notify-handler))))
-    (when auto-revert-notify-watch-descriptor
-      (setq auto-revert-notify-modified-p t)
-      (puthash
-      auto-revert-notify-watch-descriptor
-       (cons (current-buffer)
-            (gethash auto-revert-notify-watch-descriptor
-                     auto-revert-notify-watch-descriptor-hash-list))
+    ;; Check, whether this has been activated already.
+    (let ((file (if buffer-file-name
+                   (expand-file-name buffer-file-name default-directory)
+                 (expand-file-name default-directory))))
+      (maphash
+       (lambda (key _value)
+         (when (and
+                (file-notify-valid-p key)
+                (equal (file-notify--watch-absolute-filename
+                        (gethash key file-notify-descriptors))
+                       (directory-file-name file))
+                (equal (file-notify--watch-callback
+                        (gethash key file-notify-descriptors))
+                       'auto-revert-notify-handler))
+         (setq auto-revert-notify-watch-descriptor key)))
        auto-revert-notify-watch-descriptor-hash-list)
-      (add-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch nil t))))
+      ;; Create a new watch if needed.
+      (unless auto-revert-notify-watch-descriptor
+        (setq auto-revert-notify-watch-descriptor
+             (ignore-errors
+               (file-notify-add-watch
+                file
+                 (if buffer-file-name '(change attribute-change) '(change))
+                 'auto-revert-notify-handler))))
+      (when auto-revert-notify-watch-descriptor
+        (setq auto-revert-notify-modified-p t)
+        (puthash
+         auto-revert-notify-watch-descriptor
+         (cons (current-buffer)
+              (gethash auto-revert-notify-watch-descriptor
+                       auto-revert-notify-watch-descriptor-hash-list))
+         auto-revert-notify-watch-descriptor-hash-list)
+        (add-hook 'kill-buffer-hook #'auto-revert-notify-rm-watch nil t)))))
 
 ;; If we have file notifications, we want to update the auto-revert buffers
 ;; immediately when a notification occurs. Since file updates can happen very
@@ -626,10 +638,7 @@ no more reverts are possible until the next call of
                           auto-revert-buffers-counter)
                   (auto-revert-handler)
                   (setq auto-revert-buffers-counter-lockedout
-                        auto-revert-buffers-counter))
-
-                ;; No need to check other buffers.
-                (cl-return)))))))))
+                        auto-revert-buffers-counter))))))))))
 
 (defun auto-revert-active-p ()
   "Check if auto-revert is active (in current buffer or globally)."
@@ -758,6 +767,16 @@ the timer when no buffers need to be checked."
                    (buffer-list)
                  auto-revert-buffer-list))
          remaining new)
+      ;; Buffers with remote contents shall be reverted only if the
+      ;; connection is established already.
+      (setq bufs (delq nil
+                       (mapcar
+                        (lambda (buf)
+                          (with-current-buffer buf
+                            (and (or (not (file-remote-p default-directory))
+                                     (file-remote-p default-directory nil t))
+                                 buf)))
+                        bufs)))
       ;; Partition `bufs' into two halves depending on whether or not
       ;; the buffers are in `auto-revert-remaining-buffers'.  The two
       ;; halves are then re-joined with the "remaining" buffers at the
@@ -797,7 +816,7 @@ the timer when no buffers need to be checked."
       (when (and (not global-auto-revert-mode)
                 (null auto-revert-buffer-list))
         (if (timerp auto-revert-timer)
-           (cancel-timer auto-revert-timer))
+            (cancel-timer auto-revert-timer))
        (setq auto-revert-timer nil)))))
 
 
diff --git a/lisp/avoid.el b/lisp/avoid.el
index 5e99dd8..7d69fa2 100644
--- a/lisp/avoid.el
+++ b/lisp/avoid.el
@@ -1,6 +1,6 @@
 ;;; avoid.el --- make mouse pointer stay out of the way of editing
 
-;; Copyright (C) 1993-1994, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <address@hidden>
 ;; Keywords: mouse
@@ -205,8 +205,8 @@ If you want the mouse banished to a different corner set
                               'frame-or-window
                               mouse-avoidance-banish-position 'eq))
          (list-values        (pcase fra-or-win
-                               (`frame (list 0 0 (frame-width) (frame-height)))
-                               (`window (window-edges))))
+                               ('frame (list 0 0 (frame-width) (frame-height)))
+                               ('window (window-edges))))
          (alist              (cl-loop for v in list-values
                                       for k in '(left top right bottom)
                                       collect (cons k v)))
@@ -223,11 +223,11 @@ If you want the mouse banished to a different corner set
                               'top-or-bottom-pos
                               mouse-avoidance-banish-position #'eq))
          (side-fn            (pcase side
-                               (`left '+)
-                               (`right '-)))
+                               ('left '+)
+                               ('right '-)))
          (top-or-bottom-fn   (pcase top-or-bottom
-                               (`top '+)
-                               (`bottom '-))))
+                               ('top '+)
+                               ('bottom '-))))
     (cons (funcall side-fn                        ; -/+
                    (assoc-default side alist 'eq) ; right or left
                    side-dist)                     ; distance from side
diff --git a/lisp/battery.el b/lisp/battery.el
index 192a6ae..49b01d5 100644
--- a/lisp/battery.el
+++ b/lisp/battery.el
@@ -1,6 +1,6 @@
 ;;; battery.el --- display battery status information
 
-;; Copyright (C) 1997-1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Ralph Schleicher <address@hidden>
 ;; Keywords: hardware
@@ -375,12 +375,12 @@ The following %-sequences are provided:
                            last-full-capacity design-capacity))
     (and capacity rate
         (setq minutes (if (zerop rate) 0
-                        (floor (* (/ (float (if (string= charging-state
-                                                         "charging")
-                                                (- full-capacity capacity)
-                                              capacity))
-                                     rate)
-                                  60)))
+                        (floor (* (if (string= charging-state
+                                               "charging")
+                                      (- full-capacity capacity)
+                                    capacity)
+                                  60)
+                               rate))
               hours (/ minutes 60)))
     (list (cons ?c (or (and capacity (number-to-string capacity)) "N/A"))
          (cons ?L (or (battery-search-for-one-match-in-files
@@ -414,8 +414,7 @@ The following %-sequences are provided:
          (cons ?p (or (and full-capacity capacity
                            (> full-capacity 0)
                            (number-to-string
-                            (floor (/ capacity
-                                      (/ (float full-capacity) 100)))))
+                            (floor (* 100 capacity) full-capacity)))
                       "N/A")))))
 
 
@@ -471,9 +470,9 @@ The following %-sequences are provided:
                  "POWER_SUPPLY_\\(CURRENT\\|POWER\\)_NOW=\\([0-9]*\\)$"
                  nil t)
            (cl-incf power-now
-                    (* (float (string-to-number (match-string 2)))
+                    (* (string-to-number (match-string 2))
                        (if (eq (char-after (match-beginning 1)) ?C)
-                           voltage-now 1.0))))
+                           voltage-now 1))))
          (goto-char (point-min))
          (when (re-search-forward "POWER_SUPPLY_TEMP=\\([0-9]*\\)$" nil t)
            (setq temperature (match-string 1)))
@@ -585,9 +584,7 @@ The following %-sequences are provided:
     (when seconds
       (setq minutes (/ seconds 60)
             hours (/ minutes 60)
-            remaining-time
-            (format "%d:%02d" (truncate hours)
-                    (- (truncate minutes) (* 60 (truncate hours))))))
+           remaining-time (format "%d:%02d" hours (mod minutes 60))))
     (list (cons ?c (or (and energy
                             (number-to-string (round (* 1000 energy))))
                        "N/A"))
@@ -620,46 +617,71 @@ The following %-sequences are provided:
 %h Remaining battery charge time in hours
 %t Remaining battery charge time in the form `h:min'"
   (let* ((os-name (car (split-string
-                       (shell-command-to-string "/usr/bin/uname"))))
-        (apm-flag (if (equal os-name "OpenBSD") "P" "s"))
-        (apm-cmd (concat "/usr/sbin/apm -ablm" apm-flag))
-        (apm-output (split-string (shell-command-to-string apm-cmd)))
-        ;; Battery status
-        (battery-status
-         (let ((stat (string-to-number (nth 0 apm-output))))
-           (cond ((eq stat 0) '("high" . ""))
-                 ((eq stat 1) '("low" . "-"))
-                 ((eq stat 2) '("critical" . "!"))
-                 ((eq stat 3) '("charging" . "+"))
-                 ((eq stat 4) '("absent" . nil)))))
-        ;; Battery percentage
-        (battery-percentage (nth 1 apm-output))
-        ;; Battery life
-        (battery-life (nth 2 apm-output))
-        ;; AC status
-        (line-status
-         (let ((ac (string-to-number (nth 3 apm-output))))
-           (cond ((eq ac 0) "disconnected")
-                 ((eq ac 1) "connected")
-                 ((eq ac 2) "backup power"))))
-        ;; Advanced power savings mode
-        (apm-mode
-         (let ((apm (string-to-number (nth 4 apm-output))))
-           (if (string= os-name "OpenBSD")
-               (cond ((eq apm 0) "manual")
-                     ((eq apm 1) "automatic")
-                     ((eq apm 2) "cool running"))
-             (if (eq apm 1) "on" "off"))))
+                        ;; FIXME: Can't we use something like `system-type'?
+                        (shell-command-to-string "/usr/bin/uname"))))
+         (apm-flag (pcase os-name
+                     ("OpenBSD" "mP")
+                     ("FreeBSD" "st")
+                     (_         "ms")))
+         (apm-cmd (concat "/usr/sbin/apm -abl" apm-flag))
+         (apm-output (split-string (shell-command-to-string apm-cmd)))
+         (indices (pcase os-name
+                    ;; FreeBSD's manpage documents that multiple
+                    ;; outputs are ordered by "the order in which
+                    ;; they're listed in the manpage", which is alphabetical
+                    ;; and is also the order in which we pass them.
+                    ("FreeBSD" '((ac . 0)
+                                 (battery-status . 1)
+                                 (battery-percent . 2)
+                                 (apm-mode . 3)
+                                 (battery-life . 4)))
+                    ;; For NetBSD and OpenBSD, the manpage doesn't document
+                    ;; the order.  The previous code used this order, so let's
+                    ;; assume it's right.
+                    (_         '((ac . 3)
+                                 (battery-status . 0)
+                                 (battery-percent . 1)
+                                 (apm-mode . 4)
+                                 (battery-life . 2)))))
+         ;; Battery status
+         (battery-status
+          (pcase (string-to-number
+                  (nth (alist-get 'battery-status indices) apm-output))
+            (0 '("high" . ""))
+            (1 '("low" . "-"))
+            (2 '("critical" . "!"))
+            (3 '("charging" . "+"))
+            (4 '("absent" . nil))))
+         ;; Battery percentage
+         (battery-percentage
+          (nth (alist-get 'battery-percent indices) apm-output))
+         ;; Battery life
+         (battery-life (nth (alist-get 'battery-life indices) apm-output))
+         ;; AC status
+         (line-status
+          (pcase (string-to-number (nth (alist-get 'ac indices) apm-output))
+            (0 "disconnected")
+            (1 "connected")
+            (2 "backup power")))
+         ;; Advanced power savings mode
+         (apm-mode
+          (let ((apm (string-to-number
+                      (nth (alist-get 'apm-mode indices) apm-output))))
+            (if (string= os-name "OpenBSD")
+                (pcase apm
+                  (0 "manual")
+                  (1 "automatic")
+                 (2 "cool running"))
+             (if (eql apm 1) "on" "off"))))
         seconds minutes hours remaining-time)
     (unless (member battery-life '("unknown" "-1"))
       (if (member os-name '("OpenBSD" "NetBSD"))
          (setq minutes (string-to-number battery-life)
                seconds (* 60 minutes))
        (setq seconds (string-to-number battery-life)
-             minutes (truncate (/ seconds 60))))
-      (setq hours (truncate (/ minutes 60))
-           remaining-time (format "%d:%02d" hours
-                                  (- minutes (* 60 hours)))))
+             minutes (truncate seconds 60)))
+      (setq hours (truncate minutes 60)
+           remaining-time (format "%d:%02d" hours (mod minutes 60))))
     (list (cons ?L (or line-status "N/A"))
          (cons ?B (or (car battery-status) "N/A"))
          (cons ?b (or (cdr battery-status) "N/A"))
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 76383ad..744bcc3 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -1,6 +1,6 @@
 ;;; bindings.el --- define standard key bindings and some variables
 
-;; Copyright (C) 1985-1987, 1992-1996, 1999-2018 Free Software
+;; Copyright (C) 1985-1987, 1992-1996, 1999-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -417,7 +417,7 @@ zero, otherwise they start from one."
 This option specifies both the field width and the type of offset
 displayed in `mode-line-position', a component of the default
 `mode-line-format'."
-  :type `(radio
+  :type '(radio
           (const :tag "nil:  No offset is displayed" nil)
           (const :tag "\"%o\": Proportion of \"travel\" of the window through 
the buffer"
                  (-3 "%o"))
@@ -724,11 +724,11 @@ okay.  See `mode-line-format'.")
       ;; FIXME: Maybe beginning-of-line, beginning-of-buffer, end-of-line,
       ;; end-of-buffer, end-of-file, buffer-read-only, and
       ;; file-supersession should all be user-errors!
-      `(beginning-of-line beginning-of-buffer end-of-line
-       end-of-buffer end-of-file buffer-read-only
-       file-supersession mark-inactive
-        user-error ;; That's the main one!
-        ))
+      '(beginning-of-line beginning-of-buffer end-of-line
+                         end-of-buffer end-of-file buffer-read-only
+                         file-supersession mark-inactive
+                          user-error ;; That's the main one!
+                          ))
 
 (make-variable-buffer-local 'indent-tabs-mode)
 
@@ -1029,6 +1029,13 @@ if `inhibit-field-text-motion' is non-nil."
 (define-key search-map "hu"   'unhighlight-regexp)
 (define-key search-map "hf"   'hi-lock-find-patterns)
 (define-key search-map "hw"   'hi-lock-write-interactive-patterns)
+(put 'highlight-regexp                   :advertised-binding [?\M-s ?h ?r])
+(put 'highlight-phrase                   :advertised-binding [?\M-s ?h ?p])
+(put 'highlight-lines-matching-regexp    :advertised-binding [?\M-s ?h ?l])
+(put 'highlight-symbol-at-point          :advertised-binding [?\M-s ?h ?.])
+(put 'unhighlight-regexp                 :advertised-binding [?\M-s ?h ?u])
+(put 'hi-lock-find-patterns              :advertised-binding [?\M-s ?h ?f])
+(put 'hi-lock-write-interactive-patterns :advertised-binding [?\M-s ?h ?w])
 
 ;;(defun function-key-error ()
 ;;  (interactive)
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 58a2794..3041401 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -1,6 +1,6 @@
 ;;; bookmark.el --- set bookmarks, maybe annotate them, jump to them later
 
-;; Copyright (C) 1993-1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Karl Fogel <address@hidden>
 ;; Maintainer: Karl Fogel <address@hidden>
@@ -209,6 +209,7 @@ A non-nil value may result in truncated bookmark names."
     (define-key map "j" 'bookmark-jump)
     (define-key map "g" 'bookmark-jump) ;"g"o
     (define-key map "o" 'bookmark-jump-other-window)
+    (define-key map "5" 'bookmark-jump-other-frame)
     (define-key map "i" 'bookmark-insert)
     (define-key map "e" 'edit-bookmarks)
     (define-key map "f" 'bookmark-insert-location) ;"f"ind
@@ -734,7 +735,7 @@ CODING is the symbol of the coding-system in which the file 
is encoded."
   (if (memq (coding-system-base coding) '(undecided prefer-utf-8))
       (setq coding 'utf-8-emacs))
   (insert
-   (format ";;;; Emacs Bookmark Format Version %d ;;;; -*- coding: %S -*- \n"
+   (format ";;;; Emacs Bookmark Format Version %d ;;;; -*- coding: %S -*-\n"
            bookmark-file-format-version (coding-system-base coding)))
   (insert ";;; This format is meant to be slightly human-readable;\n"
           ";;; nevertheless, you probably don't want to edit it.\n"
@@ -1124,6 +1125,14 @@ DISPLAY-FUNC would be `switch-to-buffer-other-window'."
                                    bookmark-current-bookmark)))
   (bookmark-jump bookmark 'switch-to-buffer-other-window))
 
+;;;###autoload
+(defun bookmark-jump-other-frame (bookmark)
+  "Jump to BOOKMARK in another frame.  See `bookmark-jump' for more."
+  (interactive
+   (list (bookmark-completing-read "Jump to bookmark (in another frame)"
+                                   bookmark-current-bookmark)))
+  (let ((pop-up-frames t))
+    (bookmark-jump-other-window bookmark)))
 
 (defun bookmark-jump-noselect (bookmark)
   "Return the location pointed to by BOOKMARK (see `bookmark-jump').
@@ -1561,6 +1570,7 @@ unique numeric suffixes \"<2>\", \"<3>\", etc."
     (set-keymap-parent map special-mode-map)
     (define-key map "v" 'bookmark-bmenu-select)
     (define-key map "w" 'bookmark-bmenu-locate)
+    (define-key map "5" 'bookmark-bmenu-other-frame)
     (define-key map "2" 'bookmark-bmenu-2-window)
     (define-key map "1" 'bookmark-bmenu-1-window)
     (define-key map "j" 'bookmark-bmenu-this-window)
@@ -1702,6 +1712,7 @@ Bookmark names preceded by a \"*\" have annotations.
 \\[bookmark-bmenu-this-window] -- select this bookmark in place of the 
bookmark menu buffer.
 \\[bookmark-bmenu-other-window] -- select this bookmark in another window,
   so the bookmark menu bookmark remains visible in its window.
+\\[bookmark-bmenu-other-frame] -- select this bookmark in another frame.
 \\[bookmark-bmenu-switch-other-window] -- switch the other window to this 
bookmark.
 \\[bookmark-bmenu-rename] -- rename this bookmark (prompts for new name).
 \\[bookmark-bmenu-relocate] -- relocate this bookmark's file (prompts for new 
file).
@@ -1971,6 +1982,13 @@ With a prefix arg, prompts for a file to save them in."
     (bookmark--jump-via bookmark 'switch-to-buffer-other-window)))
 
 
+(defun bookmark-bmenu-other-frame ()
+  "Select this line's bookmark in other frame."
+  (interactive)
+  (let  ((bookmark (bookmark-bmenu-bookmark))
+         (pop-up-frames t))
+    (bookmark-jump-other-window bookmark)))
+
 (defun bookmark-bmenu-switch-other-window ()
   "Make the other window select this line's bookmark.
 The current window remains selected."
diff --git a/lisp/bs.el b/lisp/bs.el
index 32431ba..86a19fd 100644
--- a/lisp/bs.el
+++ b/lisp/bs.el
@@ -1,6 +1,6 @@
 ;;; bs.el --- menu for selecting and displaying buffers -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 ;; Author: Olaf Sylvester <address@hidden>
 ;; Maintainer: address@hidden
 ;; Keywords: convenience
@@ -828,8 +828,8 @@ See `visit-tags-table'."
   (let ((res
          (with-current-buffer (bs--current-buffer)
            (setq bs-buffer-show-mark (pcase bs-buffer-show-mark
-                                       (`nil   'never)
-                                       (`never 'always)
+                                       ('nil   'never)
+                                       ('never 'always)
                                        (_       nil))))))
     (bs--update-current-line)
     (bs--set-window-height)
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index bc1288a..5f88986 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -1,6 +1,6 @@
 ;;; buff-menu.el --- Interface for viewing and manipulating buffers -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985-1987, 1993-1995, 2000-2018 Free Software
+;; Copyright (C) 1985-1987, 1993-1995, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -475,10 +475,10 @@ Buffers marked with 
\\<Buffer-menu-mode-map>`\\[Buffer-menu-delete]' are deleted
                           (save-buffer))
                         (tabulated-list-set-col 2 " " t))
                     (error (warn "Error saving %s" buffer))))
-                (if delete
-                    (unless (eq buffer (current-buffer))
-                      (kill-buffer buffer)
-                      (tabulated-list-delete-entry))
+                (if (and delete
+                         (not (eq buffer (current-buffer)))
+                          (kill-buffer buffer))
+                     (tabulated-list-delete-entry)
                   (forward-line 1)))))))))
 
 (defun Buffer-menu-select ()
diff --git a/lisp/button.el b/lisp/button.el
index 0edd215..c46f3d9 100644
--- a/lisp/button.el
+++ b/lisp/button.el
@@ -1,6 +1,6 @@
 ;;; button.el --- clickable buttons
 ;;
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <address@hidden>
 ;; Keywords: extensions
diff --git a/lisp/calc/calc-aent.el b/lisp/calc/calc-aent.el
index 93aacac..f16e665 100644
--- a/lisp/calc/calc-aent.el
+++ b/lisp/calc/calc-aent.el
@@ -1,6 +1,6 @@
 ;;; calc-aent.el --- algebraic entry functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-alg.el b/lisp/calc/calc-alg.el
index 7a448d2..41ffc83 100644
--- a/lisp/calc/calc-alg.el
+++ b/lisp/calc/calc-alg.el
@@ -1,6 +1,6 @@
-;;; calc-alg.el --- algebraic functions for Calc
+;;; calc-alg.el --- algebraic functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
@@ -308,7 +308,7 @@
   (let ((math-living-dangerously t))
     (math-simplify a)))
 
-(defalias 'calcFunc-esimplify 'math-simplify-extended)
+(defalias 'calcFunc-esimplify #'math-simplify-extended)
 
 ;;; Rewrite the trig functions in a form easier to simplify.
 (defun math-trig-rewrite (fn)
@@ -329,7 +329,7 @@
       (list '/ (cons 'calcFunc-cos newfn)
             (cons 'calcFunc-sin newfn))))
    (t
-    (mapcar 'math-trig-rewrite fn))))
+    (mapcar #'math-trig-rewrite fn))))
 
 (defun math-hyperbolic-trig-rewrite (fn)
   "Rewrite hyperbolic functions in terms of sinhs and coshs."
@@ -349,7 +349,7 @@
       (list '/ (cons 'calcFunc-cosh newfn)
             (cons 'calcFunc-sinh newfn))))
    (t
-    (mapcar 'math-hyperbolic-trig-rewrite fn))))
+    (mapcar #'math-hyperbolic-trig-rewrite fn))))
 
 ;; math-top-only is local to math-simplify, but is used by
 ;; math-simplify-step, which is called by math-simplify.
@@ -402,11 +402,11 @@
         (setq top-expr res)))))
   top-expr)
 
-(defalias 'calcFunc-simplify 'math-simplify)
+(defalias 'calcFunc-simplify #'math-simplify)
 
-;;; The following has a "bug" in that if any recursive simplifications
-;;; occur only the first handler will be tried; this doesn't really
-;;; matter, since math-simplify-step is iterated to a fixed point anyway.
+;; The following has a "bug" in that if any recursive simplifications
+;; occur only the first handler will be tried; this doesn't really
+;; matter, since math-simplify-step is iterated to a fixed point anyway.
 (defun math-simplify-step (a)
   (if (Math-primp a)
       a
@@ -414,7 +414,7 @@
                      (memq (car a) '(calcFunc-quote calcFunc-condition
                                                     calcFunc-evalto)))
                  a
-               (cons (car a) (mapcar 'math-simplify-step (cdr a))))))
+               (cons (car a) (mapcar #'math-simplify-step (cdr a))))))
       (and (symbolp (car aa))
           (let ((handler (get (car aa) 'math-simplify)))
             (and handler
@@ -427,159 +427,155 @@
 
 
 (defmacro math-defsimplify (funcs &rest code)
+  "Define the simplification code for functions FUNCS.
+Code can refer to the expression to simplify via lexical variable `expr'
+and should return the simplified expression to use (or nil)."
+  (declare (indent 1) (debug (sexp body)))
   (cons 'progn
         (mapcar #'(lambda (func)
                     `(put ',func 'math-simplify
                           (nconc
                            (get ',func 'math-simplify)
                            (list
-                            #'(lambda (math-simplify-expr) ,@code)))))
+                            #'(lambda (expr) ,@code)))))
                 (if (symbolp funcs) (list funcs) funcs))))
-(put 'math-defsimplify 'lisp-indent-hook 1)
-
-;; The function created by math-defsimplify uses the variable
-;; math-simplify-expr, and so is used by functions in math-defsimplify
-(defvar math-simplify-expr)
 
 (math-defsimplify (+ -)
-  (math-simplify-plus))
-
-(defun math-simplify-plus ()
-  (cond ((and (memq (car-safe (nth 1 math-simplify-expr)) '(+ -))
-             (Math-numberp (nth 2 (nth 1 math-simplify-expr)))
-             (not (Math-numberp (nth 2 math-simplify-expr))))
-        (let ((x (nth 2 math-simplify-expr))
-              (op (car math-simplify-expr)))
-          (setcar (cdr (cdr math-simplify-expr)) (nth 2 (nth 1 
math-simplify-expr)))
-          (setcar math-simplify-expr (car (nth 1 math-simplify-expr)))
-          (setcar (cdr (cdr (nth 1 math-simplify-expr))) x)
-          (setcar (nth 1 math-simplify-expr) op)))
-       ((and (eq (car math-simplify-expr) '+)
-             (Math-numberp (nth 1 math-simplify-expr))
-             (not (Math-numberp (nth 2 math-simplify-expr))))
-        (let ((x (nth 2 math-simplify-expr)))
-          (setcar (cdr (cdr math-simplify-expr)) (nth 1 math-simplify-expr))
-          (setcar (cdr math-simplify-expr) x))))
-  (let ((aa math-simplify-expr)
+  (cond ((and (memq (car-safe (nth 1 expr)) '(+ -))
+             (Math-numberp (nth 2 (nth 1 expr)))
+             (not (Math-numberp (nth 2 expr))))
+        (let ((x (nth 2 expr))
+              (op (car expr)))
+          (setcar (cdr (cdr expr)) (nth 2 (nth 1 expr)))
+          (setcar expr (car (nth 1 expr)))
+          (setcar (cdr (cdr (nth 1 expr))) x)
+          (setcar (nth 1 expr) op)))
+       ((and (eq (car expr) '+)
+             (Math-numberp (nth 1 expr))
+             (not (Math-numberp (nth 2 expr))))
+        (let ((x (nth 2 expr)))
+          (setcar (cdr (cdr expr)) (nth 1 expr))
+          (setcar (cdr expr) x))))
+  (let ((aa expr)
        aaa temp)
     (while (memq (car-safe (setq aaa (nth 1 aa))) '(+ -))
-      (if (setq temp (math-combine-sum (nth 2 aaa) (nth 2 math-simplify-expr)
+      (if (setq temp (math-combine-sum (nth 2 aaa) (nth 2 expr)
                                       (eq (car aaa) '-)
-                                       (eq (car math-simplify-expr) '-) t))
+                                       (eq (car expr) '-) t))
          (progn
-           (setcar (cdr (cdr math-simplify-expr)) temp)
-           (setcar math-simplify-expr '+)
+           (setcar (cdr (cdr expr)) temp)
+           (setcar expr '+)
            (setcar (cdr (cdr aaa)) 0)))
       (setq aa (nth 1 aa)))
-    (if (setq temp (math-combine-sum aaa (nth 2 math-simplify-expr)
-                                    nil (eq (car math-simplify-expr) '-) t))
+    (if (setq temp (math-combine-sum aaa (nth 2 expr)
+                                    nil (eq (car expr) '-) t))
        (progn
-         (setcar (cdr (cdr math-simplify-expr)) temp)
-         (setcar math-simplify-expr '+)
+         (setcar (cdr (cdr expr)) temp)
+         (setcar expr '+)
          (setcar (cdr aa) 0)))
-    math-simplify-expr))
+    expr))
 
 (math-defsimplify *
-  (math-simplify-times))
-
-(defun math-simplify-times ()
-  (if (eq (car-safe (nth 2 math-simplify-expr)) '*)
-      (and (math-beforep (nth 1 (nth 2 math-simplify-expr)) (nth 1 
math-simplify-expr))
-          (or (math-known-scalarp (nth 1 math-simplify-expr) t)
-              (math-known-scalarp (nth 1 (nth 2 math-simplify-expr)) t))
-          (let ((x (nth 1 math-simplify-expr)))
-            (setcar (cdr math-simplify-expr) (nth 1 (nth 2 
math-simplify-expr)))
-            (setcar (cdr (nth 2 math-simplify-expr)) x)))
-    (and (math-beforep (nth 2 math-simplify-expr) (nth 1 math-simplify-expr))
-        (or (math-known-scalarp (nth 1 math-simplify-expr) t)
-            (math-known-scalarp (nth 2 math-simplify-expr) t))
-        (let ((x (nth 2 math-simplify-expr)))
-          (setcar (cdr (cdr math-simplify-expr)) (nth 1 math-simplify-expr))
-          (setcar (cdr math-simplify-expr) x))))
-  (let ((aa math-simplify-expr)
+  (if (eq (car-safe (nth 2 expr)) '*)
+      (and (math-beforep (nth 1 (nth 2 expr)) (nth 1 expr))
+          (or (math-known-scalarp (nth 1 expr) t)
+              (math-known-scalarp (nth 1 (nth 2 expr)) t))
+          (let ((x (nth 1 expr)))
+            (setcar (cdr expr) (nth 1 (nth 2 expr)))
+            (setcar (cdr (nth 2 expr)) x)))
+    (and (math-beforep (nth 2 expr) (nth 1 expr))
+        (or (math-known-scalarp (nth 1 expr) t)
+            (math-known-scalarp (nth 2 expr) t))
+        (let ((x (nth 2 expr)))
+          (setcar (cdr (cdr expr)) (nth 1 expr))
+          (setcar (cdr expr) x))))
+  (let ((aa expr)
        aaa temp
-       (safe t) (scalar (math-known-scalarp (nth 1 math-simplify-expr))))
-    (if (and (Math-ratp (nth 1 math-simplify-expr))
-            (setq temp (math-common-constant-factor (nth 2 
math-simplify-expr))))
+       (safe t) (scalar (math-known-scalarp (nth 1 expr))))
+    (if (and (Math-ratp (nth 1 expr))
+            (setq temp (math-common-constant-factor (nth 2 expr))))
        (progn
-         (setcar (cdr (cdr math-simplify-expr))
-                 (math-cancel-common-factor (nth 2 math-simplify-expr) temp))
-         (setcar (cdr math-simplify-expr) (math-mul (nth 1 math-simplify-expr) 
temp))))
+         (setcar (cdr (cdr expr))
+                 (math-cancel-common-factor (nth 2 expr) temp))
+         (setcar (cdr expr) (math-mul (nth 1 expr) temp))))
     (while (and (eq (car-safe (setq aaa (nth 2 aa))) '*)
                safe)
-      (if (setq temp (math-combine-prod (nth 1 math-simplify-expr)
+      (if (setq temp (math-combine-prod (nth 1 expr)
                                         (nth 1 aaa) nil nil t))
          (progn
-           (setcar (cdr math-simplify-expr) temp)
+           (setcar (cdr expr) temp)
            (setcar (cdr aaa) 1)))
       (setq safe (or scalar (math-known-scalarp (nth 1 aaa) t))
            aa (nth 2 aa)))
-    (if (and (setq temp (math-combine-prod aaa (nth 1 math-simplify-expr) nil 
nil t))
+    (if (and (setq temp (math-combine-prod aaa (nth 1 expr) nil nil t))
             safe)
        (progn
-         (setcar (cdr math-simplify-expr) temp)
+         (setcar (cdr expr) temp)
          (setcar (cdr (cdr aa)) 1)))
-    (if (and (eq (car-safe (nth 1 math-simplify-expr)) 'frac)
-            (memq (nth 1 (nth 1 math-simplify-expr)) '(1 -1)))
-       (math-div (math-mul (nth 2 math-simplify-expr)
-                            (nth 1 (nth 1 math-simplify-expr)))
-                 (nth 2 (nth 1 math-simplify-expr)))
-      math-simplify-expr)))
+    (if (and (eq (car-safe (nth 1 expr)) 'frac)
+            (memq (nth 1 (nth 1 expr)) '(1 -1)))
+       (math-div (math-mul (nth 2 expr)
+                            (nth 1 (nth 1 expr)))
+                 (nth 2 (nth 1 expr)))
+      expr)))
 
 (math-defsimplify /
-  (math-simplify-divide))
+  (math-simplify-divide expr))
 
-(defun math-simplify-divide ()
-  (let ((np (cdr math-simplify-expr))
+(defvar math--simplify-divide-expr)
+
+(defun math-simplify-divide (expr)
+  (let ((np (cdr expr))
        (nover nil)
-       (nn (and (or (eq (car math-simplify-expr) '/)
-                     (not (Math-realp (nth 2 math-simplify-expr))))
-                (math-common-constant-factor (nth 2 math-simplify-expr))))
+       (nn (and (or (eq (car expr) '/)
+                     (not (Math-realp (nth 2 expr))))
+                (math-common-constant-factor (nth 2 expr))))
        n op)
     (if nn
        (progn
-         (setq n (and (or (eq (car math-simplify-expr) '/)
-                           (not (Math-realp (nth 1 math-simplify-expr))))
-                      (math-common-constant-factor (nth 1 
math-simplify-expr))))
+         (setq n (and (or (eq (car expr) '/)
+                           (not (Math-realp (nth 1 expr))))
+                      (math-common-constant-factor (nth 1 expr))))
          (if (and (eq (car-safe nn) 'frac) (eq (nth 1 nn) 1) (not n))
-             (unless (and (eq (car-safe math-simplify-expr) 'calcFunc-eq)
-                           (eq (car-safe (nth 1 math-simplify-expr)) 'var)
-                           (not (math-expr-contains (nth 2 math-simplify-expr)
-                                                    (nth 1 
math-simplify-expr))))
-               (setcar (cdr math-simplify-expr)
-                        (math-mul (nth 2 nn) (nth 1 math-simplify-expr)))
-               (setcar (cdr (cdr math-simplify-expr))
-                       (math-cancel-common-factor (nth 2 math-simplify-expr) 
nn))
+             (unless (and (eq (car-safe expr) 'calcFunc-eq)
+                           (eq (car-safe (nth 1 expr)) 'var)
+                           (not (math-expr-contains (nth 2 expr)
+                                                    (nth 1 expr))))
+               (setcar (cdr expr)
+                        (math-mul (nth 2 nn) (nth 1 expr)))
+               (setcar (cdr (cdr expr))
+                       (math-cancel-common-factor (nth 2 expr) nn))
                (if (and (math-negp nn)
-                        (setq op (assq (car math-simplify-expr) 
calc-tweak-eqn-table)))
-                   (setcar math-simplify-expr (nth 1 op))))
+                        (setq op (assq (car expr) calc-tweak-eqn-table)))
+                   (setcar expr (nth 1 op))))
            (if (and n (not (eq (setq n (math-frac-gcd n nn)) 1)))
                (progn
-                 (setcar (cdr math-simplify-expr)
-                         (math-cancel-common-factor (nth 1 math-simplify-expr) 
n))
-                 (setcar (cdr (cdr math-simplify-expr))
-                         (math-cancel-common-factor (nth 2 math-simplify-expr) 
n))
+                 (setcar (cdr expr)
+                         (math-cancel-common-factor (nth 1 expr) n))
+                 (setcar (cdr (cdr expr))
+                         (math-cancel-common-factor (nth 2 expr) n))
                  (if (and (math-negp n)
-                          (setq op (assq (car math-simplify-expr)
+                          (setq op (assq (car expr)
                                           calc-tweak-eqn-table)))
-                     (setcar math-simplify-expr (nth 1 op))))))))
-    (if (and (eq (car-safe (car np)) '/)
-            (math-known-scalarp (nth 2 math-simplify-expr) t))
-       (progn
-         (setq np (cdr (nth 1 math-simplify-expr)))
-         (while (eq (car-safe (setq n (car np))) '*)
-           (and (math-known-scalarp (nth 2 n) t)
-                (math-simplify-divisor (cdr n) (cdr (cdr math-simplify-expr)) 
nil t))
-           (setq np (cdr (cdr n))))
-         (math-simplify-divisor np (cdr (cdr math-simplify-expr)) nil t)
-         (setq nover t
-               np (cdr (cdr (nth 1 math-simplify-expr))))))
-    (while (eq (car-safe (setq n (car np))) '*)
-      (and (math-known-scalarp (nth 2 n) t)
-          (math-simplify-divisor (cdr n) (cdr (cdr math-simplify-expr)) nover 
t))
-      (setq np (cdr (cdr n))))
-    (math-simplify-divisor np (cdr (cdr math-simplify-expr)) nover t)
-    math-simplify-expr))
+                     (setcar expr (nth 1 op))))))))
+    (let ((math--simplify-divide-expr expr)) ;For use in math-simplify-divisor
+      (if (and (eq (car-safe (car np)) '/)
+              (math-known-scalarp (nth 2 expr) t))
+         (progn
+           (setq np (cdr (nth 1 expr)))
+           (while (eq (car-safe (setq n (car np))) '*)
+             (and (math-known-scalarp (nth 2 n) t)
+                  (math-simplify-divisor (cdr n) (cdr (cdr expr)) nil t))
+             (setq np (cdr (cdr n))))
+           (math-simplify-divisor np (cdr (cdr expr)) nil t)
+           (setq nover t
+                 np (cdr (cdr (nth 1 expr))))))
+      (while (eq (car-safe (setq n (car np))) '*)
+        (and (math-known-scalarp (nth 2 n) t)
+            (math-simplify-divisor (cdr n) (cdr (cdr expr)) nover t))
+        (setq np (cdr (cdr n))))
+      (math-simplify-divisor np (cdr (cdr expr)) nover t)
+      expr)))
 
 ;; The variables math-simplify-divisor-nover and math-simplify-divisor-dover
 ;; are local variables for math-simplify-divisor, but are used by
@@ -587,25 +583,25 @@
 (defvar math-simplify-divisor-nover)
 (defvar math-simplify-divisor-dover)
 
-(defun math-simplify-divisor (np dp math-simplify-divisor-nover
-                                 math-simplify-divisor-dover)
+(defun math-simplify-divisor (np dp nover dover)
   (cond ((eq (car-safe (car dp)) '/)
         (math-simplify-divisor np (cdr (car dp))
-                                math-simplify-divisor-nover
-                                math-simplify-divisor-dover)
+                                nover dover)
         (and (math-known-scalarp (nth 1 (car dp)) t)
              (math-simplify-divisor np (cdr (cdr (car dp)))
-                                    math-simplify-divisor-nover
-                                     (not math-simplify-divisor-dover))))
-       ((or (or (eq (car math-simplify-expr) '/)
+                                    nover (not dover))))
+       ((or (or (eq (car math--simplify-divide-expr) '/)
                 (let ((signs (math-possible-signs (car np))))
                   (or (memq signs '(1 4))
-                      (and (memq (car math-simplify-expr) '(calcFunc-eq 
calcFunc-neq))
+                      (and (memq (car math--simplify-divide-expr)
+                                  '(calcFunc-eq calcFunc-neq))
                            (eq signs 5))
                       math-living-dangerously)))
             (math-numberp (car np)))
         (let (d
                (safe t)
+               (math-simplify-divisor-nover nover)
+               (math-simplify-divisor-dover dover)
                (scalar (math-known-scalarp (car np))))
           (while (and (eq (car-safe (setq d (car dp))) '*)
                       safe)
@@ -621,14 +617,16 @@
         op)
     (if temp
         (progn
-          (and (not (memq (car math-simplify-expr) '(/ calcFunc-eq 
calcFunc-neq)))
+          (and (not (memq (car math--simplify-divide-expr)
+                          '(/ calcFunc-eq calcFunc-neq)))
                (math-known-negp (car dp))
-               (setq op (assq (car math-simplify-expr) calc-tweak-eqn-table))
-               (setcar math-simplify-expr (nth 1 op)))
+               (setq op (assq (car math--simplify-divide-expr)
+                              calc-tweak-eqn-table))
+               (setcar math--simplify-divide-expr (nth 1 op)))
           (setcar np (if math-simplify-divisor-nover (math-div 1 temp) temp))
           (setcar dp 1))
       (and math-simplify-divisor-dover (not math-simplify-divisor-nover)
-           (eq (car math-simplify-expr) '/)
+           (eq (car math--simplify-divide-expr) '/)
            (eq (car-safe (car dp)) 'calcFunc-sqrt)
            (Math-integerp (nth 1 (car dp)))
            (progn
@@ -680,26 +678,23 @@
                        (math-gcd (nth 2 a) (nth 2 b)))))))
 
 (math-defsimplify %
-  (math-simplify-mod))
-
-(defun math-simplify-mod ()
-  (and (Math-realp (nth 2 math-simplify-expr))
-       (Math-posp (nth 2 math-simplify-expr))
-       (let ((lin (math-is-linear (nth 1 math-simplify-expr)))
-            t1 t2 t3)
+  (and (Math-realp (nth 2 expr))
+       (Math-posp (nth 2 expr))
+       (let ((lin (math-is-linear (nth 1 expr)))
+            t1)
         (or (and lin
                  (or (math-negp (car lin))
-                     (not (Math-lessp (car lin) (nth 2 math-simplify-expr))))
+                     (not (Math-lessp (car lin) (nth 2 expr))))
                  (list '%
                        (list '+
                              (math-mul (nth 1 lin) (nth 2 lin))
-                             (math-mod (car lin) (nth 2 math-simplify-expr)))
-                       (nth 2 math-simplify-expr)))
+                             (math-mod (car lin) (nth 2 expr)))
+                       (nth 2 expr)))
             (and lin
                  (not (math-equal-int (nth 1 lin) 1))
                  (math-num-integerp (nth 1 lin))
-                 (math-num-integerp (nth 2 math-simplify-expr))
-                 (setq t1 (calcFunc-gcd (nth 1 lin) (nth 2 
math-simplify-expr)))
+                 (math-num-integerp (nth 2 expr))
+                 (setq t1 (calcFunc-gcd (nth 1 lin) (nth 2 expr)))
                  (not (math-equal-int t1 1))
                  (list '*
                        t1
@@ -709,53 +704,53 @@
                                              (nth 2 lin))
                                    (let ((calc-prefer-frac t))
                                      (math-div (car lin) t1)))
-                             (math-div (nth 2 math-simplify-expr) t1))))
-            (and (math-equal-int (nth 2 math-simplify-expr) 1)
+                             (math-div (nth 2 expr) t1))))
+            (and (math-equal-int (nth 2 expr) 1)
                  (math-known-integerp (if lin
                                           (math-mul (nth 1 lin) (nth 2 lin))
-                                        (nth 1 math-simplify-expr)))
+                                        (nth 1 expr)))
                  (if lin (math-mod (car lin) 1) 0))))))
 
 (math-defsimplify (calcFunc-eq calcFunc-neq calcFunc-lt
                               calcFunc-gt calcFunc-leq calcFunc-geq)
-  (if (= (length math-simplify-expr) 3)
-      (math-simplify-ineq)))
+  (if (= (length expr) 3)
+      (math-simplify-ineq expr)))
 
-(defun math-simplify-ineq ()
-  (let ((np (cdr math-simplify-expr))
+(defun math-simplify-ineq (expr)
+  (let ((np (cdr expr))
        n)
     (while (memq (car-safe (setq n (car np))) '(+ -))
-      (math-simplify-add-term (cdr (cdr n)) (cdr (cdr math-simplify-expr))
+      (math-simplify-add-term (cdr (cdr n)) (cdr (cdr expr))
                              (eq (car n) '-) nil)
       (setq np (cdr n)))
-    (math-simplify-add-term np (cdr (cdr math-simplify-expr)) nil
-                            (eq np (cdr math-simplify-expr)))
-    (math-simplify-divide)
-    (let ((signs (math-possible-signs (cons '- (cdr math-simplify-expr)))))
-      (or (cond ((eq (car math-simplify-expr) 'calcFunc-eq)
+    (math-simplify-add-term np (cdr (cdr expr)) nil
+                            (eq np (cdr expr)))
+    (math-simplify-divide expr)
+    (let ((signs (math-possible-signs (cons '- (cdr expr)))))
+      (or (cond ((eq (car expr) 'calcFunc-eq)
                 (or (and (eq signs 2) 1)
                     (and (memq signs '(1 4 5)) 0)))
-               ((eq (car math-simplify-expr) 'calcFunc-neq)
+               ((eq (car expr) 'calcFunc-neq)
                 (or (and (eq signs 2) 0)
                     (and (memq signs '(1 4 5)) 1)))
-               ((eq (car math-simplify-expr) 'calcFunc-lt)
+               ((eq (car expr) 'calcFunc-lt)
                 (or (and (eq signs 1) 1)
                     (and (memq signs '(2 4 6)) 0)))
-               ((eq (car math-simplify-expr) 'calcFunc-gt)
+               ((eq (car expr) 'calcFunc-gt)
                 (or (and (eq signs 4) 1)
                     (and (memq signs '(1 2 3)) 0)))
-               ((eq (car math-simplify-expr) 'calcFunc-leq)
+               ((eq (car expr) 'calcFunc-leq)
                 (or (and (eq signs 4) 0)
                     (and (memq signs '(1 2 3)) 1)))
-               ((eq (car math-simplify-expr) 'calcFunc-geq)
+               ((eq (car expr) 'calcFunc-geq)
                 (or (and (eq signs 1) 0)
                     (and (memq signs '(2 4 6)) 1))))
-         math-simplify-expr))))
+         expr))))
 
 (defun math-simplify-add-term (np dp minus lplain)
   (or (math-vectorp (car np))
       (let ((rplain t)
-           n d dd temp)
+           n d temp)
        (while (memq (car-safe (setq n (car np) d (car dp))) '(+ -))
          (setq rplain nil)
          (if (setq temp (math-combine-sum n (nth 2 d)
@@ -782,27 +777,27 @@
                (setcar dp (setq n (math-neg temp)))))))))
 
 (math-defsimplify calcFunc-sin
-  (or (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin)
-          (nth 1 (nth 1 math-simplify-expr)))
-      (and (math-looks-negp (nth 1 math-simplify-expr))
-          (math-neg (list 'calcFunc-sin (math-neg (nth 1 
math-simplify-expr)))))
+  (or (and (eq (car-safe (nth 1 expr)) 'calcFunc-arcsin)
+          (nth 1 (nth 1 expr)))
+      (and (math-looks-negp (nth 1 expr))
+          (math-neg (list 'calcFunc-sin (math-neg (nth 1 expr)))))
       (and (eq calc-angle-mode 'rad)
-          (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi 
var-pi))))
+          (let ((n (math-linear-in (nth 1 expr) '(var pi var-pi))))
             (and n
                  (math-known-sin (car n) (nth 1 n) 120 0))))
       (and (eq calc-angle-mode 'deg)
-          (let ((n (math-integer-plus (nth 1 math-simplify-expr))))
+          (let ((n (math-integer-plus (nth 1 expr))))
             (and n
                  (math-known-sin (car n) (nth 1 n) '(frac 2 3) 0))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos)
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arccos)
           (list 'calcFunc-sqrt (math-sub 1 (math-sqr
-                                             (nth 1 (nth 1 
math-simplify-expr))))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan)
-          (math-div (nth 1 (nth 1 math-simplify-expr))
+                                             (nth 1 (nth 1 expr))))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arctan)
+          (math-div (nth 1 (nth 1 expr))
                     (list 'calcFunc-sqrt
                           (math-add 1 (math-sqr
-                                        (nth 1 (nth 1 math-simplify-expr)))))))
-      (let ((m (math-should-expand-trig (nth 1 math-simplify-expr))))
+                                        (nth 1 (nth 1 expr)))))))
+      (let ((m (math-should-expand-trig (nth 1 expr))))
        (and m (integerp (car m))
             (let ((n (car m)) (a (nth 1 m)))
               (list '+
@@ -812,27 +807,27 @@
                           (list 'calcFunc-sin a))))))))
 
 (math-defsimplify calcFunc-cos
-  (or (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos)
-          (nth 1 (nth 1 math-simplify-expr)))
-      (and (math-looks-negp (nth 1 math-simplify-expr))
-          (list 'calcFunc-cos (math-neg (nth 1 math-simplify-expr))))
+  (or (and (eq (car-safe (nth 1 expr)) 'calcFunc-arccos)
+          (nth 1 (nth 1 expr)))
+      (and (math-looks-negp (nth 1 expr))
+          (list 'calcFunc-cos (math-neg (nth 1 expr))))
       (and (eq calc-angle-mode 'rad)
-          (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi 
var-pi))))
+          (let ((n (math-linear-in (nth 1 expr) '(var pi var-pi))))
             (and n
                  (math-known-sin (car n) (nth 1 n) 120 300))))
       (and (eq calc-angle-mode 'deg)
-          (let ((n (math-integer-plus (nth 1 math-simplify-expr))))
+          (let ((n (math-integer-plus (nth 1 expr))))
             (and n
                  (math-known-sin (car n) (nth 1 n) '(frac 2 3) 300))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin)
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arcsin)
           (list 'calcFunc-sqrt
-                 (math-sub 1 (math-sqr (nth 1 (nth 1 math-simplify-expr))))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan)
+                 (math-sub 1 (math-sqr (nth 1 (nth 1 expr))))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arctan)
           (math-div 1
                     (list 'calcFunc-sqrt
                           (math-add 1
-                                     (math-sqr (nth 1 (nth 1 
math-simplify-expr)))))))
-      (let ((m (math-should-expand-trig (nth 1 math-simplify-expr))))
+                                     (math-sqr (nth 1 (nth 1 expr)))))))
+      (let ((m (math-should-expand-trig (nth 1 expr))))
        (and m (integerp (car m))
             (let ((n (car m)) (a (nth 1 m)))
               (list '-
@@ -842,53 +837,53 @@
                           (list 'calcFunc-sin a))))))))
 
 (math-defsimplify calcFunc-sec
-  (or (and (math-looks-negp (nth 1 math-simplify-expr))
-          (list 'calcFunc-sec (math-neg (nth 1 math-simplify-expr))))
+  (or (and (math-looks-negp (nth 1 expr))
+          (list 'calcFunc-sec (math-neg (nth 1 expr))))
       (and (eq calc-angle-mode 'rad)
-          (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi 
var-pi))))
+          (let ((n (math-linear-in (nth 1 expr) '(var pi var-pi))))
             (and n
                  (math-div 1 (math-known-sin (car n) (nth 1 n) 120 300)))))
       (and (eq calc-angle-mode 'deg)
-          (let ((n (math-integer-plus (nth 1 math-simplify-expr))))
+          (let ((n (math-integer-plus (nth 1 expr))))
             (and n
                   (math-div 1 (math-known-sin (car n) (nth 1 n) '(frac 2 3) 
300)))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin)
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arcsin)
            (math-div
             1
             (list 'calcFunc-sqrt
-                  (math-sub 1 (math-sqr (nth 1 (nth 1 math-simplify-expr)))))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos)
+                  (math-sub 1 (math-sqr (nth 1 (nth 1 expr)))))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arccos)
            (math-div
             1
-            (nth 1 (nth 1 math-simplify-expr))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan)
+            (nth 1 (nth 1 expr))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arctan)
            (list 'calcFunc-sqrt
                  (math-add 1
-                           (math-sqr (nth 1 (nth 1 math-simplify-expr))))))))
+                           (math-sqr (nth 1 (nth 1 expr))))))))
 
 (math-defsimplify calcFunc-csc
-  (or (and (math-looks-negp (nth 1 math-simplify-expr))
-          (math-neg (list 'calcFunc-csc (math-neg (nth 1 
math-simplify-expr)))))
+  (or (and (math-looks-negp (nth 1 expr))
+          (math-neg (list 'calcFunc-csc (math-neg (nth 1 expr)))))
       (and (eq calc-angle-mode 'rad)
-          (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi 
var-pi))))
+          (let ((n (math-linear-in (nth 1 expr) '(var pi var-pi))))
             (and n
                   (math-div 1 (math-known-sin (car n) (nth 1 n) 120 0)))))
       (and (eq calc-angle-mode 'deg)
-          (let ((n (math-integer-plus (nth 1 math-simplify-expr))))
+          (let ((n (math-integer-plus (nth 1 expr))))
             (and n
                   (math-div 1 (math-known-sin (car n) (nth 1 n) '(frac 2 3) 
0)))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin)
-          (math-div 1 (nth 1 (nth 1 math-simplify-expr))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos)
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arcsin)
+          (math-div 1 (nth 1 (nth 1 expr))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arccos)
            (math-div
             1
             (list 'calcFunc-sqrt (math-sub 1 (math-sqr
-                                              (nth 1 (nth 1 
math-simplify-expr)))))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan)
+                                              (nth 1 (nth 1 expr)))))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arctan)
           (math-div (list 'calcFunc-sqrt
                           (math-add 1 (math-sqr
-                                        (nth 1 (nth 1 math-simplify-expr)))))
-                     (nth 1 (nth 1 math-simplify-expr))))))
+                                        (nth 1 (nth 1 expr)))))
+                     (nth 1 (nth 1 expr))))))
 
 (defun math-should-expand-trig (x &optional hyperbolic)
   (let ((m (math-is-multiple x)))
@@ -943,55 +938,55 @@
                 (t nil))))))
 
 (math-defsimplify calcFunc-tan
-  (or (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan)
-          (nth 1 (nth 1 math-simplify-expr)))
-      (and (math-looks-negp (nth 1 math-simplify-expr))
-          (math-neg (list 'calcFunc-tan (math-neg (nth 1 
math-simplify-expr)))))
+  (or (and (eq (car-safe (nth 1 expr)) 'calcFunc-arctan)
+          (nth 1 (nth 1 expr)))
+      (and (math-looks-negp (nth 1 expr))
+          (math-neg (list 'calcFunc-tan (math-neg (nth 1 expr)))))
       (and (eq calc-angle-mode 'rad)
-          (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi 
var-pi))))
+          (let ((n (math-linear-in (nth 1 expr) '(var pi var-pi))))
             (and n
                  (math-known-tan (car n) (nth 1 n) 120))))
       (and (eq calc-angle-mode 'deg)
-          (let ((n (math-integer-plus (nth 1 math-simplify-expr))))
+          (let ((n (math-integer-plus (nth 1 expr))))
             (and n
                  (math-known-tan (car n) (nth 1 n) '(frac 2 3)))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin)
-          (math-div (nth 1 (nth 1 math-simplify-expr))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arcsin)
+          (math-div (nth 1 (nth 1 expr))
                     (list 'calcFunc-sqrt
-                          (math-sub 1 (math-sqr (nth 1 (nth 1 
math-simplify-expr)))))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos)
+                          (math-sub 1 (math-sqr (nth 1 (nth 1 expr)))))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arccos)
           (math-div (list 'calcFunc-sqrt
-                          (math-sub 1 (math-sqr (nth 1 (nth 1 
math-simplify-expr)))))
-                    (nth 1 (nth 1 math-simplify-expr))))
-      (let ((m (math-should-expand-trig (nth 1 math-simplify-expr))))
+                          (math-sub 1 (math-sqr (nth 1 (nth 1 expr)))))
+                    (nth 1 (nth 1 expr))))
+      (let ((m (math-should-expand-trig (nth 1 expr))))
        (and m
             (if (equal (car m) '(frac 1 2))
                 (math-div (math-sub 1 (list 'calcFunc-cos (nth 1 m)))
                           (list 'calcFunc-sin (nth 1 m)))
-              (math-div (list 'calcFunc-sin (nth 1 math-simplify-expr))
-                        (list 'calcFunc-cos (nth 1 math-simplify-expr))))))))
+              (math-div (list 'calcFunc-sin (nth 1 expr))
+                        (list 'calcFunc-cos (nth 1 expr))))))))
 
 (math-defsimplify calcFunc-cot
-  (or (and (math-looks-negp (nth 1 math-simplify-expr))
-          (math-neg (list 'calcFunc-cot (math-neg (nth 1 
math-simplify-expr)))))
+  (or (and (math-looks-negp (nth 1 expr))
+          (math-neg (list 'calcFunc-cot (math-neg (nth 1 expr)))))
       (and (eq calc-angle-mode 'rad)
-          (let ((n (math-linear-in (nth 1 math-simplify-expr) '(var pi 
var-pi))))
+          (let ((n (math-linear-in (nth 1 expr) '(var pi var-pi))))
             (and n
                   (math-div 1 (math-known-tan (car n) (nth 1 n) 120)))))
       (and (eq calc-angle-mode 'deg)
-          (let ((n (math-integer-plus (nth 1 math-simplify-expr))))
+          (let ((n (math-integer-plus (nth 1 expr))))
             (and n
                   (math-div 1 (math-known-tan (car n) (nth 1 n) '(frac 2 
3))))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsin)
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arcsin)
           (math-div (list 'calcFunc-sqrt
-                          (math-sub 1 (math-sqr (nth 1 (nth 1 
math-simplify-expr)))))
-                     (nth 1 (nth 1 math-simplify-expr))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccos)
-          (math-div (nth 1 (nth 1 math-simplify-expr))
+                          (math-sub 1 (math-sqr (nth 1 (nth 1 expr)))))
+                     (nth 1 (nth 1 expr))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arccos)
+          (math-div (nth 1 (nth 1 expr))
                      (list 'calcFunc-sqrt
-                          (math-sub 1 (math-sqr (nth 1 (nth 1 
math-simplify-expr)))))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctan)
-          (math-div 1 (nth 1 (nth 1 math-simplify-expr))))))
+                          (math-sub 1 (math-sqr (nth 1 (nth 1 expr)))))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arctan)
+          (math-div 1 (nth 1 (nth 1 expr))))))
 
 (defun math-known-tan (plus n mul)
   (setq n (math-mul n mul))
@@ -1026,20 +1021,20 @@
                 (t nil))))))
 
 (math-defsimplify calcFunc-sinh
-  (or (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsinh)
-          (nth 1 (nth 1 math-simplify-expr)))
-      (and (math-looks-negp (nth 1 math-simplify-expr))
-          (math-neg (list 'calcFunc-sinh (math-neg (nth 1 
math-simplify-expr)))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh)
+  (or (and (eq (car-safe (nth 1 expr)) 'calcFunc-arcsinh)
+          (nth 1 (nth 1 expr)))
+      (and (math-looks-negp (nth 1 expr))
+          (math-neg (list 'calcFunc-sinh (math-neg (nth 1 expr)))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arccosh)
           math-living-dangerously
           (list 'calcFunc-sqrt
-                 (math-sub (math-sqr (nth 1 (nth 1 math-simplify-expr))) 1)))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh)
+                 (math-sub (math-sqr (nth 1 (nth 1 expr))) 1)))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arctanh)
           math-living-dangerously
-          (math-div (nth 1 (nth 1 math-simplify-expr))
+          (math-div (nth 1 (nth 1 expr))
                     (list 'calcFunc-sqrt
-                          (math-sub 1 (math-sqr (nth 1 (nth 1 
math-simplify-expr)))))))
-      (let ((m (math-should-expand-trig (nth 1 math-simplify-expr) t)))
+                          (math-sub 1 (math-sqr (nth 1 (nth 1 expr)))))))
+      (let ((m (math-should-expand-trig (nth 1 expr) t)))
        (and m (integerp (car m))
             (let ((n (car m)) (a (nth 1 m)))
               (if (> n 1)
@@ -1050,20 +1045,20 @@
                               (list 'calcFunc-sinh a)))))))))
 
 (math-defsimplify calcFunc-cosh
-  (or (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh)
-          (nth 1 (nth 1 math-simplify-expr)))
-      (and (math-looks-negp (nth 1 math-simplify-expr))
-          (list 'calcFunc-cosh (math-neg (nth 1 math-simplify-expr))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsinh)
+  (or (and (eq (car-safe (nth 1 expr)) 'calcFunc-arccosh)
+          (nth 1 (nth 1 expr)))
+      (and (math-looks-negp (nth 1 expr))
+          (list 'calcFunc-cosh (math-neg (nth 1 expr))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arcsinh)
           math-living-dangerously
           (list 'calcFunc-sqrt
-                 (math-add (math-sqr (nth 1 (nth 1 math-simplify-expr))) 1)))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh)
+                 (math-add (math-sqr (nth 1 (nth 1 expr))) 1)))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arctanh)
           math-living-dangerously
           (math-div 1
                     (list 'calcFunc-sqrt
-                          (math-sub 1 (math-sqr (nth 1 (nth 1 
math-simplify-expr)))))))
-      (let ((m (math-should-expand-trig (nth 1 math-simplify-expr) t)))
+                          (math-sub 1 (math-sqr (nth 1 (nth 1 expr)))))))
+      (let ((m (math-should-expand-trig (nth 1 expr) t)))
        (and m (integerp (car m))
             (let ((n (car m)) (a (nth 1 m)))
               (if (> n 1)
@@ -1074,188 +1069,188 @@
                               (list 'calcFunc-sinh a)))))))))
 
 (math-defsimplify calcFunc-tanh
-  (or (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh)
-          (nth 1 (nth 1 math-simplify-expr)))
-      (and (math-looks-negp (nth 1 math-simplify-expr))
-          (math-neg (list 'calcFunc-tanh (math-neg (nth 1 
math-simplify-expr)))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsinh)
+  (or (and (eq (car-safe (nth 1 expr)) 'calcFunc-arctanh)
+          (nth 1 (nth 1 expr)))
+      (and (math-looks-negp (nth 1 expr))
+          (math-neg (list 'calcFunc-tanh (math-neg (nth 1 expr)))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arcsinh)
           math-living-dangerously
-          (math-div (nth 1 (nth 1 math-simplify-expr))
+          (math-div (nth 1 (nth 1 expr))
                     (list 'calcFunc-sqrt
-                          (math-add (math-sqr (nth 1 (nth 1 
math-simplify-expr))) 1))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh)
+                          (math-add (math-sqr (nth 1 (nth 1 expr))) 1))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arccosh)
           math-living-dangerously
           (math-div (list 'calcFunc-sqrt
-                          (math-sub (math-sqr (nth 1 (nth 1 
math-simplify-expr))) 1))
-                    (nth 1 (nth 1 math-simplify-expr))))
-      (let ((m (math-should-expand-trig (nth 1 math-simplify-expr) t)))
+                          (math-sub (math-sqr (nth 1 (nth 1 expr))) 1))
+                    (nth 1 (nth 1 expr))))
+      (let ((m (math-should-expand-trig (nth 1 expr) t)))
        (and m
             (if (equal (car m) '(frac 1 2))
                 (math-div (math-sub (list 'calcFunc-cosh (nth 1 m)) 1)
                           (list 'calcFunc-sinh (nth 1 m)))
-              (math-div (list 'calcFunc-sinh (nth 1 math-simplify-expr))
-                        (list 'calcFunc-cosh (nth 1 math-simplify-expr))))))))
+              (math-div (list 'calcFunc-sinh (nth 1 expr))
+                        (list 'calcFunc-cosh (nth 1 expr))))))))
 
 (math-defsimplify calcFunc-sech
-  (or (and (math-looks-negp (nth 1 math-simplify-expr))
-          (list 'calcFunc-sech (math-neg (nth 1 math-simplify-expr))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsinh)
+  (or (and (math-looks-negp (nth 1 expr))
+          (list 'calcFunc-sech (math-neg (nth 1 expr))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arcsinh)
           math-living-dangerously
            (math-div
             1
             (list 'calcFunc-sqrt
-                  (math-add (math-sqr (nth 1 (nth 1 math-simplify-expr))) 1))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh)
+                  (math-add (math-sqr (nth 1 (nth 1 expr))) 1))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arccosh)
           math-living-dangerously
-           (math-div 1 (nth 1 (nth 1 math-simplify-expr))) 1)
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh)
+           (math-div 1 (nth 1 (nth 1 expr))) 1)
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arctanh)
           math-living-dangerously
            (list 'calcFunc-sqrt
-                 (math-sub 1 (math-sqr (nth 1 (nth 1 math-simplify-expr))))))))
+                 (math-sub 1 (math-sqr (nth 1 (nth 1 expr))))))))
 
 (math-defsimplify calcFunc-csch
-  (or (and (math-looks-negp (nth 1 math-simplify-expr))
-          (math-neg (list 'calcFunc-csch (math-neg (nth 1 
math-simplify-expr)))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsinh)
+  (or (and (math-looks-negp (nth 1 expr))
+          (math-neg (list 'calcFunc-csch (math-neg (nth 1 expr)))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arcsinh)
           math-living-dangerously
-           (math-div 1 (nth 1 (nth 1 math-simplify-expr))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh)
+           (math-div 1 (nth 1 (nth 1 expr))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arccosh)
           math-living-dangerously
            (math-div
             1
             (list 'calcFunc-sqrt
-                  (math-sub (math-sqr (nth 1 (nth 1 math-simplify-expr))) 1))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh)
+                  (math-sub (math-sqr (nth 1 (nth 1 expr))) 1))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arctanh)
           math-living-dangerously
           (math-div (list 'calcFunc-sqrt
-                          (math-sub 1 (math-sqr (nth 1 (nth 1 
math-simplify-expr)))))
-                     (nth 1 (nth 1 math-simplify-expr))))))
+                          (math-sub 1 (math-sqr (nth 1 (nth 1 expr)))))
+                     (nth 1 (nth 1 expr))))))
 
 (math-defsimplify calcFunc-coth
-  (or (and (math-looks-negp (nth 1 math-simplify-expr))
-          (math-neg (list 'calcFunc-coth (math-neg (nth 1 
math-simplify-expr)))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arcsinh)
+  (or (and (math-looks-negp (nth 1 expr))
+          (math-neg (list 'calcFunc-coth (math-neg (nth 1 expr)))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arcsinh)
           math-living-dangerously
           (math-div (list 'calcFunc-sqrt
-                          (math-add (math-sqr (nth 1 (nth 1 
math-simplify-expr))) 1))
-                     (nth 1 (nth 1 math-simplify-expr))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arccosh)
+                          (math-add (math-sqr (nth 1 (nth 1 expr))) 1))
+                     (nth 1 (nth 1 expr))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arccosh)
           math-living-dangerously
-          (math-div (nth 1 (nth 1 math-simplify-expr))
+          (math-div (nth 1 (nth 1 expr))
                      (list 'calcFunc-sqrt
-                          (math-sub (math-sqr (nth 1 (nth 1 
math-simplify-expr))) 1))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-arctanh)
+                          (math-sub (math-sqr (nth 1 (nth 1 expr))) 1))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-arctanh)
           math-living-dangerously
-          (math-div 1 (nth 1 (nth 1 math-simplify-expr))))))
+          (math-div 1 (nth 1 (nth 1 expr))))))
 
 (math-defsimplify calcFunc-arcsin
-  (or (and (math-looks-negp (nth 1 math-simplify-expr))
-          (math-neg (list 'calcFunc-arcsin (math-neg (nth 1 
math-simplify-expr)))))
-      (and (eq (nth 1 math-simplify-expr) 1)
+  (or (and (math-looks-negp (nth 1 expr))
+          (math-neg (list 'calcFunc-arcsin (math-neg (nth 1 expr)))))
+      (and (eq (nth 1 expr) 1)
           (math-quarter-circle t))
-      (and (equal (nth 1 math-simplify-expr) '(frac 1 2))
+      (and (equal (nth 1 expr) '(frac 1 2))
           (math-div (math-half-circle t) 6))
       (and math-living-dangerously
-          (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-sin)
-          (nth 1 (nth 1 math-simplify-expr)))
+          (eq (car-safe (nth 1 expr)) 'calcFunc-sin)
+          (nth 1 (nth 1 expr)))
       (and math-living-dangerously
-          (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-cos)
+          (eq (car-safe (nth 1 expr)) 'calcFunc-cos)
           (math-sub (math-quarter-circle t)
-                    (nth 1 (nth 1 math-simplify-expr))))))
+                    (nth 1 (nth 1 expr))))))
 
 (math-defsimplify calcFunc-arccos
-  (or (and (eq (nth 1 math-simplify-expr) 0)
+  (or (and (eq (nth 1 expr) 0)
           (math-quarter-circle t))
-      (and (eq (nth 1 math-simplify-expr) -1)
+      (and (eq (nth 1 expr) -1)
           (math-half-circle t))
-      (and (equal (nth 1 math-simplify-expr) '(frac 1 2))
+      (and (equal (nth 1 expr) '(frac 1 2))
           (math-div (math-half-circle t) 3))
-      (and (equal (nth 1 math-simplify-expr) '(frac -1 2))
+      (and (equal (nth 1 expr) '(frac -1 2))
           (math-div (math-mul (math-half-circle t) 2) 3))
       (and math-living-dangerously
-          (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-cos)
-          (nth 1 (nth 1 math-simplify-expr)))
+          (eq (car-safe (nth 1 expr)) 'calcFunc-cos)
+          (nth 1 (nth 1 expr)))
       (and math-living-dangerously
-          (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-sin)
+          (eq (car-safe (nth 1 expr)) 'calcFunc-sin)
           (math-sub (math-quarter-circle t)
-                    (nth 1 (nth 1 math-simplify-expr))))))
+                    (nth 1 (nth 1 expr))))))
 
 (math-defsimplify calcFunc-arctan
-  (or (and (math-looks-negp (nth 1 math-simplify-expr))
-          (math-neg (list 'calcFunc-arctan (math-neg (nth 1 
math-simplify-expr)))))
-      (and (eq (nth 1 math-simplify-expr) 1)
+  (or (and (math-looks-negp (nth 1 expr))
+          (math-neg (list 'calcFunc-arctan (math-neg (nth 1 expr)))))
+      (and (eq (nth 1 expr) 1)
           (math-div (math-half-circle t) 4))
       (and math-living-dangerously
-          (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-tan)
-          (nth 1 (nth 1 math-simplify-expr)))))
+          (eq (car-safe (nth 1 expr)) 'calcFunc-tan)
+          (nth 1 (nth 1 expr)))))
 
 (math-defsimplify calcFunc-arcsinh
-  (or (and (math-looks-negp (nth 1 math-simplify-expr))
-          (math-neg (list 'calcFunc-arcsinh (math-neg (nth 1 
math-simplify-expr)))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-sinh)
+  (or (and (math-looks-negp (nth 1 expr))
+          (math-neg (list 'calcFunc-arcsinh (math-neg (nth 1 expr)))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-sinh)
           (or math-living-dangerously
-              (math-known-realp (nth 1 (nth 1 math-simplify-expr))))
-          (nth 1 (nth 1 math-simplify-expr)))))
+              (math-known-realp (nth 1 (nth 1 expr))))
+          (nth 1 (nth 1 expr)))))
 
 (math-defsimplify calcFunc-arccosh
-  (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-cosh)
+  (and (eq (car-safe (nth 1 expr)) 'calcFunc-cosh)
        (or math-living-dangerously
-          (math-known-realp (nth 1 (nth 1 math-simplify-expr))))
-       (nth 1 (nth 1 math-simplify-expr))))
+          (math-known-realp (nth 1 (nth 1 expr))))
+       (nth 1 (nth 1 expr))))
 
 (math-defsimplify calcFunc-arctanh
-  (or (and (math-looks-negp (nth 1 math-simplify-expr))
-          (math-neg (list 'calcFunc-arctanh (math-neg (nth 1 
math-simplify-expr)))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-tanh)
+  (or (and (math-looks-negp (nth 1 expr))
+          (math-neg (list 'calcFunc-arctanh (math-neg (nth 1 expr)))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-tanh)
           (or math-living-dangerously
-              (math-known-realp (nth 1 (nth 1 math-simplify-expr))))
-          (nth 1 (nth 1 math-simplify-expr)))))
+              (math-known-realp (nth 1 (nth 1 expr))))
+          (nth 1 (nth 1 expr)))))
 
 (math-defsimplify calcFunc-sqrt
-  (math-simplify-sqrt))
+  (math-simplify-sqrt expr))
 
-(defun math-simplify-sqrt ()
-  (or (and (eq (car-safe (nth 1 math-simplify-expr)) 'frac)
+(defun math-simplify-sqrt (expr)
+  (or (and (eq (car-safe (nth 1 expr)) 'frac)
           (math-div (list 'calcFunc-sqrt
-                           (math-mul (nth 1 (nth 1 math-simplify-expr))
-                                     (nth 2 (nth 1 math-simplify-expr))))
-                    (nth 2 (nth 1 math-simplify-expr))))
-      (let ((fac (if (math-objectp (nth 1 math-simplify-expr))
-                    (math-squared-factor (nth 1 math-simplify-expr))
-                  (math-common-constant-factor (nth 1 math-simplify-expr)))))
+                           (math-mul (nth 1 (nth 1 expr))
+                                     (nth 2 (nth 1 expr))))
+                    (nth 2 (nth 1 expr))))
+      (let ((fac (if (math-objectp (nth 1 expr))
+                    (math-squared-factor (nth 1 expr))
+                  (math-common-constant-factor (nth 1 expr)))))
        (and fac (not (eq fac 1))
             (math-mul (math-normalize (list 'calcFunc-sqrt fac))
                       (math-normalize
                        (list 'calcFunc-sqrt
                              (math-cancel-common-factor
-                               (nth 1 math-simplify-expr) fac))))))
+                               (nth 1 expr) fac))))))
       (and math-living-dangerously
-          (or (and (eq (car-safe (nth 1 math-simplify-expr)) '-)
-                   (math-equal-int (nth 1 (nth 1 math-simplify-expr)) 1)
-                   (eq (car-safe (nth 2 (nth 1 math-simplify-expr))) '^)
-                   (math-equal-int (nth 2 (nth 2 (nth 1 math-simplify-expr))) 
2)
-                   (or (and (eq (car-safe (nth 1 (nth 2 (nth 1 
math-simplify-expr))))
+          (or (and (eq (car-safe (nth 1 expr)) '-)
+                   (math-equal-int (nth 1 (nth 1 expr)) 1)
+                   (eq (car-safe (nth 2 (nth 1 expr))) '^)
+                   (math-equal-int (nth 2 (nth 2 (nth 1 expr))) 2)
+                   (or (and (eq (car-safe (nth 1 (nth 2 (nth 1 expr))))
                                 'calcFunc-sin)
                             (list 'calcFunc-cos
-                                  (nth 1 (nth 1 (nth 2 (nth 1 
math-simplify-expr))))))
-                       (and (eq (car-safe (nth 1 (nth 2 (nth 1 
math-simplify-expr))))
+                                  (nth 1 (nth 1 (nth 2 (nth 1 expr))))))
+                       (and (eq (car-safe (nth 1 (nth 2 (nth 1 expr))))
                                 'calcFunc-cos)
                             (list 'calcFunc-sin
                                   (nth 1 (nth 1 (nth 2
-                                                      (nth 1 
math-simplify-expr))))))))
-              (and (eq (car-safe (nth 1 math-simplify-expr)) '-)
-                   (math-equal-int (nth 2 (nth 1 math-simplify-expr)) 1)
-                   (eq (car-safe (nth 1 (nth 1 math-simplify-expr))) '^)
-                   (math-equal-int (nth 2 (nth 1 (nth 1 math-simplify-expr))) 
2)
-                   (and (eq (car-safe (nth 1 (nth 1 (nth 1 
math-simplify-expr))))
+                                                      (nth 1 expr))))))))
+              (and (eq (car-safe (nth 1 expr)) '-)
+                   (math-equal-int (nth 2 (nth 1 expr)) 1)
+                   (eq (car-safe (nth 1 (nth 1 expr))) '^)
+                   (math-equal-int (nth 2 (nth 1 (nth 1 expr))) 2)
+                   (and (eq (car-safe (nth 1 (nth 1 (nth 1 expr))))
                             'calcFunc-cosh)
                         (list 'calcFunc-sinh
-                              (nth 1 (nth 1 (nth 1 (nth 1 
math-simplify-expr)))))))
-              (and (eq (car-safe (nth 1 math-simplify-expr)) '+)
-                   (let ((a (nth 1 (nth 1 math-simplify-expr)))
-                         (b (nth 2 (nth 1 math-simplify-expr))))
+                              (nth 1 (nth 1 (nth 1 (nth 1 expr)))))))
+              (and (eq (car-safe (nth 1 expr)) '+)
+                   (let ((a (nth 1 (nth 1 expr)))
+                         (b (nth 2 (nth 1 expr))))
                      (and (or (and (math-equal-int a 1)
-                                   (setq a b b (nth 1 (nth 1 
math-simplify-expr))))
+                                   (setq a b b (nth 1 (nth 1 expr))))
                               (math-equal-int b 1))
                           (eq (car-safe a) '^)
                           (math-equal-int (nth 2 a) 2)
@@ -1269,20 +1264,20 @@
                               (and (eq (car-safe (nth 1 a)) 'calcFunc-cot)
                                    (list '/ 1 (list 'calcFunc-sin
                                                     (nth 1 (nth 1 a)))))))))
-              (and (eq (car-safe (nth 1 math-simplify-expr)) '^)
+              (and (eq (car-safe (nth 1 expr)) '^)
                    (list '^
-                         (nth 1 (nth 1 math-simplify-expr))
-                         (math-div (nth 2 (nth 1 math-simplify-expr)) 2)))
-              (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-sqrt)
-                   (list '^ (nth 1 (nth 1 math-simplify-expr)) (math-div 1 4)))
-              (and (memq (car-safe (nth 1 math-simplify-expr)) '(* /))
-                   (list (car (nth 1 math-simplify-expr))
-                         (list 'calcFunc-sqrt (nth 1 (nth 1 
math-simplify-expr)))
-                         (list 'calcFunc-sqrt (nth 2 (nth 1 
math-simplify-expr)))))
-              (and (memq (car-safe (nth 1 math-simplify-expr)) '(+ -))
-                   (not (math-any-floats (nth 1 math-simplify-expr)))
+                         (nth 1 (nth 1 expr))
+                         (math-div (nth 2 (nth 1 expr)) 2)))
+              (and (eq (car-safe (nth 1 expr)) 'calcFunc-sqrt)
+                   (list '^ (nth 1 (nth 1 expr)) (math-div 1 4)))
+              (and (memq (car-safe (nth 1 expr)) '(* /))
+                   (list (car (nth 1 expr))
+                         (list 'calcFunc-sqrt (nth 1 (nth 1 expr)))
+                         (list 'calcFunc-sqrt (nth 2 (nth 1 expr)))))
+              (and (memq (car-safe (nth 1 expr)) '(+ -))
+                   (not (math-any-floats (nth 1 expr)))
                    (let ((f (calcFunc-factors (calcFunc-expand
-                                               (nth 1 math-simplify-expr)))))
+                                               (nth 1 expr)))))
                      (and (math-vectorp f)
                           (or (> (length f) 2)
                               (> (nth 2 (nth 1 f)) 1))
@@ -1318,7 +1313,7 @@
        fac)))
 
 (math-defsimplify calcFunc-exp
-  (math-simplify-exp (nth 1 math-simplify-expr)))
+  (math-simplify-exp (nth 1 expr)))
 
 (defun math-simplify-exp (x)
   (or (and (eq (car-safe x) 'calcFunc-ln)
@@ -1349,22 +1344,22 @@
                  (list '+ c (list '* s '(var i var-i))))))))
 
 (math-defsimplify calcFunc-ln
-  (or (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-exp)
+  (or (and (eq (car-safe (nth 1 expr)) 'calcFunc-exp)
           (or math-living-dangerously
-              (math-known-realp (nth 1 (nth 1 math-simplify-expr))))
-          (nth 1 (nth 1 math-simplify-expr)))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) '^)
-          (equal (nth 1 (nth 1 math-simplify-expr)) '(var e var-e))
+              (math-known-realp (nth 1 (nth 1 expr))))
+          (nth 1 (nth 1 expr)))
+      (and (eq (car-safe (nth 1 expr)) '^)
+          (equal (nth 1 (nth 1 expr)) '(var e var-e))
           (or math-living-dangerously
-              (math-known-realp (nth 2 (nth 1 math-simplify-expr))))
-          (nth 2 (nth 1 math-simplify-expr)))
+              (math-known-realp (nth 2 (nth 1 expr))))
+          (nth 2 (nth 1 expr)))
       (and calc-symbolic-mode
-          (math-known-negp (nth 1 math-simplify-expr))
-          (math-add (list 'calcFunc-ln (math-neg (nth 1 math-simplify-expr)))
+          (math-known-negp (nth 1 expr))
+          (math-add (list 'calcFunc-ln (math-neg (nth 1 expr)))
                     '(* (var pi var-pi) (var i var-i))))
       (and calc-symbolic-mode
-          (math-known-imagp (nth 1 math-simplify-expr))
-          (let* ((ip (calcFunc-im (nth 1 math-simplify-expr)))
+          (math-known-imagp (nth 1 expr))
+          (let* ((ip (calcFunc-im (nth 1 expr)))
                  (ips (math-possible-signs ip)))
             (or (and (memq ips '(4 6))
                      (math-add (list 'calcFunc-ln ip)
@@ -1374,95 +1369,92 @@
                                '(/ (* (var pi var-pi) (var i var-i)) 2))))))))
 
 (math-defsimplify ^
-  (math-simplify-pow))
-
-(defun math-simplify-pow ()
   (or (and math-living-dangerously
-          (or (and (eq (car-safe (nth 1 math-simplify-expr)) '^)
+          (or (and (eq (car-safe (nth 1 expr)) '^)
                    (list '^
-                         (nth 1 (nth 1 math-simplify-expr))
-                         (math-mul (nth 2 math-simplify-expr)
-                                    (nth 2 (nth 1 math-simplify-expr)))))
-              (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-sqrt)
+                         (nth 1 (nth 1 expr))
+                         (math-mul (nth 2 expr)
+                                    (nth 2 (nth 1 expr)))))
+              (and (eq (car-safe (nth 1 expr)) 'calcFunc-sqrt)
                    (list '^
-                         (nth 1 (nth 1 math-simplify-expr))
-                         (math-div (nth 2 math-simplify-expr) 2)))
-              (and (memq (car-safe (nth 1 math-simplify-expr)) '(* /))
-                   (list (car (nth 1 math-simplify-expr))
-                         (list '^ (nth 1 (nth 1 math-simplify-expr))
-                                (nth 2 math-simplify-expr))
-                         (list '^ (nth 2 (nth 1 math-simplify-expr))
-                                (nth 2 math-simplify-expr))))))
-      (and (math-equal-int (nth 1 math-simplify-expr) 10)
-          (eq (car-safe (nth 2 math-simplify-expr)) 'calcFunc-log10)
-          (nth 1 (nth 2 math-simplify-expr)))
-      (and (equal (nth 1 math-simplify-expr) '(var e var-e))
-          (math-simplify-exp (nth 2 math-simplify-expr)))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-exp)
+                         (nth 1 (nth 1 expr))
+                         (math-div (nth 2 expr) 2)))
+              (and (memq (car-safe (nth 1 expr)) '(* /))
+                   (list (car (nth 1 expr))
+                         (list '^ (nth 1 (nth 1 expr))
+                                (nth 2 expr))
+                         (list '^ (nth 2 (nth 1 expr))
+                                (nth 2 expr))))))
+      (and (math-equal-int (nth 1 expr) 10)
+          (eq (car-safe (nth 2 expr)) 'calcFunc-log10)
+          (nth 1 (nth 2 expr)))
+      (and (equal (nth 1 expr) '(var e var-e))
+          (math-simplify-exp (nth 2 expr)))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-exp)
           (not math-integrating)
-          (list 'calcFunc-exp (math-mul (nth 1 (nth 1 math-simplify-expr))
-                                         (nth 2 math-simplify-expr))))
-      (and (equal (nth 1 math-simplify-expr) '(var i var-i))
+          (list 'calcFunc-exp (math-mul (nth 1 (nth 1 expr))
+                                         (nth 2 expr))))
+      (and (equal (nth 1 expr) '(var i var-i))
           (math-imaginary-i)
-          (math-num-integerp (nth 2 math-simplify-expr))
-          (let ((x (math-mod (math-trunc (nth 2 math-simplify-expr)) 4)))
+          (math-num-integerp (nth 2 expr))
+          (let ((x (math-mod (math-trunc (nth 2 expr)) 4)))
             (cond ((eq x 0) 1)
-                  ((eq x 1) (nth 1 math-simplify-expr))
+                  ((eq x 1) (nth 1 expr))
                   ((eq x 2) -1)
-                  ((eq x 3) (math-neg (nth 1 math-simplify-expr))))))
+                  ((eq x 3) (math-neg (nth 1 expr))))))
       (and math-integrating
-          (integerp (nth 2 math-simplify-expr))
-          (>= (nth 2 math-simplify-expr) 2)
-          (or (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-cos)
-                   (math-mul (math-pow (nth 1 math-simplify-expr)
-                                        (- (nth 2 math-simplify-expr) 2))
+          (integerp (nth 2 expr))
+          (>= (nth 2 expr) 2)
+          (or (and (eq (car-safe (nth 1 expr)) 'calcFunc-cos)
+                   (math-mul (math-pow (nth 1 expr)
+                                        (- (nth 2 expr) 2))
                              (math-sub 1
                                        (math-sqr
                                         (list 'calcFunc-sin
-                                              (nth 1 (nth 1 
math-simplify-expr)))))))
-              (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-cosh)
-                   (math-mul (math-pow (nth 1 math-simplify-expr)
-                                        (- (nth 2 math-simplify-expr) 2))
+                                              (nth 1 (nth 1 expr)))))))
+              (and (eq (car-safe (nth 1 expr)) 'calcFunc-cosh)
+                   (math-mul (math-pow (nth 1 expr)
+                                        (- (nth 2 expr) 2))
                              (math-add 1
                                        (math-sqr
                                         (list 'calcFunc-sinh
-                                              (nth 1 (nth 1 
math-simplify-expr)))))))))
-      (and (eq (car-safe (nth 2 math-simplify-expr)) 'frac)
-          (Math-ratp (nth 1 math-simplify-expr))
-          (Math-posp (nth 1 math-simplify-expr))
-          (if (equal (nth 2 math-simplify-expr) '(frac 1 2))
-              (list 'calcFunc-sqrt (nth 1 math-simplify-expr))
-            (let ((flr (math-floor (nth 2 math-simplify-expr))))
+                                              (nth 1 (nth 1 expr)))))))))
+      (and (eq (car-safe (nth 2 expr)) 'frac)
+          (Math-ratp (nth 1 expr))
+          (Math-posp (nth 1 expr))
+          (if (equal (nth 2 expr) '(frac 1 2))
+              (list 'calcFunc-sqrt (nth 1 expr))
+            (let ((flr (math-floor (nth 2 expr))))
               (and (not (Math-zerop flr))
-                   (list '* (list '^ (nth 1 math-simplify-expr) flr)
-                         (list '^ (nth 1 math-simplify-expr)
-                               (math-sub (nth 2 math-simplify-expr) flr)))))))
-      (and (eq (math-quarter-integer (nth 2 math-simplify-expr)) 2)
-          (let ((temp (math-simplify-sqrt)))
+                   (list '* (list '^ (nth 1 expr) flr)
+                         (list '^ (nth 1 expr)
+                               (math-sub (nth 2 expr) flr)))))))
+      (and (eq (math-quarter-integer (nth 2 expr)) 2)
+          (let ((temp (math-simplify-sqrt expr)))
             (and temp
-                 (list '^ temp (math-mul (nth 2 math-simplify-expr) 2)))))))
+                 (list '^ temp (math-mul (nth 2 expr) 2)))))))
 
 (math-defsimplify calcFunc-log10
-  (and (eq (car-safe (nth 1 math-simplify-expr)) '^)
-       (math-equal-int (nth 1 (nth 1 math-simplify-expr)) 10)
+  (and (eq (car-safe (nth 1 expr)) '^)
+       (math-equal-int (nth 1 (nth 1 expr)) 10)
        (or math-living-dangerously
-          (math-known-realp (nth 2 (nth 1 math-simplify-expr))))
-       (nth 2 (nth 1 math-simplify-expr))))
+          (math-known-realp (nth 2 (nth 1 expr))))
+       (nth 2 (nth 1 expr))))
 
 
 (math-defsimplify calcFunc-erf
-  (or (and (math-looks-negp (nth 1 math-simplify-expr))
-          (math-neg (list 'calcFunc-erf (math-neg (nth 1 
math-simplify-expr)))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-conj)
+  (or (and (math-looks-negp (nth 1 expr))
+          (math-neg (list 'calcFunc-erf (math-neg (nth 1 expr)))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-conj)
           (list 'calcFunc-conj
-                 (list 'calcFunc-erf (nth 1 (nth 1 math-simplify-expr)))))))
+                 (list 'calcFunc-erf (nth 1 (nth 1 expr)))))))
 
 (math-defsimplify calcFunc-erfc
-  (or (and (math-looks-negp (nth 1 math-simplify-expr))
-          (math-sub 2 (list 'calcFunc-erfc (math-neg (nth 1 
math-simplify-expr)))))
-      (and (eq (car-safe (nth 1 math-simplify-expr)) 'calcFunc-conj)
+  (or (and (math-looks-negp (nth 1 expr))
+          (math-sub 2 (list 'calcFunc-erfc (math-neg (nth 1 expr)))))
+      (and (eq (car-safe (nth 1 expr)) 'calcFunc-conj)
           (list 'calcFunc-conj
-                 (list 'calcFunc-erfc (nth 1 (nth 1 math-simplify-expr)))))))
+                 (list 'calcFunc-erfc (nth 1 (nth 1 expr)))))))
 
 
 (defun math-linear-in (expr term &optional always)
@@ -1614,10 +1606,12 @@
 (defvar math-expr-subst-old)
 (defvar math-expr-subst-new)
 
-(defun math-expr-subst (expr math-expr-subst-old math-expr-subst-new)
-  (math-expr-subst-rec expr))
+(defun math-expr-subst (expr old new)
+  (let ((math-expr-subst-old old)
+        (math-expr-subst-new new))
+    (math-expr-subst-rec expr)))
 
-(defalias 'calcFunc-subst 'math-expr-subst)
+(defalias 'calcFunc-subst #'math-expr-subst)
 
 (defun math-expr-subst-rec (expr)
   (cond ((equal expr math-expr-subst-old) math-expr-subst-new)
@@ -1632,7 +1626,7 @@
                 (math-expr-subst-rec (nth 2 expr)))))
        (t
         (cons (car expr)
-              (mapcar 'math-expr-subst-rec (cdr expr))))))
+              (mapcar #'math-expr-subst-rec (cdr expr))))))
 
 ;;; Various measures of the size of an expression.
 (defun math-expr-weight (expr)
@@ -1659,7 +1653,7 @@
 (defun calcFunc-collect (expr base)
   (let ((p (math-is-polynomial expr base 50 t)))
     (if (cdr p)
-        (math-build-polynomial-expr (mapcar 'math-normalize p) base)
+        (math-build-polynomial-expr (mapcar #'math-normalize p) base)
       (car p))))
 
 ;;; If expr is of the form "a + bx + cx^2 + ...", return the list (a b c ...),
@@ -1672,13 +1666,16 @@
 (defvar math-is-poly-loose)
 (defvar math-var)
 
-(defun math-is-polynomial (expr math-var &optional math-is-poly-degree 
math-is-poly-loose)
-  (let* ((math-poly-base-variable (if math-is-poly-loose
-                                     (if (eq math-is-poly-loose 'gen) math-var 
'(var XXX XXX))
+(defun math-is-polynomial (expr var &optional degree loose)
+  (let* ((math-poly-base-variable (if loose
+                                     (if (eq loose 'gen) var '(var XXX XXX))
                                    math-poly-base-variable))
+         (math-var var)
+         (math-is-poly-loose loose)
+         (math-is-poly-degree degree)
         (poly (math-is-poly-rec expr math-poly-neg-powers)))
-    (and (or (null math-is-poly-degree)
-            (<= (length poly) (1+ math-is-poly-degree)))
+    (and (or (null degree)
+            (<= (length poly) (1+ degree)))
         poly)))
 
 (defun math-is-poly-rec (expr negpow)
@@ -1749,7 +1746,7 @@
                            (math-poly-mix p1 1 p2
                                           (if (eq (car expr) '+) 1 -1)))))))
             ((eq (car expr) 'neg)
-             (mapcar 'math-neg (math-is-poly-rec (nth 1 expr) negpow)))
+             (mapcar #'math-neg (math-is-poly-rec (nth 1 expr) negpow)))
             ((eq (car expr) '*)
              (let ((p1 (math-is-poly-rec (nth 1 expr) negpow)))
                (and p1
@@ -1812,24 +1809,20 @@
       (math-expr-contains expr math-poly-base-variable)
     (math-expr-depends expr var)))
 
-;;; Find the variable (or sub-expression) which is the base of polynomial expr.
 ;; The variables math-poly-base-const-ok and math-poly-base-pred are
 ;; local to math-polynomial-base, but are used by math-polynomial-base-rec.
 (defvar math-poly-base-const-ok)
 (defvar math-poly-base-pred)
 
-;; The variable math-poly-base-top-expr is local to math-polynomial-base,
-;; but is used by math-polynomial-p1 in calc-poly.el, which is called
-;; by math-polynomial-base.
-
-(defun math-polynomial-base (math-poly-base-top-expr &optional 
math-poly-base-pred)
-  (or math-poly-base-pred
-      (setq math-poly-base-pred (function (lambda (base) (math-polynomial-p
-                                              math-poly-base-top-expr base)))))
+(defun math-polynomial-base (top-expr &optional pred)
+  "Find the variable (or sub-expression) which is the base of polynomial expr."
+  (let ((math-poly-base-pred
+         (or pred (function (lambda (base) (math-polynomial-p
+                                      top-expr base))))))
   (or (let ((math-poly-base-const-ok nil))
-       (math-polynomial-base-rec math-poly-base-top-expr))
+       (math-polynomial-base-rec top-expr))
       (let ((math-poly-base-const-ok t))
-       (math-polynomial-base-rec math-poly-base-top-expr))))
+       (math-polynomial-base-rec top-expr)))))
 
 (defun math-polynomial-base-rec (mpb-expr)
   (and (not (Math-objvecp mpb-expr))
@@ -1846,8 +1839,8 @@
                (funcall math-poly-base-pred mpb-expr)
                mpb-expr))))
 
-;;; Return non-nil if expr refers to any variables.
 (defun math-expr-contains-vars (expr)
+  "Return non-nil if expr refers to any variables."
   (or (eq (car-safe expr) 'var)
       (and (not (Math-primp expr))
           (progn
@@ -1855,9 +1848,9 @@
                         (not (math-expr-contains-vars (car expr)))))
             expr))))
 
-;;; Simplify a polynomial in list form by stripping off high-end zeros.
-;;; This always leaves the constant part, i.e., nil->nil and non-nil->non-nil.
 (defun math-poly-simplify (p)
+  "Simplify a polynomial in list form by stripping off high-end zeros.
+This always leaves the constant part, i.e., nil->nil and non-nil->non-nil."
   (and p
        (if (Math-zerop (nth (1- (length p)) p))
           (let ((pp (copy-sequence p)))
@@ -1879,14 +1872,14 @@
   (or (null a)
       (and (null (cdr a)) (Math-zerop (car a)))))
 
-;;; Multiply two polynomials in list form.
 (defun math-poly-mul (a b)
+  "Multiply two polynomials in list form."
   (and a b
        (math-poly-mix b (car a)
                      (math-poly-mul (cdr a) (cons 0 b)) 1)))
 
-;;; Build an expression from a polynomial list.
 (defun math-build-polynomial-expr (p var)
+  "Build an expression from a polynomial list."
   (if p
       (if (Math-numberp var)
          (math-with-extra-prec 1
@@ -1897,8 +1890,7 @@
              accum))
        (let* ((rp (reverse p))
               (n (1- (length rp)))
-              (accum (math-mul (car rp) (math-pow var n)))
-              term)
+              (accum (math-mul (car rp) (math-pow var n))))
          (while (setq rp (cdr rp))
            (setq n (1- n))
            (or (math-zerop (car rp))
diff --git a/lisp/calc/calc-arith.el b/lisp/calc/calc-arith.el
index 345d0cd..284dfa8 100644
--- a/lisp/calc/calc-arith.el
+++ b/lisp/calc/calc-arith.el
@@ -1,6 +1,6 @@
 ;;; calc-arith.el --- arithmetic functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-bin.el b/lisp/calc/calc-bin.el
index a61cecf..d979edb 100644
--- a/lisp/calc/calc-bin.el
+++ b/lisp/calc/calc-bin.el
@@ -1,6 +1,6 @@
 ;;; calc-bin.el --- binary functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-comb.el b/lisp/calc/calc-comb.el
index f1d3dae..0277903 100644
--- a/lisp/calc/calc-comb.el
+++ b/lisp/calc/calc-comb.el
@@ -1,6 +1,6 @@
 ;;; calc-comb.el --- combinatoric functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-cplx.el b/lisp/calc/calc-cplx.el
index 35cd31d..79893c6 100644
--- a/lisp/calc/calc-cplx.el
+++ b/lisp/calc/calc-cplx.el
@@ -1,6 +1,6 @@
 ;;; calc-cplx.el --- Complex number functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-embed.el b/lisp/calc/calc-embed.el
index 6573c07..c41b232 100644
--- a/lisp/calc/calc-embed.el
+++ b/lisp/calc/calc-embed.el
@@ -1,6 +1,6 @@
 ;;; calc-embed.el --- embed Calc in a buffer
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-ext.el b/lisp/calc/calc-ext.el
index f983ebe..1456fb2 100644
--- a/lisp/calc/calc-ext.el
+++ b/lisp/calc/calc-ext.el
@@ -1,6 +1,6 @@
-;;; calc-ext.el --- various extension functions for Calc
+;;; calc-ext.el --- various extension functions for Calc  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
@@ -88,7 +88,7 @@
 (defvar calc-alg-map)
 (defvar calc-alg-esc-map)
 
-;;; The following was made a function so that it could be byte-compiled.
+;; The following was made a function so that it could be byte-compiled.
 (defun calc-init-extensions ()
 
   (define-key calc-mode-map ":" 'calc-fdiv)
@@ -714,8 +714,8 @@
 
 ;;;; (Autoloads here)
   (mapc (function (lambda (x)
-    (mapcar (function (lambda (func)
-      (autoload func (car x)))) (cdr x))))
+    (mapcar (function (lambda (func) (autoload func (car x))))
+            (cdr x))))
     '(
 
  ("calc-alg" calc-has-rules math-defsimplify
@@ -894,8 +894,8 @@ calcFunc-pcont calcFunc-pdeg calcFunc-pdiv calcFunc-pdivide
 calcFunc-pdivrem calcFunc-pgcd calcFunc-plead calcFunc-pprim
 calcFunc-prem math-accum-factors math-atomic-factorp
 math-div-poly-const math-div-thru math-expand-power math-expand-term
-math-factor-contains math-factor-expr math-factor-expr-part
-math-factor-expr-try math-factor-finish math-factor-poly-coefs
+math-factor-contains math-factor-expr
+math-factor-finish
 math-factor-protect math-mul-thru math-padded-polynomial
 math-partial-fractions math-poly-degree math-poly-deriv-coefs
 math-poly-gcd-frac-list math-poly-modulus-rec math-ratpoly-p
@@ -984,8 +984,8 @@ calc-force-refresh calc-locate-cursor-element 
calc-show-edit-buffer)
 ))
 
   (mapcar (function (lambda (x)
-    (mapcar (function (lambda (cmd)
-      (autoload cmd (car x) nil t))) (cdr x))))
+                      (mapcar (function (lambda (cmd) (autoload cmd (car x) 
nil t)))
+                              (cdr x))))
     '(
 
  ("calc-alg" calc-alg-evaluate calc-apart calc-collect calc-expand
@@ -1307,8 +1307,9 @@ calc-kill calc-kill-region calc-yank))))
            (message "%s" (if msg
                              (concat group ": " msg ":"
                                      (make-string
-                                      (- (apply 'max (mapcar 'length msgs))
-                                         (length msg)) 32)
+                                      (- (apply #'max (mapcar #'length msgs))
+                                         (length msg))
+                                       ?\s)
                                      "  [MORE]"
                                      (if key
                                          (concat "  " (char-to-string key)
@@ -1334,6 +1335,8 @@ calc-kill calc-kill-region calc-yank))))
 
 ;;; General.
 
+(defvar calc-embedded-quiet)
+
 (defun calc-reset (arg)
   (interactive "P")
   (setq arg (if arg (prefix-numeric-value arg) nil))
@@ -1398,7 +1401,7 @@ calc-kill calc-kill-region calc-yank))))
 
 (defun calc-scroll-up (n)
   (interactive "P")
-  (condition-case err
+  (condition-case nil
       (scroll-up (or n (/ (window-height) 2)))
     (error nil))
   (if (pos-visible-in-window-p (max 1 (- (point-max) 2)))
@@ -1657,7 +1660,7 @@ calc-kill calc-kill-region calc-yank))))
          (let ((entries (calc-top-list n 1 'entry))
                (calc-undo-list nil) (calc-redo-list nil))
            (calc-pop-stack n 1 t)
-           (calc-push-list (mapcar 'car entries)
+           (calc-push-list (mapcar #'car entries)
                            1
                            (mapcar (function (lambda (x) (nth 2 x)))
                                    entries)))))))
@@ -1707,7 +1710,7 @@ calc-kill calc-kill-region calc-yank))))
        (calc-pop-push-record-list 1 "eval"
                                   (math-evaluate-expr (calc-top (- n)))
                                   (- n))
-      (calc-pop-push-record-list n "eval" (mapcar 'math-evaluate-expr
+      (calc-pop-push-record-list n "eval" (mapcar #'math-evaluate-expr
                                                  (calc-top-list n)))))
    (calc-handle-whys)))
 
@@ -1928,7 +1931,7 @@ calc-kill calc-kill-region calc-yank))))
         (calc-z-prefix-buf "")
         (kmap (sort (copy-sequence (calc-user-key-map))
                     (function (lambda (x y) (< (car x) (car y))))))
-        (flags (apply 'logior
+        (flags (apply #'logior
                       (mapcar (function
                                (lambda (k)
                                  (calc-user-function-classify (car k))))
@@ -2003,12 +2006,13 @@ calc-kill calc-kill-region calc-yank))))
 ;;;; Caches.
 
 (defmacro math-defcache (name init form)
+  (declare (indent 2) (debug (symbolp sexp form)))
   (let ((cache-prec (intern (concat (symbol-name name) "-cache-prec")))
        (cache-val (intern (concat (symbol-name name) "-cache")))
        (last-prec (intern (concat (symbol-name name) "-last-prec")))
        (last-val (intern (concat (symbol-name name) "-last"))))
     `(progn
-;      (defvar ,cache-prec ,(if init (math-numdigs (nth 1 init)) -100))
+       ;; (defvar ,cache-prec ,(if init (math-numdigs (nth 1 init)) -100))
        (defvar ,cache-prec (cond
                            ((consp ,init) (math-numdigs (nth 1 ,init)))
                            (,init
@@ -2037,7 +2041,6 @@ calc-kill calc-kill-region calc-yank))))
                           ,cache-val))
                   ,last-prec calc-internal-prec))
         ,last-val))))
-(put 'math-defcache 'lisp-indent-hook 2)
 
 ;;; Betcha didn't know that pi = 16 atan(1/5) - 4 atan(1/239).   [F] [Public]
 (defconst math-approx-pi
@@ -2400,7 +2403,7 @@ If X is not an error form, return 1."
               (list 'calcFunc-intv mask lo hi)
             (math-make-intv mask lo hi))))
        ((eq (car a) 'vec)
-        (cons 'vec (mapcar 'math-normalize (cdr a))))
+        (cons 'vec (mapcar #'math-normalize (cdr a))))
        ((eq (car a) 'quote)
         (math-normalize (nth 1 a)))
        ((eq (car a) 'special-const)
@@ -2412,7 +2415,7 @@ If X is not an error form, return 1."
         (math-normalize-logical-op a))
        ((memq (car a) '(calcFunc-lambda calcFunc-quote calcFunc-condition))
         (let ((calc-simplify-mode 'none))
-          (cons (car a) (mapcar 'math-normalize (cdr a)))))
+          (cons (car a) (mapcar #'math-normalize (cdr a)))))
        ((eq (car a) 'calcFunc-evalto)
         (setq a (or (nth 1 a) 0))
         (or calc-refreshing-evaltos
@@ -2435,27 +2438,25 @@ If X is not an error form, return 1."
 ;; The variable math-normalize-a is local to math-normalize in calc.el,
 ;; but is used by math-normalize-nonstandard, which is called by
 ;; math-normalize.
-(defvar math-normalize-a)
-
-(defun math-normalize-nonstandard ()
+(defun math-normalize-nonstandard (a)
   (if (consp calc-simplify-mode)
       (progn
        (setq calc-simplify-mode 'none
-             math-simplify-only (car-safe (cdr-safe math-normalize-a)))
+             math-simplify-only (car-safe (cdr-safe a)))
        nil)
-    (and (symbolp (car math-normalize-a))
+    (and (symbolp (car a))
         (or (eq calc-simplify-mode 'none)
             (and (eq calc-simplify-mode 'num)
-                 (let ((aptr (setq math-normalize-a
+                 (let ((aptr (setq a
                                     (cons
-                                     (car math-normalize-a)
-                                     (mapcar 'math-normalize
-                                             (cdr math-normalize-a))))))
+                                     (car a)
+                                     (mapcar #'math-normalize
+                                             (cdr a))))))
                    (while (and aptr (math-constp (car aptr)))
                      (setq aptr (cdr aptr)))
                    aptr)))
-        (cons (car math-normalize-a)
-               (mapcar 'math-normalize (cdr math-normalize-a))))))
+        (cons (car a)
+               (mapcar #'math-normalize (cdr a))))))
 
 
 ;;; Normalize a bignum digit list by trimming high-end zeros.  [L l]
@@ -2808,7 +2809,7 @@ If X is not an error form, return 1."
              x)
          (if (Math-primp x)
              x
-           (cons (car x) (mapcar 'math-evaluate-expr-rec (cdr x))))))
+           (cons (car x) (mapcar #'math-evaluate-expr-rec (cdr x))))))
     x))
 
 (defun math-any-floats (expr)
@@ -2822,9 +2823,10 @@ If X is not an error form, return 1."
 (defvar math-mt-many nil)
 (defvar math-mt-func nil)
 
-(defun math-map-tree (math-mt-func mmt-expr &optional math-mt-many)
-  (or math-mt-many (setq math-mt-many 1000000))
-  (math-map-tree-rec mmt-expr))
+(defun math-map-tree (func mmt-expr &optional many)
+  (let ((math-mt-func func)
+        (math-mt-many (or many 1000000)))
+    (math-map-tree-rec mmt-expr)))
 
 (defun math-map-tree-rec (mmt-expr)
   (or (= math-mt-many 0)
@@ -2842,7 +2844,7 @@ If X is not an error form, return 1."
                  (<= math-mt-many 0))
              (setq mmt-done t)
            (setq mmt-nextval (cons (car mmt-expr)
-                                   (mapcar 'math-map-tree-rec
+                                   (mapcar #'math-map-tree-rec
                                            (cdr mmt-expr))))
            (if (equal mmt-nextval mmt-expr)
                (setq mmt-done t)
@@ -2867,6 +2869,7 @@ If X is not an error form, return 1."
 (defvar math-integral-cache)
 
 (defmacro math-defintegral (funcs &rest code)
+  (declare (indent 1) (debug (sexp body)))
   (setq math-integral-cache nil)
   (cons 'progn
         (mapcar #'(lambda (func)
@@ -2876,9 +2879,9 @@ If X is not an error form, return 1."
                            (list
                             #'(lambda (u) ,@code)))))
                 (if (symbolp funcs) (list funcs) funcs))))
-(put 'math-defintegral 'lisp-indent-hook 1)
 
 (defmacro math-defintegral-2 (funcs &rest code)
+  (declare (indent 1) (debug (sexp body)))
   (setq math-integral-cache nil)
   (cons 'progn
         (mapcar #'(lambda (func)
@@ -2887,7 +2890,6 @@ If X is not an error form, return 1."
                             (get ',func 'math-integral-2)
                             (list #'(lambda (u v) ,@code)))))
                 (if (symbolp funcs) (list funcs) funcs))))
-(put 'math-defintegral-2 'lisp-indent-hook 1)
 
 (defvar var-IntegAfterRules 'calc-IntegAfterRules)
 
@@ -3097,9 +3099,16 @@ If X is not an error form, return 1."
 ;;; Expression parsing.
 
 (defvar math-expr-data)
+(defvar math-exp-pos)
+(defvar math-exp-old-pos)
+(defvar math-exp-keep-spaces)
+(defvar math-exp-token)
+(defvar math-expr-data)
+(defvar math-exp-str)
 
-(defun math-read-expr (math-exp-str)
+(defun math-read-expr (str)
   (let ((math-exp-pos 0)
+        (math-exp-str str)
        (math-exp-old-pos 0)
        (math-exp-keep-spaces nil)
        math-exp-token math-expr-data)
@@ -3138,6 +3147,10 @@ If X is not an error form, return 1."
 
 ;;; They said it couldn't be done...
 
+(defvar math-read-big-baseline)
+(defvar math-read-big-h2)
+(defvar math-read-big-err-msg)
+
 (defun math-read-big-expr (str)
   (and (> (length calc-left-label) 0)
        (string-match (concat "^" (regexp-quote calc-left-label)) str)
@@ -3179,6 +3192,8 @@ If X is not an error form, return 1."
              '(error 0 "Syntax error"))
        (math-read-expr str)))))
 
+(defvar math-rb-h2)
+
 (defun math-read-big-bigp (math-read-big-lines)
   (and (cdr math-read-big-lines)
        (let ((matrix nil)
diff --git a/lisp/calc/calc-fin.el b/lisp/calc/calc-fin.el
index 0bdf3f0..813da28 100644
--- a/lisp/calc/calc-fin.el
+++ b/lisp/calc/calc-fin.el
@@ -1,6 +1,6 @@
 ;;; calc-fin.el --- financial functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-forms.el b/lisp/calc/calc-forms.el
index f758628..fce82d2 100644
--- a/lisp/calc/calc-forms.el
+++ b/lisp/calc/calc-forms.el
@@ -1,6 +1,6 @@
 ;;; calc-forms.el --- data format conversion functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
@@ -37,13 +37,11 @@
 (defun calc-time ()
   (interactive)
   (calc-wrapper
-   (let ((time (current-time-string)))
+   (let ((time (decode-time)))
      (calc-enter-result 0 "time"
                        (list 'mod
                              (list 'hms
-                                   (string-to-number (substring time 11 13))
-                                   (string-to-number (substring time 14 16))
-                                   (string-to-number (substring time 17 19)))
+                                   (nth 2 time) (nth 1 time) (nth 0 time))
                              (list 'hms 24 0 0))))))
 
 (defun calc-to-hms (arg)
@@ -62,7 +60,7 @@
 
 
 (defun calc-hms-notation (fmt)
-  (interactive "sHours-minutes-seconds format (hms, @ \\=' \", etc.): ")
+  (interactive "sHours-minutes-seconds format (hms, @ ' \", etc.): ")
   (calc-wrapper
    (if (string-match "\\`\\([^,; ]+\\)\\([,; ]*\\)\\([^,; ]\\)\\([,; 
]*\\)\\([^,; ]\\)\\'" fmt)
        (progn
@@ -1341,16 +1339,15 @@ as measured in the integer number of days before 
December 31, 1 BC (Gregorian)."
           (math-parse-iso-date-validate isoyear isoweek isoweekday hour minute 
second)))))
 
 (defun calcFunc-now (&optional zone)
-  (let ((date (let ((calc-date-format nil))
-               (math-parse-date (current-time-string)))))
-    (if (consp date)
-       (if zone
-           (math-add date (math-div (math-sub (calcFunc-tzone nil date)
-                                              (calcFunc-tzone zone date))
-                                    '(float 864 2)))
-         date)
-      (calc-record-why "*Unable to interpret current date from system")
-      (append (list 'calcFunc-now) (and zone (list zone))))))
+  (let ((date (let ((now (decode-time)))
+               (list 'date (math-dt-to-date
+                            (list (nth 5 now) (nth 4 now) (nth 3 now)
+                                  (nth 2 now) (nth 1 now) (nth 0 now)))))))
+    (if zone
+       (math-add date (math-div (math-sub (calcFunc-tzone nil date)
+                                          (calcFunc-tzone zone date))
+                                '(float 864 2)))
+      date)))
 
 (defun calcFunc-year (date)
   (car (math-date-to-dt date)))
diff --git a/lisp/calc/calc-frac.el b/lisp/calc/calc-frac.el
index 240d423..b420581 100644
--- a/lisp/calc/calc-frac.el
+++ b/lisp/calc/calc-frac.el
@@ -1,6 +1,6 @@
 ;;; calc-frac.el --- fraction functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-funcs.el b/lisp/calc/calc-funcs.el
index 8d110b6..a9d1539 100644
--- a/lisp/calc/calc-funcs.el
+++ b/lisp/calc/calc-funcs.el
@@ -1,6 +1,6 @@
 ;;; calc-funcs.el --- well-known functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-graph.el b/lisp/calc/calc-graph.el
index 7d1fc4b..56f11c6 100644
--- a/lisp/calc/calc-graph.el
+++ b/lisp/calc/calc-graph.el
@@ -1,6 +1,6 @@
 ;;; calc-graph.el --- graph output functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
@@ -65,6 +65,9 @@
 (defvar calc-graph-no-wait nil)
 (defvar calc-gnuplot-trail-mark)
 
+(defsubst calc-graph-w32-p ()
+  (eq system-type 'windows-nt))
+
 (defun calc-graph-fast (many)
   (interactive "P")
   (let ((calc-graph-no-auto-view t))
@@ -376,8 +379,13 @@
                    ;; Check MS-Windows before X, in case they have
                    ;; $DISPLAY set for some reason (e.g., Cygwin or
                    ;; whatever)
-                   ((string= calc-gnuplot-name "pgnuplot")
-                    "windows")
+                    ((string= calc-gnuplot-name "pgnuplot")
+                     "windows")
+                    ;; Versions of gnuplot that come without pgnuplot
+                    ;; only work on MS-Windows with "qt" as the
+                    ;; terminal, for some reason.
+                   ((calc-graph-w32-p)
+                    "qt")
                    ((or (eq window-system 'x) (getenv "DISPLAY"))
                     "x11")
                    ((>= calc-gnuplot-version 3)
@@ -1113,7 +1121,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
                  (eval (intern
                         (concat "var-"
                                 (save-excursion
-                                  (re-search-backward ":\\(.*\\)\\}")
+                                 (re-search-backward ":\\(.*\\)}")
                                   (match-string 1))))))
               (error nil)))
       (if yerr
@@ -1178,7 +1186,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
         (or (looking-at "{")
             (error "Can't hide this curve (wrong format)"))
         (forward-char 1)
-        (if (looking-at "*")
+        (if (looking-at "\\*")
             (if (or (null flag) (<= (prefix-numeric-value flag) 0))
                 (delete-char 1))
           (if (or (null flag) (> (prefix-numeric-value flag) 0))
@@ -1321,14 +1329,13 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
    (calc-graph-init)
    (calc-graph-view-trail)
    (calc-gnuplot-command cmd)
-   (or (string= calc-gnuplot-name "pgnuplot")
+   (or (calc-graph-w32-p)
        (progn
         (accept-process-output)
         (calc-graph-view-trail)))))
 
 (defun calc-graph-kill (&optional no-view)
   (interactive)
-  (calc-graph-delete-temps)
   (if (calc-gnuplot-alive)
       (calc-wrapper
        (or no-view (calc-graph-view-trail))
@@ -1337,7 +1344,8 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
        (sit-for 1)
        (if (process-status calc-gnuplot-process)
           (delete-process calc-gnuplot-process))
-       (setq calc-gnuplot-process nil))))
+       (setq calc-gnuplot-process nil)))
+  (calc-graph-delete-temps))
 
 (defun calc-graph-quit ()
   (interactive)
@@ -1404,7 +1412,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
 (defun calc-gnuplot-command (&rest args)
   (calc-graph-init)
   (let ((cmd (concat (mapconcat 'identity args " ") "\n")))
-    (or (string= calc-gnuplot-name "pgnuplot")
+    (or (calc-graph-w32-p)
        (accept-process-output))
     (with-current-buffer calc-gnuplot-buffer
       (calc-gnuplot-check-for-errors)
@@ -1416,7 +1424,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
       (process-send-string calc-gnuplot-process cmd)
       (if (get-buffer-window calc-gnuplot-buffer)
          (calc-graph-view-trail))
-      (or (string= calc-gnuplot-name "pgnuplot")
+      (or (calc-graph-w32-p)
          (accept-process-output (and (not calc-graph-no-wait)
                                      calc-gnuplot-process)))
       (calc-gnuplot-check-for-errors)
@@ -1445,8 +1453,9 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
          (setq origin (point)))
        (setq calc-graph-last-device nil)
        (setq calc-graph-last-output nil)
-       (if (string= calc-gnuplot-name "pgnuplot")
-           (let ((version-str (shell-command-to-string "pgnuplot -V")))
+       (if (calc-graph-w32-p)
+           (let ((version-str
+                   (shell-command-to-string (concat calc-gnuplot-name " -V"))))
              (if (string-match "gnuplot \\([0-9]+\\)\\." version-str)
                  (setq calc-gnuplot-version (string-to-number
                                              (substring version-str
@@ -1457,11 +1466,11 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
            (let ((args (append (and calc-gnuplot-display
                                     (not (equal calc-gnuplot-display
                                                 (getenv "DISPLAY")))
-                                    (not (string= calc-gnuplot-name 
"pgnuplot"))
+                                     (not (calc-graph-w32-p))
                                     (list "-display"
                                           calc-gnuplot-display))
                                (and calc-gnuplot-geometry
-                                    (not (string= calc-gnuplot-name 
"pgnuplot"))
+                                    (not (calc-graph-w32-p))
                                     (list "-geometry"
                                           calc-gnuplot-geometry)))))
              (setq calc-gnuplot-process
@@ -1475,7 +1484,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
           (error "Sorry, can't find \"%s\" on your system"
                  calc-gnuplot-name)))
        (with-current-buffer calc-gnuplot-buffer
-         (while (and (not (string= calc-gnuplot-name "pgnuplot"))
+         (while (and (not (calc-graph-w32-p))
                      (not (save-excursion
                             (goto-char origin)
                             (search-forward "gnuplot> " nil t)))
@@ -1483,7 +1492,7 @@ This \"dumb\" driver will be present in Gnuplot 3.0."
            (accept-process-output calc-gnuplot-process))
          (or (memq (process-status calc-gnuplot-process) '(run stop))
              (error "Unable to start GNUPLOT process"))
-         (if (not (string= calc-gnuplot-name "pgnuplot"))
+         (if (not (calc-graph-w32-p))
              (if (save-excursion
                    (goto-char origin)
                    (re-search-forward
diff --git a/lisp/calc/calc-help.el b/lisp/calc/calc-help.el
index de00ff6..d9e8fe7 100644
--- a/lisp/calc/calc-help.el
+++ b/lisp/calc/calc-help.el
@@ -1,6 +1,6 @@
 ;;; calc-help.el --- help display functions for Calc,
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
@@ -172,7 +172,7 @@ C-w  Describe how there is no warranty for Calc."
          (setq desc (concat "M-" (substring desc 4))))
       (while (string-match "^M-# \\(ESC \\|C-\\)" desc)
        (setq desc (concat "M-# " (substring desc (match-end 0)))))
-      (if (string-match "\\(DEL\\|\\LFD\\|RET\\|SPC\\|TAB\\)" desc)
+      (if (string-match "\\(DEL\\|LFD\\|RET\\|SPC\\|TAB\\)" desc)
           (setq desc (replace-match "<\\&>" nil nil desc)))
       (if briefly
          (let ((msg (with-current-buffer (get-buffer-create "*Calc Summary*")
diff --git a/lisp/calc/calc-incom.el b/lisp/calc/calc-incom.el
index 50a6793..4bf922b 100644
--- a/lisp/calc/calc-incom.el
+++ b/lisp/calc/calc-incom.el
@@ -1,6 +1,6 @@
 ;;; calc-incom.el --- complex data type input functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-keypd.el b/lisp/calc/calc-keypd.el
index 2b22421..15bdc5b 100644
--- a/lisp/calc/calc-keypd.el
+++ b/lisp/calc/calc-keypd.el
@@ -1,6 +1,6 @@
 ;;; calc-keypd.el --- mouse-capable keypad input for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-lang.el b/lisp/calc/calc-lang.el
index b6ff705..ee107df 100644
--- a/lisp/calc/calc-lang.el
+++ b/lisp/calc/calc-lang.el
@@ -1,6 +1,6 @@
 ;;; calc-lang.el --- calc language functions
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
@@ -753,8 +753,8 @@
                  right " \\right)"))
           ((and (eq (aref func 0) ?\\)
                 (not (or
-                      (string-match "\\hbox{" func)
-                      (string-match "\\text{" func)))
+                      (string-match "\\\\hbox{" func)
+                      (string-match "\\\\text{" func)))
                 (= (length a) 2)
                 (or (Math-realp (nth 1 a))
                     (memq (car (nth 1 a)) '(var *))))
@@ -1127,7 +1127,7 @@
                  (math-read-token)))))))
 
 (put 'eqn 'math-lang-read
-     '((eq (string-match "->\\|<-\\|+-\\|\\\\dots\\|~\\|\\^"
+     '((eq (string-match "->\\|<-\\|\\+-\\|\\\\dots\\|~\\|\\^"
                          math-exp-str math-exp-pos)
            math-exp-pos)
        (progn
diff --git a/lisp/calc/calc-macs.el b/lisp/calc/calc-macs.el
index 0a1f552..033f6e9 100644
--- a/lisp/calc/calc-macs.el
+++ b/lisp/calc/calc-macs.el
@@ -1,6 +1,6 @@
 ;;; calc-macs.el --- important macros for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-map.el b/lisp/calc/calc-map.el
index 67a4dc3..0ba5ec7 100644
--- a/lisp/calc/calc-map.el
+++ b/lisp/calc/calc-map.el
@@ -1,6 +1,6 @@
 ;;; calc-map.el --- higher-order functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-math.el b/lisp/calc/calc-math.el
index 483907a..62fe3d4 100644
--- a/lisp/calc/calc-math.el
+++ b/lisp/calc/calc-math.el
@@ -1,6 +1,6 @@
 ;;; calc-math.el --- mathematical functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-menu.el b/lisp/calc/calc-menu.el
index 245a5f90..23a27e9 100644
--- a/lisp/calc/calc-menu.el
+++ b/lisp/calc/calc-menu.el
@@ -1,6 +1,6 @@
 ;;; calc-menu.el --- a menu for Calc
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/calc/calc-misc.el b/lisp/calc/calc-misc.el
index 6543920..aedb687 100644
--- a/lisp/calc/calc-misc.el
+++ b/lisp/calc/calc-misc.el
@@ -1,6 +1,6 @@
 ;;; calc-misc.el --- miscellaneous functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-mode.el b/lisp/calc/calc-mode.el
index 8070907..22a4b87 100644
--- a/lisp/calc/calc-mode.el
+++ b/lisp/calc/calc-mode.el
@@ -1,6 +1,6 @@
 ;;; calc-mode.el --- calculator modes for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-mtx.el b/lisp/calc/calc-mtx.el
index a314985..325e075 100644
--- a/lisp/calc/calc-mtx.el
+++ b/lisp/calc/calc-mtx.el
@@ -1,6 +1,6 @@
 ;;; calc-mtx.el --- matrix functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-nlfit.el b/lisp/calc/calc-nlfit.el
index b63d404..0349dc2 100644
--- a/lisp/calc/calc-nlfit.el
+++ b/lisp/calc/calc-nlfit.el
@@ -1,6 +1,6 @@
 ;;; calc-nlfit.el --- nonlinear curve fitting for Calc
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/calc/calc-poly.el b/lisp/calc/calc-poly.el
index 64f221e..5fba85e 100644
--- a/lisp/calc/calc-poly.el
+++ b/lisp/calc/calc-poly.el
@@ -1,6 +1,6 @@
-;;; calc-poly.el --- polynomial functions for Calc
+;;; calc-poly.el --- polynomial functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
@@ -177,8 +177,8 @@
     (math-add (car res) (math-div (cdr res) pd))))
 
 
-;;; Multiply two terms, expanding out products of sums.
 (defun math-mul-thru (lhs rhs)
+  "Multiply two terms, expanding out products of sums."
   (if (memq (car-safe lhs) '(+ -))
       (list (car lhs)
            (math-mul-thru (nth 1 lhs) rhs)
@@ -197,8 +197,8 @@
     (math-div num den)))
 
 
-;;; Sort the terms of a sum into canonical order.
 (defun math-sort-terms (expr)
+  "Sort the terms of a sum into canonical order."
   (if (memq (car-safe expr) '(+ -))
       (math-list-to-sum
        (sort (math-sum-to-list expr)
@@ -223,8 +223,8 @@
                (math-sum-to-list (nth 2 tree) (not neg))))
        (t (list (cons tree neg)))))
 
-;;; Check if the polynomial coefficients are modulo forms.
 (defun math-poly-modulus (expr &optional expr2)
+  "Check if the polynomial coefficients are modulo forms."
   (or (math-poly-modulus-rec expr)
       (and expr2 (math-poly-modulus-rec expr2))
       1))
@@ -237,12 +237,13 @@
             (math-poly-modulus-rec (nth 2 expr))))))
 
 
-;;; Divide two polynomials.  Return (quotient . remainder).
 (defvar math-poly-div-base nil)
-(defun math-poly-div (u v &optional math-poly-div-base)
-  (if math-poly-div-base
-      (math-do-poly-div u v)
-    (math-do-poly-div (calcFunc-expand u) (calcFunc-expand v))))
+(defun math-poly-div (u v &optional div-base)
+  "Divide two polynomials.  Return (quotient . remainder)."
+  (let ((math-poly-div-base div-base))
+    (if div-base
+        (math-do-poly-div u v)
+      (math-do-poly-div (calcFunc-expand u) (calcFunc-expand v)))))
 
 (defun math-poly-div-exact (u v &optional base)
   (let ((res (math-poly-div u v base)))
@@ -308,8 +309,8 @@
                       (math-div (math-build-polynomial-expr (cdr res) base)
                                 v)))))))
 
-;;; Divide two polynomials in coefficient-list form.  Return (quot . rem).
 (defun math-poly-div-coefs (u v)
+  "Divide two polynomials in coefficient-list form.  Return (quot . rem)."
   (cond ((null v) (math-reject-arg nil "Division by zero"))
        ((< (length u) (length v)) (cons nil u))
        ((cdr u)
@@ -334,9 +335,9 @@
         (cons (list (math-poly-div-rec (car u) (car v)))
               nil))))
 
-;;; Perform a pseudo-division of polynomials.  (See Knuth section 4.6.1.)
-;;; This returns only the remainder from the pseudo-division.
 (defun math-poly-pseudo-div (u v)
+  "Perform a pseudo-division of polynomials.  (See Knuth section 4.6.1.)
+This returns only the remainder from the pseudo-division."
   (cond ((null v) nil)
        ((< (length u) (length v)) u)
        ((or (cdr u) (cdr v))
@@ -359,8 +360,8 @@
           (nreverse (mapcar 'math-simplify urev))))
        (t nil)))
 
-;;; Compute the GCD of two multivariate polynomials.
 (defun math-poly-gcd (u v)
+  "Compute the GCD of two multivariate polynomials."
   (cond ((Math-equal u v) u)
        ((math-constp u)
         (if (Math-zerop u)
@@ -423,7 +424,7 @@
 (defun math-poly-gcd-coefs (u v)
   (let ((d (math-poly-gcd (math-poly-gcd-list u)
                          (math-poly-gcd-list v)))
-       (g 1) (h 1) (z 0) hh r delta ghd)
+       (g 1) (h 1) (z 0) r delta)
     (while (and u v (Math-zerop (car u)) (Math-zerop (car v)))
       (setq u (cdr u) v (cdr v) z (1+ z)))
     (or (eq d 1)
@@ -452,8 +453,8 @@
     v))
 
 
-;;; Return true if is a factor containing no sums or quotients.
 (defun math-atomic-factorp (expr)
+  "Return true if is a factor containing no sums or quotients."
   (cond ((eq (car-safe expr) '*)
         (and (math-atomic-factorp (nth 1 expr))
              (math-atomic-factorp (nth 2 expr))))
@@ -463,14 +464,13 @@
         (math-atomic-factorp (nth 1 expr)))
        (t t)))
 
-;;; Find a suitable base for dividing a by b.
-;;; The base must exist in both expressions.
-;;; The degree in the numerator must be higher or equal than the
-;;; degree in the denominator.
-;;; If the above conditions are not met the quotient is just a remainder.
-;;; Return nil if this is the case.
-
 (defun math-poly-div-base (a b)
+  "Find a suitable base for dividing a by b.
+The base must exist in both expressions.
+The degree in the numerator must be higher or equal than the
+degree in the denominator.
+If the above conditions are not met the quotient is just a remainder.
+Return nil if this is the case."
   (let (a-base b-base)
     (and (setq a-base (math-total-polynomial-base a))
         (setq b-base (math-total-polynomial-base b))
@@ -482,12 +482,11 @@
                       (throw 'return (car (car a-base))))))
             (setq a-base (cdr a-base)))))))
 
-;;; Same as above but for gcd algorithm.
-;;; Here there is no requirement that degree(a) > degree(b).
-;;; Take the base that has the highest degree considering both a and b.
-;;; ("a^20+b^21+x^3+a+b", "a+b^2+x^5+a^22+b^10") --> (a 22)
-
 (defun math-poly-gcd-base (a b)
+  "Same as `math-poly-div-base' but for gcd algorithm.
+Here there is no requirement that degree(a) > degree(b).
+Take the base that has the highest degree considering both a and b.
+  (\"a^20+b^21+x^3+a+b\", \"a+b^2+x^5+a^22+b^10\") --> (a 22)"
   (let (a-base b-base)
     (and (setq a-base (math-total-polynomial-base a))
         (setq b-base (math-total-polynomial-base b))
@@ -501,8 +500,8 @@
                   (throw 'return (car (car b-base)))
                 (setq b-base (cdr b-base)))))))))
 
-;;; Sort a list of polynomial bases.
 (defun math-sort-poly-base-list (lst)
+  "Sort a list of polynomial bases."
   (sort lst (function (lambda (a b)
                        (or (> (nth 1 a) (nth 1 b))
                            (and (= (nth 1 a) (nth 1 b))
@@ -511,21 +510,18 @@
 ;;; Given an expression find all variables that are polynomial bases.
 ;;; Return list in the form '( (var1 degree1) (var2 degree2) ... ).
 
-;; The variable math-poly-base-total-base is local to
-;; math-total-polynomial-base, but is used by math-polynomial-p1,
-;; which is called by math-total-polynomial-base.
+;; The variable math-poly-base-total-base and math-poly-base-top-expr are local
+;; to math-total-polynomial-base, but used by math-polynomial-p1, which is
+;; called by math-total-polynomial-base.
 (defvar math-poly-base-total-base)
+(defvar math-poly-base-top-expr)
 
 (defun math-total-polynomial-base (expr)
-  (let ((math-poly-base-total-base nil))
-    (math-polynomial-base expr 'math-polynomial-p1)
+  (let ((math-poly-base-total-base nil)
+        (math-poly-base-top-expr expr))
+    (math-polynomial-base expr #'math-polynomial-p1)
     (math-sort-poly-base-list math-poly-base-total-base)))
 
-;; The variable math-poly-base-top-expr is local to math-polynomial-base
-;; in calc-alg.el, but is used by math-polynomial-p1 which is called
-;; by math-polynomial-base.
-(defvar math-poly-base-top-expr)
-
 (defun math-polynomial-p1 (subexpr)
   (or (assoc subexpr math-poly-base-total-base)
       (memq (car subexpr) '(+ - * / neg))
@@ -554,28 +550,30 @@
 ;; called (indirectly) by calcFunc-factors and calcFunc-factor.
 (defvar math-to-list)
 
-(defun calcFunc-factors (math-fact-expr &optional var)
+(defun calcFunc-factors (expr &optional var)
   (let ((math-factored-vars (if var t nil))
        (math-to-list t)
        (calc-prefer-frac t))
     (or var
-       (setq var (math-polynomial-base math-fact-expr)))
+       (setq var (math-polynomial-base expr)))
     (let ((res (math-factor-finish
-               (or (catch 'factor (math-factor-expr-try var))
-                   math-fact-expr))))
+               (or (catch 'factor
+                      (let ((math-fact-expr expr)) (math-factor-expr-try var)))
+                   expr))))
       (math-simplify (if (math-vectorp res)
                         res
                       (list 'vec (list 'vec res 1)))))))
 
-(defun calcFunc-factor (math-fact-expr &optional var)
+(defun calcFunc-factor (expr &optional var)
   (let ((math-factored-vars nil)
        (math-to-list nil)
        (calc-prefer-frac t))
     (math-simplify (math-factor-finish
                    (if var
-                       (let ((math-factored-vars t))
-                         (or (catch 'factor (math-factor-expr-try var)) 
math-fact-expr))
-                     (math-factor-expr math-fact-expr))))))
+                       (let ((math-factored-vars t)
+                              (math-fact-expr expr))
+                         (or (catch 'factor (math-factor-expr-try var)) expr))
+                     (math-factor-expr expr))))))
 
 (defun math-factor-finish (x)
   (if (Math-primp x)
@@ -589,18 +587,19 @@
       (list 'calcFunc-Fac-Prot x)
     x))
 
-(defun math-factor-expr (math-fact-expr)
-  (cond ((eq math-factored-vars t) math-fact-expr)
-       ((or (memq (car-safe math-fact-expr) '(* / ^ neg))
-            (assq (car-safe math-fact-expr) calc-tweak-eqn-table))
-        (cons (car math-fact-expr) (mapcar 'math-factor-expr (cdr 
math-fact-expr))))
-       ((memq (car-safe math-fact-expr) '(+ -))
+(defun math-factor-expr (expr)
+  (cond ((eq math-factored-vars t) expr)
+       ((or (memq (car-safe expr) '(* / ^ neg))
+            (assq (car-safe expr) calc-tweak-eqn-table))
+        (cons (car expr) (mapcar 'math-factor-expr (cdr expr))))
+       ((memq (car-safe expr) '(+ -))
         (let* ((math-factored-vars math-factored-vars)
-               (y (catch 'factor (math-factor-expr-part math-fact-expr))))
+               (y (catch 'factor (let ((math-fact-expr expr))
+                                    (math-factor-expr-part expr)))))
           (if y
               (math-factor-expr y)
-            math-fact-expr)))
-       (t math-fact-expr)))
+            expr)))
+       (t expr)))
 
 (defun math-factor-expr-part (x)    ; uses "expr"
   (if (memq (car-safe x) '(+ - * / ^ neg))
@@ -616,20 +615,20 @@
 ;; used by math-factor-poly-coefs, which is called by math-factor-expr-try.
 (defvar math-fet-x)
 
-(defun math-factor-expr-try (math-fet-x)
+(defun math-factor-expr-try (x)
   (if (eq (car-safe math-fact-expr) '*)
       (let ((res1 (catch 'factor (let ((math-fact-expr (nth 1 math-fact-expr)))
-                                  (math-factor-expr-try math-fet-x))))
+                                  (math-factor-expr-try x))))
            (res2 (catch 'factor (let ((math-fact-expr (nth 2 math-fact-expr)))
-                                  (math-factor-expr-try math-fet-x)))))
+                                  (math-factor-expr-try x)))))
        (and (or res1 res2)
             (throw 'factor (math-accum-factors (or res1 (nth 1 
math-fact-expr)) 1
                                                (or res2 (nth 2 
math-fact-expr))))))
-    (let* ((p (math-is-polynomial math-fact-expr math-fet-x 30 'gen))
+    (let* ((p (math-is-polynomial math-fact-expr x 30 'gen))
           (math-poly-modulus (math-poly-modulus math-fact-expr))
           res)
       (and (cdr p)
-          (setq res (math-factor-poly-coefs p))
+          (setq res (let ((math-fet-x x)) (math-factor-poly-coefs p)))
           (throw 'factor res)))))
 
 (defun math-accum-factors (fac pow facs)
@@ -735,7 +734,6 @@
                   (let ((roots (car t1))
                         (csign (if (math-negp (nth (1- (length p)) p)) -1 1))
                         (expr 1)
-                        (unfac (nth 1 t1))
                         (scale (nth 2 t1)))
                     (while roots
                       (let ((coef0 (car (car roots)))
@@ -1108,7 +1106,7 @@ If no partial fraction representation can be found, 
return nil."
        (t expr)))
 
 (defun calcFunc-expand (expr &optional many)
-  (math-normalize (math-map-tree 'math-expand-term expr many)))
+  (math-normalize (math-map-tree #'math-expand-term expr many)))
 
 (defun math-expand-power (x n &optional var else-nil)
   (or (and (natnump n)
diff --git a/lisp/calc/calc-prog.el b/lisp/calc/calc-prog.el
index fc73143..ba8efd4 100644
--- a/lisp/calc/calc-prog.el
+++ b/lisp/calc/calc-prog.el
@@ -1,6 +1,6 @@
 ;;; calc-prog.el --- user programmability functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-rewr.el b/lisp/calc/calc-rewr.el
index cc68272..e990071 100644
--- a/lisp/calc/calc-rewr.el
+++ b/lisp/calc/calc-rewr.el
@@ -1,6 +1,6 @@
 ;;; calc-rewr.el --- rewriting functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-rules.el b/lisp/calc/calc-rules.el
index 61396a1..4f53d89 100644
--- a/lisp/calc/calc-rules.el
+++ b/lisp/calc/calc-rules.el
@@ -1,6 +1,6 @@
 ;;; calc-rules.el --- rules for simplifying algebraic expressions in Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-sel.el b/lisp/calc/calc-sel.el
index 3c36bb3..5616bd0 100644
--- a/lisp/calc/calc-sel.el
+++ b/lisp/calc/calc-sel.el
@@ -1,6 +1,6 @@
 ;;; calc-sel.el --- data selection functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-stat.el b/lisp/calc/calc-stat.el
index af4a6bb..54ecc1b 100644
--- a/lisp/calc/calc-stat.el
+++ b/lisp/calc/calc-stat.el
@@ -1,6 +1,6 @@
 ;;; calc-stat.el --- statistical functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-store.el b/lisp/calc/calc-store.el
index 864b162..3987c12 100644
--- a/lisp/calc/calc-store.el
+++ b/lisp/calc/calc-store.el
@@ -1,6 +1,6 @@
 ;;; calc-store.el --- value storage functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
@@ -405,8 +405,8 @@
                                     sconst))))
        (if var
            (let ((msg (calc-store-value var value "")))
-             (message (concat "Special constant \"%s\" copied to \"%s\"" msg)
-                      sconst (calc-var-name var)))))))))
+            (message "Special constant \"%s\" copied to \"%s\"%s"
+                     sconst (calc-var-name var) msg))))))))
 
 (defun calc-copy-variable (&optional var1 var2)
   (interactive)
diff --git a/lisp/calc/calc-stuff.el b/lisp/calc/calc-stuff.el
index 4db3443..173ecda 100644
--- a/lisp/calc/calc-stuff.el
+++ b/lisp/calc/calc-stuff.el
@@ -1,6 +1,6 @@
 ;;; calc-stuff.el --- miscellaneous functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-trail.el b/lisp/calc/calc-trail.el
index 74864ed..0eb03f4 100644
--- a/lisp/calc/calc-trail.el
+++ b/lisp/calc/calc-trail.el
@@ -1,6 +1,6 @@
 ;;; calc-trail.el --- functions for manipulating the Calc "trail"
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-undo.el b/lisp/calc/calc-undo.el
index 9101190..795a8bc 100644
--- a/lisp/calc/calc-undo.el
+++ b/lisp/calc/calc-undo.el
@@ -1,6 +1,6 @@
 ;;; calc-undo.el --- undo functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-units.el b/lisp/calc/calc-units.el
index ab76ded..86bebe6 100644
--- a/lisp/calc/calc-units.el
+++ b/lisp/calc/calc-units.el
@@ -1,6 +1,6 @@
-;;; calc-units.el --- unit conversion functions for Calc
+;;; calc-units.el --- unit conversion functions for Calc  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
@@ -46,6 +46,9 @@
 ;; CODATA values updated February 2016, using 2014 adjustment
 ;; http://arxiv.org/pdf/1507.07956.pdf
 
+;; Updated November 2018 for the redefinition of the SI
+;; https://www.bipm.org/utils/en/pdf/CGPM/Draft-Resolution-A-EN.pdf
+
 (defvar math-standard-units
   '( ;; Length
     ( m       nil                    "*Meter" )
@@ -118,7 +121,7 @@
     ( mph     "mi/hr"                "*Miles per hour" )
     ( kph     "km/hr"                "Kilometers per hour" )
     ( knot    "nmi/hr"               "Knot" )
-    ( c       "299792458 m/s"        "Speed of light" ) ;;; CODATA
+    ( c       "299792458 m/s"        "Speed of light" ) ;; SI definition
 
     ;; Acceleration
     ( ga      "980665*10^(-5) m/s^2" "*\"g\" acceleration" nil
@@ -207,8 +210,8 @@
     ( C       "A s"                   "Coulomb" )
     ( Fdy     "ech Nav"               "Faraday" )
     ( e       "ech"                   "Elementary charge" )
-    ( ech     "1.6021766208*10^(-19) C"     "Elementary charge" nil
-              "1.6021766208 10^-19 C (*)") ;;(approx) CODATA
+    ( ech     "1.602176634*10^(-19) C"    "Elementary charge" nil
+              "1.602176634 10^-19 C")     ;; SI definition
     ( V       "W/A"                   "Volt" )
     ( ohm     "V/A"                   "Ohm" )
     ( Ω       "ohm"                   "Ohm" )
@@ -256,18 +259,21 @@
     ( sr      nil                      "*Steradian" )
 
     ;; Other physical quantities
-    ;; The values are from CODATA, and are approximate.
-    ( h       "6.626070040*10^(-34) J s"     "*Planck's constant" nil
-              "6.626070040 10^-34 J s (*)")
+    ;; Unless otherwise mentioned, the values are from CODATA,
+    ;; and are approximate.
+    ( h       "6.62607015*10^(-34) J s"     "*Planck's constant" nil
+              "6.62607015 10^-34 J s")      ;; SI definition
     ( hbar    "h / (2 pi)"                  "Planck's constant" ) ;; Exact
-    ( mu0     "4 pi 10^(-7) H/m"            "Permeability of vacuum") ;; Exact
-    ( μ0      "mu0"                         "Permeability of vacuum") ;; Exact
-    ( eps0    "1 / (mu0 c^2)"               "Permittivity of vacuum" )
+    ;; After the 2018 SI redefinition, eps0 and mu0 are measured quantities,
+    ;; and mu0 no longer has the previous exact value of 4 pi 10^(-7) H/m.
+    ( eps0    "ech^2 / (2 alpha h c)"       "Permittivity of vacuum" )
     ( ε0      "eps0"                        "Permittivity of vacuum" )
+    ( mu0     "1 / (eps0 c^2)"              "Permeability of vacuum") ;; Exact
+    ( μ0      "mu0"                         "Permeability of vacuum") ;; Exact
     ( G       "6.67408*10^(-11) m^3/(kg s^2)"    "Gravitational constant" nil
               "6.67408 10^-11 m^3/(kg s^2) (*)")
-    ( Nav     "6.022140857*10^(23) / mol"    "Avogadro's constant" nil
-              "6.022140857 10^23 / mol (*)")
+    ( Nav     "6.02214076*10^(23) / mol"    "Avogadro's constant" nil
+              "6.02214076 10^23 / mol")     ;; SI definition
     ( me      "9.10938356*10^(-31) kg"      "Electron rest mass" nil
               "9.10938356 10^-31 kg (*)")
     ( mp      "1.672621898*10^(-27) kg"     "Proton rest mass" nil
@@ -280,12 +286,10 @@
               "1.883531594 10^-28 kg (*)")
     ( Ryd     "10973731.568508 /m"          "Rydberg's constant" nil
               "10973731.568508 /m (*)")
-    ( k       "1.38064852*10^(-23) J/K"      "Boltzmann's constant" nil
-              "1.38064852 10^-23 J/K (*)")
-    ( sigma   "5.670367*10^(-8) W/(m^2 K^4)" "Stefan-Boltzmann constant" nil
-              "5.670367 10^-8 W/(m^2 K^4) (*)")
-    ( σ       "sigma" "Stefan-Boltzmann constant" nil
-              "5.670367 10^-8 W/(m^2 K^4) (*)")
+    ( k       "1.380649*10^(-23) J/K"       "Boltzmann's constant" nil
+              "1.380649 10^-23 J/K")        ;; SI definition
+    ( sigma   "2 pi^5 k^4 / (15 h^3 c^2)"   "Stefan-Boltzmann constant")
+    ( σ       "sigma"                       "Stefan-Boltzmann constant")
     ( alpha   "7.2973525664*10^(-3)"        "Fine structure constant" nil
               "7.2973525664 10^-3 (*)")
     ( α       "alpha"                        "Fine structure constant" nil
@@ -298,8 +302,7 @@
               "-928.4764620 10^-26 J/T (*)")
     ( mup     "1.4106067873*10^(-26) J/T"    "Proton magnetic moment" nil
               "1.4106067873 10^-26 J/T (*)")
-    ( R0      "8.3144598 J/(mol K)"          "Molar gas constant" nil
-              "8.3144598 J/(mol K) (*)")
+    ( R0      "Nav k"                       "Molar gas constant") ;; Exact
     ( V0      "22.710947*10^(-3) m^3/mol"   "Standard volume of ideal gas" nil
               "22.710947 10^-3 m^3/mol (*)")
     ;; Logarithmic units
@@ -452,7 +455,6 @@ If COMP or STD is non-nil, put that in the units table 
instead."
         (uoldname nil)
          (unitscancel nil)
          (nouold nil)
-        unew
          units
          defunits)
      (if (or (not (math-units-in-expr-p expr t))
@@ -669,8 +671,8 @@ If COMP or STD is non-nil, put that in the units table 
instead."
                                       (substring name (1+ pos)))))
                (setq name (concat "(" name ")"))))
          (or (eq (nth 1 expr) (car u))
-             (setq name (concat (nth 2 (assq (aref (symbol-name
-                                                    (nth 1 expr)) 0)
+             (setq name (concat (nth 2 (assq (aref (symbol-name (nth 1 expr))
+                                                    0)
                                              math-unit-prefixes))
                                 (if (and (string-match "[^a-zA-Zα-ωΑ-Ω0-9']" 
name)
                                          (not (memq (car u) '(mHg gf))))
@@ -854,7 +856,7 @@ If COMP or STD is non-nil, put that in the units table 
instead."
   (or math-units-table
       (let* ((combined-units (append math-additional-units
                                     math-standard-units))
-            (math-cu-unit-list (mapcar 'car combined-units))
+            (math-cu-unit-list (mapcar #'car combined-units))
             tab)
        (message "Building units table...")
        (setq math-units-table-buffer-valid nil)
@@ -877,7 +879,7 @@ If COMP or STD is non-nil, put that in the units table 
instead."
                                    (nth 4 x))))
                          combined-units))
        (let ((math-units-table tab))
-         (mapc 'math-find-base-units tab))
+         (mapc #'math-find-base-units tab))
        (message "Building units table...done")
        (setq math-units-table tab))))
 
@@ -887,15 +889,16 @@ If COMP or STD is non-nil, put that in the units table 
instead."
 (defvar math-fbu-base)
 (defvar math-fbu-entry)
 
-(defun math-find-base-units (math-fbu-entry)
-  (if (eq (nth 4 math-fbu-entry) 'boom)
-      (error "Circular definition involving unit %s" (car math-fbu-entry)))
-  (or (nth 4 math-fbu-entry)
-      (let (math-fbu-base)
-       (setcar (nthcdr 4 math-fbu-entry) 'boom)
-       (math-find-base-units-rec (nth 1 math-fbu-entry) 1)
+(defun math-find-base-units (entry)
+  (if (eq (nth 4 entry) 'boom)
+      (error "Circular definition involving unit %s" (car entry)))
+  (or (nth 4 entry)
+      (let (math-fbu-base
+            (math-fbu-entry entry))
+       (setcar (nthcdr 4 entry) 'boom)
+       (math-find-base-units-rec (nth 1 entry) 1)
        '(or math-fbu-base
-           (error "Dimensionless definition for unit %s" (car math-fbu-entry)))
+           (error "Dimensionless definition for unit %s" (car entry)))
        (while (eq (cdr (car math-fbu-base)) 0)
          (setq math-fbu-base (cdr math-fbu-base)))
        (let ((b math-fbu-base))
@@ -904,7 +907,7 @@ If COMP or STD is non-nil, put that in the units table 
instead."
                (setcdr b (cdr (cdr b)))
              (setq b (cdr b)))))
        (setq math-fbu-base (sort math-fbu-base 'math-compare-unit-names))
-       (setcar (nthcdr 4 math-fbu-entry) math-fbu-base)
+       (setcar (nthcdr 4 entry) math-fbu-base)
        math-fbu-base)))
 
 (defun math-compare-unit-names (a b)
@@ -939,7 +942,8 @@ If COMP or STD is non-nil, put that in the units table 
instead."
               (error "Unknown name %s in defining expression for unit %s"
                      (nth 1 expr) (car math-fbu-entry))))
           ((equal expr '(calcFunc-ln 10)))
-         (t (error "Malformed defining expression for unit %s" (car 
math-fbu-entry))))))
+         (t (error "Malformed defining expression for unit %s"
+                    (car math-fbu-entry))))))
 
 
 (defun math-units-in-expr-p (expr sub-exprs)
@@ -1015,8 +1019,9 @@ If COMP or STD is non-nil, put that in the units table 
instead."
 ;; math-to-standard-units.
 (defvar math-which-standard)
 
-(defun math-to-standard-units (expr math-which-standard)
-  (math-to-standard-rec expr))
+(defun math-to-standard-units (expr which-standard)
+  (let ((math-which-standard which-standard))
+    (math-to-standard-rec expr)))
 
 (defun math-to-standard-rec (expr)
   (if (eq (car-safe expr) 'var)
@@ -1049,7 +1054,7 @@ If COMP or STD is non-nil, put that in the units table 
instead."
               (eq (car-safe (nth 1 expr)) 'var)))
        expr
       (cons (car expr)
-           (mapcar 'math-to-standard-rec (cdr expr))))))
+           (mapcar #'math-to-standard-rec (cdr expr))))))
 
 (defun math-apply-units (expr units ulist &optional pure)
   (setq expr (math-simplify-units expr))
@@ -1082,8 +1087,7 @@ If COMP or STD is non-nil, put that in the units table 
instead."
        (let ((entry (list units calc-internal-prec calc-prefer-frac)))
         (or (equal entry (car math-decompose-units-cache))
             (let ((ulist nil)
-                  (utemp units)
-                  qty unit)
+                  (utemp units))
               (while (eq (car-safe utemp) '+)
                 (setq ulist (cons (math-decompose-unit-part (nth 2 utemp))
                                   ulist)
@@ -1141,15 +1145,15 @@ If COMP or STD is non-nil, put that in the units table 
instead."
 (defvar math-cu-new-units)
 (defvar math-cu-pure)
 
-(defun math-convert-units (expr math-cu-new-units &optional math-cu-pure)
-  (if (eq (car-safe math-cu-new-units) 'var)
-      (let ((unew (assq (nth 1 math-cu-new-units)
+(defun math-convert-units (expr new-units &optional pure)
+  (if (eq (car-safe new-units) 'var)
+      (let ((unew (assq (nth 1 new-units)
                         (math-build-units-table))))
         (if (eq (car-safe (nth 1 unew)) '+)
-            (setq math-cu-new-units (nth 1 unew)))))
+            (setq new-units (nth 1 unew)))))
   (math-with-extra-prec 2
-    (let ((compat (and (not math-cu-pure)
-                       (math-find-compatible-unit expr math-cu-new-units)))
+    (let ((compat (and (not pure)
+                       (math-find-compatible-unit expr new-units)))
          (math-cu-unit-list nil)
          (math-combining-units nil))
       (if compat
@@ -1157,21 +1161,23 @@ If COMP or STD is non-nil, put that in the units table 
instead."
           (math-mul (math-mul (math-simplify-units
                                (math-div expr (math-pow (car compat)
                                                         (cdr compat))))
-                              (math-pow math-cu-new-units (cdr compat)))
+                              (math-pow new-units (cdr compat)))
                     (math-simplify-units
                      (math-to-standard-units
-                      (math-pow (math-div (car compat) math-cu-new-units)
+                      (math-pow (math-div (car compat) new-units)
                                 (cdr compat))
                       nil))))
-       (when (setq math-cu-unit-list (math-decompose-units math-cu-new-units))
-         (setq math-cu-new-units (nth 2 (car math-cu-unit-list))))
+       (when (setq math-cu-unit-list (math-decompose-units new-units))
+         (setq new-units (nth 2 (car math-cu-unit-list))))
        (when (eq (car-safe expr) '+)
          (setq expr (math-simplify-units expr)))
        (if (math-units-in-expr-p expr t)
-           (math-convert-units-rec expr)
+            (let ((math-cu-new-units new-units)
+                  (math-cu-pure pure))
+             (math-convert-units-rec expr))
          (math-apply-units (math-to-standard-units
-                            (list '/ expr math-cu-new-units) nil)
-                           math-cu-new-units math-cu-unit-list 
math-cu-pure))))))
+                            (list '/ expr new-units) nil)
+                           new-units math-cu-unit-list pure))))))
 
 (defun math-convert-units-rec (expr)
   (if (math-units-in-expr-p expr nil)
@@ -1181,7 +1187,7 @@ If COMP or STD is non-nil, put that in the units table 
instead."
     (if (Math-primp expr)
        expr
       (cons (car expr)
-           (mapcar 'math-convert-units-rec (cdr expr))))))
+           (mapcar #'math-convert-units-rec (cdr expr))))))
 
 (defun math-convert-temperature (expr old new &optional pure)
   (let* ((units (math-single-units-in-expr-p expr))
@@ -1225,37 +1231,34 @@ If COMP or STD is non-nil, put that in the units table 
instead."
     (math-simplify a)))
 (defalias 'calcFunc-usimplify 'math-simplify-units)
 
-;; The function created by math-defsimplify uses the variable
-;; math-simplify-expr, and so is used by functions in math-defsimplify
-(defvar math-simplify-expr)
-
+;; The function created by math-defsimplify uses the variable `expr'.
 (math-defsimplify (+ -)
   (and math-simplifying-units
-       (math-units-in-expr-p (nth 1 math-simplify-expr) nil)
-       (let* ((units (math-extract-units (nth 1 math-simplify-expr)))
+       (math-units-in-expr-p (nth 1 expr) nil)
+       (let* ((units (math-extract-units (nth 1 expr)))
              (ratio (math-simplify (math-to-standard-units
-                                    (list '/ (nth 2 math-simplify-expr) units) 
nil))))
+                                    (list '/ (nth 2 expr) units) nil))))
         (if (math-units-in-expr-p ratio nil)
             (progn
-              (calc-record-why "*Inconsistent units" math-simplify-expr)
-              math-simplify-expr)
-          (list '* (math-add (math-remove-units (nth 1 math-simplify-expr))
-                             (if (eq (car math-simplify-expr) '-)
+              (calc-record-why "*Inconsistent units" expr)
+              expr)
+          (list '* (math-add (math-remove-units (nth 1 expr))
+                             (if (eq (car expr) '-)
                                   (math-neg ratio) ratio))
                 units)))))
 
 (math-defsimplify *
-  (math-simplify-units-prod))
+  (math-simplify-units-prod expr))
 
-(defun math-simplify-units-prod ()
+(defun math-simplify-units-prod (expr)
   (and math-simplifying-units
        calc-autorange-units
-       (Math-realp (nth 1 math-simplify-expr))
-       (let* ((num (math-float (nth 1 math-simplify-expr)))
+       (Math-realp (nth 1 expr))
+       (let* ((num (math-float (nth 1 expr)))
              (xpon (calcFunc-xpon num))
-             (unitp (cdr (cdr math-simplify-expr)))
+             (unitp (cdr (cdr expr)))
              (unit (car unitp))
-             (pow (if (eq (car math-simplify-expr) '*) 1 -1))
+             (pow (if (eq (car expr) '*) 1 -1))
              u)
         (and (eq (car-safe unit) '*)
              (setq unitp (cdr unit)
@@ -1305,46 +1308,46 @@ If COMP or STD is non-nil, put that in the units table 
instead."
                     (or (not (eq p pref))
                         (< xpon (+ pxpon (* (math-abs pow) 3))))
                     (progn
-                      (setcar (cdr math-simplify-expr)
+                      (setcar (cdr expr)
                               (let ((calc-prefer-frac nil))
-                                (calcFunc-scf (nth 1 math-simplify-expr)
+                                (calcFunc-scf (nth 1 expr)
                                               (- uxpon pxpon))))
                       (setcar unitp pname)
-                      math-simplify-expr)))))))
+                      expr)))))))
 
 (defvar math-try-cancel-units)
 
 (math-defsimplify /
   (and math-simplifying-units
-       (let ((np (cdr math-simplify-expr))
+       (let ((np (cdr expr))
             (math-try-cancel-units 0)
-            n nn)
-        (setq n (if (eq (car-safe (nth 2 math-simplify-expr)) '*)
-                    (cdr (nth 2 math-simplify-expr))
-                  (nthcdr 2 math-simplify-expr)))
+            n)
+        (setq n (if (eq (car-safe (nth 2 expr)) '*)
+                    (cdr (nth 2 expr))
+                  (nthcdr 2 expr)))
         (if (math-realp (car n))
             (progn
-              (setcar (cdr math-simplify-expr) (math-mul (nth 1 
math-simplify-expr)
+              (setcar (cdr expr) (math-mul (nth 1 expr)
                                            (let ((calc-prefer-frac nil))
                                              (math-div 1 (car n)))))
               (setcar n 1)))
         (while (eq (car-safe (setq n (car np))) '*)
-          (math-simplify-units-divisor (cdr n) (cdr (cdr math-simplify-expr)))
+          (math-simplify-units-divisor (cdr n) (cdr (cdr expr)))
           (setq np (cdr (cdr n))))
-        (math-simplify-units-divisor np (cdr (cdr math-simplify-expr)))
+        (math-simplify-units-divisor np (cdr (cdr expr)))
         (if (eq math-try-cancel-units 0)
             (let* ((math-simplifying-units nil)
                    (base (math-simplify
-                           (math-to-standard-units math-simplify-expr nil))))
+                           (math-to-standard-units expr nil))))
               (if (Math-numberp base)
-                  (setq math-simplify-expr base))))
-        (if (eq (car-safe math-simplify-expr) '/)
-            (math-simplify-units-prod))
-        math-simplify-expr)))
+                  (setq expr base))))
+        (if (eq (car-safe expr) '/)
+            (math-simplify-units-prod expr))
+        expr)))
 
 (defun math-simplify-units-divisor (np dp)
   (let ((n (car np))
-       d dd temp)
+       d temp)
     (while (eq (car-safe (setq d (car dp))) '*)
       (when (setq temp (math-simplify-units-quotient n (nth 1 d)))
        (setcar np (setq n temp))
@@ -1384,23 +1387,23 @@ If COMP or STD is non-nil, put that in the units table 
instead."
 
 (math-defsimplify ^
   (and math-simplifying-units
-       (math-realp (nth 2 math-simplify-expr))
-       (if (memq (car-safe (nth 1 math-simplify-expr)) '(* /))
-          (list (car (nth 1 math-simplify-expr))
-                (list '^ (nth 1 (nth 1 math-simplify-expr))
-                       (nth 2 math-simplify-expr))
-                (list '^ (nth 2 (nth 1 math-simplify-expr))
-                       (nth 2 math-simplify-expr)))
-        (math-simplify-units-pow (nth 1 math-simplify-expr)
-                                  (nth 2 math-simplify-expr)))))
+       (math-realp (nth 2 expr))
+       (if (memq (car-safe (nth 1 expr)) '(* /))
+          (list (car (nth 1 expr))
+                (list '^ (nth 1 (nth 1 expr))
+                       (nth 2 expr))
+                (list '^ (nth 2 (nth 1 expr))
+                       (nth 2 expr)))
+        (math-simplify-units-pow (nth 1 expr)
+                                  (nth 2 expr)))))
 
 (math-defsimplify calcFunc-sqrt
   (and math-simplifying-units
-       (if (memq (car-safe (nth 1 math-simplify-expr)) '(* /))
-          (list (car (nth 1 math-simplify-expr))
-                (list 'calcFunc-sqrt (nth 1 (nth 1 math-simplify-expr)))
-                (list 'calcFunc-sqrt (nth 2 (nth 1 math-simplify-expr))))
-        (math-simplify-units-pow (nth 1 math-simplify-expr) '(frac 1 2)))))
+       (if (memq (car-safe (nth 1 expr)) '(* /))
+          (list (car (nth 1 expr))
+                (list 'calcFunc-sqrt (nth 1 (nth 1 expr)))
+                (list 'calcFunc-sqrt (nth 2 (nth 1 expr))))
+        (math-simplify-units-pow (nth 1 expr) '(frac 1 2)))))
 
 (math-defsimplify (calcFunc-floor
                   calcFunc-ceil
@@ -1413,21 +1416,21 @@ If COMP or STD is non-nil, put that in the units table 
instead."
                   calcFunc-abs
                   calcFunc-clean)
   (and math-simplifying-units
-       (= (length math-simplify-expr) 2)
-       (if (math-only-units-in-expr-p (nth 1 math-simplify-expr))
-          (nth 1 math-simplify-expr)
-        (if (and (memq (car-safe (nth 1 math-simplify-expr)) '(* /))
+       (= (length expr) 2)
+       (if (math-only-units-in-expr-p (nth 1 expr))
+          (nth 1 expr)
+        (if (and (memq (car-safe (nth 1 expr)) '(* /))
                  (or (math-only-units-in-expr-p
-                      (nth 1 (nth 1 math-simplify-expr)))
+                      (nth 1 (nth 1 expr)))
                      (math-only-units-in-expr-p
-                      (nth 2 (nth 1 math-simplify-expr)))))
-            (list (car (nth 1 math-simplify-expr))
-                  (cons (car math-simplify-expr)
-                        (cons (nth 1 (nth 1 math-simplify-expr))
-                              (cdr (cdr math-simplify-expr))))
-                  (cons (car math-simplify-expr)
-                        (cons (nth 2 (nth 1 math-simplify-expr))
-                              (cdr (cdr math-simplify-expr)))))))))
+                      (nth 2 (nth 1 expr)))))
+            (list (car (nth 1 expr))
+                  (cons (car expr)
+                        (cons (nth 1 (nth 1 expr))
+                              (cdr (cdr expr))))
+                  (cons (car expr)
+                        (cons (nth 2 (nth 1 expr))
+                              (cdr (cdr expr)))))))))
 
 (defun math-simplify-units-pow (a pow)
   (if (and (eq (car-safe a) '^)
@@ -1450,10 +1453,10 @@ If COMP or STD is non-nil, put that in the units table 
instead."
 
 (math-defsimplify calcFunc-sin
   (and math-simplifying-units
-       (math-units-in-expr-p (nth 1 math-simplify-expr) nil)
+       (math-units-in-expr-p (nth 1 expr) nil)
        (let ((rad (math-simplify-units
                   (math-evaluate-expr
-                   (math-to-standard-units (nth 1 math-simplify-expr) nil))))
+                   (math-to-standard-units (nth 1 expr) nil))))
             (calc-angle-mode 'rad))
         (and (eq (car-safe rad) '*)
              (math-realp (nth 1 rad))
@@ -1463,10 +1466,10 @@ If COMP or STD is non-nil, put that in the units table 
instead."
 
 (math-defsimplify calcFunc-cos
   (and math-simplifying-units
-       (math-units-in-expr-p (nth 1 math-simplify-expr) nil)
+       (math-units-in-expr-p (nth 1 expr) nil)
        (let ((rad (math-simplify-units
                   (math-evaluate-expr
-                   (math-to-standard-units (nth 1 math-simplify-expr) nil))))
+                   (math-to-standard-units (nth 1 expr) nil))))
             (calc-angle-mode 'rad))
         (and (eq (car-safe rad) '*)
              (math-realp (nth 1 rad))
@@ -1476,10 +1479,10 @@ If COMP or STD is non-nil, put that in the units table 
instead."
 
 (math-defsimplify calcFunc-tan
   (and math-simplifying-units
-       (math-units-in-expr-p (nth 1 math-simplify-expr) nil)
+       (math-units-in-expr-p (nth 1 expr) nil)
        (let ((rad (math-simplify-units
                   (math-evaluate-expr
-                   (math-to-standard-units (nth 1 math-simplify-expr) nil))))
+                   (math-to-standard-units (nth 1 expr) nil))))
             (calc-angle-mode 'rad))
         (and (eq (car-safe rad) '*)
              (math-realp (nth 1 rad))
@@ -1489,10 +1492,10 @@ If COMP or STD is non-nil, put that in the units table 
instead."
 
 (math-defsimplify calcFunc-sec
   (and math-simplifying-units
-       (math-units-in-expr-p (nth 1 math-simplify-expr) nil)
+       (math-units-in-expr-p (nth 1 expr) nil)
        (let ((rad (math-simplify-units
                   (math-evaluate-expr
-                   (math-to-standard-units (nth 1 math-simplify-expr) nil))))
+                   (math-to-standard-units (nth 1 expr) nil))))
             (calc-angle-mode 'rad))
         (and (eq (car-safe rad) '*)
              (math-realp (nth 1 rad))
@@ -1502,10 +1505,10 @@ If COMP or STD is non-nil, put that in the units table 
instead."
 
 (math-defsimplify calcFunc-csc
   (and math-simplifying-units
-       (math-units-in-expr-p (nth 1 math-simplify-expr) nil)
+       (math-units-in-expr-p (nth 1 expr) nil)
        (let ((rad (math-simplify-units
                   (math-evaluate-expr
-                   (math-to-standard-units (nth 1 math-simplify-expr) nil))))
+                   (math-to-standard-units (nth 1 expr) nil))))
             (calc-angle-mode 'rad))
         (and (eq (car-safe rad) '*)
              (math-realp (nth 1 rad))
@@ -1515,10 +1518,10 @@ If COMP or STD is non-nil, put that in the units table 
instead."
 
 (math-defsimplify calcFunc-cot
   (and math-simplifying-units
-       (math-units-in-expr-p (nth 1 math-simplify-expr) nil)
+       (math-units-in-expr-p (nth 1 expr) nil)
        (let ((rad (math-simplify-units
                   (math-evaluate-expr
-                   (math-to-standard-units (nth 1 math-simplify-expr) nil))))
+                   (math-to-standard-units (nth 1 expr) nil))))
             (calc-angle-mode 'rad))
         (and (eq (car-safe rad) '*)
              (math-realp (nth 1 rad))
@@ -1533,13 +1536,13 @@ If COMP or STD is non-nil, put that in the units table 
instead."
     (if (Math-primp expr)
        expr
       (cons (car expr)
-           (mapcar 'math-remove-units (cdr expr))))))
+           (mapcar #'math-remove-units (cdr expr))))))
 
 (defun math-extract-units (expr)
   (cond
    ((memq (car-safe expr) '(* /))
     (cons (car expr)
-          (mapcar 'math-extract-units (cdr expr))))
+          (mapcar #'math-extract-units (cdr expr))))
    ((eq (car-safe expr) 'neg)
     (math-extract-units (nth 1 expr)))
    ((eq (car-safe expr) '^)
@@ -1666,7 +1669,7 @@ In symbolic mode, return the list (^ a b)."
 (defun math-extract-logunits (expr)
   (if (memq (car-safe expr) '(* /))
       (cons (car expr)
-           (mapcar 'math-extract-logunits (cdr expr)))
+           (mapcar #'math-extract-logunits (cdr expr)))
     (if (memq (car-safe expr) '(^))
         (list '^ (math-extract-logunits (nth 1 expr)) (nth 2 expr))
       (if (member expr math-logunits) expr 1))))
diff --git a/lisp/calc/calc-vec.el b/lisp/calc/calc-vec.el
index 2c9dc06..a3e98c0 100644
--- a/lisp/calc/calc-vec.el
+++ b/lisp/calc/calc-vec.el
@@ -1,6 +1,6 @@
 ;;; calc-vec.el --- vector functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc-yank.el b/lisp/calc/calc-yank.el
index 425e4b4..0d45c12 100644
--- a/lisp/calc/calc-yank.el
+++ b/lisp/calc/calc-yank.el
@@ -1,6 +1,6 @@
 ;;; calc-yank.el --- kill-ring functionality for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calc.el b/lisp/calc/calc.el
index c79db82..35f13f9 100644
--- a/lisp/calc/calc.el
+++ b/lisp/calc/calc.el
@@ -1,6 +1,6 @@
-;;; calc.el --- the GNU Emacs calculator
+;;; calc.el --- the GNU Emacs calculator  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 ;; Keywords: convenience, extensions
@@ -178,7 +178,7 @@
 (declare-function math-read-radix-digit "calc-misc" (dig))
 (declare-function calc-digit-dots "calc-incom" ())
 (declare-function math-normalize-fancy "calc-ext" (a))
-(declare-function math-normalize-nonstandard "calc-ext" ())
+(declare-function math-normalize-nonstandard "calc-ext" (a))
 (declare-function math-recompile-eval-rules "calc-alg" ())
 (declare-function math-apply-rewrites "calc-rewr" (expr rules &optional heads 
math-apply-rw-ruleset))
 (declare-function calc-record-why "calc-misc" (&rest stuff))
@@ -203,7 +203,7 @@
 (declare-function math-compose-expr "calccomp" (a prec &optional div))
 (declare-function math-comp-width "calccomp" (c))
 (declare-function math-composition-to-string "calccomp" (c &optional width))
-(declare-function math-stack-value-offset-fancy "calccomp" ())
+(declare-function math-stack-value-offset-fancy "calccomp" (c))
 (declare-function math-format-flat-expr-fancy "calc-ext" (a prec))
 (declare-function math-adjust-fraction "calc-ext" (a))
 (declare-function math-format-binary "calc-bin" (a))
@@ -395,10 +395,17 @@ This is not required to be present for user-written mode 
annotations."
                                   (string :tag "Closing annotation 
delimiter"))))
 
 (defcustom calc-gnuplot-name
-  (if (eq system-type 'windows-nt) "pgnuplot" "gnuplot")
+  (if (and (eq system-type 'windows-nt)
+           ;; Gnuplot v4.x on MS-Windows came with a special
+           ;; pipe-enabled gnuplot executable for batch-mode
+           ;; execution; newer versions allow using gnuplot.exe.
+           (executable-find "pgnuplot"))
+      "pgnuplot"
+    "gnuplot")
   "Name of GNUPLOT program, for calc-graph features."
   :group 'calc
-  :type '(string))
+  :type '(string)
+  :version "26.2")
 
 (defcustom calc-gnuplot-plot-command
   nil
@@ -1331,16 +1338,17 @@ Notations:  3.14e6     3.14 * 10^6
 "
   (interactive)
   (mapc (function           ;FIXME: Why (set-default v (symbol-value v)) ?!?!?
-        (lambda (v) (set-default v (symbol-value v)))) calc-local-var-list)
+        (lambda (v) (set-default v (symbol-value v))))
+        calc-local-var-list)
   (kill-all-local-variables)
   (use-local-map (if (eq calc-algebraic-mode 'total)
                     (progn (require 'calc-ext) calc-alg-map) calc-mode-map))
   (mapc #'make-local-variable calc-local-var-list)
   (make-local-variable 'overlay-arrow-position)
   (make-local-variable 'overlay-arrow-string)
-  (add-hook 'change-major-mode-hook 'font-lock-defontify nil t)
+  (add-hook 'change-major-mode-hook #'font-lock-defontify nil t)
   (add-hook 'kill-buffer-query-functions
-            'calc-kill-stack-buffer
+            #'calc-kill-stack-buffer
             t t)
   (setq truncate-lines t)
   (setq buffer-read-only t)
@@ -1795,7 +1803,7 @@ See calc-keypad for details."
                     (if calc-hyperbolic-flag "Hyp " "")
                     (if calc-keep-args-flag "Keep " "")
                     (if (/= calc-stack-top 1) "Narrow " "")
-                    (apply 'concat calc-other-modes)))))
+                    (apply #'concat calc-other-modes)))))
       (if (equal new-mode-string mode-line-buffer-identification)
          nil
        (setq mode-line-buffer-identification new-mode-string)
@@ -1869,7 +1877,7 @@ See calc-keypad for details."
   (if (and (consp vals)
           (or (integerp (car vals))
               (consp (car vals))))
-      (setq vals (mapcar 'calc-normalize vals))
+      (setq vals (mapcar #'calc-normalize vals))
     (setq vals (calc-normalize vals)))
   (or (and (consp vals)
           (or (integerp (car vals))
@@ -1952,8 +1960,8 @@ See calc-keypad for details."
           (mapcar (lambda (x) (calc-get-stack-element x sel-mode)) top)))))
 
 (defun calc-top-list-n (&optional n m sel-mode)
-  (mapcar 'math-check-complete
-         (mapcar 'calc-normalize (calc-top-list n m sel-mode))))
+  (mapcar #'math-check-complete
+         (mapcar #'calc-normalize (calc-top-list n m sel-mode))))
 
 
 (defun calc-renumber-stack ()
@@ -2207,7 +2215,7 @@ the United States."
   (setq calc-aborted-prefix name)
   (if (null arg)
       (calc-enter-result 2 name (cons (or func2 func)
-                                     (mapcar 'math-check-complete
+                                     (mapcar #'math-check-complete
                                              (calc-top-list 2))))
     (require 'calc-ext)
     (calc-binary-op-fancy name func arg ident unary)))
@@ -2422,7 +2430,7 @@ the United States."
          (beep)
        (and (not (calc-minibuffer-contains 
"[-+]?\\(1[5-9]\\|[2-9][0-9]\\)#.*"))
             (search-forward "e" nil t))
-       (if (looking-at "+")
+       (if (looking-at "\\+")
            (delete-char 1))
        (if (looking-at "-")
            (delete-char 1)
@@ -2619,78 +2627,78 @@ largest Emacs integer.")
 (defvar math-eval-rules-cache-other)
 ;;; Reduce an object to canonical (normalized) form.  [O o; Z Z] [Public]
 
-(defvar math-normalize-a)
 (defvar math-normalize-error nil
   "Non-nil if the last call the `math-normalize' returned an error.")
 
-(defun math-normalize (math-normalize-a)
+(defun math-normalize (a)
   (setq math-normalize-error nil)
   (cond
-   ((not (consp math-normalize-a))
-    (if (integerp math-normalize-a)
-       (if (or (>= math-normalize-a math-small-integer-size)
-                (<= math-normalize-a (- math-small-integer-size)))
-           (math-bignum math-normalize-a)
-         math-normalize-a)
-      math-normalize-a))
-   ((eq (car math-normalize-a) 'bigpos)
-    (if (eq (nth (1- (length math-normalize-a)) math-normalize-a) 0)
-       (let* ((last (setq math-normalize-a
-                           (copy-sequence math-normalize-a))) (digs 
math-normalize-a))
+   ((not (consp a))
+    (if (integerp a)
+       (if (or (>= a math-small-integer-size)
+                (<= a (- math-small-integer-size)))
+           (math-bignum a)
+         a)
+      a))
+   ((eq (car a) 'bigpos)
+    (if (eq (nth (1- (length a)) a) 0)
+       (let* ((last (setq a
+                           (copy-sequence a)))
+               (digs a))
          (while (setq digs (cdr digs))
            (or (eq (car digs) 0) (setq last digs)))
          (setcdr last nil)))
-    (if (cdr (cdr (cdr math-normalize-a)))
-       math-normalize-a
+    (if (cdr (cdr (cdr a)))
+       a
       (cond
-       ((cdr (cdr math-normalize-a)) (+ (nth 1 math-normalize-a)
-                                        (* (nth 2 math-normalize-a)
+       ((cdr (cdr a)) (+ (nth 1 a)
+                                        (* (nth 2 a)
                                            math-bignum-digit-size)))
-       ((cdr math-normalize-a) (nth 1 math-normalize-a))
+       ((cdr a) (nth 1 a))
        (t 0))))
-   ((eq (car math-normalize-a) 'bigneg)
-    (if (eq (nth (1- (length math-normalize-a)) math-normalize-a) 0)
-       (let* ((last (setq math-normalize-a (copy-sequence math-normalize-a)))
-               (digs math-normalize-a))
+   ((eq (car a) 'bigneg)
+    (if (eq (nth (1- (length a)) a) 0)
+       (let* ((last (setq a (copy-sequence a)))
+               (digs a))
          (while (setq digs (cdr digs))
            (or (eq (car digs) 0) (setq last digs)))
          (setcdr last nil)))
-    (if (cdr (cdr (cdr math-normalize-a)))
-       math-normalize-a
+    (if (cdr (cdr (cdr a)))
+       a
       (cond
-       ((cdr (cdr math-normalize-a)) (- (+ (nth 1 math-normalize-a)
-                                           (* (nth 2 math-normalize-a)
+       ((cdr (cdr a)) (- (+ (nth 1 a)
+                                           (* (nth 2 a)
                                               math-bignum-digit-size))))
-       ((cdr math-normalize-a) (- (nth 1 math-normalize-a)))
+       ((cdr a) (- (nth 1 a)))
        (t 0))))
-   ((eq (car math-normalize-a) 'float)
-    (math-make-float (math-normalize (nth 1 math-normalize-a))
-                     (nth 2 math-normalize-a)))
-   ((or (memq (car math-normalize-a)
+   ((eq (car a) 'float)
+    (math-make-float (math-normalize (nth 1 a))
+                     (nth 2 a)))
+   ((or (memq (car a)
               '(frac cplx polar hms date mod sdev intv vec var quote
                      special-const calcFunc-if calcFunc-lambda
                      calcFunc-quote calcFunc-condition
                      calcFunc-evalto))
-       (integerp (car math-normalize-a))
-       (and (consp (car math-normalize-a))
-             (not (eq (car (car math-normalize-a)) 'lambda))))
+       (integerp (car a))
+       (and (consp (car a))
+             (not (eq (car (car a)) 'lambda))))
     (require 'calc-ext)
-    (math-normalize-fancy math-normalize-a))
+    (math-normalize-fancy a))
    (t
     (or (and calc-simplify-mode
             (require 'calc-ext)
-            (math-normalize-nonstandard))
-       (let ((args (mapcar 'math-normalize (cdr math-normalize-a))))
+             (math-normalize-nonstandard a))
+       (let ((args (mapcar #'math-normalize (cdr a))))
          (or (condition-case err
                  (let ((func
-                         (assq (car math-normalize-a) '( ( + . math-add )
-                                                         ( - . math-sub )
-                                                         ( * . math-mul )
-                                                         ( / . math-div )
-                                                         ( % . math-mod )
-                                                         ( ^ . math-pow )
-                                                         ( neg . math-neg )
-                                                         ( | . math-concat ) 
))))
+                         (assq (car a) '( ( + . math-add )
+                                          ( - . math-sub )
+                                          ( * . math-mul )
+                                          ( / . math-div )
+                                          ( % . math-mod )
+                                          ( ^ . math-pow )
+                                          ( neg . math-neg )
+                                          ( | . math-concat ) ))))
                    (or (and var-EvalRules
                             (progn
                               (or (eq var-EvalRules math-eval-rules-cache-tag)
@@ -2698,59 +2706,59 @@ largest Emacs integer.")
                                     (require 'calc-ext)
                                     (math-recompile-eval-rules)))
                               (and (or math-eval-rules-cache-other
-                                       (assq (car math-normalize-a)
+                                       (assq (car a)
                                               math-eval-rules-cache))
                                    (math-apply-rewrites
-                                    (cons (car math-normalize-a) args)
+                                    (cons (car a) args)
                                     (cdr math-eval-rules-cache)
                                     nil math-eval-rules-cache))))
                        (if func
                            (apply (cdr func) args)
-                         (and (or (consp (car math-normalize-a))
-                                  (fboundp (car math-normalize-a))
+                         (and (or (consp (car a))
+                                  (fboundp (car a))
                                   (and (not (featurep 'calc-ext))
                                        (require 'calc-ext)
-                                       (fboundp (car math-normalize-a))))
-                              (apply (car math-normalize-a) args)))))
+                                       (fboundp (car a))))
+                              (apply (car a) args)))))
                (wrong-number-of-arguments
                  (setq math-normalize-error t)
                 (calc-record-why "*Wrong number of arguments"
-                                 (cons (car math-normalize-a) args))
+                                 (cons (car a) args))
                 nil)
                (wrong-type-argument
                 (or calc-next-why
                      (calc-record-why "Wrong type of argument"
-                                      (cons (car math-normalize-a) args)))
+                                      (cons (car a) args)))
                 nil)
                (args-out-of-range
                  (setq math-normalize-error t)
                 (calc-record-why "*Argument out of range"
-                                  (cons (car math-normalize-a) args))
+                                  (cons (car a) args))
                 nil)
                (inexact-result
                 (calc-record-why "No exact representation for result"
-                                 (cons (car math-normalize-a) args))
+                                 (cons (car a) args))
                 nil)
                (math-overflow
                  (setq math-normalize-error t)
                 (calc-record-why "*Floating-point overflow occurred"
-                                 (cons (car math-normalize-a) args))
+                                 (cons (car a) args))
                 nil)
                (math-underflow
                  (setq math-normalize-error t)
                 (calc-record-why "*Floating-point underflow occurred"
-                                 (cons (car math-normalize-a) args))
+                                 (cons (car a) args))
                 nil)
                (void-variable
                  (setq math-normalize-error t)
                 (if (eq (nth 1 err) 'var-EvalRules)
                     (progn
                       (setq var-EvalRules nil)
-                      (math-normalize (cons (car math-normalize-a) args)))
+                      (math-normalize (cons (car a) args)))
                   (calc-record-why "*Variable is void" (nth 1 err)))))
-             (if (consp (car math-normalize-a))
+             (if (consp (car a))
                  (math-dimension-error)
-               (cons (car math-normalize-a) args))))))))
+               (cons (car a) args))))))))
 
 
 
@@ -2834,7 +2842,7 @@ largest Emacs integer.")
        ((eq (car a) 'frac) (math-div (math-float (nth 1 a)) (nth 2 a)))
        ((eq (car a) 'float) a)
        ((memq (car a) '(cplx polar vec hms date sdev mod))
-        (cons (car a) (mapcar 'math-float (cdr a))))
+        (cons (car a) (mapcar #'math-float (cdr a))))
        (t (math-float-fancy a))))
 
 
@@ -2845,7 +2853,7 @@ largest Emacs integer.")
        ((memq (car a) '(frac float))
         (list (car a) (Math-integer-neg (nth 1 a)) (nth 2 a)))
        ((memq (car a) '(cplx vec hms date calcFunc-idn))
-        (cons (car a) (mapcar 'math-neg (cdr a))))
+        (cons (car a) (mapcar #'math-neg (cdr a))))
        (t (math-neg-fancy a))))
 
 
@@ -3425,22 +3433,21 @@ largest Emacs integer.")
     (setcar (cdr entry) (calc-count-lines s))
     s))
 
-;; The variables math-svo-c, math-svo-wid and math-svo-off are local
+;; The variables math-svo-wid and math-svo-off are local
 ;; to math-stack-value-offset, but are used by math-stack-value-offset-fancy
 ;; in calccomp.el.
 
-(defvar math-svo-c)
 (defvar math-svo-wid)
 (defvar math-svo-off)
 
-(defun math-stack-value-offset (math-svo-c)
+(defun math-stack-value-offset (c)
   (let* ((num (if calc-line-numbering 4 0))
         (math-svo-wid (calc-window-width))
         math-svo-off)
     (if calc-display-just
        (progn
          (require 'calc-ext)
-         (math-stack-value-offset-fancy))
+         (math-stack-value-offset-fancy c))
       (setq math-svo-off (or calc-display-origin 0))
       (when (integerp calc-line-breaking)
        (setq math-svo-wid calc-line-breaking)))
@@ -3873,7 +3880,7 @@ The prefix `calcFunc-' is added to the specified name to 
get the
 actual Lisp function name.
 
 See Info node `(calc)Defining Functions'."
-  (declare (doc-string 3))
+  (declare (doc-string 3)) ;; FIXME: Edebug spec?
   (require 'calc-ext)
   (math-do-defmath func args body))
 
diff --git a/lisp/calc/calcalg2.el b/lisp/calc/calcalg2.el
index 29288b6..18243bf 100644
--- a/lisp/calc/calcalg2.el
+++ b/lisp/calc/calcalg2.el
@@ -1,6 +1,6 @@
 ;;; calcalg2.el --- more algebraic functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calcalg3.el b/lisp/calc/calcalg3.el
index 9da08b6..8015b8e 100644
--- a/lisp/calc/calcalg3.el
+++ b/lisp/calc/calcalg3.el
@@ -1,6 +1,6 @@
 ;;; calcalg3.el --- more algebraic functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el
index 858343a..91eadfb 100644
--- a/lisp/calc/calccomp.el
+++ b/lisp/calc/calccomp.el
@@ -1,6 +1,6 @@
-;;; calccomp.el --- composition functions for Calc
+;;; calccomp.el --- composition functions for Calc  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
@@ -121,7 +121,8 @@
                                                    calc-lang-slash-idiv)
                                             (math-float (nth 1 aa))
                                           (nth 1 aa))
-                                        (nth 2 aa)) prec))
+                                        (nth 2 aa))
+                                   prec))
            (if (and (eq calc-language 'big)
                     (= (length (car calc-frac-format)) 1))
                (let* ((aa (math-adjust-fraction a))
@@ -202,8 +203,9 @@
             (math-comp-comma-spc (or calc-vector-commas " "))
             (math-comp-comma (or calc-vector-commas ""))
             (math-comp-vector-prec (if (or (and calc-vector-commas
-                                      (math-vector-no-parens a))
-                                 (memq 'P calc-matrix-brackets)) 0 1000))
+                                                (math-vector-no-parens a))
+                                           (memq 'P calc-matrix-brackets))
+                                        0 1000))
             (math-comp-just (cond ((eq calc-matrix-just 'right) 'vright)
                                       ((eq calc-matrix-just 'center) 'vcent)
                                       (t 'vleft)))
@@ -803,8 +805,7 @@
                                          ( % . calcFunc-mod )
                                          ( ^ . calcFunc-pow )
                                          ( neg . calcFunc-neg )
-                                         ( | . calcFunc-vconcat ))))
-                     left right args)
+                                         ( | . calcFunc-vconcat )))))
                 (if func2
                     (setq func (cdr func2)))
                 (if (setq func2 (rassq func math-expr-function-mapping))
@@ -858,7 +859,7 @@
   (or (cdr (cdr a))
       (not (eq (car-safe (nth 1 a)) '*))))
 
-(defun math-compose-matrix (a col cols base)
+(defun math-compose-matrix (a _col cols base)
   (let ((col 0)
        (res nil))
     (while (<= (setq col (1+ col)) cols)
@@ -968,8 +969,8 @@
       (and (memq (car a) '(^ calcFunc-subscr))
           (math-tex-expr-is-flat (nth 1 a)))))
 
-(put 'calcFunc-log 'math-compose-big 'math-compose-log)
-(defun math-compose-log (a prec)
+(put 'calcFunc-log 'math-compose-big #'math-compose-log)
+(defun math-compose-log (a _prec)
   (and (= (length a) 3)
        (list 'horiz
             (list 'subscr "log"
@@ -979,8 +980,8 @@
             (math-compose-expr (nth 1 a) 1000)
             ")")))
 
-(put 'calcFunc-log10 'math-compose-big 'math-compose-log10)
-(defun math-compose-log10 (a prec)
+(put 'calcFunc-log10 'math-compose-big #'math-compose-log10)
+(defun math-compose-log10 (a _prec)
   (and (= (length a) 2)
        (list 'horiz
             (list 'subscr "log" "10")
@@ -988,8 +989,8 @@
             (math-compose-expr (nth 1 a) 1000)
             ")")))
 
-(put 'calcFunc-deriv 'math-compose-big 'math-compose-deriv)
-(put 'calcFunc-tderiv 'math-compose-big 'math-compose-deriv)
+(put 'calcFunc-deriv 'math-compose-big #'math-compose-deriv)
+(put 'calcFunc-tderiv 'math-compose-big #'math-compose-deriv)
 (defun math-compose-deriv (a prec)
   (when (= (length a) 3)
     (math-compose-expr (list '/
@@ -1003,8 +1004,8 @@
                                         (nth 2 a))))
                       prec)))
 
-(put 'calcFunc-sqrt 'math-compose-big 'math-compose-sqrt)
-(defun math-compose-sqrt (a prec)
+(put 'calcFunc-sqrt 'math-compose-big #'math-compose-sqrt)
+(defun math-compose-sqrt (a _prec)
   (when (= (length a) 2)
     (let* ((c (math-compose-expr (nth 1 a) 0))
           (a (math-comp-ascent c))
@@ -1024,8 +1025,8 @@
                  " "
                  c)))))
 
-(put 'calcFunc-choose 'math-compose-big 'math-compose-choose)
-(defun math-compose-choose (a prec)
+(put 'calcFunc-choose 'math-compose-big #'math-compose-choose)
+(defun math-compose-choose (a _prec)
   (let ((a1 (math-compose-expr (nth 1 a) 0))
        (a2 (math-compose-expr (nth 2 a) 0)))
     (list 'horiz
@@ -1035,7 +1036,7 @@
                a1 " " a2)
          ")")))
 
-(put 'calcFunc-integ 'math-compose-big 'math-compose-integ)
+(put 'calcFunc-integ 'math-compose-big #'math-compose-integ)
 (defun math-compose-integ (a prec)
   (and (memq (length a) '(3 5))
        (eq (car-safe (nth 2 a)) 'var)
@@ -1072,7 +1073,7 @@
                 (list 'horiz " d" var))
               (if parens ")" "")))))
 
-(put 'calcFunc-sum 'math-compose-big 'math-compose-sum)
+(put 'calcFunc-sum 'math-compose-big #'math-compose-sum)
 (defun math-compose-sum (a prec)
   (and (memq (length a) '(3 5 6))
        (let* ((expr (math-compose-expr (nth 1 a) 185))
@@ -1097,7 +1098,7 @@
               expr
               (if (memq prec '(180 201)) ")" "")))))
 
-(put 'calcFunc-prod 'math-compose-big 'math-compose-prod)
+(put 'calcFunc-prod 'math-compose-big #'math-compose-prod)
 (defun math-compose-prod (a prec)
   (and (memq (length a) '(3 5 6))
        (let* ((expr (math-compose-expr (nth 1 a) 198))
@@ -1124,12 +1125,11 @@
 ;; The variables math-svo-c, math-svo-wid and math-svo-off are local
 ;; to math-stack-value-offset in calc.el, but are used by
 ;; math-stack-value-offset-fancy, which is called by math-stack-value-offset..
-(defvar math-svo-c)
 (defvar math-svo-wid)
 (defvar math-svo-off)
 
-(defun math-stack-value-offset-fancy ()
-  (let ((cwid (+ (math-comp-width math-svo-c))))
+(defun math-stack-value-offset-fancy (c)
+  (let ((cwid (+ (math-comp-width c))))
     (cond ((eq calc-display-just 'right)
           (if calc-display-origin
               (setq math-svo-wid (max calc-display-origin 5))
@@ -1215,7 +1215,7 @@
 ;; which are called by math-comp-to-string-flat.
 (defvar math-comp-pos)
 
-(defun math-comp-to-string-flat (c math-comp-full-width)
+(defun math-comp-to-string-flat (c full-width)
   (if math-comp-sel-hpos
       (let ((math-comp-pos 0))
        (math-comp-sel-flat-term c))
@@ -1224,6 +1224,7 @@
          (math-comp-pos 0)
          (math-comp-margin 0)
          (math-comp-highlight (and math-comp-selected calc-show-selections))
+          (math-comp-full-width full-width)
          (math-comp-level -1))
       (math-comp-to-string-flat-term '(set -1 0))
       (math-comp-to-string-flat-term c)
@@ -1387,7 +1388,7 @@
 (defvar math-comp-hpos)
 (defvar math-comp-vpos)
 
-(defun math-comp-simplify (c full-width)
+(defun math-comp-simplify (c _full-width)
   (let ((math-comp-buf (list ""))
        (math-comp-base 0)
        (math-comp-hgt 1)
diff --git a/lisp/calc/calcsel2.el b/lisp/calc/calcsel2.el
index 1ed4faa..c49f9a0 100644
--- a/lisp/calc/calcsel2.el
+++ b/lisp/calc/calcsel2.el
@@ -1,6 +1,6 @@
 ;;; calcsel2.el --- selection functions for Calc
 
-;; Copyright (C) 1990-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Gillespie <address@hidden>
 
diff --git a/lisp/calculator.el b/lisp/calculator.el
index f559fb4..eec7aff 100644
--- a/lisp/calculator.el
+++ b/lisp/calculator.el
@@ -1,6 +1,6 @@
 ;;; calculator.el --- a calculator for Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Eli Barzilay <address@hidden>
 ;; Keywords: tools, convenience
@@ -1184,7 +1184,7 @@ arguments."
           (DX (if (and X calculator-deg) (degrees-to-radians X) X))
           (L  calculator-saved-list)
           (fF `(calculator-funcall ',f x y))
-          (fD `(if calculator-deg (radians-to-degrees x) x)))
+          (fD '(if calculator-deg (radians-to-degrees x) x)))
       (eval `(cl-flet ((F (&optional x y) ,fF) (D (x) ,fD))
                (let ((X ,X) (Y ,Y) (DX ,DX) (TX ,TX) (TY ,TY) (L ',L))
                  ,f))
@@ -1226,7 +1226,7 @@ OP is the operator (if any) that caused this call."
     (when (and (or calculator-display-fragile
                    (not (numberp (car calculator-stack))))
                (<= inp (pcase calculator-input-radix
-                         (`nil ?9) (`bin ?1) (`oct ?7) (_ 999))))
+                         ('nil ?9) ('bin ?1) ('oct ?7) (_ 999))))
       (calculator-clear-fragile)
       (setq calculator-curnum
             (concat (if (equal calculator-curnum "0") ""
diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index 0259dd1..40cb9f7 100644
--- a/lisp/calendar/appt.el
+++ b/lisp/calendar/appt.el
@@ -1,6 +1,6 @@
 ;;; appt.el --- appointment notification functions  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1989-1990, 1994, 1998, 2001-2018 Free Software
+;; Copyright (C) 1989-1990, 1994, 1998, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Neil Mager <address@hidden>
diff --git a/lisp/calendar/cal-bahai.el b/lisp/calendar/cal-bahai.el
index 41b0902..ec491ec 100644
--- a/lisp/calendar/cal-bahai.el
+++ b/lisp/calendar/cal-bahai.el
@@ -1,6 +1,6 @@
 ;;; cal-bahai.el --- calendar functions for the Bahá’í calendar.
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 ;; Keywords: calendar
diff --git a/lisp/calendar/cal-china.el b/lisp/calendar/cal-china.el
index 7746e80..f92947e 100644
--- a/lisp/calendar/cal-china.el
+++ b/lisp/calendar/cal-china.el
@@ -1,6 +1,6 @@
 ;;; cal-china.el --- calendar functions for the Chinese calendar
 
-;; Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <address@hidden>
 ;; Maintainer: Glenn Morris <address@hidden>
diff --git a/lisp/calendar/cal-coptic.el b/lisp/calendar/cal-coptic.el
index 9079d4a..6fa4606 100644
--- a/lisp/calendar/cal-coptic.el
+++ b/lisp/calendar/cal-coptic.el
@@ -1,6 +1,6 @@
 ;;; cal-coptic.el --- calendar functions for the Coptic/Ethiopic calendars
 
-;; Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <address@hidden>
 ;; Maintainer: Glenn Morris <address@hidden>
diff --git a/lisp/calendar/cal-dst.el b/lisp/calendar/cal-dst.el
index 25264bd..2126cfd 100644
--- a/lisp/calendar/cal-dst.el
+++ b/lisp/calendar/cal-dst.el
@@ -1,6 +1,6 @@
 ;;; cal-dst.el --- calendar functions for daylight saving rules  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1993-1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Paul Eggert <address@hidden>
 ;;         Edward M. Reingold <address@hidden>
@@ -154,7 +154,7 @@ Return nil if no such transition can be found."
        (while
            ;; Set PROBE to halfway between LO and HI, rounding down.
            ;; If PROBE equals LO, we are done.
-           (not (= lo (setq probe (/ (+ lo hi) 2))))
+           (not (= lo (setq probe (floor (+ lo hi) 2))))
          ;; Set either LO or HI to PROBE, depending on probe results.
          (if (eq (car (current-time-zone probe)) hi-utc-diff)
              (setq hi probe)
@@ -231,7 +231,7 @@ The result has the proper form for 
`calendar-daylight-savings-starts'."
 ;; https://lists.gnu.org/r/emacs-pretest-bug/2006-11/msg00060.html
 (defun calendar-dst-find-data (&optional time)
   "Find data on the first daylight saving time transitions after TIME.
-TIME defaults to `current-time'.  Return value is as described
+TIME defaults to the current time.  Return value is as described
 for `calendar-current-time-zone'."
   (let* ((t0 (or time (current-time)))
          (t0-zone (current-time-zone t0))
@@ -279,8 +279,8 @@ expressions that when evaluated return the start and end 
dates,
 respectively. This function first attempts to use pre-calculated
 data from `calendar-dst-transition-cache', otherwise it calls
 `calendar-dst-find-data' (and adds the results to the cache).
-If dates in YEAR cannot be handled by `encode-time' (e.g. if they
-are too large to be represented as a lisp integer), then rather
+If dates in YEAR cannot be handled by `encode-time' (e.g.,
+if they are out of range for POSIX time_t), then rather
 than an error this function returns the result appropriate for
 the current year."
   (let ((e (assoc year calendar-dst-transition-cache))
diff --git a/lisp/calendar/cal-french.el b/lisp/calendar/cal-french.el
index 75a4914..b9abab5 100644
--- a/lisp/calendar/cal-french.el
+++ b/lisp/calendar/cal-french.el
@@ -1,6 +1,6 @@
 ;;; cal-french.el --- calendar functions for the French Revolutionary calendar
 
-;; Copyright (C) 1988-1989, 1992, 1994-1995, 1997, 2001-2018 Free
+;; Copyright (C) 1988-1989, 1992, 1994-1995, 1997, 2001-2019 Free
 ;; Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <address@hidden>
diff --git a/lisp/calendar/cal-hebrew.el b/lisp/calendar/cal-hebrew.el
index f34c69f..b26dbbe 100644
--- a/lisp/calendar/cal-hebrew.el
+++ b/lisp/calendar/cal-hebrew.el
@@ -1,6 +1,6 @@
 ;;; cal-hebrew.el --- calendar functions for the Hebrew calendar
 
-;; Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Nachum Dershowitz <address@hidden>
 ;;         Edward M. Reingold <address@hidden>
diff --git a/lisp/calendar/cal-html.el b/lisp/calendar/cal-html.el
index f6ecc9e..a77330a 100644
--- a/lisp/calendar/cal-html.el
+++ b/lisp/calendar/cal-html.el
@@ -1,6 +1,6 @@
 ;;; cal-html.el --- functions for printing HTML calendars
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Anna M. Bigatti <address@hidden>
 ;; Keywords: calendar
diff --git a/lisp/calendar/cal-islam.el b/lisp/calendar/cal-islam.el
index ac62791..32e15f5 100644
--- a/lisp/calendar/cal-islam.el
+++ b/lisp/calendar/cal-islam.el
@@ -1,6 +1,6 @@
 ;;; cal-islam.el --- calendar functions for the Islamic calendar
 
-;; Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <address@hidden>
 ;; Maintainer: Glenn Morris <address@hidden>
diff --git a/lisp/calendar/cal-iso.el b/lisp/calendar/cal-iso.el
index 5366fef..8568afe 100644
--- a/lisp/calendar/cal-iso.el
+++ b/lisp/calendar/cal-iso.el
@@ -1,6 +1,6 @@
 ;;; cal-iso.el --- calendar functions for the ISO calendar
 
-;; Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <address@hidden>
 ;; Maintainer: Glenn Morris <address@hidden>
diff --git a/lisp/calendar/cal-julian.el b/lisp/calendar/cal-julian.el
index fecf4d5..1297a96 100644
--- a/lisp/calendar/cal-julian.el
+++ b/lisp/calendar/cal-julian.el
@@ -1,6 +1,6 @@
 ;;; cal-julian.el --- calendar functions for the Julian calendar
 
-;; Copyright (C) 1995, 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <address@hidden>
 ;; Maintainer: Glenn Morris <address@hidden>
diff --git a/lisp/calendar/cal-mayan.el b/lisp/calendar/cal-mayan.el
index ecc5419..37fe4b9 100644
--- a/lisp/calendar/cal-mayan.el
+++ b/lisp/calendar/cal-mayan.el
@@ -1,6 +1,6 @@
 ;;; cal-mayan.el --- calendar functions for the Mayan calendars
 
-;; Copyright (C) 1992-1993, 1995, 1997, 2001-2018 Free Software
+;; Copyright (C) 1992-1993, 1995, 1997, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Stewart M. Clamen <address@hidden>
diff --git a/lisp/calendar/cal-menu.el b/lisp/calendar/cal-menu.el
index be3c7a2..cf7d04f 100644
--- a/lisp/calendar/cal-menu.el
+++ b/lisp/calendar/cal-menu.el
@@ -1,6 +1,6 @@
 ;;; cal-menu.el --- calendar functions for menu bar and popup menu support
 
-;; Copyright (C) 1994-1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <address@hidden>
 ;;         Lara Rios <address@hidden>
diff --git a/lisp/calendar/cal-move.el b/lisp/calendar/cal-move.el
index 7a32eb6..ecd05e7 100644
--- a/lisp/calendar/cal-move.el
+++ b/lisp/calendar/cal-move.el
@@ -1,6 +1,6 @@
 ;;; cal-move.el --- calendar functions for movement in the calendar
 
-;; Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <address@hidden>
 ;; Maintainer: Glenn Morris <address@hidden>
diff --git a/lisp/calendar/cal-persia.el b/lisp/calendar/cal-persia.el
index dad9c09..c0b6cb2 100644
--- a/lisp/calendar/cal-persia.el
+++ b/lisp/calendar/cal-persia.el
@@ -1,6 +1,6 @@
 ;;; cal-persia.el --- calendar functions for the Persian calendar
 
-;; Copyright (C) 1996-1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Edward M. Reingold <address@hidden>
 ;; Maintainer: Glenn Morris <address@hidden>
diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el
index 7ae0ecb..78ab076 100644
--- a/lisp/calendar/cal-tex.el
+++ b/lisp/calendar/cal-tex.el
@@ -1,6 +1,6 @@
 ;;; cal-tex.el --- calendar functions for printing calendars with LaTeX
 
-;; Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Steve Fisk <address@hidden>
 ;;         Edward M. Reingold <address@hidden>
@@ -925,7 +925,7 @@ argument EVENT specifies a different buffer position."
         (cal-tex-large-bf (cal-tex-LaTeXify-string (calendar-day-name date)))
         (insert ", ")
         (cal-tex-large-bf (cal-tex-month-name month))
-        (insert " ")
+        (insert "\\ ")
         (cal-tex-large-bf (number-to-string day))
         (unless (string-equal "" (setq s (cal-tex-latexify-list
                                           holidays date "; ")))
@@ -976,7 +976,7 @@ shown are hard-coded to 8-12, 13-17."
   (cal-tex-large-bf (cal-tex-LaTeXify-string (calendar-day-name date)))
   (insert ", ")
   (cal-tex-large-bf (cal-tex-month-name month))
-  (insert " ")
+  (insert "\\ ")
   (cal-tex-large-bf (number-to-string day))
   (unless (string-equal "" (setq s (cal-tex-latexify-list
                                     holidays date "; ")))
diff --git a/lisp/calendar/cal-x.el b/lisp/calendar/cal-x.el
index f605d0c..58d1eeb 100644
--- a/lisp/calendar/cal-x.el
+++ b/lisp/calendar/cal-x.el
@@ -1,6 +1,6 @@
 ;;; cal-x.el --- calendar windows in dedicated frames
 
-;; Copyright (C) 1994-1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;;         Edward M. Reingold <address@hidden>
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 71fb76c..de8f758 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1,6 +1,6 @@
 ;;; calendar.el --- calendar functions  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1988-1995, 1997, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1988-1995, 1997, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Edward M. Reingold <address@hidden>
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index acf4b20..1be2a05 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -1,6 +1,6 @@
 ;;; diary-lib.el --- diary functions  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1989-1990, 1992-1995, 2001-2018 Free Software
+;; Copyright (C) 1989-1990, 1992-1995, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Edward M. Reingold <address@hidden>
@@ -1412,13 +1412,15 @@ marks.  This is intended to deal with deleted diary 
entries."
           (setq file-glob-attrs (nth 1 (diary-pull-attrs nil '())))
           (with-syntax-table diary-syntax-table
             (save-excursion
-              (diary-mark-entries-1 'calendar-mark-date-pattern)
-              (diary-mark-sexp-entries)
-              ;; Although it looks like mark-entries-hook runs every time,
-              ;; diary-mark-included-diary-files binds it to nil
-              ;; (essentially) when it runs in included files.
-              (run-hooks 'diary-nongregorian-marking-hook
-                         'diary-mark-entries-hook))))
+              (save-restriction
+                (widen)                 ; bug#33423
+                (diary-mark-entries-1 'calendar-mark-date-pattern)
+                (diary-mark-sexp-entries)
+                ;; Although it looks like mark-entries-hook runs every time,
+                ;; diary-mark-included-diary-files binds it to nil
+                ;; (essentially) when it runs in included files.
+                (run-hooks 'diary-nongregorian-marking-hook
+                           'diary-mark-entries-hook)))))
       (and temp-buff (buffer-name temp-buff) (kill-buffer temp-buff)))
     (or d-incp (message "Marking diary entries...done"))))
 
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index f383083..2b080c3 100644
--- a/lisp/calendar/holidays.el
+++ b/lisp/calendar/holidays.el
@@ -1,6 +1,6 @@
-;;; holidays.el --- holiday functions for the calendar package
+;;; holidays.el --- holiday functions for the calendar package  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1989-1990, 1992-1994, 1997, 2001-2018 Free Software
+;; Copyright (C) 1989-1990, 1992-1994, 1997, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Edward M. Reingold <address@hidden>
@@ -64,8 +64,7 @@
     (holiday-float 11 4 4 "Thanksgiving")))
   "General holidays.  Default value is for the United States.
 See the documentation for `calendar-holidays' for details."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-general-holidays 'risky-local-variable t)
 
@@ -86,8 +85,7 @@ See the documentation for `calendar-holidays' for details."
   "Oriental holidays.
 See the documentation for `calendar-holidays' for details."
   :version "23.1"                       ; added more holidays
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-oriental-holidays 'risky-local-variable t)
 
@@ -95,8 +93,7 @@ See the documentation for `calendar-holidays' for details."
 (defcustom holiday-local-holidays nil
   "Local holidays.
 See the documentation for `calendar-holidays' for details."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-local-holidays 'risky-local-variable t)
 
@@ -104,8 +101,7 @@ See the documentation for `calendar-holidays' for details."
 (defcustom holiday-other-holidays nil
   "User defined holidays.
 See the documentation for `calendar-holidays' for details."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-other-holidays 'risky-local-variable t)
 
@@ -122,8 +118,8 @@ See the documentation for `calendar-holidays' for details."
   "Jewish holidays.
 See the documentation for `calendar-holidays' for details."
   :type 'sexp
-  :version "23.1"            ; removed dependency on hebrew-holidays-N
-  :group 'holidays)
+  :version "23.1")            ; removed dependency on hebrew-holidays-N
+
 ;;;###autoload
 (put 'holiday-hebrew-holidays 'risky-local-variable t)
 
@@ -141,8 +137,7 @@ See the documentation for `calendar-holidays' for details."
          (holiday-advent 0 "Advent")))))
   "Christian holidays.
 See the documentation for `calendar-holidays' for details."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-christian-holidays 'risky-local-variable t)
 
@@ -162,8 +157,7 @@ See the documentation for `calendar-holidays' for details."
          (holiday-islamic 12 10 "Id-al-Adha")))))
   "Islamic holidays.
 See the documentation for `calendar-holidays' for details."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-islamic-holidays 'risky-local-variable t)
 
@@ -183,8 +177,7 @@ See the documentation for `calendar-holidays' for details."
          (holiday-fixed 11 28 "Ascension of `Abdu’l-Bahá")))))
   "Bahá’í holidays.
 See the documentation for `calendar-holidays' for details."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-bahai-holidays 'risky-local-variable t)
 
@@ -204,8 +197,7 @@ See the documentation for `calendar-holidays' for details."
                            calendar-daylight-time-zone-name)))))
   "Sun-related holidays.
 See the documentation for `calendar-holidays' for details."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'holiday-solar-holidays 'risky-local-variable t)
 
@@ -323,8 +315,7 @@ you've written to return a (possibly empty) list of the 
relevant VISIBLE dates
 with descriptive strings such as
 
      (((2 6 1989) \"New Moon\") ((2 12 1989) \"First Quarter Moon\") ... )."
-  :type 'sexp
-  :group 'holidays)
+  :type 'sexp)
 ;;;###autoload
 (put 'calendar-holidays 'risky-local-variable t)
 
@@ -336,14 +327,14 @@ with descriptive strings such as
 (defun calendar-holiday-list ()
   "Form the list of holidays that occur on dates in the calendar window.
 The holidays are those in the list `calendar-holidays'."
-  (let (res h err)
+  (let (res h)
     (sort
      (dolist (p calendar-holidays res)
        (if (setq h (if calendar-debug-sexp
                        (let ((debug-on-error t))
-                         (eval p))
+                         (eval p t))
                      (condition-case err
-                         (eval p)
+                         (eval p t)
                        (error
                         (display-warning
                          'holidays
@@ -470,7 +461,7 @@ The optional LABEL is used to label the buffer created."
           (choice (capitalize
                    (completing-read "List (TAB for choices): " lists nil t)))
           (which (if (string-equal choice "Ask")
-                     (eval (read-variable "Enter list name: "))
+                     (symbol-value (read-variable "Enter list name: "))
                    (cdr (assoc choice lists))))
           (name (if (string-equal choice "Equinoxes/Solstices")
                     choice
@@ -536,7 +527,7 @@ strings describing those holidays that apply on DATE, or 
nil if none do."
                  3)))
          holidays in-range a)
     (calendar-increment-month displayed-month displayed-year 1)
-    (dotimes (_idummy number-of-intervals)
+    (dotimes (_ number-of-intervals)
       (setq holidays (append holidays (calendar-holiday-list)))
       (calendar-increment-month displayed-month displayed-year 3))
     (dolist (hol holidays)
@@ -690,19 +681,19 @@ the holiday description of `date'.  If `date' is visible 
in the
 calendar window, the holiday STRING is on that date.  If date is
 nil, or if the date is not visible, there is no holiday."
   (let ((m displayed-month)
-        (y displayed-year)
-        year date)
+        (y displayed-year))
     (calendar-increment-month m y -1)
     (holiday-filter-visible-calendar
-     (list
-      (progn
-        (setq year y
-              date (eval sexp))
-        (list date (if date (eval string))))
-      (progn
-        (setq year (1+ y)
-              date (eval sexp))
-        (list date (if date (eval string))))))))
+     (calendar-dlet* (year date)
+       (list
+        (progn
+          (setq year y
+                date (eval sexp t))
+          (list date (if date (eval string t))))
+        (progn
+          (setq year (1+ y)
+                date (eval sexp t))
+          (list date (if date (eval string t)))))))))
 
 
 (defun holiday-advent (&optional n string)
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index e3e458a..a8fd765 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -1,6 +1,6 @@
 ;;; icalendar.el --- iCalendar implementation -*- lexical-binding: t -*-
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author:         Ulf Jasper <address@hidden>
 ;; Created:        August 2002
@@ -643,12 +643,14 @@ FIXME: multiple comma-separated values should be allowed!"
               (setq year  (nth 2 mdy))))
         ;; create the decoded date-time
         ;; FIXME!?!
-        (condition-case nil
-            (decode-time (encode-time second minute hour day month year zone))
-          (error
-           (message "Cannot decode \"%s\"" isodatetimestring)
-           ;; hope for the best...
-           (list second minute hour day month year 0 nil 0))))
+       (let ((decoded-time (list second minute hour day month year
+                                 nil -1 zone)))
+         (condition-case nil
+             (decode-time (encode-time decoded-time 'integer))
+           (error
+            (message "Cannot decode \"%s\"" isodatetimestring)
+            ;; Hope for the best....
+            decoded-time))))
     ;; isodatetimestring == nil
     nil))
 
@@ -1596,8 +1598,7 @@ regular expression matching the start of non-marking 
entries.
 ENTRY-MAIN is the first line of the diary entry.
 
 Optional argument START determines the first day of the
-enumeration, given as a time value, in same format as returned by
-`current-time' -- used for test purposes."
+enumeration, given as a Lisp time value -- used for test purposes."
   (cond ((string-match (concat nonmarker
                                "%%(and \\(([^)]+)\\))\\(\\s-*.*?\\) ?$")
                        entry-main)
@@ -1621,8 +1622,7 @@ enumeration, given as a time value, in same format as 
returned by
                    (mapcar
                     (lambda (offset)
                       (let* ((day (decode-time (time-add now
-                                                         (seconds-to-time
-                                                          (* offset 60 60 
24)))))
+                                                        (* 60 60 24 offset))))
                              (d (nth 3 day))
                              (m (nth 4 day))
                              (y (nth 5 day))
diff --git a/lisp/calendar/lunar.el b/lisp/calendar/lunar.el
index b9d79e4..5424551 100644
--- a/lisp/calendar/lunar.el
+++ b/lisp/calendar/lunar.el
@@ -1,6 +1,6 @@
 ;;; lunar.el --- calendar functions for phases of the moon
 
-;; Copyright (C) 1992-1993, 1995, 1997, 2001-2018 Free Software
+;; Copyright (C) 1992-1993, 1995, 1997, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Edward M. Reingold <address@hidden>
diff --git a/lisp/calendar/parse-time.el b/lisp/calendar/parse-time.el
index 9443fde..93e7e53 100644
--- a/lisp/calendar/parse-time.el
+++ b/lisp/calendar/parse-time.el
@@ -1,6 +1,6 @@
 ;;; parse-time.el --- parsing time strings -*- lexical-binding: t -*-
 
-;; Copyright (C) 1996, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Erik Naggum <address@hidden>
 ;; Keywords: util
@@ -147,7 +147,7 @@ letters, digits, plus or minus signs or colons."
 ;;;###autoload
 (defun parse-time-string (string)
   "Parse the time-string STRING into (SEC MIN HOUR DAY MON YEAR DOW DST TZ).
-STRING should be on something resembling an RFC2822 string, a la
+STRING should be something resembling an RFC 822 (or later) date-time, e.g.,
 \"Fri, 25 Mar 2016 16:24:56 +0100\", but this function is
 somewhat liberal in what format it accepts, and will attempt to
 return a \"likely\" value even for somewhat malformed strings.
diff --git a/lisp/calendar/solar.el b/lisp/calendar/solar.el
index ddaf745..23bc761 100644
--- a/lisp/calendar/solar.el
+++ b/lisp/calendar/solar.el
@@ -1,6 +1,6 @@
 ;;; solar.el --- calendar functions for solar events  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-1993, 1995, 1997, 2001-2018 Free Software
+;; Copyright (C) 1992-1993, 1995, 1997, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Edward M. Reingold <address@hidden>
diff --git a/lisp/calendar/time-date.el b/lisp/calendar/time-date.el
index c3898e0..cc30bd1 100644
--- a/lisp/calendar/time-date.el
+++ b/lisp/calendar/time-date.el
@@ -1,6 +1,6 @@
 ;;; time-date.el --- Date and time handling functions
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;;     Masanobu Umeda <address@hidden>
@@ -148,17 +148,17 @@ it is assumed that PICO was omitted and should be treated 
as zero."
 ;; values.  timezone-make-date-arpa-standard should help.
 (defun date-to-time (date)
   "Parse a string DATE that represents a date-time and return a time value.
+DATE should be in one of the forms recognized by `parse-time-string'.
 If DATE lacks timezone information, GMT is assumed."
   (condition-case err
-      (apply 'encode-time (parse-time-string date))
+      (encode-time (parse-time-string date))
     (error
      (let ((overflow-error '(error "Specified time is not representable")))
        (if (equal err overflow-error)
           (apply 'signal err)
         (condition-case err
-            (apply 'encode-time
-                   (parse-time-string
-                    (timezone-make-date-arpa-standard date)))
+            (encode-time (parse-time-string
+                          (timezone-make-date-arpa-standard date)))
           (error
            (if (equal err overflow-error)
                (apply 'signal err)
diff --git a/lisp/calendar/timeclock.el b/lisp/calendar/timeclock.el
index 646f529..a896df5 100644
--- a/lisp/calendar/timeclock.el
+++ b/lisp/calendar/timeclock.el
@@ -1,6 +1,6 @@
 ;;; timeclock.el --- mode for keeping track of how much you work  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 ;; Created: 25 Mar 1999
@@ -467,16 +467,10 @@ include the second count.  If REVERSE-LEADER is non-nil, 
it means to
 output a \"+\" if the time value is negative, rather than a \"-\".
 This is used when negative time values have an inverted meaning (such
 as with time remaining, where negative time really means overtime)."
-  (if show-seconds
-      (format "%s%d:%02d:%02d"
-             (if (< seconds 0) (if reverse-leader "+" "-") "")
-             (truncate (/ (abs seconds) 60 60))
-             (% (truncate (/ (abs seconds) 60)) 60)
-             (% (truncate (abs seconds)) 60))
-    (format "%s%d:%02d"
+  (let ((s (abs (truncate seconds))))
+    (format (if show-seconds "%s%d:%02d:%02d" "%s%d:%02d")
            (if (< seconds 0) (if reverse-leader "+" "-") "")
-           (truncate (/ (abs seconds) 60 60))
-           (% (truncate (/ (abs seconds) 60)) 60))))
+           (/ s 3600) (% (/ s 60) 60) (% s 60))))
 
 (defsubst timeclock-currently-in-p ()
   "Return non-nil if the user is currently clocked in."
@@ -528,14 +522,12 @@ non-nil, the amount returned will be relative to past 
time worked."
   "Return a time value representing the end of today's workday.
 If TODAY-ONLY is non-nil, the value returned will be relative only to
 the time worked today, and not to past time."
-  (seconds-to-time
-   (- (float-time)
-      (let ((discrep (timeclock-find-discrep)))
-       (if discrep
-           (if today-only
-               (cadr discrep)
-             (car discrep))
-         0.0)))))
+  (time-since (let ((discrep (timeclock-find-discrep)))
+               (if discrep
+                   (if today-only
+                       (cadr discrep)
+                     (car discrep))
+                 0))))
 
 ;;;###autoload
 (defun timeclock-when-to-leave-string (&optional show-seconds
@@ -672,8 +664,8 @@ being logged for.  Normally only \"in\" events specify a 
project."
                    "\n")
            (if (equal (downcase code) "o")
                (setq timeclock-last-period
-                     (- (float-time now)
-                        (float-time (cadr timeclock-last-event)))
+                     (float-time
+                      (time-subtract now (cadr timeclock-last-event)))
                      timeclock-discrepancy
                      (+ timeclock-discrepancy
                         timeclock-last-period)))
@@ -708,8 +700,7 @@ recorded to disk.  If MOMENT is non-nil, use that as the 
current time.
 This is only provided for coherency when used by
 `timeclock-discrepancy'."
   (if (equal (car timeclock-last-event) "i")
-      (- (float-time moment)
-        (float-time (cadr timeclock-last-event)))
+      (float-time (time-subtract moment (cadr timeclock-last-event)))
     timeclock-last-period))
 
 (cl-defstruct (timeclock-entry
@@ -722,8 +713,7 @@ This is only provided for coherency when used by
 
 (defsubst timeclock-entry-length (entry)
   "Return the length of ENTRY in seconds."
-  (- (float-time (cadr entry))
-     (float-time (car entry))))
+  (float-time (time-subtract (cadr entry) (car entry))))
 
 (defsubst timeclock-entry-list-length (entry-list)
   "Return the total length of ENTRY-LIST in seconds."
@@ -742,8 +732,8 @@ This is only provided for coherency when used by
 
 (defsubst timeclock-entry-list-span (entry-list)
   "Return the total time in seconds spanned by ENTRY-LIST."
-  (- (float-time (timeclock-entry-list-end entry-list))
-     (float-time (timeclock-entry-list-begin entry-list))))
+  (float-time (time-subtract (timeclock-entry-list-end entry-list)
+                            (timeclock-entry-list-begin entry-list))))
 
 (defsubst timeclock-entry-list-break (entry-list)
   "Return the total break time (span - length) in ENTRY-LIST."
@@ -1110,7 +1100,7 @@ discrepancy, today's discrepancy, and the time worked 
today."
                           last-date-limited nil)
                     (if beg
                         (error "Error in format of timelog file!")
-                      (setq beg (float-time (cadr event))))))
+                      (setq beg (cadr event)))))
                  ((equal (downcase (car event)) "o")
                   (if (and (nth 2 event)
                            (> (length (nth 2 event)) 0))
@@ -1118,7 +1108,7 @@ discrepancy, today's discrepancy, and the time worked 
today."
                   (if (not beg)
                       (error "Error in format of timelog file!")
                     (setq timeclock-last-period
-                          (- (float-time (cadr event)) beg)
+                          (float-time (time-subtract (cadr event) beg))
                           accum (+ timeclock-last-period accum)
                           beg nil))
                   (if (equal last-date todays-date)
@@ -1156,7 +1146,7 @@ If optional argument TIME is non-nil, use that instead of 
the current time."
     (setcar (nthcdr 0 decoded) 0)
     (setcar (nthcdr 1 decoded) 0)
     (setcar (nthcdr 2 decoded) 0)
-    (apply 'encode-time decoded)))
+    (encode-time decoded)))
 
 (defun timeclock-mean (l)
   "Compute the arithmetic mean of the values in the list L."
@@ -1196,9 +1186,7 @@ HTML-P is non-nil, HTML markup is added."
            (insert project "</b><br>\n")
          (insert project "*\n"))
        (let ((proj-data (cdr (assoc project (timeclock-project-alist log))))
-             (two-weeks-ago (seconds-to-time
-                             (- (float-time today)
-                                (* 2 7 24 60 60))))
+             (two-weeks-ago (time-subtract today (* 2 7 24 60 60)))
              two-week-len today-len)
          (while proj-data
            (if (not (time-less-p
@@ -1249,18 +1237,10 @@ HTML-P is non-nil, HTML markup is added."
     <th>-1 year</th>
 </tr>")
        (let* ((day-list (timeclock-day-list))
-              (thirty-days-ago (seconds-to-time
-                                (- (float-time today)
-                                   (* 30 24 60 60))))
-              (three-months-ago (seconds-to-time
-                                 (- (float-time today)
-                                    (* 90 24 60 60))))
-              (six-months-ago (seconds-to-time
-                               (- (float-time today)
-                                  (* 180 24 60 60))))
-              (one-year-ago (seconds-to-time
-                             (- (float-time today)
-                                (* 365 24 60 60))))
+              (thirty-days-ago (time-subtract today (* 30 24 60 60)))
+              (three-months-ago (time-subtract today (* 90 24 60 60)))
+              (six-months-ago (time-subtract today (* 180 24 60 60)))
+              (one-year-ago (time-subtract today (* 365 24 60 60)))
               (time-in  (vector (list t) (list t) (list t) (list t) (list t)))
               (time-out (vector (list t) (list t) (list t) (list t) (list t)))
               (breaks   (vector (list t) (list t) (list t) (list t) (list t)))
@@ -1273,12 +1253,11 @@ HTML-P is non-nil, HTML markup is added."
              (unless (time-less-p
                       (timeclock-day-begin day)
                       (aref lengths i))
-               (let ((base (float-time
-                            (timeclock-day-base
-                             (timeclock-day-begin day)))))
+               (let ((base (timeclock-day-base (timeclock-day-begin day))))
                  (nconc (aref time-in i)
-                        (list (- (float-time (timeclock-day-begin day))
-                                 base)))
+                        (list (float-time (time-subtract
+                                           (timeclock-day-begin day)
+                                           base))))
                  (let ((span (timeclock-day-span day))
                        (len (timeclock-day-length day))
                        (req (timeclock-day-required day)))
@@ -1289,8 +1268,9 @@ HTML-P is non-nil, HTML markup is added."
                    (when (and (> span 0)
                               (> (/ (float len) (float span)) 0.70))
                      (nconc (aref time-out i)
-                            (list (- (float-time (timeclock-day-end day))
-                                     base)))
+                            (list (float-time (time-subtract
+                                               (timeclock-day-end day)
+                                               base))))
                      (nconc (aref breaks i) (list (- span len))))
                    (if req
                        (setq len (+ len (- timeclock-workday req))))
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 7d01fe3..7169ef4 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -1,6 +1,6 @@
 ;;; todo-mode.el --- facilities for making and maintaining todo lists  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1997, 1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Oliver Seidel <address@hidden>
 ;;     Stephen Berman <address@hidden>
@@ -1931,7 +1931,7 @@ their associated keys and their effects."
                             (calendar-current-date) t t))))
             (time-string (or (and time (todo-read-time))
                              (and todo-always-add-time-string
-                                  (substring (current-time-string) 11 16)))))
+                                  (format-time-string "%H:%M")))))
        (setq todo-date-from-calendar nil)
        (find-file-noselect file 'nowarn)
        (set-window-buffer (selected-window)
@@ -2881,8 +2881,7 @@ visible."
              (not marked))
       (let* ((date-string (calendar-date-string (calendar-current-date) t t))
             (time-string (if todo-always-add-time-string
-                             (concat " " (substring (current-time-string)
-                                                    11 16))
+                             (format-time-string " %H:%M")
                            ""))
             (done-prefix (concat "[" todo-done-string date-string time-string
                                  "] "))
@@ -6091,7 +6090,7 @@ the empty string (i.e., no time string)."
     (while (not valid)
       (setq answer (read-string "Enter a clock time: " nil nil
                                (when todo-always-add-time-string
-                                 (substring (current-time-string) 11 16))))
+                                 (format-time-string "%H:%M"))))
       (when (or (string= "" answer)
                (string-match diary-time-regexp answer))
        (setq valid t)))
@@ -6389,8 +6388,7 @@ Filtered Items mode following todo (not done) items."
 ;; 
-----------------------------------------------------------------------------
 
 (defvar todo-key-bindings-t
-  `(
-    ("Af"           todo-find-archive)
+  '(("Af"           todo-find-archive)
     ("Ac"           todo-choose-archive)
     ("Ad"           todo-archive-done-item)
     ("Cv"           todo-toggle-view-done-items)
@@ -6421,13 +6419,11 @@ Filtered Items mode following todo (not done) items."
     ("k"            todo-delete-item)
     ("m"            todo-move-item)
     ("u"            todo-item-undone)
-    ([remap newline] newline-and-indent)
-   )
+    ([remap newline] newline-and-indent))
   "List of key bindings for Todo mode only.")
 
 (defvar todo-key-bindings-t+a+f
-  `(
-    ("C*" todo-mark-category)
+  '(("C*" todo-mark-category)
     ("Cu" todo-unmark-category)
     ("Fh" todo-toggle-item-header)
     ("h"  todo-toggle-item-header)
@@ -6444,27 +6440,22 @@ Filtered Items mode following todo (not done) items."
     ("p"  todo-previous-item)
     ("q"  todo-quit)
     ("s"  todo-save)
-    ("t"  todo-show)
-   )
+    ("t"  todo-show))
   "List of key bindings for Todo, Archive, and Filtered Items modes.")
 
 (defvar todo-key-bindings-t+a
-  `(
-    ("Fc" todo-show-categories-table)
+  '(("Fc" todo-show-categories-table)
     ("S"  todo-search)
     ("X"  todo-clear-matches)
     ("b"  todo-backward-category)
     ("f"  todo-forward-category)
-    ("*"  todo-toggle-mark-item)
-   )
+    ("*"  todo-toggle-mark-item))
   "List of key bindings for Todo and Todo Archive modes.")
 
 (defvar todo-key-bindings-t+f
-  `(
-    ("l" todo-lower-item-priority)
+  '(("l" todo-lower-item-priority)
     ("r" todo-raise-item-priority)
-    ("#" todo-set-item-priority)
-   )
+    ("#" todo-set-item-priority))
   "List of key bindings for Todo and Todo Filtered Items modes.")
 
 (defvar todo-mode-map
diff --git a/lisp/case-table.el b/lisp/case-table.el
index 8ff931d..c27e772 100644
--- a/lisp/case-table.el
+++ b/lisp/case-table.el
@@ -1,6 +1,6 @@
 ;;; case-table.el --- code to extend the character set and support case tables 
 -*- lexical-binding: t -*-
 
-;; Copyright (C) 1988, 1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Howard Gayle
 ;; Maintainer: address@hidden
diff --git a/lisp/cdl.el b/lisp/cdl.el
index 487ec90..752e59b 100644
--- a/lisp/cdl.el
+++ b/lisp/cdl.el
@@ -1,6 +1,6 @@
 ;;; cdl.el --- Common Data Language (CDL) utility functions for GNU Emacs
 
-;; Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Ata Etemadi <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/cedet/ChangeLog.1 b/lisp/cedet/ChangeLog.1
index 58ce7f7..8333dd3 100644
--- a/lisp/cedet/ChangeLog.1
+++ b/lisp/cedet/ChangeLog.1
@@ -3460,7 +3460,7 @@
 ;; coding: utf-8
 ;; End:
 
-       Copyright (C) 2009-2018 Free Software Foundation, Inc.
+       Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/cedet/cedet-cscope.el b/lisp/cedet/cedet-cscope.el
index ef958fa..19a4ef9 100644
--- a/lisp/cedet/cedet-cscope.el
+++ b/lisp/cedet/cedet-cscope.el
@@ -1,6 +1,6 @@
 ;;; cedet-cscope.el --- CScope support for CEDET
 
-;;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Package: cedet
diff --git a/lisp/cedet/cedet-files.el b/lisp/cedet/cedet-files.el
index 4865b98..b378bcf 100644
--- a/lisp/cedet/cedet-files.el
+++ b/lisp/cedet/cedet-files.el
@@ -1,6 +1,6 @@
 ;;; cedet-files.el --- Common routines dealing with file names.
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Package: cedet
diff --git a/lisp/cedet/cedet-global.el b/lisp/cedet/cedet-global.el
index a0e8813..0a6604b 100644
--- a/lisp/cedet/cedet-global.el
+++ b/lisp/cedet/cedet-global.el
@@ -1,6 +1,6 @@
 ;;; cedet-global.el --- GNU Global support for CEDET.
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Package: cedet
diff --git a/lisp/cedet/cedet-idutils.el b/lisp/cedet/cedet-idutils.el
index 393d64d..7b8be07 100644
--- a/lisp/cedet/cedet-idutils.el
+++ b/lisp/cedet/cedet-idutils.el
@@ -1,6 +1,6 @@
 ;;; cedet-idutils.el --- ID Utils support for CEDET.
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Old-Version: 0.2
diff --git a/lisp/cedet/cedet.el b/lisp/cedet/cedet.el
index 34a4d99..b3d4a5d 100644
--- a/lisp/cedet/cedet.el
+++ b/lisp/cedet/cedet.el
@@ -1,6 +1,6 @@
 ;;; cedet.el --- Setup CEDET environment
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <address@hidden>
 ;; Maintainer: Eric M. Ludlam  <address@hidden>
diff --git a/lisp/cedet/data-debug.el b/lisp/cedet/data-debug.el
index 0a907c9..eeec6b5 100644
--- a/lisp/cedet/data-debug.el
+++ b/lisp/cedet/data-debug.el
@@ -1,6 +1,6 @@
 ;;; data-debug.el --- Data structure debugger
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam  <address@hidden>
 ;; Old-Version: 0.2
@@ -920,14 +920,14 @@ If PARENT is non-nil, it is somehow related as a parent 
to thing."
   (interactive)
   (forward-line 1)
   (beginning-of-line)
-  (skip-chars-forward " *-><[]" (point-at-eol)))
+  (skip-chars-forward "- *><[]" (point-at-eol)))
 
 (defun data-debug-prev ()
   "Go to the previous line in the Ddebug buffer."
   (interactive)
   (forward-line -1)
   (beginning-of-line)
-  (skip-chars-forward " *-><[]" (point-at-eol)))
+  (skip-chars-forward "- *><[]" (point-at-eol)))
 
 (defun data-debug-next-expando ()
   "Go to the next line in the Ddebug buffer.
@@ -1014,7 +1014,7 @@ Do nothing if already contracted."
           (data-debug-current-line-expanded-p))
       (data-debug-contract-current-line)
     (data-debug-expand-current-line))
-  (skip-chars-forward " *-><[]" (point-at-eol)))
+  (skip-chars-forward "- *><[]" (point-at-eol)))
 
 (defun data-debug-expand-or-contract-mouse (event)
   "Expand or contract anything at event EVENT."
diff --git a/lisp/cedet/ede.el b/lisp/cedet/ede.el
index 1168f26..22374dd 100644
--- a/lisp/cedet/ede.el
+++ b/lisp/cedet/ede.el
@@ -1,6 +1,6 @@
 ;;; ede.el --- Emacs Development Environment gloss
 
-;; Copyright (C) 1998-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/auto.el b/lisp/cedet/ede/auto.el
index b360694..4871d51 100644
--- a/lisp/cedet/ede/auto.el
+++ b/lisp/cedet/ede/auto.el
@@ -1,6 +1,6 @@
 ;;; ede/auto.el --- Autoload features for EDE
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/ede/autoconf-edit.el b/lisp/cedet/ede/autoconf-edit.el
index 2c5ca56..c243e9b 100644
--- a/lisp/cedet/ede/autoconf-edit.el
+++ b/lisp/cedet/ede/autoconf-edit.el
@@ -1,6 +1,6 @@
 ;;; ede/autoconf-edit.el --- Keymap for autoconf
 
-;; Copyright (C) 1998-2000, 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2000, 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: project
diff --git a/lisp/cedet/ede/base.el b/lisp/cedet/ede/base.el
index 8e2ee16..41ab17f 100644
--- a/lisp/cedet/ede/base.el
+++ b/lisp/cedet/ede/base.el
@@ -1,6 +1,6 @@
 ;;; ede/base.el --- Baseclasses for EDE.
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/ede/config.el b/lisp/cedet/ede/config.el
index 2cb2271..285951c 100644
--- a/lisp/cedet/ede/config.el
+++ b/lisp/cedet/ede/config.el
@@ -1,6 +1,6 @@
 ;;; ede/config.el --- Configuration Handler baseclass
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Ludlam <address@hidden>
 
diff --git a/lisp/cedet/ede/cpp-root.el b/lisp/cedet/ede/cpp-root.el
index bcefb4e..f715187 100644
--- a/lisp/cedet/ede/cpp-root.el
+++ b/lisp/cedet/ede/cpp-root.el
@@ -1,6 +1,6 @@
 ;;; ede/cpp-root.el --- A simple way to wrap a C++ project with a single root
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/ede/custom.el b/lisp/cedet/ede/custom.el
index aea4fd7..f4c34aa 100644
--- a/lisp/cedet/ede/custom.el
+++ b/lisp/cedet/ede/custom.el
@@ -1,6 +1,6 @@
 ;;; ede/custom.el --- customization of EDE projects.
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/ede/detect.el b/lisp/cedet/ede/detect.el
index 2b5086a..e33f7a9 100644
--- a/lisp/cedet/ede/detect.el
+++ b/lisp/cedet/ede/detect.el
@@ -1,6 +1,6 @@
 ;;; ede/detect.el --- EDE project detection and file associations
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
@@ -198,7 +198,7 @@ Return a cons cell:
        (ans (ede-detect-directory-for-project default-directory)))
     (if ans
        (message "Project found in %d sec @ %s of type %s"
-                (float-time (time-subtract nil start))
+                (encode-time (time-since start) 'integer)
                 (car ans)
                 (eieio-object-name-string (cdr ans)))
       (message "No Project found.") )))
diff --git a/lisp/cedet/ede/dired.el b/lisp/cedet/ede/dired.el
index 9600d3d..7fe8809 100644
--- a/lisp/cedet/ede/dired.el
+++ b/lisp/cedet/ede/dired.el
@@ -1,6 +1,6 @@
 ;;; ede/dired.el --- EDE extensions to dired.
 
-;; Copyright (C) 1998-2000, 2003, 2009-2018 Free Software Foundation,
+;; Copyright (C) 1998-2000, 2003, 2009-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/lisp/cedet/ede/emacs.el b/lisp/cedet/ede/emacs.el
index f756932..19400c7 100644
--- a/lisp/cedet/ede/emacs.el
+++ b/lisp/cedet/ede/emacs.el
@@ -1,6 +1,6 @@
 ;;; ede/emacs.el --- Special project for Emacs
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/ede/files.el b/lisp/cedet/ede/files.el
index 2c47481..dbe07fb 100644
--- a/lisp/cedet/ede/files.el
+++ b/lisp/cedet/ede/files.el
@@ -1,6 +1,6 @@
 ;;; ede/files.el --- Associate projects with files and directories.
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/ede/generic.el b/lisp/cedet/ede/generic.el
index 915891e..075c4ce 100644
--- a/lisp/cedet/ede/generic.el
+++ b/lisp/cedet/ede/generic.el
@@ -1,6 +1,6 @@
 ;;; ede/generic.el --- Base Support for generic build systems
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/ede/linux.el b/lisp/cedet/ede/linux.el
index cb5e739..8ec6d8b 100644
--- a/lisp/cedet/ede/linux.el
+++ b/lisp/cedet/ede/linux.el
@@ -1,6 +1,6 @@
 ;;; ede/linux.el --- Special project for Linux
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/ede/locate.el b/lisp/cedet/ede/locate.el
index c1c4851..866dce6 100644
--- a/lisp/cedet/ede/locate.el
+++ b/lisp/cedet/ede/locate.el
@@ -1,6 +1,6 @@
 ;;; ede/locate.el --- Locate support
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/ede/make.el b/lisp/cedet/ede/make.el
index 8b9a38b..3eb11d5 100644
--- a/lisp/cedet/ede/make.el
+++ b/lisp/cedet/ede/make.el
@@ -1,6 +1,6 @@
 ;;; ede/make.el --- General information about "make"
 
-;;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/ede/makefile-edit.el b/lisp/cedet/ede/makefile-edit.el
index d05fb86..1472108 100644
--- a/lisp/cedet/ede/makefile-edit.el
+++ b/lisp/cedet/ede/makefile-edit.el
@@ -1,6 +1,6 @@
 ;;; makefile-edit.el --- Makefile editing/scanning commands.
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
@@ -105,7 +105,7 @@ STOP-BEFORE is a regular expression matching a file name."
        (let ((e (save-excursion
                   (makefile-end-of-command)
                   (point))))
-         (while (re-search-forward 
"\\s-**\\([-a-zA-Z0-9./address@hidden(){}]+\\)\\s-*" e t)
+         (while (re-search-forward 
"\\s-*\\([-a-zA-Z0-9./address@hidden(){}]+\\)\\s-*" e t)
            (let ((var nil)(varexp nil)
                  (match (buffer-substring-no-properties
                          (match-beginning 1)
diff --git a/lisp/cedet/ede/pconf.el b/lisp/cedet/ede/pconf.el
index cba7aaa..4b6da44 100644
--- a/lisp/cedet/ede/pconf.el
+++ b/lisp/cedet/ede/pconf.el
@@ -1,6 +1,6 @@
 ;;; ede/pconf.el --- configure.ac maintenance for EDE
 
-;;; Copyright (C) 1998-2000, 2005, 2008-2018 Free Software Foundation,
+;;; Copyright (C) 1998-2000, 2005, 2008-2019 Free Software Foundation,
 ;;; Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/lisp/cedet/ede/pmake.el b/lisp/cedet/ede/pmake.el
index f0f07e9..db5a33e 100644
--- a/lisp/cedet/ede/pmake.el
+++ b/lisp/cedet/ede/pmake.el
@@ -1,6 +1,6 @@
 ;;; ede-pmake.el --- EDE Generic Project Makefile code generator.
 
-;; Copyright (C) 1998-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/proj-archive.el b/lisp/cedet/ede/proj-archive.el
index 553f918..d071e42 100644
--- a/lisp/cedet/ede/proj-archive.el
+++ b/lisp/cedet/ede/proj-archive.el
@@ -1,6 +1,6 @@
 ;;; ede/proj-archive.el --- EDE Generic Project archive support
 
-;;  Copyright (C) 1998-2001, 2009-2018 Free Software Foundation, Inc.
+;;  Copyright (C) 1998-2001, 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/proj-aux.el b/lisp/cedet/ede/proj-aux.el
index f75006d..1b03722 100644
--- a/lisp/cedet/ede/proj-aux.el
+++ b/lisp/cedet/ede/proj-aux.el
@@ -1,6 +1,6 @@
 ;;; ede/proj-aux.el --- EDE Generic Project auxiliary file support
 
-;; Copyright (C) 1998-2000, 2007, 2009-2018 Free Software Foundation,
+;; Copyright (C) 1998-2000, 2007, 2009-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/lisp/cedet/ede/proj-comp.el b/lisp/cedet/ede/proj-comp.el
index fc7205f..aa6baf3 100644
--- a/lisp/cedet/ede/proj-comp.el
+++ b/lisp/cedet/ede/proj-comp.el
@@ -1,6 +1,6 @@
 ;;; ede/proj-comp.el --- EDE Generic Project compiler/rule driver
 
-;; Copyright (C) 1999-2001, 2004-2005, 2007, 2009-2018 Free Software
+;; Copyright (C) 1999-2001, 2004-2005, 2007, 2009-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/lisp/cedet/ede/proj-elisp.el b/lisp/cedet/ede/proj-elisp.el
index d9b8989..c8e920a 100644
--- a/lisp/cedet/ede/proj-elisp.el
+++ b/lisp/cedet/ede/proj-elisp.el
@@ -1,6 +1,6 @@
 ;;; ede-proj-elisp.el --- EDE Generic Project Emacs Lisp support
 
-;; Copyright (C) 1998-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/proj-info.el b/lisp/cedet/ede/proj-info.el
index 992996a..1a2f107 100644
--- a/lisp/cedet/ede/proj-info.el
+++ b/lisp/cedet/ede/proj-info.el
@@ -1,6 +1,6 @@
 ;;; ede-proj-info.el --- EDE Generic Project texinfo support
 
-;;; Copyright (C) 1998-2001, 2004, 2007-2018 Free Software Foundation,
+;;; Copyright (C) 1998-2001, 2004, 2007-2019 Free Software Foundation,
 ;;; Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/lisp/cedet/ede/proj-misc.el b/lisp/cedet/ede/proj-misc.el
index d1a8fce..c9be119 100644
--- a/lisp/cedet/ede/proj-misc.el
+++ b/lisp/cedet/ede/proj-misc.el
@@ -1,6 +1,6 @@
 ;;; ede-proj-misc.el --- EDE Generic Project Emacs Lisp support
 
-;; Copyright (C) 1998-2001, 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2001, 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/proj-obj.el b/lisp/cedet/ede/proj-obj.el
index c6c52ed..45e8740 100644
--- a/lisp/cedet/ede/proj-obj.el
+++ b/lisp/cedet/ede/proj-obj.el
@@ -1,6 +1,6 @@
 ;;; ede/proj-obj.el --- EDE Generic Project Object code generation support
 
-;;; Copyright (C) 1998-2000, 2005, 2008-2018 Free Software Foundation,
+;;; Copyright (C) 1998-2000, 2005, 2008-2019 Free Software Foundation,
 ;;; Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/lisp/cedet/ede/proj-prog.el b/lisp/cedet/ede/proj-prog.el
index 215b791..8299b72 100644
--- a/lisp/cedet/ede/proj-prog.el
+++ b/lisp/cedet/ede/proj-prog.el
@@ -1,6 +1,6 @@
 ;;; ede-proj-prog.el --- EDE Generic Project program support
 
-;; Copyright (C) 1998-2001, 2005, 2008-2018 Free Software Foundation,
+;; Copyright (C) 1998-2001, 2005, 2008-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/lisp/cedet/ede/proj-scheme.el b/lisp/cedet/ede/proj-scheme.el
index fa9395d..8f28d62 100644
--- a/lisp/cedet/ede/proj-scheme.el
+++ b/lisp/cedet/ede/proj-scheme.el
@@ -1,6 +1,6 @@
 ;;; ede/proj-scheme.el --- EDE Generic Project scheme (guile) support
 
-;; Copyright (C) 1998-2000, 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2000, 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: project, make, scheme
diff --git a/lisp/cedet/ede/proj-shared.el b/lisp/cedet/ede/proj-shared.el
index 75d02ec..47fb453 100644
--- a/lisp/cedet/ede/proj-shared.el
+++ b/lisp/cedet/ede/proj-shared.el
@@ -1,6 +1,6 @@
 ;;; ede-proj-shared.el --- EDE Generic Project shared library support
 
-;;; Copyright (C) 1998-2000, 2009-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 1998-2000, 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/proj.el b/lisp/cedet/ede/proj.el
index 77ecc2a..0774a46 100644
--- a/lisp/cedet/ede/proj.el
+++ b/lisp/cedet/ede/proj.el
@@ -1,6 +1,6 @@
 ;;; ede/proj.el --- EDE Generic Project file driver
 
-;; Copyright (C) 1998-2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/project-am.el b/lisp/cedet/ede/project-am.el
index e0fb111..12db0a4 100644
--- a/lisp/cedet/ede/project-am.el
+++ b/lisp/cedet/ede/project-am.el
@@ -1,6 +1,6 @@
 ;;; project-am.el --- A project management scheme based on automake files.
 
-;; Copyright (C) 1998-2000, 2003, 2005, 2007-2018 Free Software
+;; Copyright (C) 1998-2000, 2003, 2005, 2007-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/lisp/cedet/ede/shell.el b/lisp/cedet/ede/shell.el
index 7ba338d..a20046c 100644
--- a/lisp/cedet/ede/shell.el
+++ b/lisp/cedet/ede/shell.el
@@ -1,6 +1,6 @@
 ;;; ede/shell.el --- A shell controlled by EDE.
 ;;
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/ede/simple.el b/lisp/cedet/ede/simple.el
index 3931cf6..fb4df48 100644
--- a/lisp/cedet/ede/simple.el
+++ b/lisp/cedet/ede/simple.el
@@ -1,6 +1,6 @@
 ;;; ede/simple.el --- Overlay an EDE structure on an existing project
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/ede/source.el b/lisp/cedet/ede/source.el
index 71a1c38..8105af0 100644
--- a/lisp/cedet/ede/source.el
+++ b/lisp/cedet/ede/source.el
@@ -1,6 +1,6 @@
 ;; ede/source.el --- EDE source code object
 
-;; Copyright (C) 2000, 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: project, make
diff --git a/lisp/cedet/ede/speedbar.el b/lisp/cedet/ede/speedbar.el
index 353bec2..a5ccb66 100644
--- a/lisp/cedet/ede/speedbar.el
+++ b/lisp/cedet/ede/speedbar.el
@@ -1,6 +1,6 @@
 ;;; ede/speedbar.el --- Speedbar viewing of EDE projects
 
-;; Copyright (C) 1998-2001, 2003, 2005, 2007-2018 Free Software
+;; Copyright (C) 1998-2001, 2003, 2005, 2007-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
@@ -276,7 +276,7 @@ INDENT is the current indentation level."
 Etags does not support this feature.  TEXT will be the button
 string.  TOKEN will be the list, and INDENT is the current indentation
 level."
-  (cond ((string-match "+" text)       ;we have to expand this file
+  (cond ((string-match "\\+" text)     ;we have to expand this file
         (speedbar-change-expand-button-char ?-)
         (speedbar-with-writable
           (save-excursion
diff --git a/lisp/cedet/ede/srecode.el b/lisp/cedet/ede/srecode.el
index 0e8e829..5217e2d 100644
--- a/lisp/cedet/ede/srecode.el
+++ b/lisp/cedet/ede/srecode.el
@@ -1,6 +1,6 @@
 ;;; ede/srecode.el --- EDE utilities on top of SRecoder
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/ede/system.el b/lisp/cedet/ede/system.el
index 734450e..9999923 100644
--- a/lisp/cedet/ede/system.el
+++ b/lisp/cedet/ede/system.el
@@ -1,6 +1,6 @@
 ;;; ede-system.el --- EDE working with the system (VC, FTP, ETC)
 
-;; Copyright (C) 2001-2003, 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2003, 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: project, make, vc
diff --git a/lisp/cedet/ede/util.el b/lisp/cedet/ede/util.el
index 7bd0bfe..29b8fbf 100644
--- a/lisp/cedet/ede/util.el
+++ b/lisp/cedet/ede/util.el
@@ -1,6 +1,6 @@
 ;;; ede/util.el --- EDE utilities
 
-;; Copyright (C) 2000, 2005, 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2005, 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: project, make
diff --git a/lisp/cedet/inversion.el b/lisp/cedet/inversion.el
index 48010f7..c62a57e 100644
--- a/lisp/cedet/inversion.el
+++ b/lisp/cedet/inversion.el
@@ -1,6 +1,6 @@
 ;;; inversion.el --- When you need something in version XX.XX
 
-;;; Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Version: 1.3
diff --git a/lisp/cedet/mode-local.el b/lisp/cedet/mode-local.el
index 1cd306b..f83decb 100644
--- a/lisp/cedet/mode-local.el
+++ b/lisp/cedet/mode-local.el
@@ -1,6 +1,6 @@
 ;;; mode-local.el --- Support for mode local facilities
 ;;
-;; Copyright (C) 2004-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2005, 2007-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: David Ponce <address@hidden>
 ;; Maintainer: David Ponce <address@hidden>
diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el
index e34b51f..fd658fa 100644
--- a/lisp/cedet/pulse.el
+++ b/lisp/cedet/pulse.el
@@ -1,6 +1,6 @@
 ;;; pulse.el --- Pulsing Overlays
 
-;;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Version: 1.0
diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el
index f0a1e6b..3c84461 100644
--- a/lisp/cedet/semantic.el
+++ b/lisp/cedet/semantic.el
@@ -1,6 +1,6 @@
 ;;; semantic.el --- Semantic buffer evaluator.
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: syntax tools
@@ -225,37 +225,37 @@ during a flush when the cache is given a new value of 
nil.")
   "Indicate that the current buffer is unparseable.
 It is also true that the parse tree will need either updating or
 a rebuild.  This state will be changed when the user edits the buffer."
-  `(setq semantic-parse-tree-state 'unparseable))
+  '(setq semantic-parse-tree-state 'unparseable))
 
 (defmacro semantic-parse-tree-unparseable-p ()
   "Return non-nil if the current buffer has been marked unparseable."
-  `(eq semantic-parse-tree-state 'unparseable))
+  '(eq semantic-parse-tree-state 'unparseable))
 
 (defmacro semantic-parse-tree-set-needs-update ()
   "Indicate that the current parse tree needs to be updated.
 The parse tree can be updated by `semantic-parse-changes'."
-  `(setq semantic-parse-tree-state 'needs-update))
+  '(setq semantic-parse-tree-state 'needs-update))
 
 (defmacro semantic-parse-tree-needs-update-p ()
   "Return non-nil if the current parse tree needs to be updated."
-  `(eq semantic-parse-tree-state 'needs-update))
+  '(eq semantic-parse-tree-state 'needs-update))
 
 (defmacro semantic-parse-tree-set-needs-rebuild ()
   "Indicate that the current parse tree needs to be rebuilt.
 The parse tree must be rebuilt by `semantic-parse-region'."
-  `(setq semantic-parse-tree-state 'needs-rebuild))
+  '(setq semantic-parse-tree-state 'needs-rebuild))
 
 (defmacro semantic-parse-tree-needs-rebuild-p ()
   "Return non-nil if the current parse tree needs to be rebuilt."
-  `(eq semantic-parse-tree-state 'needs-rebuild))
+  '(eq semantic-parse-tree-state 'needs-rebuild))
 
 (defmacro semantic-parse-tree-set-up-to-date ()
   "Indicate that the current parse tree is up to date."
-  `(setq semantic-parse-tree-state nil))
+  '(setq semantic-parse-tree-state nil))
 
 (defmacro semantic-parse-tree-up-to-date-p ()
   "Return non-nil if the current parse tree is up to date."
-  `(null semantic-parse-tree-state))
+  '(null semantic-parse-tree-state))
 
 ;;; Interfacing with the system
 ;;
diff --git a/lisp/cedet/semantic/analyze.el b/lisp/cedet/semantic/analyze.el
index 2c50722..9ea7ebf 100644
--- a/lisp/cedet/semantic/analyze.el
+++ b/lisp/cedet/semantic/analyze.el
@@ -1,6 +1,6 @@
 ;;; semantic/analyze.el --- Analyze semantic tags against local context
 
-;; Copyright (C) 2000-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/analyze/complete.el 
b/lisp/cedet/semantic/analyze/complete.el
index 68dffc1..7d31ec7 100644
--- a/lisp/cedet/semantic/analyze/complete.el
+++ b/lisp/cedet/semantic/analyze/complete.el
@@ -1,6 +1,6 @@
 ;;; semantic/analyze/complete.el --- Smart Completions
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/analyze/debug.el 
b/lisp/cedet/semantic/analyze/debug.el
index 6041556..d78d850 100644
--- a/lisp/cedet/semantic/analyze/debug.el
+++ b/lisp/cedet/semantic/analyze/debug.el
@@ -1,6 +1,6 @@
 ;;; semantic/analyze/debug.el --- Debug the analyzer
 
-;;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
@@ -558,19 +558,19 @@ PARENT is a possible parent (by nesting) tag."
                         'mouse-face 'custom-button-pressed-face
                         'tag tag
                         'action
-                        `(lambda (button)
-                           (let ((buff nil)
-                                 (pnt nil))
-                             (save-excursion
-                               (semantic-go-to-tag
-                                (button-get button 'tag))
-                               (setq buff (current-buffer))
-                               (setq pnt (point)))
-                             (if (get-buffer-window buff)
-                                 (select-window (get-buffer-window buff))
-                               (pop-to-buffer buff t))
-                             (goto-char pnt)
-                             (pulse-line-hook-function)))
+                        (lambda (button)
+                          (let ((buff nil)
+                                (pnt nil))
+                            (save-excursion
+                              (semantic-go-to-tag
+                               (button-get button 'tag))
+                              (setq buff (current-buffer))
+                              (setq pnt (point)))
+                            (if (get-buffer-window buff)
+                                (select-window (get-buffer-window buff))
+                              (pop-to-buffer buff t))
+                            (goto-char pnt)
+                            (pulse-line-hook-function)))
                         ))
       (princ "\"")
       (princ str)
diff --git a/lisp/cedet/semantic/analyze/fcn.el 
b/lisp/cedet/semantic/analyze/fcn.el
index 5120694..5e46624 100644
--- a/lisp/cedet/semantic/analyze/fcn.el
+++ b/lisp/cedet/semantic/analyze/fcn.el
@@ -1,6 +1,6 @@
 ;;; semantic/analyze/fcn.el --- Analyzer support functions.
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/analyze/refs.el 
b/lisp/cedet/semantic/analyze/refs.el
index 6268da8..7732106 100644
--- a/lisp/cedet/semantic/analyze/refs.el
+++ b/lisp/cedet/semantic/analyze/refs.el
@@ -1,6 +1,6 @@
 ;;; semantic/analyze/refs.el --- Analysis of the references between tags.
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/bovine.el b/lisp/cedet/semantic/bovine.el
index 2e37289..5d174c8 100644
--- a/lisp/cedet/semantic/bovine.el
+++ b/lisp/cedet/semantic/bovine.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine.el --- LL Parser/Analyzer core.
 
-;; Copyright (C) 1999-2004, 2006-2007, 2009-2018 Free Software
+;; Copyright (C) 1999-2004, 2006-2007, 2009-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
@@ -72,7 +72,7 @@ The return list is a lambda expression to be used in a bovine 
table."
   "Return the current nonterminal symbol.
 Part of the grammar source debugger.  Depends on the existing
 environment of `semantic-bovinate-stream'."
-  `(if nt-stack
+  '(if nt-stack
        (car (aref (car nt-stack) 2))
      nonterminal))
 
diff --git a/lisp/cedet/semantic/bovine/c.el b/lisp/cedet/semantic/bovine/c.el
index cb27582..5f0ea16 100644
--- a/lisp/cedet/semantic/bovine/c.el
+++ b/lisp/cedet/semantic/bovine/c.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine/c.el --- Semantic details for C
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/bovine/debug.el 
b/lisp/cedet/semantic/bovine/debug.el
index e511b3d..3464e25 100644
--- a/lisp/cedet/semantic/bovine/debug.el
+++ b/lisp/cedet/semantic/bovine/debug.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine/debug.el --- Debugger support for bovinator
 
-;; Copyright (C) 2003, 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/bovine/el.el b/lisp/cedet/semantic/bovine/el.el
index 7400a4c..d46b73f 100644
--- a/lisp/cedet/semantic/bovine/el.el
+++ b/lisp/cedet/semantic/bovine/el.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine/el.el --- Semantic details for Emacs Lisp
 
-;; Copyright (C) 1999-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/bovine/gcc.el 
b/lisp/cedet/semantic/bovine/gcc.el
index 29ec41e..e04efb3 100644
--- a/lisp/cedet/semantic/bovine/gcc.el
+++ b/lisp/cedet/semantic/bovine/gcc.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine/gcc.el --- gcc querying special code for the C parser
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/bovine/grammar.el 
b/lisp/cedet/semantic/bovine/grammar.el
index 1746f3e..f77bc9d 100644
--- a/lisp/cedet/semantic/bovine/grammar.el
+++ b/lisp/cedet/semantic/bovine/grammar.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine/grammar.el --- Bovine's input grammar mode
 ;;
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: David Ponce <address@hidden>
 ;; Maintainer: David Ponce <address@hidden>
diff --git a/lisp/cedet/semantic/bovine/make.el 
b/lisp/cedet/semantic/bovine/make.el
index 23e3860..4fe3334 100644
--- a/lisp/cedet/semantic/bovine/make.el
+++ b/lisp/cedet/semantic/bovine/make.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine/make.el --- Makefile parsing rules.
 
-;; Copyright (C) 2000-2004, 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2004, 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/bovine/scm.el 
b/lisp/cedet/semantic/bovine/scm.el
index 44b5ff0..3dc2437 100644
--- a/lisp/cedet/semantic/bovine/scm.el
+++ b/lisp/cedet/semantic/bovine/scm.el
@@ -1,6 +1,6 @@
 ;;; semantic/bovine/scm.el --- Semantic details for Scheme (guile)
 
-;;; Copyright (C) 2001-2004, 2008-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2001-2004, 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/chart.el b/lisp/cedet/semantic/chart.el
index b1fe7f3..02da145 100644
--- a/lisp/cedet/semantic/chart.el
+++ b/lisp/cedet/semantic/chart.el
@@ -1,6 +1,6 @@
 ;;; semantic/chart.el --- Utilities for use with semantic tag tables
 
-;; Copyright (C) 1999-2001, 2003, 2005, 2008-2018 Free Software
+;; Copyright (C) 1999-2001, 2003, 2005, 2008-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/lisp/cedet/semantic/complete.el b/lisp/cedet/semantic/complete.el
index eb25f11..88ddd58 100644
--- a/lisp/cedet/semantic/complete.el
+++ b/lisp/cedet/semantic/complete.el
@@ -1,6 +1,6 @@
 ;;; semantic/complete.el --- Routines for performing tag completion
 
-;; Copyright (C) 2003-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/ctxt.el b/lisp/cedet/semantic/ctxt.el
index 8edccfc..54ef2ee 100644
--- a/lisp/cedet/semantic/ctxt.el
+++ b/lisp/cedet/semantic/ctxt.el
@@ -1,6 +1,6 @@
 ;;; semantic/ctxt.el --- Context calculations for Semantic tools.
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/db-debug.el b/lisp/cedet/semantic/db-debug.el
index 3021666..bfc2c98 100644
--- a/lisp/cedet/semantic/db-debug.el
+++ b/lisp/cedet/semantic/db-debug.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-debug.el --- Extra level debugging routines for Semantic
 
-;;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/db-ebrowse.el 
b/lisp/cedet/semantic/db-ebrowse.el
index 1856531..14ada88 100644
--- a/lisp/cedet/semantic/db-ebrowse.el
+++ b/lisp/cedet/semantic/db-ebrowse.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-ebrowse.el --- Semanticdb backend using ebrowse.
 
-;; Copyright (C) 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 ;; Authors: Eric M. Ludlam <address@hidden>
 ;;     Joakim Verona
diff --git a/lisp/cedet/semantic/db-el.el b/lisp/cedet/semantic/db-el.el
index 6752397..5375623 100644
--- a/lisp/cedet/semantic/db-el.el
+++ b/lisp/cedet/semantic/db-el.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-el.el --- Semantic database extensions for Emacs Lisp
 
-;;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: tags
diff --git a/lisp/cedet/semantic/db-file.el b/lisp/cedet/semantic/db-file.el
index 2d55c27..8dbb337 100644
--- a/lisp/cedet/semantic/db-file.el
+++ b/lisp/cedet/semantic/db-file.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-file.el --- Save a semanticdb to a cache file.
 
-;;; Copyright (C) 2000-2005, 2007-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2000-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: tags
diff --git a/lisp/cedet/semantic/db-find.el b/lisp/cedet/semantic/db-find.el
index 7cb2ac1..c89ae13 100644
--- a/lisp/cedet/semantic/db-find.el
+++ b/lisp/cedet/semantic/db-find.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-find.el --- Searching through semantic databases.
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: tags
diff --git a/lisp/cedet/semantic/db-global.el b/lisp/cedet/semantic/db-global.el
index cc58d2c..7592b00 100644
--- a/lisp/cedet/semantic/db-global.el
+++ b/lisp/cedet/semantic/db-global.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-global.el --- Semantic database extensions for GLOBAL
 
-;; Copyright (C) 2002-2006, 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2006, 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: tags
diff --git a/lisp/cedet/semantic/db-javascript.el 
b/lisp/cedet/semantic/db-javascript.el
index 789614d..5622594 100644
--- a/lisp/cedet/semantic/db-javascript.el
+++ b/lisp/cedet/semantic/db-javascript.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-javascript.el --- Semantic database extensions for javascript
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Joakim Verona
 
diff --git a/lisp/cedet/semantic/db-mode.el b/lisp/cedet/semantic/db-mode.el
index e61eb71..e1d8f63 100644
--- a/lisp/cedet/semantic/db-mode.el
+++ b/lisp/cedet/semantic/db-mode.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-mode.el --- Semanticdb Minor Mode
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/db-ref.el b/lisp/cedet/semantic/db-ref.el
index c689e31..ddac96c 100644
--- a/lisp/cedet/semantic/db-ref.el
+++ b/lisp/cedet/semantic/db-ref.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-ref.el --- Handle cross-db file references
 
-;;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/db-typecache.el 
b/lisp/cedet/semantic/db-typecache.el
index ade0dda..8de3cc4 100644
--- a/lisp/cedet/semantic/db-typecache.el
+++ b/lisp/cedet/semantic/db-typecache.el
@@ -1,6 +1,6 @@
 ;;; semantic/db-typecache.el --- Manage Datatypes
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/db.el b/lisp/cedet/semantic/db.el
index 05484fc..1987bc0 100644
--- a/lisp/cedet/semantic/db.el
+++ b/lisp/cedet/semantic/db.el
@@ -1,6 +1,6 @@
 ;;; semantic/db.el --- Semantic tag database manager
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: tags
diff --git a/lisp/cedet/semantic/debug.el b/lisp/cedet/semantic/debug.el
index 3c71c20..e5c04d1 100644
--- a/lisp/cedet/semantic/debug.el
+++ b/lisp/cedet/semantic/debug.el
@@ -1,6 +1,6 @@
 ;;; semantic/debug.el --- Language Debugger framework
 
-;; Copyright (C) 2003-2005, 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2005, 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/decorate.el b/lisp/cedet/semantic/decorate.el
index c33d15c..07e393f 100644
--- a/lisp/cedet/semantic/decorate.el
+++ b/lisp/cedet/semantic/decorate.el
@@ -1,6 +1,6 @@
 ;;; semantic/decorate.el --- Utilities for decorating/highlighting tokens.
 
-;;; Copyright (C) 1999-2003, 2005-2007, 2009-2018 Free Software
+;;; Copyright (C) 1999-2003, 2005-2007, 2009-2019 Free Software
 ;;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/lisp/cedet/semantic/decorate/include.el 
b/lisp/cedet/semantic/decorate/include.el
index 98fcc88..4412a4c 100644
--- a/lisp/cedet/semantic/decorate/include.el
+++ b/lisp/cedet/semantic/decorate/include.el
@@ -1,6 +1,6 @@
 ;;; semantic/decorate/include.el --- Decoration modes for include statements
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/decorate/mode.el 
b/lisp/cedet/semantic/decorate/mode.el
index 77a8471..be1d5db 100644
--- a/lisp/cedet/semantic/decorate/mode.el
+++ b/lisp/cedet/semantic/decorate/mode.el
@@ -1,6 +1,6 @@
 ;;; semantic/decorate/mode.el --- Minor mode for decorating tags
 
-;; Copyright (C) 2000-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/dep.el b/lisp/cedet/semantic/dep.el
index 640884d..84bb228 100644
--- a/lisp/cedet/semantic/dep.el
+++ b/lisp/cedet/semantic/dep.el
@@ -1,6 +1,6 @@
 ;;; semantic/dep.el --- Methods for tracking dependencies (include files)
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: syntax
@@ -56,7 +56,7 @@ reparsed, the cache will be reset.
 TODO: use ffap.el to locate such items?
 
 NOTE: Obsolete this, or use as special user")
-(make-variable-buffer-local `semantic-dependency-include-path)
+(make-variable-buffer-local 'semantic-dependency-include-path)
 
 (defvar semantic-dependency-system-include-path nil
   "Defines the system include path.
@@ -71,7 +71,7 @@ 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.")
-(make-variable-buffer-local `semantic-dependency-system-include-path)
+(make-variable-buffer-local 'semantic-dependency-system-include-path)
 
 (defmacro defcustom-mode-local-semantic-dependency-system-include-path
   (mode name value &optional docstring)
diff --git a/lisp/cedet/semantic/doc.el b/lisp/cedet/semantic/doc.el
index a175355..5611629 100644
--- a/lisp/cedet/semantic/doc.el
+++ b/lisp/cedet/semantic/doc.el
@@ -1,6 +1,6 @@
 ;;; semantic/doc.el --- Routines for documentation strings
 
-;; Copyright (C) 1999-2003, 2005, 2008-2018 Free Software Foundation,
+;; Copyright (C) 1999-2003, 2005, 2008-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/lisp/cedet/semantic/ede-grammar.el 
b/lisp/cedet/semantic/ede-grammar.el
index 8c36623..4ced6fa 100644
--- a/lisp/cedet/semantic/ede-grammar.el
+++ b/lisp/cedet/semantic/ede-grammar.el
@@ -1,6 +1,6 @@
 ;;; semantic/ede-grammar.el --- EDE support for Semantic Grammar Files
 
-;; Copyright (C) 2003-2004, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: project, make
diff --git a/lisp/cedet/semantic/edit.el b/lisp/cedet/semantic/edit.el
index 2a31588..1225492 100644
--- a/lisp/cedet/semantic/edit.el
+++ b/lisp/cedet/semantic/edit.el
@@ -1,6 +1,6 @@
 ;;; semantic/edit.el --- Edit Management for Semantic
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/find.el b/lisp/cedet/semantic/find.el
index 7cb8ebf..57a296d 100644
--- a/lisp/cedet/semantic/find.el
+++ b/lisp/cedet/semantic/find.el
@@ -1,6 +1,6 @@
 ;;; semantic/find.el --- Search routines for Semantic
 
-;; Copyright (C) 1999-2005, 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2005, 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/format.el b/lisp/cedet/semantic/format.el
index 6f4e8c6..7d040fd 100644
--- a/lisp/cedet/semantic/format.el
+++ b/lisp/cedet/semantic/format.el
@@ -1,6 +1,6 @@
 ;;; semantic/format.el --- Routines for formatting tags
 
-;; Copyright (C) 1999-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/fw.el b/lisp/cedet/semantic/fw.el
index 6e7a26e..6719e62 100644
--- a/lisp/cedet/semantic/fw.el
+++ b/lisp/cedet/semantic/fw.el
@@ -1,6 +1,6 @@
 ;;; semantic/fw.el --- Framework for Semantic
 
-;;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/grammar-wy.el 
b/lisp/cedet/semantic/grammar-wy.el
index 49f3264..cc5942f 100644
--- a/lisp/cedet/semantic/grammar-wy.el
+++ b/lisp/cedet/semantic/grammar-wy.el
@@ -1,6 +1,6 @@
 ;;; semantic/grammar-wy.el --- Generated parser support file
 
-;; Copyright (C) 2002-2004, 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2009-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/cedet/semantic/grammar.el b/lisp/cedet/semantic/grammar.el
index ccfb4ec..f6d67cf 100644
--- a/lisp/cedet/semantic/grammar.el
+++ b/lisp/cedet/semantic/grammar.el
@@ -1,6 +1,6 @@
 ;;; semantic/grammar.el --- Major mode framework for Semantic grammars
 
-;; Copyright (C) 2002-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <address@hidden>
 ;; Maintainer: David Ponce <address@hidden>
@@ -1611,7 +1611,7 @@ Select the buffer containing the tag's definition, and 
move point there."
 ;;
 
 (defvar semantic-grammar-syntax-help
-  `(
+  '(
     ;; Lexical Symbols
     ("symbol" . "Syntax: A symbol of alpha numeric and symbol characters")
     ("number" . "Syntax: Numeric characters.")
diff --git a/lisp/cedet/semantic/html.el b/lisp/cedet/semantic/html.el
index 6ddb645..3a8165c 100644
--- a/lisp/cedet/semantic/html.el
+++ b/lisp/cedet/semantic/html.el
@@ -1,6 +1,6 @@
 ;;; semantic/html.el --- Semantic details for html files
 
-;; Copyright (C) 2004-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/ia-sb.el b/lisp/cedet/semantic/ia-sb.el
index c0b22b5..9f2cb7d 100644
--- a/lisp/cedet/semantic/ia-sb.el
+++ b/lisp/cedet/semantic/ia-sb.el
@@ -1,6 +1,6 @@
 ;;; semantic/ia-sb.el --- Speedbar analysis display interactor
 
-;;; Copyright (C) 2002-2004, 2006, 2008-2018 Free Software Foundation,
+;;; Copyright (C) 2002-2004, 2006, 2008-2019 Free Software Foundation,
 ;;; Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/lisp/cedet/semantic/ia.el b/lisp/cedet/semantic/ia.el
index 74f9afe..1549f52 100644
--- a/lisp/cedet/semantic/ia.el
+++ b/lisp/cedet/semantic/ia.el
@@ -1,6 +1,6 @@
 ;;; semantic/ia.el --- Interactive Analysis functions
 
-;;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/idle.el b/lisp/cedet/semantic/idle.el
index 07b7af8..a894630 100644
--- a/lisp/cedet/semantic/idle.el
+++ b/lisp/cedet/semantic/idle.el
@@ -1,6 +1,6 @@
 ;;; idle.el --- Schedule parsing tasks in idle time
 
-;; Copyright (C) 2003-2006, 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2006, 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/imenu.el b/lisp/cedet/semantic/imenu.el
index 62bcfac..0fb9eca 100644
--- a/lisp/cedet/semantic/imenu.el
+++ b/lisp/cedet/semantic/imenu.el
@@ -1,6 +1,6 @@
 ;;; semantic/imenu.el --- Use Semantic as an imenu tag generator
 
-;; Copyright (C) 2000-2005, 2007-2008, 2010-2018 Free Software
+;; Copyright (C) 2000-2005, 2007-2008, 2010-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/lisp/cedet/semantic/java.el b/lisp/cedet/semantic/java.el
index ae43953..54cce96 100644
--- a/lisp/cedet/semantic/java.el
+++ b/lisp/cedet/semantic/java.el
@@ -1,6 +1,6 @@
 ;;; semantic/java.el --- Semantic functions for Java
 
-;;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <address@hidden>
 
diff --git a/lisp/cedet/semantic/lex-spp.el b/lisp/cedet/semantic/lex-spp.el
index b7cacbc..d491e33 100644
--- a/lisp/cedet/semantic/lex-spp.el
+++ b/lisp/cedet/semantic/lex-spp.el
@@ -1,6 +1,6 @@
 ;;; semantic/lex-spp.el --- Semantic Lexical Pre-processor
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/lex.el b/lisp/cedet/semantic/lex.el
index 0cc296f..2690122 100644
--- a/lisp/cedet/semantic/lex.el
+++ b/lisp/cedet/semantic/lex.el
@@ -1,6 +1,6 @@
 ;;; semantic/lex.el --- Lexical Analyzer builder  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/mru-bookmark.el 
b/lisp/cedet/semantic/mru-bookmark.el
index 5789881..2f38d35 100644
--- a/lisp/cedet/semantic/mru-bookmark.el
+++ b/lisp/cedet/semantic/mru-bookmark.el
@@ -1,6 +1,6 @@
 ;;; semantic/mru-bookmark.el --- Automatic bookmark tracking
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/sb.el b/lisp/cedet/semantic/sb.el
index 443c383..83d11e1 100644
--- a/lisp/cedet/semantic/sb.el
+++ b/lisp/cedet/semantic/sb.el
@@ -1,6 +1,6 @@
 ;;; semantic/sb.el --- Semantic tag display for speedbar
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: syntax
@@ -279,7 +279,7 @@ Optional MODIFIERS is additional text needed for variables."
 (defun semantic-sb-show-extra (text token indent)
   "Display additional information about the token as an expansion.
 TEXT TOKEN and INDENT are the details."
-  (cond ((string-match "+" text)       ;we have to expand this file
+  (cond ((string-match "\\+" text)     ;we have to expand this file
         (speedbar-change-expand-button-char ?-)
         (speedbar-with-writable
           (save-excursion
@@ -325,7 +325,7 @@ TEXT TOKEN and INDENT are the details."
 (defun semantic-sb-expand-group (text token indent)
   "Expand a group which has semantic tokens.
 TEXT TOKEN and INDENT are the details."
-  (cond ((string-match "+" text)       ;we have to expand this file
+  (cond ((string-match "\\+" text)     ;we have to expand this file
         (speedbar-change-expand-button-char ?-)
         (speedbar-with-writable
           (save-excursion
diff --git a/lisp/cedet/semantic/scope.el b/lisp/cedet/semantic/scope.el
index 0f171e2..e0851d3 100644
--- a/lisp/cedet/semantic/scope.el
+++ b/lisp/cedet/semantic/scope.el
@@ -1,6 +1,6 @@
 ;;; semantic/scope.el --- Analyzer Scope Calculations
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/senator.el b/lisp/cedet/semantic/senator.el
index c217b00..2462662 100644
--- a/lisp/cedet/semantic/senator.el
+++ b/lisp/cedet/semantic/senator.el
@@ -1,6 +1,6 @@
 ;;; semantic/senator.el --- SEmantic NAvigaTOR
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/cedet/semantic/sort.el b/lisp/cedet/semantic/sort.el
index 5d6a938..02a4e58 100644
--- a/lisp/cedet/semantic/sort.el
+++ b/lisp/cedet/semantic/sort.el
@@ -1,6 +1,6 @@
 ;;; semantic/sort.el --- Utilities for sorting and re-arranging tag tables.
 
-;;; Copyright (C) 1999-2005, 2007-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 1999-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/symref.el b/lisp/cedet/semantic/symref.el
index c697e54..b005199 100644
--- a/lisp/cedet/semantic/symref.el
+++ b/lisp/cedet/semantic/symref.el
@@ -1,6 +1,6 @@
 ;;; semantic/symref.el --- Symbol Reference API
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/symref/cscope.el 
b/lisp/cedet/semantic/symref/cscope.el
index d02ca53..53e62a4 100644
--- a/lisp/cedet/semantic/symref/cscope.el
+++ b/lisp/cedet/semantic/symref/cscope.el
@@ -1,6 +1,6 @@
 ;;; semantic/symref/cscope.el --- Semantic-symref support via cscope.
 
-;;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/symref/filter.el 
b/lisp/cedet/semantic/symref/filter.el
index 726ef59..5d16669 100644
--- a/lisp/cedet/semantic/symref/filter.el
+++ b/lisp/cedet/semantic/symref/filter.el
@@ -1,6 +1,6 @@
 ;;; semantic/symref/filter.el --- Filter symbol reference hits for accuracy.
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/symref/global.el 
b/lisp/cedet/semantic/symref/global.el
index b749150..9bc24fb 100644
--- a/lisp/cedet/semantic/symref/global.el
+++ b/lisp/cedet/semantic/symref/global.el
@@ -1,6 +1,6 @@
 ;;; semantic/symref/global.el --- Use GNU Global for symbol references
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/symref/grep.el 
b/lisp/cedet/semantic/symref/grep.el
index 661e101..caac757 100644
--- a/lisp/cedet/semantic/symref/grep.el
+++ b/lisp/cedet/semantic/symref/grep.el
@@ -1,6 +1,6 @@
 ;;; semantic/symref/grep.el --- Symref implementation using find/grep
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/symref/idutils.el 
b/lisp/cedet/semantic/symref/idutils.el
index 3ffab31..58cf12a 100644
--- a/lisp/cedet/semantic/symref/idutils.el
+++ b/lisp/cedet/semantic/symref/idutils.el
@@ -1,6 +1,6 @@
 ;;; semantic/symref/idutils.el --- Symref implementation for idutils
 
-;;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/symref/list.el 
b/lisp/cedet/semantic/symref/list.el
index ab22d0d..50aa5c5 100644
--- a/lisp/cedet/semantic/symref/list.el
+++ b/lisp/cedet/semantic/symref/list.el
@@ -1,6 +1,6 @@
 ;;; semantic/symref/list.el --- Symref Output List UI.
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/tag-file.el b/lisp/cedet/semantic/tag-file.el
index ca67efd..21bc8c8 100644
--- a/lisp/cedet/semantic/tag-file.el
+++ b/lisp/cedet/semantic/tag-file.el
@@ -1,6 +1,6 @@
 ;;; semantic/tag-file.el --- Routines that find files based on tags.
 
-;; Copyright (C) 1999-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/tag-ls.el b/lisp/cedet/semantic/tag-ls.el
index 39a4d95..e4627d6 100644
--- a/lisp/cedet/semantic/tag-ls.el
+++ b/lisp/cedet/semantic/tag-ls.el
@@ -1,6 +1,6 @@
 ;;; semantic/tag-ls.el --- Language Specific override functions for tags
 
-;; Copyright (C) 1999-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/tag-write.el b/lisp/cedet/semantic/tag-write.el
index 2127be8..bb79775 100644
--- a/lisp/cedet/semantic/tag-write.el
+++ b/lisp/cedet/semantic/tag-write.el
@@ -1,6 +1,6 @@
 ;;; semantic/tag-write.el --- Write tags to a text stream
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/tag.el b/lisp/cedet/semantic/tag.el
index 0e27546..1011d1c 100644
--- a/lisp/cedet/semantic/tag.el
+++ b/lisp/cedet/semantic/tag.el
@@ -1,6 +1,6 @@
 ;;; semantic/tag.el --- tag creation and access
 
-;; Copyright (C) 1999-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/texi.el b/lisp/cedet/semantic/texi.el
index 1fdfd10..f079bf2 100644
--- a/lisp/cedet/semantic/texi.el
+++ b/lisp/cedet/semantic/texi.el
@@ -1,6 +1,6 @@
 ;;; semantic/texi.el --- Semantic details for Texinfo files
 
-;; Copyright (C) 2001-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/semantic/util-modes.el 
b/lisp/cedet/semantic/util-modes.el
index 180aca5..69df671 100644
--- a/lisp/cedet/semantic/util-modes.el
+++ b/lisp/cedet/semantic/util-modes.el
@@ -1,6 +1,6 @@
 ;;; semantic/util-modes.el --- Semantic minor modes
 
-;; Copyright (C) 2000-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Authors: Eric M. Ludlam <address@hidden>
 ;;          David Ponce <address@hidden>
diff --git a/lisp/cedet/semantic/util.el b/lisp/cedet/semantic/util.el
index 0a02b89..943f9c7 100644
--- a/lisp/cedet/semantic/util.el
+++ b/lisp/cedet/semantic/util.el
@@ -1,6 +1,6 @@
 ;;; semantic/util.el --- Utilities for use with semantic tag tables
 
-;;; Copyright (C) 1999-2005, 2007-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 1999-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/wisent.el b/lisp/cedet/semantic/wisent.el
index bfbcb6a..6bb7710 100644
--- a/lisp/cedet/semantic/wisent.el
+++ b/lisp/cedet/semantic/wisent.el
@@ -1,6 +1,6 @@
 ;;; semantic/wisent.el --- Wisent - Semantic gateway
 
-;; Copyright (C) 2001-2007, 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2007, 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <address@hidden>
 ;; Maintainer: David Ponce <address@hidden>
diff --git a/lisp/cedet/semantic/wisent/comp.el 
b/lisp/cedet/semantic/wisent/comp.el
index 21ea7ed..db910b1 100644
--- a/lisp/cedet/semantic/wisent/comp.el
+++ b/lisp/cedet/semantic/wisent/comp.el
@@ -1,6 +1,6 @@
 ;;; semantic/wisent/comp.el --- GNU Bison for Emacs - Grammar compiler
 
-;; Copyright (C) 1984, 1986, 1989, 1992, 1995, 2000-2007, 2009-2018 Free
+;; Copyright (C) 1984, 1986, 1989, 1992, 1995, 2000-2007, 2009-2019 Free
 ;; Software Foundation, Inc.
 
 ;; Author: David Ponce <address@hidden>
@@ -196,11 +196,11 @@ If optional LEFT is non-nil insert spaces on left."
 (defmacro wisent-log-buffer ()
   "Return the log buffer.
 Its name is defined in constant `wisent-log-buffer-name'."
-  `(get-buffer-create wisent-log-buffer-name))
+  '(get-buffer-create wisent-log-buffer-name))
 
 (defmacro wisent-clear-log ()
   "Delete the entire contents of the log buffer."
-  `(with-current-buffer (wisent-log-buffer)
+  '(with-current-buffer (wisent-log-buffer)
      (erase-buffer)))
 
 (defvar byte-compile-current-file)
diff --git a/lisp/cedet/semantic/wisent/grammar.el 
b/lisp/cedet/semantic/wisent/grammar.el
index d55b38a..7d77671 100644
--- a/lisp/cedet/semantic/wisent/grammar.el
+++ b/lisp/cedet/semantic/wisent/grammar.el
@@ -1,6 +1,6 @@
 ;;; semantic/wisent/grammar.el --- Wisent's input grammar mode
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: David Ponce <address@hidden>
 ;; Maintainer: David Ponce <address@hidden>
@@ -194,7 +194,7 @@ See also the function `wisent-skip-block'."
   "Expand call to SKIP-TOKEN grammar macro.
 Return the form to skip the lookahead token.
 See also the function `wisent-skip-token'."
-  `(wisent-skip-token))
+  '(wisent-skip-token))
 
 (defun wisent-grammar-assocs ()
   "Return associativity and precedence level definitions."
diff --git a/lisp/cedet/semantic/wisent/java-tags.el 
b/lisp/cedet/semantic/wisent/java-tags.el
index 7cd739a..4bf7a8e 100644
--- a/lisp/cedet/semantic/wisent/java-tags.el
+++ b/lisp/cedet/semantic/wisent/java-tags.el
@@ -1,6 +1,6 @@
 ;;; semantic/wisent/java-tags.el --- Java LALR parser for Emacs
 
-;; Copyright (C) 2001-2006, 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2006, 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <address@hidden>
 ;; Maintainer: David Ponce <address@hidden>
diff --git a/lisp/cedet/semantic/wisent/javascript.el 
b/lisp/cedet/semantic/wisent/javascript.el
index 518689a..05040b3 100644
--- a/lisp/cedet/semantic/wisent/javascript.el
+++ b/lisp/cedet/semantic/wisent/javascript.el
@@ -1,6 +1,6 @@
 ;;; semantic/wisent/javascript.el --- javascript parser support
 
-;; Copyright (C) 2005, 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Ludlam <address@hidden>
 ;; Keywords: syntax
diff --git a/lisp/cedet/semantic/wisent/python.el 
b/lisp/cedet/semantic/wisent/python.el
index f7944fe..c530329 100644
--- a/lisp/cedet/semantic/wisent/python.el
+++ b/lisp/cedet/semantic/wisent/python.el
@@ -1,6 +1,6 @@
 ;;; wisent-python.el --- Semantic support for Python
 
-;; Copyright (C) 2002, 2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Richard Kim  <address@hidden>
 ;; Maintainer: Richard Kim  <address@hidden>
diff --git a/lisp/cedet/semantic/wisent/wisent.el 
b/lisp/cedet/semantic/wisent/wisent.el
index 310799d..2108242 100644
--- a/lisp/cedet/semantic/wisent/wisent.el
+++ b/lisp/cedet/semantic/wisent/wisent.el
@@ -1,6 +1,6 @@
 ;;; semantic/wisent/wisent.el --- GNU Bison for Emacs - Runtime
 
-;;; Copyright (C) 2002-2007, 2009-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2002-2007, 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <address@hidden>
 ;; Maintainer: David Ponce <address@hidden>
diff --git a/lisp/cedet/srecode.el b/lisp/cedet/srecode.el
index e27fa1d..ce263fc 100644
--- a/lisp/cedet/srecode.el
+++ b/lisp/cedet/srecode.el
@@ -1,6 +1,6 @@
 ;;; srecode.el --- Semantic buffer evaluator.
 
-;;; Copyright (C) 2005, 2007-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: codegeneration
diff --git a/lisp/cedet/srecode/args.el b/lisp/cedet/srecode/args.el
index 7195b78..e8a1a2c 100644
--- a/lisp/cedet/srecode/args.el
+++ b/lisp/cedet/srecode/args.el
@@ -1,6 +1,6 @@
 ;;; srecode/args.el --- Provide some simple template arguments
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/compile.el b/lisp/cedet/srecode/compile.el
index a0a53a6..204211b 100644
--- a/lisp/cedet/srecode/compile.el
+++ b/lisp/cedet/srecode/compile.el
@@ -1,6 +1,6 @@
 ;;; srecode/compile --- Compilation of srecode template files.
 
-;; Copyright (C) 2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: codegeneration
diff --git a/lisp/cedet/srecode/cpp.el b/lisp/cedet/srecode/cpp.el
index 1413914..e6a5599 100644
--- a/lisp/cedet/srecode/cpp.el
+++ b/lisp/cedet/srecode/cpp.el
@@ -1,6 +1,6 @@
 ;;; srecode/cpp.el --- C++ specific handlers for Semantic Recoder
 
-;; Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;;         Jan Moringen <address@hidden>
diff --git a/lisp/cedet/srecode/ctxt.el b/lisp/cedet/srecode/ctxt.el
index 9afbac9..66f6779 100644
--- a/lisp/cedet/srecode/ctxt.el
+++ b/lisp/cedet/srecode/ctxt.el
@@ -1,6 +1,6 @@
 ;;; srecode/ctxt.el --- Derive a context from the source buffer.
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/dictionary.el b/lisp/cedet/srecode/dictionary.el
index a2410be..a13c42d 100644
--- a/lisp/cedet/srecode/dictionary.el
+++ b/lisp/cedet/srecode/dictionary.el
@@ -1,6 +1,6 @@
 ;;; srecode/dictionary.el --- Dictionary code for the semantic recoder.
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/document.el b/lisp/cedet/srecode/document.el
index cf43337..06fc262 100644
--- a/lisp/cedet/srecode/document.el
+++ b/lisp/cedet/srecode/document.el
@@ -1,6 +1,6 @@
 ;;; srecode/document.el --- Documentation (comment) generation
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/el.el b/lisp/cedet/srecode/el.el
index ff9e1d5..348c812 100644
--- a/lisp/cedet/srecode/el.el
+++ b/lisp/cedet/srecode/el.el
@@ -1,6 +1,6 @@
 ;;; srecode/el.el --- Emacs Lisp specific arguments
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/expandproto.el 
b/lisp/cedet/srecode/expandproto.el
index ae63aff..7b5de0d 100644
--- a/lisp/cedet/srecode/expandproto.el
+++ b/lisp/cedet/srecode/expandproto.el
@@ -1,6 +1,6 @@
 ;;; srecode/expandproto.el --- Expanding prototypes.
 
-;; Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/extract.el b/lisp/cedet/srecode/extract.el
index 276f2ac..f493251 100644
--- a/lisp/cedet/srecode/extract.el
+++ b/lisp/cedet/srecode/extract.el
@@ -1,6 +1,6 @@
 ;;; srecode/extract.el --- Extract content from previously inserted macro.
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/fields.el b/lisp/cedet/srecode/fields.el
index d184469..95caeb3 100644
--- a/lisp/cedet/srecode/fields.el
+++ b/lisp/cedet/srecode/fields.el
@@ -1,6 +1,6 @@
 ;;; srecode/fields.el --- Handling type-in fields in a buffer.
 ;;
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/filters.el b/lisp/cedet/srecode/filters.el
index 2138212..b9b037f 100644
--- a/lisp/cedet/srecode/filters.el
+++ b/lisp/cedet/srecode/filters.el
@@ -1,6 +1,6 @@
 ;;; srecode/filters.el --- Filters for use in template variables.
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/find.el b/lisp/cedet/srecode/find.el
index 1929ef3..6859226 100644
--- a/lisp/cedet/srecode/find.el
+++ b/lisp/cedet/srecode/find.el
@@ -1,6 +1,6 @@
 ;;;; srecode/find.el --- Tools for finding templates in the database.
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/getset.el b/lisp/cedet/srecode/getset.el
index 870acd6..cef4b94 100644
--- a/lisp/cedet/srecode/getset.el
+++ b/lisp/cedet/srecode/getset.el
@@ -1,6 +1,6 @@
 ;;; srecode/getset.el --- Package for inserting new get/set methods.
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/insert.el b/lisp/cedet/srecode/insert.el
index 13dc8ee..26af2ff 100644
--- a/lisp/cedet/srecode/insert.el
+++ b/lisp/cedet/srecode/insert.el
@@ -1,6 +1,6 @@
 ;;; srecode/insert.el --- Insert srecode templates to an output stream.
 
-;; Copyright (C) 2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/java.el b/lisp/cedet/srecode/java.el
index 7021267..85df930 100644
--- a/lisp/cedet/srecode/java.el
+++ b/lisp/cedet/srecode/java.el
@@ -1,6 +1,6 @@
 ;;; srecode/java.el --- Srecode Java support
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/map.el b/lisp/cedet/srecode/map.el
index 1d419c9..fa5d27b 100644
--- a/lisp/cedet/srecode/map.el
+++ b/lisp/cedet/srecode/map.el
@@ -1,6 +1,6 @@
 ;;; srecode/map.el --- Manage a template file map
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/mode.el b/lisp/cedet/srecode/mode.el
index 28e8b3b..bf1f64e 100644
--- a/lisp/cedet/srecode/mode.el
+++ b/lisp/cedet/srecode/mode.el
@@ -1,6 +1,6 @@
 ;;; srecode/mode.el --- Minor mode for managing and using SRecode templates
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
@@ -89,14 +89,14 @@
      ])
    "---"
    '( "Insert ..." :filter srecode-minor-mode-templates-menu )
-   `( "Generate ..." :filter srecode-minor-mode-generate-menu )
+   '( "Generate ..." :filter srecode-minor-mode-generate-menu )
    "---"
-    (semantic-menu-item
-     ["Customize..."
-      (customize-group "srecode")
-      :active t
-      :help "Customize SRecode options"
-      ])
+   (semantic-menu-item
+    ["Customize..."
+     (customize-group "srecode")
+     :active t
+     :help "Customize SRecode options"
+     ])
    (list
     "Debugging Tools..."
     (semantic-menu-item
diff --git a/lisp/cedet/srecode/semantic.el b/lisp/cedet/srecode/semantic.el
index 122fd88..93dcaff 100644
--- a/lisp/cedet/srecode/semantic.el
+++ b/lisp/cedet/srecode/semantic.el
@@ -1,6 +1,6 @@
 ;;; srecode/semantic.el --- Semantic specific extensions to SRecode.
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/srt-mode.el b/lisp/cedet/srecode/srt-mode.el
index 6c269e0..2ad7ffc 100644
--- a/lisp/cedet/srecode/srt-mode.el
+++ b/lisp/cedet/srecode/srt-mode.el
@@ -1,6 +1,6 @@
 ;;; srecode/srt-mode.el --- Major mode for writing screcode macros
 
-;; Copyright (C) 2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/cedet/srecode/srt.el b/lisp/cedet/srecode/srt.el
index fdabdc4..e6d2bb7 100644
--- a/lisp/cedet/srecode/srt.el
+++ b/lisp/cedet/srecode/srt.el
@@ -1,6 +1,6 @@
 ;;; srecode/srt.el --- argument handlers for SRT files
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/table.el b/lisp/cedet/srecode/table.el
index af2e8b1..3b271f0 100644
--- a/lisp/cedet/srecode/table.el
+++ b/lisp/cedet/srecode/table.el
@@ -1,6 +1,6 @@
 ;;; srecode/table.el --- Tables of Semantic Recoders
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/cedet/srecode/template.el b/lisp/cedet/srecode/template.el
index add2f09..8528a37 100644
--- a/lisp/cedet/srecode/template.el
+++ b/lisp/cedet/srecode/template.el
@@ -1,6 +1,6 @@
 ;;; srecode/template.el --- SRecoder template language parser support.
 
-;; Copyright (C) 2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/cedet/srecode/texi.el b/lisp/cedet/srecode/texi.el
index ec73b7b..223cf28 100644
--- a/lisp/cedet/srecode/texi.el
+++ b/lisp/cedet/srecode/texi.el
@@ -1,6 +1,6 @@
 ;;; srecode/texi.el --- Srecode texinfo support.
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/lisp/char-fold.el b/lisp/char-fold.el
index 907d49e..e61bc3e 100644
--- a/lisp/char-fold.el
+++ b/lisp/char-fold.el
@@ -1,6 +1,6 @@
 ;;; char-fold.el --- match unicode to similar ASCII -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: matching
diff --git a/lisp/chistory.el b/lisp/chistory.el
index b4a8b6e..59bdc00 100644
--- a/lisp/chistory.el
+++ b/lisp/chistory.el
@@ -1,6 +1,6 @@
 ;;; chistory.el --- list command history
 
-;; Copyright (C) 1985, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
 ;; Maintainer: address@hidden
diff --git a/lisp/cmuscheme.el b/lisp/cmuscheme.el
index 93856aa..ed6f1bf 100644
--- a/lisp/cmuscheme.el
+++ b/lisp/cmuscheme.el
@@ -1,6 +1,6 @@
 ;;; cmuscheme.el --- Scheme process in a buffer. Adapted from tea.el
 
-;; Copyright (C) 1988, 1994, 1997, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1988, 1994, 1997, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Olin Shivers <address@hidden>
diff --git a/lisp/color.el b/lisp/color.el
index 9981354..e401456 100644
--- a/lisp/color.el
+++ b/lisp/color.el
@@ -1,6 +1,6 @@
 ;;; color.el --- Color manipulation library -*- lexical-binding:t -*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Authors: Julien Danjou <address@hidden>
 ;;          Drew Adams <address@hidden>
diff --git a/lisp/comint.el b/lisp/comint.el
index 5928804..d21cc13 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1,6 +1,6 @@
 ;;; comint.el --- general command interpreter in a window stuff -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1988, 1990, 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1990, 1992-2019 Free Software Foundation, Inc.
 
 ;; Author: Olin Shivers <address@hidden>
 ;;     Simon Marshall <address@hidden>
@@ -1618,8 +1618,8 @@ Go to the history element by the absolute history 
position HIST-POS."
 (defun comint-within-quotes (beg end)
   "Return t if the number of quotes between BEG and END is odd.
 Quotes are single and double."
-  (let ((countsq (comint-how-many-region "\\(^\\|[^\\\\]\\)'" beg end))
-       (countdq (comint-how-many-region "\\(^\\|[^\\\\]\\)\"" beg end)))
+  (let ((countsq (comint-how-many-region "\\(^\\|[^\\]\\)'" beg end))
+       (countdq (comint-how-many-region "\\(^\\|[^\\]\\)\"" beg end)))
     (or (= (mod countsq 2) 1) (= (mod countdq 2) 1))))
 
 (defun comint-how-many-region (regexp beg end)
@@ -2072,20 +2072,6 @@ Make backspaces delete the previous character."
            (goto-char (process-mark process))
            (set-marker comint-last-output-start (point))
 
-            ;; Try to skip repeated prompts, which can occur as a result of
-            ;; commands sent without inserting them in the buffer.
-            (let ((bol (save-excursion (forward-line 0) (point)))) ;No fields.
-              (when (and (not (bolp))
-                         (looking-back comint-prompt-regexp bol))
-                (let* ((prompt (buffer-substring bol (point)))
-                       (prompt-re (concat "\\`" (regexp-quote prompt))))
-                  (while (string-match prompt-re string)
-                    (setq string (substring string (match-end 0)))))))
-            (while (string-match (concat "\\(^" comint-prompt-regexp
-                                         "\\)\\1+")
-                                 string)
-              (setq string (replace-match "\\1" nil nil string)))
-
            ;; insert-before-markers is a bad thing. XXX
            ;; Luckily we don't have to use it any more, we use
            ;; window-point-insertion-type instead.
@@ -2536,13 +2522,16 @@ Useful if you accidentally suspend the top-level 
process."
 
 (defun comint-skip-input ()
   "Skip all pending input, from last stuff output by interpreter to point.
-This means mark it as if it had been sent as input, without sending it."
+This means mark it as if it had been sent as input, without
+sending it.  The command keys used to trigger the command that
+called this function are inserted into the buffer."
   (let ((comint-input-sender 'ignore)
        (comint-input-filter-functions nil))
     (comint-send-input t t))
   (end-of-line)
   (let ((pos (point))
-       (marker (process-mark (get-buffer-process (current-buffer)))))
+       (marker (process-mark (get-buffer-process (current-buffer))))
+        (inhibit-read-only t))
     (insert "  " (key-description (this-command-keys)))
     (if (= marker pos)
        (set-marker marker (point)))))
@@ -3089,7 +3078,7 @@ interpreter (e.g., the percent notation of cmd.exe on 
Windows)."
        (let (env-var-name
              env-var-val)
          (save-match-data
-           (while (string-match "%\\([^\\\\/]*\\)%" name)
+           (while (string-match "%\\([^\\/]*\\)%" name)
              (setq env-var-name (match-string 1 name))
              (setq env-var-val (or (getenv env-var-name) ""))
              (setq name (replace-match env-var-val t t name))))))
diff --git a/lisp/completion.el b/lisp/completion.el
index 66b413f..89285c7 100644
--- a/lisp/completion.el
+++ b/lisp/completion.el
@@ -1,6 +1,6 @@
 ;;; completion.el --- dynamic word-completion code
 
-;; Copyright (C) 1990, 1993, 1995, 1997, 2001-2018 Free Software
+;; Copyright (C) 1990, 1993, 1995, 1997, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -409,10 +409,7 @@ Used to decide whether to save completions.")
 (defun cmpl-coerce-string-case (string case-type)
   (cond ((eq case-type :down) (downcase string))
        ((eq case-type :up) (upcase string))
-       ((eq case-type :capitalized)
-        (setq string (downcase string))
-        (aset string 0 (logand ?\337 (aref string 0)))
-        string)
+       ((eq case-type :capitalized) (capitalize string))
        (t string)))
 
 (defun cmpl-merge-string-cases (string-to-coerce given-string)
@@ -435,7 +432,7 @@ Used to decide whether to save completions.")
 
 
 (defun cmpl-hours-since-origin ()
-  (floor (float-time) 3600))
+  (floor (encode-time nil 'integer) 3600))
 
 ;;---------------------------------------------------------------------------
 ;; "Symbol" parsing functions
diff --git a/lisp/composite.el b/lisp/composite.el
index 3d4805e..d2df3d1 100644
--- a/lisp/composite.el
+++ b/lisp/composite.el
@@ -1,6 +1,6 @@
 ;;; composite.el --- support character composition
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
 ;;   2008, 2009, 2010, 2011
diff --git a/lisp/cus-dep.el b/lisp/cus-dep.el
index 258b62e..e26837b 100644
--- a/lisp/cus-dep.el
+++ b/lisp/cus-dep.el
@@ -1,6 +1,6 @@
 ;;; cus-dep.el --- find customization dependencies
 ;;
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <address@hidden>
 ;; Keywords: internal
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index b69a63b..f87b6b6 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1,6 +1,6 @@
 ;;; cus-edit.el --- tools for customizing Emacs and Lisp packages -*- 
lexical-binding:t -*-
 ;;
-;; Copyright (C) 1996-1997, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 1999-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <address@hidden>
 ;; Maintainer: address@hidden
@@ -2444,7 +2444,7 @@ If INITIAL-STRING is non-nil, use that rather than 
\"Parent groups:\"."
   :group 'custom-faces)
 
 (defface custom-variable-tag
-  `((((class color) (background dark))
+  '((((class color) (background dark))
      :foreground "light blue" :weight bold)
     (((min-colors 88) (class color) (background light))
      :foreground "blue1" :weight bold)
@@ -3920,7 +3920,7 @@ restoring it to the state of a face that has never been 
customized."
 (defun custom-hook-convert-widget (widget)
   ;; Handle `:options'.
   (let* ((options (widget-get widget :options))
-        (other `(editable-list :inline t
+        (other '(editable-list :inline t
                                :entry-format "%i %d%v"
                                (function :format " %v")))
         (args (if options
diff --git a/lisp/cus-face.el b/lisp/cus-face.el
index 54f5d51..0ee6a8d 100644
--- a/lisp/cus-face.el
+++ b/lisp/cus-face.el
@@ -1,6 +1,6 @@
 ;;; cus-face.el --- customization support for faces
 ;;
-;; Copyright (C) 1996-1997, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 1999-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <address@hidden>
 ;; Keywords: help, faces
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index 133e94f..baa05d0 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -1,6 +1,6 @@
 ;;; cus-start.el --- define customization properties of builtins  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1997, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <address@hidden>
 ;; Keywords: internal
@@ -314,7 +314,13 @@ Leaving \"Default\" unchecked is equivalent with 
specifying a default of
                                            (other :tag "hidden by keypress" 1))
                              "22.1")
             (make-pointer-invisible mouse boolean "23.2")
-            (menu-bar-mode frames boolean nil
+             (resize-mini-frames
+              frames (choice
+                      (const :tag "Never" nil)
+                      (const :tag "Fit frame to buffer" t)
+                      (function :tag "User-defined function"))
+               "27.1")
+             (menu-bar-mode frames boolean nil
                            ;; FIXME?
                             ;; :initialize custom-initialize-default
                            :set custom-set-minor-mode)
@@ -730,7 +736,7 @@ since it could result in memory overflow and make Emacs 
crash."
       ;; If this is NOT while dumping Emacs, set up the rest of the
       ;; customization info.  This is the stuff that is not needed
       ;; until someone does M-x customize etc.
-      (unless purify-flag
+      (unless dump-mode
        ;; Add it to the right group(s).
        (if (listp group)
            (dolist (g group)
@@ -752,7 +758,7 @@ since it could result in memory overflow and make Emacs 
crash."
 ;; Record cus-start as loaded if we have set up all the info that we can.
 ;; Don't record it as loaded if we have only set up the standard values
 ;; and safe/risky properties.
-(unless purify-flag
+(unless dump-mode
   (provide 'cus-start))
 
 ;;; cus-start.el ends here
diff --git a/lisp/cus-theme.el b/lisp/cus-theme.el
index 995c55b..bc9d1d4 100644
--- a/lisp/cus-theme.el
+++ b/lisp/cus-theme.el
@@ -1,6 +1,6 @@
 ;;; cus-theme.el -- custom theme creation user interface  -*- lexical-binding: 
t -*-
 ;;
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Alex Schroeder <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/custom.el b/lisp/custom.el
index a08f7fd..53b8045 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -1,6 +1,6 @@
 ;;; custom.el --- tools for declaring and initializing options  -*- 
lexical-binding: t -*-
 ;;
-;; Copyright (C) 1996-1997, 1999, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1996-1997, 1999, 2001-2019 Free Software Foundation,
 ;; Inc.
 ;;
 ;; Author: Per Abrahamsen <address@hidden>
diff --git a/lisp/dabbrev.el b/lisp/dabbrev.el
index 913b23d..2159f96 100644
--- a/lisp/dabbrev.el
+++ b/lisp/dabbrev.el
@@ -1,6 +1,6 @@
 ;;; dabbrev.el --- dynamic abbreviation package  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1992, 1994, 1996-1997, 2000-2018 Free
+;; Copyright (C) 1985-1986, 1992, 1994, 1996-1997, 2000-2019 Free
 ;; Software Foundation, Inc.
 
 ;; Author: Don Morrison
diff --git a/lisp/delim-col.el b/lisp/delim-col.el
index 076d4dc..a968b32 100644
--- a/lisp/delim-col.el
+++ b/lisp/delim-col.el
@@ -1,6 +1,6 @@
 ;;; delim-col.el --- prettify all columns in a region or rectangle
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
diff --git a/lisp/delsel.el b/lisp/delsel.el
index 9582272..8f71bc6 100644
--- a/lisp/delsel.el
+++ b/lisp/delsel.el
@@ -1,6 +1,6 @@
 ;;; delsel.el --- delete selection if you insert  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992, 1997-1998, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1992, 1997-1998, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Matthieu Devin <address@hidden>
diff --git a/lisp/descr-text.el b/lisp/descr-text.el
index d8f8188..8be2b94 100644
--- a/lisp/descr-text.el
+++ b/lisp/descr-text.el
@@ -1,6 +1,6 @@
 ;;; descr-text.el --- describe text mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1994-1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <address@hidden>
 ;; Maintainer: address@hidden
@@ -386,13 +386,22 @@ The position information includes POS; the total size of 
BUFFER; the
 region limits, if narrowed; the column number; and the horizontal
 scroll amount, if the buffer is horizontally scrolled.
 
-The character information includes the character code; charset and
-code points in it; syntax; category; how the character is encoded in
-BUFFER and in BUFFER's file; character composition information (if
-relevant); the font and font glyphs used to display the character;
-the character's canonical name and other properties defined by the
-Unicode Data Base; and widgets, buttons, overlays, and text properties
-relevant to POS."
+The character information includes:
+ its codepoint;
+ its charset (see `char-charset'), overridden by the `charset' text
+   property at POS, if any;
+ the codepoint of the character in the above charset;
+ the character's script (as defined by `char-script-table')
+ the character's syntax, as produced by `syntax-after'
+   and `internal-describe-syntax-value';
+ its category (see `char-category-set' and `describe-char-categories');
+ how to input the character using the keyboard and input methods;
+ how the character is encoded in BUFFER and in BUFFER's file;
+ the font and font glyphs used to display the character;
+ the composition information for displaying the character (if relevant);
+ the character's canonical name and other properties defined by the
+   Unicode Data Base;
+ and widgets, buttons, overlays, and text properties relevant to POS."
   (interactive "d")
   (unless (buffer-live-p buffer) (setq buffer (current-buffer)))
   (let ((src-buf (current-buffer)))
@@ -556,7 +565,7 @@ relevant to POS."
                         (apply 'propertize char-description
                                (text-properties-at pos))
                         char char char))
-              ("preferred charset"
+              ("charset"
                ,`(insert-text-button
                   ,(symbol-name charset)
                   'type 'help-character-set 'help-args '(,charset))
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 1346fa3..acabde5 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -1,6 +1,6 @@
 ;;; desktop.el --- save partial status of Emacs when killed -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993-1995, 1997, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1993-1995, 1997, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Morten Welinder <address@hidden>
@@ -1544,10 +1544,10 @@ and try to load that."
           ;; for the sake of `clean-buffer-list': preserving the invariant
           ;; "how much time the user spent in Emacs without looking at this 
buffer".
           (setq buffer-display-time
-                (if buffer-display-time
-                    (time-add buffer-display-time
-                              (time-subtract nil desktop-file-modtime))
-                  (current-time)))
+               (time-since (if buffer-display-time
+                               (time-subtract desktop-file-modtime
+                                              buffer-display-time)
+                             0)))
          (unless (< desktop-file-version 208) ; Don't misinterpret any old 
custom args
            (dolist (record compacted-vars)
              (let*
diff --git a/lisp/dframe.el b/lisp/dframe.el
index 12cedaf..eebc0bf 100644
--- a/lisp/dframe.el
+++ b/lisp/dframe.el
@@ -1,6 +1,6 @@
 ;;; dframe --- dedicate frame support modes  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: file, tags, tools
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index 72c16da..b81c0d1 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -1,6 +1,6 @@
 ;;; dired-aux.el --- less commonly used parts of dired -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1985-1986, 1992, 1994, 1998, 2000-2018 Free Software
+;; Copyright (C) 1985-1986, 1992, 1994, 1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Sebastian Kremer <address@hidden>.
@@ -148,7 +148,7 @@ the string of command switches used as the third argument 
of `diff'."
          (read-string "Options for diff: "
                       (if (stringp diff-switches)
                           diff-switches
-                        (mapconcat 'identity diff-switches " ")))))))
+                        (mapconcat #'identity diff-switches " ")))))))
   (let ((current (dired-get-filename t)))
     (when (or (equal (expand-file-name file)
                     (expand-file-name current))
@@ -173,7 +173,7 @@ With prefix arg, prompt for argument SWITCHES which is 
options for `diff'."
        (list (read-string "Options for diff: "
                           (if (stringp diff-switches)
                               diff-switches
-                            (mapconcat 'identity diff-switches " "))))
+                            (mapconcat #'identity diff-switches " "))))
       nil))
   (diff-backup (dired-get-filename) switches))
 
@@ -227,12 +227,12 @@ Examples of PREDICATE:
     (setq file-alist2 (delq (assoc "." file-alist2) file-alist2))
     (setq file-alist2 (delq (assoc ".." file-alist2) file-alist2))
     (setq file-list1 (mapcar
-                     'cadr
+                     #'cadr
                       (dired-file-set-difference
                        file-alist1 file-alist2
                       predicate))
          file-list2 (mapcar
-                     'cadr
+                     #'cadr
                       (dired-file-set-difference
                        file-alist2 file-alist1
                       predicate)))
@@ -491,7 +491,7 @@ Uses the shell command coming from variables `lpr-command' 
and
            lpr-switches))
         (command (dired-mark-read-string
                   "Print %s with: "
-                  (mapconcat 'identity
+                   (mapconcat #'identity
                              (cons lpr-command
                                    (if (stringp lpr-switches)
                                        (list lpr-switches)
@@ -597,7 +597,7 @@ with a prefix argument."
             (possibilities (file-name-all-completions
                             base-versions
                             (file-name-directory fn)))
-            (versions (mapcar 'backup-extract-version possibilities)))
+            (versions (mapcar #'backup-extract-version possibilities)))
        (if versions
            (setq dired-file-version-alist
                  (cons (cons fn versions)
@@ -822,27 +822,28 @@ can be produced by `dired-get-marked-files', for example."
                  retval))
            (lambda (x) (concat cmd-prefix command dired-mark-separator x)))))
     (concat
-     (cond (on-each
-            (format "%s%s"
-                    (mapconcat stuff-it (mapcar 'shell-quote-argument 
file-list)
-                               cmd-sep)
-                    ;; POSIX shells running a list of commands in the 
background
-                    ;; (LIST = cmd_1 & [cmd_2 & ... cmd_i & ... cmd_N &])
-                    ;; return once cmd_N ends, i.e., the shell does not
-                    ;; wait for cmd_i to finish before executing cmd_i+1.
-                    ;; That means, running (shell-command LIST) may not show
-                    ;; the output of all the commands (Bug#23206).
-                    ;; Add 'wait' to force those POSIX shells to wait until
-                    ;; all commands finish.
-                    (or (and parallel-in-background (not w32-shell)
-                             "&wait")
-                        "")))
-           (t
-            (let ((files (mapconcat 'shell-quote-argument
-                                    file-list dired-mark-separator)))
-              (when (cdr file-list)
-                (setq files (concat dired-mark-prefix files 
dired-mark-postfix)))
-              (funcall stuff-it files))))
+     (cond
+      (on-each
+       (format "%s%s"
+               (mapconcat stuff-it (mapcar #'shell-quote-argument file-list)
+                          cmd-sep)
+               ;; POSIX shells running a list of commands in the background
+               ;; (LIST = cmd_1 & [cmd_2 & ... cmd_i & ... cmd_N &])
+               ;; return once cmd_N ends, i.e., the shell does not
+               ;; wait for cmd_i to finish before executing cmd_i+1.
+               ;; That means, running (shell-command LIST) may not show
+               ;; the output of all the commands (Bug#23206).
+               ;; Add 'wait' to force those POSIX shells to wait until
+               ;; all commands finish.
+               (or (and parallel-in-background (not w32-shell)
+                        "&wait")
+                   "")))
+      (t
+       (let ((files (mapconcat #'shell-quote-argument
+                               file-list dired-mark-separator)))
+         (when (cdr file-list)
+           (setq files (concat dired-mark-prefix files dired-mark-postfix)))
+         (funcall stuff-it files))))
      (or (and in-background "&") ""))))
 
 ;; This is an extra function so that it can be redefined by ange-ftp.
@@ -872,7 +873,7 @@ Else returns nil for success."
       (set-buffer err-buffer)
       (erase-buffer)
       (setq default-directory dir      ; caller's default-directory
-           err (not (eq 0 (apply 'process-file program nil t nil arguments))))
+           err (not (eq 0 (apply #'process-file program nil t nil arguments))))
       (if err
          (progn
            (dired-log (concat program " " (prin1-to-string arguments) "\n"))
@@ -1231,7 +1232,12 @@ return t; if SYM is q or ESC, return nil."
 
 ;;;###autoload
 (defun dired-do-compress (&optional arg)
-  "Compress or uncompress marked (or next ARG) files."
+  "Compress or uncompress marked (or next ARG) files.
+If invoked on a directory, compress all of the files in
+the directory and all of its subdirectories, recursively,
+into a .tar.gz archive.
+If invoked on a .tar.gz or a .tgz or a .zip or a .7z archive,
+uncompress and unpack all the files in the archive."
   (interactive "P")
   (dired-map-over-marks-check #'dired-compress arg 'compress t))
 
@@ -1344,7 +1350,7 @@ See Info node `(emacs)Subdir switches' for more details."
           ;; Replace space by old marker without moving point.
           ;; Faster than goto+insdel inside a save-excursion?
           (when char
-            (subst-char-in-region opoint (1+ opoint) ?\040 char)))))
+            (subst-char-in-region opoint (1+ opoint) ?\s char)))))
   (dired-move-to-filename))
 
 ;;;###autoload
@@ -1398,8 +1404,8 @@ files matching `dired-omit-regexp'."
                (catch 'not-found
                  (if (string= directory cur-dir)
                      (progn
-                       (skip-chars-forward "^\r\n")
-                       (if (eq (following-char) ?\r)
+                       (end-of-line)
+                       (if (dired--hidden-p)
                            (dired-unhide-subdir))
                        ;; We are already where we should be, except when
                        ;; point is before the subdir line or its total line.
@@ -1409,7 +1415,7 @@ files matching `dired-omit-regexp'."
                    ;; else try to find correct place to insert
                    (if (dired-goto-subdir directory)
                        (progn ;; unhide if necessary
-                         (if (= (following-char) ?\r)
+                         (if (dired--hidden-p)
                              ;; Point is at end of subdir line.
                              (dired-unhide-subdir))
                          ;; found - skip subdir and `total' line
@@ -1518,7 +1524,7 @@ files matching `dired-omit-regexp'."
                                 (point))
                          (line-beginning-position 2)))
       (setq file (directory-file-name file))
-      (dired-add-entry file (if (eq ?\040 marker) nil marker)))))
+      (dired-add-entry file (if (eq ?\s marker) nil marker)))))
 
 ;;; Copy, move/rename, making hard and symbolic links
 
@@ -2557,7 +2563,7 @@ Optional third arg LIMIT (>= 1) is a limit to the length 
of the
 resulting list.
 Thus, if SEP is a regexp that only matches itself,
 
-   (mapconcat 'identity (dired-split SEP STRING) SEP)
+   (mapconcat #'identity (dired-split SEP STRING) SEP)
 
 is always equal to STRING."
   (let* ((start (string-match pat str))
@@ -2605,7 +2611,7 @@ When called interactively and not on a subdir line, go to 
this subdir's line."
 (defun dired-goto-subdir (dir)
   "Go to end of header line of DIR in this dired buffer.
 Return value of point on success, otherwise return nil.
-The next char is either \\n, or \\r if DIR is hidden."
+The next char is \\n."
   (interactive
    (prog1                              ; let push-mark display its message
        (list (expand-file-name
@@ -2620,8 +2626,8 @@ The next char is either \\n, or \\r if DIR is hidden."
     (and elt
         (goto-char (dired-get-subdir-min elt))
         ;; dired-subdir-hidden-p and dired-add-entry depend on point being
-        ;; at either \r or \n after this function succeeds.
-        (progn (skip-chars-forward "^\r\n")
+        ;; at \n after this function succeeds.
+        (progn (end-of-line)
                (point)))))
 
 ;;;###autoload
@@ -2694,18 +2700,13 @@ Lower levels are unaffected."
 ;;; hiding
 
 (defun dired-unhide-subdir ()
-  (let (buffer-read-only)
-    (subst-char-in-region (dired-subdir-min) (dired-subdir-max) ?\r ?\n)))
-
-(defun dired-hide-check ()
-  (or selective-display
-      (error "selective-display must be t for subdir hiding to work!")))
+  (with-silent-modifications
+    (dired--unhide (dired-subdir-min) (dired-subdir-max))))
 
 (defun dired-subdir-hidden-p (dir)
-  (and selective-display
-       (save-excursion
-        (dired-goto-subdir dir)
-        (= (following-char) ?\r))))
+  (save-excursion
+    (dired-goto-subdir dir)
+    (dired--hidden-p)))
 
 ;;;###autoload
 (defun dired-hide-subdir (arg)
@@ -2713,8 +2714,7 @@ Lower levels are unaffected."
 Optional prefix arg is a repeat factor.
 Use \\[dired-hide-all] to (un)hide all directories."
   (interactive "p")
-  (dired-hide-check)
-  (let ((modflag (buffer-modified-p)))
+  (with-silent-modifications
     (while (>=  (setq arg (1- arg)) 0)
       (let* ((cur-dir (dired-current-directory))
             (hidden-p (dired-subdir-hidden-p cur-dir))
@@ -2723,12 +2723,11 @@ Use \\[dired-hide-all] to (un)hide all directories."
             buffer-read-only)
        ;; keep header line visible, hide rest
        (goto-char (dired-get-subdir-min elt))
-       (skip-chars-forward "^\n\r")
+       (end-of-line)
        (if hidden-p
-           (subst-char-in-region (point) end-pos ?\r ?\n)
-         (subst-char-in-region (point) end-pos ?\n ?\r)))
-      (dired-next-subdir 1 t))
-    (restore-buffer-modified-p modflag)))
+           (dired--unhide (point) end-pos)
+         (dired--hide (point) end-pos)))
+      (dired-next-subdir 1 t))))
 
 ;;;###autoload
 (defun dired-hide-all (&optional ignored)
@@ -2736,28 +2735,20 @@ Use \\[dired-hide-all] to (un)hide all directories."
 If there is already something hidden, make everything visible again.
 Use \\[dired-hide-subdir] to (un)hide a particular subdirectory."
   (interactive "P")
-  (dired-hide-check)
-  (let ((modflag (buffer-modified-p))
-       buffer-read-only)
-    (if (save-excursion
-         (goto-char (point-min))
-         (search-forward "\r" nil t))
-       ;; unhide - bombs on \r in filenames
-       (subst-char-in-region (point-min) (point-max) ?\r ?\n)
+  (with-silent-modifications
+    (if (text-property-any (point-min) (point-max) 'invisible 'dired)
+       (dired--unhide (point-min) (point-max))
       ;; hide
-      (let ((pos (point-max))          ; pos of end of last directory
-           (alist dired-subdir-alist))
-       (while alist                    ; while there are dirs before pos
-         (subst-char-in-region (dired-get-subdir-min (car alist)) ; pos of 
prev dir
-                               (save-excursion
-                                 (goto-char pos) ; current dir
-                                 ;; we're somewhere on current dir's line
-                                 (forward-line -1)
-                                 (point))
-                               ?\n ?\r)
-         (setq pos (dired-get-subdir-min (car alist))) ; prev dir gets current 
dir
-         (setq alist (cdr alist)))))
-    (restore-buffer-modified-p modflag)))
+      (let ((pos (point-max)))         ; pos of end of last directory
+        (dolist (subdir dired-subdir-alist)
+         (let ((start (dired-get-subdir-min subdir)) ; pos of prev dir
+               (end (save-excursion
+                      (goto-char pos) ; current dir
+                      ;; we're somewhere on current dir's line
+                      (forward-line -1)
+                      (point))))
+            (dired--hide start end))
+         (setq pos (dired-get-subdir-min subdir))))))) ; prev dir gets current 
dir
 
 ;;;###end dired-ins.el
 
@@ -2783,8 +2774,8 @@ When off, it uses the original predicate."
   nil nil nil
   (if dired-isearch-filenames-mode
       (add-function :before-while (local 'isearch-filter-predicate)
-                  #'dired-isearch-filter-filenames
-                  '((isearch-message-prefix . "filename ")))
+                    #'dired-isearch-filter-filenames
+                    '((isearch-message-prefix . "filename ")))
     (remove-function (local 'isearch-filter-predicate)
                      #'dired-isearch-filter-filenames))
   (when isearch-mode
@@ -2800,13 +2791,13 @@ Intended to be added to `isearch-mode-hook'."
                 (get-text-property (point) 'dired-filename)))
     (define-key isearch-mode-map "\M-sff" 'dired-isearch-filenames-mode)
     (dired-isearch-filenames-mode 1)
-    (add-hook 'isearch-mode-end-hook 'dired-isearch-filenames-end nil t)))
+    (add-hook 'isearch-mode-end-hook #'dired-isearch-filenames-end nil t)))
 
 (defun dired-isearch-filenames-end ()
   "Clean up the Dired file name search after terminating isearch."
   (define-key isearch-mode-map "\M-sff" nil)
   (dired-isearch-filenames-mode -1)
-  (remove-hook 'isearch-mode-end-hook 'dired-isearch-filenames-end t)
+  (remove-hook 'isearch-mode-end-hook #'dired-isearch-filenames-end t)
   (unless isearch-suspended
     (custom-reevaluate-setting 'dired-isearch-filenames)))
 
@@ -2854,11 +2845,11 @@ is part of a file name (i.e., has the text property 
`dired-filename')."
 Stops when a match is found.
 To continue searching for next match, use command \\[tags-loop-continue]."
   (interactive "sSearch marked files (regexp): ")
-  (multifile-initialize-search
+  (fileloop-initialize-search
    regexp
    (dired-get-marked-files nil nil #'dired-nondirectory-p)
    'default)
-  (multifile-continue))
+  (fileloop-continue))
 
 ;;;###autoload
 (defun dired-do-query-replace-regexp (from to &optional delimited)
@@ -2876,11 +2867,11 @@ with the command \\[tags-loop-continue]."
       (if (and buffer (with-current-buffer buffer
                        buffer-read-only))
          (error "File `%s' is visited read-only" file))))
-  (multifile-initialize-replace
+  (fileloop-initialize-replace
    from to (dired-get-marked-files nil nil #'dired-nondirectory-p)
    (if (equal from (downcase from)) nil 'default)
    delimited)
-  (multifile-continue))
+  (fileloop-continue))
 
 (declare-function xref--show-xrefs "xref")
 (declare-function xref-query-replace-in-results "xref")
@@ -2900,7 +2891,7 @@ REGEXP should use constructs supported by your local 
`grep' command."
   (declare-function rgrep-find-ignored-directories "grep" (dir))
   (let* ((files (dired-get-marked-files nil nil nil nil t))
          (ignores (nconc (mapcar
-                          (lambda (s) (concat s "/"))
+                          #'file-name-as-directory
                           (rgrep-find-ignored-directories default-directory))
                          grep-find-ignored-files))
          (xrefs (mapcan
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 6c19863..defc541 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -1,6 +1,6 @@
 ;;; dired-x.el --- extra Dired functionality  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1993-1994, 1997, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1993-1994, 1997, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Sebastian Kremer <address@hidden>
@@ -463,9 +463,11 @@ Interactively with prefix argument, read FILE-NAME."
    (list nil (and current-prefix-arg
                   (read-file-name "Jump to Dired file: "))))
   (cond
-   ((bound-and-true-p archive-subfile-mode)
+   ((and (bound-and-true-p archive-subfile-mode)
+         (buffer-live-p archive-superior-buffer))
     (switch-to-buffer archive-superior-buffer))
-   ((bound-and-true-p tar-subfile-mode)
+   ((and (bound-and-true-p tar-subfile-mode)
+         (buffer-live-p tar-superior-buffer))
     (switch-to-buffer tar-superior-buffer))
    (t
     ;; Expand file-name before `dired-goto-file' call:
diff --git a/lisp/dired.el b/lisp/dired.el
index f2f2b76..fc0b712 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1,6 +1,6 @@
 ;;; dired.el --- directory-browsing commands -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1992-1997, 2000-2018 Free Software
+;; Copyright (C) 1985-1986, 1992-1997, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Sebastian Kremer <address@hidden>
@@ -325,7 +325,7 @@ The directory name must be absolute, but need not be fully 
expanded.")
 
 (put 'dired-actual-switches 'safe-local-variable 'dired-safe-switches-p)
 
-(defvar dired-re-inode-size "[0-9  \t]*[.,0-9]*[BkKMGTPEZY]?[ \t]*"
+(defvar dired-re-inode-size "[0-9 \t]*[.,0-9]*[BkKMGTPEZY]?[ \t]*"
   "Regexp for optional initial inode and file size as made by `ls -i -s'.")
 
 ;; These regexps must be tested at beginning-of-line, but are also
@@ -364,12 +364,12 @@ This is an alist of the form (SUBDIR . SWITCHES).")
 (defvaralias 'dired-move-to-filename-regexp
   'directory-listing-before-filename-regexp)
 
-(defvar dired-subdir-regexp "^. \\([^\n\r]+\\)\\(:\\)[\n\r]"
+(defvar dired-subdir-regexp "^. \\(.+\\)\\(:\\)\n"
   "Regexp matching a maybe hidden subdirectory line in `ls -lR' output.
 Subexpression 1 is the subdirectory proper, no trailing colon.
 The match starts at the beginning of the line and ends after the end
-of the line (\\n or \\r).
-Subexpression 2 must end right before the \\n or \\r.")
+of the line.
+Subexpression 2 must end right before the \\n.")
 
 (defgroup dired-faces nil
   "Faces used by Dired."
@@ -548,7 +548,7 @@ Return value is the number of files marked, or nil if none 
were marked."
       (setq count 0)
       (when ,msg
        (message "%s %ss%s..."
-                (cond ((eq dired-marker-char ?\040) "Unmarking")
+                (cond ((eq dired-marker-char ?\s) "Unmarking")
                       ((eq dired-del-marker dired-marker-char)
                        "Flagging")
                       (t "Marking"))
@@ -568,7 +568,7 @@ Return value is the number of files marked, or nil if none 
were marked."
                         count
                         ,msg
                         (dired-plural-s count)
-                        (if (eq dired-marker-char ?\040) "un" "")
+                        (if (eq dired-marker-char ?\s) "un" "")
                         (if (eq dired-marker-char dired-del-marker)
                             "flagged" "marked"))))
     (and (> count 0) count)))
@@ -1478,12 +1478,36 @@ change; the point does."
                (list w
                     (dired-get-filename nil t)
                      (line-number-at-pos (window-point w)))))
-          (get-buffer-window-list nil 0 t))))
+          (get-buffer-window-list nil 0 t))
+   ;; For each window that showed the current buffer before, scan its
+   ;; list of previous buffers.  For each association thus found save
+   ;; a triple <point, name, line> where 'point' is that window's
+   ;; window-point marker stored in the window's list of previous
+   ;; buffers, 'name' is the filename at the position of 'point' and
+   ;; 'line' is the line number at the position of 'point'.
+   (let ((buffer (current-buffer))
+         prevs)
+     (walk-windows
+      (lambda (window)
+        (let ((prev (assq buffer (window-prev-buffers window))))
+          (when prev
+            (with-current-buffer buffer
+              (save-excursion
+                (goto-char (nth 2 prev))
+                (setq prevs
+                      (cons
+                       (list (nth 2 prev)
+                             (dired-get-filename nil t)
+                             (line-number-at-pos (point)))
+                       prevs)))))))
+      'nomini t)
+     prevs)))
 
 (defun dired-restore-positions (positions)
   "Restore POSITIONS saved with `dired-save-positions'."
   (let* ((buf-file-pos (nth 0 positions))
-        (buffer (nth 0 buf-file-pos)))
+        (buffer (nth 0 buf-file-pos))
+         (prevs (nth 2 positions)))
     (unless (and (nth 1 buf-file-pos)
                 (dired-goto-file (nth 1 buf-file-pos)))
       (goto-char (point-min))
@@ -1497,13 +1521,26 @@ change; the point does."
                       (dired-goto-file (nth 1 win-file-pos)))
             (goto-char (point-min))
            (forward-line (1- (nth 2 win-file-pos)))
-           (dired-move-to-filename)))))))
+           (dired-move-to-filename)))))
+    (when prevs
+      (with-current-buffer buffer
+        (save-excursion
+          (dolist (prev prevs)
+            (let ((point (nth 0 prev)))
+              ;; Sanity check of the point marker.
+              (when (and (markerp point)
+                         (eq (marker-buffer point) buffer))
+                (unless (and (nth 1 prev)
+                             (dired-goto-file (nth 1 prev)))
+                  (goto-char (point-min))
+                 (forward-line (1- (nth 2 prev))))
+               (dired-move-to-filename)
+                (move-marker point (point) buffer)))))))))
 
 (defun dired-remember-marks (beg end)
   "Return alist of files and their marks, from BEG to END."
-  (if selective-display                        ; must unhide to make this work.
-      (let ((inhibit-read-only t))
-       (subst-char-in-region beg end ?\r ?\n)))
+  (if (dired--find-hidden-pos (point-min) (point-max))
+      (dired--unhide (point-min) (point-max))) ;Must unhide to make this work.
   (let (fil chr alist)
     (save-excursion
       (goto-char beg)
@@ -1530,15 +1567,12 @@ Each element of ALIST looks like (FILE . MARKERCHAR)."
 
 (defun dired-remember-hidden ()
   "Return a list of names of subdirs currently hidden."
-  (let ((l dired-subdir-alist) dir pos result)
-    (while l
-      (setq dir (car (car l))
-           pos (cdr (car l))
-           l (cdr l))
+  (let (result)
+    (pcase-dolist (`(,dir . ,pos) dired-subdir-alist)
       (goto-char pos)
-      (skip-chars-forward "^\r\n")
-      (if (eq (following-char) ?\r)
-         (setq result (cons dir result))))
+      (end-of-line)
+      (if (dired--hidden-p)
+         (push dir result)))
     result))
 
 (defun dired-insert-old-subdirs (old-subdir-alist)
@@ -1709,7 +1743,7 @@ Do so according to the former subdir alist 
OLD-SUBDIR-ALIST."
 
     ;; Make menu bar items.
 
-    ;; No need to fo this, now that top-level items are fewer.
+    ;; No need to do this, now that top-level items are fewer.
     ;;;;
     ;; Get rid of the Edit menu bar item to save space.
     ;(define-key map [menu-bar edit] 'undefined)
@@ -2097,9 +2131,9 @@ Keybindings:
        mode-name "Dired"
        ;; case-fold-search nil
        buffer-read-only t
-       selective-display t             ; for subdirectory hiding
        mode-line-buffer-identification
        (propertized-buffer-identification "%17b"))
+  (add-to-invisibility-spec '(dired . t))
   ;; Ignore dired-hide-details-* value of invisible text property by default.
   (when (eq buffer-invisibility-spec t)
     (setq buffer-invisibility-spec (list t)))
@@ -2122,8 +2156,8 @@ Keybindings:
   (when (featurep 'dnd)
     (setq-local dnd-protocol-alist
                 (append dired-dnd-protocol-alist dnd-protocol-alist)))
-  (add-hook 'file-name-at-point-functions 'dired-file-name-at-point nil t)
-  (add-hook 'isearch-mode-hook 'dired-isearch-filenames-setup nil t)
+  (add-hook 'file-name-at-point-functions #'dired-file-name-at-point nil t)
+  (add-hook 'isearch-mode-hook #'dired-isearch-filenames-setup nil t)
   (run-mode-hooks 'dired-mode-hook))
 
 ;; Idiosyncratic dired commands that don't deal with marks.
@@ -2219,7 +2253,7 @@ directory in another window."
   (let ((raw (dired-get-filename nil t))
        file-name)
     (if (null raw)
-       (error "No file on this line"))
+       (user-error "No file on this line"))
     (setq file-name (file-name-sans-versions raw t))
     (if (file-exists-p file-name)
        file-name
@@ -2228,7 +2262,8 @@ directory in another window."
        (error "File no longer exists; type `g' to update Dired buffer")))))
 
 ;; Force C-m keybinding rather than `f' or `e' in the mode doc:
-(define-obsolete-function-alias 'dired-advertised-find-file 'dired-find-file 
"23.2")
+(define-obsolete-function-alias 'dired-advertised-find-file
+  #'dired-find-file "23.2")
 (defun dired-find-file ()
   "In Dired, visit the file or directory named on this line."
   (interactive)
@@ -2476,6 +2511,34 @@ See options: `dired-hide-details-hide-symlink-targets' 
and
             'remove-from-invisibility-spec)
           'dired-hide-details-link))
 
+;;; Functions to hide/unhide text
+
+(defun dired--find-hidden-pos (start end)
+  (text-property-any start end 'invisible 'dired))
+
+(defun dired--hidden-p (&optional pos)
+  (eq (get-char-property (or pos (point)) 'invisible) 'dired))
+
+(defun dired--hide (start end)
+  ;; The old code used selective-display which only works at
+  ;; a line-granularity, so it used start and end positions that where
+  ;; approximate ("anywhere on the line is fine").
+  (save-excursion
+    (put-text-property (progn (goto-char start) (line-end-position))
+                       (progn (goto-char end) (line-end-position))
+                       'invisible 'dired)))
+
+(defun dired--unhide (start end)
+  ;; The old code used selective-display which only works at
+  ;; a line-granularity, so it used start and end positions that where
+  ;; approximate ("anywhere on the line is fine").
+  ;; FIXME: This also removes other invisible properties!
+  (save-excursion
+    (remove-text-properties
+     (progn (goto-char start) (line-end-position))
+     (progn (goto-char end) (line-end-position))
+     '(invisible))))
+
 ;;; Functions for finding the file name in a dired buffer line.
 
 (defvar dired-permission-flags-regexp
@@ -2515,12 +2578,11 @@ Return the position of the beginning of the filename, 
or nil if none found."
   ;; This is the UNIX version.
   (if (get-text-property (point) 'dired-filename)
       (goto-char (next-single-property-change (point) 'dired-filename))
-    (let (opoint file-type executable symlink hidden used-F eol)
-      (setq used-F (dired-check-switches dired-actual-switches "F" "classify")
-           opoint (point)
-           eol (line-end-position)
-           hidden (and selective-display
-                       (save-excursion (search-forward "\r" eol t))))
+    (let ((opoint (point))
+          (used-F (dired-check-switches dired-actual-switches "F" "classify"))
+          (eol (line-end-position))
+          (hidden (dired--hidden-p))
+          file-type executable symlink)
       (if hidden
          nil
        (save-excursion ;; Find out what kind of file this is:
@@ -2757,7 +2819,7 @@ You can then feed the file name(s) to other commands with 
\\[yank]."
     (if pos
        (progn
          (goto-char pos)
-         (or no-skip (skip-chars-forward "^\n\r"))
+         (or no-skip (end-of-line))
          (point))
       (if no-error-if-not-found
          nil                           ; return nil if not found
@@ -3149,17 +3211,17 @@ non-empty directories is allowed."
   (dired-move-to-filename))
 
 (defun dired-fun-in-all-buffers (directory file fun &rest args)
-  ;; In all buffers dired'ing DIRECTORY, run FUN with ARGS.
-  ;; If the buffer has a wildcard pattern, check that it matches FILE.
-  ;; (FILE does not include a directory component.)
-  ;; FILE may be nil, in which case ignore it.
-  ;; Return list of buffers where FUN succeeded (i.e., returned non-nil).
+  "In all buffers dired'ing DIRECTORY, run FUN with ARGS.
+If the buffer has a wildcard pattern, check that it matches FILE.
+(FILE does not include a directory component.)
+FILE may be nil, in which case ignore it.
+Return list of buffers where FUN succeeded (i.e., returned non-nil)."
   (let (success-list)
-    (dolist (buf (dired-buffers-for-dir (expand-file-name directory)
-                                       file))
+    (dolist (buf (dired-buffers-for-dir (expand-file-name directory) file))
       (with-current-buffer buf
        (if (apply fun args)
-           (setq success-list (cons (buffer-name buf) success-list)))))
+           (push buf success-list))))
+    ;; FIXME: AFAICT, this return value is not used by any of the callers!
     success-list))
 
 ;; Delete the entry for FILE from
@@ -3392,7 +3454,7 @@ no ARGth marked file is found before this line."
     (and (dired-goto-file file)
         (progn
           (beginning-of-line)
-          (if (not (equal ?\040 (following-char)))
+          (if (not (equal ?\s (following-char)))
               (following-char))))))
 
 (defun dired-mark-files-in-region (start end)
@@ -3450,7 +3512,7 @@ If looking at a subdir, unmark all its files except `.' 
and `..'.
 If the region is active in Transient Mark mode, unmark all files
 in the active region."
   (interactive (list current-prefix-arg t))
-  (let ((dired-marker-char ?\040))
+  (let ((dired-marker-char ?\s))
     (dired-mark arg interactive)))
 
 (defun dired-flag-file-deletion (arg &optional interactive)
@@ -3489,11 +3551,11 @@ As always, hidden subdirs are not affected."
             ;; use subst instead of insdel because it does not move
             ;; the gap and thus should be faster and because
             ;; other characters are left alone automatically
-            (apply 'subst-char-in-region
+            (apply #'subst-char-in-region
                    (point) (1+ (point))
-                   (if (eq ?\040 (following-char)) ; SPC
-                       (list ?\040 dired-marker-char)
-                     (list dired-marker-char ?\040))))
+                   (if (eq ?\s (following-char))
+                       (list ?\s dired-marker-char)
+                     (list dired-marker-char ?\s))))
         (forward-line 1)))))
 
 ;;; Commands to mark or flag files based on their characteristics or names.
@@ -3524,7 +3586,7 @@ object files--just `.o' will mark more than you might 
think."
                                                      (dired-get-filename nil 
t) t))
                                                    "\\'"))))
                       'dired-regexp-history)
-        (if current-prefix-arg ?\040)))
+        (if current-prefix-arg ?\s)))
   (let ((dired-marker-char (or marker-char dired-marker-char)))
     (dired-mark-if
      (and (not (looking-at-p dired-re-dot))
@@ -3547,7 +3609,7 @@ since it was last visited."
    (list (read-regexp (concat (if current-prefix-arg "Unmark" "Mark")
                               " files containing (regexp): ")
                       nil 'dired-regexp-history)
-        (if current-prefix-arg ?\040)))
+        (if current-prefix-arg ?\s)))
   (let ((dired-marker-char (or marker-char dired-marker-char)))
     (dired-mark-if
      (and (not (looking-at-p dired-re-dot))
@@ -3584,14 +3646,14 @@ The match is against the non-directory part of the 
filename.  Use `^'
   "Mark all symbolic links.
 With prefix argument, unmark or unflag all those files."
   (interactive "P")
-  (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char)))
+  (let ((dired-marker-char (if unflag-p ?\s dired-marker-char)))
     (dired-mark-if (looking-at-p dired-re-sym) "symbolic link")))
 
 (defun dired-mark-directories (unflag-p)
   "Mark all directory file lines except `.' and `..'.
 With prefix argument, unmark or unflag all those files."
   (interactive "P")
-  (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char)))
+  (let ((dired-marker-char (if unflag-p ?\s dired-marker-char)))
     (dired-mark-if (and (looking-at-p dired-re-dir)
                        (not (looking-at-p dired-re-dot)))
                   "directory file")))
@@ -3600,7 +3662,7 @@ With prefix argument, unmark or unflag all those files."
   "Mark all executable files.
 With prefix argument, unmark or unflag all those files."
   (interactive "P")
-  (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char)))
+  (let ((dired-marker-char (if unflag-p ?\s dired-marker-char)))
     (dired-mark-if (looking-at-p dired-re-exe) "executable file")))
 
 ;; dired-x.el has a dired-mark-sexp interactive command: mark
@@ -3610,7 +3672,7 @@ With prefix argument, unmark or unflag all those files."
   "Flag for deletion files whose names suggest they are auto save files.
 A prefix argument says to unmark or unflag those files instead."
   (interactive "P")
-  (let ((dired-marker-char (if unflag-p ?\040 dired-del-marker)))
+  (let ((dired-marker-char (if unflag-p ?\s dired-del-marker)))
     (dired-mark-if
      ;; It is less than general to check for # here,
      ;; but it's the only way this runs fast enough.
@@ -3849,7 +3911,7 @@ The idea is to set this buffer-locally in special Dired 
buffers.")
     (force-mode-line-update)))
 
 (define-obsolete-function-alias 'dired-sort-set-modeline
-  'dired-sort-set-mode-line "24.3")
+  #'dired-sort-set-mode-line "24.3")
 
 (defun dired-sort-toggle-or-edit (&optional arg)
   "Toggle sorting by date, and refresh the Dired buffer.
@@ -4091,7 +4153,7 @@ Ask means pop up a menu for the user to select one of 
copy, move or link."
           (dired dired-dir)
           ;; The following elements of `misc-data' are the keys
           ;; from `dired-subdir-alist'.
-          (mapc 'dired-maybe-insert-subdir (cdr misc-data))
+          (mapc #'dired-maybe-insert-subdir (cdr misc-data))
           (current-buffer))
       (message "Desktop: Directory %s no longer exists." dir)
       (when desktop-missing-file-warning (sit-for 1))
diff --git a/lisp/dirtrack.el b/lisp/dirtrack.el
index 862268d..0925a4d 100644
--- a/lisp/dirtrack.el
+++ b/lisp/dirtrack.el
@@ -1,6 +1,6 @@
 ;;; dirtrack.el --- Directory Tracking by watching the prompt
 
-;; Copyright (C) 1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Peter Breton <address@hidden>
 ;; Created: Sun Nov 17 1996
diff --git a/lisp/disp-table.el b/lisp/disp-table.el
index 95224f2..476c0cb 100644
--- a/lisp/disp-table.el
+++ b/lisp/disp-table.el
@@ -1,6 +1,6 @@
 ;;; disp-table.el --- functions for dealing with char tables
 
-;; Copyright (C) 1987, 1994-1995, 1999, 2001-2018 Free Software
+;; Copyright (C) 1987, 1994-1995, 1999, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Erik Naggum <address@hidden>
diff --git a/lisp/display-line-numbers.el b/lisp/display-line-numbers.el
index 3569b84..d38f2e6 100644
--- a/lisp/display-line-numbers.el
+++ b/lisp/display-line-numbers.el
@@ -1,6 +1,6 @@
 ;;; display-line-numbers.el --- interface for display-line-numbers -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: convenience
diff --git a/lisp/dnd.el b/lisp/dnd.el
index 0c94c8b..459a723 100644
--- a/lisp/dnd.el
+++ b/lisp/dnd.el
@@ -1,6 +1,6 @@
 ;;; dnd.el --- drag and drop support
 
-;; Copyright (C) 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Jan Djärv <address@hidden>
 ;; Maintainer: address@hidden
@@ -130,6 +130,7 @@ Return nil if URI is not a local file."
                         (match-string 0 sysname)
                       sysname))))
       (when (and hostname
+                 (not (eq system-type 'windows-nt))
                 (or (string-equal "localhost" hostname)
                     (string-equal (downcase sysname) hostname)
                     (string-equal sysname-no-dot hostname)))
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 2b2c687..a706907 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -1,6 +1,6 @@
 ;;; doc-view.el --- View PDF/PostScript/DVI files in Emacs -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Tassilo Horn <address@hidden>
 ;; Maintainer: Tassilo Horn <address@hidden>
@@ -155,12 +155,13 @@
 
 (defcustom doc-view-ghostscript-program "gs"
   "Program to convert PS and PDF files to PNG."
-  :type 'file
-  :group 'doc-view)
+  :type 'file)
 
 (defcustom doc-view-pdfdraw-program
   (cond
    ((executable-find "pdfdraw") "pdfdraw")
+   ((executable-find "mudraw") "mudraw")
+   ((executable-find "mutool") "mutool")
    (t "mudraw"))
   "Name of MuPDF's program to convert PDF files to PNG."
   :type 'file
@@ -182,17 +183,20 @@
 (defcustom doc-view-ghostscript-options
   '("-dSAFER" ;; Avoid security problems when rendering files from untrusted
     ;; sources.
-    "-dNOPAUSE" "-sDEVICE=png16m" "-dTextAlphaBits=4"
+    "-dNOPAUSE" "-dTextAlphaBits=4"
     "-dBATCH" "-dGraphicsAlphaBits=4" "-dQUIET")
   "A list of options to give to ghostscript."
-  :type '(repeat string)
-  :group 'doc-view)
+  :type '(repeat string))
+
+(defcustom doc-view-ghostscript-device "png16m"
+  "Output device to give to ghostscript."
+  :type 'string
+  :version "27.1")
 
 (defcustom doc-view-resolution 100
   "Dots per inch resolution used to render the documents.
 Higher values result in larger images."
-  :type 'number
-  :group 'doc-view)
+  :type 'number)
 
 (defcustom doc-view-scale-internally t
   "Whether we should try to rescale images ourselves.
@@ -207,8 +211,7 @@ scaling."
 Has only an effect if `doc-view-scale-internally' is non-nil and support for
 scaling is compiled into emacs."
   :version "24.1"
-  :type 'number
-  :group 'doc-view)
+  :type 'number)
 
 (defcustom doc-view-dvipdfm-program "dvipdfm"
   "Program to convert DVI files to PDF.
@@ -218,8 +221,7 @@ converted to PNG.
 
 If this and `doc-view-dvipdf-program' are set,
 `doc-view-dvipdf-program' will be preferred."
-  :type 'file
-  :group 'doc-view)
+  :type 'file)
 
 (defcustom doc-view-dvipdf-program "dvipdf"
   "Program to convert DVI files to PDF.
@@ -229,8 +231,7 @@ converted to PNG.
 
 If this and `doc-view-dvipdfm-program' are set,
 `doc-view-dvipdf-program' will be preferred."
-  :type 'file
-  :group 'doc-view)
+  :type 'file)
 
 (define-obsolete-variable-alias 'doc-view-unoconv-program
                                 'doc-view-odf->pdf-converter-program
@@ -245,8 +246,7 @@ If this and `doc-view-dvipdfm-program' are set,
 
 Needed for viewing OpenOffice.org (and MS Office) files."
   :version "24.4"
-  :type 'file
-  :group 'doc-view)
+  :type 'file)
 
 (defcustom doc-view-odf->pdf-converter-function
   (cond
@@ -267,22 +267,19 @@ Needed for viewing OpenOffice.org (and MS Office) files."
   "Program to convert PS files to PDF.
 
 PS files will be converted to PDF before searching is possible."
-  :type 'file
-  :group 'doc-view)
+  :type 'file)
 
 (defcustom doc-view-pdftotext-program "pdftotext"
   "Program to convert PDF files to plain text.
 
 Needed for searching."
-  :type 'file
-  :group 'doc-view)
+  :type 'file)
 
 (defcustom doc-view-cache-directory
   (expand-file-name (format "docview%d" (user-uid))
                    temporary-file-directory)
   "The base directory, where the PNG images will be saved."
-  :type 'directory
-  :group 'doc-view)
+  :type 'directory)
 
 (defvar doc-view-conversion-buffer " *doc-view conversion output*"
   "The buffer where messages from the converter programs go to.")
@@ -293,8 +290,7 @@ After such a refresh newly converted pages will be 
available for
 viewing.  If set to nil there won't be any refreshes and the
 pages won't be displayed before conversion of the whole document
 has finished."
-  :type 'integer
-  :group 'doc-view)
+  :type 'integer)
 
 (defcustom doc-view-continuous nil
   "In Continuous mode reaching the page edge advances to next/previous page.
@@ -302,7 +298,6 @@ When non-nil, scrolling a line upward at the bottom edge of 
the page
 moves to the next page, and scrolling a line downward at the top edge
 of the page moves to the previous page."
   :type 'boolean
-  :group 'doc-view
   :version "23.2")
 
 ;;;; Internal Variables
@@ -412,6 +407,7 @@ Typically \"page-%s.png\".")
     (define-key map "W"               'doc-view-fit-width-to-window)
     (define-key map "H"               'doc-view-fit-height-to-window)
     (define-key map "P"               'doc-view-fit-page-to-window)
+    (define-key map "F"               'doc-view-fit-window-to-page) ;F = frame
     ;; Killing the buffer (and the process)
     (define-key map (kbd "K")         'doc-view-kill-proc)
     ;; Slicing the image
@@ -429,22 +425,20 @@ Typically \"page-%s.png\".")
     (define-key map (kbd "C-c C-c")   'doc-view-toggle-display)
     ;; Open a new buffer with doc's text contents
     (define-key map (kbd "C-c C-t")   'doc-view-open-text)
-    ;; Reconvert the current document.  Don't just use revert-buffer
-    ;; because that resets the scale factor, the page number, ...
-    (define-key map (kbd "g")         'doc-view-revert-buffer)
-    (define-key map (kbd "r")         'doc-view-revert-buffer)
+    (define-key map (kbd "r")         'revert-buffer)
     map)
   "Keymap used by `doc-view-mode' when displaying a doc as a set of images.")
 
-(defun doc-view-revert-buffer (&optional ignore-auto noconfirm)
-  "Like `revert-buffer', but preserves the buffer's current modes."
-  (interactive (list (not current-prefix-arg)))
+(define-obsolete-function-alias 'doc-view-revert-buffer #'revert-buffer "27.1")
+(defvar revert-buffer-preserve-modes)
+(defun doc-view--revert-buffer (orig-fun &rest args)
+  "Preserve the buffer's current mode and check PDF sanity."
   (if (< undo-outer-limit (* 2 (buffer-size)))
       ;; It's normal for this operation to result in a very large undo entry.
       (setq-local undo-outer-limit (* 2 (buffer-size))))
   (cl-labels ((revert ()
-                      (let (revert-buffer-function)
-                        (revert-buffer ignore-auto noconfirm 
'preserve-modes))))
+                      (let ((revert-buffer-preserve-modes t))
+                        (apply orig-fun args))))
     (if (and (eq 'pdf doc-view-doc-type)
              (executable-find "pdfinfo"))
         ;; We don't want to revert if the PDF file is corrupted which
@@ -452,7 +446,7 @@ Typically \"page-%s.png\".")
         ;; file.  (TODO: We'd like to have something like that also
         ;; for other types, at least PS, but I don't know a good way
         ;; to test if a PS file is complete.)
-        (if (= 0 (call-process (executable-find "pdfinfo") nil nil nil
+        (if (= 0 (call-process "pdfinfo" nil nil nil
                                doc-view--buffer-file-name))
             (revert)
           (when (called-interactively-p 'interactive)
@@ -492,12 +486,14 @@ Typically \"page-%s.png\".")
 
 ;;;; Navigation Commands
 
+;; FIXME: The doc-view-current-* definitions below are macros because they
+;; map to accessors which we want to use via `setf' as well!
 (defmacro doc-view-current-page (&optional win)
   `(image-mode-window-get 'page ,win))
-(defmacro doc-view-current-info () `(image-mode-window-get 'info))
-(defmacro doc-view-current-overlay () `(image-mode-window-get 'overlay))
-(defmacro doc-view-current-image () `(image-mode-window-get 'image))
-(defmacro doc-view-current-slice () `(image-mode-window-get 'slice))
+(defmacro doc-view-current-info () '(image-mode-window-get 'info))
+(defmacro doc-view-current-overlay () '(image-mode-window-get 'overlay))
+(defmacro doc-view-current-image () '(image-mode-window-get 'image))
+(defmacro doc-view-current-slice () '(image-mode-window-get 'slice))
 
 (defun doc-view-last-page-number ()
   (length doc-view--current-files))
@@ -683,7 +679,7 @@ at the top edge of the page moves to the previous page."
        (file-error
        (error
         (format "Unable to use temporary directory %s: %s"
-                dir (mapconcat 'identity (cdr error) " "))))))))
+                dir (mapconcat #'identity (cdr error) " "))))))))
 
 (defun doc-view--current-cache-dir ()
   "Return the directory where the png files of the current doc should be saved.
@@ -872,6 +868,38 @@ min {(window-width / image-width), (window-height / 
image-height)} times."
         (setf (doc-view-current-slice) new-slice)
         (doc-view-goto-page (doc-view-current-page))))))
 
+(defun doc-view-fit-window-to-page ()
+  "Resize selected window so it just fits the current page.
+Resize the containing frame if needed."
+  (interactive)
+  (let* ((slice (doc-view-current-slice))
+         (img-width  (if slice (nth 2 slice)
+                       (car (image-display-size
+                             (image-get-display-property) t))))
+         (img-height (if slice (nth 3 slice)
+                       (cdr (image-display-size
+                             (image-get-display-property) t))))
+         (win-width  (- (nth 2 (window-inside-pixel-edges))
+                        (nth 0 (window-inside-pixel-edges))))
+         (win-height (- (nth 3 (window-inside-pixel-edges))
+                        (nth 1 (window-inside-pixel-edges))))
+         (width-diff  (- img-width  win-width))
+         (height-diff (- img-height win-height))
+         (new-frame-params
+          (append
+           (if (= (window-width) (frame-width))
+               `((width  . (text-pixels
+                            . ,(+ (frame-text-width) width-diff))))
+             (enlarge-window (/ width-diff (frame-char-width)) 'horiz)
+             nil)
+           (if (= (window-height) (frame-height))
+               `((height  . (text-pixels
+                             . ,(+ (frame-text-height) height-diff))))
+             (enlarge-window (/ height-diff (frame-char-height)) nil)
+             nil))))
+    (when new-frame-params
+      (modify-frame-parameters (selected-frame) new-frame-params))))
+
 (defun doc-view-reconvert-doc ()
   "Reconvert the current document.
 Should be invoked when the cached images aren't up-to-date."
@@ -906,7 +934,7 @@ Should be invoked when the cached images aren't up-to-date."
   (let* ((default-directory (or (unhandled-file-name-directory
                                  default-directory)
                              (expand-file-name "~/")))
-         (proc (apply 'start-process name doc-view-conversion-buffer
+         (proc (apply #'start-process name doc-view-conversion-buffer
                       program args)))
     (push proc doc-view--current-converter-processes)
     (setq mode-line-process (list (format ":%s" proc)))
@@ -927,16 +955,31 @@ Should be invoked when the cached images aren't 
up-to-date."
                            (list "-o" pdf dvi)
                            callback)))
 
+(defun doc-view-pdf-password-protected-ghostscript-p (pdf)
+  "Return non-nil if a PDF file is password-protected.
+The test is performed using `doc-view-ghostscript-program'."
+  (with-temp-buffer
+    (apply #'call-process doc-view-ghostscript-program nil (current-buffer)
+           nil `(,@doc-view-ghostscript-options
+                 "-sNODISPLAY"
+                 ,pdf))
+    (goto-char (point-min))
+    (search-forward "This file requires a password for access." nil t)))
+
 (defun doc-view-pdf->png-converter-ghostscript (pdf png page callback)
-  (doc-view-start-process
-   "pdf/ps->png" doc-view-ghostscript-program
-   `(,@doc-view-ghostscript-options
-     ,(format "-r%d" (round doc-view-resolution))
-     ,@(if page `(,(format "-dFirstPage=%d" page)))
-     ,@(if page `(,(format "-dLastPage=%d" page)))
-     ,(concat "-sOutputFile=" png)
-     ,pdf)
-   callback))
+  (let ((pdf-passwd (if (doc-view-pdf-password-protected-ghostscript-p pdf)
+                        (read-passwd "Enter password for PDF file: "))))
+    (doc-view-start-process
+     "pdf/ps->png" doc-view-ghostscript-program
+     `(,@doc-view-ghostscript-options
+       ,(concat "-sDEVICE=" doc-view-ghostscript-device)
+       ,(format "-r%d" (round doc-view-resolution))
+       ,@(if page `(,(format "-dFirstPage=%d" page)))
+       ,@(if page `(,(format "-dLastPage=%d" page)))
+       ,@(if pdf-passwd `(,(format "-sPDFPassword=%s" pdf-passwd)))
+       ,(concat "-sOutputFile=" png)
+       ,pdf)
+     callback)))
 
 (defalias 'doc-view-ps->png-converter-ghostscript
   'doc-view-pdf->png-converter-ghostscript)
@@ -957,14 +1000,36 @@ If PAGE is nil, convert the whole document."
      ,tiff)
    callback))
 
+(defun doc-view-pdfdraw-program-subcommand ()
+  "Return the mutool subcommand replacing mudraw.
+Recent MuPDF distributions replaced 'mudraw' with 'mutool draw'."
+  (when (string-match "mutool[^/\\]*$" doc-view-pdfdraw-program)
+    '("draw")))
+
+(defun doc-view-pdf-password-protected-pdfdraw-p (pdf)
+  "Return non-nil if a PDF file is password-protected.
+The test is performed using `doc-view-pdfdraw-program'."
+  (with-temp-buffer
+    (apply #'call-process doc-view-pdfdraw-program nil (current-buffer) nil
+           `(,@(doc-view-pdfdraw-program-subcommand)
+             ,(concat "-o" null-device)
+             ;; In case PDF isn't password-protected, "draw" only one page.
+             ,pdf "1"))
+    (goto-char (point-min))
+    (search-forward "error: cannot authenticate password" nil t)))
+
 (defun doc-view-pdf->png-converter-mupdf (pdf png page callback)
-  (doc-view-start-process
-   "pdf->png" doc-view-pdfdraw-program
-   `(,(concat "-o" png)
-     ,(format "-r%d" (round doc-view-resolution))
-     ,pdf
-     ,@(if page `(,(format "%d" page))))
-   callback))
+  (let ((pdf-passwd (if (doc-view-pdf-password-protected-pdfdraw-p pdf)
+                        (read-passwd "Enter password for PDF file: "))))
+    (doc-view-start-process
+     "pdf->png" doc-view-pdfdraw-program
+     `(,@(doc-view-pdfdraw-program-subcommand)
+       ,(concat "-o" png)
+       ,(format "-r%d" (round doc-view-resolution))
+       ,@(if pdf-passwd `("-p" ,pdf-passwd))
+       ,pdf
+       ,@(if page `(,(format "%d" page))))
+     callback)))
 
 (defun doc-view-odf->pdf-converter-unoconv (odf callback)
   "Convert ODF to PDF asynchronously and call CALLBACK when finished.
@@ -1004,8 +1069,8 @@ is named like ODF with the extension turned to pdf."
   "Convert PDF-PS to PNG asynchronously."
   (funcall
    (pcase doc-view-doc-type
-     (`pdf doc-view-pdf->png-converter-function)
-     (`djvu #'doc-view-djvu->tiff-converter-ddjvu)
+     ('pdf doc-view-pdf->png-converter-function)
+     ('djvu #'doc-view-djvu->tiff-converter-ddjvu)
      (_ #'doc-view-ps->png-converter-ghostscript))
    pdf-ps png nil
    (let ((resolution doc-view-resolution))
@@ -1074,20 +1139,20 @@ Start by converting PAGES, and then the rest."
   "Convert the current document to text and call CALLBACK when done."
   (make-directory (doc-view--current-cache-dir) t)
   (pcase doc-view-doc-type
-    (`pdf
+    ('pdf
      ;; Doc is a PDF, so convert it to TXT
      (doc-view-pdf->txt doc-view--buffer-file-name txt callback))
-    (`ps
+    ('ps
      ;; Doc is a PS, so convert it to PDF (which will be converted to
      ;; TXT thereafter).
      (let ((pdf (doc-view-current-cache-doc-pdf)))
        (doc-view-ps->pdf doc-view--buffer-file-name pdf
                          (lambda () (doc-view-pdf->txt pdf txt callback)))))
-    (`dvi
+    ('dvi
      ;; Doc is a DVI.  This means that a doc.pdf already exists in its
      ;; cache subdirectory.
      (doc-view-pdf->txt (doc-view-current-cache-doc-pdf) txt callback))
-    (`odf
+    ('odf
      ;; Doc is some ODF (or MS Office) doc.  This means that a doc.pdf
      ;; already exists in its cache subdirectory.
      (doc-view-pdf->txt (doc-view-current-cache-doc-pdf) txt callback))
@@ -1128,13 +1193,13 @@ Those files are saved in the directory given by the 
function
                    (doc-view--current-cache-dir))))
     (make-directory (doc-view--current-cache-dir) t)
     (pcase doc-view-doc-type
-      (`dvi
+      ('dvi
        ;; DVI files have to be converted to PDF before Ghostscript can process
        ;; it.
        (let ((pdf (doc-view-current-cache-doc-pdf)))
          (doc-view-dvi->pdf doc-view--buffer-file-name pdf
                             (lambda () (doc-view-pdf/ps->png pdf png-file)))))
-      (`odf
+      ('odf
        ;; ODF files have to be converted to PDF before Ghostscript can
        ;; process it.
        (let ((pdf (doc-view-current-cache-doc-pdf))
@@ -1147,11 +1212,11 @@ Those files are saved in the directory given by the 
function
         ;; file name.  It's named like the input file with the
         ;; extension replaced by pdf.
          (funcall doc-view-odf->pdf-converter-function 
doc-view--buffer-file-name
-                            (lambda ()
-                             ;; Rename to doc.pdf
-                             (rename-file opdf pdf)
-                             (doc-view-pdf/ps->png pdf png-file)))))
-      ((or `pdf `djvu)
+                  (lambda ()
+                   ;; Rename to doc.pdf
+                   (rename-file opdf pdf)
+                   (doc-view-pdf/ps->png pdf png-file)))))
+      ((or 'pdf 'djvu)
        (let ((pages (doc-view-active-pages)))
          ;; Convert doc to bitmap images starting with the active pages.
          (doc-view-document->bitmap doc-view--buffer-file-name png-file 
pages)))
@@ -1217,7 +1282,8 @@ dragging it to its bottom-right corner.  See also
     (save-match-data
       (when (string-match (concat "%%BoundingBox: "
                                  "\\([[:digit:]]+\\) \\([[:digit:]]+\\) "
-                                 "\\([[:digit:]]+\\) \\([[:digit:]]+\\)") o)
+                                 "\\([[:digit:]]+\\) \\([[:digit:]]+\\)")
+                          o)
        (mapcar #'string-to-number
                (list (match-string 1 o)
                      (match-string 2 o)
@@ -1301,10 +1367,10 @@ ARGS is a list of image descriptors."
       (let* ((image (if (and file (file-readable-p file))
                        (if (not (and doc-view-scale-internally
                                      (fboundp 'imagemagick-types)))
-                           (apply 'create-image file doc-view--image-type nil 
args)
+                           (apply #'create-image file doc-view--image-type nil 
args)
                          (unless (member :width args)
                            (setq args `(,@args :width ,doc-view-image-width)))
-                         (apply 'create-image file 'imagemagick nil args))))
+                         (apply #'create-image file 'imagemagick nil args))))
             (slice (doc-view-current-slice))
             (img-width (and image (car (image-size image))))
             (displayed-img-width (if (and image slice)
@@ -1410,6 +1476,14 @@ For now these keys are useful:
   (interactive)
   (tooltip-show (doc-view-current-info)))
 
+;; We define an own major mode for DocView's text display so that we
+;; can easily distinguish when we want to toggle back because
+;; text-mode is a likely candidate for a default major-mode
+;; (bug#34451).
+(define-derived-mode doc-view--text-view-mode text-mode "DV/Text"
+  "View mode used in DocView's text buffers."
+  (view-mode))
+
 (defun doc-view-open-text ()
   "Display the current doc's contents as text."
   (interactive)
@@ -1421,15 +1495,22 @@ For now these keys are useful:
                (buffer-undo-list t)
                (dv-bfn doc-view--buffer-file-name))
            (erase-buffer)
+            ;; FIXME: Replacing the buffer's PDF content with its txt rendering
+            ;; is pretty risky.  We should probably use *another*
+            ;; buffer instead, so there's much less risk of
+            ;; overwriting the PDF file with some text rendering.
            (set-buffer-multibyte t)
            (insert-file-contents txt)
-           (text-mode)
+           (doc-view--text-view-mode)
            (setq-local doc-view--buffer-file-name dv-bfn)
            (set-buffer-modified-p nil)
            (doc-view-minor-mode)
            (add-hook 'write-file-functions
                      (lambda ()
-                       (when (eq major-mode 'text-mode)
+                        ;; FIXME: If the user changes major mode and then
+                        ;; saves the buffer, the PDF file will be clobbered
+                        ;; with its txt rendering!
+                       (when (eq major-mode 'doc-view--text-view-mode)
                          (error "Cannot save text contents of document %s"
                                 buffer-file-name)))
                      nil t))
@@ -1453,7 +1534,7 @@ For now these keys are useful:
     ;; normal mode.
     (doc-view-fallback-mode)
     (doc-view-minor-mode 1))
-   ((eq major-mode 'text-mode)
+   ((eq major-mode 'doc-view--text-view-mode)
     (let ((buffer-undo-list t))
       ;; We're currently viewing the document's text contents, so switch
       ;; back to .
@@ -1695,7 +1776,7 @@ If BACKWARD is non-nil, jump to the previous match."
   "Find the right single-page converter for the current document type"
   (pcase-let ((`(,conv-function ,type ,extension)
                (pcase doc-view-doc-type
-                 (`djvu (list #'doc-view-djvu->tiff-converter-ddjvu 'tiff 
"tif"))
+                 ('djvu (list #'doc-view-djvu->tiff-converter-ddjvu 'tiff 
"tif"))
                  (_     (list doc-view-pdf->png-converter-function  'png  
"png")))))
     (setq-local doc-view-single-page-converter-function conv-function)
     (setq-local doc-view--image-type type)
@@ -1725,7 +1806,7 @@ If BACKWARD is non-nil, jump to the previous match."
       ;; window-parameters in the window-state(s) and then restoring this
       ;; window-state should call us back (to interpret/use those parameters).
       (doc-view-goto-page page)
-      (when slice (apply 'doc-view-set-slice slice))
+      (when slice (apply #'doc-view-set-slice slice))
       (current-buffer))))
 
 (add-to-list 'desktop-buffer-mode-handlers
@@ -1764,46 +1845,47 @@ toggle between displaying the document or editing it as 
text.
     (doc-view-make-safe-dir doc-view-cache-directory)
     ;; Handle compressed files, remote files, files inside archives
     (setq-local doc-view--buffer-file-name
-                (cond
-                 (jka-compr-really-do-compress
-                  ;; FIXME: there's a risk of name conflicts here.
-                  (expand-file-name
-                   (file-name-nondirectory
-                    (file-name-sans-extension buffer-file-name))
-                   doc-view-cache-directory))
-                 ;; Is the file readable by local processes?
-                 ;; We used to use `file-remote-p' but it's unclear what it's
-                 ;; supposed to return nil for things like local files accessed
-                 ;; via `su' or via file://...
-                 ((let ((file-name-handler-alist nil))
-                    (not (and buffer-file-name
-                              (file-readable-p buffer-file-name))))
-                  ;; FIXME: there's a risk of name conflicts here.
-                  (expand-file-name
-                   (if buffer-file-name
-                       (file-name-nondirectory buffer-file-name)
-                     (buffer-name))
-                   doc-view-cache-directory))
-                 (t buffer-file-name)))
+               (convert-standard-filename
+                 (cond
+                  (jka-compr-really-do-compress
+                   ;; FIXME: there's a risk of name conflicts here.
+                   (expand-file-name
+                    (file-name-nondirectory
+                     (file-name-sans-extension buffer-file-name))
+                    doc-view-cache-directory))
+                  ;; Is the file readable by local processes?
+                  ;; We used to use `file-remote-p' but it's unclear what it's
+                  ;; supposed to return nil for things like local files 
accessed
+                  ;; via `su' or via file://...
+                  ((let ((file-name-handler-alist nil))
+                     (not (and buffer-file-name
+                               (file-readable-p buffer-file-name))))
+                   ;; FIXME: there's a risk of name conflicts here.
+                   (expand-file-name
+                    (if buffer-file-name
+                       (file-name-nondirectory buffer-file-name)
+                      (buffer-name))
+                    doc-view-cache-directory))
+                  (t buffer-file-name))))
     (when (not (string= doc-view--buffer-file-name buffer-file-name))
       (write-region nil nil doc-view--buffer-file-name))
 
-    (setq-local revert-buffer-function #'doc-view-revert-buffer)
+    (add-function :around (local 'revert-buffer-function) 
#'doc-view--revert-buffer)
 
     (add-hook 'change-major-mode-hook
              (lambda ()
                (doc-view-kill-proc)
                (remove-overlays (point-min) (point-max) 'doc-view t))
              nil t)
-    (add-hook 'clone-indirect-buffer-hook 'doc-view-clone-buffer-hook nil t)
-    (add-hook 'kill-buffer-hook 'doc-view-kill-proc nil t)
-    (setq-local desktop-save-buffer 'doc-view-desktop-save-buffer)
+    (add-hook 'clone-indirect-buffer-hook #'doc-view-clone-buffer-hook nil t)
+    (add-hook 'kill-buffer-hook #'doc-view-kill-proc nil t)
+    (setq-local desktop-save-buffer #'doc-view-desktop-save-buffer)
 
     (remove-overlays (point-min) (point-max) 'doc-view t) ;Just in case.
     ;; Keep track of display info ([vh]scroll, page number, overlay,
     ;; ...)  for each window in which this document is shown.
     (add-hook 'image-mode-new-window-functions
-             'doc-view-new-window-function nil t)
+             #'doc-view-new-window-function nil t)
     (image-mode-setup-winprops)
 
     (setq-local mode-line-position
@@ -1819,7 +1901,7 @@ toggle between displaying the document or editing it as 
text.
                     #'doc-view-scroll-down-or-previous-page))
     (setq-local cursor-type nil)
     (use-local-map doc-view-mode-map)
-    (add-hook 'after-revert-hook 'doc-view-reconvert-doc nil t)
+    (add-hook 'after-revert-hook #'doc-view-reconvert-doc nil t)
     (setq-local bookmark-make-record-function
                 #'doc-view-bookmark-make-record)
     (setq mode-name "DocView"
@@ -1861,8 +1943,7 @@ to the next best mode."
   "Toggle displaying buffer via Doc View (Doc View minor mode).
 
 See the command `doc-view-mode' for more information on this mode."
-  nil " DocView" doc-view-minor-mode-map
-  :group 'doc-view
+  :lighter " DocView"
   (when doc-view-minor-mode
     (add-hook 'change-major-mode-hook (lambda () (doc-view-minor-mode -1)) nil 
t)
     (message
@@ -1880,6 +1961,84 @@ See the command `doc-view-mode' for more information on 
this mode."
   (interactive)
   (dired doc-view-cache-directory))
 
+;;;; Presentation mode
+
+(defvar doc-view-presentation-mode-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "\e" 'doc-view-presentation-exit)
+    (define-key map "q" 'doc-view-presentation-exit)
+    ;; (define-key map "C" 'doc-view-convert-all-pages)
+    map))
+
+(defvar-local doc-view-presentation--src-data nil)
+
+(defun doc-view-presentation-exit ()
+  "Leave Doc-View's presentation mode."
+  (interactive)
+  (doc-view-presentation-mode -1))
+
+(define-minor-mode doc-view-presentation-mode
+  "Minor mode used while in presentation mode."
+  :init-value nil :keymap doc-view-presentation-mode-map
+  (if doc-view-presentation-mode
+      (progn
+        (set (make-local-variable 'mode-line-format) nil)
+        (doc-view-fit-page-to-window)
+        ;; (doc-view-convert-all-pages)
+        )
+    (kill-local-variable 'mode-line-format)
+    (let ((pn (doc-view-current-page))
+          (win (selected-window)))
+      (doc-view-presentation--propagate-pn doc-view-presentation--src-data pn)
+      (setq doc-view-presentation--src-data nil)
+      (with-selected-window win
+        (if (and (one-window-p) (window-dedicated-p))
+            (delete-frame))))))
+
+(defun doc-view-presentation--propagate-pn (src-data pn)
+  (when src-data
+    (let ((win (car src-data)))
+      (when (and (window-live-p win)
+                 (eq (current-buffer) (window-buffer win)))
+        (select-window win))
+      (when (eq (doc-view-current-page) (cdr src-data))
+        (doc-view-goto-page pn)))))
+
+(defun doc-view-presentation ()
+  "Put Doc-View in presentation mode."
+  (interactive)
+  (let* ((src-data (cons (selected-window) (doc-view-current-page)))
+         (mal (display-monitor-attributes-list))
+         (monitor-top 0)
+         (monitor-left 0)
+         (monitor-height (display-pixel-height))
+         (monitor-width (display-pixel-width)))
+    (dolist (attrs mal)
+      (when (memq (selected-frame) (alist-get 'frames attrs))
+        (let ((geom (alist-get 'geometry attrs)))
+          (when geom
+            (setq monitor-top (nth 0 geom))
+            (setq monitor-left (nth 1 geom))
+            (setq monitor-width (nth 2 geom))
+            (setq monitor-height (nth 3 geom))))))
+    (let ((frame (make-frame
+                  `((minibuffer . nil)
+                    (fullscreen . fullboth)
+                    (height . ,(ceiling monitor-height (frame-char-height)))
+                    ;; Don't use `ceiling' here since doc-view will center the
+                    ;; image instead.
+                    (width . ,(ceiling monitor-width (frame-char-width)))
+                    (name . "Doc-View-Presentation")
+                    (top . ,monitor-top) (left . ,monitor-left) (user-position 
. t)
+                    (vertical-scroll-bars . nil)
+                    (left-fringe . 0) (right-fringe . 0)
+                    (menu-bar-lines . 0)
+                    (tool-bar-lines . 0)))))
+      (select-window (frame-root-window frame))
+      (setq doc-view-presentation--src-data src-data)
+      (set-window-dedicated-p (selected-window) t)
+      (doc-view-presentation-mode 1))))
+
 
 ;;;; Bookmark integration
 
diff --git a/lisp/dom.el b/lisp/dom.el
index 6045a68..e4da63d 100644
--- a/lisp/dom.el
+++ b/lisp/dom.el
@@ -1,6 +1,6 @@
 ;;; dom.el --- XML/HTML (etc.) DOM manipulation and searching functions -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: xml, html
diff --git a/lisp/dos-fns.el b/lisp/dos-fns.el
index aeb8da4..c575dd4 100644
--- a/lisp/dos-fns.el
+++ b/lisp/dos-fns.el
@@ -1,6 +1,6 @@
 ;;; dos-fns.el --- MS-Dos specific functions
 
-;; Copyright (C) 1991, 1993, 1995-1996, 2001-2018 Free Software
+;; Copyright (C) 1991, 1993, 1995-1996, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/dos-vars.el b/lisp/dos-vars.el
index d4fe760..53de20b 100644
--- a/lisp/dos-vars.el
+++ b/lisp/dos-vars.el
@@ -1,6 +1,6 @@
 ;;; dos-vars.el --- MS-Dos specific user options
 
-;; Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: internal
diff --git a/lisp/dos-w32.el b/lisp/dos-w32.el
index c19aa44..0c04b8f 100644
--- a/lisp/dos-w32.el
+++ b/lisp/dos-w32.el
@@ -1,6 +1,6 @@
 ;; dos-w32.el --- Functions shared among MS-DOS and W32 (NT/95) platforms
 
-;; Copyright (C) 1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: Geoff Voelker <address@hidden>
 ;; Keywords: internal
diff --git a/lisp/double.el b/lisp/double.el
index b21fe5b..a5e7dcd 100644
--- a/lisp/double.el
+++ b/lisp/double.el
@@ -1,6 +1,6 @@
 ;;; double.el --- support for keyboard remapping with double clicking
 
-;; Copyright (C) 1994, 1997-1998, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1994, 1997-1998, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Per Abrahamsen <address@hidden>
diff --git a/lisp/dynamic-setting.el b/lisp/dynamic-setting.el
index f5fbe15..cf1a8d3 100644
--- a/lisp/dynamic-setting.el
+++ b/lisp/dynamic-setting.el
@@ -1,6 +1,6 @@
 ;;; dynamic-setting.el --- Support dynamic changes
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Jan Djärv <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/ebuff-menu.el b/lisp/ebuff-menu.el
index 198320c..6543e5f 100644
--- a/lisp/ebuff-menu.el
+++ b/lisp/ebuff-menu.el
@@ -1,6 +1,6 @@
 ;;; ebuff-menu.el --- electric-buffer-list mode
 
-;; Copyright (C) 1985-1986, 1994, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1985-1986, 1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Richard Mlynarik <address@hidden>
diff --git a/lisp/echistory.el b/lisp/echistory.el
index fb00027..e932daf 100644
--- a/lisp/echistory.el
+++ b/lisp/echistory.el
@@ -1,6 +1,6 @@
 ;;; echistory.el --- Electric Command History Mode
 
-;; Copyright (C) 1985, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
 ;; Maintainer: address@hidden
diff --git a/lisp/ecomplete.el b/lisp/ecomplete.el
index 3bfab47..d9f34ef 100644
--- a/lisp/ecomplete.el
+++ b/lisp/ecomplete.el
@@ -1,6 +1,6 @@
 ;;; ecomplete.el --- electric completion of addresses and the like  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: mail
@@ -96,7 +96,7 @@ string that was matched."
 (defun ecomplete-add-item (type key text)
   "Add item TEXT of TYPE to the database, using KEY as the identifier."
   (let ((elems (assq type ecomplete-database))
-       (now (string-to-number (format-time-string "%s")))
+       (now (encode-time nil 'integer))
        entry)
     (unless elems
       (push (setq elems (list type)) ecomplete-database))
@@ -210,7 +210,7 @@ matches."
 (defun ecomplete-decay-1 (elem)
   ;; We subtract 5% from the item for each week it hasn't been used.
   (/ (car elem)
-     (expt 1.05 (/ (- (float-time) (cadr elem))
+     (expt 1.05 (/ (float-time (time-since (cadr elem)))
                    (* 7 24 60 60)))))
 
 ;; `ecomplete-get-matches' uses substring matching, so also use the `substring'
diff --git a/lisp/edmacro.el b/lisp/edmacro.el
index c3d9bc5..b480b23 100644
--- a/lisp/edmacro.el
+++ b/lisp/edmacro.el
@@ -1,6 +1,6 @@
 ;;; edmacro.el --- keyboard macro editor
 
-;; Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <address@hidden>
 ;; Maintainer: Dave Gillespie <address@hidden>
@@ -623,12 +623,16 @@ This function assumes that the events can be stored in a 
string."
                 (push (vector 'menu-bar (car ev)) result))
                ;; It would be nice to do pop-up menus, too, but not enough
                ;; info is recorded in macros to make this possible.
-               (noerror
-                ;; Just ignore mouse events.
+               ((or (mouse-event-p ev) (mouse-movement-p ev)
+                    (memq (event-basic-type ev)
+                          (list mouse-wheel-down-event mouse-wheel-up-event
+                                mouse-wheel-right-event
+                                mouse-wheel-left-event)))
                 nil)
+               (noerror nil)
                (t
-                (error "Macros with mouse clicks are not %s"
-                       "supported by this command"))))
+                (error "`edmacro-fix-menu-commands': Unsupported event: %S"
+                       ev))))
        ;; Reverse them again and make them back into a vector.
        (vconcat (nreverse result)))
     macro))
diff --git a/lisp/ehelp.el b/lisp/ehelp.el
index d43efd4..2a24c98 100644
--- a/lisp/ehelp.el
+++ b/lisp/ehelp.el
@@ -1,6 +1,6 @@
 ;;; ehelp.el --- bindings for electric-help mode -*- lexical-binding: t -*-
 
-;; Copyright (C) 1986, 1995, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 1995, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Richard Mlynarik
 ;; (according to ack.texi and authors.el)
diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
index 7df7098..3be09d8 100644
--- a/lisp/elec-pair.el
+++ b/lisp/elec-pair.el
@@ -1,6 +1,6 @@
 ;;; elec-pair.el --- Automatic parenthesis pairing  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: João Távora <address@hidden>
 
@@ -227,7 +227,14 @@ inside a comment or string."
 (defun electric-pair--insert (char)
   (let ((last-command-event char)
        (blink-matching-paren nil)
-       (electric-pair-mode nil))
+       (electric-pair-mode nil)
+        ;; When adding the "closer" delimiter, a job his function is
+        ;; frequently used for, we don't want to munch any extra
+        ;; newlines above us.  That would be the default behaviour of
+        ;; `electric-layout-mode', which potentially kicked in before
+        ;; us to add these newlines, and is probably about to kick in
+        ;; again after we add the closer.
+        (electric-layout-allow-duplicate-newlines t))
     (self-insert-command 1)))
 
 (cl-defmacro electric-pair--with-uncached-syntax ((table &optional start) 
&rest body)
@@ -405,6 +412,15 @@ strings."
   (let ((ppss (electric-pair--syntax-ppss (point) '(comment))))
     (memq (nth 3 ppss) (list t char))))
 
+(defmacro electric-pair--save-literal-point-excursion (&rest body)
+  ;; FIXME: need this instead of `save-excursion' when functions in
+  ;; BODY, such as `electric-pair-inhibit-if-helps-balance' and
+  ;; `electric-pair-skip-if-helps-balance' modify and restore the
+  ;; buffer in a way that modifies the marker used by save-excursion.
+  (let ((point (make-symbol "point")))
+    `(let ((,point (point)))
+       (unwind-protect (progn ,@body) (goto-char ,point)))))
+
 (defun electric-pair-inhibit-if-helps-balance (char)
   "Return non-nil if auto-pairing of CHAR would hurt parentheses' balance.
 
@@ -413,24 +429,28 @@ some list calculations, finally restoring the situation 
as if nothing
 happened."
   (pcase (electric-pair-syntax-info char)
     (`(,syntax ,pair ,_ ,s-or-c)
-     (unwind-protect
-         (progn
-           (delete-char -1)
-           (cond ((eq ?\( syntax)
-                  (let* ((pair-data
-                          (electric-pair--balance-info 1 s-or-c))
-                         (outermost (cdr pair-data)))
-                    (cond ((car outermost)
-                           nil)
-                          (t
-                           (eq (cdr outermost) pair)))))
-                 ((eq syntax ?\")
-                  (electric-pair--unbalanced-strings-p char))))
-       (insert-char char)))))
+     (catch 'done
+       ;; FIXME: modify+undo is *very* tricky business.  We used to
+       ;; use `delete-char' followed by `insert', but this changed the
+       ;; position some markers.  The real fix would be to compute the
+       ;; result without having to modify the buffer at all.
+       (atomic-change-group
+         (delete-char -1)
+         (throw
+          'done
+          (cond ((eq ?\( syntax)
+                 (let* ((pair-data
+                         (electric-pair--balance-info 1 s-or-c))
+                        (outermost (cdr pair-data)))
+                   (cond ((car outermost)
+                          nil)
+                         (t
+                          (eq (cdr outermost) pair)))))
+                ((eq syntax ?\")
+                 (electric-pair--unbalanced-strings-p char)))))))))
 
 (defun electric-pair-skip-if-helps-balance (char)
   "Return non-nil if skipping CHAR would benefit parentheses' balance.
-
 Works by first removing the character from the buffer, then doing
 some list calculations, finally restoring the situation as if nothing
 happened."
@@ -452,7 +472,7 @@ happened."
                             (not (eq (cdr outermost) pair)))))))
                  ((eq syntax ?\")
                   (electric-pair--inside-string-p char))))
-       (insert-char char)))))
+       (insert char)))))
 
 (defun electric-pair-default-skip-self (char)
   (if electric-pair-preserve-balance
@@ -498,7 +518,9 @@ happened."
         ((and (memq syntax '(?\) ?\" ?\$))
               (and (or unconditional
                        (if (functionp electric-pair-skip-self)
-                           (funcall electric-pair-skip-self last-command-event)
+                           (electric-pair--save-literal-point-excursion
+                             (goto-char pos)
+                             (funcall electric-pair-skip-self 
last-command-event))
                          electric-pair-skip-self))
                    (save-excursion
                      (when (and (not (and unconditional
@@ -522,11 +544,13 @@ happened."
                                    pos))
          (forward-char))
         ;; Insert matching pair.
-        ((and (memq syntax `(?\( ?\" ?\$))
+        ((and (memq syntax '(?\( ?\" ?\$))
               (not overwrite-mode)
               (or unconditional
-                  (not (funcall electric-pair-inhibit-predicate
-                                last-command-event))))
+                  (not (electric-pair--save-literal-point-excursion
+                         (goto-char pos)
+                         (funcall electric-pair-inhibit-predicate
+                                  last-command-event)))))
          (save-excursion (electric-pair--insert pair)))))
       (_
        (when (and (if (functionp electric-pair-open-newline-between-pairs)
@@ -540,7 +564,12 @@ happened."
                       (matching-paren (char-after))))
          (save-excursion (newline 1 t)))))))
 
-(put 'electric-pair-post-self-insert-function   'priority  20)
+;; Prioritize this to kick in after
+;; `electric-layout-post-self-insert-function': that considerably
+;; simplifies interoperation when `electric-pair-mode',
+;; `electric-layout-mode' and `electric-indent-mode' are used
+;; together.  Use `vc-region-history' on these lines for more info.
+(put 'electric-pair-post-self-insert-function   'priority  50)
 
 (defun electric-pair-will-use-region ()
   (and (use-region-p)
diff --git a/lisp/electric.el b/lisp/electric.el
index 8730b07..657913a 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -1,6 +1,6 @@
 ;;; electric.el --- window maker and Command loop for `electric' modes
 
-;; Copyright (C) 1985-1986, 1995, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1985-1986, 1995, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: K. Shane Hartman
@@ -198,8 +198,8 @@ relative order must be maintained within it."
   (setq-default post-self-insert-hook
                 (sort (default-value 'post-self-insert-hook)
                       #'(lambda (fn1 fn2)
-                          (< (or (get fn1 'priority) 0)
-                             (or (get fn2 'priority) 0))))))
+                          (< (or (if (symbolp fn1) (get fn1 'priority)) 0)
+                             (or (if (symbolp fn2) (get fn2 'priority)) 0))))))
 
 ;;; Electric indentation.
 
@@ -272,26 +272,25 @@ or comment."
           (when at-newline
             (let ((before (copy-marker (1- pos) t)))
               (save-excursion
-                (unless (or (memq indent-line-function
-                                  electric-indent-functions-without-reindent)
-                            electric-indent-inhibit)
+                (unless
+                    (or (memq indent-line-function
+                              electric-indent-functions-without-reindent)
+                        electric-indent-inhibit)
                   ;; Don't reindent the previous line if the
                   ;; indentation function is not a real one.
                   (goto-char before)
                   (condition-case-unless-debug ()
                       (indent-according-to-mode)
-                    (error (throw 'indent-error nil))))
-                ;; We are at EOL before the call to
-                ;; `indent-according-to-mode', and after it we usually
-                ;; are as well, but not always.  We tried to address
-                ;; it with `save-excursion' but that uses a normal
-                ;; marker whereas we need `move after insertion', so
-                ;; we do the save/restore by hand.
-                (goto-char before)
-                (when (eolp)
-                  ;; Remove the trailing whitespace after indentation because
-                  ;; indentation may (re)introduce the whitespace.
-                  (delete-horizontal-space t)))))
+                    (error (throw 'indent-error nil)))
+                  ;; The goal here will be to remove the trailing
+                  ;; whitespace after reindentation of the previous line
+                  ;; because that may have (re)introduced it.
+                  (goto-char before)
+                  ;; We were at EOL in marker `before' before the call
+                  ;; to `indent-according-to-mode' but after we may
+                  ;; not be (Bug#15767).
+                  (when (and (eolp))
+                    (delete-horizontal-space t))))))
           (unless (and electric-indent-inhibit
                        (not at-newline))
             (condition-case-unless-debug ()
@@ -363,45 +362,115 @@ use `electric-indent-local-mode'."
 (defvar electric-layout-rules nil
   "List of rules saying where to automatically insert newlines.
 
-Each rule has the form (CHAR . WHERE) where CHAR is the char that
-was just inserted and WHERE specifies where to insert newlines
-and can be: nil, `before', `after', `around', `after-stay', or a
-function of no arguments that returns one of those symbols.
+Each rule has the form (CHAR . WHERE), the rule matching if the
+character just inserted was CHAR.  WHERE specifies where to
+insert newlines, and can be:
+
+* one of the symbols `before', `after', `around', `after-stay',
+  or nil.
+
+* a list of the preceding symbols, processed in order of
+  appearance to insert multiple newlines;
+
+* a function of no arguments that returns one of the previous
+  values.
+
+Each symbol specifies where, in relation to the position POS of
+the character inserted, the newline character(s) should be
+inserted.  `after-stay' means insert a newline after POS but stay
+in the same place.
+
+Instead of the (CHAR . WHERE) form, a rule can also be just a
+function of a single argument, the character just inserted.  It
+is called at that position, and should return a value compatible with
+WHERE if the rule matches, or nil if it doesn't match.
 
-The symbols specify where in relation to CHAR the newline
-character(s) should be inserted. `after-stay' means insert a
-newline after CHAR but stay in the same place.")
+If multiple rules match, only first one is executed.")
+
+;; TODO: Make this a defcustom?
+(defvar electric-layout-allow-duplicate-newlines nil
+  "If non-nil, allow duplication of `before' newlines.")
 
 (defun electric-layout-post-self-insert-function ()
-  (let* ((rule (cdr (assq last-command-event electric-layout-rules)))
-         pos)
+  (when electric-layout-mode
+    (electric-layout-post-self-insert-function-1)))
+
+;; for edebug's sake, a separate function
+(defun electric-layout-post-self-insert-function-1 ()
+  (let* ((pos (electric--after-char-pos))
+         probe
+         (rules electric-layout-rules)
+         (rule
+          (catch 'done
+            (when pos
+              (while (setq probe (pop rules))
+                (cond ((and (consp probe)
+                            (eq (car probe) last-command-event))
+                       (throw 'done (cdr probe)))
+                      ((functionp probe)
+                       (let ((res
+                              (save-excursion
+                                (goto-char pos)
+                                (funcall probe last-command-event))))
+                         (when res (throw 'done res))))))))))
     (when (and rule
-               (setq pos (electric--after-char-pos))
                ;; Not in a string or comment.
                (not (nth 8 (save-excursion (syntax-ppss pos)))))
-      (let ((end (point-marker))
-            (sym (if (functionp rule) (funcall rule) rule)))
-        (set-marker-insertion-type end (not (eq sym 'after-stay)))
-        (goto-char pos)
-        (pcase sym
-          ;; FIXME: we used `newline' down here which called
-          ;; self-insert-command and ran post-self-insert-hook recursively.
-          ;; It happened to make electric-indent-mode work automatically with
-          ;; electric-layout-mode (at the cost of re-indenting lines
-          ;; multiple times), but I'm not sure it's what we want.
-          ;;
-          ;; FIXME: check eolp before inserting \n?
-          (`before (goto-char (1- pos)) (skip-chars-backward " \t")
-                   (unless (bolp) (insert "\n")))
-          (`after  (insert "\n"))
-          (`after-stay (save-excursion
-                         (let ((electric-layout-rules nil))
-                           (newline 1 t))))
-          (`around (save-excursion
-                     (goto-char (1- pos)) (skip-chars-backward " \t")
-                     (unless (bolp) (insert "\n")))
-                   (insert "\n")))      ; FIXME: check eolp before inserting 
\n?
-        (goto-char end)))))
+      (goto-char pos)
+      (when (functionp rule) (setq rule (funcall rule)))
+      (dolist (sym (if (symbolp rule) (list rule) rule))
+        (let* ((nl-after
+                (lambda ()
+                  ;; FIXME: we use `newline', which calls
+                  ;; `self-insert-command' and ran
+                  ;; `post-self-insert-hook' recursively.  It happened
+                  ;; to make `electric-indent-mode' work automatically
+                  ;; with `electric-layout-mode' (at the cost of
+                  ;; re-indenting lines multiple times), but I'm not
+                  ;; sure it's what we want.
+                  ;;
+                  ;; address@hidden/02/22: Indeed in the case of `before'
+                  ;; newlines, re-indentation is prevented.
+                  ;;
+                  ;; FIXME: when `newline'ing, we exceptionally
+                  ;; prevent a specific behaviour of
+                  ;; `eletric-pair-mode', that of opening an extra
+                  ;; newline between newly inserted matching paris.
+                  ;; In theory that behaviour should be provided by
+                  ;; `electric-layout-mode' instead, which should be
+                  ;; possible given the current API.
+                  ;;
+                  ;; FIXME: check eolp before inserting \n?
+                  (let ((electric-layout-mode nil)
+                        (electric-pair-open-newline-between-pairs nil))
+                    (newline 1 t))))
+               (nl-before
+                (lambda ()
+                  (save-excursion
+                    (goto-char (1- pos))
+                    ;; Normally, we don't duplicate newlines, but when
+                    ;; we're being called for i.e. a closer brace for
+                    ;; `electric-pair-mode' generally make sense.  So
+                    ;; consult `electric-layout-allow-duplicate-newlines'
+                    (unless (and (not electric-layout-allow-duplicate-newlines)
+                                 (progn (skip-chars-backward " \t")
+                                        (bolp)))
+                      ;; FIXME: address@hidden/03/22: Make sure the `before'
+                      ;; newline being inserted here does not trigger
+                      ;; reindentation.  It doesn't seem to be our job
+                      ;; to do so and it break with `cc-mode's
+                      ;; indentation function.  Later on we can add a
+                      ;; before-and-maybe-indent, or if the user
+                      ;; really wants to reindent, then
+                      ;; `last-command-event' should be in
+                      ;; `electric-indent-chars'.
+                      (let ((electric-indent-inhibit t))
+                        (funcall nl-after)))))))
+            (pcase sym
+              ('before (funcall nl-before))
+              ('after  (funcall nl-after))
+              ('after-stay (save-excursion (funcall nl-after)))
+              ('around (funcall nl-before) (funcall nl-after))))))))
 
 (put 'electric-layout-post-self-insert-function 'priority  40)
 
@@ -419,6 +488,19 @@ The variable `electric-layout-rules' says when and how to 
insert newlines."
          (remove-hook 'post-self-insert-hook
                       #'electric-layout-post-self-insert-function))))
 
+;;;###autoload
+(define-minor-mode electric-layout-local-mode
+  "Toggle `electric-layout-mode' only in this buffer."
+  :variable (buffer-local-value 'electric-layout-mode (current-buffer))
+  (cond
+   ((eq electric-layout-mode (default-value 'electric-layout-mode))
+    (kill-local-variable 'electric-layout-mode))
+   ((not (default-value 'electric-layout-mode))
+    ;; Locally enabled, but globally disabled.
+    (electric-layout-mode 1)             ; Setup the hooks.
+    (setq-default electric-layout-mode nil) ; But keep it globally disabled.
+    )))
+
 ;;; Electric quoting.
 
 (defcustom electric-quote-comment t
diff --git a/lisp/elide-head.el b/lisp/elide-head.el
index d43a40d..82d0819 100644
--- a/lisp/elide-head.el
+++ b/lisp/elide-head.el
@@ -1,6 +1,6 @@
 ;;; elide-head.el --- hide headers in files
 
-;; Copyright (C) 1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;; Keywords: outlines tools
diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el
index 04d2fbf..2034f33 100644
--- a/lisp/emacs-lisp/advice.el
+++ b/lisp/emacs-lisp/advice.el
@@ -1,6 +1,6 @@
 ;;; advice.el --- An overloading mechanism for Emacs Lisp functions  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993-1994, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Hans Chalupsky <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/emacs-lisp/autoload.el b/lisp/emacs-lisp/autoload.el
index c9ee532..19e1e93 100644
--- a/lisp/emacs-lisp/autoload.el
+++ b/lisp/emacs-lisp/autoload.el
@@ -1,6 +1,6 @@
 ;; autoload.el --- maintain autoloads in loaddefs.el  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1991-1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991-1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Roland McGrath <address@hidden>
 ;; Keywords: maint
@@ -146,7 +146,7 @@ expression, in which case we want to handle forms 
differently."
                            t))))
         ;; Add the usage form at the end where describe-function-1
         ;; can recover it.
-        (when (listp args) (setq doc (help-add-fundoc-usage doc args)))
+        (when (consp args) (setq doc (help-add-fundoc-usage doc args)))
         ;; (message "autoload of %S" (nth 1 form))
         `(autoload ,(nth 1 form) ,file ,doc ,interactive ,type)))
 
@@ -182,13 +182,13 @@ expression, in which case we want to handle forms 
differently."
       (let* ((macrop (memq car '(defmacro cl-defmacro defmacro*)))
             (name (nth 1 form))
             (args (pcase car
-                     ((or `defun `defmacro
-                          `defun* `defmacro* `cl-defun `cl-defmacro
-                          `define-overloadable-function)
+                     ((or 'defun 'defmacro
+                          'defun* 'defmacro* 'cl-defun 'cl-defmacro
+                          'define-overloadable-function)
                       (nth 2 form))
-                     (`define-skeleton '(&optional str arg))
-                     ((or `define-generic-mode `define-derived-mode
-                          `define-compilation-mode)
+                     ('define-skeleton '(&optional str arg))
+                     ((or 'define-generic-mode 'define-derived-mode
+                          'define-compilation-mode)
                       nil)
                      (_ t)))
             (body (nthcdr (or (function-get car 'doc-string-elt) 3) form))
@@ -1047,7 +1047,7 @@ write its autoloads into the specified file instead."
                        ;; we don't want to depend on whether Emacs was
                        ;; built with or without modules support, nor
                        ;; what is the suffix for the underlying OS.
-                      (unless (string-match "\\.\\(elc\\|\\so\\|dll\\)" suf)
+                      (unless (string-match "\\.\\(elc\\|so\\|dll\\)" suf)
                          (push suf tmp)))
                      (concat "^[^=.].*" (regexp-opt tmp t) "\\'")))
         (files (apply #'nconc
diff --git a/lisp/emacs-lisp/avl-tree.el b/lisp/emacs-lisp/avl-tree.el
index 5031238..d2a3a13 100644
--- a/lisp/emacs-lisp/avl-tree.el
+++ b/lisp/emacs-lisp/avl-tree.el
@@ -1,6 +1,6 @@
 ;;; avl-tree.el --- balanced binary trees, AVL-trees  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1995, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Per Cederqvist <address@hidden>
 ;;         Inge Wallin <address@hidden>
diff --git a/lisp/emacs-lisp/backquote.el b/lisp/emacs-lisp/backquote.el
index c306b1c..5e72dc3 100644
--- a/lisp/emacs-lisp/backquote.el
+++ b/lisp/emacs-lisp/backquote.el
@@ -1,6 +1,6 @@
 ;;; backquote.el --- implement the ` Lisp construct
 
-;; Copyright (C) 1990, 1992, 1994, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1990, 1992, 1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Rick Sladkey <address@hidden>
diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el
index e82d4f5..60d146e 100644
--- a/lisp/emacs-lisp/backtrace.el
+++ b/lisp/emacs-lisp/backtrace.el
@@ -1,6 +1,6 @@
 ;;; backtrace.el --- generic major mode for Elisp backtraces -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell
 ;; Keywords: lisp, tools, maint
diff --git a/lisp/emacs-lisp/benchmark.el b/lisp/emacs-lisp/benchmark.el
index e062a18..5b5cda3 100644
--- a/lisp/emacs-lisp/benchmark.el
+++ b/lisp/emacs-lisp/benchmark.el
@@ -1,6 +1,6 @@
 ;;; benchmark.el --- support for benchmarking code  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love  <address@hidden>
 ;; Keywords: lisp, extensions
@@ -38,7 +38,7 @@
     `(let (,t1)
        (setq ,t1 (current-time))
        ,@forms
-       (float-time (time-subtract nil ,t1)))))
+       (float-time (time-since ,t1)))))
 
 ;;;###autoload
 (defmacro benchmark-run (&optional repetitions &rest forms)
@@ -81,7 +81,7 @@ result.  The overhead of the `lambda's is accounted for."
        (gcs (make-symbol "gcs"))
        (gc (make-symbol "gc"))
        (code (byte-compile `(lambda () ,@forms)))
-       (lambda-code (byte-compile `(lambda ()))))
+       (lambda-code (byte-compile '(lambda ()))))
     `(let ((,gc gc-elapsed)
           (,gcs gcs-done))
        (list ,(if (or (symbolp repetitions) (> repetitions 1))
diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el
index 3124217..33ab2f5 100644
--- a/lisp/emacs-lisp/bindat.el
+++ b/lisp/emacs-lisp/bindat.el
@@ -1,6 +1,6 @@
 ;;; bindat.el --- binary data structure packing and unpacking.
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <address@hidden>
 ;; Assignment name: struct.el
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 4854808..4418c9a 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -1,6 +1,6 @@
 ;;; byte-opt.el --- the optimization passes of the emacs-lisp byte compiler 
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1991, 1994, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 1994, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski <address@hidden>
 ;;     Hallvard Furuseth <address@hidden>
@@ -255,7 +255,7 @@
       (setq fn (or (symbol-function name)
                    (cdr (assq name byte-compile-function-environment)))))
     (pcase fn
-      (`nil
+      ('nil
        (byte-compile-warn "attempt to inline `%s' before it was defined"
                           name)
        form)
@@ -635,7 +635,7 @@
     (setq form (car (last (cdr form)))))
   (cond ((consp form)
          (pcase (car form)
-           (`quote (cadr form))
+           ('quote (cadr form))
            ;; Can't use recursion in a defsubst.
            ;; (`progn (byte-compile-trueconstp (car (last (cdr form)))))
            ))
@@ -649,7 +649,7 @@
     (setq form (car (last (cdr form)))))
   (cond ((consp form)
          (pcase (car form)
-           (`quote (null (cadr form)))
+           ('quote (null (cadr form)))
            ;; Can't use recursion in a defsubst.
            ;; (`progn (byte-compile-nilconstp (car (last (cdr form)))))
            ))
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el
index 5edf5a2..b638b56 100644
--- a/lisp/emacs-lisp/byte-run.el
+++ b/lisp/emacs-lisp/byte-run.el
@@ -1,6 +1,6 @@
 ;;; byte-run.el --- byte-compiler support for inlining  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1992, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski <address@hidden>
 ;;     Hallvard Furuseth <address@hidden>
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 23aa937..ef9f9f3 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1,6 +1,6 @@
 ;;; bytecomp.el --- compilation of Lisp code into byte code -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985-1987, 1992, 1994, 1998, 2000-2018 Free Software
+;; Copyright (C) 1985-1987, 1992, 1994, 1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Jamie Zawinski <address@hidden>
@@ -124,6 +124,7 @@
 (require 'backquote)
 (require 'macroexp)
 (require 'cconv)
+(eval-when-compile (require 'compile))
 ;; Refrain from using cl-lib at run-time here, since it otherwise prevents
 ;; us from emitting warnings when compiling files which use cl-lib without
 ;; requiring it! (bug#30635)
@@ -1044,6 +1045,24 @@ Each function's symbol gets added to 
`byte-compile-noruntime-functions'."
 
 ;;; byte compiler messages
 
+(defun emacs-lisp-compilation-file-name-or-buffer (str)
+  "Return file name or buffer given by STR.
+If STR is a \"normal\" filename, just return it.
+If STR is something like \"Buffer foo.el\", return #<buffer foo.el>
+\(if it is still live) or the string \"foo.el\" otherwise."
+  (if (string-match "Buffer \\(.*\\)\\'" str)
+      (or (get-buffer (match-string-no-properties 1 str))
+          (match-string-no-properties 1 str))
+    str))
+
+(defconst emacs-lisp-compilation-parse-errors-filename-function
+  'emacs-lisp-compilation-file-name-or-buffer
+  "The value for `compilation-parse-errors-filename-function' for when
+we go into emacs-lisp-compilation-mode.")
+
+(define-compilation-mode emacs-lisp-compilation-mode "elisp-compile"
+  "The variant of `compilation-mode' used for emacs-lisp error buffers")
+
 (defvar byte-compile-current-form nil)
 (defvar byte-compile-dest-file nil)
 (defvar byte-compile-current-file nil)
@@ -1273,10 +1292,10 @@ Return nil if such is not found."
               (insert "\f\nCompiling "
                       (if (stringp byte-compile-current-file)
                           (concat "file " byte-compile-current-file)
-                        (concat "buffer "
+                        (concat "in buffer "
                                  (buffer-name byte-compile-current-file)))
                       " at " (current-time-string) "\n")
-            (insert "\f\nCompiling no file at " (current-time-string) "\n"))
+            (insert "\f\nCompiling internal form(s) at " (current-time-string) 
"\n"))
           (when dir
             (setq default-directory dir)
             (unless was-same
@@ -1285,7 +1304,8 @@ Return nil if such is not found."
           (setq byte-compile-last-logged-file byte-compile-current-file
                 byte-compile-last-warned-form nil)
           ;; Do this after setting default-directory.
-          (unless (derived-mode-p 'compilation-mode) (compilation-mode))
+          (unless (derived-mode-p 'compilation-mode)
+             (emacs-lisp-compilation-mode))
           (compilation-forget-errors)
           pt))))
 
@@ -1841,8 +1861,8 @@ that already has a `.elc' file."
                                            (file-name-nondirectory source))))
                    (progn (cl-incf
                            (pcase (byte-recompile-file source force arg)
-                             (`no-byte-compile skip-count)
-                             (`t file-count)
+                             ('no-byte-compile skip-count)
+                             ('t file-count)
                              (_ fail-count)))
                           (or noninteractive
                               (message "Checking %s..." directory))
@@ -3414,8 +3434,8 @@ for symbols generated by the byte compiler itself."
         (cl-assert (listp fargs))
         (while fargs
           (pcase (car fargs)
-            (`&optional (setq fargs (cdr fargs)))
-            (`&rest (setq fmax2 (+ (* 2 (length dynbinds)) 1))
+            ('&optional (setq fargs (cdr fargs)))
+            ('&rest (setq fmax2 (+ (* 2 (length dynbinds)) 1))
                     (push (cadr fargs) dynbinds)
                     (setq fargs nil))
             (_ (push (pop fargs) dynbinds))))
@@ -3464,8 +3484,8 @@ for symbols generated by the byte compiler itself."
                 (not (memq var byte-compile-not-obsolete-vars))
                 (not (memq var byte-compile-global-not-obsolete-vars))
                 (or (pcase (nth 1 od)
-                      (`set (not (eq access-type 'reference)))
-                      (`get (eq access-type 'reference))
+                      ('set (not (eq access-type 'reference)))
+                      ('get (eq access-type 'reference))
                       (_ t)))))
         (byte-compile-warn-obsolete var))))
 
@@ -3659,7 +3679,7 @@ If it is nil, then the handler is 
\"byte-compile-SYMBOL.\""
 (byte-defop-compiler (>= byte-geq)     2-and)
 (byte-defop-compiler get               2)
 (byte-defop-compiler nth               2)
-(byte-defop-compiler substring         2-3)
+(byte-defop-compiler substring         1-3)
 (byte-defop-compiler (move-marker byte-set-marker) 2-3)
 (byte-defop-compiler set-marker        2-3)
 (byte-defop-compiler match-beginning   1)
@@ -4888,7 +4908,7 @@ binding slots have been popped."
              arg)
             ;; `lam' is the lambda expression in `fun' (or nil if not
             ;; recognized).
-            ((or `(,(or `quote `function) ,lam) (let lam nil))
+            ((or `(,(or 'quote 'function) ,lam) (let lam nil))
              fun)
             ;; `arglist' is the list of arguments (or t if not recognized).
             ;; `body' is the body of `lam' (or t if not recognized).
@@ -5078,18 +5098,18 @@ invoked interactively."
        (setq byte-compile-call-tree
              (sort byte-compile-call-tree
                    (pcase byte-compile-call-tree-sort
-                      (`callers
+                      ('callers
                        (lambda (x y) (< (length (nth 1 x))
-                                   (length (nth 1 y)))))
-                      (`calls
+                                        (length (nth 1 y)))))
+                      ('calls
                        (lambda (x y) (< (length (nth 2 x))
-                                   (length (nth 2 y)))))
-                      (`calls+callers
+                                        (length (nth 2 y)))))
+                      ('calls+callers
                        (lambda (x y) (< (+ (length (nth 1 x))
-                                      (length (nth 2 x)))
-                                   (+ (length (nth 1 y))
-                                      (length (nth 2 y))))))
-                      (`name
+                                           (length (nth 2 x)))
+                                        (+ (length (nth 1 y))
+                                           (length (nth 2 y))))))
+                      ('name
                        (lambda (x y) (string< (car x) (car y))))
                       (_ (error "`byte-compile-call-tree-sort': `%s' - unknown 
sort mode"
                                 byte-compile-call-tree-sort))))))
diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index bfa6d73..d43d027 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -1,6 +1,6 @@
 ;;; cconv.el --- Closure conversion for statically scoped Emacs lisp. -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Igor Kuzmin <address@hidden>
 ;; Maintainer: address@hidden
@@ -322,7 +322,7 @@ places where they originally did not directly appear."
   ;; so we never touch it(unless we enter to the other closure).
   ;;(if (listp form) (print (car form)) form)
   (pcase form
-    (`(,(and letsym (or `let* `let)) ,binders . ,body)
+    (`(,(and letsym (or 'let* 'let)) ,binders . ,body)
 
                                        ; let and let* special forms
      (let ((binders-new '())
@@ -455,7 +455,7 @@ places where they originally did not directly appear."
     (`(function . ,_) form)
 
                                        ;defconst, defvar
-    (`(,(and sym (or `defconst `defvar)) ,definedsymbol . ,forms)
+    (`(,(and sym (or 'defconst 'defvar)) ,definedsymbol . ,forms)
      `(,sym ,definedsymbol
             . ,(when (consp forms)
                  (cons (cconv-convert (car forms) env extend)
@@ -497,8 +497,8 @@ places where they originally did not directly appear."
                        `((let ((,var (list ,var))) ,@body))))))
              handlers))))
 
-    (`(,(and head (or (and `catch (guard byte-compile--use-old-handlers))
-                      `unwind-protect))
+    (`(,(and head (or (and 'catch (guard byte-compile--use-old-handlers))
+                      'unwind-protect))
        ,form . ,body)
      `(,head ,(cconv-convert form env extend)
         :fun-body ,(cconv--convert-function () body env form)))
@@ -527,7 +527,7 @@ places where they originally did not directly appear."
              `(progn . ,(nreverse prognlist))
            (car prognlist)))))
 
-    (`(,(and (or `funcall `apply) callsym) ,fun . ,args)
+    (`(,(and (or 'funcall 'apply) callsym) ,fun . ,args)
      ;; These are not special forms but we treat them separately for the needs
      ;; of lambda lifting.
      (let ((mapping (cdr (assq fun env))))
@@ -657,7 +657,7 @@ This function does not return anything but instead fills the
 and updates the data stored in ENV."
   (pcase form
                                        ; let special form
-    (`(,(and (or `let* `let) letsym) ,binders . ,body-forms)
+    (`(,(and (or 'let* 'let) letsym) ,binders . ,body-forms)
 
      (let ((orig-env env)
            (newvars nil)
@@ -742,18 +742,18 @@ and updates the data stored in ENV."
                                    form "variable"))))
 
     ;; FIXME: The bytecode for unwind-protect forces us to wrap the unwind.
-    (`(,(or (and `catch (guard byte-compile--use-old-handlers))
-            `unwind-protect)
+    (`(,(or (and 'catch (guard byte-compile--use-old-handlers))
+            'unwind-protect)
        ,form . ,body)
      (cconv-analyze-form form env)
      (cconv--analyze-function () body env form))
 
     (`(defvar ,var) (push var byte-compile-bound-variables))
-    (`(,(or `defconst `defvar) ,var ,value . ,_)
+    (`(,(or 'defconst 'defvar) ,var ,value . ,_)
      (push var byte-compile-bound-variables)
      (cconv-analyze-form value env))
 
-    (`(,(or `funcall `apply) ,fun . ,args)
+    (`(,(or 'funcall 'apply) ,fun . ,args)
      ;; Here we ignore fun because funcall and apply are the only two
      ;; functions where we can pass a candidate for lambda lifting as
      ;; argument.  So, if we see fun elsewhere, we'll delete it from
diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el
index cf1d4ce..9c29297 100644
--- a/lisp/emacs-lisp/chart.el
+++ b/lisp/emacs-lisp/chart.el
@@ -1,6 +1,6 @@
 ;;; chart.el --- Draw charts (bar charts, etc)  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1996, 1998-1999, 2001, 2004-2005, 2007-2018 Free
+;; Copyright (C) 1996, 1998-1999, 2001, 2004-2005, 2007-2019 Free
 ;; Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam  <address@hidden>
@@ -704,7 +704,7 @@ SORT-PRED if desired."
        (cntlst nil))
     (save-excursion
       (goto-char (point-min))
-      (while (re-search-forward "\\-[A-Z][a-z][a-z] +\\(\\w+\\)@\\w+" nil t)
+      (while (re-search-forward "-[A-Z][a-z][a-z] +\\(\\w+\\)@\\w+" nil t)
        (let* ((nam (buffer-substring (match-beginning 1) (match-end 1)))
               (m (member nam nmlst)))
          (message "Scanned username %s" nam)
diff --git a/lisp/emacs-lisp/check-declare.el b/lisp/emacs-lisp/check-declare.el
index 769da3a..8445950 100644
--- a/lisp/emacs-lisp/check-declare.el
+++ b/lisp/emacs-lisp/check-declare.el
@@ -1,6 +1,6 @@
 ;;; check-declare.el --- Check declare-function statements
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Glenn Morris <address@hidden>
 ;; Keywords: lisp, tools, maint
diff --git a/lisp/emacs-lisp/checkdoc.el b/lisp/emacs-lisp/checkdoc.el
index 83929be..fa6f85c 100644
--- a/lisp/emacs-lisp/checkdoc.el
+++ b/lisp/emacs-lisp/checkdoc.el
@@ -1,6 +1,6 @@
 ;;; checkdoc.el --- check documentation strings for style requirements  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Version: 0.6.2
@@ -174,6 +174,7 @@
 (require 'cl-lib)
 (require 'help-mode) ;; for help-xref-info-regexp
 (require 'thingatpt) ;; for handy thing-at-point-looking-at
+(require 'lisp-mnt)
 
 (defvar compilation-error-regexp-alist)
 (defvar compilation-mode-font-lock-keywords)
@@ -884,9 +885,8 @@ a separate buffer."
 ;;;###autoload
 (defun checkdoc-continue (&optional take-notes)
   "Find the next doc string in the current buffer which has a style error.
-Prefix argument TAKE-NOTES means to continue through the whole buffer and
-save warnings in a separate buffer.  Second optional argument START-POINT
-is the starting location.  If this is nil, `point-min' is used instead."
+Prefix argument TAKE-NOTES means to continue through the whole
+buffer and save warnings in a separate buffer."
   (interactive "P")
   (let ((wrong nil) (msg nil)
        ;; Assign a flag to spellcheck flag
@@ -1511,7 +1511,7 @@ may require more formatting")
                                              (line-end-position))))))))
      ;; Continuation of above.  Make sure our sentence is capitalized.
      (save-excursion
-       (skip-chars-forward "\"\\*")
+       (skip-chars-forward "\"*")
        (if (looking-at "[a-z]")
           (if (checkdoc-autofix-ask-replace
                (match-beginning 0) (match-end 0)
@@ -2206,21 +2206,10 @@ News agents may remove it"
 ;;
 (defvar generate-autoload-cookie)
 
-(eval-when-compile (require 'lisp-mnt))        ; expand silly defsubsts
-(declare-function lm-summary "lisp-mnt" (&optional file))
-(declare-function lm-section-start "lisp-mnt" (header &optional after))
-(declare-function lm-section-end "lisp-mnt" (header))
-
 (defun checkdoc-file-comments-engine ()
   "Return a message list if this file does not match the Emacs standard.
 This checks for style only, such as the first line, Commentary:,
 Code:, and others referenced in the style guide."
-  (if (featurep 'lisp-mnt)
-      nil
-    (require 'lisp-mnt)
-    ;; Old XEmacs don't have `lm-commentary-mark'
-    (if (and (not (fboundp 'lm-commentary-mark)) (fboundp 'lm-commentary))
-       (defalias 'lm-commentary-mark #'lm-commentary)))
   (save-excursion
     (let* ((f1 (file-name-nondirectory (buffer-file-name)))
           (fn (file-name-sans-extension f1))
@@ -2281,7 +2270,7 @@ Code:, and others referenced in the style guide."
        (if (or (not checkdoc-force-history-flag)
                (file-exists-p "ChangeLog")
                (file-exists-p "../ChangeLog")
-                (and (fboundp 'lm-history-mark) (funcall #'lm-history-mark)))
+                (lm-history-mark))
            nil
          (progn
            (goto-char (or (lm-commentary-mark) (point-min)))
diff --git a/lisp/emacs-lisp/cl-extra.el b/lisp/emacs-lisp/cl-extra.el
index bea38a0..a2400a0 100644
--- a/lisp/emacs-lisp/cl-extra.el
+++ b/lisp/emacs-lisp/cl-extra.el
@@ -1,6 +1,6 @@
 ;;; cl-extra.el --- Common Lisp features, part 2  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <address@hidden>
 ;; Keywords: extensions
@@ -438,9 +438,7 @@ as an integer unless JUNK-ALLOWED is non-nil."
 ;; Random numbers.
 
 (defun cl--random-time ()
-  (let* ((time (copy-sequence (current-time-string))) (i (length time)) (v 0))
-    (while (>= (cl-decf i) 0) (setq v (+ (* v 3) (aref time i))))
-    v))
+  (car (encode-time nil t)))
 
 ;;;###autoload (autoload 'cl-random-state-p "cl-extra")
 (cl-defstruct (cl--random-state
@@ -484,7 +482,7 @@ Optional second arg STATE is a random-state object."
 If STATE is t, return a new state object seeded from the time of day."
   (unless state (setq state cl--random-state))
   (if (cl-random-state-p state)
-      (copy-tree state t)
+      (copy-sequence state)
     (cl--make-random-state (if (integerp state) state (cl--random-time)))))
 
 ;; Implementation limits.
@@ -576,9 +574,9 @@ too large if positive or too small if negative)."
   "Concatenate, into a sequence of type TYPE, the argument SEQUENCEs.
 \n(fn TYPE SEQUENCE...)"
   (pcase type
-    (`vector (apply #'vconcat sequences))
-    (`string (apply #'concat sequences))
-    (`list (apply #'append (append sequences '(nil))))
+    ('vector (apply #'vconcat sequences))
+    ('string (apply #'concat sequences))
+    ('list (apply #'append (append sequences '(nil))))
     (_ (error "Not a sequence type name: %S" type))))
 
 ;;; List functions.
@@ -596,10 +594,10 @@ too large if positive or too small if negative)."
 ;;;###autoload
 (defun cl-list-length (x)
   "Return the length of list X.  Return nil if list is circular."
-  (let ((n 0) (fast x) (slow x))
-    (while (and (cdr fast) (not (and (eq fast slow) (> n 0))))
-      (setq n (+ n 2) fast (cdr (cdr fast)) slow (cdr slow)))
-    (if fast (if (cdr fast) nil (1+ n)) n)))
+  (cl-check-type x list)
+  (condition-case nil
+      (length x)
+    (circular-list)))
 
 ;;;###autoload
 (defun cl-tailp (sublist list)
@@ -742,7 +740,7 @@ including `cl-block' and `cl-eval-when'."
 (with-eval-after-load 'find-func
   (defvar find-function-regexp-alist)
   (add-to-list 'find-function-regexp-alist
-               `(define-type . cl--typedef-regexp)))
+               '(define-type . cl--typedef-regexp)))
 
 (define-button-type 'cl-help-type
   :supertype 'help-function-def
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el
index 0da434d..a25221c 100644
--- a/lisp/emacs-lisp/cl-generic.el
+++ b/lisp/emacs-lisp/cl-generic.el
@@ -1,6 +1,6 @@
 ;;; cl-generic.el --- CLOS-style generic functions for Elisp  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Version: 1.0
@@ -940,7 +940,7 @@ MET-NAME is as returned by `cl--generic-load-hist-format'."
   (add-to-list 'find-function-regexp-alist
                `(cl-defmethod . ,#'cl--generic-search-method))
   (add-to-list 'find-function-regexp-alist
-               `(cl-defgeneric . cl--generic-find-defgeneric-regexp)))
+               '(cl-defgeneric . cl--generic-find-defgeneric-regexp)))
 
 (defun cl--generic-method-info (method)
   (let* ((specializers (cl--generic-method-specializers method))
diff --git a/lisp/emacs-lisp/cl-indent.el b/lisp/emacs-lisp/cl-indent.el
index 73b9172..10af440 100644
--- a/lisp/emacs-lisp/cl-indent.el
+++ b/lisp/emacs-lisp/cl-indent.el
@@ -1,6 +1,6 @@
 ;;; cl-indent.el --- Enhanced lisp-indent mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1987, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1987, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Richard Mlynarik <address@hidden>
 ;; Created: July 1987
diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el
index 592235d..3a9280f 100644
--- a/lisp/emacs-lisp/cl-lib.el
+++ b/lisp/emacs-lisp/cl-lib.el
@@ -1,6 +1,6 @@
 ;;; cl-lib.el --- Common Lisp extensions for Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <address@hidden>
 ;; Version: 1.0
@@ -365,13 +365,6 @@ SEQ, this is like `mapcar'.  With several, it is like the 
Common Lisp
 (cl--defalias 'cl-second 'cadr)
 (cl--defalias 'cl-rest 'cdr)
 
-(defun cl-endp (x)
-  "Return true if X is the empty list; false if it is a cons.
-Signal an error if X is not a list."
-  (if (listp x)
-      (null x)
-    (signal 'wrong-type-argument (list 'listp x 'x))))
-
 (cl--defalias 'cl-third 'cl-caddr "Return the third element of the list X.")
 (cl--defalias 'cl-fourth 'cl-cadddr "Return the fourth element of the list X.")
 
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 47afc72..6803e71 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -1,6 +1,6 @@
 ;;; cl-macs.el --- Common Lisp macros  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <address@hidden>
 ;; Old-Version: 2.02
@@ -1932,7 +1932,7 @@ Labels have lexical scope and dynamic extent."
           (push (nreverse block) blocks)
           (setq block (list label-or-stmt))))
       (unless (eq 'go (car-safe (car-safe block)))
-        (push `(go cl--exit) block))
+        (push '(go cl--exit) block))
       (push (nreverse block) blocks))
     (let ((catch-tag (make-symbol "cl--tagbody-tag"))
           (cl--tagbody-alist cl--tagbody-alist))
@@ -2215,7 +2215,7 @@ of `cl-symbol-macrolet' to additionally expand symbol 
macros."
             ;; The behavior of CL made sense in a dynamically scoped
             ;; language, but nowadays, lexical scoping semantics is more often
             ;; expected.
-            (`(,(or `let `let*) . ,(or `(,bindings . ,body) dontcare))
+            (`(,(or 'let 'let*) . ,(or `(,bindings . ,body) dontcare))
              (let ((nbs ()) (found nil))
                (dolist (binding bindings)
                  (let* ((var (if (symbolp binding) binding (car binding)))
@@ -3056,7 +3056,7 @@ the form NAME which is a shorthand for (NAME NAME)."
 
 (defun cl--defstruct-predicate (type)
   (let ((cons (assq (cl-struct-sequence-type type)
-                    `((list . consp)
+                    '((list . consp)
                       (vector . vectorp)
                       (nil . recordp)))))
     (if cons
@@ -3390,7 +3390,7 @@ The type name can then be used in `cl-typecase', 
`cl-check-type', etc."
      (put ',name 'cl-deftype-handler
           (cl-function (lambda (&cl-defs ('*) ,@arglist) ,@body)))))
 
-(cl-deftype extended-char () `(and character (not base-char)))
+(cl-deftype extended-char () '(and character (not base-char)))
 
 ;;; Additional functions that we can now define because we've defined
 ;;; `cl-defsubst' and `cl-typep'.
diff --git a/lisp/emacs-lisp/cl-preloaded.el b/lisp/emacs-lisp/cl-preloaded.el
index 2a70f9b..4bd22fa 100644
--- a/lisp/emacs-lisp/cl-preloaded.el
+++ b/lisp/emacs-lisp/cl-preloaded.el
@@ -1,6 +1,6 @@
 ;;; cl-preloaded.el --- Preloaded part of the CL library  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Package: emacs
diff --git a/lisp/emacs-lisp/cl-print.el b/lisp/emacs-lisp/cl-print.el
index c63f5ac..5fe3dd1 100644
--- a/lisp/emacs-lisp/cl-print.el
+++ b/lisp/emacs-lisp/cl-print.el
@@ -1,6 +1,6 @@
 ;;; cl-print.el --- CL-style generic printing  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords:
diff --git a/lisp/emacs-lisp/cl-seq.el b/lisp/emacs-lisp/cl-seq.el
index 60cccd0..3eb6ea1 100644
--- a/lisp/emacs-lisp/cl-seq.el
+++ b/lisp/emacs-lisp/cl-seq.el
@@ -1,6 +1,6 @@
 ;;; cl-seq.el --- Common Lisp features, part 3  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <address@hidden>
 ;; Old-Version: 2.02
@@ -113,6 +113,13 @@
 (defvar cl-key)
 
 ;;;###autoload
+(defun cl-endp (x)
+  "Return true if X is the empty list; false if it is a cons.
+Signal an error if X is not a list."
+  (cl-check-type x list)
+  (null x))
+
+;;;###autoload
 (defun cl-reduce (cl-func cl-seq &rest cl-keys)
   "Reduce two-argument FUNCTION across SEQ.
 \nKeywords supported:  :start :end :from-end :initial-value :key
diff --git a/lisp/emacs-lisp/cl.el b/lisp/emacs-lisp/cl.el
index f664315..71be1d1 100644
--- a/lisp/emacs-lisp/cl.el
+++ b/lisp/emacs-lisp/cl.el
@@ -1,6 +1,6 @@
 ;;; cl.el --- Compatibility aliases for the old CL library.  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: extensions
diff --git a/lisp/emacs-lisp/copyright.el b/lisp/emacs-lisp/copyright.el
index 2f29c19..2726bbc 100644
--- a/lisp/emacs-lisp/copyright.el
+++ b/lisp/emacs-lisp/copyright.el
@@ -1,6 +1,6 @@
 ;;; copyright.el --- update the copyright notice in current buffer
 
-;; Copyright (C) 1991-1995, 1998, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1991-1995, 1998, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Daniel Pfeiffer <address@hidden>
diff --git a/lisp/emacs-lisp/crm.el b/lisp/emacs-lisp/crm.el
index 3ec0bd8..40567e1 100644
--- a/lisp/emacs-lisp/crm.el
+++ b/lisp/emacs-lisp/crm.el
@@ -1,6 +1,6 @@
 ;;; crm.el --- read multiple strings with completion
 
-;; Copyright (C) 1985-1986, 1993-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1993-2019 Free Software Foundation, Inc.
 
 ;; Author: Sen Nagata <address@hidden>
 ;; Keywords: completion, minibuffer, multiple elements
diff --git a/lisp/emacs-lisp/cursor-sensor.el b/lisp/emacs-lisp/cursor-sensor.el
index 7e3088d..66b940f 100644
--- a/lisp/emacs-lisp/cursor-sensor.el
+++ b/lisp/emacs-lisp/cursor-sensor.el
@@ -1,6 +1,6 @@
 ;;; cursor-sensor.el --- React to cursor movement  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords:
@@ -22,17 +22,50 @@
 
 ;;; Commentary:
 
-;; This package implements the `cursor-intangible' property, which is
-;; meant to replace the old `intangible' property.  To use it, just enable the
-;; `cursor-intangible-mode', after which this package will move point away from
-;; any position that has a non-nil `cursor-intangible' property.  This is only
-;; done just before redisplay happens, contrary to the old `intangible'
-;; property which was done at a much lower level.
+;; This package implements the `cursor-intangible' and
+;; `cursor-sensor-functions' properties, which are meant to replace
+;; the old `intangible', `point-entered', and `point-left' properties.
+
+;; To use `cursor-intangible', just enable the
+;; `cursor-intangible-mode' minor mode, after which this package will
+;; move point away from any position that has a non-nil
+;; `cursor-intangible' property.  This is only done just before
+;; redisplay happens, contrary to the old `intangible' property which
+;; was done at a much lower level.
+
+;; To use `cursor-sensor-functions', enable the `cursor-sensor-mode'
+;; minor mode, after which the `cursor-sensor-functions' will be
+;; called just before redisplay happens, according to the movement of
+;; the cursor since the last redisplay.
+
+;;;; Motivation
+
+;; The old properties were very problematic in practice because they
+;; operate at a much lower level and hence affect all motion
+;; *functions* like goto-char, forward-char, ... hence breaking
+;; invariants like:
+;;
+;;    (forward-char N) == (progn (forward-char N1) (forward-char (- N N1)))
+;;    (point) == (progn (forward-char N) (forward-char -N) (point))
+;;    (+ N (point)) == (progn (forward-char N) (point))
+;;
+;; The problems would usually show up due to interaction between
+;; unrelated code working in the same buffer, where one code used those
+;; properties and the other (unknowingly) assumed those aren't used.
+;; In practice a *lot* of code assumes there's no such funny business.
+;;
+;; Worse: all(?) packages using those properties don't actually want those
+;; properties to affect motion at such a low-level, they only want to
+;; affect the overall effect of commands, but not the effect of every
+;; single point-motion that a given command happened to use internally.
 
 ;;; Code:
 
 ;;;###autoload
-(defvar cursor-sensor-inhibit nil)
+(defvar cursor-sensor-inhibit nil
+  "When non-nil, suspend `cursor-sensor-mode' and `cursor-intangible-mode'.
+By convention, this is a list of symbols where each symbol stands for the
+\"cause\" of the suspension.")
 
 (defun cursor-sensor--intangible-p (pos)
   (let ((p (get-pos-property pos 'cursor-intangible)))
@@ -127,7 +160,7 @@
         (setcdr old nil))
       (if (or (and (null new) (null (cdr old)))
               (and (eq new (cdr old))
-                   (eq (next-single-property-change
+                   (eq (next-single-char-property-change
                         start 'cursor-sensor-functions nil end)
                        end)))
           ;; Clearly nothing to do.
@@ -139,7 +172,7 @@
                   (let ((pos start)
                         (missing nil))
                     (while (< pos end)
-                      (setq pos (next-single-property-change
+                      (setq pos (next-single-char-property-change
                                  pos 'cursor-sensor-functions
                                  nil end))
                       (unless (memq f (get-char-property
diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el
index 7fc2b41..8989aa0 100644
--- a/lisp/emacs-lisp/debug.el
+++ b/lisp/emacs-lisp/debug.el
@@ -1,6 +1,6 @@
 ;;; debug.el --- debuggers and related commands for Emacs  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1994, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1985-1986, 1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: address@hidden
@@ -236,14 +236,37 @@ first will be printed into the backtrace buffer."
                ;; Place an extra debug-on-exit for macro's.
                (when (eq 'lambda (car-safe (cadr (backtrace-frame 4))))
                  (backtrace-debug 5 t)))
+              (with-current-buffer debugger-buffer
+                (unless (derived-mode-p 'debugger-mode)
+                 (debugger-mode))
+               (debugger-setup-buffer debugger-args)
+               (when noninteractive
+                 ;; If the backtrace is long, save the beginning
+                 ;; and the end, but discard the middle.
+                 (when (> (count-lines (point-min) (point-max))
+                          debugger-batch-max-lines)
+                   (goto-char (point-min))
+                   (forward-line (/ 2 debugger-batch-max-lines))
+                   (let ((middlestart (point)))
+                     (goto-char (point-max))
+                     (forward-line (- (/ 2 debugger-batch-max-lines)
+                                      debugger-batch-max-lines))
+                     (delete-region middlestart (point)))
+                   (insert "...\n"))
+                 (goto-char (point-min))
+                 (message "%s" (buffer-string))
+                 (kill-emacs -1)))
              (pop-to-buffer
               debugger-buffer
               `((display-buffer-reuse-window
-                 display-buffer-in-previous-window)
-                . (,(when (and (window-live-p debugger-previous-window)
-                               (frame-visible-p
-                                (window-frame debugger-previous-window)))
-                      `(previous-window . ,debugger-previous-window)))))
+                 display-buffer-in-previous-window
+                 display-buffer-below-selected)
+                . ((window-min-height . 10)
+                    (window-height . fit-window-to-buffer)
+                   ,@(when (and (window-live-p debugger-previous-window)
+                                (frame-visible-p
+                                 (window-frame debugger-previous-window)))
+                       `((previous-window . ,debugger-previous-window))))))
              (setq debugger-window (selected-window))
              (if (eq debugger-previous-window debugger-window)
                  (when debugger-jumping-flag
@@ -256,25 +279,6 @@ first will be printed into the backtrace buffer."
                            (window-total-height debugger-window)))
                      (error nil)))
                (setq debugger-previous-window debugger-window))
-              (unless (derived-mode-p 'debugger-mode)
-               (debugger-mode))
-             (debugger-setup-buffer debugger-args)
-             (when noninteractive
-               ;; If the backtrace is long, save the beginning
-               ;; and the end, but discard the middle.
-               (when (> (count-lines (point-min) (point-max))
-                        debugger-batch-max-lines)
-                 (goto-char (point-min))
-                 (forward-line (/ 2 debugger-batch-max-lines))
-                 (let ((middlestart (point)))
-                   (goto-char (point-max))
-                   (forward-line (- (/ 2 debugger-batch-max-lines)
-                                    debugger-batch-max-lines))
-                   (delete-region middlestart (point)))
-                 (insert "...\n"))
-               (goto-char (point-min))
-               (message "%s" (buffer-string))
-               (kill-emacs -1))
              (message "")
              (let ((standard-output nil)
                    (buffer-read-only t))
@@ -354,26 +358,26 @@ Include the reason for debugger entry from ARGS."
   (pcase (car args)
     ;; lambda is for debug-on-call when a function call is next.
     ;; debug is for debug-on-entry function called.
-    ((or `lambda `debug)
+    ((or 'lambda 'debug)
      (insert "--entering a function:\n"))
     ;; Exiting a function.
-    (`exit
+    ('exit
      (insert "--returning value: ")
      (insert (backtrace-print-to-string debugger-value))
      (insert ?\n))
     ;; Watchpoint triggered.
-    ((and `watchpoint (let `(,symbol ,newval . ,details) (cdr args)))
+    ((and 'watchpoint (let `(,symbol ,newval . ,details) (cdr args)))
      (insert
       "--"
       (pcase details
-        (`(makunbound nil) (format "making %s void" symbol))
+        ('(makunbound nil) (format "making %s void" symbol))
         (`(makunbound ,buffer) (format "killing local value of %s in buffer %s"
                                        symbol buffer))
         (`(defvaralias ,_) (format "aliasing %s to %s" symbol newval))
         (`(let ,_) (format "let-binding %s to %s" symbol
                            (backtrace-print-to-string newval)))
         (`(unlet ,_) (format "ending let-binding of %s" symbol))
-        (`(set nil) (format "setting %s to %s" symbol
+        ('(set nil) (format "setting %s to %s" symbol
                             (backtrace-print-to-string newval)))
         (`(set ,buffer) (format "setting %s in buffer %s to %s"
                                 symbol buffer
@@ -382,12 +386,12 @@ Include the reason for debugger entry from ARGS."
       ": ")
      (insert ?\n))
     ;; Debugger entered for an error.
-    (`error
+    ('error
      (insert "--Lisp error: ")
      (insert (backtrace-print-to-string (nth 1 args)))
      (insert ?\n))
     ;; debug-on-call, when the next thing is an eval.
-    (`t
+    ('t
      (insert "--beginning evaluation of function call form:\n"))
     ;; User calls debug directly.
     (_
@@ -740,7 +744,7 @@ This function is called when SYMBOL's value is modified."
 
 When called interactively, prompt for VARIABLE in the minibuffer.
 
-This works by calling `add-variable-watch' on VARIABLE.  If you
+This works by calling `add-variable-watcher' on VARIABLE.  If you
 quit from the debugger, this will abort the change (unless the
 change is caused by the termination of a let-binding).
 
diff --git a/lisp/emacs-lisp/derived.el b/lisp/emacs-lisp/derived.el
index 483d6fb..6db0584 100644
--- a/lisp/emacs-lisp/derived.el
+++ b/lisp/emacs-lisp/derived.el
@@ -1,7 +1,7 @@
 ;;; derived.el --- allow inheritance of major modes
 ;; (formerly mode-clone.el)
 
-;; Copyright (C) 1993-1994, 1999, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1993-1994, 1999, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: David Megginson (address@hidden)
diff --git a/lisp/emacs-lisp/disass.el b/lisp/emacs-lisp/disass.el
index 53f9b66..3fc2224 100644
--- a/lisp/emacs-lisp/disass.el
+++ b/lisp/emacs-lisp/disass.el
@@ -1,6 +1,6 @@
 ;;; disass.el --- disassembler for compiled Emacs Lisp code  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1986, 1991, 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 1991, 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Doug Cutting <address@hidden>
 ;;     Jamie Zawinski <address@hidden>
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index d74c3dd..be531aa 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -1,6 +1,6 @@
 ;;; easy-mmode.el --- easy definition for major and minor modes
 
-;; Copyright (C) 1997, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Georges Brun-Cottan <address@hidden>
 ;; Maintainer: Stefan Monnier <address@hidden>
@@ -411,12 +411,6 @@ on if the hook has explicitly disabled it."
        (:global (setq keys (cdr keys)))
        (_ (push keyw extra-keywords) (push (pop keys) extra-keywords))))
 
-    (unless group
-      ;; We might as well provide a best-guess default group.
-      (setq group
-           `(:group ',(intern (replace-regexp-in-string
-                               "-mode\\'" "" (symbol-name mode))))))
-
     `(progn
        (progn
          :autoload-end
@@ -624,15 +618,15 @@ BODY is executed after moving to the destination 
location."
          (when-narrowed
           (lambda (body)
             (if (null narrowfun) body
-              `(let ((was-narrowed
-                      (prog1 (or (< (- (point-max) (point-min)) (buffer-size)))
-                        (widen))))
+              `(let ((was-narrowed (prog1 (buffer-narrowed-p) (widen))))
                  ,body
                  (when was-narrowed (funcall #',narrowfun)))))))
     (unless name (setq name base-name))
+    ;; FIXME: Move most of those functions's bodies to helper functions!
     `(progn
        (defun ,next-sym (&optional count)
-        ,(format "Go to the next COUNT'th %s." name)
+        ,(format "Go to the next COUNT'th %s.
+Interactively, COUNT is the prefix numeric argument, and defaults to 1." name)
         (interactive "p")
         (unless count (setq count 1))
         (if (< count 0) (,prev-sym (- count))
@@ -650,11 +644,17 @@ BODY is executed after moving to the destination 
location."
                                         `(re-search-forward ,re nil t 2)))
                                    (point-max))))
                     (unless (pos-visible-in-window-p endpt nil t)
-                      (recenter '(0)))))))
+                      (let ((ws (window-start)))
+                        (recenter '(0))
+                        (if (< (window-start) ws)
+                            ;; recenter scrolled in the wrong direction!
+                            (set-window-start nil ws))))))))
            ,@body))
        (put ',next-sym 'definition-name ',base)
        (defun ,prev-sym (&optional count)
-        ,(format "Go to the previous COUNT'th %s" (or name base-name))
+        ,(format "Go to the previous COUNT'th %s.
+Interactively, COUNT is the prefix numeric argument, and defaults to 1."
+                  (or name base-name))
         (interactive "p")
         (unless count (setq count 1))
         (if (< count 0) (,next-sym (- count))
diff --git a/lisp/emacs-lisp/easymenu.el b/lisp/emacs-lisp/easymenu.el
index 403829a..5bf046d 100644
--- a/lisp/emacs-lisp/easymenu.el
+++ b/lisp/emacs-lisp/easymenu.el
@@ -1,6 +1,6 @@
 ;;; easymenu.el --- support the easymenu interface for defining a menu  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1994, 1996, 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1996, 1998-2019 Free Software Foundation, Inc.
 
 ;; Keywords: emulations
 ;; Author: Richard Stallman <address@hidden>
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 15f68a6..8b4cb1a 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -1,6 +1,6 @@
 ;;; edebug.el --- a source-level debugger for Emacs Lisp  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 1988-1995, 1997, 1999-2018 Free Software Foundation,
+;; Copyright (C) 1988-1995, 1997, 1999-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Daniel LaLiberte <address@hidden>
@@ -192,11 +192,11 @@ Use this with caution since it is not debugged."
 
 (defcustom edebug-print-length 50
   "If non-nil, default value of `print-length' for printing results in Edebug."
-  :type 'integer
+  :type '(choice integer (const nil))
   :group 'edebug)
 (defcustom edebug-print-level 50
   "If non-nil, default value of `print-level' for printing results in Edebug."
-  :type 'integer
+  :type '(choice integer (const nil))
   :group 'edebug)
 (defcustom edebug-print-circle t
   "If non-nil, default value of `print-circle' for printing results in Edebug."
@@ -3602,9 +3602,7 @@ Return the result of the last expression."
   "Evaluate an expression in the outside environment.
 If interactive, prompt for the expression.
 Print result in minibuffer."
-  (interactive (list (read-from-minibuffer
-                     "Eval: " nil read-expression-map t
-                     'read-expression-history)))
+  (interactive (list (read--expression "Eval: ")))
   (princ
    (edebug-outside-excursion
     (setq values (cons (edebug-eval expr) values))
diff --git a/lisp/emacs-lisp/eieio-base.el b/lisp/emacs-lisp/eieio-base.el
index 75709dd..3a01098 100644
--- a/lisp/emacs-lisp/eieio-base.el
+++ b/lisp/emacs-lisp/eieio-base.el
@@ -1,6 +1,6 @@
 ;;; eieio-base.el --- Base classes for EIEIO.  -*- lexical-binding:t -*-
 
-;;; Copyright (C) 2000-2002, 2004-2005, 2007-2018 Free Software
+;;; Copyright (C) 2000-2002, 2004-2005, 2007-2019 Free Software
 ;;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam  <address@hidden>
diff --git a/lisp/emacs-lisp/eieio-compat.el b/lisp/emacs-lisp/eieio-compat.el
index e048d0e..ea5a283 100644
--- a/lisp/emacs-lisp/eieio-compat.el
+++ b/lisp/emacs-lisp/eieio-compat.el
@@ -1,6 +1,6 @@
 ;;; eieio-compat.el --- Compatibility with Older EIEIO versions  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1995-1996, 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1996, 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: OO, lisp
@@ -182,11 +182,11 @@ Summary:
           ;; `no-applicable-method', which have slightly different calling
           ;; convention than their cl-generic counterpart.
           (pcase method
-            (`no-next-method
+            ('no-next-method
              (setq method 'cl-no-next-method)
              (setq specializers `(generic method ,@specializers))
              (lambda (_generic _method &rest args) (apply code args)))
-            (`no-applicable-method
+            ('no-applicable-method
              (setq method 'cl-no-applicable-method)
              (setq specializers `(generic ,@specializers))
              (lambda (generic arg &rest args)
diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el
index 1e9555c..400dc3b 100644
--- a/lisp/emacs-lisp/eieio-core.el
+++ b/lisp/emacs-lisp/eieio-core.el
@@ -1,6 +1,6 @@
 ;;; eieio-core.el --- Core implementation for eieio  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1995-1996, 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1996, 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Version: 1.4
diff --git a/lisp/emacs-lisp/eieio-custom.el b/lisp/emacs-lisp/eieio-custom.el
index 3ee5a29..e018883 100644
--- a/lisp/emacs-lisp/eieio-custom.el
+++ b/lisp/emacs-lisp/eieio-custom.el
@@ -1,6 +1,6 @@
 ;;; eieio-custom.el -- eieio object customization  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2001, 2005, 2007-2018 Free Software Foundation,
+;; Copyright (C) 1999-2001, 2005, 2007-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/lisp/emacs-lisp/eieio-datadebug.el 
b/lisp/emacs-lisp/eieio-datadebug.el
index f309117..df17e81 100644
--- a/lisp/emacs-lisp/eieio-datadebug.el
+++ b/lisp/emacs-lisp/eieio-datadebug.el
@@ -1,6 +1,6 @@
 ;;; eieio-datadebug.el --- EIEIO extensions to the data debugger.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: OO, lisp
diff --git a/lisp/emacs-lisp/eieio-opt.el b/lisp/emacs-lisp/eieio-opt.el
index eeb0bc9..193f92b 100644
--- a/lisp/emacs-lisp/eieio-opt.el
+++ b/lisp/emacs-lisp/eieio-opt.el
@@ -1,6 +1,6 @@
 ;;; eieio-opt.el -- eieio optional functions (debug, printing, speedbar)
 
-;; Copyright (C) 1996, 1998-2003, 2005, 2008-2018 Free Software
+;; Copyright (C) 1996, 1998-2003, 2005, 2008-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
@@ -327,7 +327,7 @@ current expansion depth."
 (defun eieio-sb-expand (text class indent)
   "For button TEXT, expand CLASS at the current location.
 Argument INDENT is the depth of indentation."
-  (cond ((string-match "+" text)       ;we have to expand this file
+  (cond ((string-match "\\+" text)     ;we have to expand this file
         (speedbar-change-expand-button-char ?-)
         (speedbar-with-writable
           (save-excursion
diff --git a/lisp/emacs-lisp/eieio-speedbar.el 
b/lisp/emacs-lisp/eieio-speedbar.el
index 3553e47..2dd9a5e 100644
--- a/lisp/emacs-lisp/eieio-speedbar.el
+++ b/lisp/emacs-lisp/eieio-speedbar.el
@@ -1,6 +1,6 @@
 ;;; eieio-speedbar.el -- Classes for managing speedbar displays.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2002, 2005, 2007-2018 Free Software Foundation,
+;; Copyright (C) 1999-2002, 2005, 2007-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
@@ -348,7 +348,7 @@ The object is at indentation level INDENT."
 (defun eieio-speedbar-object-expand (text token indent)
   "Expand object represented by TEXT.
 TOKEN is the object.  INDENT is the current indentation level."
-  (cond ((string-match "+" text)       ;we have to expand this file
+  (cond ((string-match "\\+" text)     ;we have to expand this file
         (speedbar-change-expand-button-char ?-)
         (oset token expanded t)
         (speedbar-with-writable
diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el
index 84804a0..44f48ef 100644
--- a/lisp/emacs-lisp/eieio.el
+++ b/lisp/emacs-lisp/eieio.el
@@ -1,7 +1,7 @@
 ;;; eieio.el --- Enhanced Implementation of Emacs Interpreted Objects  -*- 
lexical-binding:t -*-
 ;;;              or maybe Eric's Implementation of Emacs Interpreted Objects
 
-;; Copyright (C) 1995-1996, 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1996, 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Version: 1.4
diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 49ba71f..188d99e 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -1,6 +1,6 @@
 ;;; eldoc.el --- Show function arglist or variable docstring in echo area  -*- 
lexical-binding:t; -*-
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Noah Friedman <address@hidden>
 ;; Maintainer: address@hidden
@@ -357,12 +357,15 @@ return any documentation.")
   ;; This is run from post-command-hook or some idle timer thing,
   ;; so we need to be careful that errors aren't ignored.
   (with-demoted-errors "eldoc error: %s"
-    (and (or (eldoc-display-message-p)
-             ;; Erase the last message if we won't display a new one.
-             (when eldoc-last-message
-               (eldoc-message nil)
-               nil))
-        (eldoc-message (funcall eldoc-documentation-function)))))
+    (if (not (eldoc-display-message-p))
+        ;; Erase the last message if we won't display a new one.
+        (when eldoc-last-message
+          (eldoc-message nil))
+      (let ((non-essential t))
+        ;; Only keep looking for the info as long as the user hasn't
+        ;; requested our attention.  This also locally disables inhibit-quit.
+        (while-no-input
+          (eldoc-message (funcall eldoc-documentation-function)))))))
 
 ;; If the entire line cannot fit in the echo area, the symbol name may be
 ;; truncated or eliminated entirely from the output to make room for the
diff --git a/lisp/emacs-lisp/elint.el b/lisp/emacs-lisp/elint.el
index 391d3fd..3f49b51 100644
--- a/lisp/emacs-lisp/elint.el
+++ b/lisp/emacs-lisp/elint.el
@@ -1,6 +1,6 @@
 ;;; elint.el --- Lint Emacs Lisp -*- lexical-binding: t -*-
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Peter Liljenberg <address@hidden>
 ;; Created: May 1997
diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el
index 012e7cf..f0dcb51 100644
--- a/lisp/emacs-lisp/elp.el
+++ b/lisp/emacs-lisp/elp.el
@@ -1,6 +1,6 @@
 ;;; elp.el --- Emacs Lisp Profiler  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1994-1995, 1997-1998, 2001-2018 Free Software
+;; Copyright (C) 1994-1995, 1997-1998, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Barry A. Warsaw
diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el
index a883feb..ee561d5 100644
--- a/lisp/emacs-lisp/ert-x.el
+++ b/lisp/emacs-lisp/ert-x.el
@@ -1,6 +1,6 @@
 ;;; ert-x.el --- Staging area for experimental extensions to ERT  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2008, 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008, 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Lennart Borgman (lennart O borgman A gmail O com)
 ;;         Christian Ohler <address@hidden>
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index eb9695d..20d013b 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -1,6 +1,6 @@
 ;;; ert.el --- Emacs Lisp Regression Testing  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2008, 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2008, 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Christian Ohler <address@hidden>
 ;; Keywords: lisp, tools
@@ -971,7 +971,7 @@ contained in UNIVERSE."
                       test
                       (ert-test-most-recent-result test))))
                 universe))
-    (:unexpected (ert-select-tests `(not :expected) universe))
+    (:unexpected (ert-select-tests '(not :expected) universe))
     ((pred stringp)
      (pcase-exhaustive universe
        (`t (mapcar #'ert-get-test
@@ -1563,7 +1563,8 @@ Ran \\([0-9]+\\) tests, \\([0-9]+\\) results as expected\
       (message "-------")
       (with-temp-buffer
         (dolist (x (list (list skipped "skipped" "SKIPPED")
-                         (list unexpected "unexpected" "FAILED")))
+                         (list unexpected "unexpected"
+                               "\\(?:FAILED\\|PASSED\\)")))
           (mapc (lambda (l)
                   (erase-buffer)
                   (insert-file-contents l)
@@ -1821,13 +1822,13 @@ determines how frequently the progress display is 
updated.")
   (force-mode-line-update)
   (redisplay t)
   (setf (ert--stats-next-redisplay stats)
-        (+ (float-time) ert-test-run-redisplay-interval-secs)))
+       (float-time (time-add nil ert-test-run-redisplay-interval-secs))))
 
 (defun ert--results-update-stats-display-maybe (ewoc stats)
   "Call `ert--results-update-stats-display' if not called recently.
 
 EWOC and STATS are arguments for `ert--results-update-stats-display'."
-  (when (>= (float-time) (ert--stats-next-redisplay stats))
+  (unless (time-less-p nil (ert--stats-next-redisplay stats))
     (ert--results-update-stats-display ewoc stats)))
 
 (defun ert--tests-running-mode-line-indicator ()
diff --git a/lisp/emacs-lisp/ewoc.el b/lisp/emacs-lisp/ewoc.el
index 52d8451..c33b465 100644
--- a/lisp/emacs-lisp/ewoc.el
+++ b/lisp/emacs-lisp/ewoc.el
@@ -1,6 +1,6 @@
 ;;; ewoc.el --- utility to maintain a view of a list of objects in a buffer  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1991-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2019 Free Software Foundation, Inc.
 
 ;; Author: Per Cederqvist <address@hidden>
 ;;     Inge Wallin <address@hidden>
diff --git a/lisp/emacs-lisp/faceup.el b/lisp/emacs-lisp/faceup.el
index bbf4c5d..7527f53 100644
--- a/lisp/emacs-lisp/faceup.el
+++ b/lisp/emacs-lisp/faceup.el
@@ -1,6 +1,6 @@
 ;;; faceup.el --- Markup language for faces and font-lock regression testing  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren
 ;; Version: 0.0.6
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index c542469..b63d4d4 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -1,6 +1,6 @@
 ;;; find-func.el --- find the definition of the Emacs Lisp function near point 
 -*- lexical-binding:t -*-
 
-;; Copyright (C) 1997, 1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Jens Petersen <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/emacs-lisp/float-sup.el b/lisp/emacs-lisp/float-sup.el
index 45933bb..54c8afe 100644
--- a/lisp/emacs-lisp/float-sup.el
+++ b/lisp/emacs-lisp/float-sup.el
@@ -1,6 +1,6 @@
 ;;; float-sup.el --- define some constants useful for floating point numbers.
 
-;; Copyright (C) 1985-1987, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: internal
diff --git a/lisp/emacs-lisp/generator.el b/lisp/emacs-lisp/generator.el
index e38c7d9..3fd66bf 100644
--- a/lisp/emacs-lisp/generator.el
+++ b/lisp/emacs-lisp/generator.el
@@ -1,6 +1,6 @@
 ;;; generator.el --- generators  -*- lexical-binding: t -*-
 
-;;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Daniel Colascione <address@hidden>
 ;; Keywords: extensions, elisp
@@ -213,8 +213,8 @@ don't yield.")
 
     ;; Process `and'.
 
-    (`(and)                             ; (and) -> t
-      (cps--transform-1 t next-state))
+    ('(and)                             ; (and) -> t
+     (cps--transform-1 t next-state))
     (`(and ,condition)                  ; (and CONDITION) -> CONDITION
       (cps--transform-1 condition next-state))
     (`(and ,condition . ,rest)
@@ -246,8 +246,8 @@ don't yield.")
     ;; Process `cond': transform into `if' or `or' depending on the
     ;; precise kind of the condition we're looking at.
 
-    (`(cond)                            ; (cond) -> nil
-      (cps--transform-1 nil next-state))
+    ('(cond)                            ; (cond) -> nil
+     (cps--transform-1 nil next-state))
     (`(cond (,condition) . ,rest)
       (cps--transform-1 `(or ,condition (cond ,@rest))
                         next-state))
@@ -281,14 +281,14 @@ don't yield.")
     ;; Process `progn' and `inline': they are identical except for the
     ;; name, which has some significance to the byte compiler.
 
-    (`(inline) (cps--transform-1 nil next-state))
+    ('(inline) (cps--transform-1 nil next-state))
     (`(inline ,form) (cps--transform-1 form next-state))
     (`(inline ,form . ,rest)
       (cps--transform-1 form
                         (cps--transform-1 `(inline ,@rest)
                                           next-state)))
 
-    (`(progn) (cps--transform-1 nil next-state))
+    ('(progn) (cps--transform-1 nil next-state))
     (`(progn ,form) (cps--transform-1 form next-state))
     (`(progn ,form . ,rest)
       (cps--transform-1 form
@@ -345,7 +345,7 @@ don't yield.")
 
     ;; Process `or'.
 
-    (`(or) (cps--transform-1 nil next-state))
+    ('(or) (cps--transform-1 nil next-state))
     (`(or ,condition) (cps--transform-1 condition next-state))
     (`(or ,condition . ,rest)
       (cps--transform-1
@@ -646,11 +646,11 @@ modified copy."
                          ,(cps--make-close-iterator-form terminal-state)))))
                   (t (error "unknown iterator operation %S" op))))))
          ,(when finalizer-symbol
-                `(funcall iterator
-                          :stash-finalizer
-                          (make-finalizer
-                           (lambda ()
-                             (iter-close iterator)))))
+            '(funcall iterator
+                      :stash-finalizer
+                      (make-finalizer
+                       (lambda ()
+                         (iter-close iterator)))))
          iterator))))
 
 (defun iter-yield (value)
diff --git a/lisp/emacs-lisp/generic.el b/lisp/emacs-lisp/generic.el
index 194fa1e..678d384 100644
--- a/lisp/emacs-lisp/generic.el
+++ b/lisp/emacs-lisp/generic.el
@@ -1,6 +1,6 @@
 ;;; generic.el --- defining simple major modes with comment and font-lock
 ;;
-;; Copyright (C) 1997, 1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2019 Free Software Foundation, Inc.
 ;;
 ;; Author:  Peter Breton <address@hidden>
 ;; Created: Fri Sep 27 1996
diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el
index 704c764..3463bdb 100644
--- a/lisp/emacs-lisp/gv.el
+++ b/lisp/emacs-lisp/gv.el
@@ -1,6 +1,6 @@
 ;;; gv.el --- generalized variables  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: extensions
diff --git a/lisp/emacs-lisp/helper.el b/lisp/emacs-lisp/helper.el
index 58fd17d..d1bd46f 100644
--- a/lisp/emacs-lisp/helper.el
+++ b/lisp/emacs-lisp/helper.el
@@ -1,6 +1,6 @@
 ;;; helper.el --- utility help package supporting help in electric modes
 
-;; Copyright (C) 1985, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
 ;; Maintainer: address@hidden
diff --git a/lisp/emacs-lisp/inline.el b/lisp/emacs-lisp/inline.el
index 865e17e..70dbff2 100644
--- a/lisp/emacs-lisp/inline.el
+++ b/lisp/emacs-lisp/inline.el
@@ -1,6 +1,6 @@
 ;;; inline.el --- Define functions by their inliner  -*- lexical-binding:t; -*-
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 
@@ -259,7 +259,7 @@ See Info node `(elisp)Defining Functions' for more details."
   `(error ,@args))
 
 (defun inline--warning (&rest _args)
-  `(throw 'inline--just-use
+  '(throw 'inline--just-use
           ;; FIXME: This would inf-loop by calling us right back when
           ;; macroexpand-all recurses to expand inline--form.
           ;; (macroexp--warn-and-return (format ,@args)
diff --git a/lisp/emacs-lisp/let-alist.el b/lisp/emacs-lisp/let-alist.el
index 17732bc..dc54342 100644
--- a/lisp/emacs-lisp/let-alist.el
+++ b/lisp/emacs-lisp/let-alist.el
@@ -1,6 +1,6 @@
 ;;; let-alist.el --- Easily let-bind values of an assoc-list by their names 
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <address@hidden>
 ;; Package-Requires: ((emacs "24.1"))
diff --git a/lisp/emacs-lisp/lisp-mnt.el b/lisp/emacs-lisp/lisp-mnt.el
index 5c623a3..91c7615 100644
--- a/lisp/emacs-lisp/lisp-mnt.el
+++ b/lisp/emacs-lisp/lisp-mnt.el
@@ -1,6 +1,6 @@
 ;;; lisp-mnt.el --- utility functions for Emacs Lisp maintainers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1992, 1994, 1997, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1992, 1994, 1997, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric S. Raymond <address@hidden>
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 4619919..30a43d8 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -1,6 +1,6 @@
 ;;; lisp-mode.el --- Lisp mode, and its idiosyncratic commands  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1999-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: lisp, languages
diff --git a/lisp/emacs-lisp/lisp.el b/lisp/emacs-lisp/lisp.el
index 3fda1dd..d10d5f0 100644
--- a/lisp/emacs-lisp/lisp.el
+++ b/lisp/emacs-lisp/lisp.el
@@ -1,6 +1,6 @@
 ;;; lisp.el --- Lisp editing commands for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1994, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1985-1986, 1994, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el
index e69f93c..b966d16 100644
--- a/lisp/emacs-lisp/macroexp.el
+++ b/lisp/emacs-lisp/macroexp.el
@@ -1,6 +1,6 @@
 ;;; macroexp.el --- Additional macro-expansion support -*- lexical-binding: t 
-*-
 ;;
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <address@hidden>
 ;; Keywords: lisp, compiler, macros
@@ -94,7 +94,7 @@ each clause."
       clause)))
 
 (defun macroexp--compiler-macro (handler form)
-  (condition-case err
+  (condition-case-unless-debug err
       (apply handler form (cdr form))
     (error
      (message "Compiler-macro error for %S: %S" (car form) err)
@@ -223,15 +223,15 @@ Assumes the caller has bound 
`macroexpand-all-environment'."
                                         (cddr form))
                         (cdr form))
         form))
-      (`(,(or `defvar `defconst) . ,_) (macroexp--all-forms form 2))
+      (`(,(or 'defvar 'defconst) . ,_) (macroexp--all-forms form 2))
       (`(function ,(and f `(lambda . ,_)))
        (macroexp--cons 'function
                        (macroexp--cons (macroexp--all-forms f 2)
                                        nil
                                        (cdr form))
                        form))
-      (`(,(or `function `quote) . ,_) form)
-      (`(,(and fun (or `let `let*)) . ,(or `(,bindings . ,body) dontcare))
+      (`(,(or 'function 'quote) . ,_) form)
+      (`(,(and fun (or 'let 'let*)) . ,(or `(,bindings . ,body) dontcare))
        (macroexp--cons fun
                        (macroexp--cons (macroexp--all-clauses bindings 1)
                                        (macroexp--all-forms body)
@@ -250,7 +250,7 @@ Assumes the caller has bound `macroexpand-all-environment'."
       ;; here, so that any code that cares about the difference will
       ;; see the same transformation.
       ;; First arg is a function:
-      (`(,(and fun (or `funcall `apply `mapcar `mapatoms `mapconcat `mapc))
+      (`(,(and fun (or 'funcall 'apply 'mapcar 'mapatoms 'mapconcat 'mapc))
          ',(and f `(lambda . ,_)) . ,args)
        (macroexp--warn-and-return
         (nth 1 f)
@@ -258,7 +258,7 @@ Assumes the caller has bound `macroexpand-all-environment'."
                 (list 'lambda (nth 1 f) '...))
         (macroexp--expand-all `(,fun ,f . ,args))))
       ;; Second arg is a function:
-      (`(,(and fun (or `sort)) ,arg1 ',(and f `(lambda . ,_)) . ,args)
+      (`(,(and fun (or 'sort)) ,arg1 ',(and f `(lambda . ,_)) . ,args)
        (macroexp--warn-and-return
         (nth 1 f)
         (format "%s quoted with ' rather than with #'"
@@ -409,7 +409,7 @@ cases where EXP is a constant."
   "Bind each binding in BINDINGS as `macroexp-let2' does."
   (declare (indent 2) (debug (sexp (&rest (sexp form)) body)))
   (pcase-exhaustive bindings
-    (`nil (macroexp-progn body))
+    ('nil (macroexp-progn body))
     (`((,var ,exp) . ,tl)
      `(macroexp-let2 ,test ,var ,exp
         (macroexp-let2* ,test ,tl ,@body)))))
diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el
index a61c0ad..a688330 100644
--- a/lisp/emacs-lisp/map-ynp.el
+++ b/lisp/emacs-lisp/map-ynp.el
@@ -1,6 +1,6 @@
 ;;; map-ynp.el --- general-purpose boolean question-asker  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1991-1995, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991-1995, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Roland McGrath <address@hidden>
 ;; Maintainer: address@hidden
@@ -79,6 +79,7 @@ are meaningful here.
 
 Returns the number of actions taken."
   (let* ((actions 0)
+         (msg (current-message))
         user-keys mouse-event map prompt char elt def
         ;; Non-nil means we should use mouse menus to ask.
         use-menus
@@ -246,9 +247,12 @@ C-g to quit (cancel the whole command);
       (if delayed-switch-frame
          (setq unread-command-events
                (cons delayed-switch-frame unread-command-events))))
-    ;; Clear the last prompt from the minibuffer.
+    ;; Clear the last prompt from the minibuffer, and restore the
+    ;; previous echo-area message, if any.
     (let ((message-log-max nil))
-      (message ""))
+      (if msg
+          (message "%s" msg)
+        (message "")))
     ;; Return the number of actions that were taken.
     actions))
 
@@ -261,7 +265,7 @@ C-g to quit (cancel the whole command);
   "If non-nil, `read-answer' accepts single-character answers.
 If t, accept short (single key-press) answers to the question.
 If nil, require long answers.  If `auto', accept short answers if
-the function cell of `yes-or-no-p' is set to `y-or-on-p'."
+the function cell of `yes-or-no-p' is set to `y-or-n-p'."
   :type '(choice (const :tag "Accept short answers" t)
                  (const :tag "Require long answer" nil)
                  (const :tag "Guess preference" auto))
diff --git a/lisp/emacs-lisp/map.el b/lisp/emacs-lisp/map.el
index 1f6f1ff..54e802e 100644
--- a/lisp/emacs-lisp/map.el
+++ b/lisp/emacs-lisp/map.el
@@ -1,10 +1,11 @@
 ;;; map.el --- Map manipulation functions  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <address@hidden>
 ;; Keywords: convenience, map, hash-table, alist, array
-;; Version: 1.2
+;; Version: 2.0
+;; Package-Requires: ((emacs "25"))
 ;; Package: map
 
 ;; Maintainer: address@hidden
@@ -92,17 +93,21 @@ Returns the result of evaluating the form associated with 
MAP-VAR's type."
     `(cond ((listp ,map-var) ,(plist-get args :list))
            ((hash-table-p ,map-var) ,(plist-get args :hash-table))
            ((arrayp ,map-var) ,(plist-get args :array))
-           (t (error "Unsupported map: %s" ,map-var)))))
+           (t (error "Unsupported map type `%S': %S"
+                     (type-of ,map-var) ,map-var)))))
 
-(defun map-elt (map key &optional default testfn)
+(define-error 'map-not-inplace "Cannot modify map in-place")
+
+(defsubst map--plist-p (list)
+  (and (consp list) (not (listp (car list)))))
+
+(cl-defgeneric map-elt (map key &optional default testfn)
   "Lookup KEY in MAP and return its associated value.
 If KEY is not found, return DEFAULT which defaults to nil.
 
-If MAP is a list, `eql' is used to lookup KEY.  Optional argument
-TESTFN, if non-nil, means use its function definition instead of
-`eql'.
+TESTFN is deprecated.  Its default depends on the MAP argument.
 
-MAP can be a list, hash-table or array."
+In the base definition, MAP can be an alist, hash-table, or array."
   (declare
    (gv-expander
     (lambda (do)
@@ -110,17 +115,23 @@ MAP can be a list, hash-table or array."
         (macroexp-let2* nil
             ;; Eval them once and for all in the right order.
             ((key key) (default default) (testfn testfn))
-          `(if (listp ,mgetter)
-               ;; Special case the alist case, since it can't be handled by the
-               ;; map--put function.
-               ,(gv-get `(alist-get ,key (gv-synthetic-place
-                                          ,mgetter ,msetter)
-                                    ,default nil ,testfn)
-                        do)
-             ,(funcall do `(map-elt ,mgetter ,key ,default)
-                       (lambda (v) `(map--put ,mgetter ,key ,v)))))))))
+          (funcall do `(map-elt ,mgetter ,key ,default)
+                   (lambda (v)
+                     `(condition-case nil
+                          ;; Silence warnings about the hidden 4th arg.
+                          (with-no-warnings (map-put! ,mgetter ,key ,v 
,testfn))
+                        (map-not-inplace
+                         ,(funcall msetter
+                                   `(map-insert ,mgetter ,key ,v))))))))))
+   ;; `testfn' is deprecated.
+   (advertised-calling-convention (map key &optional default) "27.1"))
   (map--dispatch map
-    :list (alist-get key map default nil testfn)
+    :list (if (map--plist-p map)
+              (let ((res (plist-get map key)))
+                (if (and default (null res) (not (plist-member map key)))
+                    default
+                  res))
+            (alist-get key map default nil testfn))
     :hash-table (gethash key map default)
     :array (if (and (>= key 0) (< key (seq-length map)))
                (seq-elt map key)
@@ -133,16 +144,34 @@ with VALUE.
 When MAP is a list, test equality with TESTFN if non-nil, otherwise use `eql'.
 
 MAP can be a list, hash-table or array."
+  (declare (obsolete "use map-put! or (setf (map-elt ...) ...) instead" 
"27.1"))
   `(setf (map-elt ,map ,key nil ,testfn) ,value))
 
-(defun map-delete (map key)
-  "Delete KEY from MAP and return MAP.
-No error is signaled if KEY is not a key of MAP.  If MAP is an
-array, store nil at the index KEY.
-
-MAP can be a list, hash-table or array."
+(defun map--plist-delete (map key)
+  (let ((tail map) last)
+    (while (consp tail)
+      (cond
+       ((not (equal key (car tail)))
+        (setq last tail)
+        (setq tail (cddr last)))
+       (last
+        (setq tail (cddr tail))
+        (setf (cddr last) tail))
+       (t
+        (cl-assert (eq tail map))
+        (setq map (cddr map))
+        (setq tail map))))
+    map))
+
+(cl-defgeneric map-delete (map key)
+  "Delete KEY in-place from MAP and return MAP.
+No error is signaled if KEY is not a key of MAP.
+If MAP is an array, store nil at the index KEY."
   (map--dispatch map
-    :list (setf (alist-get key map nil t) nil)
+    ;; FIXME: Signal map-not-inplace i.s.o returning a different list?
+    :list (if (map--plist-p map)
+              (setq map (map--plist-delete map key))
+            (setf (alist-get key map nil t) nil))
     :hash-table (remhash key map)
     :array (and (>= key 0)
                 (<= key (seq-length map))
@@ -160,120 +189,133 @@ Map can be a nested map composed of alists, hash-tables 
and arrays."
                   map)
       default))
 
-(defun map-keys (map)
+(cl-defgeneric map-keys (map)
   "Return the list of keys in MAP.
-
-MAP can be a list, hash-table or array."
+The default implementation delegates to `map-apply'."
   (map-apply (lambda (key _) key) map))
 
-(defun map-values (map)
+(cl-defgeneric map-values (map)
   "Return the list of values in MAP.
-
-MAP can be a list, hash-table or array."
+The default implementation delegates to `map-apply'."
   (map-apply (lambda (_ value) value) map))
 
-(defun map-pairs (map)
+(cl-defgeneric map-pairs (map)
   "Return the elements of MAP as key/value association lists.
-
-MAP can be a list, hash-table or array."
+The default implementation delegates to `map-apply'."
   (map-apply #'cons map))
 
-(defun map-length (map)
-  "Return the length of MAP.
-
-MAP can be a list, hash-table or array."
-  (length (map-keys map)))
-
-(defun map-copy (map)
-  "Return a copy of MAP.
-
-MAP can be a list, hash-table or array."
+(cl-defgeneric map-length (map)
+  ;; FIXME: Should we rename this to `map-size'?
+  "Return the number of elements in the map.
+The default implementation counts `map-keys'."
+  (cond
+   ((hash-table-p map) (hash-table-count map))
+   ((listp map)
+    ;; FIXME: What about repeated/shadowed keys?
+    (if (map--plist-p map) (/ (length map) 2) (length map)))
+   ((arrayp map) (length map))
+   (t (length (map-keys map)))))
+
+(cl-defgeneric map-copy (map)
+  "Return a copy of MAP."
+  ;; FIXME: Clarify how deep is the copy!
   (map--dispatch map
-    :list (seq-copy map)
+    :list (seq-copy map)           ;FIXME: Probably not deep enough for alists!
     :hash-table (copy-hash-table map)
     :array (seq-copy map)))
 
-(defun map-apply (function map)
+(cl-defgeneric map-apply (function map)
   "Apply FUNCTION to each element of MAP and return the result as a list.
 FUNCTION is called with two arguments, the key and the value.
+The default implementation delegates to `map-do'."
+  (let ((res '()))
+    (map-do (lambda (k v) (push (funcall function k v) res)) map)
+    (nreverse res)))
 
-MAP can be a list, hash-table or array."
-  (funcall (map--dispatch map
-             :list #'map--apply-alist
-             :hash-table #'map--apply-hash-table
-             :array #'map--apply-array)
-           function
-           map))
-
-(defun map-do (function map)
+(cl-defgeneric map-do (function map)
   "Apply FUNCTION to each element of MAP and return nil.
-FUNCTION is called with two arguments, the key and the value."
-  (funcall (map--dispatch map
-             :list #'map--do-alist
-             :hash-table #'maphash
-             :array #'map--do-array)
-           function
-           map))
-
-(defun map-keys-apply (function map)
-  "Return the result of applying FUNCTION to each key of MAP.
+FUNCTION is called with two arguments, the key and the value.")
 
-MAP can be a list, hash-table or array."
+;; FIXME: I wish there was a way to avoid this η-redex!
+(cl-defmethod map-do (function (map hash-table)) (maphash function map))
+
+(cl-defgeneric map-keys-apply (function map)
+  "Return the result of applying FUNCTION to each key of MAP.
+The default implementation delegates to `map-apply'."
   (map-apply (lambda (key _)
                (funcall function key))
              map))
 
-(defun map-values-apply (function map)
+(cl-defgeneric map-values-apply (function map)
   "Return the result of applying FUNCTION to each value of MAP.
-
-MAP can be a list, hash-table or array."
+The default implementation delegates to `map-apply'."
   (map-apply (lambda (_ val)
                (funcall function val))
              map))
 
-(defun map-filter (pred map)
+(cl-defgeneric map-filter (pred map)
   "Return an alist of key/val pairs for which (PRED key val) is non-nil in MAP.
-
-MAP can be a list, hash-table or array."
+The default implementation delegates to `map-apply'."
   (delq nil (map-apply (lambda (key val)
                          (if (funcall pred key val)
                              (cons key val)
                            nil))
                        map)))
 
-(defun map-remove (pred map)
+(cl-defgeneric map-remove (pred map)
   "Return an alist of the key/val pairs for which (PRED key val) is nil in MAP.
-
-MAP can be a list, hash-table or array."
+The default implementation delegates to `map-filter'."
   (map-filter (lambda (key val) (not (funcall pred key val)))
               map))
 
-(defun mapp (map)
-  "Return non-nil if MAP is a map (list, hash-table or array)."
+(cl-defgeneric mapp (map)
+  "Return non-nil if MAP is a map (alist, hash-table, array, ...)."
   (or (listp map)
       (hash-table-p map)
       (arrayp map)))
 
-(defun map-empty-p (map)
+(cl-defgeneric map-empty-p (map)
   "Return non-nil if MAP is empty.
+The default implementation delegates to `map-length'."
+  (zerop (map-length map)))
+
+(cl-defmethod map-empty-p ((map list))
+  (null map))
+
+(cl-defgeneric map-contains-key (map key &optional testfn)
+  ;; FIXME: The test function to use generally depends on the map object,
+  ;; so specifying `testfn' here is problematic: e.g. for hash-tables
+  ;; we shouldn't use `gethash' unless `testfn' is the same as the map's own
+  ;; test function!
+  "Return non-nil If and only if MAP contains KEY.
+TESTFN is deprecated.  Its default depends on MAP.
+The default implementation delegates to `map-do'."
+  (unless testfn (setq testfn #'equal))
+  (catch 'map--catch
+    (map-do (lambda (k _v)
+              (if (funcall testfn key k) (throw 'map--catch t)))
+            map)
+    nil))
 
-MAP can be a list, hash-table or array."
-  (map--dispatch map
-    :list (null map)
-    :array (seq-empty-p map)
-    :hash-table (zerop (hash-table-count map))))
-
-(defun map-contains-key (map key &optional testfn)
-  "If MAP contain KEY return KEY, nil otherwise.
-Equality is defined by TESTFN if non-nil or by `equal' if nil.
-
-MAP can be a list, hash-table or array."
-  (seq-contains (map-keys map) key testfn))
-
-(defun map-some (pred map)
-  "Return a non-nil if (PRED key val) is non-nil for any key/value pair in MAP.
-
-MAP can be a list, hash-table or array."
+(cl-defmethod map-contains-key ((map list) key &optional testfn)
+  (let ((v '(nil)))
+    (not (eq v (alist-get key map v nil (or testfn #'equal))))))
+
+(cl-defmethod map-contains-key ((map array) key &optional _testfn)
+  (and (integerp key)
+       (>= key 0)
+       (< key (length map))))
+
+(cl-defmethod map-contains-key ((map hash-table) key &optional _testfn)
+  (let ((v '(nil)))
+    (not (eq v (gethash key map v)))))
+
+(cl-defgeneric map-some (pred map)
+  "Return the first non-nil (PRED key val) in MAP.
+The default implementation delegates to `map-apply'."
+  ;; FIXME: Not sure if there's much benefit to defining it as defgeneric,
+  ;; since as defined, I can't think of a map-type where we could provide an
+  ;; algorithmically more efficient algorithm than the default.
   (catch 'map--break
     (map-apply (lambda (key value)
                  (let ((result (funcall pred key value)))
@@ -282,10 +324,12 @@ MAP can be a list, hash-table or array."
                map)
     nil))
 
-(defun map-every-p (pred map)
+(cl-defgeneric map-every-p (pred map)
   "Return non-nil if (PRED key val) is non-nil for all elements of the map MAP.
-
-MAP can be a list, hash-table or array."
+The default implementation delegates to `map-apply'."
+  ;; FIXME: Not sure if there's much benefit to defining it as defgeneric,
+  ;; since as defined, I can't think of a map-type where we could provide an
+  ;; algorithmically more efficient algorithm than the default.
   (catch 'map--break
     (map-apply (lambda (key value)
               (or (funcall pred key value)
@@ -294,9 +338,7 @@ MAP can be a list, hash-table or array."
     t))
 
 (defun map-merge (type &rest maps)
-  "Merge into a map of type TYPE all the key/value pairs in MAPS.
-
-MAP can be a list, hash-table or array."
+  "Merge into a map of type TYPE all the key/value pairs in MAPS."
   (let ((result (map-into (pop maps) type)))
     (while maps
       ;; FIXME: When `type' is `list', we get an O(N^2) behavior.
@@ -310,7 +352,7 @@ MAP can be a list, hash-table or array."
 
 (defun map-merge-with (type function &rest maps)
   "Merge into a map of type TYPE all the key/value pairs in MAPS.
-When two maps contain the same key, call FUNCTION on the two
+When two maps contain the same key (`eql'), call FUNCTION on the two
 values and use the value returned by it.
 MAP can be a list, hash-table or array."
   (let ((result (map-into (pop maps) type))
@@ -318,49 +360,80 @@ MAP can be a list, hash-table or array."
     (while maps
       (map-apply (lambda (key value)
                    (cl-callf (lambda (old)
-                               (if (eq old not-found)
+                               (if (eql old not-found)
                                    value
                                  (funcall function old value)))
                        (map-elt result key not-found)))
                  (pop maps)))
     result))
 
-(defun map-into (map type)
-  "Convert the map MAP into a map of type TYPE.
-
-TYPE can be one of the following symbols: list or hash-table.
-MAP can be a list, hash-table or array."
-  (pcase type
-    (`list (map-pairs map))
-    (`hash-table (map--into-hash-table map))
-    (_ (error "Not a map type name: %S" type))))
-
-(defun map--put (map key v)
+(cl-defgeneric map-into (map type)
+  "Convert the map MAP into a map of type TYPE.")
+;; FIXME: I wish there was a way to avoid this η-redex!
+(cl-defmethod map-into (map (_type (eql list))) (map-pairs map))
+(cl-defmethod map-into (map (_type (eql alist))) (map-pairs map))
+(cl-defmethod map-into (map (_type (eql plist)))
+  (let ((plist '()))
+    (map-do (lambda (k v) (setq plist `(,k ,v ,@plist))) map)
+    plist))
+
+(cl-defgeneric map-put! (map key value &optional testfn)
+  "Associate KEY with VALUE in MAP.
+If KEY is already present in MAP, replace the associated value
+with VALUE.
+This operates by modifying MAP in place.
+If it cannot do that, it signals the `map-not-inplace' error.
+If you want to insert an element without modifying MAP, use `map-insert'."
+  ;; `testfn' only exists for backward compatibility with `map-put'!
+  (declare (advertised-calling-convention (map key value) "27.1"))
   (map--dispatch map
-    :list (let ((p (assoc key map)))
-            (if p (setcdr p v)
-              (error "No place to change the mapping for %S" key)))
-    :hash-table (puthash key v map)
-    :array (aset map key v)))
-
-(defun map--apply-alist (function map)
-  "Private function used to apply FUNCTION over MAP, MAP being an alist."
-  (seq-map (lambda (pair)
-             (funcall function
-                      (car pair)
-                      (cdr pair)))
-           map))
-
-(defun map--apply-hash-table (function map)
-  "Private function used to apply FUNCTION over MAP, MAP being a hash-table."
+    :list
+    (if (map--plist-p map)
+        (plist-put map key value)
+      (let ((oldmap map))
+        (setf (alist-get key map key nil (or testfn #'equal)) value)
+        (unless (eq oldmap map)
+          (signal 'map-not-inplace (list oldmap)))))
+    :hash-table (puthash key value map)
+    ;; FIXME: If `key' is too large, should we signal `map-not-inplace'
+    ;; and let `map-insert' grow the array?
+    :array (aset map key value)))
+
+(define-error 'map-inplace "Can only modify map in place")
+
+(cl-defgeneric map-insert (map key value)
+  "Return a new map like MAP except that it associates KEY with VALUE.
+This does not modify MAP.
+If you want to insert an element in place, use `map-put!'."
+  (if (listp map)
+      (if (map--plist-p map)
+          `(,key ,value ,@map)
+        (cons (cons key value) map))
+    ;; FIXME: Should we signal an error or use copy+put! ?
+    (signal 'map-inplace (list map))))
+
+;; There shouldn't be old source code referring to `map--put', yet we do
+;; need to keep it for backward compatibility with .elc files where the
+;; expansion of `setf' may call this function.
+(define-obsolete-function-alias 'map--put #'map-put! "27.1")
+
+(cl-defmethod map-apply (function (map list))
+  (if (map--plist-p map)
+      (cl-call-next-method)
+    (seq-map (lambda (pair)
+               (funcall function
+                        (car pair)
+                        (cdr pair)))
+             map)))
+
+(cl-defmethod map-apply (function (map hash-table))
   (let (result)
     (maphash (lambda (key value)
                (push (funcall function key value) result))
              map)
     (nreverse result)))
 
-(defun map--apply-array (function map)
-  "Private function used to apply FUNCTION over MAP, MAP being an array."
+(cl-defmethod map-apply (function (map array))
   (let ((index 0))
     (seq-map (lambda (elt)
                (prog1
@@ -368,22 +441,27 @@ MAP can be a list, hash-table or array."
                  (setq index (1+ index))))
              map)))
 
-(defun map--do-alist (function alist)
+(cl-defmethod map-do (function (map list))
   "Private function used to iterate over ALIST using FUNCTION."
-  (seq-do (lambda (pair)
-            (funcall function
-                     (car pair)
-                     (cdr pair)))
-          alist))
-
-(defun map--do-array (function array)
+  (if (map--plist-p map)
+      (while map
+        (funcall function (pop map) (pop map)))
+    (seq-do (lambda (pair)
+              (funcall function
+                       (car pair)
+                       (cdr pair)))
+            map)))
+
+(cl-defmethod map-do (function (array array))
   "Private function used to iterate over ARRAY using FUNCTION."
   (seq-do-indexed (lambda (elt index)
                      (funcall function index elt))
                    array))
 
-(defun map--into-hash-table (map)
+(cl-defmethod map-into (map (_type (eql hash-table)))
   "Convert MAP into a hash-table."
+  ;; FIXME: Just knowing we want a hash-table is insufficient, since that
+  ;; doesn't tell us the test function to use with it!
   (let ((ht (make-hash-table :size (map-length map)
                              :test 'equal)))
     (map-apply (lambda (key value)
diff --git a/lisp/emacs-lisp/nadvice.el b/lisp/emacs-lisp/nadvice.el
index 76a9095..bb647b0 100644
--- a/lisp/emacs-lisp/nadvice.el
+++ b/lisp/emacs-lisp/nadvice.el
@@ -1,6 +1,6 @@
 ;;; nadvice.el --- Light-weight advice primitives for Elisp functions  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: extensions, lisp, tools
diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el
index 3ec214a..1486aeb 100644
--- a/lisp/emacs-lisp/package-x.el
+++ b/lisp/emacs-lisp/package-x.el
@@ -1,6 +1,6 @@
 ;;; package-x.el --- Package extras
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Tom Tromey <address@hidden>
 ;; Created: 10 Mar 2007
@@ -202,8 +202,8 @@ if it exists."
               (split-version (package-desc-version pkg-desc))
               (commentary
                 (pcase file-type
-                  (`single (lm-commentary))
-                  (`tar nil))) ;; FIXME: Get it from the README file.
+                  ('single (lm-commentary))
+                  ('tar nil))) ;; FIXME: Get it from the README file.
                (extras (package-desc-extras pkg-desc))
               (pkg-version (package-version-join split-version))
               (pkg-buffer (current-buffer)))
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index f2ffef8..61cf690 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1,6 +1,6 @@
 ;;; package.el --- Simple package system for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Tom Tromey <address@hidden>
 ;;         Daniel Hackney <address@hidden>
@@ -487,7 +487,7 @@ This is, approximately, the inverse of `version-to-list'.
                 str-list))))
       (if (equal "." (car str-list))
           (pop str-list))
-      (apply 'concat (nreverse str-list)))))
+      (apply #'concat (nreverse str-list)))))
 
 (defun package-desc-full-name (pkg-desc)
   (format "%s-%s"
@@ -496,9 +496,9 @@ This is, approximately, the inverse of `version-to-list'.
 
 (defun package-desc-suffix (pkg-desc)
   (pcase (package-desc-kind pkg-desc)
-    (`single ".el")
-    (`tar ".tar")
-    (`dir "")
+    ('single ".el")
+    ('tar ".tar")
+    ('dir "")
     (kind (error "Unknown package kind: %s" kind))))
 
 (defun package-desc--keywords (pkg-desc)
@@ -609,6 +609,12 @@ updates `package-alist'."
             (when (file-directory-p pkg-dir)
               (package-load-descriptor pkg-dir))))))))
 
+(defun package--alist ()
+  "Return `package-alist', after computing it if needed."
+  (or package-alist
+      (progn (package-load-all-descriptors)
+             package-alist)))
+
 (defun define-package (_name-string _version-string
                                     &optional _docstring _requirements
                                     &rest _extra-properties)
@@ -750,7 +756,8 @@ DIR, sorted by most recently loaded last."
   (let* ((history (delq nil
                         (mapcar (lambda (x)
                                   (let ((f (car x)))
-                                    (and f (file-name-sans-extension f))))
+                                    (and (stringp f)
+                                         (file-name-sans-extension f))))
                                 load-history)))
          (dir (file-truename dir))
          ;; List all files that have already been loaded.
@@ -837,7 +844,7 @@ untar into a directory named DIR; otherwise, signal an 
error."
   (tar-untar-buffer))
 
 (defun package--alist-to-plist-args (alist)
-  (mapcar 'macroexp-quote
+  (mapcar #'macroexp-quote
           (apply #'nconc
                  (mapcar (lambda (pair) (list (car pair) (cdr pair))) alist))))
 (defun package-unpack (pkg-desc)
@@ -846,7 +853,7 @@ untar into a directory named DIR; otherwise, signal an 
error."
          (dirname (package-desc-full-name pkg-desc))
          (pkg-dir (expand-file-name dirname package-user-dir)))
     (pcase (package-desc-kind pkg-desc)
-      (`dir
+      ('dir
        (make-directory pkg-dir t)
        (let ((file-list
               (directory-files
@@ -860,12 +867,12 @@ untar into a directory named DIR; otherwise, signal an 
error."
          ;; things simple by ensuring we're one of them.
          (setf (package-desc-kind pkg-desc)
                (if (> (length file-list) 1) 'tar 'single))))
-      (`tar
+      ('tar
        (make-directory package-user-dir t)
        ;; FIXME: should we delete PKG-DIR if it exists?
        (let* ((default-directory (file-name-as-directory package-user-dir)))
          (package-untar-buffer dirname)))
-      (`single
+      ('single
        (let ((el-file (expand-file-name (format "%s.el" name) pkg-dir)))
          (make-directory pkg-dir t)
          (package--write-file-no-coding el-file)))
@@ -898,7 +905,9 @@ untar into a directory named DIR; otherwise, signal an 
error."
           (print-length nil))
       (write-region
        (concat
-        ";;; -*- no-byte-compile: t -*-\n"
+        ";;; Generated package description from "
+        (replace-regexp-in-string "-pkg\\.el\\'" ".el" pkg-file)
+        "  -*- no-byte-compile: t -*-\n"
         (prin1-to-string
          (nconc
           (list 'define-package
@@ -1001,6 +1010,7 @@ is wrapped around any parts requiring it."
 
 (declare-function lm-header "lisp-mnt" (header))
 (declare-function lm-homepage "lisp-mnt" (&optional file))
+(declare-function lm-keywords-list "lisp-mnt" (&optional file))
 (declare-function lm-maintainer "lisp-mnt" (&optional file))
 (declare-function lm-authors "lisp-mnt" (&optional file))
 
@@ -1031,6 +1041,7 @@ boundaries."
            (pkg-version
             (or (package-strip-rcs-id (lm-header "package-version"))
                 (package-strip-rcs-id (lm-header "version"))))
+           (keywords (lm-keywords-list))
            (homepage (lm-homepage)))
       (unless pkg-version
         (error
@@ -1042,6 +1053,7 @@ boundaries."
             (package-read-from-string requires-str)))
        :kind 'single
        :url homepage
+       :keywords keywords
        :maintainer (lm-maintainer)
        :authors (lm-authors)))))
 
@@ -1491,10 +1503,8 @@ The variable `package-load-list' controls which packages 
to load."
       ;; 2 (this assumes we were careful to save this file so it doesn't need
       ;; any decoding).
       (let ((load-source-file-function nil))
-        (load package-quickstart-file))
-    (unless package--initialized
-      (package-initialize t))
-    (dolist (elt package-alist)
+        (load package-quickstart-file nil 'nomessage))
+    (dolist (elt (package--alist))
       (condition-case err
           (package-activate (car elt))
         ;; Don't let failure of activation of a package arbitrarily stop
@@ -1563,14 +1573,16 @@ similar to an entry in `package-alist'.  Save the 
cached copy to
                 (member name package-unsigned-archives))
             ;; If we don't care about the signature, save the file and
             ;; we're done.
-            (progn (write-region content nil local-file nil 'silent)
+            (progn (let ((coding-system-for-write 'utf-8))
+                     (write-region content nil local-file nil 'silent))
                    (package--update-downloads-in-progress archive))
           ;; If we care, check it (perhaps async) and *then* write the file.
           (package--check-signature
            location file content async
            ;; This function will be called after signature checking.
            (lambda (&optional good-sigs)
-             (write-region content nil local-file nil 'silent)
+             (let ((coding-system-for-write 'utf-8))
+               (write-region content nil local-file nil 'silent))
              ;; Write out good signatures into archive-contents.signed file.
              (when good-sigs
                (write-region (mapconcat #'epg-signature-to-string good-sigs 
"\n")
@@ -1903,10 +1915,9 @@ If PACKAGE is a `package-desc' object, MIN-VERSION is 
ignored."
     ;; We used the quickstart: make it possible to use package-installed-p
     ;; even before package is fully initialized.
     (memq package package-activated-list))
-   ((not package--initialized) (error "package.el is not yet initialized!"))
    (t
     (or
-     (let ((pkg-descs (cdr (assq package package-alist))))
+     (let ((pkg-descs (cdr (assq package (package--alist)))))
        (and pkg-descs
             (version-list-<= min-version
                              (package-desc-version (car pkg-descs)))))
@@ -2079,16 +2090,12 @@ If NOSAVE is non-nil, the package is not removed from
 `package-selected-packages'."
   (interactive
    (progn
-     ;; Initialize the package system to get the list of package
-     ;; symbols for completion.
-     (unless package--initialized
-       (package-initialize t))
      (let* ((package-table
              (mapcar
               (lambda (p) (cons (package-desc-full-name p) p))
               (delq nil
                     (mapcar (lambda (p) (unless (package-built-in-p p) p))
-                            (apply #'append (mapcar #'cdr package-alist))))))
+                            (apply #'append (mapcar #'cdr 
(package--alist)))))))
             (package-name (completing-read "Delete package: "
                                            (mapcar #'car package-table)
                                            nil t)))
@@ -2123,6 +2130,9 @@ If NOSAVE is non-nil, the package is not removed from
            (add-hook 'post-command-hook #'package-menu--post-refresh)
            (delete-directory dir t)
            ;; Remove NAME-VERSION.signed and NAME-readme.txt files.
+           ;;
+           ;; NAME-readme.txt files are no longer created, but they
+           ;; may be left around from an earlier install.
            (dolist (suffix '(".signed" "readme.txt"))
              (let* ((version (package-version-join (package-desc-version 
pkg-desc)))
                     (file (concat (if (string= suffix ".signed")
@@ -2193,12 +2203,12 @@ will be deleted."
      ;; Load the package list if necessary (but don't activate them).
      (unless package--initialized
        (package-initialize t))
-     (let ((packages (append (mapcar 'car package-alist)
-                             (mapcar 'car package-archive-contents)
-                             (mapcar 'car package--builtins))))
+     (let ((packages (append (mapcar #'car package-alist)
+                             (mapcar #'car package-archive-contents)
+                             (mapcar #'car package--builtins))))
        (unless (memq guess packages)
          (setq guess nil))
-       (setq packages (mapcar 'symbol-name packages))
+       (setq packages (mapcar #'symbol-name packages))
        (let ((val
               (completing-read (if guess
                                    (format "Describe package (default %s): "
@@ -2233,6 +2243,45 @@ Otherwise no newline is inserted."
 
 (declare-function lm-commentary "lisp-mnt" (&optional file))
 
+(defun package--get-description (desc)
+  "Return a string containing the long description of the package DESC.
+The description is read from the installed package files."
+  ;; Installed packages have nil for kind, so we look for README
+  ;; first, then fall back to the Commentary header.
+
+  ;; We don’t include README.md here, because that is often the home
+  ;; page on a site like github, and not suitable as the package long
+  ;; description.
+  (let ((files '("README-elpa" "README-elpa.md" "README" "README.rst" 
"README.org"))
+        file
+        (srcdir (package-desc-dir desc))
+        result)
+    (while (and files
+                (not result))
+      (setq file (pop files))
+      (when (file-readable-p (expand-file-name file srcdir))
+        ;; Found a README.
+        (with-temp-buffer
+          (insert-file-contents (expand-file-name file srcdir))
+          (setq result (buffer-string)))))
+
+    (or
+     result
+
+     ;; Look for Commentary header.
+     (let ((mainsrcfile (expand-file-name (format "%s.el" (package-desc-name 
desc))
+                                          srcdir)))
+       (when (file-readable-p mainsrcfile)
+         (with-temp-buffer
+           (insert (or (lm-commentary mainsrcfile) ""))
+           (goto-char (point-min))
+           (when (re-search-forward "^;;; Commentary:\n" nil t)
+             (replace-match ""))
+           (while (re-search-forward "^\\(;+ ?\\)" nil t)
+             (replace-match ""))
+           (buffer-string))))
+     )))
+
 (defun describe-package-1 (pkg)
   (require 'lisp-mnt)
   (let* ((desc (or
@@ -2406,7 +2455,8 @@ Otherwise no newline is inserted."
     (insert "\n")
 
     (if built-in
-        ;; For built-in packages, insert the commentary.
+        ;; For built-in packages, get the description from the
+        ;; Commentary header.
         (let ((fn (locate-file (format "%s.el" name) load-path
                                load-file-rep-suffixes))
               (opoint (point)))
@@ -2417,27 +2467,26 @@ Otherwise no newline is inserted."
               (replace-match ""))
             (while (re-search-forward "^\\(;+ ?\\)" nil t)
               (replace-match ""))))
-      (let* ((basename (format "%s-readme.txt" name))
-             (readme (expand-file-name basename package-user-dir))
-             readme-string)
-        ;; For elpa packages, try downloading the commentary.  If that
-        ;; fails, try an existing readme file in `package-user-dir'.
-        (cond ((and (package-desc-archive desc)
-                    (package--with-response-buffer (package-archive-base desc)
-                      :file basename :noerror t
-                      (save-excursion
-                        (goto-char (point-max))
-                        (unless (bolp)
-                          (insert ?\n)))
-                      (write-region nil nil
-                                    (expand-file-name readme package-user-dir)
-                                    nil 'silent)
-                      (setq readme-string (buffer-string))
-                      t))
-               (insert readme-string))
-              ((file-readable-p readme)
-               (insert-file-contents readme)
-               (goto-char (point-max))))))))
+
+      (if (package-installed-p desc)
+          ;; For installed packages, get the description from the installed 
files.
+          (insert (package--get-description desc))
+
+        ;; For non-built-in, non-installed packages, get description from the 
archive.
+        (let* ((basename (format "%s-readme.txt" name))
+               readme-string)
+
+          (package--with-response-buffer (package-archive-base desc)
+            :file basename :noerror t
+            (save-excursion
+              (goto-char (point-max))
+              (unless (bolp)
+                (insert ?\n)))
+            (setq readme-string (buffer-string))
+            t)
+          (insert (or readme-string
+                      "This package does not provide a description.")))
+        ))))
 
 (defun package-install-button-action (button)
   (let ((pkg-desc (button-get button 'package-desc)))
@@ -2466,7 +2515,7 @@ Otherwise no newline is inserted."
                                 :background "light grey"
                                 :foreground "black")
                        'link)))
-    (apply 'insert-text-button button-text 'face button-face 'follow-link t
+    (apply #'insert-text-button button-text 'face button-face 'follow-link t
            props)))
 
 
@@ -2494,7 +2543,7 @@ Otherwise no newline is inserted."
 
 (easy-menu-define package-menu-mode-menu package-menu-mode-map
   "Menu for `package-menu-mode'."
-  `("Package"
+  '("Package"
     ["Describe Package" package-menu-describe-package :help "Display 
information about this package"]
     ["Help" package-menu-quick-help :help "Show short key binding help for 
package-menu-mode"]
     "--"
@@ -2547,7 +2596,7 @@ Letters do not insert themselves; instead, they are 
commands.
           ("Description" 0 nil)])
   (setq tabulated-list-padding 2)
   (setq tabulated-list-sort-key (cons "Status" nil))
-  (add-hook 'tabulated-list-revert-hook 'package-menu--refresh nil t)
+  (add-hook 'tabulated-list-revert-hook #'package-menu--refresh nil t)
   (tabulated-list-init-header))
 
 (defmacro package--push (pkg-desc status listname)
@@ -2818,7 +2867,7 @@ shown."
   (package-menu--refresh packages keywords)
   (setf (car (aref tabulated-list-format 0))
         (if keywords
-            (let ((filters (mapconcat 'identity keywords ",")))
+            (let ((filters (mapconcat #'identity keywords ",")))
               (concat "Package[" filters "]"))
           "Package"))
   (if keywords
@@ -3392,6 +3441,9 @@ short description."
   ;; Generate the Package Menu.
   (let ((buf (get-buffer-create "*Packages*")))
     (with-current-buffer buf
+      ;; Since some packages have their descriptions include non-ASCII
+      ;; characters...
+      (setq buffer-file-coding-system 'utf-8)
       (package-menu-mode)
 
       ;; Fetch the remote list of packages.
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 826bafc..e4dcc54 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -1,6 +1,6 @@
 ;;; pcase.el --- ML-style pattern-matching macro for Elisp -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords:
@@ -63,6 +63,7 @@
 ;; FIXME: Now that macroexpansion is also performed when loading an interpreted
 ;; file, this is not a real problem any more.
 (defconst pcase--memoize (make-hash-table :weakness 'key :test 'eq))
+;; (defconst pcase--memoize (make-hash-table :test 'eq))
 ;; (defconst pcase--memoize-1 (make-hash-table :test 'eq))
 ;; (defconst pcase--memoize-2 (make-hash-table :weakness 'key :test 'equal))
 
@@ -175,7 +176,9 @@ Emacs Lisp manual for more information and examples."
 
 ;; FIXME: Obviously, this will collide with nadvice's use of
 ;; function-documentation if we happen to advise `pcase'.
+;;;###autoload
 (put 'pcase 'function-documentation '(pcase--make-docstring))
+;;;###autoload
 (defun pcase--make-docstring ()
   (let* ((main (documentation (symbol-function 'pcase) 'raw))
          (ud (help-split-fundoc main 'pcase)))
@@ -264,10 +267,14 @@ variable name being but a special case of it)."
 
 ;;;###autoload
 (defmacro pcase-let* (bindings &rest body)
-  "Like `let*' but where you can use `pcase' patterns for bindings.
-BODY should be an expression, and BINDINGS should be a list of bindings
-of the form (PATTERN EXP).
-See `pcase-let' for discussion of how PATTERN is matched."
+  "Like `let*', but supports destructuring BINDINGS using `pcase' patterns.
+As with `pcase-let', BINDINGS are of the form (PATTERN EXP), but the
+EXP in each binding in BINDINGS can use the results of the destructuring
+bindings that precede it in BINDINGS' order.
+
+Each EXP should match (i.e. be of compatible structure) to its
+respective PATTERN; a mismatch may signal an error or may go
+undetected, binding variables to arbitrary values, such as nil."
   (declare (indent 1)
            (debug ((&rest (pcase-PAT &optional form)) body)))
   (let ((cached (gethash bindings pcase--memoize)))
@@ -280,13 +287,16 @@ See `pcase-let' for discussion of how PATTERN is matched."
 
 ;;;###autoload
 (defmacro pcase-let (bindings &rest body)
-  "Like `let' but where you can use `pcase' patterns for bindings.
-BODY should be a list of expressions, and BINDINGS should be a list of bindings
-of the form (PATTERN EXP).
-The PATTERNs are only used to extract data, so the code does not test
-whether the data does match the corresponding patterns: a mismatch
-may signal an error or may go undetected, binding variables to arbitrary
-values, such as nil."
+  "Like `let', but supports destructuring BINDINGS using `pcase' patterns.
+BODY should be a list of expressions, and BINDINGS should be a list of
+bindings of the form (PATTERN EXP).
+All EXPs are evaluated first, and then used to perform destructuring
+bindings by matching each EXP against its respective PATTERN.  Then
+BODY is evaluated with those bindings in effect.
+
+Each EXP should match (i.e. be of compatible structure) to its
+respective PATTERN; a mismatch may signal an error or may go
+undetected, binding variables to arbitrary values, such as nil."
   (declare (indent 1) (debug pcase-let*))
   (if (null (cdr bindings))
       `(pcase-let* ,bindings ,@body)
@@ -304,11 +314,15 @@ values, such as nil."
 
 ;;;###autoload
 (defmacro pcase-dolist (spec &rest body)
-  "Superset of `dolist' where the VAR binding can be a `pcase' PATTERN.
-More specifically, this is just a shorthand for the following combination
-of `dolist' and `pcase-let':
-
-    (dolist (x LIST) (pcase-let ((PATTERN x)) BODY...))
+  "Eval BODY once for each set of bindings defined by PATTERN and LIST 
elements.
+PATTERN should be a `pcase' pattern describing the structure of
+LIST elements, and LIST is a list of objects that match PATTERN,
+i.e. have a structure that is compatible with PATTERN.
+For each element of LIST, this macro binds the variables in
+PATTERN to the corresponding subfields of the LIST element, and
+then evaluates BODY with these bindings in effect.  The
+destructuring bindings of variables in PATTERN to the subfields
+of the elements of LIST is performed as if by `pcase-let'.
 \n(fn (PATTERN LIST) BODY...)"
   (declare (indent 1) (debug ((pcase-PAT form) body)))
   (if (pcase--trivial-upat-p (car spec))
@@ -771,7 +785,7 @@ Otherwise, it defers to REST which is a list of branches of 
the form
    ((eq 'or (caar matches))
     (let* ((alts (cdar matches))
            (var (if (eq (caar alts) 'match) (cadr (car alts))))
-           (simples '()) (others '()) (memq-ok t))
+           (simples '()) (others '()) (memql-ok t))
       (when var
         (dolist (alt alts)
           (if (and (eq (car alt) 'match) (eq var (cadr alt))
@@ -779,16 +793,16 @@ Otherwise, it defers to REST which is a list of branches 
of the form
                      (eq (car-safe upat) 'quote)))
               (let ((val (cadr (cddr alt))))
                 (unless (or (integerp val) (symbolp val))
-                  (setq memq-ok nil))
+                  (setq memql-ok nil))
                 (push (cadr (cddr alt)) simples))
             (push alt others))))
       (cond
        ((null alts) (error "Please avoid it") (pcase--u rest))
-       ;; Yes, we can use `memq' (or `member')!
+       ;; Yes, we can use `memql' (or `member')!
        ((> (length simples) 1)
         (pcase--u1 (cons `(match ,var
                                  . (pred (pcase--flip
-                                          ,(if memq-ok #'memq #'member)
+                                          ,(if memql-ok #'memql #'member)
                                           ',simples)))
                          (cdr matches))
                    code vars
diff --git a/lisp/emacs-lisp/pp.el b/lisp/emacs-lisp/pp.el
index 1698d44..de4cbfc 100644
--- a/lisp/emacs-lisp/pp.el
+++ b/lisp/emacs-lisp/pp.el
@@ -1,6 +1,6 @@
 ;;; pp.el --- pretty printer for Emacs Lisp  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1989, 1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Randal Schwartz <address@hidden>
 ;; Keywords: lisp
diff --git a/lisp/emacs-lisp/radix-tree.el b/lisp/emacs-lisp/radix-tree.el
index 2491cce..75d9874 100644
--- a/lisp/emacs-lisp/radix-tree.el
+++ b/lisp/emacs-lisp/radix-tree.el
@@ -1,6 +1,6 @@
 ;;; radix-tree.el --- A simple library of radix trees  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords:
@@ -74,7 +74,7 @@
             (cmp (compare-strings prefix nil nil key i ni)))
        (if (eq t cmp)
            (pcase (radix-tree--remove ptree key ni)
-             (`nil rtree)
+             ('nil rtree)
              (`((,pprefix . ,pptree))
               `((,(concat prefix pprefix) . ,pptree) . ,rtree))
              (nptree `((,prefix . ,nptree) . ,rtree)))
diff --git a/lisp/emacs-lisp/re-builder.el b/lisp/emacs-lisp/re-builder.el
index 358bb19..f5b1dd8 100644
--- a/lisp/emacs-lisp/re-builder.el
+++ b/lisp/emacs-lisp/re-builder.el
@@ -1,6 +1,6 @@
 ;;; re-builder.el --- building Regexps with visual feedback -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Detlev Zundel <address@hidden>
 ;; Keywords: matching, lisp, tools
diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el
index 8de4959..d883752 100644
--- a/lisp/emacs-lisp/regexp-opt.el
+++ b/lisp/emacs-lisp/regexp-opt.el
@@ -1,6 +1,6 @@
 ;;; regexp-opt.el --- generate efficient regexps to match strings -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1994-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Marshall <address@hidden>
 ;; Maintainer: address@hidden
@@ -84,11 +84,14 @@
 ;;; Code:
 
 ;;;###autoload
-(defun regexp-opt (strings &optional paren)
+(defun regexp-opt (strings &optional paren keep-order)
   "Return a regexp to match a string in the list STRINGS.
-Each string should be unique in STRINGS and should not contain
-any regexps, quoted or not.  Optional PAREN specifies how the
-returned regexp is surrounded by grouping constructs.
+Each member of STRINGS is treated as a fixed string, not as a regexp.
+Optional PAREN specifies how the returned regexp is surrounded by
+grouping constructs.
+
+If STRINGS is the empty list, the return value is a regexp that
+never matches anything.
 
 The optional argument PAREN can be any of the following:
 
@@ -111,8 +114,14 @@ nil
     necessary to ensure that a postfix operator appended to it will
     apply to the whole expression.
 
-The resulting regexp is equivalent to but usually more efficient
-than that of a simplified version:
+The optional argument KEEP-ORDER, if nil or omitted, allows the
+returned regexp to match the strings in any order.  If non-nil,
+the match is guaranteed to be performed in the order given, as if
+the strings were made into a regexp by joining them with the
+`\\|' operator.
+
+Up to reordering, the resulting regexp is equivalent to but
+usually more efficient than that of a simplified version:
 
  (defun simplified-regexp-opt (strings &optional paren)
    (let ((parens
@@ -121,9 +130,9 @@ than that of a simplified version:
                 ((eq paren \\='symbols) \\='(\"\\\\_<\\\\(\" . 
\"\\\\)\\\\_>\"))
                 ((null paren)          \\='(\"\\\\(?:\" . \"\\\\)\"))
                 (t                       \\='(\"\\\\(\" . \"\\\\)\")))))
-     (concat (car paren)
+     (concat (car parens)
              (mapconcat \\='regexp-quote strings \"\\\\|\")
-             (cdr paren))))"
+             (cdr parens))))"
   (save-match-data
     ;; Recurse on the sorted list.
     (let* ((max-lisp-eval-depth 10000)
@@ -133,7 +142,19 @@ than that of a simplified version:
           (open (cond ((stringp paren) paren) (paren "\\(")))
           (sorted-strings (delete-dups
                            (sort (copy-sequence strings) 'string-lessp)))
-          (re (regexp-opt-group sorted-strings (or open t) (not open))))
+          (re
+            (cond
+             ;; No strings: return a\` which cannot match anything.
+             ((null strings)
+              (concat (or open "\\(?:") "a\\`\\)"))
+             ;; If we cannot reorder, give up all attempts at
+             ;; optimisation.  There is room for improvement (Bug#34641).
+             ((and keep-order (regexp-opt--contains-prefix sorted-strings))
+              (concat (or open "\\(?:")
+                      (mapconcat #'regexp-quote strings "\\|")
+                      "\\)"))
+             (t
+              (regexp-opt-group sorted-strings (or open t) (not open))))))
       (cond ((eq paren 'words)
             (concat "\\<" re "\\>"))
            ((eq paren 'symbols)
@@ -313,6 +334,22 @@ CHARS should be a list of characters."
           (concat "[" dash caret "]"))
       (concat "[" bracket charset caret dash "]"))))
 
+
+(defun regexp-opt--contains-prefix (strings)
+  "Whether STRINGS contains a proper prefix of one of its other elements.
+STRINGS must be a list of sorted strings without duplicates."
+  (let ((s strings))
+    ;; In a lexicographically sorted list, a string always immediately
+    ;; succeeds one of its prefixes.
+    (while (and (cdr s)
+                (not (string-equal
+                      (car s)
+                      (substring (cadr s) 0 (min (length (car s))
+                                                 (length (cadr s)))))))
+      (setq s (cdr s)))
+    (cdr s)))
+
+
 (provide 'regexp-opt)
 
 ;;; regexp-opt.el ends here
diff --git a/lisp/emacs-lisp/regi.el b/lisp/emacs-lisp/regi.el
index 9a1ba76..f8268ed 100644
--- a/lisp/emacs-lisp/regi.el
+++ b/lisp/emacs-lisp/regi.el
@@ -1,6 +1,6 @@
 ;;; regi.el --- REGular expression Interpreting engine
 
-;; Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: 1993 Barry A. Warsaw, Century Computing, Inc. <address@hidden>
 ;; Maintainer:    address@hidden
diff --git a/lisp/emacs-lisp/ring.el b/lisp/emacs-lisp/ring.el
index 312df6b..c7d0268 100644
--- a/lisp/emacs-lisp/ring.el
+++ b/lisp/emacs-lisp/ring.el
@@ -1,6 +1,6 @@
 ;;; ring.el --- handle rings of items   -*- lexical-binding: t; -*-
 
-;; Copyright (C) 1992, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: extensions
@@ -189,17 +189,28 @@ Raise error if ITEM is not in the RING."
 (defun ring-extend (ring x)
   "Increase the size of RING by X."
   (when (and (integerp x) (> x 0))
-    (let* ((hd       (car ring))
-          (length   (ring-length ring))
-          (size     (ring-size ring))
-          (old-vec  (cddr ring))
-          (new-vec  (make-vector (+ size x) nil)))
-      (setcdr ring (cons length new-vec))
-      ;; If the ring is wrapped, the existing elements must be written
-      ;; out in the right order.
-      (dotimes (j length)
-       (aset new-vec j (aref old-vec (mod (+ hd j) size))))
-      (setcar ring 0))))
+    (ring-resize ring (+ x (ring-size ring)))))
+
+(defun ring-resize (ring size)
+  "Set the size of RING to SIZE.
+If the new size is smaller, then the oldest items in the ring are
+discarded."
+  (when (integerp size)
+    (let ((length (ring-length ring))
+         (new-vec (make-vector size nil)))
+      (if (= length 0)
+          (setcdr ring (cons 0 new-vec))
+        (let* ((hd (car ring))
+              (old-size (ring-size ring))
+              (old-vec (cddr ring))
+               (copy-length (min size length))
+               (copy-hd (mod (+ hd (- length copy-length)) length)))
+          (setcdr ring (cons copy-length new-vec))
+          ;; If the ring is wrapped, the existing elements must be written
+          ;; out in the right order.
+          (dotimes (j copy-length)
+           (aset new-vec j (aref old-vec (mod (+ copy-hd j) old-size))))
+          (setcar ring 0))))))
 
 (defun ring-insert+extend (ring item &optional grow-p)
   "Like `ring-insert', but if GROW-P is non-nil, then enlarge ring.
diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el
index 3197478..6d1adae 100644
--- a/lisp/emacs-lisp/rmc.el
+++ b/lisp/emacs-lisp/rmc.el
@@ -1,6 +1,6 @@
 ;;; rmc.el --- read from a multiple choice question -*- lexical-binding: t -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 
diff --git a/lisp/emacs-lisp/rx.el b/lisp/emacs-lisp/rx.el
index 1230df4..fdd2431 100644
--- a/lisp/emacs-lisp/rx.el
+++ b/lisp/emacs-lisp/rx.el
@@ -1,6 +1,6 @@
-;;; rx.el --- sexp notation for regular expressions
+;;; rx.el --- sexp notation for regular expressions  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Gerd Moellmann <address@hidden>
 ;; Maintainer: address@hidden
@@ -246,7 +246,9 @@ regular expressions.")
 
 
 (defconst rx-categories
-  '((consonant                 . ?0)
+  '((space-for-indent           . ?\s)
+    (base                       . ?.)
+    (consonant                 . ?0)
     (base-vowel                        . ?1)
     (upper-diacritical-mark    . ?2)
     (lower-diacritical-mark    . ?3)
@@ -265,7 +267,9 @@ regular expressions.")
     (japanese-hiragana-two-byte . ?H)
     (indian-two-byte           . ?I)
     (japanese-katakana-two-byte . ?K)
+    (strong-left-to-right       . ?L)
     (korean-hangul-two-byte    . ?N)
+    (strong-right-to-left       . ?R)
     (cyrillic-two-byte         . ?Y)
     (combining-diacritic       . ?^)
     (ascii                     . ?a)
@@ -389,7 +393,7 @@ FORM is of the form `(and FORM1 ...)'."
   (rx-group-if
    (if (memq nil (mapcar 'stringp (cdr form)))
        (mapconcat (lambda (x) (rx-form x '|)) (cdr form) "\\|")
-     (regexp-opt (cdr form)))
+     (regexp-opt (cdr form) nil t))
    (and (memq rx-parent '(: * t)) rx-parent)))
 
 
@@ -425,6 +429,13 @@ Only both edges of each range is checked."
     ;; set L list of all ranges
     (mapc (lambda (e) (cond ((stringp e) (push e str))
                            ((numberp e) (push (cons e e) l))
+                            ;; Ranges between ASCII and raw bytes are split,
+                            ;; to prevent accidental inclusion of Unicode
+                            ;; characters later on.
+                            ((and (<= (car e) #x7f)
+                                  (>= (cdr e) #x3fff80))
+                             (push (cons (car e) #x7f) l)
+                             (push (cons #x3fff80 (cdr e)) l))
                            (t (push e l))))
          args)
     ;; condense overlapped ranges in L
@@ -449,28 +460,38 @@ Only both edges of each range is checked."
 
 
 (defun rx-check-any-string (str)
-  "Check string argument STR for Rx `any'."
-  (let ((i 0)
-       c1 c2 l)
-    (if (= 0 (length str))
-       (error "String arg for Rx `any' must not be empty"))
-    (while (string-match ".-." str i)
-      ;; string before range: convert it to characters
-      (if (< i (match-beginning 0))
-         (setq l (nconc
-                  l
-                  (append (substring str i (match-beginning 0)) nil))))
-      ;; range
-      (setq i (match-end 0)
-           c1 (aref str (match-beginning 0))
-           c2 (aref str (1- i)))
-      (cond
-       ((< c1 c2) (setq l (nconc l (list (cons c1 c2)))))
-       ((= c1 c2) (setq l (nconc l (list c1))))))
-    ;; rest?
-    (if (< i (length str))
-       (setq l (nconc l (append (substring str i) nil))))
-    l))
+  "Turn the `any' argument string STR into a list of characters.
+The original order is not preserved.  Ranges, \"A-Z\", become pairs, (?A . 
?Z)."
+  (let ((decode-char
+         ;; Make sure raw bytes are decoded as such, to avoid confusion with
+         ;; U+0080..U+00FF.
+         (if (multibyte-string-p str)
+             #'identity
+           (lambda (c) (if (<= #x80 c #xff)
+                           (+ c #x3fff00)
+                         c))))
+        (len (length str))
+        (i 0)
+        (ret nil))
+    (if (= 0 len)
+        (error "String arg for Rx `any' must not be empty"))
+    (while (< i len)
+      (cond ((and (< i (- len 2))
+                  (= (aref str (+ i 1)) ?-))
+             ;; Range.
+             (let ((start (funcall decode-char (aref str i)))
+                   (end   (funcall decode-char (aref str (+ i 2)))))
+               (cond ((< start end) (push (cons start end) ret))
+                     ((= start end) (push start ret))
+                     (t
+                      (error "Rx character range `%c-%c' is reversed"
+                             start end)))
+               (setq i (+ i 3))))
+            (t
+             ;; Single character.
+             (push (funcall decode-char (aref str i)) ret)
+             (setq i (+ i 1)))))
+    ret))
 
 
 (defun rx-check-any (arg)
@@ -485,7 +506,10 @@ Only both edges of each range is checked."
               (null (string-match "\\`\\[\\[:[-a-z]+:\\]\\]\\'" translation)))
           (error "Invalid char class `%s' in Rx `any'" arg))
        (list (substring translation 1 -1)))) ; strip outer brackets
-    ((and (integerp (car-safe arg)) (integerp (cdr-safe arg)))
+    ((and (characterp (car-safe arg)) (characterp (cdr-safe arg)))
+     (unless (<= (car arg) (cdr arg))
+       (error "Rx character range `%c-%c' is reversed"
+              (car arg) (cdr arg)))
      (list arg))
     ((stringp arg) (rx-check-any-string arg))
     ((error
@@ -591,7 +615,7 @@ ARG is optional."
   (rx-check form)
   (let ((result (rx-form (cadr form) '!))
        case-fold-search)
-    (cond ((string-match "\\`\\[^" result)
+    (cond ((string-match "\\`\\[\\^" result)
           (cond
            ((equal result "[^]") "[^^]")
            ((and (= (length result) 4) (null (eq rx-parent '!)))
@@ -726,8 +750,8 @@ If OP is anything else, produce a greedy regexp if 
`rx-greedy-flag'
 is non-nil."
   (rx-check form)
   (setq form (rx-trans-forms form))
-  (let ((suffix (cond ((memq (car form) '(* + ?\s)) "")
-                     ((memq (car form) '(*? +? ??)) "?")
+  (let ((suffix (cond ((memq (car form) '(* + \? ?\s)) "")
+                     ((memq (car form) '(*? +? \?? ??)) "?")
                      (rx-greedy-flag "")
                      (t "?")))
        (op (cond ((memq (car form) '(* *? 0+ zero-or-more)) "*")
@@ -769,7 +793,7 @@ of all atomic regexps."
      ((= l 3) (string-match "\\`\\(?:\\\\[cCsS_]\\|\\[[^^]\\]\\)" r))
      ((null lax)
       (cond
-       ((string-match "\\`\\[^?\]?\\(?:\\[:[a-z]+:]\\|[^]]\\)*\\]\\'" r))
+       ((string-match "\\`\\[\\^?]?\\(?:\\[:[a-z]+:]\\|[^]]\\)*]\\'" r))
        ((string-match "\\`\\\\(\\(?:[^\\]\\|\\\\[^)]\\)*\\\\)\\'" r)))))))
 
 
@@ -830,33 +854,34 @@ If FORM is `(minimal-match FORM1)', non-greedy versions 
of `*',
   (rx-group-if (cadr form) rx-parent))
 
 
-(defun rx-form (form &optional rx-parent)
+(defun rx-form (form &optional parent)
   "Parse and produce code for regular expression FORM.
 FORM is a regular expression in sexp form.
-RX-PARENT shows which type of expression calls and controls putting of
+PARENT shows which type of expression calls and controls putting of
 shy groups around the result and some more in other functions."
-  (cond
-   ((stringp form)
-    (rx-group-if (regexp-quote form)
-                 (if (and (eq rx-parent '*) (< 1 (length form)))
-                     rx-parent)))
-   ((integerp form)
-    (regexp-quote (char-to-string form)))
-   ((symbolp form)
-    (let ((info (rx-info form nil)))
-      (cond ((stringp info)
-             info)
-            ((null info)
-             (error "Unknown rx form `%s'" form))
-            (t
-             (funcall (nth 0 info) form)))))
-   ((consp form)
-    (let ((info (rx-info (car form) 'head)))
-      (unless (consp info)
-        (error "Unknown rx form `%s'" (car form)))
-      (funcall (nth 0 info) form)))
-   (t
-    (error "rx syntax error at `%s'" form))))
+  (let ((rx-parent parent))
+    (cond
+     ((stringp form)
+      (rx-group-if (regexp-quote form)
+                   (if (and (eq parent '*) (< 1 (length form)))
+                       parent)))
+     ((integerp form)
+      (regexp-quote (char-to-string form)))
+     ((symbolp form)
+      (let ((info (rx-info form nil)))
+        (cond ((stringp info)
+               info)
+              ((null info)
+               (error "Unknown rx form `%s'" form))
+              (t
+               (funcall (nth 0 info) form)))))
+     ((consp form)
+      (let ((info (rx-info (car form) 'head)))
+        (unless (consp info)
+          (error "Unknown rx form `%s'" (car form)))
+        (funcall (nth 0 info) form)))
+     (t
+      (error "rx syntax error at `%s'" form)))))
 
 
 ;;;###autoload
@@ -897,6 +922,7 @@ CHAR
      matches any character in SET ....  SET may be a character or string.
      Ranges of characters can be specified as `A-Z' in strings.
      Ranges may also be specified as conses like `(?A . ?Z)'.
+     Reversed ranges like `Z-A' and `(?Z . ?A)' are not permitted.
 
      SET may also be the name of a character class: `digit',
      `control', `hex-digit', `blank', `graph', `print', `alnum',
@@ -957,7 +983,7 @@ CHAR
      matches 0 through 9.
 
 `control', `cntrl'
-     matches ASCII control characters.
+     matches any character whose code is in the range 0-31.
 
 `hex-digit', `hex', `xdigit'
      matches 0 through 9, a through f and A through F.
@@ -1044,7 +1070,9 @@ CHAR
      matches a character with category CATEGORY.  CATEGORY must be
      either a character to use for C, or one of the following symbols.
 
-     `consonant'                       (\\c0 in string notation)
+     `space-for-indent'                 (\\c\\s in string notation)
+     `base'                             (\\c.)
+     `consonant'                       (\\c0)
      `base-vowel'                      (\\c1)
      `upper-diacritical-mark'          (\\c2)
      `lower-diacritical-mark'          (\\c3)
@@ -1062,7 +1090,9 @@ CHAR
      `japanese-hiragana-two-byte'      (\\cH)
      `indian-two-byte'                 (\\cI)
      `japanese-katakana-two-byte'      (\\cK)
+     `strong-left-to-right'             (\\cL)
      `korean-hangul-two-byte'          (\\cN)
+     `strong-right-to-left'             (\\cR)
      `cyrillic-two-byte'               (\\cY)
      `combining-diacritic'             (\\c^)
      `ascii'                           (\\ca)
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index b40c424..3413cd1 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -1,10 +1,10 @@
 ;;; seq.el --- Sequence manipulation functions  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <address@hidden>
 ;; Keywords: sequences
-;; Version: 2.20
+;; Version: 2.21
 ;; Package: seq
 
 ;; Maintainer: address@hidden
@@ -110,6 +110,14 @@ name to be bound to the rest of SEQUENCE."
   "Return the number of elements of SEQUENCE."
   (length sequence))
 
+(defun seq-first (sequence)
+  "Return the first element of SEQUENCE."
+  (seq-elt sequence 0))
+
+(defun seq-rest (sequence)
+  "Return a sequence of the elements of SEQUENCE except the first one."
+  (seq-drop sequence 1))
+
 (cl-defgeneric seq-do (function sequence)
   "Apply FUNCTION to each element of SEQUENCE, presumably for side effects.
 Return SEQUENCE."
@@ -348,6 +356,7 @@ found or not."
     count))
 
 (cl-defgeneric seq-contains (sequence elt &optional testfn)
+  (declare (obsolete seq-contains-p "27.1"))
   "Return the first element in SEQUENCE that is equal to ELT.
 Equality is defined by TESTFN if non-nil or by `equal' if nil."
   (seq-some (lambda (e)
@@ -355,11 +364,20 @@ Equality is defined by TESTFN if non-nil or by `equal' if 
nil."
                 e))
             sequence))
 
+(cl-defgeneric seq-contains-p (sequence elt &optional testfn)
+  "Return non-nil if SEQUENCE contains an element equal to ELT.
+Equality is defined by TESTFN if non-nil or by `equal' if nil."
+    (catch 'seq--break
+      (seq-doseq (e sequence)
+        (when (funcall (or testfn #'equal) e elt)
+          (throw 'seq--break t)))
+      nil))
+
 (cl-defgeneric seq-set-equal-p (sequence1 sequence2 &optional testfn)
   "Return non-nil if SEQUENCE1 and SEQUENCE2 contain the same elements, 
regardless of order.
 Equality is defined by TESTFN if non-nil or by `equal' if nil."
-  (and (seq-every-p (lambda (item1) (seq-contains sequence2 item1 testfn)) 
sequence1)
-       (seq-every-p (lambda (item2) (seq-contains sequence1 item2 testfn)) 
sequence2)))
+  (and (seq-every-p (lambda (item1) (seq-contains-p sequence2 item1 testfn)) 
sequence1)
+       (seq-every-p (lambda (item2) (seq-contains-p sequence1 item2 testfn)) 
sequence2)))
 
 (cl-defgeneric seq-position (sequence elt &optional testfn)
   "Return the index of the first element in SEQUENCE that is equal to ELT.
@@ -377,7 +395,7 @@ Equality is defined by TESTFN if non-nil or by `equal' if 
nil."
 TESTFN is used to compare elements, or `equal' if TESTFN is nil."
   (let ((result '()))
     (seq-doseq (elt sequence)
-      (unless (seq-contains result elt testfn)
+      (unless (seq-contains-p result elt testfn)
         (setq result (cons elt result))))
     (nreverse result)))
 
@@ -402,7 +420,7 @@ negative integer or 0, nil is returned."
   "Return a list of the elements that appear in both SEQUENCE1 and SEQUENCE2.
 Equality is defined by TESTFN if non-nil or by `equal' if nil."
   (seq-reduce (lambda (acc elt)
-                (if (seq-contains sequence2 elt testfn)
+                (if (seq-contains-p sequence2 elt testfn)
                     (cons elt acc)
                   acc))
               (seq-reverse sequence1)
@@ -412,9 +430,9 @@ Equality is defined by TESTFN if non-nil or by `equal' if 
nil."
   "Return a list of the elements that appear in SEQUENCE1 but not in SEQUENCE2.
 Equality is defined by TESTFN if non-nil or by `equal' if nil."
   (seq-reduce (lambda (acc elt)
-                (if (not (seq-contains sequence2 elt testfn))
-                    (cons elt acc)
-                  acc))
+                (if (seq-contains-p sequence2 elt testfn)
+                    acc
+                  (cons elt acc)))
               (seq-reverse sequence1)
               '()))
 
diff --git a/lisp/emacs-lisp/shadow.el b/lisp/emacs-lisp/shadow.el
index 260ac36..85adbe3 100644
--- a/lisp/emacs-lisp/shadow.el
+++ b/lisp/emacs-lisp/shadow.el
@@ -1,6 +1,6 @@
 ;;; shadow.el --- locate Emacs Lisp file shadowings
 
-;; Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Terry Jones <address@hidden>
 ;; Keywords: lisp
diff --git a/lisp/emacs-lisp/smie.el b/lisp/emacs-lisp/smie.el
index 4b82172..92b639d 100644
--- a/lisp/emacs-lisp/smie.el
+++ b/lisp/emacs-lisp/smie.el
@@ -1,6 +1,6 @@
 ;;; smie.el --- Simple Minded Indentation Engine -*- lexical-binding: t -*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: languages, lisp, internal, parsing, indentation
@@ -533,9 +533,9 @@ PREC2 is a table as returned by `smie-precs->prec2' or
                      (setq y (cons nil (cons nil nil)))
                      (push (cons (cdr k) y) table))
                    (pcase v
-                     (`= (push (cons x y) eqs))
-                     (`< (push (cons x y) csts))
-                     (`> (push (cons y x) csts))
+                     ('= (push (cons x y) eqs))
+                     ('< (push (cons x y) csts))
+                     ('> (push (cons y x) csts))
                      (_ (error "SMIE error: prec2 has %S↦%S which ∉ {<,+,>}"
                                k v))))))
              prec2)
@@ -612,8 +612,8 @@ PREC2 is a table as returned by `smie-precs->prec2' or
     (dolist (x (gethash :smie-open/close-alist prec2))
       (let* ((token (car x))
              (cons (pcase (cdr x)
-                     (`closer (cddr (assoc token table)))
-                     (`opener (cdr (assoc token table))))))
+                     ('closer (cddr (assoc token table)))
+                     ('opener (cdr (assoc token table))))))
         ;; `cons' can be nil for openers/closers which only contain
         ;; "atomic" elements.
         (when cons
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 20eb0d5..b9ffe6a 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -1,6 +1,6 @@
 ;;; subr-x.el --- extra Lisp functions  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: convenience
@@ -122,7 +122,7 @@ If ELT is of the form ((EXPR)), listify (EXPR) with a dummy 
symbol."
             bindings)))
 
 (defmacro if-let* (varlist then &rest else)
-  "Bind variables according to VARLIST and eval THEN or ELSE.
+  "Bind variables according to VARLIST and evaluate THEN or ELSE.
 This is like `if-let' but doesn't handle a VARLIST of the form
 \(SYMBOL SOMETHING) specially."
   (declare (indent 2)
@@ -136,14 +136,14 @@ This is like `if-let' but doesn't handle a VARLIST of the 
form
     `(let* () ,then)))
 
 (defmacro when-let* (varlist &rest body)
-  "Bind variables according to VARLIST and conditionally eval BODY.
+  "Bind variables according to VARLIST and conditionally evaluate BODY.
 This is like `when-let' but doesn't handle a VARLIST of the form
 \(SYMBOL SOMETHING) specially."
   (declare (indent 1) (debug if-let*))
   (list 'if-let* varlist (macroexp-progn body)))
 
 (defmacro and-let* (varlist &rest body)
-  "Bind variables according to VARLIST and conditionally eval BODY.
+  "Bind variables according to VARLIST and conditionally evaluate BODY.
 Like `when-let*', except if BODY is empty and all the bindings
 are non-nil, then the result is non-nil."
   (declare (indent 1)
@@ -157,22 +157,20 @@ are non-nil, then the result is non-nil."
       `(let* () ,@(or body '(t))))))
 
 (defmacro if-let (spec then &rest else)
-  "Bind variables according to SPEC and eval THEN or ELSE.
-Each binding is evaluated in turn, and evaluation stops if a
-binding value is nil.  If all are non-nil, the value of THEN is
-returned, or the last form in ELSE is returned.
+  "Bind variables according to SPEC and evaluate THEN or ELSE.
+Evaluate each binding in turn, stopping if a binding value is nil.
+If all are non-nil return the value of THEN, otherwise the last form in ELSE.
 
-Each element of SPEC is a list (SYMBOL VALUEFORM) which binds
+Each element of SPEC is a list (SYMBOL VALUEFORM) that binds
 SYMBOL to the value of VALUEFORM.  An element can additionally be
 of the form (VALUEFORM), which is evaluated and checked for nil;
 i.e. SYMBOL can be omitted if only the test result is of
 interest.  It can also be of the form SYMBOL, then the binding of
 SYMBOL is checked for nil.
 
-As a special case, a SPEC of the form \(SYMBOL SOMETHING) is
-interpreted like \((SYMBOL SOMETHING)). This exists for backward
-compatibility with the old syntax that accepted only one
-binding."
+As a special case, interprets a SPEC of the form \(SYMBOL SOMETHING)
+like \((SYMBOL SOMETHING)).  This exists for backward compatibility
+with an old syntax that accepted only one binding."
   (declare (indent 2)
            (debug ([&or (&rest [&or symbolp (symbolp form) (form)])
                         (symbolp form)]
@@ -184,10 +182,9 @@ binding."
   (list 'if-let* spec then (macroexp-progn else)))
 
 (defmacro when-let (spec &rest body)
-  "Bind variables according to SPEC and conditionally eval BODY.
-Each binding is evaluated in turn, and evaluation stops if a
-binding value is nil.  If all are non-nil, the value of the last
-form in BODY is returned.
+  "Bind variables according to SPEC and conditionally evaluate BODY.
+Evaluate each binding in turn, stopping if a binding value is nil.
+If all are non-nil, return the value of the last form in BODY.
 
 The variable list SPEC is the same as in `if-let'."
   (declare (indent 1) (debug if-let))
@@ -253,6 +250,35 @@ TRIM-LEFT and TRIM-RIGHT default to \"[ \\t\\n\\r]+\"."
       (substring string 0 (- (length string) (length suffix)))
     string))
 
+(defun replace-region-contents (beg end replace-fn
+                                    &optional max-secs max-costs)
+  "Replace the region between BEG and END using REPLACE-FN.
+REPLACE-FN runs on the current buffer narrowed to the region.  It
+should return either a string or a buffer replacing the region.
+
+The replacement is performed using `replace-buffer-contents'
+which also describes the MAX-SECS and MAX-COSTS arguments and the
+return value.
+
+Note: If the replacement is a string, it'll be placed in a
+temporary buffer so that `replace-buffer-contents' can operate on
+it.  Therefore, if you already have the replacement in a buffer,
+it makes no sense to convert it to a string using
+`buffer-substring' or similar."
+  (save-excursion
+    (save-restriction
+      (narrow-to-region beg end)
+      (goto-char (point-min))
+      (let ((repl (funcall replace-fn)))
+       (if (bufferp repl)
+           (replace-buffer-contents repl max-secs max-costs)
+         (let ((source-buffer (current-buffer)))
+           (with-temp-buffer
+             (insert repl)
+             (let ((tmp-buffer (current-buffer)))
+               (set-buffer source-buffer)
+               (replace-buffer-contents tmp-buffer max-secs max-costs)))))))))
+
 (provide 'subr-x)
 
 ;;; subr-x.el ends here
diff --git a/lisp/emacs-lisp/syntax.el b/lisp/emacs-lisp/syntax.el
index ad1a966..d09d6c1 100644
--- a/lisp/emacs-lisp/syntax.el
+++ b/lisp/emacs-lisp/syntax.el
@@ -1,6 +1,6 @@
 ;;; syntax.el --- helper functions to find syntactic context  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: internal
@@ -176,7 +176,7 @@ Note: back-references in REGEXPs do not work."
          (re
           (mapconcat
            (lambda (rule)
-             (let* ((orig-re (eval (car rule)))
+             (let* ((orig-re (eval (car rule) t))
                     (re orig-re))
                (when (and (assq 0 rule) (cdr rules))
                  ;; If there's more than 1 rule, and the rule want to apply
@@ -190,7 +190,7 @@ Note: back-references in REGEXPs do not work."
                       (cond
                        ((assq 0 rule) (if (zerop offset) t
                                         `(match-beginning ,offset)))
-                       ((null (cddr rule))
+                       ((and (cdr rule) (null (cddr rule)))
                         `(match-beginning ,(+ offset (car (cadr rule)))))
                        (t
                         `(or ,@(mapcar
@@ -434,14 +434,20 @@ These are valid when the buffer has no restriction.")
        (setcdr cell cache)))
     ))
 
+;;; FIXME: Explain this variable.  Currently only its last (5th) slot is used.
+;;; Perhaps the other slots should be removed?
 (defvar syntax-ppss-stats
-  [(0 . 0.0) (0 . 0.0) (0 . 0.0) (0 . 0.0) (0 . 0.0) (1 . 2500.0)])
+  [(0 . 0) (0 . 0) (0 . 0) (0 . 0) (0 . 0) (2 . 2500)])
 (defun syntax-ppss-stats ()
   (mapcar (lambda (x)
            (condition-case nil
-               (cons (car x) (truncate (/ (cdr x) (car x))))
+               (cons (car x) (/ (cdr x) (car x)))
              (error nil)))
          syntax-ppss-stats))
+(defun syntax-ppss--update-stats (i old new)
+  (let ((pair (aref syntax-ppss-stats i)))
+    (cl-incf (car pair))
+    (cl-incf (cdr pair) (- new old))))
 
 (defvar-local syntax-ppss-table nil
   "Syntax-table to use during `syntax-ppss', if any.")
@@ -486,11 +492,10 @@ running the hook."
        (if (and old-pos (< (- pos old-pos)
                            ;; The time to use syntax-begin-function and
                            ;; find PPSS is assumed to be about 2 * distance.
-                           (* 2 (/ (cdr (aref syntax-ppss-stats 5))
-                                   (1+ (car (aref syntax-ppss-stats 5)))))))
+                           (let ((pair (aref syntax-ppss-stats 5)))
+                             (/ (* 2 (cdr pair)) (car pair)))))
            (progn
-             (cl-incf (car (aref syntax-ppss-stats 0)))
-             (cl-incf (cdr (aref syntax-ppss-stats 0)) (- pos old-pos))
+             (syntax-ppss--update-stats 0 old-pos pos)
              (parse-partial-sexp old-pos pos nil nil old-ppss))
 
          (cond
@@ -506,8 +511,7 @@ running the hook."
                 (setq pt-min (or (syntax-ppss-toplevel-pos old-ppss)
                                  (nth 2 old-ppss)))
                 (<= pt-min pos) (< (- pos pt-min) syntax-ppss-max-span))
-           (cl-incf (car (aref syntax-ppss-stats 1)))
-           (cl-incf (cdr (aref syntax-ppss-stats 1)) (- pos pt-min))
+           (syntax-ppss--update-stats 1 pt-min pos)
            (setq ppss (parse-partial-sexp pt-min pos)))
           ;; The OLD-* data can't be used.  Consult the cache.
           (t
@@ -529,14 +533,18 @@ running the hook."
 
              ;; Setup the before-change function if necessary.
              (unless (or ppss-cache ppss-last)
+                ;; We should be either the very last function on
+                ;; before-change-functions or the very first on
+                ;; after-change-functions.
+                ;; Note: combine-change-calls-1 needs to be kept in sync
+                ;; with this!
                (add-hook 'before-change-functions
                          'syntax-ppss-flush-cache t t))
 
              ;; Use the best of OLD-POS and CACHE.
              (if (or (not old-pos) (< old-pos pt-min))
                  (setq pt-best pt-min ppss-best ppss)
-               (cl-incf (car (aref syntax-ppss-stats 4)))
-               (cl-incf (cdr (aref syntax-ppss-stats 4)) (- pos old-pos))
+               (syntax-ppss--update-stats 4 old-pos pos)
                (setq pt-best old-pos ppss-best old-ppss))
 
              ;; Use the `syntax-begin-function' if available.
@@ -556,21 +564,18 @@ running the hook."
                         (not (memq (get-text-property (point) 'face)
                                    '(font-lock-string-face font-lock-doc-face
                                      font-lock-comment-face))))
-               (cl-incf (car (aref syntax-ppss-stats 5)))
-               (cl-incf (cdr (aref syntax-ppss-stats 5)) (- pos (point)))
+               (syntax-ppss--update-stats 5 (point) pos)
                (setq pt-best (point) ppss-best nil))
 
              (cond
               ;; Quick case when we found a nearby pos.
               ((< (- pos pt-best) syntax-ppss-max-span)
-               (cl-incf (car (aref syntax-ppss-stats 2)))
-               (cl-incf (cdr (aref syntax-ppss-stats 2)) (- pos pt-best))
+               (syntax-ppss--update-stats 2 pt-best pos)
                (setq ppss (parse-partial-sexp pt-best pos nil nil ppss-best)))
               ;; Slow case: compute the state from some known position and
               ;; populate the cache so we won't need to do it again soon.
               (t
-               (cl-incf (car (aref syntax-ppss-stats 3)))
-               (cl-incf (cdr (aref syntax-ppss-stats 3)) (- pos pt-min))
+               (syntax-ppss--update-stats 3 pt-min pos)
 
                ;; If `pt-min' is too far, add a few intermediate entries.
                (while (> (- pos pt-min) (* 2 syntax-ppss-max-span))
diff --git a/lisp/emacs-lisp/tabulated-list.el 
b/lisp/emacs-lisp/tabulated-list.el
index 58619ec..b23ce21 100644
--- a/lisp/emacs-lisp/tabulated-list.el
+++ b/lisp/emacs-lisp/tabulated-list.el
@@ -1,6 +1,6 @@
 ;;; tabulated-list.el --- generic major mode for tabulated lists -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Chong Yidong <address@hidden>
 ;; Keywords: extensions, lisp
@@ -36,6 +36,43 @@
 
 ;;; Code:
 
+(defgroup tabulated-list nil
+  "Tabulated-list customization group."
+  :group 'convenience
+  :group 'display)
+
+(defcustom tabulated-list-gui-sort-indicator-asc ?▼
+  "Indicator for columns sorted in ascending order, for GUI frames.
+See `tabulated-list-tty-sort-indicator-asc' for the indicator used on
+text-mode frames."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
+(defcustom tabulated-list-gui-sort-indicator-desc ?▲
+  "Indicator for columns sorted in descending order, for GUI frames.
+See `tabulated-list-tty-sort-indicator-desc' for the indicator used on
+text-mode frames."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
+(defcustom tabulated-list-tty-sort-indicator-asc ?v
+  "Indicator for columns sorted in ascending order, for text-mode frames.
+See `tabulated-list-gui-sort-indicator-asc' for the indicator used on GUI
+frames."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
+(defcustom tabulated-list-tty-sort-indicator-desc ?^
+  "Indicator for columns sorted in ascending order, for text-mode frames.
+See `tabulated-list-gui-sort-indicator-asc' for the indicator used on GUI
+frames."
+  :group 'tabulated-list
+  :type 'character
+  :version "27.1")
+
 ;; The reason `tabulated-list-format' and other variables are
 ;; permanent-local is to make it convenient to switch to a different
 ;; major mode, switch back, and have the original Tabulated List data
@@ -151,8 +188,10 @@ If ADVANCE is non-nil, move forward by one line 
afterwards."
       (forward-line)))
 
 (defvar tabulated-list-mode-map
-  (let ((map (copy-keymap special-mode-map)))
-    (set-keymap-parent map button-buffer-map)
+  (let ((map (make-sparse-keymap)))
+    (set-keymap-parent map (make-composed-keymap
+                            button-buffer-map
+                            special-mode-map))
     (define-key map "n" 'next-line)
     (define-key map "p" 'previous-line)
     (define-key map "S" 'tabulated-list-sort)
@@ -172,14 +211,20 @@ If ADVANCE is non-nil, move forward by one line 
afterwards."
     map)
   "Local keymap for `tabulated-list-mode' sort buttons.")
 
-(defvar tabulated-list-glyphless-char-display
+(defun tabulated-list-make-glyphless-char-display-table ()
+  "Make the `glyphless-char-display' table used for text-mode frames.
+This table is used for displaying the sorting indicators, see
+variables `tabulated-list-tty-sort-indicator-asc' and
+`tabulated-list-tty-sort-indicator-desc' for more information."
   (let ((table (make-char-table 'glyphless-char-display nil)))
     (set-char-table-parent table glyphless-char-display)
-    ;; Some text terminals can't display the Unicode arrows; be safe.
-    (aset table 9650 (cons nil "^"))
-    (aset table 9660 (cons nil "v"))
-    table)
-  "The `glyphless-char-display' table in Tabulated List buffers.")
+    (aset table
+          tabulated-list-gui-sort-indicator-desc
+          (cons nil (char-to-string tabulated-list-tty-sort-indicator-desc)))
+    (aset table
+          tabulated-list-gui-sort-indicator-asc
+          (cons nil (char-to-string tabulated-list-tty-sort-indicator-asc)))
+    table))
 
 (defvar tabulated-list--header-string nil
   "Holds the header if `tabulated-list-use-header-line' is nil.
@@ -229,8 +274,11 @@ Populated by `tabulated-list-init-header'.")
                  (concat label
                          (cond
                           ((> (+ 2 (length label)) width) "")
-                          ((cdr tabulated-list-sort-key) " ▲")
-                          (t " ▼")))
+                          ((cdr tabulated-list-sort-key)
+                            (format " %c"
+                                    tabulated-list-gui-sort-indicator-desc))
+                          (t (format " %c"
+                                      tabulated-list-gui-sort-indicator-asc))))
                  'face 'bold
                  'tabulated-list-column-name label
                  button-props))
@@ -653,7 +701,8 @@ as the ewoc pretty-printer."
   (setq-local truncate-lines t)
   (setq-local buffer-undo-list t)
   (setq-local revert-buffer-function #'tabulated-list-revert)
-  (setq-local glyphless-char-display tabulated-list-glyphless-char-display)
+  (setq-local glyphless-char-display
+              (tabulated-list-make-glyphless-char-display-table))
   ;; Avoid messing up the entries' display just because the first
   ;; column of the first entry happens to begin with a R2L letter.
   (setq bidi-paragraph-direction 'left-to-right)
diff --git a/lisp/emacs-lisp/tcover-ses.el b/lisp/emacs-lisp/tcover-ses.el
index 21bc2ce..29b4818 100644
--- a/lisp/emacs-lisp/tcover-ses.el
+++ b/lisp/emacs-lisp/tcover-ses.el
@@ -1,6 +1,6 @@
 ;;;; testcover-ses.el -- Example use of `testcover' to test "SES"
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Jonathan Yavner <address@hidden>
 ;; Maintainer: Jonathan Yavner <address@hidden>
diff --git a/lisp/emacs-lisp/tcover-unsafep.el 
b/lisp/emacs-lisp/tcover-unsafep.el
index ecfb3bb..571f53c 100644
--- a/lisp/emacs-lisp/tcover-unsafep.el
+++ b/lisp/emacs-lisp/tcover-unsafep.el
@@ -1,6 +1,6 @@
 ;;;; testcover-unsafep.el -- Use testcover to test unsafep's code coverage
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Jonathan Yavner <address@hidden>
 ;; Maintainer: Jonathan Yavner <address@hidden>
diff --git a/lisp/emacs-lisp/testcover.el b/lisp/emacs-lisp/testcover.el
index d48c79c..1ea1285 100644
--- a/lisp/emacs-lisp/testcover.el
+++ b/lisp/emacs-lisp/testcover.el
@@ -1,6 +1,6 @@
 ;;;; testcover.el -- Visual code-coverage tool  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Jonathan Yavner <address@hidden>
 ;; Maintainer: Jonathan Yavner <address@hidden>
diff --git a/lisp/emacs-lisp/text-property-search.el 
b/lisp/emacs-lisp/text-property-search.el
index b464402..41ca070 100644
--- a/lisp/emacs-lisp/text-property-search.el
+++ b/lisp/emacs-lisp/text-property-search.el
@@ -1,6 +1,6 @@
 ;;; text-property-search.el --- search for text properties  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: convenience
diff --git a/lisp/emacs-lisp/thunk.el b/lisp/emacs-lisp/thunk.el
index 823d496..e1370c4 100644
--- a/lisp/emacs-lisp/thunk.el
+++ b/lisp/emacs-lisp/thunk.el
@@ -1,6 +1,6 @@
 ;;; thunk.el --- Lazy form evaluation  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <address@hidden>
 ;; Keywords: sequences
diff --git a/lisp/emacs-lisp/timer-list.el b/lisp/emacs-lisp/timer-list.el
index f0fd4f4..81e2f91 100644
--- a/lisp/emacs-lisp/timer-list.el
+++ b/lisp/emacs-lisp/timer-list.el
@@ -1,6 +1,6 @@
 ;;; timer-list.el --- list active timers in a buffer
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Package: emacs
@@ -37,16 +37,14 @@
                       ;; Idle.
                       (if (aref timer 7) "*" " ")
                       ;; Next time.
-                      (let ((time (float-time (list (aref timer 1)
-                                                    (aref timer 2)
-                                                    (aref timer 3)))))
+                     (let ((time (list (aref timer 1)
+                                       (aref timer 2)
+                                       (aref timer 3))))
                         (format "%.2f"
-                                (if (aref timer 7)
-                                    time
-                                  (- (float-time (list (aref timer 1)
-                                                       (aref timer 2)
-                                                       (aref timer 3)))
-                                     (float-time)))))
+                               (float-time
+                                (if (aref timer 7)
+                                    time
+                                  (time-subtract time nil)))))
                       ;; Repeat.
                       (let ((repeat (aref timer 4)))
                         (cond
diff --git a/lisp/emacs-lisp/timer.el b/lisp/emacs-lisp/timer.el
index 56323c8..f706d9b 100644
--- a/lisp/emacs-lisp/timer.el
+++ b/lisp/emacs-lisp/timer.el
@@ -1,6 +1,6 @@
 ;;; timer.el --- run a function with args at some time in future -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Package: emacs
@@ -74,7 +74,7 @@
 
 (defun timer-set-time (timer time &optional delta)
   "Set the trigger time of TIMER to TIME.
-TIME must be in the internal format returned by, e.g., `current-time'.
+TIME must be a Lisp time value.
 If optional third argument DELTA is a positive number, make the timer
 fire repeatedly that many seconds apart."
   (setf (timer--time timer) time)
@@ -88,7 +88,7 @@ SECS may be an integer, floating point number, or the internal
 time format returned by, e.g., `current-idle-time'.
 If optional third argument REPEAT is non-nil, make the timer
 fire each time Emacs is idle for that many seconds."
-  (setf (timer--time timer) (if (consp secs) secs (seconds-to-time secs)))
+  (setf (timer--time timer) secs)
   (setf (timer--repeat-delay timer) repeat)
   timer)
 
@@ -249,8 +249,8 @@ how many will really happen."
 (defun timer-until (timer time)
   "Calculate number of seconds from when TIMER will run, until TIME.
 TIMER is a timer, and stands for the time when its next repeat is scheduled.
-TIME is a time-list."
-  (- (float-time time) (float-time (timer--time timer))))
+TIME is a Lisp time value."
+  (float-time (time-subtract time (timer--time timer))))
 
 (defun timer-event-handler (timer)
   "Call the handler for the timer TIMER.
@@ -281,7 +281,7 @@ This function is called, by name, directly by the C code."
               ;; perhaps because Emacs was suspended for a long time,
               ;; limit how many times things get repeated.
               (if (and (numberp timer-max-repeats)
-                       (< 0 (timer-until timer nil)))
+                      (time-less-p nil (timer--time timer)))
                   (let ((repeats (/ (timer-until timer nil)
                                     (timer--repeat-delay timer))))
                     (if (> repeats timer-max-repeats)
diff --git a/lisp/emacs-lisp/tq.el b/lisp/emacs-lisp/tq.el
index f23c387..4249305 100644
--- a/lisp/emacs-lisp/tq.el
+++ b/lisp/emacs-lisp/tq.el
@@ -1,6 +1,6 @@
 ;;; tq.el --- utility to maintain a transaction queue  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1985-1987, 1992, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1985-1987, 1992, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Scott Draves <address@hidden>
diff --git a/lisp/emacs-lisp/trace.el b/lisp/emacs-lisp/trace.el
index b92395b..2f271c1 100644
--- a/lisp/emacs-lisp/trace.el
+++ b/lisp/emacs-lisp/trace.el
@@ -1,6 +1,6 @@
 ;;; trace.el --- tracing facility for Emacs Lisp functions  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993, 1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Hans Chalupsky <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/emacs-lisp/unsafep.el b/lisp/emacs-lisp/unsafep.el
index 03f22eb..d20b751 100644
--- a/lisp/emacs-lisp/unsafep.el
+++ b/lisp/emacs-lisp/unsafep.el
@@ -1,6 +1,6 @@
 ;;;; unsafep.el -- Determine whether a Lisp form is safe to evaluate
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Jonathan Yavner <address@hidden>
 ;; Maintainer: Jonathan Yavner <address@hidden>
diff --git a/lisp/emacs-lisp/warnings.el b/lisp/emacs-lisp/warnings.el
index c4d97ce..13ca605 100644
--- a/lisp/emacs-lisp/warnings.el
+++ b/lisp/emacs-lisp/warnings.el
@@ -1,6 +1,6 @@
 ;;; warnings.el --- log and display warnings
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: internal
diff --git a/lisp/emacs-lock.el b/lisp/emacs-lock.el
index 1ff69cc..0cded29 100644
--- a/lisp/emacs-lock.el
+++ b/lisp/emacs-lock.el
@@ -1,6 +1,6 @@
 ;;; emacs-lock.el --- protect buffers against killing or exiting -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Juanma Barranquero <address@hidden>
 ;; Inspired by emacs-lock.el by Tom Wurgler <address@hidden>
diff --git a/lisp/emulation/cua-base.el b/lisp/emulation/cua-base.el
index f114342..302ef12 100644
--- a/lisp/emulation/cua-base.el
+++ b/lisp/emulation/cua-base.el
@@ -1,6 +1,6 @@
 ;;; cua-base.el --- emulate CUA key bindings
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <address@hidden>
 ;; Keywords: keyboard emulations convenience cua
@@ -39,7 +39,7 @@
 ;;     C-v     -> paste
 ;;
 ;; The tricky part is the handling of the C-x and C-c keys which
-;; are normally used as prefix keys for most of emacs' built-in
+;; are normally used as prefix keys for most of Emacs' built-in
 ;; commands.  With CUA they still do!!!
 ;;
 ;; Only when the region is currently active (and highlighted since
@@ -69,7 +69,7 @@
 ;; [C-space] to start the region and use unshifted movement keys to extend
 ;; it. To cancel the region, use [C-space] or [C-g].
 
-;; If you prefer to use the standard emacs cut, copy, paste, and undo
+;; If you prefer to use the standard Emacs cut, copy, paste, and undo
 ;; bindings, customize cua-enable-cua-keys to nil.
 
 
@@ -138,7 +138,7 @@
 ;; cua-mode's superior rectangle support uses a true visual
 ;; representation of the selected rectangle, i.e. it highlights the
 ;; actual part of the buffer that is currently selected as part of the
-;; rectangle.  Unlike emacs' traditional rectangle commands, the
+;; rectangle.  Unlike Emacs' traditional rectangle commands, the
 ;; selected rectangle always as straight left and right edges, even
 ;; when those are in the middle of a TAB character or beyond the end
 ;; of the current line.  And it does this without actually modifying
@@ -710,7 +710,8 @@ a cons (TYPE . COLOR), then both properties are affected."
     ;; C-x binding after the first C-x C-x was rewritten to just C-x).
     (prefix-command-preserve-state)
     ;; Push the key back on the event queue
-    (setq unread-command-events (cons key unread-command-events))))
+    (setq unread-command-events (cons (cons 'no-record key)
+                                      unread-command-events))))
 
 (defun cua--prefix-override-handler ()
   "Start timer waiting for prefix key to be followed by another key.
@@ -1047,7 +1048,6 @@ If ARG is the atom `-', scroll downward by nearly full 
screen."
        (scroll-up arg)
       (end-of-buffer (goto-char (point-max)))))))
 
-(put 'cua-scroll-up 'CUA 'move)
 (put 'cua-scroll-up 'isearch-scroll t)
 
 (defun cua-scroll-down (&optional arg)
@@ -1068,7 +1068,6 @@ If ARG is the atom `-', scroll upward by nearly full 
screen."
        (scroll-down arg)
       (beginning-of-buffer (goto-char (point-min)))))))
 
-(put 'cua-scroll-down 'CUA 'move)
 (put 'cua-scroll-down 'isearch-scroll t)
 
 ;;; Cursor indications
diff --git a/lisp/emulation/cua-gmrk.el b/lisp/emulation/cua-gmrk.el
index 7f817da..16eff9d 100644
--- a/lisp/emulation/cua-gmrk.el
+++ b/lisp/emulation/cua-gmrk.el
@@ -1,6 +1,6 @@
 ;;; cua-gmrk.el --- CUA unified global mark support
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <address@hidden>
 ;; Keywords: keyboard emulations convenience cua mark
diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el
index 296aba1..706634a 100644
--- a/lisp/emulation/cua-rect.el
+++ b/lisp/emulation/cua-rect.el
@@ -1,6 +1,6 @@
 ;;; cua-rect.el --- CUA unified rectangle support
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <address@hidden>
 ;; Keywords: keyboard emulations convenience CUA
diff --git a/lisp/emulation/edt-lk201.el b/lisp/emulation/edt-lk201.el
index 6073501..797de50 100644
--- a/lisp/emulation/edt-lk201.el
+++ b/lisp/emulation/edt-lk201.el
@@ -1,6 +1,6 @@
 ;;; edt-lk201.el --- enhanced EDT keypad mode emulation for LK-201 keyboards
 
-;; Copyright (C) 1986, 1992-1993, 1995, 2001-2018 Free Software
+;; Copyright (C) 1986, 1992-1993, 1995, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Kevin Gallagher <address@hidden>
diff --git a/lisp/emulation/edt-mapper.el b/lisp/emulation/edt-mapper.el
index 87becd5..b8e28f5 100644
--- a/lisp/emulation/edt-mapper.el
+++ b/lisp/emulation/edt-mapper.el
@@ -1,6 +1,6 @@
 ;;; edt-mapper.el --- create an EDT LK-201 map file for X-Windows Emacs
 
-;; Copyright (C) 1994-1995, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Kevin Gallagher <address@hidden>
 ;; Maintainer: Kevin Gallagher <address@hidden>
diff --git a/lisp/emulation/edt-pc.el b/lisp/emulation/edt-pc.el
index 2ee7e34..3fe33ca 100644
--- a/lisp/emulation/edt-pc.el
+++ b/lisp/emulation/edt-pc.el
@@ -1,6 +1,6 @@
 ;;; edt-pc.el --- enhanced EDT keypad mode emulation for PC 101 keyboards
 
-;; Copyright (C) 1986, 1994-1995, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1986, 1994-1995, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Kevin Gallagher <address@hidden>
diff --git a/lisp/emulation/edt-vt100.el b/lisp/emulation/edt-vt100.el
index f85f08e..f3d2518 100644
--- a/lisp/emulation/edt-vt100.el
+++ b/lisp/emulation/edt-vt100.el
@@ -1,6 +1,6 @@
 ;;; edt-vt100.el --- enhanced EDT keypad mode emulation for VT series terminals
 
-;; Copyright (C) 1986, 1992-1993, 1995, 2002-2018 Free Software
+;; Copyright (C) 1986, 1992-1993, 1995, 2002-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Kevin Gallagher <address@hidden>
diff --git a/lisp/emulation/edt.el b/lisp/emulation/edt.el
index 179791b..d1fe0b8 100644
--- a/lisp/emulation/edt.el
+++ b/lisp/emulation/edt.el
@@ -1,6 +1,6 @@
 ;;; edt.el --- enhanced EDT keypad mode emulation for GNU Emacs
 
-;; Copyright (C) 1986, 1992-1995, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1986, 1992-1995, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Kevin Gallagher <address@hidden>
diff --git a/lisp/emulation/keypad.el b/lisp/emulation/keypad.el
index 841cf3c..543a1c9 100644
--- a/lisp/emulation/keypad.el
+++ b/lisp/emulation/keypad.el
@@ -1,6 +1,6 @@
 ;;; keypad.el --- simplified keypad bindings
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <address@hidden>
 ;; Keywords: keyboard convenience
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 3b617a4..f52ce72 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -1,6 +1,6 @@
 ;;; viper-cmd.el --- Vi command support for Viper  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: viper
@@ -1124,7 +1124,7 @@ as a Meta key and any number of multiple escapes are 
allowed."
          ;; it is an error.
          (progn
            ;; new com is (CHAR . OLDCOM)
-           (if (viper-memq-char char '(?# ?\")) (error "Viper bell"))
+           (if (viper-memq-char char '(?# ?\")) (user-error viper-ViperBell))
            (setq com (cons char com))
            (setq cont nil))
        ;; If com is nil we set com as char, and read more.  Again, if char is
@@ -1143,7 +1143,7 @@ as a Meta key and any number of multiple escapes are 
allowed."
               (let ((reg (read-char)))
                 (if (viper-valid-register reg)
                     (setq viper-use-register reg)
-                  (error "Viper bell"))
+                  (user-error viper-ViperBell))
                 (setq char (read-char))))
              (t
               (setq com char)
@@ -1165,7 +1165,7 @@ as a Meta key and any number of multiple escapes are 
allowed."
              (viper-regsuffix-command-p char)
              (viper= char ?!) ; bang command
              (viper= char ?g) ; the gg command (like G0)
-             (error "Viper bell"))
+             (user-error viper-ViperBell))
          (setq cmd-to-exec-at-end
                (viper-exec-form-in-vi
                 `(key-binding (char-to-string ,char)))))
@@ -1199,7 +1199,7 @@ as a Meta key and any number of multiple escapes are 
allowed."
         ((equal com '(?= . ?=)) (viper-line (cons value ?=)))
         ;; gg  acts as G0
         ((equal (car com) ?g)   (viper-goto-line 0))
-        (t (error "Viper bell")))))
+        (t (user-error viper-ViperBell)))))
 
     (if cmd-to-exec-at-end
        (progn
@@ -2609,9 +2609,9 @@ On reaching end of line, stop and signal error."
          ;; the forward motion before the 'viper-execute-com', but, of
          ;; course, 'dl' doesn't work on an empty line, so we have to
          ;; catch that condition before 'viper-execute-com'
-         (if (and (eolp) (bolp)) (error "Viper bell") (forward-char val))
+         (if (and (eolp) (bolp)) (user-error viper-ViperBell) (forward-char 
val))
          (if com (viper-execute-com 'viper-forward-char val com))
-         (if (eolp) (progn (backward-char 1) (error "Viper bell"))))
+         (if (eolp) (progn (backward-char 1) (user-error viper-ViperBell))))
       (forward-char val)
       (if com (viper-execute-com 'viper-forward-char val com)))))
 
@@ -2626,7 +2626,7 @@ On reaching beginning of line, stop and signal error."
     (if com (viper-move-marker-locally 'viper-com-point (point)))
     (if viper-ex-style-motion
        (progn
-         (if (bolp) (error "Viper bell") (backward-char val))
+         (if (bolp) (user-error viper-ViperBell) (backward-char val))
          (if com (viper-execute-com 'viper-backward-char val com)))
       (backward-char val)
       (if com (viper-execute-com 'viper-backward-char val com)))))
@@ -2953,7 +2953,7 @@ On reaching beginning of line, stop and signal error."
     (if com (viper-execute-com 'viper-goto-col val com))
     (save-excursion
       (end-of-line)
-      (if (> val (current-column)) (error "Viper bell")))
+      (if (> val (current-column)) (user-error viper-ViperBell)))
     ))
 
 
@@ -3084,7 +3084,7 @@ If point is on a widget or a button, simulate clicking on 
that widget/button."
 ;; If FORWARD then search is forward, otherwise backward.  OFFSET is used to
 ;; adjust point after search.
 (defun viper-find-char (arg char forward offset)
-  (or (char-or-string-p char) (error "Viper bell"))
+  (or (char-or-string-p char) (user-error viper-ViperBell))
   (let ((arg (if forward arg (- arg)))
        (cmd (if (eq viper-intermediate-command 'viper-repeat)
                 (nth 5 viper-d-com)
@@ -3424,7 +3424,7 @@ controlled by the sign of prefix numeric value."
             (if com (viper-move-marker-locally 'viper-com-point (point)))
             (backward-sexp 1)
             (if com (viper-execute-com 'viper-paren-match nil com)))
-           (t (error "Viper bell"))))))
+           (t (user-error viper-ViperBell))))))
 
 (defun viper-toggle-parse-sexp-ignore-comments ()
   (interactive)
@@ -4001,7 +4001,7 @@ Null string will repeat previous search."
            (let ((reg viper-use-register))
              (setq viper-use-register nil)
              (error viper-EmptyRegister reg))
-         (error "Viper bell")))
+         (user-error viper-ViperBell)))
     (setq viper-use-register nil)
     (if (viper-end-with-a-newline-p text)
        (progn
@@ -4051,7 +4051,7 @@ Null string will repeat previous search."
            (let ((reg viper-use-register))
              (setq viper-use-register nil)
              (error viper-EmptyRegister reg))
-         (error "Viper bell")))
+         (user-error viper-ViperBell)))
     (setq viper-use-register nil)
     (if (viper-end-with-a-newline-p text) (beginning-of-line))
     (viper-set-destructive-command
@@ -4096,7 +4096,7 @@ Null string will repeat previous search."
             (> val (viper-chars-in-region (point) (viper-line-pos 'end))))
        (setq val (viper-chars-in-region (point) (viper-line-pos 'end))))
     (if (and viper-ex-style-motion (eolp))
-       (if (bolp) (error "Viper bell") (setq val 0))) ; not bol---simply back 
1 ch
+       (if (bolp) (user-error viper-ViperBell) (setq val 0))) ; not 
bol---simply back 1 ch
     (save-excursion
       (viper-forward-char-carefully val)
       (setq end-del-pos (point)))
@@ -4366,7 +4366,7 @@ and regexp replace."
          ((viper= char ?,) (viper-cycle-through-mark-ring))
          ((viper= char ?^) (push-mark viper-saved-mark t t))
          ((viper= char ?D) (mark-defun))
-         (t (error "Viper bell"))
+         (t (user-error viper-ViperBell))
          )))
 
 ;; Algorithm: If first invocation of this command save mark on ring, goto
@@ -4465,7 +4465,7 @@ One can use \\=`\\=` and \\='\\=' to temporarily jump 1 
step back."
                 (switch-to-buffer buff)
                 (goto-char viper-com-point)
                 (viper-change-state-to-vi)
-                (error "Viper bell")))))
+                (user-error viper-ViperBell)))))
        ((and (not skip-white) (viper= char ?`))
         (if com (viper-move-marker-locally 'viper-com-point (point)))
         (if (and (viper-same-line (point) viper-last-jump)
diff --git a/lisp/emulation/viper-ex.el b/lisp/emulation/viper-ex.el
index d95a828..45b91cd 100644
--- a/lisp/emulation/viper-ex.el
+++ b/lisp/emulation/viper-ex.el
@@ -1,6 +1,6 @@
 ;;; viper-ex.el --- functions implementing the Ex commands for Viper
 
-;; Copyright (C) 1994-1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: viper
@@ -427,18 +427,18 @@ reversed."
             (forward-char 1)
             (setq ex-token-type 'whole))
            ((= char ?+)
-            (cond ((or (looking-at "+[-+]") (looking-at "+[\n|]"))
+            (cond ((looking-at "\\+[-+\n|]")
                    (forward-char 1)
                    (insert "1")
                    (backward-char 1)
                  (setq ex-token-type 'plus))
-                  ((looking-at "+[0-9]")
+                  ((looking-at "\\+[0-9]")
                    (forward-char 1)
                    (setq ex-token-type 'plus))
                   (t
                    (error viper-BadAddress))))
            ((= char ?-)
-            (cond ((or (looking-at "-[-+]") (looking-at "-[\n|]"))
+            (cond ((looking-at "-[-+\n|]")
                    (forward-char 1)
                    (insert "1")
                    (backward-char 1)
@@ -455,7 +455,7 @@ reversed."
               (while (and (not (eolp)) cont)
                 ;;(re-search-forward "[^/]*/")
                 (re-search-forward "[^/]*\\(/\\|\n\\)")
-                (if (not (looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\/"
+                (if (not (looking-back "[^\\]\\(\\\\\\\\\\)*\\\\/"
                                         (line-beginning-position 0)))
                     (setq cont nil))))
             (backward-char 1)
@@ -469,7 +469,7 @@ reversed."
               (while (and (not (eolp)) cont)
                 ;;(re-search-forward "[^\\?]*\\?")
                 (re-search-forward "[^\\?]*\\(\\?\\|\n\\)")
-                (if (not (looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\\\?"
+                (if (not (looking-back "[^\\]\\(\\\\\\\\\\)*\\\\\\?"
                                         (line-beginning-position 0)))
                     (setq cont nil))
                 (backward-char 1)
@@ -565,7 +565,7 @@ reversed."
   (let (save-pos dist compl-list string-to-complete completion-result)
 
     (save-excursion
-      (setq dist (skip-chars-backward "[a-zA-Z!=>&~]")
+      (setq dist (skip-chars-backward "a-zA-Z!=>&~")
            save-pos (point)))
 
     (if (or (= dist 0)
@@ -744,7 +744,7 @@ reversed."
             (error
              "Global regexp must be inside matching non-alphanumeric chars"))
            ((= c ??) (error "`?' is not an allowed pattern delimiter here")))
-      (if (looking-at "[^\\\\\n]")
+      (if (looking-at "[^\\\n]")
          (progn
            (forward-char 1)
            (set-mark (point))
@@ -757,7 +757,7 @@ reversed."
                        (error "Missing closing delimiter for global regexp")
                      (goto-char (point-max))))
                (if (not (looking-back
-                         (format "[^\\\\]\\(\\\\\\\\\\)*\\\\%c" c)
+                         (format "[^\\]\\(\\\\\\\\\\)*\\\\%c" c)
                           (line-beginning-position 0)))
                    (setq cont nil)
                  ;; we are at an escaped delimiter: unescape it and continue
@@ -1240,7 +1240,7 @@ reversed."
                (read-string "[Hit return to confirm] ")
              (quit
               (save-excursion (kill-buffer " *delete text*"))
-              (error "Viper bell")))
+              (user-error viper-ViperBell)))
            (save-excursion (kill-buffer " *delete text*")))
        (if ex-buffer
            (cond ((viper-valid-register ex-buffer '(Letter))
@@ -1686,7 +1686,7 @@ reversed."
     (message ":set  <Variable> [= <Value>]")
     (or batch (sit-for 2))
 
-    (while (string-match "^[ \\t\\n]*$"
+    (while (string-match "^[ \t\n]*$"
                         (setq str
                               (completing-read ":set " ex-variable-alist)))
       (message ":set <Variable> [= <Value>]")
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index 7db9a34..5a80804 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -1,6 +1,6 @@
 ;;; viper-init.el --- some common definitions for Viper
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: viper
@@ -268,6 +268,7 @@ that deletes a file.")
 (defconst viper-BadAddress "Ill-formed address"   "")
 (defconst viper-FirstAddrExceedsSecond "First address exceeds second"   "")
 (defconst viper-NoFileSpecified "No file specified"   "")
+(defconst viper-ViperBell "Viper bell"   "")
 
 ;; Is t until viper-mode executes for the very first time.
 ;; Prevents recursive descend into startup messages.
diff --git a/lisp/emulation/viper-keym.el b/lisp/emulation/viper-keym.el
index cc0b7eb..8bb75d6 100644
--- a/lisp/emulation/viper-keym.el
+++ b/lisp/emulation/viper-keym.el
@@ -1,6 +1,6 @@
 ;;; viper-keym.el --- Viper keymaps  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1994-1997, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1997, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: viper
diff --git a/lisp/emulation/viper-macs.el b/lisp/emulation/viper-macs.el
index cfb46cc..37ab81d 100644
--- a/lisp/emulation/viper-macs.el
+++ b/lisp/emulation/viper-macs.el
@@ -1,6 +1,6 @@
 ;;; viper-macs.el --- functions implementing keyboard macros for Viper  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1994-1997, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1997, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: viper
diff --git a/lisp/emulation/viper-mous.el b/lisp/emulation/viper-mous.el
index 639596c..e49fc87 100644
--- a/lisp/emulation/viper-mous.el
+++ b/lisp/emulation/viper-mous.el
@@ -1,6 +1,6 @@
 ;;; viper-mous.el --- mouse support for Viper
 
-;; Copyright (C) 1994-1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: viper
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index aa45655..a7e7af3 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -1,6 +1,6 @@
 ;;; viper-util.el --- Utilities used by viper.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1994-1997, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1997, 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: viper
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index 8dd150b..d6912ee 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -3,7 +3,7 @@
 ;;              and a venomous VI PERil.
 ;;              Viper Is also a Package for Emacs Rebels.
 
-;; Copyright (C) 1994-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Keywords: emulations
diff --git a/lisp/env.el b/lisp/env.el
index 7007ba3..5a4130e 100644
--- a/lisp/env.el
+++ b/lisp/env.el
@@ -1,6 +1,6 @@
 ;;; env.el --- functions to manipulate environment variables  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1991, 1994, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 1994, 2000-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: processes, unix
diff --git a/lisp/epa-dired.el b/lisp/epa-dired.el
index 31f398f..3a3a143 100644
--- a/lisp/epa-dired.el
+++ b/lisp/epa-dired.el
@@ -1,5 +1,5 @@
 ;;; epa-dired.el --- the EasyPG Assistant, dired extension -*- 
lexical-binding: t -*-
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Keywords: PGP, GnuPG
diff --git a/lisp/epa-file.el b/lisp/epa-file.el
index 866a4ae..35cd1ec 100644
--- a/lisp/epa-file.el
+++ b/lisp/epa-file.el
@@ -1,5 +1,5 @@
 ;;; epa-file.el --- the EasyPG Assistant, transparent file encryption -*- 
lexical-binding: t -*-
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Keywords: PGP, GnuPG
diff --git a/lisp/epa-hook.el b/lisp/epa-hook.el
index 19f131c..cb9d997 100644
--- a/lisp/epa-hook.el
+++ b/lisp/epa-hook.el
@@ -1,5 +1,5 @@
 ;;; epa-hook.el --- preloaded code to enable epa-file.el -*- lexical-binding: 
t -*-
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Keywords: PGP, GnuPG
diff --git a/lisp/epa-mail.el b/lisp/epa-mail.el
index 0085937..1bb8d9b 100644
--- a/lisp/epa-mail.el
+++ b/lisp/epa-mail.el
@@ -1,5 +1,5 @@
 ;;; epa-mail.el --- the EasyPG Assistant, minor-mode for mail composer -*- 
lexical-binding: t -*-
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Keywords: PGP, GnuPG, mail, message
@@ -150,7 +150,7 @@ If no one is selected, default secret key is used.  "
                   (mapcar
                    (lambda (recipient)
                      (let ((tem (assoc recipient epa-mail-aliases)))
-                       (if tem (cdr tem)
+                       (if tem (copy-sequence (cdr tem))
                          (list recipient))))
                    real-recipients)))
       )))
diff --git a/lisp/epa.el b/lisp/epa.el
index c3938e9..c8abff4 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -1,6 +1,6 @@
 ;;; epa.el --- the EasyPG Assistant -*- lexical-binding: t -*-
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Keywords: PGP, GnuPG
@@ -597,12 +597,12 @@ If SECRET is non-nil, list secret keys instead of public 
keys."
            (erase-buffer)
            (insert (format
                     (pcase (epg-context-operation context)
-                      (`decrypt "Error while decrypting with \"%s\":")
-                      (`verify "Error while verifying with \"%s\":")
-                      (`sign "Error while signing with \"%s\":")
-                      (`encrypt "Error while encrypting with \"%s\":")
-                      (`import-keys "Error while importing keys with \"%s\":")
-                      (`export-keys "Error while exporting keys with \"%s\":")
+                      ('decrypt "Error while decrypting with \"%s\":")
+                      ('verify "Error while verifying with \"%s\":")
+                      ('sign "Error while signing with \"%s\":")
+                      ('encrypt "Error while encrypting with \"%s\":")
+                      ('import-keys "Error while importing keys with \"%s\":")
+                      ('export-keys "Error while exporting keys with \"%s\":")
                       (_ "Error while executing \"%s\":\n\n"))
                     (epg-context-program context))
                    "\n\n"
diff --git a/lisp/epg-config.el b/lisp/epg-config.el
index fb866df..4502f90 100644
--- a/lisp/epg-config.el
+++ b/lisp/epg-config.el
@@ -1,6 +1,6 @@
 ;;; epg-config.el --- configuration of the EasyPG Library
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Keywords: PGP, GnuPG
diff --git a/lisp/epg.el b/lisp/epg.el
index c8f24eb..e06cc06 100644
--- a/lisp/epg.el
+++ b/lisp/epg.el
@@ -1,5 +1,5 @@
 ;;; epg.el --- the EasyPG Library -*- lexical-binding: t -*-
-;; Copyright (C) 1999-2000, 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Keywords: PGP, GnuPG
@@ -1144,7 +1144,7 @@ callback data (if any)."
 
 (defun epg--status-SIG_CREATED (context string)
   (if (string-match "\\`\\([DCS]\\) \\([0-9]+\\) \\([0-9]+\\) \
-\\([0-9A-Fa-F][0-9A-Fa-F]\\) \\(.*\\) " string)
+\\([0-9A-Fa-f][0-9A-Fa-f]\\) \\(.*\\) " string)
       (epg-context-set-result-for
        context 'sign
        (cons (epg-make-new-signature
diff --git a/lisp/erc/ChangeLog.1 b/lisp/erc/ChangeLog.1
index 7e12f63..97b5d3f 100644
--- a/lisp/erc/ChangeLog.1
+++ b/lisp/erc/ChangeLog.1
@@ -11443,7 +11443,7 @@
        * erc.el: * Added command-names to completion (erc-command-table)
        * New variable erc-auto-query. When set, every arriving message to you
        will open a query buffer for that sender if not already open.
-       * Compatibility function fo non-existing line-beginning|end-position 
functions in XEmacs.
+       * Compatibility function for non-existing line-beginning|end-position 
functions in XEmacs.
 
 2001-10-03  Mario Lang  <address@hidden>
 
@@ -11702,7 +11702,7 @@
 
        * erc-speak.el, erc.el: New file.
 
-  Copyright (C) 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/erc/ChangeLog.2 b/lisp/erc/ChangeLog.2
index 5fc4135..e8b1046 100644
--- a/lisp/erc/ChangeLog.2
+++ b/lisp/erc/ChangeLog.2
@@ -757,7 +757,7 @@
 
 See ChangeLog.1 for earlier changes.
 
-  Copyright (C) 2009-2018 Free Software Foundation, Inc.
+  Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/erc/erc-autoaway.el b/lisp/erc/erc-autoaway.el
index 80cb6ab..9e224e0 100644
--- a/lisp/erc/erc-autoaway.el
+++ b/lisp/erc/erc-autoaway.el
@@ -1,6 +1,6 @@
 ;;; erc-autoaway.el --- Provides autoaway for ERC
 
-;; Copyright (C) 2002-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Jorgen Schaefer <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index 814ecfa..2854cde 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -1,6 +1,6 @@
 ;;; erc-backend.el --- Backend network communication for ERC  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Filename: erc-backend.el
 ;; Author: Lawrence Mitchell <address@hidden>
@@ -844,10 +844,9 @@ Additionally, detect whether the IRC process has hung."
              erc-server-last-received-time))
       (with-current-buffer buf
         (if (and erc-server-send-ping-timeout
-                 (>
-                  (erc-time-diff (erc-current-time)
-                                 erc-server-last-received-time)
-                  erc-server-send-ping-timeout))
+                 (time-less-p
+                  erc-server-send-ping-timeout
+                  (time-since erc-server-last-received-time)))
             (progn
               ;; if the process is hung, kill it
               (setq erc-server-timed-out t)
@@ -865,16 +864,15 @@ Additionally, detect whether the IRC process has hung."
 See `erc-server-flood-margin' for an explanation of the flood
 protection algorithm."
   (with-current-buffer buffer
-    (let ((now (erc-current-time)))
+    (let ((now (current-time)))
       (when erc-server-flood-timer
         (erc-cancel-timer erc-server-flood-timer)
         (setq erc-server-flood-timer nil))
-      (when (< erc-server-flood-last-message
-               now)
-        (setq erc-server-flood-last-message now))
+      (when (time-less-p erc-server-flood-last-message now)
+        (setq erc-server-flood-last-message (erc-emacs-time-to-erc-time now)))
       (while (and erc-server-flood-queue
-                  (< erc-server-flood-last-message
-                     (+ now erc-server-flood-margin)))
+                  (time-less-p erc-server-flood-last-message
+                               (time-add now erc-server-flood-margin)))
         (let ((msg (caar erc-server-flood-queue))
               (encoding (cdar erc-server-flood-queue)))
           (setq erc-server-flood-queue (cdr erc-server-flood-queue)
@@ -1070,8 +1068,8 @@ Hands off to helper functions via `erc-call-hooks'."
               erc-server-prevent-duplicates)
       (let ((m (erc-response.unparsed parsed-response)))
         ;; duplicate suppression
-        (if (< (or (gethash m erc-server-duplicates) 0)
-               (- (erc-current-time) erc-server-duplicate-timeout))
+        (if (time-less-p (or (gethash m erc-server-duplicates) 0)
+                         (time-since erc-server-duplicate-timeout))
             (erc-call-hooks process parsed-response))
         (puthash m (erc-current-time) erc-server-duplicates))
     ;; Hand off to the relevant handler.
@@ -1447,7 +1445,7 @@ add things to `%s' instead."
   "Handle pong messages." nil
   (let ((time (string-to-number (erc-response.contents parsed))))
     (when (> time 0)
-      (setq erc-server-lag (erc-time-diff time (erc-current-time)))
+      (setq erc-server-lag (erc-time-diff time nil))
       (when erc-verbose-server-ping
         (erc-display-message
          parsed 'notice proc 'PONG
@@ -1730,7 +1728,7 @@ See `erc-display-server-message'." nil
                (cdr (erc-response.command-args parsed))))
     (setq time (when on-since
                  (format-time-string erc-server-timestamp-format
-                                     (erc-string-to-emacs-time on-since))))
+                                     (string-to-number on-since))))
     (erc-update-user-nick nick nick nil nil nil
                           (and time (format "on since %s" time)))
     (if time
@@ -1802,7 +1800,7 @@ See `erc-display-server-message'." nil
 (define-erc-response-handler (329)
   "Channel creation date." nil
   (let ((channel (cadr (erc-response.command-args parsed)))
-        (time (erc-string-to-emacs-time
+        (time (string-to-number
                (nth 2 (erc-response.command-args parsed)))))
     (erc-display-message
      parsed 'notice (erc-get-buffer channel proc)
@@ -1844,7 +1842,7 @@ See `erc-display-server-message'." nil
   (pcase-let ((`(,channel ,nick ,time)
                (cdr (erc-response.command-args parsed))))
     (setq time (format-time-string erc-server-timestamp-format
-                                   (erc-string-to-emacs-time time)))
+                                   (string-to-number time)))
     (erc-update-channel-topic channel
                               (format "\C-o (%s, %s)" nick time)
                               'append)
diff --git a/lisp/erc/erc-button.el b/lisp/erc/erc-button.el
index 7599053..c8aa887 100644
--- a/lisp/erc/erc-button.el
+++ b/lisp/erc/erc-button.el
@@ -1,6 +1,6 @@
 ;; erc-button.el --- A way of buttonizing certain things in ERC buffers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1996-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-capab.el b/lisp/erc/erc-capab.el
index 85f18fd..210a773 100644
--- a/lisp/erc/erc-capab.el
+++ b/lisp/erc/erc-capab.el
@@ -1,6 +1,6 @@
 ;;; erc-capab.el --- support for dancer-ircd and hyperion's CAPAB
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 
diff --git a/lisp/erc/erc-compat.el b/lisp/erc/erc-compat.el
index ce66ff9..e724e36 100644
--- a/lisp/erc/erc-compat.el
+++ b/lisp/erc/erc-compat.el
@@ -1,6 +1,6 @@
 ;;; erc-compat.el --- ERC compatibility code for XEmacs
 
-;; Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-dcc.el b/lisp/erc/erc-dcc.el
index 8de0007..a6b7532 100644
--- a/lisp/erc/erc-dcc.el
+++ b/lisp/erc/erc-dcc.el
@@ -1,6 +1,6 @@
 ;;; erc-dcc.el --- CTCP DCC module for ERC
 
-;; Copyright (C) 1993-1995, 1998, 2002-2004, 2006-2018 Free Software
+;; Copyright (C) 1993-1995, 1998, 2002-2004, 2006-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Ben A. Mesander <address@hidden>
@@ -422,23 +422,23 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
                           (when (fboundp 'make-network-process) '("send"))))
   (pcomplete-here
    (pcase (intern (downcase (pcomplete-arg 1)))
-     (`chat (mapcar (lambda (elt) (plist-get elt :nick))
+     ('chat (mapcar (lambda (elt) (plist-get elt :nick))
                     (erc-remove-if-not
                      #'(lambda (elt)
                          (eq (plist-get elt :type) 'CHAT))
                      erc-dcc-list)))
-     (`close (erc-delete-dups
+     ('close (erc-delete-dups
               (mapcar (lambda (elt) (symbol-name (plist-get elt :type)))
                       erc-dcc-list)))
-     (`get (mapcar #'erc-dcc-nick
+     ('get (mapcar #'erc-dcc-nick
                    (erc-remove-if-not
                     #'(lambda (elt)
                         (eq (plist-get elt :type) 'GET))
                     erc-dcc-list)))
-     (`send (pcomplete-erc-all-nicks))))
+     ('send (pcomplete-erc-all-nicks))))
   (pcomplete-here
    (pcase (intern (downcase (pcomplete-arg 2)))
-     (`get (mapcar (lambda (elt) (plist-get elt :file))
+     ('get (mapcar (lambda (elt) (plist-get elt :file))
                    (erc-remove-if-not
                     #'(lambda (elt)
                         (and (eq (plist-get elt :type) 'GET)
@@ -446,13 +446,13 @@ where FOO is one of CLOSE, GET, SEND, LIST, CHAT, etc."
                                                 (plist-get elt :nick))
                                                (pcomplete-arg 1))))
                     erc-dcc-list)))
-     (`close (mapcar #'erc-dcc-nick
+     ('close (mapcar #'erc-dcc-nick
                      (erc-remove-if-not
                       #'(lambda (elt)
                           (eq (plist-get elt :type)
                               (intern (upcase (pcomplete-arg 1)))))
                       erc-dcc-list)))
-     (`send (pcomplete-entries)))))
+     ('send (pcomplete-entries)))))
 
 (defun erc-dcc-do-CHAT-command (proc &optional nick)
   (when nick
@@ -979,17 +979,20 @@ rather than every 1024 byte block, but nobody seems to 
care."
     (let ((inhibit-read-only t)
           received-bytes)
       (goto-char (point-max))
-      (insert (string-make-unibyte str))
+      (if str
+          (insert (string-make-unibyte str)))
 
       (when (> (point-max) erc-dcc-receive-cache)
         (erc-dcc-append-contents (current-buffer) erc-dcc-file-name))
-      (setq received-bytes (+ (buffer-size) erc-dcc-byte-count))
+      (setq received-bytes (buffer-size))
+      (if erc-dcc-byte-count
+          (setq received-bytes (+ received-bytes erc-dcc-byte-count)))
 
       (and erc-dcc-verbose
            (erc-display-message
             nil 'notice erc-server-process
             'dcc-get-bytes-received
-            ?f (file-name-nondirectory buffer-file-name)
+            ?f (file-name-nondirectory (buffer-name))
             ?b (number-to-string received-bytes)))
       (cond
        ((and (> (plist-get erc-dcc-entry-data :size) 0)
@@ -997,7 +1000,7 @@ rather than every 1024 byte block, but nobody seems to 
care."
         (erc-display-message
          nil '(notice error) 'active
          'dcc-get-file-too-long
-         ?f (file-name-nondirectory buffer-file-name))
+         ?f (file-name-nondirectory (buffer-name)))
         (delete-process proc))
        (t
         (process-send-string
@@ -1021,7 +1024,7 @@ transfer is complete."
      ?s (number-to-string erc-dcc-byte-count)
      ?t (format "%.0f"
                 (erc-time-diff (plist-get erc-dcc-entry-data :start-time)
-                               (erc-current-time)))))
+                               nil))))
   (kill-buffer (process-buffer proc))
   (delete-process proc))
 
diff --git a/lisp/erc/erc-desktop-notifications.el 
b/lisp/erc/erc-desktop-notifications.el
index 84db0f5..56b9392 100644
--- a/lisp/erc/erc-desktop-notifications.el
+++ b/lisp/erc/erc-desktop-notifications.el
@@ -1,6 +1,6 @@
 ;; erc-desktop-notifications.el -- Send notification on PRIVMSG or mentions
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Julien Danjou <address@hidden>
 ;; Keywords: comm
diff --git a/lisp/erc/erc-ezbounce.el b/lisp/erc/erc-ezbounce.el
index 5869750..a2c9336 100644
--- a/lisp/erc/erc-ezbounce.el
+++ b/lisp/erc/erc-ezbounce.el
@@ -1,6 +1,6 @@
 ;;; erc-ezbounce.el ---  Handle EZBounce bouncer commands
 
-;; Copyright (C) 2002, 2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Andreas Fuchs <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-fill.el b/lisp/erc/erc-fill.el
index 5efb854..934b52a 100644
--- a/lisp/erc/erc-fill.el
+++ b/lisp/erc/erc-fill.el
@@ -1,6 +1,6 @@
 ;;; erc-fill.el --- Filling IRC messages in various ways
 
-;; Copyright (C) 2001-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Andreas Fuchs <address@hidden>
 ;;         Mario Lang <address@hidden>
diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
index 2d5aede..117b678 100644
--- a/lisp/erc/erc-goodies.el
+++ b/lisp/erc/erc-goodies.el
@@ -1,6 +1,6 @@
 ;; erc-goodies.el --- Collection of ERC modules
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Jorgen Schaefer <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-ibuffer.el b/lisp/erc/erc-ibuffer.el
index 93a9573..149c858 100644
--- a/lisp/erc/erc-ibuffer.el
+++ b/lisp/erc/erc-ibuffer.el
@@ -1,6 +1,6 @@
 ;;; erc-ibuffer.el --- ibuffer integration with ERC
 
-;; Copyright (C) 2002, 2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-identd.el b/lisp/erc/erc-identd.el
index d710d95..d95e0ea 100644
--- a/lisp/erc/erc-identd.el
+++ b/lisp/erc/erc-identd.el
@@ -1,6 +1,6 @@
 ;;; erc-identd.el --- RFC1413 (identd authentication protocol) server
 
-;; Copyright (C) 2003, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-imenu.el b/lisp/erc/erc-imenu.el
index f038216..08f52f1 100644
--- a/lisp/erc/erc-imenu.el
+++ b/lisp/erc/erc-imenu.el
@@ -1,6 +1,6 @@
 ;;; erc-imenu.el -- Imenu support for ERC
 
-;; Copyright (C) 2001-2002, 2004, 2006-2018 Free Software Foundation,
+;; Copyright (C) 2001-2002, 2004, 2006-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Mario Lang <address@hidden>
diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index d7ae933..896521e 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -1,6 +1,6 @@
 ;;; erc-join.el --- autojoin channels on connect and reconnects
 
-;; Copyright (C) 2002-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-lang.el b/lisp/erc/erc-lang.el
index 02823e7..f0dbe69 100644
--- a/lisp/erc/erc-lang.el
+++ b/lisp/erc/erc-lang.el
@@ -1,6 +1,6 @@
 ;;; erc-lang.el --- provide the LANG command to ERC
 
-;; Copyright (C) 2002, 2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-list.el b/lisp/erc/erc-list.el
index 0bb962d..d8d9e17 100644
--- a/lisp/erc/erc-list.el
+++ b/lisp/erc/erc-list.el
@@ -1,6 +1,6 @@
 ;;; erc-list.el --- /list support for ERC  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Tom Tromey <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-log.el b/lisp/erc/erc-log.el
index 584f566..4153f5c 100644
--- a/lisp/erc/erc-log.el
+++ b/lisp/erc/erc-log.el
@@ -1,6 +1,6 @@
 ;;; erc-log.el --- Logging facilities for ERC.
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Lawrence Mitchell <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el
index 534a5b7..cc4b4a8 100644
--- a/lisp/erc/erc-match.el
+++ b/lisp/erc/erc-match.el
@@ -1,6 +1,6 @@
 ;;; erc-match.el --- Highlight messages matching certain regexps
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Andreas Fuchs <address@hidden>
 ;; Maintainer: address@hidden
@@ -601,7 +601,7 @@ See `erc-log-match-format'."
                                                       'timestamp))))
                  (away-time (erc-emacs-time-to-erc-time (erc-away-time))))
             (when (and away-time last-msg-time
-                       (erc-time-gt last-msg-time away-time))
+                       (time-less-p away-time last-msg-time))
               (erc-display-message
                nil 'notice 'active
                (format "You have logged messages waiting in \"%s\"."
diff --git a/lisp/erc/erc-menu.el b/lisp/erc/erc-menu.el
index 4270ec6..8173829 100644
--- a/lisp/erc/erc-menu.el
+++ b/lisp/erc/erc-menu.el
@@ -1,6 +1,6 @@
 ;; erc-menu.el -- Menu-bar definitions for ERC
 
-;; Copyright (C) 2001-2002, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2002, 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-netsplit.el b/lisp/erc/erc-netsplit.el
index 885fc49..87c3a61 100644
--- a/lisp/erc/erc-netsplit.el
+++ b/lisp/erc/erc-netsplit.el
@@ -1,6 +1,6 @@
 ;;; erc-netsplit.el --- Reduce JOIN/QUIT messages on netsplits
 
-;; Copyright (C) 2002-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-networks.el b/lisp/erc/erc-networks.el
index 824c482..eca8ad6 100644
--- a/lisp/erc/erc-networks.el
+++ b/lisp/erc/erc-networks.el
@@ -1,6 +1,6 @@
 ;;; erc-networks.el --- IRC networks
 
-;; Copyright (C) 2002, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-notify.el b/lisp/erc/erc-notify.el
index 2666598..45dae89 100644
--- a/lisp/erc/erc-notify.el
+++ b/lisp/erc/erc-notify.el
@@ -1,6 +1,6 @@
 ;;; erc-notify.el --- Online status change notification  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2002-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-page.el b/lisp/erc/erc-page.el
index 4d78a8c..cb57883 100644
--- a/lisp/erc/erc-page.el
+++ b/lisp/erc/erc-page.el
@@ -1,6 +1,6 @@
 ;; erc-page.el - CTCP PAGE support for ERC
 
-;; Copyright (C) 2002, 2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 
diff --git a/lisp/erc/erc-pcomplete.el b/lisp/erc/erc-pcomplete.el
index db0359c..dd2da85 100644
--- a/lisp/erc/erc-pcomplete.el
+++ b/lisp/erc/erc-pcomplete.el
@@ -1,6 +1,6 @@
 ;;; erc-pcomplete.el --- Provides programmable completion for ERC
 
-;; Copyright (C) 2002-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Sacha Chua <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-replace.el b/lisp/erc/erc-replace.el
index f321ae0..2e0e54a 100644
--- a/lisp/erc/erc-replace.el
+++ b/lisp/erc/erc-replace.el
@@ -1,6 +1,6 @@
 ;; erc-replace.el -- wash and massage messages inserted into the buffer
 
-;; Copyright (C) 2001-2002, 2004, 2006-2018 Free Software Foundation,
+;; Copyright (C) 2001-2002, 2004, 2006-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Andreas Fuchs <address@hidden>
diff --git a/lisp/erc/erc-ring.el b/lisp/erc/erc-ring.el
index 7e315d3..5459d8b 100644
--- a/lisp/erc/erc-ring.el
+++ b/lisp/erc/erc-ring.el
@@ -1,6 +1,6 @@
 ;; erc-ring.el -- Command history handling for erc using ring.el
 
-;; Copyright (C) 2001-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-services.el b/lisp/erc/erc-services.el
index ac49a3e..886ba60 100644
--- a/lisp/erc/erc-services.el
+++ b/lisp/erc/erc-services.el
@@ -1,6 +1,6 @@
 ;;; erc-services.el --- Identify to NickServ  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 
diff --git a/lisp/erc/erc-sound.el b/lisp/erc/erc-sound.el
index 8df8ded..34f7ce6 100644
--- a/lisp/erc/erc-sound.el
+++ b/lisp/erc/erc-sound.el
@@ -1,6 +1,6 @@
 ;;; erc-sound.el --- CTCP SOUND support for ERC
 
-;; Copyright (C) 2002-2003, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2003, 2006-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 
diff --git a/lisp/erc/erc-speedbar.el b/lisp/erc/erc-speedbar.el
index 58eefd8..0a1e38f 100644
--- a/lisp/erc/erc-speedbar.el
+++ b/lisp/erc/erc-speedbar.el
@@ -1,6 +1,6 @@
 ;;; erc-speedbar.el --- Speedbar support for ERC
 
-;; Copyright (C) 2001-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
 ;; Contributor: Eric M. Ludlam <address@hidden>
@@ -140,7 +140,7 @@ This will add a speedbar major display mode."
        t))))
 
 (defun erc-speedbar-expand-server (text server indent)
-  (cond ((string-match "+" text)
+  (cond ((string-match "\\+" text)
         (speedbar-change-expand-button-char ?-)
         (if (speedbar-with-writable
               (save-excursion
@@ -185,7 +185,7 @@ This will add a speedbar major display mode."
   "For the line matching TEXT, in CHANNEL, expand or contract a line.
 INDENT is the current indentation level."
   (cond
-   ((string-match "+" text)
+   ((string-match "\\+" text)
     (speedbar-change-expand-button-char ?-)
     (speedbar-with-writable
      (save-excursion
@@ -285,7 +285,7 @@ is only done when the channel is actually expanded already."
        (erc-speedbar-expand-channel "+" buffer 1)))))
 
 (defun erc-speedbar-expand-user (text token indent)
-  (cond ((string-match "+" text)
+  (cond ((string-match "\\+" text)
         (speedbar-change-expand-button-char ?-)
         (speedbar-with-writable
           (save-excursion
diff --git a/lisp/erc/erc-spelling.el b/lisp/erc/erc-spelling.el
index 3a34ea3..69a83fa 100644
--- a/lisp/erc/erc-spelling.el
+++ b/lisp/erc/erc-spelling.el
@@ -1,6 +1,6 @@
 ;;; erc-spelling.el --- use flyspell in ERC
 
-;; Copyright (C) 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Jorgen Schaefer <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-stamp.el b/lisp/erc/erc-stamp.el
index 6a648e7..860fdbb 100644
--- a/lisp/erc/erc-stamp.el
+++ b/lisp/erc/erc-stamp.el
@@ -1,6 +1,6 @@
 ;;; erc-stamp.el --- Timestamping for ERC messages
 
-;; Copyright (C) 2002-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index cae18f6..e51e605 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -1,6 +1,6 @@
 ;;; erc-track.el --- Track modified channel buffers  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
 ;; Maintainer: address@hidden
@@ -630,8 +630,8 @@ only consider active buffers visible.")
   (if erc-track-when-inactive
       (when erc-buffer-activity; could be nil
        (and (erc-track-get-buffer-window buffer erc-track-visibility)
-            (<= (erc-time-diff erc-buffer-activity (erc-current-time))
-                erc-buffer-activity-timeout)))
+            (not (time-less-p erc-buffer-activity-timeout
+                              (erc-time-diff erc-buffer-activity nil)))))
     (erc-track-get-buffer-window buffer erc-track-visibility)))
 
 ;;; Tracking the channel modifications
@@ -640,7 +640,7 @@ only consider active buffers visible.")
   (unless (minibuffer-window-active-p (minibuffer-window))
     ;; delay this until command has finished to make sure window is
     ;; actually visible before clearing activity
-    (add-hook 'post-command-hook 'erc-modified-channels-update)))
+    (erc-modified-channels-update)))
 
 (defvar erc-modified-channels-update-inside nil
   "Variable to prevent running `erc-modified-channels-update' multiple
@@ -669,8 +669,7 @@ ARGS are ignored."
                  (erc-modified-channels-remove-buffer buffer))))
            erc-modified-channels-alist)
       (when removed-channel
-       (erc-modified-channels-display)))
-    (remove-hook 'post-command-hook 'erc-modified-channels-update)))
+       (erc-modified-channels-display)))))
 
 (defvar erc-track-mouse-face (if (featurep 'xemacs)
                                 'modeline-mousable
@@ -929,14 +928,14 @@ relative to `erc-track-switch-direction'"
        offset)
     (when (< arg 0)
       (setq dir (pcase dir
-                 (`oldest      'newest)
-                 (`newest      'oldest)
-                 (`mostactive  'leastactive)
-                 (`leastactive 'mostactive)
-                 (`importance  'oldest)))
+                 ('oldest      'newest)
+                 ('newest      'oldest)
+                 ('mostactive  'leastactive)
+                 ('leastactive 'mostactive)
+                 ('importance  'oldest)))
       (setq arg (- arg)))
     (setq offset (pcase dir
-                  ((or `oldest `leastactive)
+                  ((or 'oldest 'leastactive)
                    (- (length erc-modified-channels-alist) arg))
                   (_ (1- arg))))
     ;; normalize out of range user input
diff --git a/lisp/erc/erc-truncate.el b/lisp/erc/erc-truncate.el
index d4359c5..0417429 100644
--- a/lisp/erc/erc-truncate.el
+++ b/lisp/erc/erc-truncate.el
@@ -1,6 +1,6 @@
 ;;; erc-truncate.el --- Functions for truncating ERC buffers
 
-;; Copyright (C) 2003-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Andreas Fuchs <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc-xdcc.el b/lisp/erc/erc-xdcc.el
index 0d66fe5..162b22e 100644
--- a/lisp/erc/erc-xdcc.el
+++ b/lisp/erc/erc-xdcc.el
@@ -1,6 +1,6 @@
 ;;; erc-xdcc.el --- XDCC file-server support for ERC
 
-;; Copyright (C) 2003-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index a7e2742..d1fa5c7 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -1,6 +1,6 @@
 ;; erc.el --- An Emacs Internet Relay Chat client  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Alexander L. Belikoff (address@hidden)
 ;; Contributors: Sergey Berezin (address@hidden),
@@ -62,9 +62,6 @@
 ;;; History:
 ;;
 
-(defconst erc-version-string (format "\C-bERC\C-b (IRC client for Emacs %s)" 
emacs-version)
-  "ERC version.  This is used by function `erc-version'.")
-
 ;;; Code:
 
 (load "erc-loaddefs" nil t)
@@ -1943,15 +1940,15 @@ removed from the list will be disabled."
 (defun erc-setup-buffer (buffer)
   "Consults `erc-join-buffer' to find out how to display `BUFFER'."
   (pcase erc-join-buffer
-    (`window
+    ('window
      (if (active-minibuffer-window)
          (display-buffer buffer)
        (switch-to-buffer-other-window buffer)))
-    (`window-noselect
+    ('window-noselect
      (display-buffer buffer))
-    (`bury
+    ('bury
      nil)
-    (`frame
+    ('frame
      (when (or (not erc-reuse-frames)
                (not (get-buffer-window buffer t)))
        (let ((frame (make-frame (or erc-frame-alist
@@ -2525,10 +2522,7 @@ Returns NICK unmodified unless `erc-lurker-trim-nicks' is
 non-nil."
   (if erc-lurker-trim-nicks
       (replace-regexp-in-string
-       (format "[%s]"
-               (mapconcat (lambda (char)
-                            (regexp-quote (char-to-string char)))
-                          erc-lurker-ignore-chars ""))
+       (regexp-opt-charset (string-to-list erc-lurker-ignore-chars))
        "" nick)
     nick))
 
@@ -2568,8 +2562,8 @@ consumption for long-lived IRC or Emacs sessions."
      (maphash
       (lambda (nick last-PRIVMSG-time)
         (when
-            (> (float-time (time-subtract nil last-PRIVMSG-time))
-               erc-lurker-threshold-time)
+           (time-less-p erc-lurker-threshold-time
+                        (time-since last-PRIVMSG-time))
           (remhash nick hash)))
       hash)
      (if (zerop (hash-table-count hash))
@@ -2634,9 +2628,8 @@ server within `erc-lurker-threshold-time'.  See also
           (gethash (erc-lurker-maybe-trim nick)
                    (gethash server erc-lurker-state (make-hash-table)))))
     (or (null last-PRIVMSG-time)
-        (> (float-time
-            (time-subtract nil last-PRIVMSG-time))
-           erc-lurker-threshold-time))))
+       (time-less-p erc-lurker-threshold-time
+                    (time-since last-PRIVMSG-time)))))
 
 (defcustom erc-common-server-suffixes
   '(("openprojects.net\\'" . "OPN")
@@ -3415,7 +3408,7 @@ Otherwise leave the channel indicated by LINE."
 
 (defun erc-cmd-PING (recipient)
   "Ping RECIPIENT."
-  (let ((time (format "%f" (erc-current-time))))
+  (let ((time (format-time-string "%s.%6N")))
     (erc-log (format "cmd: PING: %s" time))
     (erc-cmd-CTCP recipient "PING" time)))
 
@@ -4289,7 +4282,7 @@ and as second argument the event parsed as a vector."
 (defun erc-is-message-ctcp-and-not-action-p (message)
   "Check if MESSAGE is a CTCP message or not."
   (and (erc-is-message-ctcp-p message)
-       (not (string-match "^\C-a\\ACTION.*\C-a$" message))))
+       (not (string-match "^\C-aACTION.*\C-a$" message))))
 
 (defun erc-format-privmessage (nick msg privp msgp)
   "Format a PRIVMSG in an insertable fashion."
@@ -4495,7 +4488,7 @@ See also: `erc-echo-notice-in-user-buffers',
                                     (mapcar #'upcase
                                             (cdr (split-string mode)))))
                         erc-channel-banlist)))
-                ((string-match "^+" mode)
+                ((string-match "^\\+" mode)
                  ;; Add the banned mask(s) to the ban list
                  (mapc
                   (lambda (mask)
@@ -4643,7 +4636,7 @@ See also `erc-display-message'."
                        (user-full-name)
                        (user-login-name)
                        (system-name))))
-          (ns (erc-time-diff erc-server-last-sent-time (erc-current-time))))
+          (ns (erc-time-diff erc-server-last-sent-time nil)))
       (when (> ns 0)
         (setq s (concat s " Idle for " (erc-sec-to-time ns))))
       (erc-send-ctcp-notice nick s)))
@@ -4732,8 +4725,7 @@ See also `erc-display-message'."
       nil
     (let ((time (match-string 1 msg)))
       (condition-case nil
-          (let ((delta (erc-time-diff (string-to-number time)
-                                      (erc-current-time))))
+          (let ((delta (erc-time-diff (string-to-number time) nil)))
             (erc-display-message
              nil 'notice 'active
              'CTCP-PING ?n nick
@@ -4791,10 +4783,7 @@ If non-nil, return from being away."
                  (erc-default-target)
                  (if away-time
                      (format "is back (gone for %s)"
-                             (erc-sec-to-time
-                              (erc-time-diff
-                               (erc-emacs-time-to-erc-time away-time)
-                               (erc-current-time))))
+                             (erc-sec-to-time (erc-time-diff away-time nil)))
                    "is back")))))))))
     (erc-update-mode-line)))
 
@@ -5386,10 +5375,10 @@ submitted line to be intentional."
 (defun erc-send-current-line ()
   "Parse current line and send it to IRC."
   (interactive)
-  (let ((now (float-time)))
+  (let ((now (current-time)))
     (if (or (not erc-accidental-paste-threshold-seconds)
-            (< erc-accidental-paste-threshold-seconds
-               (- now erc-last-input-time)))
+            (time-less-p erc-accidental-paste-threshold-seconds
+                        (time-subtract now erc-last-input-time)))
         (save-restriction
           (widen)
           (if (< (point) (erc-beg-of-input-line))
@@ -6039,22 +6028,20 @@ non-nil value is found.
 
 ;; time routines
 
-(defun erc-string-to-emacs-time (string)
-  "Convert the long number represented by STRING into an Emacs timestamp."
-  (let* ((n (string-to-number (concat string ".0"))))
-    (list (truncate (/ n 65536))
-          (truncate (mod n 65536)))))
+(define-obsolete-function-alias 'erc-string-to-emacs-time 'string-to-number
+  "27.1")
 
 (defalias 'erc-emacs-time-to-erc-time 'float-time)
 (defalias 'erc-current-time 'float-time)
 
 (defun erc-time-diff (t1 t2)
-  "Return the time difference in seconds between T1 and T2."
-  (abs (- t2 t1)))
+  "Return the absolute value of the difference in seconds between T1 and T2."
+  (abs (float-time (time-subtract t1 t2))))
 
 (defun erc-time-gt (t1 t2)
   "Check whether T1 > T2."
-  (> t1 t2))
+  (declare (obsolete time-less-p "27.1"))
+  (time-less-p t2 t1))
 
 (defun erc-sec-to-time (ns)
   "Convert NS to a time string HH:MM.SS."
diff --git a/lisp/eshell/em-alias.el b/lisp/eshell/em-alias.el
index c5125fd..dbffd52 100644
--- a/lisp/eshell/em-alias.el
+++ b/lisp/eshell/em-alias.el
@@ -1,6 +1,6 @@
 ;;; em-alias.el --- creation and management of command aliases  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
diff --git a/lisp/eshell/em-banner.el b/lisp/eshell/em-banner.el
index f8fd898..4a0b265 100644
--- a/lisp/eshell/em-banner.el
+++ b/lisp/eshell/em-banner.el
@@ -1,6 +1,6 @@
 ;;; em-banner.el --- sample module that displays a login banner  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
diff --git a/lisp/eshell/em-basic.el b/lisp/eshell/em-basic.el
index 5201076..72a4e6b 100644
--- a/lisp/eshell/em-basic.el
+++ b/lisp/eshell/em-basic.el
@@ -1,6 +1,6 @@
 ;;; em-basic.el --- basic shell builtin commands  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -118,7 +118,7 @@ or `eshell-printn' for display."
 
 (defun eshell/printnl (&rest args)
   "Print out each of the arguments, separated by newlines."
-  (let ((elems (eshell-flatten-list args)))
+  (let ((elems (flatten-tree args)))
     (while elems
       (eshell-printn (eshell-echo (list (car elems))))
       (setq elems (cdr elems)))))
diff --git a/lisp/eshell/em-cmpl.el b/lisp/eshell/em-cmpl.el
index e79b490..25a6e88 100644
--- a/lisp/eshell/em-cmpl.el
+++ b/lisp/eshell/em-cmpl.el
@@ -1,6 +1,6 @@
 ;;; em-cmpl.el --- completion using the TAB key  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -288,9 +288,10 @@ to writing a completion function."
            (function
             (lambda ()
               (set (make-local-variable 'comint-file-name-quote-list)
-                   eshell-special-chars-outside-quoting))) nil t)
-  (add-hook 'pcomplete-quote-arg-hook 'eshell-quote-backslash nil t)
-  (define-key eshell-mode-map [(meta tab)] 'eshell-complete-lisp-symbol)
+                   eshell-special-chars-outside-quoting)))
+            nil t)
+  (add-hook 'pcomplete-quote-arg-hook #'eshell-quote-backslash nil t)
+  ;;(define-key eshell-mode-map [(meta tab)] 'eshell-complete-lisp-symbol) ; 
Redundant
   (define-key eshell-mode-map [(meta control ?i)] 'eshell-complete-lisp-symbol)
   (define-key eshell-command-map [(meta ?h)] 'eshell-completion-help)
   (define-key eshell-command-map [tab] 'pcomplete-expand-and-complete)
@@ -298,15 +299,14 @@ to writing a completion function."
     'pcomplete-expand-and-complete)
   (define-key eshell-command-map [space] 'pcomplete-expand)
   (define-key eshell-command-map [? ] 'pcomplete-expand)
-  (define-key eshell-mode-map [tab] 'eshell-pcomplete)
-  (define-key eshell-mode-map [(control ?i)] 'eshell-pcomplete)
+  ;;(define-key eshell-mode-map [tab] 'completion-at-point) ;Redundant!
+  (define-key eshell-mode-map [(control ?i)] 'completion-at-point)
   (add-hook 'completion-at-point-functions
             #'pcomplete-completions-at-point nil t)
   ;; jww (1999-10-19): Will this work on anything but X?
-  (if (featurep 'xemacs)
-      (define-key eshell-mode-map [iso-left-tab] 'pcomplete-reverse)
-    (define-key eshell-mode-map [backtab] 'pcomplete-reverse))
-  (define-key eshell-mode-map [(meta ??)] 'pcomplete-list))
+  (define-key eshell-mode-map
+    (if (featurep 'xemacs) [iso-left-tab] [backtab]) 'pcomplete-reverse)
+  (define-key eshell-mode-map [(meta ??)] 'completion-help-at-point))
 
 (defun eshell-completion-command-name ()
   "Return the command name, possibly sans globbing."
@@ -442,34 +442,24 @@ to writing a completion function."
         (if glob-name
             completions
           (setq completions
-                (append (and (eshell-using-module 'eshell-alias)
-                             (funcall (symbol-function 
'eshell-alias-completions)
-                                      filename))
+                (append (if (fboundp 'eshell-alias-completions)
+                             (eshell-alias-completions filename))
                         (eshell-winnow-list
                          (mapcar
                           (function
                            (lambda (name)
                              (substring name 7)))
                           (all-completions (concat "eshell/" filename)
-                                           obarray 'functionp))
+                                           obarray #'functionp))
                          nil '(eshell-find-alias-function))
                         completions))
           (append (and (or eshell-show-lisp-completions
                            (and eshell-show-lisp-alternatives
                                 (null completions)))
-                       (all-completions filename obarray 'functionp))
+                       (all-completions filename obarray #'functionp))
                   completions)))))))
 
-(defun eshell-pcomplete (&optional interactively)
-  "Eshell wrapper for `pcomplete'."
-  (interactive "p")
-  ;; Pretend to be pcomplete so that cycling works (bug#13293).
-  (setq this-command 'pcomplete)
-  (condition-case nil
-      (if interactively
-         (call-interactively 'pcomplete)
-       (pcomplete))
-    (text-read-only (completion-at-point)))) ; Workaround for bug#12838.
+(define-obsolete-function-alias 'eshell-pcomplete #'completion-at-point "27.1")
 
 (provide 'em-cmpl)
 
diff --git a/lisp/eshell/em-dirs.el b/lisp/eshell/em-dirs.el
index b7d13ee..937bc98 100644
--- a/lisp/eshell/em-dirs.el
+++ b/lisp/eshell/em-dirs.el
@@ -1,6 +1,6 @@
 ;;; em-dirs.el --- directory navigation commands  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -62,12 +62,11 @@ they lack somewhat in feel from the typical shell 
equivalents."
 (defcustom eshell-dirs-load-hook nil
   "A hook that gets run when `eshell-dirs' is loaded."
   :version "24.1"                      ; removed eshell-dirs-initialize
-  :type 'hook
-  :group 'eshell-dirs)
+  :type 'hook)
 
 (defcustom eshell-pwd-convert-function (if (eshell-under-windows-p)
-                                          'expand-file-name
-                                        'identity)
+                                          #'expand-file-name
+                                        #'identity)
   "The function used to normalize the value of Eshell's `pwd'.
 The value returned by `pwd' is also used when recording the
 last-visited directory in the last-dir-ring, so it will affect the
@@ -75,8 +74,7 @@ form of the list used by `cd ='."
   :type '(radio (function-item file-truename)
                (function-item expand-file-name)
                (function-item identity)
-               (function :tag "Other"))
-  :group 'eshell-dirs)
+               (function :tag "Other")))
 
 (defcustom eshell-ask-to-save-last-dir 'always
   "Determine if the last-dir-ring should be automatically saved.
@@ -88,63 +86,53 @@ If set to t, always ask if any Eshell buffers are open at 
exit time.
 If set to `always', the list-dir-ring will always be saved, silently."
   :type '(choice (const :tag "Never" nil)
                 (const :tag "Ask" t)
-                (const :tag "Always save" always))
-  :group 'eshell-dirs)
+                (const :tag "Always save" always)))
 
 (defcustom eshell-cd-shows-directory nil
   "If non-nil, using `cd' will report the directory it changes to."
-  :type 'boolean
-  :group 'eshell-dirs)
+  :type 'boolean)
 
 (defcustom eshell-cd-on-directory t
   "If non-nil, do a cd if a directory is in command position."
-  :type 'boolean
-  :group 'eshell-dirs)
+  :type 'boolean)
 
 (defcustom eshell-directory-change-hook nil
   "A hook to run when the current directory changes."
-  :type 'hook
-  :group 'eshell-dirs)
+  :type 'hook)
 
 (defcustom eshell-list-files-after-cd nil
   "If non-nil, call \"ls\" with any remaining args after doing a cd.
 This is provided for convenience, since the same effect is easily
 achieved by adding a function to `eshell-directory-change-hook' that
 calls \"ls\" and references `eshell-last-arguments'."
-  :type 'boolean
-  :group 'eshell-dirs)
+  :type 'boolean)
 
 (defcustom eshell-pushd-tohome nil
   "If non-nil, make pushd with no arg behave as `pushd ~' (like `cd').
 This mirrors the optional behavior of tcsh."
-  :type 'boolean
-  :group 'eshell-dirs)
+  :type 'boolean)
 
 (defcustom eshell-pushd-dextract nil
   "If non-nil, make \"pushd +n\" pop the nth dir to the stack top.
 This mirrors the optional behavior of tcsh."
-  :type 'boolean
-  :group 'eshell-dirs)
+  :type 'boolean)
 
 (defcustom eshell-pushd-dunique nil
   "If non-nil, make pushd only add unique directories to the stack.
 This mirrors the optional behavior of tcsh."
-  :type 'boolean
-  :group 'eshell-dirs)
+  :type 'boolean)
 
 (defcustom eshell-dirtrack-verbose t
   "If non-nil, show the directory stack following directory change.
 This is effective only if directory tracking is enabled."
-  :type 'boolean
-  :group 'eshell-dirs)
+  :type 'boolean)
 
 (defcustom eshell-last-dir-ring-file-name
   (expand-file-name "lastdir" eshell-directory-name)
   "If non-nil, name of the file to read/write the last-dir-ring.
 See also `eshell-read-last-dir-ring' and `eshell-write-last-dir-ring'.
 If it is nil, the last-dir-ring will not be written to disk."
-  :type 'file
-  :group 'eshell-dirs)
+  :type 'file)
 
 (defcustom eshell-last-dir-ring-size 32
   "If non-nil, the size of the directory history ring.
@@ -164,13 +152,11 @@ directories gets pushed, and its size is unlimited.
 explicitly very much, but every once in a while would like to return to
 a previously visited directory without having to type in the whole
 thing again."
-  :type 'integer
-  :group 'eshell-dirs)
+  :type 'integer)
 
 (defcustom eshell-last-dir-unique t
   "If non-nil, `eshell-last-dir-ring' contains only unique entries."
-  :type 'boolean
-  :group 'eshell-dirs)
+  :type 'boolean)
 
 ;;; Internal Variables:
 
@@ -189,20 +175,22 @@ Thus, this does not include the current directory.")
   (setq eshell-variable-aliases-list
        (append
         eshell-variable-aliases-list
-        '(("-" (lambda (indices)
-                 (if (not indices)
-                     (unless (ring-empty-p eshell-last-dir-ring)
-                       (expand-file-name
-                        (ring-ref eshell-last-dir-ring 0)))
-                   (expand-file-name
-                    (eshell-apply-indices eshell-last-dir-ring indices)))))
-          ("+" "PWD")
-          ("PWD" (lambda (indices)
-                   (expand-file-name (eshell/pwd))) t)
-          ("OLDPWD" (lambda (indices)
+         `(("-" ,(lambda (indices)
+                  (if (not indices)
                       (unless (ring-empty-p eshell-last-dir-ring)
                         (expand-file-name
-                         (ring-ref eshell-last-dir-ring 0)))) t))))
+                         (ring-ref eshell-last-dir-ring 0)))
+                    (expand-file-name
+                     (eshell-apply-indices eshell-last-dir-ring indices)))))
+          ("+" "PWD")
+          ("PWD" ,(lambda (_indices)
+                    (expand-file-name (eshell/pwd)))
+            t)
+          ("OLDPWD" ,(lambda (_indices)
+                       (unless (ring-empty-p eshell-last-dir-ring)
+                         (expand-file-name
+                          (ring-ref eshell-last-dir-ring 0))))
+            t))))
 
   (when eshell-cd-on-directory
     (make-local-variable 'eshell-interpreter-alist)
@@ -213,14 +201,14 @@ Thus, this does not include the current directory.")
                eshell-interpreter-alist)))
 
   (add-hook 'eshell-parse-argument-hook
-           'eshell-parse-user-reference nil t)
+           #'eshell-parse-user-reference nil t)
   (if (eshell-under-windows-p)
       (add-hook 'eshell-parse-argument-hook
-               'eshell-parse-drive-letter nil t))
+               #'eshell-parse-drive-letter nil t))
 
   (when (eshell-using-module 'eshell-cmpl)
     (add-hook 'pcomplete-try-first-hook
-             'eshell-complete-user-reference nil t))
+             #'eshell-complete-user-reference nil t))
 
   (make-local-variable 'eshell-dirstack)
   (make-local-variable 'eshell-last-dir-ring)
@@ -230,9 +218,9 @@ Thus, this does not include the current directory.")
   (unless eshell-last-dir-ring
     (setq eshell-last-dir-ring (make-ring eshell-last-dir-ring-size)))
 
-  (add-hook 'eshell-exit-hook 'eshell-write-last-dir-ring nil t)
+  (add-hook 'eshell-exit-hook #'eshell-write-last-dir-ring nil t)
 
-  (add-hook 'kill-emacs-hook 'eshell-save-some-last-dir))
+  (add-hook 'kill-emacs-hook #'eshell-save-some-last-dir))
 
 (defun eshell-save-some-last-dir ()
   "Save the list-dir-ring for any open Eshell buffers."
@@ -259,7 +247,7 @@ Thus, this does not include the current directory.")
   (if (> (length args) 1)
       (error "%s: command not found" (car args))
     (throw 'eshell-replace-command
-          (eshell-parse-command "cd" (eshell-flatten-list args)))))
+          (eshell-parse-command "cd" (flatten-tree args)))))
 
 (defun eshell-parse-user-reference ()
   "An argument beginning with ~ is a filename to be expanded."
@@ -272,7 +260,7 @@ Thus, this does not include the current directory.")
 (defun eshell-parse-drive-letter ()
   "An argument beginning with X:[^/] is a drive letter reference."
   (when (and (not eshell-current-argument)
-            (looking-at "\\([A-Za-z]:\\)\\([^/\\\\]\\|\\'\\)"))
+            (looking-at "\\([A-Za-z]:\\)\\([^/\\]\\|\\'\\)"))
     (goto-char (match-end 1))
     (let* ((letter (match-string 1))
           (regexp (concat "\\`" letter))
@@ -307,13 +295,11 @@ Thus, this does not include the current directory.")
     (if (and (> len 1)
             (eq (aref path (1- len)) ?/)
             (not (and (eshell-under-windows-p)
-                      (string-match "\\`[A-Za-z]:[\\\\/]\\'" path))))
+                      (string-match "\\`[A-Za-z]:[\\/]\\'" path))))
        (setq path (substring path 0 (1- (length path)))))
-    (if eshell-pwd-convert-function
-       (funcall eshell-pwd-convert-function path)
-      path)))
+    (funcall (or eshell-pwd-convert-function #'identity) path)))
 
-(defun eshell-expand-multiple-dots (path)
+(defun eshell-expand-multiple-dots (filename)
   ;; FIXME: This advice recommendation is rather odd: it's somewhat
   ;; dangerous and it claims not to work with minibuffer-completion, which
   ;; makes it much less interesting.
@@ -326,16 +312,17 @@ in the minibuffer:
     (advice-add 'expand-file-name :around #'my-expand-multiple-dots)
     (defun my-expand-multiple-dots (orig-fun filename &rest args)
       (apply orig-fun (eshell-expand-multiple-dots filename) args))"
-  (while (string-match "\\(?:^\\|/\\)\\.\\.\\(\\.+\\)\\(?:$\\|/\\)" path)
-    (let* ((extra-dots (match-string 1 path))
+  (while (string-match "\\(?:\\`\\|/\\)\\.\\.\\(\\.+\\)\\(?:\\'\\|/\\)"
+                       filename)
+    (let* ((extra-dots (match-string 1 filename))
           (len (length extra-dots))
           replace-text)
       (while (> len 0)
        (setq replace-text (concat replace-text "/..")
              len (1- len)))
-      (setq path
-           (replace-match replace-text t t path 1))))
-  path)
+      (setq filename
+           (replace-match replace-text t t filename 1))))
+  filename)
 
 (defun eshell-find-previous-directory (regexp)
   "Find the most recent last-dir matching REGEXP."
@@ -353,7 +340,7 @@ in the minibuffer:
 
 (defun eshell/cd (&rest args)           ; all but first ignored
   "Alias to extend the behavior of `cd'."
-  (setq args (eshell-flatten-list args))
+  (setq args (flatten-tree args))
   (let ((path (car args))
        (subpath (car (cdr args)))
        (case-fold-search (eshell-under-windows-p))
@@ -552,15 +539,16 @@ in the minibuffer:
 
 (defun eshell-write-last-dir-ring ()
   "Write the buffer's `eshell-last-dir-ring' to a history file."
-  (let ((file eshell-last-dir-ring-file-name))
+  (let* ((file eshell-last-dir-ring-file-name)
+        (resolved-file (if (stringp file) (file-truename file))))
     (cond
      ((or (null file)
          (equal file "")
          (null eshell-last-dir-ring)
          (ring-empty-p eshell-last-dir-ring))
       nil)
-     ((not (file-writable-p file))
-      (message "Cannot write last-dir-ring file %s" file))
+     ((not (file-writable-p resolved-file))
+      (message "Cannot write last-dir-ring file %s" resolved-file))
      (t
       (let* ((ring eshell-last-dir-ring)
             (index (ring-length ring)))
@@ -570,7 +558,7 @@ in the minibuffer:
            (insert (ring-ref ring index) ?\n))
          (insert (eshell/pwd) ?\n)
          (eshell-with-private-file-modes
-          (write-region (point-min) (point-max) file nil
+          (write-region (point-min) (point-max) resolved-file nil
                         'no-message))))))))
 
 (provide 'em-dirs)
diff --git a/lisp/eshell/em-glob.el b/lisp/eshell/em-glob.el
index ca7b1b8..f03243a 100644
--- a/lisp/eshell/em-glob.el
+++ b/lisp/eshell/em-glob.el
@@ -1,6 +1,6 @@
 ;;; em-glob.el --- extended file name globbing  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index 62e2f57..05579ee 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -1,6 +1,6 @@
 ;;; em-hist.el --- history list management  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -466,15 +466,16 @@ lost if `eshell-history-ring' is not empty.  If
 Useful within process sentinels.
 
 See also `eshell-read-history'."
-  (let ((file (or filename eshell-history-file-name)))
+  (let* ((file (or filename eshell-history-file-name))
+        (resolved-file (if (stringp file) (file-truename file))))
     (cond
      ((or (null file)
          (equal file "")
          (null eshell-history-ring)
          (ring-empty-p eshell-history-ring))
       nil)
-     ((not (file-writable-p file))
-      (message "Cannot write history file %s" file))
+     ((not (file-writable-p resolved-file))
+      (message "Cannot write history file %s" resolved-file))
      (t
       (let* ((ring eshell-history-ring)
             (index (ring-length ring)))
@@ -489,7 +490,7 @@ See also `eshell-read-history'."
               (insert (substring-no-properties (ring-ref ring index)) ?\n)
              (subst-char-in-region start (1- (point)) ?\n ?\177)))
          (eshell-with-private-file-modes
-          (write-region (point-min) (point-max) file append
+          (write-region (point-min) (point-max) resolved-file append
                         'no-message))))))))
 
 (defun eshell-list-history ()
diff --git a/lisp/eshell/em-ls.el b/lisp/eshell/em-ls.el
index 53de7f7..5e4bbdc 100644
--- a/lisp/eshell/em-ls.el
+++ b/lisp/eshell/em-ls.el
@@ -1,6 +1,6 @@
 ;;; em-ls.el --- implementation of ls in Lisp  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -346,7 +346,7 @@ instead."
    "ls" (if eshell-ls-initial-args
            (list eshell-ls-initial-args args)
          args)
-   `((?a "all" nil show-all
+   '((?a "all" nil show-all
         "do not ignore entries starting with .")
      (?A "almost-all" nil show-almost-all
         "do not list implied . and ..")
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index c3b942d..dd3351b 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -1,6 +1,6 @@
 ;;; em-pred.el --- argument predicates and modifiers (ala zsh)  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -421,9 +421,8 @@ resultant list of strings."
       (forward-char))
     (if (looking-at "[0-9]+")
        (progn
-         (setq when (- (float-time)
-                       (* (string-to-number (match-string 0))
-                          quantum)))
+         (setq when (time-since (* (string-to-number (match-string 0))
+                                   quantum)))
          (goto-char (match-end 0)))
       (setq open (char-after))
       (if (setq close (memq open '(?\( ?\[ ?\< ?\{)))
@@ -438,17 +437,17 @@ resultant list of strings."
             (attrs (file-attributes file)))
        (unless attrs
          (error "Cannot stat file `%s'" file))
-       (setq when (float-time (nth attr-index attrs))))
+       (setq when (nth attr-index attrs)))
       (goto-char (1+ end)))
     `(lambda (file)
        (let ((attrs (file-attributes file)))
         (if attrs
             (,(if (eq qual ?-)
-                  '<
+                  'time-less-p
                 (if (eq qual ?+)
-                    '>
-                  '=)) ,when (float-time
-                              (nth ,attr-index attrs))))))))
+                    '(lambda (a b) (time-less-p b a))
+                  'time-equal-p))
+             ,when (nth ,attr-index attrs)))))))
 
 (defun eshell-pred-file-type (type)
   "Return a test which tests that the file is of a certain TYPE.
diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el
index e61b0eb..a303520 100644
--- a/lisp/eshell/em-prompt.el
+++ b/lisp/eshell/em-prompt.el
@@ -1,6 +1,6 @@
 ;;; em-prompt.el --- command prompts  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
diff --git a/lisp/eshell/em-rebind.el b/lisp/eshell/em-rebind.el
index 064dcc7..9cb1617 100644
--- a/lisp/eshell/em-rebind.el
+++ b/lisp/eshell/em-rebind.el
@@ -1,6 +1,6 @@
 ;;; em-rebind.el --- rebind keys when point is at current input  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
diff --git a/lisp/eshell/em-script.el b/lisp/eshell/em-script.el
index a5d8e96..bab2622 100644
--- a/lisp/eshell/em-script.el
+++ b/lisp/eshell/em-script.el
@@ -1,6 +1,6 @@
 ;;; em-script.el --- Eshell script files  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
diff --git a/lisp/eshell/em-smart.el b/lisp/eshell/em-smart.el
index 53bbdfe..420f885 100644
--- a/lisp/eshell/em-smart.el
+++ b/lisp/eshell/em-smart.el
@@ -1,6 +1,6 @@
 ;;; em-smart.el --- smart display of output  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
diff --git a/lisp/eshell/em-term.el b/lisp/eshell/em-term.el
index ddde47f..8af783e 100644
--- a/lisp/eshell/em-term.el
+++ b/lisp/eshell/em-term.el
@@ -1,6 +1,6 @@
 ;;; em-term.el --- running visual commands  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -175,7 +175,7 @@ allowed."
   (let* (eshell-interpreter-alist
         (interp (eshell-find-interpreter (car args) (cdr args)))
         (program (car interp))
-        (args (eshell-flatten-list
+        (args (flatten-tree
                (eshell-stringify-list (append (cdr interp)
                                               (cdr args)))))
         (term-buf
diff --git a/lisp/eshell/em-tramp.el b/lisp/eshell/em-tramp.el
index 9475f4e..603b762 100644
--- a/lisp/eshell/em-tramp.el
+++ b/lisp/eshell/em-tramp.el
@@ -1,6 +1,6 @@
 ;;; em-tramp.el --- Eshell features that require TRAMP  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Aidan Gauland <address@hidden>
 
@@ -62,7 +62,7 @@
   "Alias \"su\" to call TRAMP.
 
 Uses the system su through TRAMP's su method."
-  (setq args (eshell-stringify-list (eshell-flatten-list args)))
+  (setq args (eshell-stringify-list (flatten-tree args)))
   (let ((orig-args (copy-tree args)))
     (eshell-eval-using-options
      "su" args
@@ -100,7 +100,7 @@ Become another USER during a login session.")
   "Alias \"sudo\" to call Tramp.
 
 Uses the system sudo through TRAMP's sudo method."
-  (setq args (eshell-stringify-list (eshell-flatten-list args)))
+  (setq args (eshell-stringify-list (flatten-tree args)))
   (let ((orig-args (copy-tree args)))
     (eshell-eval-using-options
      "sudo" args
diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el
index 3aecebc..e4c4265 100644
--- a/lisp/eshell/em-unix.el
+++ b/lisp/eshell/em-unix.el
@@ -1,6 +1,6 @@
 ;;; em-unix.el --- UNIX command aliases  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -231,7 +231,7 @@ Otherwise, Emacs will attempt to use rsh to invoke du on 
the remote machine."
 This is implemented to call either `delete-file', `kill-buffer',
 `kill-process', or `unintern', depending on the nature of the
 argument."
-  (setq args (eshell-flatten-list args))
+  (setq args (flatten-tree args))
   (eshell-eval-using-options
    "rm" args
    '((?h "help" nil nil "show this usage screen")
@@ -481,7 +481,7 @@ Remove the DIRECTORY(ies), if they are empty.")
         (error "%s: missing destination file or directory" ,command))
      (if (= len 1)
         (nconc args '(".")))
-     (setq args (eshell-stringify-list (eshell-flatten-list args)))
+     (setq args (eshell-stringify-list (flatten-tree args)))
      (if (and ,(not (equal command "ln"))
              (string-match eshell-tar-regexp (car (last args)))
              (or (> (length args) 2)
@@ -606,7 +606,7 @@ with `--symbolic'.  When creating hard links, each TARGET 
must exist.")
   "Implementation of cat in Lisp.
 If in a pipeline, or the file is not a regular file, directory or
 symlink, then revert to the system's definition of cat."
-  (setq args (eshell-stringify-list (eshell-flatten-list args)))
+  (setq args (eshell-stringify-list (flatten-tree args)))
   (if (or eshell-in-pipeline-p
          (catch 'special
            (dolist (arg args)
@@ -670,7 +670,7 @@ Fallback to standard make when called synchronously."
        (compile (concat "make " (eshell-flatten-and-stringify args))))
     (throw 'eshell-replace-command
           (eshell-parse-command "*make" (eshell-stringify-list
-                                         (eshell-flatten-list args))))))
+                                         (flatten-tree args))))))
 
 (put 'eshell/make 'eshell-no-numeric-conversions t)
 
@@ -705,7 +705,7 @@ available..."
          (erase-buffer)
          (occur-mode)
          (let ((files (eshell-stringify-list
-                       (eshell-flatten-list (cdr args))))
+                       (flatten-tree (cdr args))))
                (inhibit-redisplay t)
                string)
            (when (car args)
@@ -750,11 +750,11 @@ external command."
        (throw 'eshell-replace-command
               (eshell-parse-command (concat "*" command)
                                     (eshell-stringify-list
-                                     (eshell-flatten-list args))))
+                                     (flatten-tree args))))
       (let* ((args (mapconcat 'identity
                              (mapcar 'shell-quote-argument
                                      (eshell-stringify-list
-                                      (eshell-flatten-list args)))
+                                      (flatten-tree args)))
                              " "))
             (cmd (progn
                    (set-text-properties 0 (length args)
@@ -876,7 +876,7 @@ external command."
 (defun eshell/du (&rest args)
   "Implementation of \"du\" in Lisp, passing ARGS."
   (setq args (if args
-                (eshell-stringify-list (eshell-flatten-list args))
+                (eshell-stringify-list (flatten-tree args))
               '(".")))
   (let ((ext-du (eshell-search-path "du")))
     (if (and ext-du
@@ -943,7 +943,8 @@ Summarize disk usage of each FILE, recursively for 
directories.")
 (defvar eshell-time-start nil)
 
 (defun eshell-show-elapsed-time ()
-  (let ((elapsed (format "%.3f secs\n" (- (float-time) eshell-time-start))))
+  (let ((elapsed (format "%.3f secs\n"
+                        (float-time (time-since eshell-time-start)))))
     (set-text-properties 0 (length elapsed) '(face bold) elapsed)
     (eshell-interactive-print elapsed))
   (remove-hook 'eshell-post-command-hook 'eshell-show-elapsed-time t))
@@ -976,7 +977,7 @@ Show wall-clock time elapsed during execution of COMMAND.")
            (eshell-parse-command (car time-args)
 ;;; https://lists.gnu.org/r/bug-gnu-emacs/2007-08/msg00205.html
                                  (eshell-stringify-list
-                                  (eshell-flatten-list (cdr time-args))))))))
+                                  (flatten-tree (cdr time-args))))))))
 
 (defun eshell/whoami (&rest _args)
   "Make \"whoami\" Tramp aware."
@@ -1000,7 +1001,7 @@ Show wall-clock time elapsed during execution of 
COMMAND.")
 
 (defun eshell/diff (&rest args)
   "Alias \"diff\" to call Emacs `diff' function."
-  (let ((orig-args (eshell-stringify-list (eshell-flatten-list args))))
+  (let ((orig-args (eshell-stringify-list (flatten-tree args))))
     (if (or eshell-plain-diff-behavior
            (not (and (eshell-interactive-output-p)
                      (not eshell-in-pipeline-p)
@@ -1056,7 +1057,7 @@ Show wall-clock time elapsed during execution of 
COMMAND.")
               (string-match "^-" (car args))))
       (throw 'eshell-replace-command
             (eshell-parse-command "*locate" (eshell-stringify-list
-                                             (eshell-flatten-list args))))
+                                             (flatten-tree args))))
     (save-selected-window
       (let ((locate-history-list (list (car args))))
        (locate-with-filter (car args) (cadr args))))))
diff --git a/lisp/eshell/em-xtra.el b/lisp/eshell/em-xtra.el
index cc84d19..602e841 100644
--- a/lisp/eshell/em-xtra.el
+++ b/lisp/eshell/em-xtra.el
@@ -1,6 +1,6 @@
 ;;; em-xtra.el --- extra alias functions  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -51,7 +51,7 @@ naturally accessible within Emacs."
   "Implementation of expr, using the calc package."
   (if (not (fboundp 'calc-eval))
       (throw 'eshell-replace-command
-            (eshell-parse-command "*expr" (eshell-flatten-list args)))
+            (eshell-parse-command "*expr" (flatten-tree args)))
     ;; to fool the byte-compiler...
     (let ((func 'calc-eval))
       (funcall func (eshell-flatten-and-stringify args)))))
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el
index 6709588..360202b 100644
--- a/lisp/eshell/esh-arg.el
+++ b/lisp/eshell/esh-arg.el
@@ -1,6 +1,6 @@
 ;;; esh-arg.el --- argument processing  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index 92cac61..1ed5d5d 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -1,6 +1,6 @@
 ;;; esh-cmd.el --- command invocation  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -122,24 +122,20 @@ however."
 
 (defcustom eshell-prefer-lisp-functions nil
   "If non-nil, prefer Lisp functions to external commands."
-  :type 'boolean
-  :group 'eshell-cmd)
+  :type 'boolean)
 
 (defcustom eshell-lisp-regexp "\\([(`]\\|#'\\)"
   "A regexp which, if matched at beginning of an argument, means Lisp.
 Such arguments will be passed to `read', and then evaluated."
-  :type 'regexp
-  :group 'eshell-cmd)
+  :type 'regexp)
 
 (defcustom eshell-pre-command-hook nil
   "A hook run before each interactive command is invoked."
-  :type 'hook
-  :group 'eshell-cmd)
+  :type 'hook)
 
 (defcustom eshell-post-command-hook nil
   "A hook run after each interactive command is invoked."
-  :type 'hook
-  :group 'eshell-cmd)
+  :type 'hook)
 
 (defcustom eshell-prepare-command-hook nil
   "A set of functions called to prepare a named command.
@@ -149,8 +145,7 @@ the value of these symbols if necessary.
 
 To prevent a command from executing at all, set
 `eshell-last-command-name' to nil."
-  :type 'hook
-  :group 'eshell-cmd)
+  :type 'hook)
 
 (defcustom eshell-named-command-hook nil
   "A set of functions called before a named command is invoked.
@@ -165,7 +160,7 @@ In order to substitute an alternate command form for 
execution, the
 hook function should throw it using the tag `eshell-replace-command'.
 For example:
 
-  (add-hook \\='eshell-named-command-hook \\='subst-with-cd)
+  (add-hook \\='eshell-named-command-hook #\\='subst-with-cd)
   (defun subst-with-cd (command args)
     (throw \\='eshell-replace-command
           (eshell-parse-command \"cd\" args)))
@@ -173,8 +168,7 @@ For example:
 Although useless, the above code will cause any non-glob, non-Lisp
 command (i.e., `ls' as opposed to `*ls' or `(ls)') to be replaced by a
 call to `cd' using the arguments that were passed to the function."
-  :type 'hook
-  :group 'eshell-cmd)
+  :type 'hook)
 
 (defcustom eshell-pre-rewrite-command-hook
   '(eshell-no-command-conversion
@@ -182,8 +176,7 @@ call to `cd' using the arguments that were passed to the 
function."
   "A hook run before command rewriting begins.
 The terms of the command to be rewritten is passed as arguments, and
 may be modified in place.  Any return value is ignored."
-  :type 'hook
-  :group 'eshell-cmd)
+  :type 'hook)
 
 (defcustom eshell-rewrite-command-hook
   '(eshell-rewrite-for-command
@@ -202,8 +195,7 @@ so by adding a function to this hook.  The first function 
to return a
 substitute command form is the one used.  Each function is passed the
 command's full argument list, which is a list of sexps (typically
 forms or strings)."
-  :type 'hook
-  :group 'eshell-cmd)
+  :type 'hook)
 
 (defvar eshell-post-rewrite-command-function #'identity
   "Function run after command rewriting is finished.
@@ -228,16 +220,14 @@ If an entry is a function, it will be called with the 
name, and should
 return non-nil if the command is complex."
   :type '(repeat :tag "Commands"
                 (choice (string :tag "Name")
-                        (function :tag "Predicate")))
-  :group 'eshell-cmd)
+                        (function :tag "Predicate"))))
 
 ;;; User Variables:
 
 (defcustom eshell-cmd-load-hook nil
   "A hook that gets run when `eshell-cmd' is loaded."
   :version "24.1"                     ; removed eshell-cmd-initialize
-  :type 'hook
-  :group 'eshell-cmd)
+  :type 'hook)
 
 (defcustom eshell-debug-command nil
   "If non-nil, enable Eshell debugging code.
@@ -247,9 +237,8 @@ you must re-load `esh-cmd.el'."
   :initialize 'custom-initialize-default
   :set (lambda (symbol value)
         (set symbol value)
-        (load-library "esh-cmd"))
-  :type 'boolean
-  :group 'eshell-cmd)
+        (load "esh-cmd"))
+  :type 'boolean)
 
 (defcustom eshell-deferrable-commands
   '(eshell-named-command
@@ -259,16 +248,14 @@ you must re-load `esh-cmd.el'."
 If they return a process object, execution of the calling Eshell
 command will wait for completion (in the background) before finishing
 the command."
-  :type '(repeat function)
-  :group 'eshell-cmd)
+  :type '(repeat function))
 
 (defcustom eshell-subcommand-bindings
   '((eshell-in-subcommand-p t)
     (default-directory default-directory)
     (process-environment (eshell-copy-environment)))
   "A list of `let' bindings for subcommand environments."
-  :type 'sexp
-  :group 'eshell-cmd)
+  :type 'sexp)
 
 (put 'risky-local-variable 'eshell-subcommand-bindings t)
 
@@ -307,7 +294,7 @@ otherwise t.")
   (set (make-local-variable 'eshell-last-command-name) nil)
   (set (make-local-variable 'eshell-last-async-proc) nil)
 
-  (add-hook 'eshell-kill-hook 'eshell-resume-command nil t)
+  (add-hook 'eshell-kill-hook #'eshell-resume-command nil t)
 
   ;; make sure that if a command is over, and no process is being
   ;; waited for, that `eshell-current-command' is set to nil.  This
@@ -317,16 +304,17 @@ otherwise t.")
            (function
             (lambda ()
               (setq eshell-current-command nil
-                    eshell-last-async-proc nil))) nil t)
+                    eshell-last-async-proc nil)))
+            nil t)
 
   (add-hook 'eshell-parse-argument-hook
-           'eshell-parse-subcommand-argument nil t)
+           #'eshell-parse-subcommand-argument nil t)
   (add-hook 'eshell-parse-argument-hook
-           'eshell-parse-lisp-argument nil t)
+           #'eshell-parse-lisp-argument nil t)
 
   (when (eshell-using-module 'eshell-cmpl)
     (add-hook 'pcomplete-try-first-hook
-             'eshell-complete-lisp-symbols nil t)))
+             #'eshell-complete-lisp-symbols nil t)))
 
 (defun eshell-complete-lisp-symbols ()
   "If there is a user reference, complete it."
@@ -724,6 +712,8 @@ ensconced in a list."
         eshell-current-subjob-p)
      ,object))
 
+(defvar eshell-this-command-hook nil)
+
 (defmacro eshell-trap-errors (object)
   "Trap any errors that occur, so they are not entirely fatal.
 Also, the variable `eshell-this-command-hook' is available for the
@@ -736,9 +726,9 @@ this grossness will be made to disappear by using 
`call/cc'..."
      (eshell-condition-case err
         (prog1
             ,object
-          (run-hooks 'eshell-this-command-hook))
+          (mapc #'funcall eshell-this-command-hook))
        (error
-       (run-hooks 'eshell-this-command-hook)
+       (mapc #'funcall eshell-this-command-hook)
        (eshell-errorn (error-message-string err))
        (eshell-close-handles 1)))))
 
@@ -816,7 +806,7 @@ This is used on systems where async subprocesses are not 
supported."
        ;; The last process in the pipe should get its handles
        ;; redirected as we found them before running the pipe.
        ,(if (null (cdr pipeline))
-            `(progn
+            '(progn
                (setq eshell-current-handles tail-handles)
                (setq eshell-in-pipeline-p nil)))
        (let ((result ,(car pipeline)))
@@ -1059,16 +1049,8 @@ be finished later after the completion of an 
asynchronous subprocess."
        ((eq (car form) 'setcdr)
        (setcar (cdr args) (eshell-do-eval (cadr args) synchronous-p))
        (eval form))
-       ((memq (car form) '(let catch condition-case unwind-protect))
-       ;; `let', `condition-case' and `unwind-protect' have to be
-       ;; handled specially, because we only want to call
-       ;; `eshell-do-eval' on their first form.
-       ;;
-       ;; NOTE: This requires obedience by all forms which this
-       ;; function might encounter, that they do not contain
-       ;; other special forms.
-       (if (and (eq (car form) 'let)
-                (not (eq (car (cadr args)) 'eshell-do-eval)))
+       ((eq (car form) 'let)
+       (if (not (eq (car (cadr args)) 'eshell-do-eval))
            (eshell-manipulate "evaluating let args"
              (dolist (letarg (car args))
                (if (and (listp letarg)
@@ -1076,6 +1058,21 @@ be finished later after the completion of an 
asynchronous subprocess."
                    (setcdr letarg
                            (list (eshell-do-eval
                                   (cadr letarg) synchronous-p)))))))
+        (cl-progv
+            (mapcar (lambda (binding) (if (consp binding) (car binding) 
binding))
+                    (car args))
+            ;; These expressions should all be constants now.
+            (mapcar (lambda (binding) (if (consp binding) (eval (cadr 
binding))))
+                    (car args))
+         (eshell-do-eval (macroexp-progn (cdr args)) synchronous-p)))
+       ((memq (car form) '(catch condition-case unwind-protect))
+       ;; `condition-case' and `unwind-protect' have to be
+       ;; handled specially, because we only want to call
+       ;; `eshell-do-eval' on their first form.
+       ;;
+       ;; NOTE: This requires obedience by all forms which this
+       ;; function might encounter, that they do not contain
+       ;; other special forms.
        (unless (eq (car form) 'unwind-protect)
          (setq args (cdr args)))
        (unless (eq (caar args) 'eshell-do-eval)
@@ -1158,10 +1155,9 @@ be finished later after the completion of an 
asynchronous subprocess."
          (setq name (substring name 1)
                direct t))
       (if (and (not direct)
-              (eshell-using-module 'eshell-alias)
+              (fboundp 'eshell-lookup-alias)
               (setq alias
-                    (funcall (symbol-function 'eshell-lookup-alias)
-                             name)))
+                    (eshell-lookup-alias name)))
          (setq program
                (concat name " is an alias, defined as \""
                        (cadr alias) "\"")))
diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el
index 244cc7f..35ebd36 100644
--- a/lisp/eshell/esh-ext.el
+++ b/lisp/eshell/esh-ext.el
@@ -1,6 +1,6 @@
 ;;; esh-ext.el --- commands external to Eshell  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -222,7 +222,7 @@ causing the user to wonder if anything's really going on..."
 
 (defun eshell-external-command (command args)
   "Insert output from an external COMMAND, using ARGS."
-  (setq args (eshell-stringify-list (eshell-flatten-list args)))
+  (setq args (eshell-stringify-list (flatten-tree args)))
   (let ((interp (eshell-find-interpreter
                 command
                 args
diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el
index 1bcf5fb..c33e732 100644
--- a/lisp/eshell/esh-io.el
+++ b/lisp/eshell/esh-io.el
@@ -1,6 +1,6 @@
 ;;; esh-io.el --- I/O management  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
diff --git a/lisp/eshell/esh-mode.el b/lisp/eshell/esh-mode.el
index 0c25f41..3029876 100644
--- a/lisp/eshell/esh-mode.el
+++ b/lisp/eshell/esh-mode.el
@@ -1,6 +1,6 @@
 ;;; esh-mode.el --- user interface  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
diff --git a/lisp/eshell/esh-module.el b/lisp/eshell/esh-module.el
index 06e94bd..2583044 100644
--- a/lisp/eshell/esh-module.el
+++ b/lisp/eshell/esh-module.el
@@ -1,6 +1,6 @@
 ;;; esh-module.el --- Eshell modules  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2000, 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 ;; Keywords: processes
diff --git a/lisp/eshell/esh-opt.el b/lisp/eshell/esh-opt.el
index d7a4494..a023a3c 100644
--- a/lisp/eshell/esh-opt.el
+++ b/lisp/eshell/esh-opt.el
@@ -1,6 +1,6 @@
 ;;; esh-opt.el --- command options processing  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -77,7 +77,7 @@ arguments, some do not.  The recognized :KEYWORDS are:
   arguments.
 
 :preserve-args
-  If present, do not pass MACRO-ARGS through `eshell-flatten-list'
+  If present, do not pass MACRO-ARGS through `flatten-tree'
 and `eshell-stringify-list'.
 
 :parse-leading-options-only
@@ -106,7 +106,7 @@ let-bound variable `args'."
            ,(if (memq ':preserve-args (cadr options))
                 macro-args
               (list 'eshell-stringify-list
-                    (list 'eshell-flatten-list macro-args))))
+                    (list 'flatten-tree macro-args))))
           (processed-args (eshell--do-opts ,name ,options temp-args))
           ,@(delete-dups
              (delq nil (mapcar (lambda (opt)
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index 3735f30..3432582 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -1,6 +1,6 @@
 ;;; esh-proc.el --- process management  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -282,7 +282,6 @@ See `eshell-needs-pipe'."
            (let ((process-connection-type
                   (unless (eshell-needs-pipe-p command)
                     process-connection-type))
-                 ;; `start-process' can't deal with relative filenames.
                  (command (file-local-name (expand-file-name command))))
              (apply 'start-file-process
                     (file-name-nondirectory command) nil command args)))
@@ -499,7 +498,7 @@ See the variable `eshell-kill-processes-on-exit'."
                                        (buffer-name))))
          (eshell-round-robin-kill
           (if (eq eshell-kill-processes-on-exit 'every)
-              (format-message "Kill Eshell child process `%s'? "))))
+              "Kill Eshell child process `%s'? ")))
       (let ((buf (get-buffer "*Process List*")))
        (if (and buf (buffer-live-p buf))
            (kill-buffer buf)))
diff --git a/lisp/eshell/esh-util.el b/lisp/eshell/esh-util.el
index 8fe8c46..118978e 100644
--- a/lisp/eshell/esh-util.el
+++ b/lisp/eshell/esh-util.el
@@ -1,6 +1,6 @@
 ;;; esh-util.el --- general utilities  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -285,15 +285,7 @@ Prepend remote identification of `default-directory', if 
any."
         ,@forms)
        (setq list-iter (cdr list-iter)))))
 
-(defun eshell-flatten-list (args)
-  "Flatten any lists within ARGS, so that there are no sublists."
-  (let ((new-list (list t)))
-    (dolist (a args)
-      (if (and (listp a)
-              (listp (cdr a)))
-         (nconc new-list (eshell-flatten-list a))
-       (nconc new-list (list a))))
-    (cdr new-list)))
+(define-obsolete-function-alias 'eshell-flatten-list #'flatten-tree "27.1")
 
 (defun eshell-uniquify-list (l)
   "Remove occurring multiples in L.  You probably want to sort first."
@@ -330,7 +322,7 @@ Prepend remote identification of `default-directory', if 
any."
 
 (defsubst eshell-flatten-and-stringify (&rest args)
   "Flatten and stringify all of the ARGS into a single string."
-  (mapconcat 'eshell-stringify (eshell-flatten-list args) " "))
+  (mapconcat 'eshell-stringify (flatten-tree args) " "))
 
 (defsubst eshell-directory-files (regexp &optional directory)
   "Return a list of files in the given DIRECTORY matching REGEXP."
@@ -660,7 +652,7 @@ If NOSORT is non-nil, the list is not sorted--its order is 
unpredictable.
                        (setcar (nthcdr 0 moment) 0)
                        (setcar (nthcdr 1 moment) 0)
                        (setcar (nthcdr 2 moment) 0))
-                     (apply 'encode-time moment))
+                     (encode-time moment))
                  (ange-ftp-file-modtime (expand-file-name name dir))))
               symlink)
          (if (string-match "\\(.+\\) -> \\(.+\\)" name)
diff --git a/lisp/eshell/esh-var.el b/lisp/eshell/esh-var.el
index b5dce80..d8be72e 100644
--- a/lisp/eshell/esh-var.el
+++ b/lisp/eshell/esh-var.el
@@ -1,6 +1,6 @@
 ;;; esh-var.el --- handling of variables  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -128,60 +128,55 @@ variable value, a subcommand, or even the result of a 
Lisp form."
 (defcustom eshell-var-load-hook nil
   "A list of functions to call when loading `eshell-var'."
   :version "24.1"                      ; removed eshell-var-initialize
-  :type 'hook
-  :group 'eshell-var)
+  :type 'hook)
 
 (defcustom eshell-prefer-lisp-variables nil
   "If non-nil, prefer Lisp variables to environment variables."
-  :type 'boolean
-  :group 'eshell-var)
+  :type 'boolean)
 
 (defcustom eshell-complete-export-definition t
   "If non-nil, completing names for `export' shows current definition."
-  :type 'boolean
-  :group 'eshell-var)
+  :type 'boolean)
 
 (defcustom eshell-modify-global-environment nil
   "If non-nil, using `export' changes Emacs's global environment."
-  :type 'boolean
-  :group 'eshell-var)
+  :type 'boolean)
 
 (defcustom eshell-variable-name-regexp "[A-Za-z0-9_-]+"
   "A regexp identifying what constitutes a variable name reference.
 Note that this only applies for `$NAME'.  If the syntax `$<NAME>' is
 used, then NAME can contain any character, including angle brackets,
 if they are quoted with a backslash."
-  :type 'regexp
-  :group 'eshell-var)
+  :type 'regexp)
 
 (defcustom eshell-variable-aliases-list
-  '(;; for eshell.el
-    ("COLUMNS" (lambda (indices) (window-width)) t)
-    ("LINES" (lambda (indices) (window-height)) t)
+  `(;; for eshell.el
+    ("COLUMNS" ,(lambda (_indices) (window-width)) t)
+    ("LINES" ,(lambda (_indices) (window-height)) t)
 
     ;; for eshell-cmd.el
-    ("_" (lambda (indices)
-          (if (not indices)
-              (car (last eshell-last-arguments))
-            (eshell-apply-indices eshell-last-arguments
-                                  indices))))
+    ("_" ,(lambda (indices)
+           (if (not indices)
+               (car (last eshell-last-arguments))
+             (eshell-apply-indices eshell-last-arguments
+                                   indices))))
     ("?" eshell-last-command-status)
     ("$" eshell-last-command-result)
     ("0" eshell-command-name)
-    ("1" (lambda (indices) (nth 0 eshell-command-arguments)))
-    ("2" (lambda (indices) (nth 1 eshell-command-arguments)))
-    ("3" (lambda (indices) (nth 2 eshell-command-arguments)))
-    ("4" (lambda (indices) (nth 3 eshell-command-arguments)))
-    ("5" (lambda (indices) (nth 4 eshell-command-arguments)))
-    ("6" (lambda (indices) (nth 5 eshell-command-arguments)))
-    ("7" (lambda (indices) (nth 6 eshell-command-arguments)))
-    ("8" (lambda (indices) (nth 7 eshell-command-arguments)))
-    ("9" (lambda (indices) (nth 8 eshell-command-arguments)))
-    ("*" (lambda (indices)
-          (if (not indices)
-              eshell-command-arguments
-            (eshell-apply-indices eshell-command-arguments
-                                  indices)))))
+    ("1" ,(lambda (_indices) (nth 0 eshell-command-arguments)))
+    ("2" ,(lambda (_indices) (nth 1 eshell-command-arguments)))
+    ("3" ,(lambda (_indices) (nth 2 eshell-command-arguments)))
+    ("4" ,(lambda (_indices) (nth 3 eshell-command-arguments)))
+    ("5" ,(lambda (_indices) (nth 4 eshell-command-arguments)))
+    ("6" ,(lambda (_indices) (nth 5 eshell-command-arguments)))
+    ("7" ,(lambda (_indices) (nth 6 eshell-command-arguments)))
+    ("8" ,(lambda (_indices) (nth 7 eshell-command-arguments)))
+    ("9" ,(lambda (_indices) (nth 8 eshell-command-arguments)))
+    ("*" ,(lambda (indices)
+           (if (not indices)
+               eshell-command-arguments
+             (eshell-apply-indices eshell-command-arguments
+                                   indices)))))
   "This list provides aliasing for variable references.
 It is very similar in concept to what `eshell-user-aliases-list' does
 for commands.  Each member of this defines the name of a command,
@@ -197,8 +192,7 @@ function), and the arguments passed to this function would 
be the list
 '(10 20)', and nil."
   :type '(repeat (list string sexp
                       (choice (const :tag "Copy to environment" t)
-                              (const :tag "Use only in Eshell" nil))))
-  :group 'eshell-var)
+                              (const :tag "Use only in Eshell" nil)))))
 
 (put 'eshell-variable-aliases-list 'risky-local-variable t)
 
@@ -397,6 +391,8 @@ process any indices that come after the variable reference."
          indices (and (not (eobp))
                       (eq (char-after) ?\[)
                       (eshell-parse-indices))
+          ;; This is an expression that will be evaluated by `eshell-do-eval',
+          ;; which only support let-binding of dynamically-scoped vars
          value `(let ((indices ',indices)) ,value))
     (if get-len
        `(length ,value)
@@ -419,18 +415,17 @@ Possible options are:
       (if (not end)
           (throw 'eshell-incomplete ?\{)
         (prog1
-            (list 'eshell-convert
-                  (list 'eshell-command-to-value
-                        (list 'eshell-as-subcommand
-                              (eshell-parse-command
-                               (cons (1+ (point)) end)))))
+            `(eshell-convert
+              (eshell-command-to-value
+               (eshell-as-subcommand
+                ,(eshell-parse-command (cons (1+ (point)) end)))))
           (goto-char (1+ end))))))
    ((memq (char-after) '(?\' ?\"))
     (let ((name (if (eq (char-after) ?\')
                     (eshell-parse-literal-quote)
                   (eshell-parse-double-quote))))
       (if name
-         (list 'eshell-get-variable (eval name) 'indices))))
+         `(eshell-get-variable ,(eval name) indices))))
    ((eq (char-after) ?\<)
     (let ((end (eshell-find-delimiter ?\< ?\>)))
       (if (not end)
@@ -439,37 +434,30 @@ Possible options are:
                (cmd (concat (buffer-substring (1+ (point)) end)
                             " > " temp)))
           (prog1
-              (list
-               'let (list (list 'eshell-current-handles
-                                (list 'eshell-create-handles temp
-                                      (list 'quote 'overwrite))))
-               (list
-                'progn
-                (list 'eshell-as-subcommand
-                      (eshell-parse-command cmd))
-                (list 'ignore
-                      (list 'nconc 'eshell-this-command-hook
-                            (list 'list
-                                  (list 'function
-                                        (list 'lambda nil
-                                              (list 'delete-file temp))))))
-                (list 'quote temp)))
+              `(let ((eshell-current-handles
+                      (eshell-create-handles ,temp 'overwrite)))
+                 (progn
+                   (eshell-as-subcommand ,(eshell-parse-command cmd))
+                   (ignore
+                    (nconc eshell-this-command-hook
+                           (list (function (lambda ()
+                                              (delete-file ,temp))))))
+                   (quote ,temp)))
             (goto-char (1+ end)))))))
    ((eq (char-after) ?\()
     (condition-case nil
-        (list 'eshell-command-to-value
-              (list 'eshell-lisp-command
-                    (list 'quote (read (current-buffer)))))
+        `(eshell-command-to-value
+          (eshell-lisp-command
+           ',(read (current-buffer))))
       (end-of-file
        (throw 'eshell-incomplete ?\())))
    ((assoc (char-to-string (char-after))
            eshell-variable-aliases-list)
     (forward-char)
-    (list 'eshell-get-variable
-          (char-to-string (char-before)) 'indices))
+    `(eshell-get-variable ,(char-to-string (char-before)) indices))
    ((looking-at eshell-variable-name-regexp)
     (prog1
-        (list 'eshell-get-variable (match-string 0) 'indices)
+        `(eshell-get-variable ,(match-string 0) indices)
       (goto-char (match-end 0))))
    (t
     (error "Invalid variable reference"))))
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index f3c4a4a..4516800 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -1,6 +1,6 @@
 ;;; eshell.el --- the Emacs command shell  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 ;; Version: 2.4.2
diff --git a/lisp/expand.el b/lisp/expand.el
index 010ba60..0c4d343 100644
--- a/lisp/expand.el
+++ b/lisp/expand.el
@@ -1,6 +1,6 @@
 ;;; expand.el --- make abbreviations more usable
 
-;; Copyright (C) 1995-1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Frederic Lepied <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/ezimage.el b/lisp/ezimage.el
index 86ced34..2b06878 100644
--- a/lisp/ezimage.el
+++ b/lisp/ezimage.el
@@ -1,6 +1,6 @@
 ;;; ezimage --- Generalized Image management
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: file, tags, tools
diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index c6a976d..1a0cc64 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -1,6 +1,6 @@
 ;;; face-remap.el --- Functions for managing `face-remapping-alist'  -*- 
lexical-binding: t -*-
 ;;
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <address@hidden>
 ;; Keywords: faces, face remapping, display, user commands
diff --git a/lisp/facemenu.el b/lisp/facemenu.el
index 7c10d60..44b3941 100644
--- a/lisp/facemenu.el
+++ b/lisp/facemenu.el
@@ -1,6 +1,6 @@
 ;;; facemenu.el --- create a face menu for interactively adding fonts to text
 
-;; Copyright (C) 1994-1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <address@hidden>
 ;; Keywords: faces
diff --git a/lisp/faces.el b/lisp/faces.el
index a8c1546..ab6c384 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -1,6 +1,6 @@
 ;;; faces.el --- Lisp faces -*- lexical-binding: t -*-
 
-;; Copyright (C) 1992-1996, 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1996, 1998-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: internal
diff --git a/lisp/ffap.el b/lisp/ffap.el
index b51929d..36e37e9 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1,6 +1,6 @@
 ;;; ffap.el --- find file (or url) at point
 
-;; Copyright (C) 1995-1997, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1997, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Michelangelo Grigni <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/filecache.el b/lisp/filecache.el
index 9dd6310..fb099c1 100644
--- a/lisp/filecache.el
+++ b/lisp/filecache.el
@@ -1,6 +1,6 @@
 ;;; filecache.el --- find files using a pre-loaded cache  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1996, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author:  Peter Breton <address@hidden>
 ;; Created: Sun Nov 10 1996
diff --git a/lisp/multifile.el b/lisp/fileloop.el
similarity index 77%
rename from lisp/multifile.el
rename to lisp/fileloop.el
index 712da5c..2e77811 100644
--- a/lisp/multifile.el
+++ b/lisp/fileloop.el
@@ -1,6 +1,6 @@
-;;; multifile.el --- Operations on multiple files  -*- lexical-binding: t; -*-
+;;; fileloop.el --- Operations on multiple files  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2018  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 
@@ -24,11 +24,11 @@
 ;; version of etags.el.
 
 ;; TODO:
-;; - Maybe it would make sense to replace the multifile--* vars with a single
+;; - Maybe it would make sense to replace the fileloop--* vars with a single
 ;;   global var holding a struct, and then stash those structs into a history
-;;   of past operations, so you can perform a multifile-search while in the
-;;   middle of a multifile-replace and later go back to that
-;;   multifile-replace.
+;;   of past operations, so you can perform a fileloop-search while in the
+;;   middle of a fileloop-replace and later go back to that
+;;   fileloop-replace.
 ;; - Make multi-isearch work on top of this library (might require changes
 ;;   to this library, of course).
 
@@ -36,12 +36,12 @@
 
 (require 'generator)
 
-(defgroup multifile nil
+(defgroup fileloop nil
   "Operations on multiple files."
   :group 'tools)
 
-(defcustom multifile-revert-buffers 'silent
-  "Whether to revert files during multifile operation.
+(defcustom fileloop-revert-buffers 'silent
+  "Whether to revert files during fileloop operation.
   `silent' means to only do it if `revert-without-query' is applicable;
   t        means to offer to do it for all applicable files;
   nil      means never to do it"
@@ -49,17 +49,17 @@
 
 ;; FIXME: This already exists in GNU ELPA's iterator.el.  Maybe it should move
 ;; to generator.el?
-(iter-defun multifile--list-to-iterator (list)
+(iter-defun fileloop--list-to-iterator (list)
   (while list (iter-yield (pop list))))
 
-(defvar multifile--iterator iter-empty)
-(defvar multifile--scan-function
+(defvar fileloop--iterator iter-empty)
+(defvar fileloop--scan-function
   (lambda () (user-error "No operation in progress")))
-(defvar multifile--operate-function #'ignore)
-(defvar multifile--freshly-initialized nil)
+(defvar fileloop--operate-function #'ignore)
+(defvar fileloop--freshly-initialized nil)
 
 ;;;###autoload
-(defun multifile-initialize (files scan-function operate-function)
+(defun fileloop-initialize (files scan-function operate-function)
   "Initialize a new round of operation on several files.
 FILES can be either a list of file names, or an iterator (used with 
`iter-next')
 which returns a file name at each step.
@@ -69,18 +69,18 @@ OPERATE-FUNCTION is a function called with no argument; it 
is expected
 to perform the operation on the current file buffer and when done
 should return non-nil to mean that we should immediately continue
 operating on the next file and nil otherwise."
-  (setq multifile--iterator
+  (setq fileloop--iterator
         (if (and (listp files) (not (functionp files)))
-            (multifile--list-to-iterator files)
+            (fileloop--list-to-iterator files)
           files))
-  (setq multifile--scan-function scan-function)
-  (setq multifile--operate-function operate-function)
-  (setq multifile--freshly-initialized t))
+  (setq fileloop--scan-function scan-function)
+  (setq fileloop--operate-function operate-function)
+  (setq fileloop--freshly-initialized t))
 
-(defun multifile-next-file (&optional novisit)
+(defun fileloop-next-file (&optional novisit)
   ;; FIXME: Should we provide an interactive command, like tags-next-file?
   (let ((next (condition-case nil
-                  (iter-next multifile--iterator)
+                  (iter-next fileloop--iterator)
                 (iter-end-of-sequence nil))))
     (unless next
       (and novisit
@@ -91,9 +91,9 @@ operating on the next file and nil otherwise."
           (new (not buffer)))
       ;; Optionally offer to revert buffers
       ;; if the files have changed on disk.
-      (and buffer multifile-revert-buffers
+      (and buffer fileloop-revert-buffers
           (not (verify-visited-file-modtime buffer))
-           (if (eq multifile-revert-buffers 'silent)
+           (if (eq fileloop-revert-buffers 'silent)
                (and (not (buffer-modified-p buffer))
                     (let ((revertible nil))
                       (dolist (re revert-without-query)
@@ -118,7 +118,7 @@ operating on the next file and nil otherwise."
         (insert-file-contents new nil))
       new)))
 
-(defun multifile-continue ()
+(defun fileloop-continue ()
   "Continue last multi-file operation."
   (interactive)
   (let (new
@@ -131,10 +131,10 @@ operating on the next file and nil otherwise."
        (progn
          ;; Scan files quickly for the first or next interesting one.
          ;; This starts at point in the current buffer.
-         (while (or multifile--freshly-initialized file-finished
+         (while (or fileloop--freshly-initialized file-finished
                     (save-restriction
                       (widen)
-                      (not (funcall multifile--scan-function))))
+                      (not (funcall fileloop--scan-function))))
            ;; If nothing was found in the previous file, and
            ;; that file isn't in a temp buffer, restore point to
            ;; where it was.
@@ -142,17 +142,17 @@ operating on the next file and nil otherwise."
              (goto-char original-point))
 
            (setq file-finished nil)
-           (setq new (multifile-next-file t))
+           (setq new (fileloop-next-file t))
 
            ;; If NEW is non-nil, we got a temp buffer,
            ;; and NEW is the file name.
            (when (or messaged
-                     (and (not multifile--freshly-initialized)
+                     (and (not fileloop--freshly-initialized)
                           (> baud-rate search-slow-speed)
                           (setq messaged t)))
              (message "Scanning file %s..." (or new buffer-file-name)))
 
-           (setq multifile--freshly-initialized nil)
+           (setq fileloop--freshly-initialized nil)
            (setq original-point (if new nil (point)))
            (goto-char (point-min)))
 
@@ -172,13 +172,13 @@ operating on the next file and nil otherwise."
          ;; If value is non-nil, continue to scan the next file.
           (save-restriction
             (widen)
-            (funcall multifile--operate-function)))
+            (funcall fileloop--operate-function)))
       (setq file-finished t))))
 
 ;;;###autoload
-(defun multifile-initialize-search (regexp files case-fold)
+(defun fileloop-initialize-search (regexp files case-fold)
   (let ((last-buffer (current-buffer)))
-    (multifile-initialize
+    (fileloop-initialize
      files
      (lambda ()
        (let ((case-fold-search
@@ -191,16 +191,16 @@ operating on the next file and nil otherwise."
        nil))))
 
 ;;;###autoload
-(defun multifile-initialize-replace (from to files case-fold &optional 
delimited)
+(defun fileloop-initialize-replace (from to files case-fold &optional 
delimited)
   "Initialize a new round of query&replace on several files.
 FROM is a regexp and TO is the replacement to use.
-FILES describes the file, as in `multifile-initialize'.
+FILES describes the file, as in `fileloop-initialize'.
 CASE-FOLD can be t, nil, or `default', the latter one meaning to obey
 the default setting of `case-fold-search'.
 DELIMITED if non-nil means replace only word-delimited matches."
   ;; FIXME: Not sure how the delimited-flag interacts with the regexp-flag in
   ;; `perform-replace', so I just try to mimic the old code.
-  (multifile-initialize
+  (fileloop-initialize
    files
    (lambda ()
      (let ((case-fold-search
@@ -213,5 +213,5 @@ DELIMITED if non-nil means replace only word-delimited 
matches."
    (lambda ()
      (perform-replace from to t t delimited nil multi-query-replace-map))))
 
-(provide 'multifile)
-;;; multifile.el ends here
+(provide 'fileloop)
+;;; fileloop.el ends here
diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index 59a8c0e..3f9bb96 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -1,6 +1,6 @@
 ;;; filenotify.el --- watch files for changes on disk  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 
@@ -45,11 +45,11 @@ could use another implementation.")
                (:constructor nil)
                (:constructor
                 file-notify--watch-make (directory filename callback)))
-  ;; Watched directory
+  ;; Watched directory.
   directory
   ;; Watched relative filename, nil if watching the directory.
   filename
-  ;; Function to propagate events to
+  ;; Function to propagate events to.
   callback)
 
 (defun file-notify--watch-absolute-filename (watch)
@@ -114,7 +114,7 @@ Could be different from the directory watched by the 
backend library."
   (when-let* ((watch (gethash (car event) file-notify-descriptors)))
     (directory-file-name
      (expand-file-name
-      (or  (and (stringp (nth 2 event)) (nth 2 event)) "")
+      (or (and (stringp (nth 2 event)) (nth 2 event)) "")
       (file-notify--watch-directory watch)))))
 
 ;; Only `gfilenotify' could return two file names.
@@ -240,13 +240,14 @@ EVENT is the cadr of the event in 
`file-notify-handle-event'
                             (file-notify--watch-filename watch)
                             (file-name-nondirectory file1)))))
             ;;(message
-            ;;"file-notify-callback %S %S %S %S %S"
-            ;;desc action file file1 watch)
-            (if file1
-                (funcall (file-notify--watch-callback watch)
-                         `(,desc ,action ,file ,file1))
-              (funcall (file-notify--watch-callback watch)
-                       `(,desc  ,action ,file))))
+            ;;"file-notify-callback %S %S %S %S %S %S %S"
+            ;;desc action file file1 watch
+            ;;(file-notify--event-watched-file event)
+            ;;(file-notify--watch-directory watch))
+            (funcall (file-notify--watch-callback watch)
+                     (if file1
+                         `(,desc ,action ,file ,file1)
+                       `(,desc ,action ,file))))
 
           ;; Send `stopped' event.
           (when (or stopped
@@ -420,11 +421,9 @@ DESCRIPTOR should be an object returned by 
`file-notify-add-watch'."
               descriptor))
            t))))
 
-
 ;; TODO:
-;; * Watching a /dir/file may receive events for dir.
-;;   (This may be the desired behavior.)
-;; * Watching a file in an 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/files-x.el b/lisp/files-x.el
index 9af399c..b71e920 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -1,6 +1,6 @@
 ;;; files-x.el --- extended file handling commands
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Juri Linkov <address@hidden>
 ;; Maintainer: address@hidden
@@ -30,6 +30,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'subr-x)) ; for string-trim-right
+
 
 ;;; Commands to add/delete file-local/directory-local variables.
 
@@ -484,7 +486,7 @@ from the MODE alist ignoring the input argument VALUE."
                                 (if (memq variable '(mode eval))
                                     (cdr mode-assoc)
                                   (assq-delete-all variable (cdr 
mode-assoc))))))
-                       (assq-delete-all mode variables)))
+                       (assoc-delete-all mode variables)))
          (setq variables
                (cons `(,mode . ((,variable . ,value)))
                      variables))))
@@ -513,9 +515,11 @@ from the MODE alist ignoring the input argument VALUE."
                             (car mode-variables)
                             (format "(%s)" (mapconcat
                                             (lambda (variable-value)
-                                              (format "(%S . %S)"
+                                              (format "(%S . %s)"
                                                       (car variable-value)
-                                                      (cdr variable-value)))
+                                                      (string-trim-right
+                                                       (pp-to-string
+                                                        (cdr 
variable-value)))))
                                             (cdr mode-variables) "\n"))))
                   variables "\n")))
 
@@ -578,7 +582,7 @@ changed by the user.")
 (setq ignored-local-variables
       (cons 'connection-local-variables-alist ignored-local-variables))
 
-(defvar connection-local-profile-alist '()
+(defvar connection-local-profile-alist nil
   "Alist mapping connection profiles to variable lists.
 Each element in this list has the form (PROFILE VARIABLES).
 PROFILE is the name of a connection profile (a symbol).
@@ -586,7 +590,7 @@ VARIABLES is a list that declares connection-local 
variables for
 PROFILE.  An element in VARIABLES is an alist whose elements are
 of the form (VAR . VALUE).")
 
-(defvar connection-local-criteria-alist '()
+(defvar connection-local-criteria-alist nil
   "Alist mapping connection criteria to connection profiles.
 Each element in this list has the form (CRITERIA PROFILES).
 CRITERIA is a plist identifying a connection and the application
@@ -681,7 +685,12 @@ This does nothing if `enable-connection-local-variables' 
is nil."
       ;; Loop over variables.
       (dolist (variable (connection-local-get-profile-variables profile))
         (unless (assq (car variable) connection-local-variables-alist)
-          (push variable connection-local-variables-alist))))))
+          (push variable connection-local-variables-alist))))
+    ;; Push them to `file-local-variables-alist'.  Connection-local
+    ;; variables do not appear from external files.  So we can regard
+    ;; them as safe.
+    (let ((enable-local-variables :all))
+      (hack-local-variables-filter connection-local-variables-alist nil))))
 
 ;;;###autoload
 (defun hack-connection-local-variables-apply (criteria)
@@ -693,24 +702,35 @@ will not be changed."
         (copy-tree connection-local-variables-alist)))
    (hack-local-variables-apply)))
 
+(defsubst connection-local-criteria-for-default-directory ()
+  "Return a connection-local criteria, which represents `default-directory'."
+  (when (file-remote-p default-directory)
+    `(:application tramp
+       :protocol ,(file-remote-p default-directory 'method)
+       :user     ,(file-remote-p default-directory 'user)
+       :machine  ,(file-remote-p default-directory 'host))))
+
 ;;;###autoload
-(defmacro with-connection-local-profiles (profiles &rest body)
-  "Apply connection-local variables according to PROFILES in current buffer.
+(defmacro with-connection-local-variables (&rest body)
+  "Apply connection-local variables according to `default-directory'.
 Execute BODY, and unwind connection-local variables."
-  (declare (indent 1) (debug t))
-  `(let ((enable-connection-local-variables t)
-         (old-buffer-local-variables (buffer-local-variables))
-        connection-local-variables-alist connection-local-criteria-alist)
-     (apply 'connection-local-set-profiles nil ,profiles)
-     (hack-connection-local-variables-apply nil)
-     (unwind-protect
-         (progn ,@body)
-       ;; Cleanup.
-       (dolist (variable connection-local-variables-alist)
-        (let ((elt (assq (car variable) old-buffer-local-variables)))
-          (if elt
-              (set (make-local-variable (car elt)) (cdr elt))
-           (kill-local-variable (car variable))))))))
+  (declare (debug t))
+  `(if (file-remote-p default-directory)
+       (let ((enable-connection-local-variables t)
+             (old-buffer-local-variables (buffer-local-variables))
+            connection-local-variables-alist)
+        (hack-connection-local-variables-apply
+         (connection-local-criteria-for-default-directory))
+        (unwind-protect
+             (progn ,@body)
+          ;; Cleanup.
+          (dolist (variable connection-local-variables-alist)
+            (let ((elt (assq (car variable) old-buffer-local-variables)))
+              (if elt
+                  (set (make-local-variable (car elt)) (cdr elt))
+                (kill-local-variable (car variable)))))))
+     ;; No connection-local variables to apply.
+     ,@body))
 
 
 
diff --git a/lisp/files.el b/lisp/files.el
index ad03283..77a194b 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1,6 +1,6 @@
 ;;; files.el --- file input and output commands for Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985-1987, 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 1992-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Package: emacs
@@ -758,9 +758,10 @@ nil (meaning `default-directory') as the associated list 
element."
   ;; do end up using a superficially different directory.
   (setq dir (expand-file-name dir))
   (if (not (file-directory-p dir))
-      (if (file-exists-p dir)
-         (error "%s is not a directory" dir)
-       (error "%s: no such directory" dir))
+      (error (if (file-exists-p dir)
+                "%s is not a directory"
+               "%s: no such directory")
+             dir)
     (unless (file-accessible-directory-p dir)
       (error "Cannot cd to %s:  Permission denied" dir))
     (setq default-directory dir)
@@ -801,9 +802,15 @@ The path separator is colon in GNU and GNU-like systems."
     (setq cd-path (or (parse-colon-path (getenv "CDPATH"))
                       (list "./"))))
   (cd-absolute
-   (or (locate-file dir cd-path nil
-                    (lambda (f) (and (file-directory-p f) 'dir-ok)))
-       (error "No such directory found via CDPATH environment variable"))))
+   (or
+    ;; locate-file doesn't support remote file names, so detect them
+    ;; and support them here by hand.
+    (and (file-remote-p (expand-file-name dir))
+         (file-accessible-directory-p (expand-file-name dir))
+         (expand-file-name dir))
+    (locate-file dir cd-path nil
+                 (lambda (f) (and (file-directory-p f) 'dir-ok)))
+    (error "No such directory found via CDPATH environment variable"))))
 
 (defun directory-files-recursively (dir regexp &optional include-directories)
   "Return list of all files under DIR that have file names matching REGEXP.
@@ -862,7 +869,7 @@ This function will normally skip directories, so if you 
want it to find
 directories, make sure the PREDICATE function returns `dir-ok' for them.
 
 PREDICATE can also be an integer to pass to the `access' system call,
-in which case file-name handlers are ignored.  This usage is deprecated.
+in which case file name handlers are ignored.  This usage is deprecated.
 For compatibility, PREDICATE can also be one of the symbols
 `executable', `readable', `writable', or `exists', or a list of
 one or more of those symbols."
@@ -1002,7 +1009,7 @@ directory if it does not exist."
        ;; Make sure `user-emacs-directory' exists,
        ;; unless we're in batch mode or dumping Emacs.
        (or noninteractive
-          purify-flag
+           dump-mode
           (let (errtype)
             (if (file-directory-p user-emacs-directory)
                 (or (file-accessible-directory-p user-emacs-directory)
@@ -1157,7 +1164,7 @@ consecutive checks.  For example:
                  (file-attributes (file-chase-links file)))))))"
   :group 'files
   :version "24.1"
-  :type `(choice
+  :type '(choice
          (const   :tag "Do not inhibit file name cache" nil)
          (const   :tag "Do not use file name cache" t)
          (integer :tag "Do not use file name cache"
@@ -1166,7 +1173,10 @@ consecutive checks.  For example:
 
 (defun file-local-name (file)
   "Return the local name component of FILE.
-It returns a file name which can be used directly as argument of
+This function removes from FILE the specification of the remote host
+and the method of accessing the host, leaving only the part that
+identifies FILE locally on the remote system.
+The returned file name can be used directly as argument of
 `process-file', `start-file-process', or `shell-command'."
   (or (file-remote-p file 'localname) file))
 
@@ -1192,10 +1202,11 @@ names beginning with `~'."
   "Splice DIRNAME to FILE like the operating system would.
 If FILE is relative, return DIRNAME concatenated to FILE.
 Otherwise return FILE, quoted as needed if DIRNAME and FILE have
-different handlers; although this quoting is dubious if DIRNAME
-is magic, it is not clear what would be better.  This function
-differs from `expand-file-name' in that DIRNAME must be a
-directory name and leading `~' and `/:' are not special in FILE."
+different file name handlers; although this quoting is dubious if
+DIRNAME is magic, it is not clear what would be better.  This
+function differs from `expand-file-name' in that DIRNAME must be
+a directory name and leading `~' and `/:' are not special in
+FILE."
   (let ((unquoted (if (files--name-absolute-system-p file)
                      file
                    (concat dirname file))))
@@ -1895,7 +1906,7 @@ afterwards (so long as the home directory does not change;
 if you want to permanently change your home directory after having
 started Emacs, set `abbreviated-home-dir' to nil so it will be recalculated)."
   ;; Get rid of the prefixes added by the automounter.
-  (save-match-data
+  (save-match-data                      ;FIXME: Why?
     (if (and automount-dir-prefix
             (string-match automount-dir-prefix filename)
             (file-exists-p (file-name-directory
@@ -3456,6 +3467,8 @@ return as the symbol specifying the mode."
                 (let* ((key (intern (match-string 1)))
                        (val (save-restriction
                               (narrow-to-region (point) end)
+                               ;; As a defensive measure, we do not allow
+                               ;; circular data in the file-local data.
                               (let ((read-circle nil))
                                 (read (current-buffer)))))
                        ;; It is traditional to ignore
@@ -3577,6 +3590,11 @@ local variables, but directory-local variables may still 
be applied."
        result)
     (unless (eq handle-mode t)
       (setq file-local-variables-alist nil)
+      (when (file-remote-p default-directory)
+        (with-demoted-errors "Connection-local variables error: %s"
+         ;; Note this is a no-op if enable-local-variables is nil.
+         (hack-connection-local-variables
+           (connection-local-criteria-for-default-directory))))
       (with-demoted-errors "Directory-local variables error: %s"
        ;; Note this is a no-op if enable-local-variables is nil.
        (hack-dir-local-variables)))
@@ -3665,6 +3683,8 @@ local variables, but directory-local variables may still 
be applied."
                      ;; Read the variable value.
                      (skip-chars-forward "^:")
                      (forward-char 1)
+                      ;; As a defensive measure, we do not allow
+                      ;; circular data in the file-local data.
                      (let ((read-circle nil))
                        (setq val (read (current-buffer))))
                      (if (eq handle-mode t)
@@ -3832,13 +3852,13 @@ It is dangerous if either of these conditions are met:
 If VAR is `mode', call `VAL-mode' as a function unless it's
 already the major mode."
   (pcase var
-    (`mode
+    ('mode
      (let ((mode (intern (concat (downcase (symbol-name val))
                                  "-mode"))))
        (unless (eq (indirect-function mode)
                    (indirect-function major-mode))
          (funcall mode))))
-    (`eval
+    ('eval
      (pcase val
        (`(add-hook ',hook . ,_) (hack-one-local-variable--obsolete hook)))
      (save-excursion (eval val)))
@@ -4096,7 +4116,6 @@ apply).
 Return the new class name, which is a symbol named DIR."
   (let* ((class-name (intern dir))
          (files (dir-locals--all-files dir))
-         (read-circle nil)
         ;; If there was a problem, use the values we could get but
         ;; don't let the cache prevent future reads.
         (latest 0) (success 0)
@@ -4111,7 +4130,10 @@ Return the new class name, which is a symbol named DIR."
           (insert-file-contents file)
           (let ((newvars
                  (condition-case-unless-debug nil
-                     (read (current-buffer))
+                     ;; As a defensive measure, we do not allow
+                     ;; circular data in the file/dir-local data.
+                     (let ((read-circle nil))
+                       (read (current-buffer)))
                    (end-of-file nil))))
             (setq variables
                   ;; Try and avoid loading `map' since that also loads cl-lib
@@ -4324,12 +4346,15 @@ the old visited file has been renamed to the new name 
FILENAME."
   "Write current buffer into file FILENAME.
 This makes the buffer visit that file, and marks it as not modified.
 
-If you specify just a directory name as FILENAME, that means to use
-the default file name but in that directory.  You can also yank
-the default file name into the minibuffer to edit it, using 
\\<minibuffer-local-map>\\[next-history-element].
+Interactively, prompt for FILENAME.
+If you specify just a directory name as FILENAME, that means to write
+to a file in that directory.  In this case, the base name of the file
+is the same as that of the file visited in the buffer, or the buffer
+name sans leading directories, if any, if the buffer is not already
+visiting a file.
 
-If the buffer is not already visiting a file, the default file name
-for the output file is the buffer name.
+You can also yank the file name into the minibuffer to edit it,
+using \\<minibuffer-local-map>\\[next-history-element].
 
 If optional second arg CONFIRM is non-nil, this function
 asks for confirmation before overwriting an existing file.
@@ -6728,7 +6753,7 @@ Valid wildcards are '*', '?', '[abc]' and '[a-z]'."
 ;;              dired-after-subdir-garbage (defines what a "total" line is)
 ;;   - variable dired-subdir-regexp
 ;; - may be passed "--dired" as the first argument in SWITCHES.
-;;   Filename handlers might have to remove this switch if their
+;;   File name handlers might have to remove this switch if their
 ;;   "ls" command does not support it.
 (defun insert-directory (file switches &optional wildcard full-directory-p)
   "Insert directory listing for FILE, formatted according to SWITCHES.
@@ -7093,7 +7118,8 @@ only these files will be asked to be saved."
         (default-directory
          (if (memq operation
                     '(insert-directory process-file start-file-process
-                                       shell-command temporary-file-directory))
+                                       make-process shell-command
+                                       temporary-file-directory))
              (directory-file-name
               (expand-file-name
                (unhandled-file-name-directory default-directory)))
@@ -7141,7 +7167,13 @@ only these files will be asked to be saved."
                           ;; These file-notify-* operations take a
                           ;; descriptor.
                           (file-notify-rm-watch)
-                          (file-notify-valid-p)))
+                          (file-notify-valid-p)
+                          ;; `make-process' uses keyword arguments and
+                          ;; doesn't mangle its filenames in any way.
+                          ;; It already strips /: from the binary
+                          ;; filename, so we don't have to do this
+                          ;; here.
+                          (make-process)))
                  ;; For all other operations, treat the first
                  ;; argument only as the file name.
                  '(nil 0))))
@@ -7151,25 +7183,25 @@ only these files will be asked to be saved."
     (if (symbolp (car file-arg-indices))
        (setq method (pop file-arg-indices)))
     ;; Strip off the /: from the file names that have it.
-    (save-match-data
+    (save-match-data                    ;FIXME: Why?
       (while (consp file-arg-indices)
        (let ((pair (nthcdr (car file-arg-indices) arguments)))
          (when (car pair)
            (setcar pair (file-name-unquote (car pair) t))))
        (setq file-arg-indices (cdr file-arg-indices))))
     (pcase method
-      (`identity (car arguments))
-      (`add (file-name-quote (apply operation arguments) t))
-      (`buffer-file-name
+      ('identity (car arguments))
+      ('add (file-name-quote (apply operation arguments) t))
+      ('buffer-file-name
        (let ((buffer-file-name (file-name-unquote buffer-file-name t)))
          (apply operation arguments)))
-      (`insert-file-contents
+      ('insert-file-contents
        (let ((visit (nth 1 arguments)))
          (unwind-protect
              (apply operation arguments)
            (when (and visit buffer-file-name)
              (setq buffer-file-name (file-name-quote buffer-file-name t))))))
-      (`unquote-then-quote
+      ('unquote-then-quote
        ;; We can't use `cl-letf' with `(buffer-local-value)' here
        ;; because it wouldn't work during bootstrapping.
        (let ((buffer (current-buffer)))
@@ -7182,7 +7214,7 @@ only these files will be asked to be saved."
              ;; underlying operation.
              (with-current-buffer buffer
                (apply operation arguments))))))
-      (`local-copy
+      ('local-copy
        (let* ((file-name-handler-alist saved-file-name-handler-alist)
               (source (car arguments))
               (target (car (cdr arguments)))
@@ -7393,7 +7425,10 @@ Otherwise, trash FILENAME using the freedesktop.org 
conventions,
  like the GNOME, KDE and XFCE desktop environments.  Emacs only
  moves files to \"home trash\", ignoring per-volume trashcans."
   (interactive "fMove file to trash: ")
-  (cond (trash-directory
+  ;; If `system-move-file-to-trash' is defined, use it.
+  (cond ((fboundp 'system-move-file-to-trash)
+        (system-move-file-to-trash filename))
+        (trash-directory
         ;; If `trash-directory' is non-nil, move the file there.
         (let* ((trash-dir   (expand-file-name trash-directory))
                (fn          (directory-file-name (expand-file-name filename)))
@@ -7412,9 +7447,6 @@ Otherwise, trash FILENAME using the freedesktop.org 
conventions,
                 (setq new-fn (car (find-backup-file-name new-fn)))))
           (let (delete-by-moving-to-trash)
             (rename-file fn new-fn))))
-       ;; If `system-move-file-to-trash' is defined, use it.
-       ((fboundp 'system-move-file-to-trash)
-        (system-move-file-to-trash filename))
        ;; Otherwise, use the freedesktop.org method, as specified at
        ;; http://freedesktop.org/wiki/Specifications/trash-spec
        (t
diff --git a/lisp/filesets.el b/lisp/filesets.el
index 8ccfa57..b74b4a8 100644
--- a/lisp/filesets.el
+++ b/lisp/filesets.el
@@ -1,6 +1,6 @@
 ;;; filesets.el --- handle group of files
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Thomas Link <address@hidden>
 ;; Maintainer: address@hidden
@@ -565,7 +565,7 @@ including directory trees to the menu can take a lot of 
memory."
   :group 'filesets)
 
 (defcustom filesets-commands
-  `(("Isearch"
+  '(("Isearch"
      multi-isearch-files
      (filesets-cmd-isearch-getargs))
     ("Isearch (regexp)"
@@ -1286,10 +1286,10 @@ on-close-all ... Not used"
                  (filesets-get-external-viewer filename)))))
     (filesets-alist-get def
                        (pcase event
-                         (`on-open-all       ':ignore-on-open-all)
-                         (`on-grep           ':ignore-on-read-text)
-                         (`on-cmd nil)
-                         (`on-close-all nil))
+                         ('on-open-all       ':ignore-on-open-all)
+                         ('on-grep           ':ignore-on-read-text)
+                         ('on-cmd nil)
+                         ('on-close-all nil))
                        nil t)))
 
 (defun filesets-filetype-get-prop (property filename &optional entry)
diff --git a/lisp/find-cmd.el b/lisp/find-cmd.el
index 7a4e81e..66b850a 100644
--- a/lisp/find-cmd.el
+++ b/lisp/find-cmd.el
@@ -1,6 +1,6 @@
 ;;; find-cmd.el --- Build a valid find(1) command with sexps
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Philip Jackson <address@hidden>
 ;; Version: 0.6
diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index 9a798b0..ef137be 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -1,6 +1,6 @@
 ;;; find-dired.el --- run a `find' command and dired the output  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1992, 1994-1995, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1992, 1994-1995, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Roland McGrath <address@hidden>,
@@ -175,7 +175,7 @@ use in place of \"-ls\" as the final argument."
                          " " args " "
                          (shell-quote-argument ")")
                          " "))
-                      (if (string-match "\\`\\(.*\\) {} \\(\\\\;\\|+\\)\\'"
+                      (if (string-match "\\`\\(.*\\) {} \\(\\\\;\\|\\+\\)\\'"
                                         (car find-ls-option))
                           (format "%s %s %s"
                                   (match-string 1 (car find-ls-option))
diff --git a/lisp/find-file.el b/lisp/find-file.el
index bda6204..8731408 100644
--- a/lisp/find-file.el
+++ b/lisp/find-file.el
@@ -4,7 +4,7 @@
 ;; Maintainer: address@hidden
 ;; Keywords: c, matching, tools
 
-;; Copyright (C) 1994-1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/lisp/find-lisp.el b/lisp/find-lisp.el
index a3e4511..073e2bc 100644
--- a/lisp/find-lisp.el
+++ b/lisp/find-lisp.el
@@ -4,7 +4,7 @@
 ;; Created: Fri Mar 26 1999
 ;; Keywords: unix
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -342,16 +342,11 @@ list of ls option letters of which c and u are 
recognized).  Use
 the same method as \"ls\" to decide whether to show time-of-day or
 year, depending on distance between file date and NOW."
   (let* ((time (nth (find-lisp-time-index switches) file-attr))
-        (diff16 (- (car time) (car now)))
-        (diff (+ (ash diff16 16) (- (car (cdr time)) (car (cdr now)))))
-        (past-cutoff (- (* 6 30 24 60 60)))    ; 6 30-day months
+        (diff (encode-time (time-subtract time now) 'integer))
+        (past-cutoff -15778476)                ; 1/2 of a Gregorian year
         (future-cutoff (* 60 60)))             ; 1 hour
     (format-time-string
-     (if (and
-         (<= past-cutoff diff) (<= diff future-cutoff)
-         ;; Sanity check in case `diff' computation overflowed.
-         (<= (1- (ash past-cutoff -16)) diff16)
-         (<= diff16 (1+ (ash future-cutoff -16))))
+     (if (<= past-cutoff diff future-cutoff)
         "%b %e %H:%M"
        "%b %e  %Y")
      time)))
diff --git a/lisp/finder.el b/lisp/finder.el
index 7a642c7..54a0758 100644
--- a/lisp/finder.el
+++ b/lisp/finder.el
@@ -1,6 +1,6 @@
 ;;; finder.el --- topic & keyword-based code finder
 
-;; Copyright (C) 1992, 1997-1999, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1992, 1997-1999, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric S. Raymond <address@hidden>
diff --git a/lisp/flow-ctrl.el b/lisp/flow-ctrl.el
index 17ee283..e92b6b4 100644
--- a/lisp/flow-ctrl.el
+++ b/lisp/flow-ctrl.el
@@ -1,6 +1,6 @@
 ;;; flow-ctrl.el --- help for lusers on cu(1) or ttys with wired-in ^S/^Q flow 
control
 
-;; Copyright (C) 1990-1991, 1994, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1990-1991, 1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Kevin Gallagher
diff --git a/lisp/foldout.el b/lisp/foldout.el
index 34e3c6d..3ef88fe 100644
--- a/lisp/foldout.el
+++ b/lisp/foldout.el
@@ -1,6 +1,6 @@
 ;;; foldout.el --- folding extensions for outline-mode and outline-minor-mode
 
-;; Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Kevin Broadey <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/follow.el b/lisp/follow.el
index ed7b7d2..acc2b26 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -1,6 +1,6 @@
 ;;; follow.el --- synchronize windows showing the same buffer
 
-;; Copyright (C) 1995-1997, 1999, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1995-1997, 1999, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Anders Lindgren
diff --git a/lisp/font-core.el b/lisp/font-core.el
index c5b036e..6b26f0c 100644
--- a/lisp/font-core.el
+++ b/lisp/font-core.el
@@ -1,6 +1,6 @@
 ;;; font-core.el --- Core interface to font-lock
 
-;; Copyright (C) 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: languages, faces
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index be9fb4d..1475911 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1,6 +1,6 @@
-;;; font-lock.el --- Electric font lock mode
+;;; font-lock.el --- Electric font lock mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski
 ;;     Richard Stallman
@@ -656,7 +656,7 @@ be enabled."
       (cond (font-lock-fontified
             nil)
            ((or (null max-size) (> max-size (buffer-size)))
-            (font-lock-fontify-buffer))
+             (with-no-warnings (font-lock-fontify-buffer)))
            (font-lock-verbose
             (message "Fontifying %s...buffer size greater than 
font-lock-maximum-size"
                      (buffer-name)))))))
@@ -926,9 +926,9 @@ The value of this variable is used when Font Lock mode is 
turned on."
 
 (defun font-lock-turn-on-thing-lock ()
   (pcase (font-lock-value-in-major-mode font-lock-support-mode)
-    (`fast-lock-mode (fast-lock-mode t))
-    (`lazy-lock-mode (lazy-lock-mode t))
-    (`jit-lock-mode
+    ('fast-lock-mode (fast-lock-mode t))
+    ('lazy-lock-mode (lazy-lock-mode t))
+    ('jit-lock-mode
      ;; Prepare for jit-lock
      (remove-hook 'after-change-functions
                   #'font-lock-after-change-function t)
@@ -1093,14 +1093,10 @@ accessible portion of the current buffer."
                 (or beg (point-min)) (or end (point-max)))))
 
 (defvar font-lock-ensure-function
-  (lambda (_beg _end)
+  (lambda (beg end)
     (unless font-lock-fontified
-      (font-lock-default-fontify-buffer)
-      (unless font-lock-mode
-        ;; If font-lock is not enabled, we don't have the hooks in place to
-        ;; track modifications, so a subsequent call to font-lock-ensure can't
-        ;; assume that the fontification is still valid.
-        (setq font-lock-fontified nil))))
+      (save-excursion
+        (font-lock-fontify-region (or beg (point-min)) (or end (point-max))))))
   "Function to make sure a region has been fontified.
 Called with two arguments BEG and END.")
 
@@ -1784,7 +1780,7 @@ If SYNTACTIC-KEYWORDS is non-nil, it means these keywords 
are used for
          (cons t (cons keywords
                        (mapcar #'font-lock-compile-keyword keywords))))
     (if (and (not syntactic-keywords)
-            (let ((beg-function syntax-begin-function))
+            (let ((beg-function (with-no-warnings syntax-begin-function)))
               (or (eq beg-function #'beginning-of-defun)
                    (if (symbolp beg-function)
                        (get beg-function 'font-lock-syntax-paren-check))))
diff --git a/lisp/format-spec.el b/lisp/format-spec.el
index 38ce69b..4455c59 100644
--- a/lisp/format-spec.el
+++ b/lisp/format-spec.el
@@ -1,6 +1,6 @@
 ;;; format-spec.el --- functions for formatting arbitrary formatting strings
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: tools
diff --git a/lisp/format.el b/lisp/format.el
index 49d3c71..93f131b 100644
--- a/lisp/format.el
+++ b/lisp/format.el
@@ -1,6 +1,6 @@
 ;;; format.el --- read and save files in multiple formats
 
-;; Copyright (C) 1994-1995, 1997, 1999, 2001-2018 Free Software
+;; Copyright (C) 1994-1995, 1997, 1999, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Boris Goldowsky <address@hidden>
diff --git a/lisp/forms.el b/lisp/forms.el
index dba9b36..a85ee94 100644
--- a/lisp/forms.el
+++ b/lisp/forms.el
@@ -1,6 +1,6 @@
 ;;; forms.el --- Forms mode: edit a file as a form to fill in
 
-;; Copyright (C) 1991, 1994-1997, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1991, 1994-1997, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Johan Vromans <address@hidden>
diff --git a/lisp/frame.el b/lisp/frame.el
index 56b8c54..6cb1247 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -1,6 +1,6 @@
 ;;; frame.el --- multi-frame management independent of window systems  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1993-1994, 1996-1997, 2000-2018 Free Software
+;; Copyright (C) 1993-1994, 1996-1997, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -316,10 +316,15 @@ there (in decreasing order of priority)."
   ;; want to use save-excursion here, because that may also try to set
   ;; the buffer of the selected window, which fails when the selected
   ;; window is the minibuffer.
-  (let ((old-buffer (current-buffer))
-       (window-system-frame-alist
-         (cdr (assq initial-window-system
-                    window-system-default-frame-alist))))
+  (let* ((old-buffer (current-buffer))
+        (window-system-frame-alist
+          (cdr (assq initial-window-system
+                     window-system-default-frame-alist)))
+         (minibuffer
+          (cdr (or (assq 'minibuffer initial-frame-alist)
+                  (assq 'minibuffer window-system-frame-alist)
+                  (assq 'minibuffer default-frame-alist)
+                  '(minibuffer . t)))))
 
     (when (and frame-notice-user-settings
               (null frame-initial-frame))
@@ -410,11 +415,7 @@ there (in decreasing order of priority)."
       ;; default-frame-alist in the parameters of the screen we
       ;; create here, so that its new value, gleaned from the user's
       ;; init file, will be applied to the existing screen.
-      (if (not (eq (cdr (or (assq 'minibuffer initial-frame-alist)
-                           (assq 'minibuffer window-system-frame-alist)
-                           (assq 'minibuffer default-frame-alist)
-                           '(minibuffer . t)))
-                  t))
+      (if (not (eq minibuffer t))
          ;; Create the new frame.
          (let (parms new)
            ;; MS-Windows needs this to avoid inflooping below.
@@ -442,7 +443,15 @@ there (in decreasing order of priority)."
                                parms
                                nil))
 
-           ;; Get rid of `reverse', because that was handled
+           (when (eq minibuffer 'child-frame)
+              ;; When the minibuffer shall be shown in a child frame,
+              ;; remove the 'minibuffer' parameter from PARMS.  It
+              ;; will get assigned by the usual routines to the child
+              ;; frame's root window below.
+              (setq parms (cons '(minibuffer)
+                               (delq (assq 'minibuffer parms) parms))))
+
+            ;; Get rid of `reverse', because that was handled
            ;; when we first made the frame.
            (setq parms (cons '(reverse) (delq (assq 'reverse parms) parms)))
 
@@ -465,7 +474,18 @@ there (in decreasing order of priority)."
            ;; the only frame with a minibuffer.  If it is, create a
            ;; new one.
            (or (delq frame-initial-frame (minibuffer-frame-list))
-               (make-initial-minibuffer-frame nil))
+                (and (eq minibuffer 'child-frame)
+                     ;; Create a minibuffer child frame and parent it
+                     ;; immediately.  Take any other parameters for
+                     ;; the child frame from 'minibuffer-frame-list'.
+                     (let* ((minibuffer-frame-alist
+                             (cons `(parent-frame . ,new) 
minibuffer-frame-alist)))
+                       (make-initial-minibuffer-frame nil)
+                       ;; With a minibuffer child frame we do not want
+                       ;; to select the minibuffer frame initially as
+                       ;; we do for standard minibuffer-only frames.
+                       (select-frame new)))
+                (make-initial-minibuffer-frame nil))
 
            ;; If the initial frame is serving as a surrogate
            ;; minibuffer frame for any frames, we need to wean them
@@ -644,9 +664,39 @@ Return nil if we don't know how to interpret DISPLAY."
 (defun make-frame-on-display (display &optional parameters)
   "Make a frame on display DISPLAY.
 The optional argument PARAMETERS specifies additional frame parameters."
-  (interactive "sMake frame on display: ")
+  (interactive (list (completing-read
+                      (format "Make frame on display: ")
+                      (delete-dups
+                       (mapcar (lambda (frame)
+                                 (frame-parameter frame 'display))
+                               (frame-list))))))
   (make-frame (cons (cons 'display display) parameters)))
 
+(defun make-frame-on-monitor (monitor &optional display parameters)
+  "Make a frame on monitor MONITOR.
+The optional argument DISPLAY can be a display name, and the optional
+argument PARAMETERS specifies additional frame parameters."
+  (interactive
+   (list
+    (let* ((default (cdr (assq 'name (frame-monitor-attributes)))))
+      (completing-read
+       (format "Make frame on monitor (default %s): " default)
+       (or (delq nil (mapcar (lambda (a)
+                               (cdr (assq 'name a)))
+                             (display-monitor-attributes-list)))
+           '(""))
+       nil nil nil nil default))))
+  (let* ((monitor-workarea
+          (catch 'done
+            (dolist (a (display-monitor-attributes-list display))
+              (when (equal (cdr (assq 'name a)) monitor)
+                (throw 'done (cdr (assq 'workarea a)))))))
+         (geometry-parameters
+          (when monitor-workarea
+            `((top . ,(nth 1 monitor-workarea))
+              (left . ,(nth 0 monitor-workarea))))))
+    (make-frame (append geometry-parameters parameters))))
+
 (declare-function x-close-connection "xfns.c" (terminal))
 
 (defun close-display-connection (display)
@@ -682,7 +732,9 @@ If DISPLAY is nil, that stands for the selected frame's 
display."
 (defun make-frame-command ()
   "Make a new frame, on the same terminal as the selected frame.
 If the terminal is a text-only terminal, this also selects the
-new frame."
+new frame.
+
+When called from Lisp, returns the new frame."
   (interactive)
   (if (display-graphic-p)
       (make-frame)
@@ -761,7 +813,7 @@ the new frame according to its own rules."
              (t window-system)))
         (oldframe (selected-frame))
         (params parameters)
-        frame)
+        frame child-frame)
 
     (unless (get w 'window-system-initialized)
       (let ((window-system w))          ;Hack attack!
@@ -777,17 +829,44 @@ the new frame according to its own rules."
     (dolist (p default-frame-alist)
       (unless (assq (car p) params)
        (push p params)))
-    ;; Now make the frame.
-    (run-hooks 'before-make-frame-hook)
 
 ;;     (setq frame-size-history '(1000))
 
-    (setq frame (let ((window-system w)) ;Hack attack!
+    (when (eq (cdr (or (assq 'minibuffer params) '(minibuffer . t)))
+              'child-frame)
+      ;; If the 'minibuffer' parameter equals 'child-frame' make a
+      ;; frame without minibuffer first using the root window of
+      ;; 'default-minibuffer-frame' as its minibuffer window
+      (setq child-frame t)
+      (setq params (cons '(minibuffer)
+                         (delq (assq 'minibuffer params) params))))
+
+    ;; Now make the frame.
+    (run-hooks 'before-make-frame-hook)
+
+    (setq frame (let ((window-system w)) ; Hack attack!
                   (frame-creation-function params)))
+
+    (when child-frame
+      ;; When we want to equip the new frame with a minibuffer-only
+      ;; child frame, make that frame and reparent it immediately.
+      (setq child-frame
+            (make-frame
+             (append
+              `((display . ,display) (minibuffer . only)
+                (parent-frame . ,frame))
+              minibuffer-frame-alist)))
+      (when (frame-live-p child-frame)
+        ;; Have the 'minibuffer' parameter of our new frame refer to
+        ;; its child frame's root window.
+        (set-frame-parameter
+         frame 'minibuffer (frame-root-window child-frame))))
+
     (normal-erase-is-backspace-setup-frame frame)
-    ;; Inherit the original frame's parameters.
+    ;; Inherit original frame's parameters unless they are overridden
+    ;; by explicit parameters.
     (dolist (param frame-inherited-parameters)
-      (unless (assq param parameters)   ;Overridden by explicit parameters.
+      (unless (assq param parameters)
         (let ((val (frame-parameter oldframe param)))
           (when val (set-frame-parameter frame param val)))))
 
@@ -1038,7 +1117,7 @@ face specs for the new background mode."
           (default-bg-mode
             (if (or (window-system frame)
                     (and tty-type
-                         (string-match "^\\(xterm\\|\\rxvt\\|dtterm\\|eterm\\)"
+                         (string-match "^\\(xterm\\|rxvt\\|dtterm\\|eterm\\)"
                                        tty-type)))
                 'light
               'dark))
@@ -1085,9 +1164,23 @@ face specs for the new background mode."
            ;; most faces are unmodified).
            (dolist (face (face-list))
              (and (not (get face 'face-override-spec))
-                  (not (face-spec-match-p face
-                                          (face-user-default-spec face)
-                                          (selected-frame)))
+                  (not (and
+                         ;; If the face was not yet realized for the
+                         ;; frame, face-spec-match-p will signal an
+                         ;; error, so treat such a missing face as
+                         ;; having a mismatched spec; the call to
+                         ;; face-spec-recalc below will then realize
+                         ;; the face for the frame.  This happens
+                         ;; during startup with -rv on the command
+                         ;; line for the initial frame, because frames
+                         ;; are not recorded in the pdump file.
+                         (assq face (frame-face-alist))
+                         (face-spec-match-p face
+                                            (face-user-default-spec face)
+                                            ;; FIXME: why selected-frame and
+                                            ;; not the frame that is the
+                                            ;; argument to this function?
+                                            (selected-frame))))
                   (push face locally-modified-faces)))
            ;; Now change to the new frame parameters
            (modify-frame-parameters frame params)
@@ -1607,7 +1700,10 @@ keys and their meanings."
   (or frame (setq frame (selected-frame)))
   (cl-loop for attributes in (display-monitor-attributes-list frame)
           for frames = (cdr (assq 'frames attributes))
-          if (memq frame frames) return attributes))
+          if (memq frame frames) return attributes
+          ;; On broken frames monitor attributes,
+          ;; fall back to the last monitor.
+          finally return attributes))
 
 (defun frame-monitor-attribute (attribute &optional frame x y)
   "Return the value of ATTRIBUTE on FRAME's monitor.
@@ -1745,20 +1841,17 @@ for FRAME."
   (let* ((frame (window-normalize-frame frame))
          (root (frame-root-window frame))
          (mini (minibuffer-window frame))
-         (mini-height-before-size-change 0)
+         (mini-old-height 0)
          (mini-height 0))
     ;; FRAME's minibuffer window counts iff it's on FRAME and FRAME is
     ;; not a minibuffer-only frame.
     (when (and (eq (window-frame mini) frame) (not (eq mini root)))
-      (setq mini-height-before-size-change
-            (window-pixel-height-before-size-change mini))
+      (setq mini-old-height (window-old-pixel-height mini))
       (setq mini-height (window-pixel-height mini)))
     ;; Return non-nil when either the width of the root or the sum of
     ;; the heights of root and minibuffer window changed.
-    (or (/= (window-pixel-width-before-size-change root)
-            (window-pixel-width root))
-        (/= (+ (window-pixel-height-before-size-change root)
-               mini-height-before-size-change)
+    (or (/= (window-old-pixel-width root) (window-pixel-width root))
+        (/= (+ (window-old-pixel-height root) mini-old-height)
             (+ (window-pixel-height root) mini-height)))))
 
 ;;;; Frame/display capabilities.
diff --git a/lisp/frameset.el b/lisp/frameset.el
index 0d7e802..3bc7375 100644
--- a/lisp/frameset.el
+++ b/lisp/frameset.el
@@ -1,6 +1,6 @@
 ;;; frameset.el --- save and restore frame and window setup -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Juanma Barranquero <address@hidden>
 ;; Keywords: convenience
@@ -675,7 +675,7 @@ nil while the filtering is done to restore it."
       ;; of a frameset, so we must copy parameters to avoid inadvertent
       ;; modifications.
       (pcase (cdr (assq (car current) filter-alist))
-       (`nil
+       ('nil
         (push (if saving current (copy-tree current)) filtered))
        (:never
         nil)
@@ -903,7 +903,7 @@ NOTE: This only works for non-iconified frames."
                      (< fr-right  left) (> fr-right  right)
                      (< fr-top    top)  (> fr-top    bottom)))
            ;; Displaced to the left, right, above or below the screen.
-           (`t   (or (> fr-left   right)
+           ('t   (or (> fr-left   right)
                      (< fr-right  left)
                      (> fr-top    bottom)
                      (< fr-bottom top)))
@@ -1195,11 +1195,11 @@ All keyword parameters default to nil."
         ;; will decide which ones can be reused, and how to deal with any 
leftover.
         (frameset--reuse-list
          (pcase reuse-frames
-           (`t
+           ('t
             frames)
-           (`nil
+           ('nil
             nil)
-           (`match
+           ('match
             (cl-loop for (state) in (frameset-states frameset)
                      when (frameset-frame-with-id (frameset-cfg-id state) 
frames)
                      collect it))
@@ -1364,11 +1364,11 @@ Called from `jump-to-register'.  Internal use only."
                     ;; iconify frames
                     (lambda (frame action)
                       (pcase action
-                        (`rejected (iconify-frame frame))
+                        ('rejected (iconify-frame frame))
                         ;; In the unexpected case that a frame was a candidate
                         ;; (matching frame id) and yet not restored, remove it
                         ;; because it is in fact a duplicate.
-                        (`ignored (delete-frame frame))))))
+                        ('ignored (delete-frame frame))))))
 
   ;; Restore selected frame, buffer and point.
   (let ((frame (frameset-frame-with-id (aref data 1)))
diff --git a/lisp/fringe.el b/lisp/fringe.el
index 583a0e2..92387a2 100644
--- a/lisp/fringe.el
+++ b/lisp/fringe.el
@@ -1,6 +1,6 @@
 ;;; fringe.el --- fringe setup and control  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/generic-x.el b/lisp/generic-x.el
index d8a7fe3..c430be7 100644
--- a/lisp/generic-x.el
+++ b/lisp/generic-x.el
@@ -1,6 +1,6 @@
 ;;; generic-x.el --- A collection of generic modes
 
-;; Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author:  Peter Breton <address@hidden>
 ;; Created: Tue Oct 08 1996
@@ -294,7 +294,7 @@ your changes into effect."
   nil
   nil
   ;; Hostname ? user date request return-code number-of-bytes
-  '(("^\\([-a-zA-z0-9.]+\\) - [-A-Za-z]+ \\(\\[.*\\]\\)"
+  '(("^\\([-a-zA-Z0-9.]+\\) - [-A-Za-z]+ \\(\\[.*\\]\\)"
      (1 font-lock-constant-face)
      (2 font-lock-variable-name-face)))
   '("access_log\\'")
@@ -1490,7 +1490,8 @@ like an INI file.  You can add this hook to 
`find-file-hook'."
      '("^\\([^:]+\\):\\([^:]*\\):\\([0-9]+\\):\\(.*\\)$"
        (1 font-lock-type-face)
        (4 font-lock-variable-name-face))))
-  '("/etc/passwd\\'" "/etc/group\\'")
+  ;; /etc/passwd- is a backup file for /etc/passwd, so is group- and shadow-
+  '("/etc/passwd-?\\'" "/etc/group-?\\'" "/etc/shadow-?\\'")
   (list
    (function
     (lambda ()
diff --git a/lisp/gnus/ChangeLog.1 b/lisp/gnus/ChangeLog.1
index 30fd75f..333da55 100644
--- a/lisp/gnus/ChangeLog.1
+++ b/lisp/gnus/ChangeLog.1
@@ -3702,7 +3702,7 @@
        * gnus.el: Quassia Gnus v0.1 is released.
 
 
-  Copyright (C) 1997-2018 Free Software Foundation, Inc.
+  Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/gnus/ChangeLog.2 b/lisp/gnus/ChangeLog.2
index b49a866..bc507d5 100644
--- a/lisp/gnus/ChangeLog.2
+++ b/lisp/gnus/ChangeLog.2
@@ -18538,7 +18538,7 @@
 
 See ChangeLog.1 for earlier changes.
 
-  Copyright (C) 2000-2002, 2004-2018 Free Software Foundation, Inc.
+  Copyright (C) 2000-2002, 2004-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/gnus/ChangeLog.3 b/lisp/gnus/ChangeLog.3
index f98a6dc..3bd9f89 100644
--- a/lisp/gnus/ChangeLog.3
+++ b/lisp/gnus/ChangeLog.3
@@ -26325,7 +26325,7 @@
 
 See ChangeLog.2 for earlier changes.
 
-  Copyright (C) 2004-2018 Free Software Foundation, Inc.
+  Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/gnus/canlock.el b/lisp/gnus/canlock.el
index 0bd47cd..7edc91a 100644
--- a/lisp/gnus/canlock.el
+++ b/lisp/gnus/canlock.el
@@ -1,6 +1,6 @@
 ;;; canlock.el --- functions for Cancel-Lock feature
 
-;; Copyright (C) 1998-1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Katsumi Yamaoka <address@hidden>
 ;; Keywords: news, cancel-lock, hmac, sha1, rfc2104
diff --git a/lisp/gnus/deuglify.el b/lisp/gnus/deuglify.el
index 6286c53..2fdc34e 100644
--- a/lisp/gnus/deuglify.el
+++ b/lisp/gnus/deuglify.el
@@ -1,6 +1,6 @@
 ;;; deuglify.el --- deuglify broken Outlook (Express) articles
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Raymond Scholz <address@hidden>
 ;;         Thomas Steffen
diff --git a/lisp/gnus/gmm-utils.el b/lisp/gnus/gmm-utils.el
index 224299b..6e324f9 100644
--- a/lisp/gnus/gmm-utils.el
+++ b/lisp/gnus/gmm-utils.el
@@ -1,6 +1,6 @@
 ;;; gmm-utils.el --- Utility functions for Gnus, Message and MML
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Reiner Steib <address@hidden>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el
index 18e6174..879e1fe 100644
--- a/lisp/gnus/gnus-agent.el
+++ b/lisp/gnus/gnus-agent.el
@@ -1,6 +1,6 @@
 ;;; gnus-agent.el --- unplugged support for Gnus
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; This file is part of GNU Emacs.
@@ -225,7 +225,9 @@ NOTES:
 (defvar gnus-agent-overview-buffer nil)
 (defvar gnus-category-predicate-cache nil)
 (defvar gnus-category-group-cache nil)
-(defvar gnus-agent-spam-hashtb nil)
+(defvar gnus-agent-spam-hashtb nil
+  "Cache of message subjects for spam messages.
+Actually a hash table holding subjects mapped to t.")
 (defvar gnus-agent-file-name nil)
 (defvar gnus-agent-file-coding-system 'raw-text)
 (defvar gnus-agent-file-loading-cache nil)
@@ -642,8 +644,8 @@ minor mode in all Gnus buffers."
 (defun gnus-agent-queue-setup (&optional group-name)
   "Make sure the queue group exists.
 Optional arg GROUP-NAME allows another group to be specified."
-  (unless (gnus-gethash (format "nndraft:%s" (or group-name "queue"))
-                       gnus-newsrc-hashtb)
+  (unless (gethash (format "nndraft:%s" (or group-name "queue"))
+                  gnus-newsrc-hashtb)
     (gnus-request-create-group (or group-name "queue") '(nndraft ""))
     (let ((gnus-level-default-subscribed 1))
       (gnus-subscribe-group (format "nndraft:%s" (or group-name "queue"))
@@ -1330,11 +1332,11 @@ downloaded into the agent."
           (when (re-search-forward
                  (concat "^" (regexp-quote group) " ") nil t)
             (save-excursion
-              (setq oactive-max (read (current-buffer))        ;; max
+              (setq oactive-max (read (current-buffer))          ;; max
                     oactive-min (read (current-buffer)))) ;; min
             (gnus-delete-line)))
        (when active
-         (insert (format "%S %d %d y\n" (intern group)
+         (insert (format "%s %d %d y\n" group
                          (max (or oactive-max (cdr active)) (cdr active))
                          (min (or oactive-min (car active)) (car active))))
          (goto-char (point-max))
@@ -2161,7 +2163,10 @@ doesn't exist, to valid the overview buffer."
 
     (gnus-agent-update-view-total-fetched-for group nil)))
 
-(defvar gnus-agent-article-local nil)
+;; FIXME: Why would this be a hash table?  Wouldn't a simple alist or
+;; something suffice?
+(defvar gnus-agent-article-local nil
+  "Hashtable holding information about a group.")
 (defvar gnus-agent-article-local-times nil)
 (defvar gnus-agent-file-loading-local nil)
 
@@ -2173,12 +2178,12 @@ article counts for each of the method's subscribed 
groups."
              (zerop gnus-agent-article-local-times)
              (not (gnus-methods-equal-p
                    gnus-command-method
-                   (symbol-value (intern "+method" 
gnus-agent-article-local)))))
+                   (gethash "+method" gnus-agent-article-local))))
       (setq gnus-agent-article-local
            (gnus-cache-file-contents
             (gnus-agent-lib-file "local")
             'gnus-agent-file-loading-local
-            'gnus-agent-read-and-cache-local))
+            #'gnus-agent-read-and-cache-local))
       (when gnus-agent-article-local-times
        (cl-incf gnus-agent-article-local-times)))
     gnus-agent-article-local))
@@ -2188,14 +2193,15 @@ article counts for each of the method's subscribed 
groups."
 gnus-agent-article-local.  If that variable had `dirty' (also known as
 modified) original contents, they are first saved to their own file."
   (if (and gnus-agent-article-local
-           (symbol-value (intern "+dirty" gnus-agent-article-local)))
+           (gethash "+dirty" gnus-agent-article-local))
       (gnus-agent-save-local))
   (gnus-agent-read-local file))
 
 (defun gnus-agent-read-local (file)
   "Load FILE and do a `read' there."
-  (let ((my-obarray (gnus-make-hashtable (count-lines (point-min)
-                                                      (point-max))))
+  (let ((hashtb (gnus-make-hashtable
+                (count-lines (point-min)
+                             (point-max))))
         (line 1))
     (with-temp-buffer
       (condition-case nil
@@ -2204,7 +2210,8 @@ modified) original contents, they are first saved to 
their own file."
         (file-error))
 
       (goto-char (point-min))
-      ;; Skip any comments at the beginning of the file (the only place where 
they may appear)
+      ;; Skip any comments at the beginning of the file (the only
+      ;; place where they may appear)
       (while (= (following-char) ?\;)
         (forward-line 1)
         (setq line (1+ line)))
@@ -2214,33 +2221,32 @@ modified) original contents, they are first saved to 
their own file."
             (let (group
                   min
                   max
-                  (cur (current-buffer))
-                 (obarray my-obarray))
+                  (cur (current-buffer)))
               (setq group (read cur)
                     min (read cur)
                     max (read cur))
 
-              (when (stringp group)
-                (setq group (intern group my-obarray)))
+              (unless (stringp group)
+                (setq group (symbol-name group)))
 
               ;; NOTE: The '+ 0' ensure that min and max are both numerics.
-              (set group (cons (+ 0 min) (+ 0 max))))
+              (puthash group (cons (+ 0 min) (+ 0 max)) hashtb))
           (error
            (gnus-message 3 "Warning - invalid agent local: %s on line %d: %s"
                          file line (error-message-string err))))
         (forward-line 1)
         (setq line (1+ line))))
 
-    (set (intern "+dirty" my-obarray) nil)
-    (set (intern "+method" my-obarray) gnus-command-method)
-    my-obarray))
+    (puthash "+dirty" nil hashtb)
+    (puthash "+method" gnus-command-method hashtb)
+    hashtb))
 
 (defun gnus-agent-save-local (&optional force)
   "Save gnus-agent-article-local under it method's agent.lib directory."
-  (let ((my-obarray gnus-agent-article-local))
-    (when (and my-obarray
-               (or force (symbol-value (intern "+dirty" my-obarray))))
-      (let* ((gnus-command-method (symbol-value (intern "+method" my-obarray)))
+  (let ((hashtb gnus-agent-article-local))
+    (when (and hashtb
+               (or force (gethash "+dirty" hashtb)))
+      (let* ((gnus-command-method (gethash "+method" hashtb))
              ;; NOTE: gnus-command-method is used within gnus-agent-lib-file.
              (dest (gnus-agent-lib-file "local")))
         (gnus-make-directory (gnus-agent-lib-file ""))
@@ -2248,31 +2254,30 @@ modified) original contents, they are first saved to 
their own file."
        (let ((coding-system-for-write gnus-agent-file-coding-system)
              (file-name-coding-system nnmail-pathname-coding-system))
          (with-temp-file dest
-           (let ((gnus-command-method (symbol-value (intern "+method" 
my-obarray)))
+           ;; FIXME: Why are we letting this again?
+           (let ((gnus-command-method (gethash "+method" hashtb))
                  print-level print-length
                  (standard-output (current-buffer)))
-             (mapatoms (lambda (symbol)
-                         (cond ((not (boundp symbol))
-                                nil)
-                               ((member (symbol-name symbol) '("+dirty" 
"+method"))
-                                nil)
-                               (t
-                                (let ((range (symbol-value symbol)))
-                                  (when range
-                                    (prin1 symbol)
-                                    (princ " ")
-                                    (princ (car range))
-                                    (princ " ")
-                                    (princ (cdr range))
-                                    (princ "\n"))))))
-                       my-obarray))))))))
+             (maphash (lambda (group active)
+                        (cond ((null active)
+                               nil)
+                              ((member group '("+dirty" "+method"))
+                               nil)
+                              (t
+                               (when active
+                                 (prin1 group)
+                                 (princ " ")
+                                 (princ (car active))
+                                 (princ " ")
+                                 (princ (cdr active))
+                                 (princ "\n")))))
+                      hashtb))))))))
 
 (defun gnus-agent-get-local (group &optional gmane method)
   (let* ((gmane (or gmane (gnus-group-real-name group)))
          (gnus-command-method (or method (gnus-find-method-for-group group)))
          (local (gnus-agent-load-local))
-         (symb (intern gmane local))
-         (minmax (and (boundp symb) (symbol-value symb))))
+         (minmax (gethash gmane local)))
     (unless minmax
       ;; Bind these so that gnus-agent-load-alist doesn't change the
       ;; current alist (i.e. gnus-agent-article-alist)
@@ -2291,24 +2296,23 @@ modified) original contents, they are first saved to 
their own file."
   (let* ((gmane (or gmane (gnus-group-real-name group)))
          (gnus-command-method (or method (gnus-find-method-for-group group)))
          (local (or local (gnus-agent-load-local)))
-         (symb (intern gmane local))
-         (minmax (and (boundp symb) (symbol-value symb))))
+         (minmax (gethash gmane local)))
     (if (cond ((and minmax
                     (or (not (eq min (car minmax)))
                         (not (eq max (cdr minmax))))
                    min
                    max)
-               (setcar minmax min)
-               (setcdr minmax max)
+               (setcar (gethash gmane local) min)
+               (setcdr (gethash gmane local) max)
                t)
               (minmax
                nil)
               ((and min max)
-               (set symb (cons min max))
+               (puthash gmane (cons min max) local)
                t)
              (t
-              (unintern symb local)))
-        (set (intern "+dirty" local) t))))
+              (remhash gmane local)))
+        (puthash "+dirty" t local))))
 
 (defun gnus-agent-article-name (article group)
   (expand-file-name article
@@ -2575,9 +2579,6 @@ modified) original contents, they are first saved to 
their own file."
 ;;; Agent Category Mode
 ;;;
 
-(defvar gnus-category-mode-hook nil
-  "Hook run in `gnus-category-mode' buffers.")
-
 (defvar gnus-category-line-format "     %(%20c%): %g\n"
   "Format of category lines.
 
@@ -2603,17 +2604,16 @@ General format specifiers can also be used.  See Info 
node
 (defvar gnus-tmp-groups)
 
 (defvar gnus-category-line-format-alist
-  `((?c gnus-tmp-name ?s)
+  '((?c gnus-tmp-name ?s)
     (?g gnus-tmp-groups ?d)))
 
 (defvar gnus-category-mode-line-format-alist
-  `((?u user-defined ?s)))
+  '((?u user-defined ?s)))
 
 (defvar gnus-category-line-format-spec nil)
 (defvar gnus-category-mode-line-format-spec nil)
 
 (defvar gnus-category-mode-map nil)
-(put 'gnus-category-mode 'mode-class 'special)
 
 (unless gnus-category-mode-map
   (setq gnus-category-mode-map (make-sparse-keymap))
@@ -2655,9 +2655,8 @@ General format specifiers can also be used.  See Info node
 
     (gnus-run-hooks 'gnus-category-menu-hook)))
 
-(define-derived-mode gnus-category-mode fundamental-mode "Category"
+(define-derived-mode gnus-category-mode gnus-mode "Category"
   "Major mode for listing and editing agent categories.
-
 All normal editing commands are switched off.
 \\<gnus-category-mode-map>
 For more in-depth information on this mode, read the manual
@@ -2672,8 +2671,7 @@ The following commands are available:
   (gnus-set-default-directory)
   (setq mode-line-process nil)
   (buffer-disable-undo)
-  (setq truncate-lines t)
-  (setq buffer-read-only t))
+  (setq truncate-lines t))
 
 (defalias 'gnus-category-position-point 'gnus-goto-colon)
 
@@ -2884,8 +2882,8 @@ The following commands are available:
       nil
     (let ((string (gnus-simplify-subject (mail-header-subject gnus-headers))))
       (prog1
-         (gnus-gethash string gnus-agent-spam-hashtb)
-       (gnus-sethash string t gnus-agent-spam-hashtb)))))
+         (gethash string gnus-agent-spam-hashtb)
+       (puthash string t gnus-agent-spam-hashtb)))))
 
 (defun gnus-agent-short-p ()
   "Say whether an article is short or not."
@@ -3013,13 +3011,13 @@ articles."
   (unless gnus-category-group-cache
     (setq gnus-category-group-cache (gnus-make-hashtable 1000))
     (let ((cs gnus-category-alist)
-         groups cat)
-      (while (setq cat (pop cs))
+         groups)
+      (dolist (cat cs)
        (setq groups (gnus-agent-cat-groups cat))
-       (while groups
-         (gnus-sethash (pop groups) cat gnus-category-group-cache)))))
-  (or (gnus-gethash group gnus-category-group-cache)
-      (assq 'default gnus-category-alist)))
+       (dolist (g groups)
+         (puthash g cat gnus-category-group-cache)))))
+  (gethash group gnus-category-group-cache
+          (assq 'default gnus-category-alist)))
 
 (defvar gnus-agent-expire-current-dirs)
 (defvar gnus-agent-expire-stats)
@@ -3059,7 +3057,7 @@ FORCE is equivalent to setting the expiration predicates 
to true."
                                    (count-lines (point-min) (point-max))))))
                     (save-excursion
                       (gnus-agent-expire-group-1
-                       group overview (gnus-gethash-safe group orig)
+                       group overview (gethash group orig)
                        articles force))))
               (kill-buffer overview))))
       (gnus-message 4 "%s" (gnus-agent-expire-done-message)))))
@@ -3477,9 +3475,7 @@ articles in every agentized group? "))
                                    (count-lines (point-min) (point-max))))))
                     (dolist (expiring-group (gnus-groups-from-server
                                              gnus-command-method))
-                      (let* ((active
-                              (gnus-gethash-safe expiring-group orig)))
-
+                      (let ((active (gethash expiring-group orig)))
                         (when active
                           (save-excursion
                             (gnus-agent-expire-group-1
@@ -3509,83 +3505,80 @@ articles in every agentized group? "))
 (defun gnus-agent-expire-unagentized-dirs ()
   (when (and gnus-agent-expire-unagentized-dirs
              (boundp 'gnus-agent-expire-current-dirs))
-    (let* ((keep (gnus-make-hashtable))
-          (file-name-coding-system nnmail-pathname-coding-system))
-
-      (gnus-sethash gnus-agent-directory t keep)
+    (let ((file-name-coding-system nnmail-pathname-coding-system)
+         ;; Another hash table that could just be a list.
+         (keep (gnus-make-hashtable 20))
+         to-remove)
+      (puthash gnus-agent-directory t keep)
       (dolist (dir gnus-agent-expire-current-dirs)
        (when (and (stringp dir)
                   (file-directory-p dir))
-         (while (not (gnus-gethash dir keep))
-           (gnus-sethash dir t keep)
+         (while (not (gethash dir keep))
+           (puthash dir t keep)
            (setq dir (file-name-directory (directory-file-name dir))))))
 
-      (let* (to-remove
-             checker
-             (checker
-              (function
-               (lambda (d)
-                 "Given a directory, check it and its subdirectories for
-              membership in the keep hash.  If it isn't found, add
-              it to to-remove."
-                 (let ((files (directory-files d))
-                       file)
-                   (while (setq file (pop files))
-                     (cond ((equal file ".") ; Ignore self
-                            nil)
-                           ((equal file "..") ; Ignore parent
-                            nil)
-                           ((equal file ".overview")
-                            ;; Directory must contain .overview to be
-                            ;; agent's cache of a group.
-                            (let ((d (file-name-as-directory d))
-                                  r)
-                              ;; Search ancestor's for last directory NOT
-                              ;; found in keep hash.
-                              (while (not (gnus-gethash
-                                           (setq d (file-name-directory d)) 
keep))
-                                (setq r d
-                                      d (directory-file-name d)))
-                              ;; if ANY ancestor was NOT in keep hash and
-                              ;; it's not already in to-remove, add it to
-                              ;; to-remove.
-                              (if (and r
-                                       (not (member r to-remove)))
-                                  (push r to-remove))))
-                           ((file-directory-p (setq file (nnheader-concat d 
file)))
-                            (funcall checker file)))))))))
-        (funcall checker (expand-file-name gnus-agent-directory))
-
-        (when (and to-remove
-                   (or gnus-expert-user
-                       (gnus-y-or-n-p
-                        "gnus-agent-expire has identified local directories 
that are\
+      (cl-labels ((checker
+                  (d)
+                  ;; Given a directory, check it and its subdirectories
+                  ;; for membership in the keep list.  If it isn't found,
+                  ;; add it to to-remove.
+                  (let ((files (directory-files d))
+                        file)
+                    (while (setq file (pop files))
+                      (cond ((equal file ".") ; Ignore self
+                             nil)
+                            ((equal file "..") ; Ignore parent
+                             nil)
+                            ((equal file ".overview")
+                             ;; Directory must contain .overview to be
+                             ;; agent's cache of a group.
+                             (let ((d (file-name-as-directory d))
+                                   r)
+                               ;; Search ancestors for last directory NOT
+                               ;; found in keep.
+                               (while (not (gethash (setq d 
(file-name-directory d)) keep))
+                                 (setq r d
+                                       d (directory-file-name d)))
+                               ;; if ANY ancestor was NOT in keep hash and
+                               ;; it's not already in to-remove, add it to
+                               ;; to-remove.
+                               (if (and r
+                                        (not (member r to-remove)))
+                                   (push r to-remove))))
+                            ((file-directory-p (setq file (nnheader-concat d 
file)))
+                             (checker file)))))))
+        (checker (expand-file-name gnus-agent-directory)))
+
+      (when (and to-remove
+                 (or gnus-expert-user
+                     (gnus-y-or-n-p
+                      "gnus-agent-expire has identified local directories that 
are\
  not currently required by any agentized group.  Do you wish to consider\
  deleting them?")))
-          (while to-remove
-            (let ((dir (pop to-remove)))
-              (if (or gnus-expert-user
-                     (gnus-y-or-n-p (format "Delete %s? " dir)))
-                  (let* (delete-recursive
-                        files f
-                         (delete-recursive
-                          (function
-                           (lambda (f-or-d)
-                             (ignore-errors
-                               (if (file-directory-p f-or-d)
-                                   (condition-case nil
-                                       (delete-directory f-or-d)
-                                     (file-error
-                                     (setq files (directory-files f-or-d))
-                                     (while files
-                                       (setq f (pop files))
-                                       (or (member f '("." ".."))
-                                           (funcall delete-recursive
-                                                    (nnheader-concat
-                                                     f-or-d f))))
-                                      (delete-directory f-or-d)))
-                                 (delete-file f-or-d)))))))
-                    (funcall delete-recursive dir))))))))))
+        (while to-remove
+          (let ((dir (pop to-remove)))
+            (if (or gnus-expert-user
+                   (gnus-y-or-n-p (format "Delete %s? " dir)))
+                (let* (delete-recursive
+                      files f
+                       (delete-recursive
+                        (function
+                         (lambda (f-or-d)
+                           (ignore-errors
+                             (if (file-directory-p f-or-d)
+                                 (condition-case nil
+                                     (delete-directory f-or-d)
+                                   (file-error
+                                   (setq files (directory-files f-or-d))
+                                   (while files
+                                     (setq f (pop files))
+                                     (or (member f '("." ".."))
+                                         (funcall delete-recursive
+                                                  (nnheader-concat
+                                                   f-or-d f))))
+                                    (delete-directory f-or-d)))
+                               (delete-file f-or-d)))))))
+                  (funcall delete-recursive dir)))))))))
 
 ;;;###autoload
 (defun gnus-agent-batch ()
@@ -4103,8 +4096,8 @@ agent has fetched."
      ;; if null, gnus-agent-group-pathname will calc method.
      (let* ((gnus-command-method method)
            (path (or path (gnus-agent-group-pathname group)))
-           (entry (or (gnus-gethash path gnus-agent-total-fetched-hashtb)
-                      (gnus-sethash path (make-list 3 0)
+           (entry (or (gethash path gnus-agent-total-fetched-hashtb)
+                      (puthash path (make-list 3 0)
                                     gnus-agent-total-fetched-hashtb)))
            (file-name-coding-system nnmail-pathname-coding-system))
        (when (file-exists-p path)
@@ -4134,7 +4127,7 @@ agent has fetched."
         (cl-incf (nth 2 entry) delta))))))
 
 (defun gnus-agent-update-view-total-fetched-for
-  (group agent-over &optional method path)
+    (group agent-over &optional method path)
   "Update, or set, the total disk space used by the .agentview and
 .overview files.  These files are calculated separately as they can be
 modified."
@@ -4144,9 +4137,9 @@ modified."
      ;; if null, gnus-agent-group-pathname will calc method.
      (let* ((gnus-command-method method)
            (path (or path (gnus-agent-group-pathname group)))
-           (entry (or (gnus-gethash path gnus-agent-total-fetched-hashtb)
-                      (gnus-sethash path (make-list 3 0)
-                                    gnus-agent-total-fetched-hashtb)))
+           (entry (or (gethash path gnus-agent-total-fetched-hashtb)
+                      (puthash path (make-list 3 0)
+                               gnus-agent-total-fetched-hashtb)))
            (file-name-coding-system nnmail-pathname-coding-system)
            (size (or (file-attribute-size (file-attributes
                                            (nnheader-concat
@@ -4161,12 +4154,13 @@ modified."
   "Get the total disk space used by the specified GROUP."
   (unless (equal group "dummy.group")
     (unless gnus-agent-total-fetched-hashtb
-      (setq gnus-agent-total-fetched-hashtb (gnus-make-hashtable 1024)))
+      (setq gnus-agent-total-fetched-hashtb
+           (gnus-make-hashtable 1000)))
 
     ;; if null, gnus-agent-group-pathname will calc method.
     (let* ((gnus-command-method method)
           (path (gnus-agent-group-pathname group))
-          (entry (gnus-gethash path gnus-agent-total-fetched-hashtb)))
+          (entry (gethash path gnus-agent-total-fetched-hashtb)))
       (if entry
          (apply '+ entry)
        (let ((gnus-agent-inhibit-update-total-fetched-for (not no-inhibit)))
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index f28e6db..baa8a24 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -1,6 +1,6 @@
 ;;; gnus-art.el --- article mode commands for Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -278,7 +278,7 @@ This can also be a list of the above values."
   "String or function to be executed to display an X-Face header.
 If it is a string, the command will be executed in a sub-shell
 asynchronously.  The compressed face will be piped to this command."
-  :type `(choice string
+  :type '(choice string
                 (function-item gnus-display-x-face-in-from)
                 function)
   :version "21.1"
@@ -3540,18 +3540,11 @@ possible values."
          (concat "Date: " (message-make-date time)))
         ;; Convert to Universal Time.
         ((eq type 'ut)
-         (concat "Date: "
-                 (substring
-                  (message-make-date
-                   (let* ((e (parse-time-string date))
-                          (tm (apply 'encode-time e))
-                          (ms (car tm))
-                          (ls (- (cadr tm) (car (current-time-zone time)))))
-                     (cond ((< ls 0) (list (1- ms) (+ ls 65536)))
-                           ((> ls 65535) (list (1+ ms) (- ls 65536)))
-                           (t (list ms ls)))))
-                  0 -5)
-                 "UT"))
+         (let ((system-time-locale "C"))
+           (format-time-string
+            "Date: %a, %d %b %Y %T UT"
+            (encode-time (parse-time-string date))
+            t)))
         ;; Get the original date from the article.
         ((eq type 'original)
          (concat "Date: " (if (string-match "\n+$" date)
@@ -3569,13 +3562,7 @@ possible values."
              (concat "Date: " (format-time-string format time)))))
         ;; ISO 8601.
         ((eq type 'iso8601)
-         (let ((tz (car (current-time-zone time))))
-           (concat
-            "Date: "
-            (format-time-string "%Y%m%dT%H%M%S" time)
-            (format "%s%02d%02d"
-                    (if (> tz 0) "+" "-") (/ (abs tz) 3600)
-                    (/ (% (abs tz) 3600) 60)))))
+         (format-time-string "Date: %Y%m%dT%H%M%S%z" time))
         ;; Do a lapsed format.
         ((eq type 'lapsed)
          (concat "Date: " (article-lapsed-string time)))
@@ -3623,18 +3610,14 @@ possible values."
 (defun article-lapsed-string (time &optional max-segments)
   ;; If the date is seriously mangled, the timezone functions are
   ;; liable to bug out, so we ignore all errors.
-  (let* ((real-time (time-subtract nil time))
-        (real-sec (and real-time
-                       (+ (* (float (car real-time)) 65536)
-                          (cadr real-time))))
-        (sec (and real-time (abs real-sec)))
+  (let* ((real-time (time-since time))
+        (real-sec (float-time real-time))
+        (sec (abs real-sec))
         (segments 0)
         num prev)
     (unless max-segments
       (setq max-segments (length article-time-units)))
     (cond
-     ((null real-time)
-      "Unknown")
      ((zerop sec)
       "Now")
      (t
@@ -4388,8 +4371,6 @@ If variable `gnus-use-long-file-name' is non-nil, it is
 ;;; Gnus article mode
 ;;;
 
-(put 'gnus-article-mode 'mode-class 'special)
-
 (set-keymap-parent gnus-article-mode-map widget-keymap)
 
 (gnus-define-keys gnus-article-mode-map
@@ -4467,9 +4448,8 @@ If variable `gnus-use-long-file-name' is non-nil, it is
 (defvar bookmark-make-record-function)
 (defvar shr-put-image-function)
 
-(define-derived-mode gnus-article-mode fundamental-mode "Article"
+(define-derived-mode gnus-article-mode gnus-mode "Article"
   "Major mode for displaying an article.
-
 All normal editing commands are switched off.
 
 The following commands are available in addition to all summary mode
@@ -4510,8 +4490,7 @@ commands:
     (setq cursor-in-non-selected-windows nil))
   (gnus-set-default-directory)
   (buffer-disable-undo)
-  (setq buffer-read-only t
-       show-trailing-whitespace nil)
+  (setq show-trailing-whitespace nil)
   (mm-enable-multibyte))
 
 (defun gnus-article-setup-buffer ()
@@ -5159,7 +5138,7 @@ Deleting parts may malfunction or destroy the article; 
continue? "))
            "`----\n"))
          (setcdr data
                  (cdr (mm-make-handle
-                       nil `("text/plain" (charset . gnus-decoded)) nil nil
+                       nil '("text/plain" (charset . gnus-decoded)) nil nil
                        (list "attachment")
                        (format "Deleted attachment (%s bytes)" bsize))))))
       ;; (set-buffer gnus-summary-buffer)
@@ -7397,9 +7376,8 @@ groups."
   :group 'gnus-article-buttons
   :type 'regexp)
 
-;; Regexp suggested by Felix Wiemann in <address@hidden>
 (defcustom gnus-button-valid-localpart-regexp
-  "[a-z0-9$%(*-=?[_][^<>\")!;:,{}\n\t @]*"
+  "[-a-z0-9$%(*+./=?[_][^<>\")!;:,{}\n\t @]*"
   "Regular expression that matches a localpart of mail addresses or MIDs."
   :version "22.1"
   :group 'gnus-article-buttons
@@ -7495,7 +7473,7 @@ must return `mid', `mail', `invalid' or `ask'."
     (2.0   . "^[A-Z][a-z][A-Z][a-z][a-z][^a-z]")) ;; ^[A-Z][a-z]{4,4}
   "An alist of (RATE . REGEXP) pairs for `gnus-button-mid-or-mail-heuristic'.
 
-A negative RATE indicates a message IDs, whereas a positive indicates a mail
+A negative RATE indicates a message ID, whereas a positive indicates a mail
 address.  The REGEXP is processed with `case-fold-search' set to nil."
   :version "22.1"
   :group 'gnus-article-buttons
@@ -7504,7 +7482,7 @@ address.  The REGEXP is processed with `case-fold-search' 
set to nil."
 
 (defun gnus-button-mid-or-mail-heuristic (mid-or-mail)
   "Guess whether MID-OR-MAIL is a message ID or a mail address.
-Returns `mid' if MID-OR-MAIL is a message IDs, `mail' if it's a mail
+Returns `mid' if MID-OR-MAIL is a message ID, `mail' if it's a mail
 address, `ask' if unsure and `invalid' if the string is invalid."
   (let ((case-fold-search nil)
        (list gnus-button-mid-or-mail-heuristic-alist)
diff --git a/lisp/gnus/gnus-async.el b/lisp/gnus/gnus-async.el
index ad25f80..4e2723e 100644
--- a/lisp/gnus/gnus-async.el
+++ b/lisp/gnus/gnus-async.el
@@ -1,6 +1,6 @@
 ;;; gnus-async.el --- asynchronous support for Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -84,7 +84,6 @@ that was fetched."
 (defvar gnus-async-article-alist nil)
 (defvar gnus-async-article-semaphore '(nil))
 (defvar gnus-async-fetch-list nil)
-(defvar gnus-async-hashtb nil)
 (defvar gnus-async-current-prefetch-group nil)
 (defvar gnus-async-current-prefetch-article nil)
 (defvar gnus-async-timer nil)
@@ -127,14 +126,11 @@ that was fetched."
 (defun gnus-async-close ()
   (gnus-kill-buffer gnus-async-prefetch-article-buffer)
   (gnus-kill-buffer gnus-async-prefetch-headers-buffer)
-  (setq gnus-async-hashtb nil
-       gnus-async-article-alist nil
+  (setq gnus-async-article-alist nil
        gnus-async-header-prefetched nil))
 
 (defun gnus-async-set-buffer ()
-  (nnheader-set-temp-buffer gnus-async-prefetch-article-buffer t)
-  (unless gnus-async-hashtb
-    (setq gnus-async-hashtb (gnus-make-hashtable 1023))))
+  (nnheader-set-temp-buffer gnus-async-prefetch-article-buffer t))
 
 (defun gnus-async-halt-prefetch ()
   "Stop prefetching."
@@ -242,13 +238,10 @@ that was fetched."
          (when gnus-async-post-fetch-function
            (funcall gnus-async-post-fetch-function summary))))
       (gnus-async-with-semaphore
-       (setq
-        gnus-async-article-alist
-        (cons (list (intern (format "%s-%d" group article)
-                            gnus-async-hashtb)
-                    mark (point-max-marker)
-                    group article)
-              gnus-async-article-alist))))
+       (push (list (format "%s-%d" group article)
+                   mark (point-max-marker)
+                   group article)
+             gnus-async-article-alist)))
     (if (not (gnus-buffer-live-p summary))
        (gnus-async-with-semaphore
          (setq gnus-async-fetch-list nil))
@@ -314,8 +307,7 @@ that was fetched."
     (set-marker (caddr entry) nil))
   (gnus-async-with-semaphore
     (setq gnus-async-article-alist
-         (delq entry gnus-async-article-alist))
-    (unintern (car entry) gnus-async-hashtb)))
+         (delete entry gnus-async-article-alist))))
 
 (defun gnus-async-prefetch-remove-group (group)
   "Remove all articles belonging to GROUP from the prefetch buffer."
@@ -331,9 +323,8 @@ that was fetched."
   "Return the entry for ARTICLE in GROUP if it has been prefetched."
   (let ((entry (save-excursion
                 (gnus-async-set-buffer)
-                (assq (intern-soft (format "%s-%d" group article)
-                                   gnus-async-hashtb)
-                      gnus-async-article-alist))))
+                (assoc (format "%s-%d" group article)
+                       gnus-async-article-alist))))
     ;; Perhaps something has emptied the buffer?
     (if (and entry
             (= (cadr entry) (caddr entry)))
@@ -342,7 +333,7 @@ that was fetched."
            (set-marker (cadr entry) nil)
            (set-marker (caddr entry) nil))
          (setq gnus-async-article-alist
-               (delq entry gnus-async-article-alist))
+               (delete entry gnus-async-article-alist))
          nil)
       entry)))
 
diff --git a/lisp/gnus/gnus-bcklg.el b/lisp/gnus/gnus-bcklg.el
index 95cb1ca..c5a0e3e 100644
--- a/lisp/gnus/gnus-bcklg.el
+++ b/lisp/gnus/gnus-bcklg.el
@@ -1,6 +1,6 @@
 ;;; gnus-bcklg.el --- backlog functions for Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -22,17 +22,16 @@
 
 ;;; Commentary:
 
+;; The backlog caches the text of a certain number of read articles in
+;; a separate buffer, so they can be retrieved quickly if the user
+;; opens them again.  Also see `gnus-keep-backlog'.
+
 ;;; Code:
 
 (require 'gnus)
 
-;;;
-;;; Buffering of read articles.
-;;;
-
 (defvar gnus-backlog-buffer " *Gnus Backlog*")
-(defvar gnus-backlog-articles nil)
-(defvar gnus-backlog-hashtb nil)
+(defvar gnus-backlog-articles '())
 
 (defun gnus-backlog-buffer ()
   "Return the backlog buffer."
@@ -42,11 +41,6 @@
        (setq buffer-read-only t)
        (get-buffer gnus-backlog-buffer))))
 
-(defun gnus-backlog-setup ()
-  "Initialize backlog variables."
-  (unless gnus-backlog-hashtb
-    (setq gnus-backlog-hashtb (gnus-make-hashtable 1024))))
-
 (gnus-add-shutdown 'gnus-backlog-shutdown 'gnus)
 
 (defun gnus-backlog-shutdown ()
@@ -54,46 +48,42 @@
   (interactive)
   (when (get-buffer gnus-backlog-buffer)
     (gnus-kill-buffer gnus-backlog-buffer))
-  (setq gnus-backlog-hashtb nil
-       gnus-backlog-articles nil))
+  (setq gnus-backlog-articles nil))
 
 (defun gnus-backlog-enter-article (group number buffer)
   (when (and (numberp number)
             (not (gnus-virtual-group-p group)))
-    (gnus-backlog-setup)
-    (let ((ident (intern (concat group ":" (int-to-string number))
-                        gnus-backlog-hashtb))
+    (let ((ident (format "%s:%d" group number))
          b)
-      (if (memq ident gnus-backlog-articles)
-         ()                            ; It's already kept.
-      ;; Remove the oldest article, if necessary.
-       (and (numberp gnus-keep-backlog)
-            (>= (length gnus-backlog-articles) gnus-keep-backlog)
-          (gnus-backlog-remove-oldest-article))
-       (push ident gnus-backlog-articles)
-       ;; Insert the new article.
-       (with-current-buffer (gnus-backlog-buffer)
-         (let (buffer-read-only)
-           (goto-char (point-max))
-           (unless (bolp)
-             (insert "\n"))
-           (setq b (point))
-           (insert-buffer-substring buffer)
-           ;; Tag the beginning of the article with the ident.
-           (if (> (point-max) b)
-             (put-text-property b (1+ b) 'gnus-backlog ident)
-             (gnus-error 3 "Article %d is blank" number))))))))
+     (unless (member ident gnus-backlog-articles) ; It's already kept.
+       ;; Remove the oldest article, if necessary.
+       (and (numberp gnus-keep-backlog)
+           (>= (length gnus-backlog-articles) gnus-keep-backlog)
+           (gnus-backlog-remove-oldest-article))
+       (push ident gnus-backlog-articles)
+       ;; Insert the new article.
+       (with-current-buffer (gnus-backlog-buffer)
+        (let (buffer-read-only)
+          (goto-char (point-max))
+          (unless (bolp)
+            (insert "\n"))
+          (setq b (point))
+          (insert-buffer-substring buffer)
+          ;; Tag the beginning of the article with the ident.
+          (if (> (point-max) b)
+              (put-text-property b (1+ b) 'gnus-backlog ident)
+            (gnus-error 3 "Article %d is blank" number))))))))
 
 (defun gnus-backlog-remove-oldest-article ()
   (with-current-buffer (gnus-backlog-buffer)
     (goto-char (point-min))
-    (if (zerop (buffer-size))
-       ()                              ; The buffer is empty.
+    (unless (zerop (buffer-size)) ; The buffer is empty.
       (let ((ident (get-text-property (point) 'gnus-backlog))
            buffer-read-only)
        ;; Remove the ident from the list of articles.
        (when ident
-         (setq gnus-backlog-articles (delq ident gnus-backlog-articles)))
+         (setq gnus-backlog-articles
+               (delete ident gnus-backlog-articles)))
        ;; Delete the article itself.
        (delete-region
         (point) (next-single-property-change
@@ -102,42 +92,40 @@
 (defun gnus-backlog-remove-article (group number)
   "Remove article NUMBER in GROUP from the backlog."
   (when (numberp number)
-    (gnus-backlog-setup)
-    (let ((ident (intern (concat group ":" (int-to-string number))
-                        gnus-backlog-hashtb))
-         beg end)
-      (when (memq ident gnus-backlog-articles)
+    (let ((ident (format "%s:%d" group number))
+         beg)
+      (when (member ident gnus-backlog-articles)
        ;; It was in the backlog.
        (with-current-buffer (gnus-backlog-buffer)
-         (let (buffer-read-only)
-           (when (setq beg (text-property-any
-                            (point-min) (point-max) 'gnus-backlog
-                            ident))
-             ;; Find the end (i. e., the beginning of the next article).
-             (setq end
-                   (next-single-property-change
-                    (1+ beg) 'gnus-backlog (current-buffer) (point-max)))
-             (delete-region beg end)
-             ;; Return success.
-             t))
-         (setq gnus-backlog-articles (delq ident gnus-backlog-articles)))))))
+         (save-excursion
+           (let (buffer-read-only)
+             (goto-char (point-min))
+             (when (setq beg (gnus-text-property-search
+                              'gnus-backlog ident))
+               ;; Find the end (i. e., the beginning of the next article).
+               (goto-char
+                (next-single-property-change
+                 (1+ beg) 'gnus-backlog (current-buffer) (point-max)))
+               (delete-region beg (point))
+               ;; Return success.
+               t)))
+         (setq gnus-backlog-articles
+               (delete ident gnus-backlog-articles)))))))
 
 (defun gnus-backlog-request-article (group number &optional buffer)
   (when (and (numberp number)
             (not (gnus-virtual-group-p group)))
-    (gnus-backlog-setup)
-    (let ((ident (intern (concat group ":" (int-to-string number))
-                        gnus-backlog-hashtb))
+    (let ((ident (format "%s:%d" group number))
          beg end)
-      (when (memq ident gnus-backlog-articles)
+      (when (member ident gnus-backlog-articles)
        ;; It was in the backlog.
        (with-current-buffer (gnus-backlog-buffer)
-         (if (not (setq beg (text-property-any
-                             (point-min) (point-max) 'gnus-backlog
-                             ident)))
+         (if (not (setq beg (gnus-text-property-search
+                             'gnus-backlog ident)))
              ;; It wasn't in the backlog after all.
              (ignore
-              (setq gnus-backlog-articles (delq ident gnus-backlog-articles)))
+              (setq gnus-backlog-articles
+                    (delete ident gnus-backlog-articles)))
            ;; Find the end (i. e., the beginning of the next article).
            (setq end
                  (next-single-property-change
diff --git a/lisp/gnus/gnus-bookmark.el b/lisp/gnus/gnus-bookmark.el
index 0d718e2..cc0a52f 100644
--- a/lisp/gnus/gnus-bookmark.el
+++ b/lisp/gnus/gnus-bookmark.el
@@ -1,6 +1,6 @@
 ;;; gnus-bookmark.el --- Bookmarks in Gnus
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Bastien Guerry <bzg AT altern DOT org>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el
index a16b61a..5e6483d 100644
--- a/lisp/gnus/gnus-cache.el
+++ b/lisp/gnus/gnus-cache.el
@@ -1,6 +1,6 @@
 ;;; gnus-cache.el --- cache interface for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -272,7 +272,7 @@ it's not cached."
 (defun gnus-cache-possibly-alter-active (group active)
   "Alter the ACTIVE info for GROUP to reflect the articles in the cache."
   (when gnus-cache-active-hashtb
-    (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb)))
+    (let ((cache-active (gethash group gnus-cache-active-hashtb)))
       (when cache-active
        (when (< (car cache-active) (car active))
          (setcar active (car cache-active)))
@@ -522,7 +522,7 @@ system for example was used.")
            (gnus-delete-line)))
       (unless (setq gnus-newsgroup-cached
                    (delq article gnus-newsgroup-cached))
-       (gnus-sethash gnus-newsgroup-name nil gnus-cache-active-hashtb)
+       (remhash gnus-newsgroup-name gnus-cache-active-hashtb)
        (setq gnus-cache-active-altered t))
       (gnus-summary-update-secondary-mark article)
       t)))
@@ -542,8 +542,8 @@ system for example was used.")
          (progn
            (gnus-cache-update-active group (car articles) t)
            (gnus-cache-update-active group (car (last articles))))
-       (when (gnus-gethash group gnus-cache-active-hashtb)
-         (gnus-sethash group nil gnus-cache-active-hashtb)
+       (when (gethash group gnus-cache-active-hashtb)
+         (remhash group gnus-cache-active-hashtb)
          (setq gnus-cache-active-altered t)))
       articles)))
 
@@ -666,13 +666,16 @@ $ emacs -batch -l ~/.emacs -l gnus -f gnus-jog-cache"
     ;; Mark the active hashtb as unaltered.
     (setq gnus-cache-active-altered nil)))
 
+;; FIXME: Why is there a `gnus-cache-possibly-alter-active',
+;; `gnus-cache-possibly-update-active', and
+;; `gnus-cache-update-active'?  Do we really need all three?
 (defun gnus-cache-possibly-update-active (group active)
   "Update active info bounds of GROUP with ACTIVE if necessary.
 The update is performed if ACTIVE contains a higher or lower bound
 than the current."
   (let ((lower t) (higher t))
     (if gnus-cache-active-hashtb
-       (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb)))
+       (let ((cache-active (gethash group gnus-cache-active-hashtb)))
          (when cache-active
            (unless (< (car active) (car cache-active))
              (setq lower nil))
@@ -687,10 +690,10 @@ than the current."
 (defun gnus-cache-update-active (group number &optional low)
   "Update the upper bound of the active info of GROUP to NUMBER.
 If LOW, update the lower bound instead."
-  (let ((active (gnus-gethash group gnus-cache-active-hashtb)))
+  (let ((active (gethash group gnus-cache-active-hashtb)))
     (if (null active)
        ;; We just create a new active entry for this group.
-       (gnus-sethash group (cons number number) gnus-cache-active-hashtb)
+       (puthash group (cons number number) gnus-cache-active-hashtb)
       ;; Update the lower or upper bound.
       (if low
          (setcar active number)
@@ -734,10 +737,10 @@ If LOW, update the lower bound instead."
       ;; FIXME: this is kind of a workaround.  The active file should
       ;; be updated at the time articles are cached.  It will make
       ;; `gnus-cache-unified-group-names' needless.
-      (gnus-sethash (or (cdr (assoc group gnus-cache-unified-group-names))
-                       group)
-                   (cons (car nums) (car (last nums)))
-                   gnus-cache-active-hashtb))
+      (puthash (or (cdr (assoc group gnus-cache-unified-group-names))
+                  group)
+              (cons (car nums) (car (last nums)))
+              gnus-cache-active-hashtb))
     ;; Go through all the other files.
     (dolist (file alphs)
       (when (and (file-directory-p file)
@@ -798,13 +801,13 @@ supported."
     (unless gnus-cache-active-hashtb
       (gnus-cache-read-active))
     (let* ((old-group-hash-value
-           (gnus-gethash old-group gnus-cache-active-hashtb))
+           (gethash old-group gnus-cache-active-hashtb))
           (new-group-hash-value
-           (gnus-gethash new-group gnus-cache-active-hashtb))
+           (gethash new-group gnus-cache-active-hashtb))
           (delta
            (or old-group-hash-value new-group-hash-value)))
-      (gnus-sethash new-group old-group-hash-value gnus-cache-active-hashtb)
-      (gnus-sethash old-group nil gnus-cache-active-hashtb)
+      (puthash new-group old-group-hash-value gnus-cache-active-hashtb)
+      (puthash old-group nil gnus-cache-active-hashtb)
 
       (if no-save
          (setq gnus-cache-active-altered delta)
@@ -826,8 +829,8 @@ supported."
   (let ((no-save gnus-cache-active-hashtb))
     (unless gnus-cache-active-hashtb
       (gnus-cache-read-active))
-    (let* ((group-hash-value (gnus-gethash group gnus-cache-active-hashtb)))
-      (gnus-sethash group nil gnus-cache-active-hashtb)
+    (let* ((group-hash-value (gethash group gnus-cache-active-hashtb)))
+      (remhash group gnus-cache-active-hashtb)
 
       (if no-save
          (setq gnus-cache-active-altered group-hash-value)
@@ -849,9 +852,9 @@ supported."
   (when gnus-cache-total-fetched-hashtb
     (gnus-cache-with-refreshed-group
      group
-     (let* ((entry (or (gnus-gethash group gnus-cache-total-fetched-hashtb)
-                      (gnus-sethash group (make-vector 2 0)
-                                    gnus-cache-total-fetched-hashtb)))
+     (let* ((entry (or (gethash group gnus-cache-total-fetched-hashtb)
+                      (puthash group (make-vector 2 0)
+                               gnus-cache-total-fetched-hashtb)))
            size)
 
        (if file
@@ -874,8 +877,8 @@ supported."
   (when gnus-cache-total-fetched-hashtb
     (gnus-cache-with-refreshed-group
      group
-     (let* ((entry (or (gnus-gethash group gnus-cache-total-fetched-hashtb)
-                      (gnus-sethash group (make-list 2 0)
+     (let* ((entry (or (gethash group gnus-cache-total-fetched-hashtb)
+                      (puthash group (make-list 2 0)
                                     gnus-cache-total-fetched-hashtb)))
            (file-name-coding-system nnmail-pathname-coding-system)
            (size (or (file-attribute-size (file-attributes
@@ -888,22 +891,21 @@ supported."
 (defun gnus-cache-rename-group-total-fetched-for (old-group new-group)
   "Record of disk space used by OLD-GROUP now associated with NEW-GROUP."
   (when gnus-cache-total-fetched-hashtb
-    (let ((entry (gnus-gethash old-group gnus-cache-total-fetched-hashtb)))
-      (gnus-sethash new-group entry gnus-cache-total-fetched-hashtb)
-      (gnus-sethash old-group nil gnus-cache-total-fetched-hashtb))))
+    (let ((entry (gethash old-group gnus-cache-total-fetched-hashtb)))
+      (puthash new-group entry gnus-cache-total-fetched-hashtb)
+      (remhash old-group gnus-cache-total-fetched-hashtb))))
 
 (defun gnus-cache-delete-group-total-fetched-for (group)
   "Delete record of disk space used by GROUP being deleted."
   (when gnus-cache-total-fetched-hashtb
-      (gnus-sethash group nil gnus-cache-total-fetched-hashtb)))
+      (remhash group gnus-cache-total-fetched-hashtb)))
 
 (defun gnus-cache-total-fetched-for (group &optional no-inhibit)
   "Get total disk space used by the cache for the specified GROUP."
   (unless (equal group "dummy.group")
     (unless gnus-cache-total-fetched-hashtb
-      (setq gnus-cache-total-fetched-hashtb (gnus-make-hashtable 1024)))
-
-    (let* ((entry (gnus-gethash group gnus-cache-total-fetched-hashtb)))
+      (setq gnus-cache-total-fetched-hashtb (gnus-make-hashtable 1000)))
+    (let* ((entry (gethash group gnus-cache-total-fetched-hashtb)))
       (if entry
          (apply '+ entry)
        (let ((gnus-cache-inhibit-update-total-fetched-for (not no-inhibit)))
diff --git a/lisp/gnus/gnus-cite.el b/lisp/gnus/gnus-cite.el
index bbf9e52..7e431e7 100644
--- a/lisp/gnus/gnus-cite.el
+++ b/lisp/gnus/gnus-cite.el
@@ -1,6 +1,6 @@
 ;;; gnus-cite.el --- parse citations in articles for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Per Abhiddenware
 
@@ -92,7 +92,7 @@ The first regexp group should match the Supercite 
attribution."
 ;;     -----Original Message-----
 ;;     From: ...
 ;;     To: ...
-;;     Sent: ...   [date, in non-RFC-2822 format]
+;;     Sent: ...   [date, in non-RFC-822-or-later format]
 ;;     Subject: ...
 ;;
 ;;     Cited message, with no prefixes
@@ -340,7 +340,7 @@ in a boring face, then the pages will be skipped."
 ;; TAG: Is a Supercite tag, if any.
 
 (defvar gnus-cited-opened-text-button-line-format-alist
-  `((?b (marker-position beg) ?d)
+  '((?b (marker-position beg) ?d)
     (?e (marker-position end) ?d)
     (?n (count-lines beg end) ?d)
     (?l (- end beg) ?d)))
@@ -625,7 +625,7 @@ always hide."
                (point)
                (progn (eval gnus-cited-closed-text-button-line-format-spec)
                       (point))
-               `gnus-article-toggle-cited-text
+               'gnus-article-toggle-cited-text
                (list (cons beg end) start))
               (point))
              'article-type 'annotation)
@@ -675,7 +675,7 @@ means show, nil means toggle."
                        gnus-cited-opened-text-button-line-format-spec
                      gnus-cited-closed-text-button-line-format-spec))
                   (point))
-           `gnus-article-toggle-cited-text
+           'gnus-article-toggle-cited-text
            args)
           (point))
         'article-type 'annotation)))))
@@ -1128,7 +1128,7 @@ Returns nil if there is no such line before LIMIT, t 
otherwise."
     (let ((cdepth (min (length (apply 'concat
                                      (split-string
                                       (match-string-no-properties 0)
-                                      "[ \t [:alnum:]]+")))
+                                      "[\t [:alnum:]]+")))
                       gnus-message-max-citation-depth))
          (mlist (make-list (* (1+ gnus-message-max-citation-depth) 2) nil))
          (start (point-at-bol))
diff --git a/lisp/gnus/gnus-cloud.el b/lisp/gnus/gnus-cloud.el
index 1aa8e71..485f815 100644
--- a/lisp/gnus/gnus-cloud.el
+++ b/lisp/gnus/gnus-cloud.el
@@ -1,6 +1,6 @@
 ;;; gnus-cloud.el --- storing and retrieving data via IMAP
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: mail
diff --git a/lisp/gnus/gnus-cus.el b/lisp/gnus/gnus-cus.el
index f4c0aa7..d56066e 100644
--- a/lisp/gnus/gnus-cus.el
+++ b/lisp/gnus/gnus-cus.el
@@ -1,6 +1,6 @@
 ;;; gnus-cus.el --- customization commands for Gnus
 
-;; Copyright (C) 1996, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <address@hidden>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-delay.el b/lisp/gnus/gnus-delay.el
index e9138f0..aabf239 100644
--- a/lisp/gnus/gnus-delay.el
+++ b/lisp/gnus/gnus-delay.el
@@ -1,6 +1,6 @@
 ;;; gnus-delay.el --- Delayed posting of articles
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <address@hidden>
 ;; Keywords: mail, news, extensions
@@ -98,19 +98,15 @@ DELAY is a string, giving the length of the time.  Possible 
values are:
           (setq hour   (string-to-number (match-string 1 delay))
                 minute (string-to-number (match-string 2 delay)))
           ;; Use current time, except...
-          (setq deadline (apply 'vector (decode-time)))
+          (setq deadline (decode-time))
           ;; ... for minute and hour.
-          (aset deadline 1 minute)
-          (aset deadline 2 hour)
-          ;; Convert to seconds.
-          (setq deadline (float-time (apply 'encode-time
-                                            (append deadline nil))))
+          (setq deadline (apply #'encode-time (car deadline) minute hour
+                                (nthcdr 3 deadline)))
           ;; If this time has passed already, add a day.
-          (when (< deadline (float-time))
-            (setq deadline (+ 86400 deadline))) ; 86400 secs/day
+          (when (time-less-p deadline nil)
+            (setq deadline (time-add 86400 deadline))) ; 86400 secs/day
           ;; Convert seconds to date header.
-          (setq deadline (message-make-date
-                          (seconds-to-time deadline))))
+          (setq deadline (message-make-date deadline)))
          ((string-match "\\([0-9]+\\)\\s-*\\([mhdwMY]\\)" delay)
           (setq num (match-string 1 delay))
           (setq unit (match-string 2 delay))
@@ -128,8 +124,7 @@ DELAY is a string, giving the length of the time.  Possible 
values are:
                  (setq delay (* num 60 60)))
                 (t
                  (setq delay (* num 60))))
-          (setq deadline (message-make-date
-                          (seconds-to-time (+ (float-time) delay)))))
+          (setq deadline (message-make-date (time-add nil delay))))
          (t (error "Malformed delay `%s'" delay)))
     (message-add-header (format "%s: %s" gnus-delay-header deadline)))
   (set-buffer-modified-p t)
@@ -164,11 +159,8 @@ DELAY is a string, giving the length of the time.  
Possible values are:
               nil t)
              (progn
                (setq deadline (nnheader-header-value))
-               (setq deadline (apply 'encode-time
-                                     (parse-time-string deadline)))
-               (setq deadline (time-since deadline))
-               (when (and (>= (nth 0 deadline) 0)
-                          (>= (nth 1 deadline) 0))
+               (setq deadline (encode-time (parse-time-string deadline)))
+               (unless (time-less-p nil deadline)
                  (message "Sending delayed article %d" article)
                  (gnus-draft-send article group)
                  (message "Sending delayed article %d...done" article)))
diff --git a/lisp/gnus/gnus-demon.el b/lisp/gnus/gnus-demon.el
index 2405c70..6c5e0b7 100644
--- a/lisp/gnus/gnus-demon.el
+++ b/lisp/gnus/gnus-demon.el
@@ -1,6 +1,6 @@
 ;;; gnus-demon.el --- daemonic Gnus behavior
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -93,7 +93,7 @@ Emacs has been idle for IDLE `gnus-demon-timestep's."
 
 (defun gnus-demon-idle-since ()
   "Return the number of seconds since when Emacs is idle."
-  (float-time (or (current-idle-time) '(0 0 0))))
+  (float-time (or (current-idle-time) 0)))
 
 (defun gnus-demon-run-callback (func &optional idle time special)
   "Run FUNC if Emacs has been idle for longer than IDLE seconds.
@@ -192,11 +192,9 @@ marked with SPECIAL."
                            (elt nowParts 6)
                            (elt nowParts 7)
                            (elt nowParts 8)))
-        ;; calculate number of seconds between NOW and THEN
-        (diff (+ (* 65536 (- (car then) (car now)))
-                 (- (cadr then) (cadr now)))))
-    ;; return number of timesteps in the number of seconds
-    (round (/ diff gnus-demon-timestep))))
+        (diff (float-time (time-subtract then now))))
+    ;; Return number of timesteps in the number of seconds.
+    (round diff gnus-demon-timestep)))
 
 (gnus-add-shutdown 'gnus-demon-cancel 'gnus)
 
diff --git a/lisp/gnus/gnus-diary.el b/lisp/gnus/gnus-diary.el
index b8ad424..ceb0d4a 100644
--- a/lisp/gnus/gnus-diary.el
+++ b/lisp/gnus/gnus-diary.el
@@ -1,6 +1,6 @@
 ;;; gnus-diary.el --- Wrapper around the NNDiary Gnus back end
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author:        Didier Verna <address@hidden>
 ;; Maintainer:    Didier Verna <address@hidden>
@@ -159,32 +159,29 @@ There are currently two built-in format functions:
   ;; Code partly stolen from article-make-date-line
   (let* ((extras (mail-header-extra header))
         (sched (gnus-diary-header-schedule extras))
-        (occur (nndiary-next-occurrence sched (current-time)))
         (now (current-time))
+        (occur (nndiary-next-occurrence sched now))
         (real-time (time-subtract occur now)))
-    (if (null real-time)
-       "?????"
-      (let* ((sec (+ (* (float (car real-time)) 65536) (cadr real-time)))
-            (past (< sec 0))
-            delay)
-       (and past (setq sec (- sec)))
-       (unless (zerop sec)
-         ;; This is a bit convoluted, but basically we go through the time
-         ;; units for years, weeks, etc, and divide things to see whether
-         ;; that results in positive answers.
-         (let ((units `((year . ,(* 365.25 24 3600))
-                        (month . ,(* 31 24 3600))
-                        (week . ,(* 7 24 3600))
-                        (day . ,(* 24 3600))
-                        (hour . 3600)
-                        (minute . 60)))
-               unit num)
-           (while (setq unit (pop units))
-             (unless (zerop (setq num (ffloor (/ sec (cdr unit)))))
-               (setq delay (append delay `((,(floor num) . ,(car unit))))))
-             (setq sec (- sec (* num (cdr unit)))))))
-       (funcall gnus-diary-delay-format-function past delay)))
-    ))
+    (let* ((sec (encode-time real-time 'integer))
+          (past (< sec 0))
+          delay)
+      (and past (setq sec (- sec)))
+      (unless (zerop sec)
+       ;; This is a bit convoluted, but basically we go through the time
+       ;; units for years, weeks, etc, and divide things to see whether
+       ;; that results in positive answers.
+       (let ((units `((year . ,(round (* 365.25 24 3600)))
+                      (month . ,(* 31 24 3600))
+                      (week . ,(* 7 24 3600))
+                      (day . ,(* 24 3600))
+                      (hour . 3600)
+                      (minute . 60)))
+             unit num)
+         (while (setq unit (pop units))
+           (unless (zerop (setq num (floor sec (cdr unit))))
+             (setq delay (append delay `((,num . ,(car unit))))))
+           (setq sec (mod sec (cdr unit))))))
+      (funcall gnus-diary-delay-format-function past delay))))
 
 ;; #### NOTE: Gnus sometimes gives me a HEADER not corresponding to any
 ;; message, with all fields set to nil here. I don't know what it is for, and
diff --git a/lisp/gnus/gnus-dired.el b/lisp/gnus/gnus-dired.el
index a46dd78..acb8fd7 100644
--- a/lisp/gnus/gnus-dired.el
+++ b/lisp/gnus/gnus-dired.el
@@ -1,6 +1,6 @@
 ;;; gnus-dired.el --- utility functions where gnus and dired meet
 
-;; Copyright (C) 1996-1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Authors: Benjamin Rutt <address@hidden>,
 ;;          Shenghuo Zhu <address@hidden>
diff --git a/lisp/gnus/gnus-draft.el b/lisp/gnus/gnus-draft.el
index 7d4be47..ad1aa62 100644
--- a/lisp/gnus/gnus-draft.el
+++ b/lisp/gnus/gnus-draft.el
@@ -1,6 +1,6 @@
 ;;; gnus-draft.el --- draft message support for Gnus
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-dup.el b/lisp/gnus/gnus-dup.el
index a03c6c1..8b87648 100644
--- a/lisp/gnus/gnus-dup.el
+++ b/lisp/gnus/gnus-dup.el
@@ -1,6 +1,6 @@
 ;;; gnus-dup.el --- suppression of duplicate articles in Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -44,7 +44,7 @@ seen in the same session."
   :type 'boolean)
 
 (defcustom gnus-duplicate-list-length 10000
-  "The number of Message-IDs to keep in the duplicate suppression list."
+  "The maximum number of duplicate Message-IDs to keep track of."
   :group 'gnus-duplicate
   :type 'integer)
 
@@ -55,8 +55,10 @@ seen in the same session."
 
 ;;; Internal variables
 
-(defvar gnus-dup-list nil)
-(defvar gnus-dup-hashtb nil)
+(defvar gnus-dup-list nil
+  "List of seen message IDs, as strings.")
+(defvar gnus-dup-hashtb nil
+  "Hash table of seen message IDs, for fast lookup.")
 
 (defvar gnus-dup-list-dirty nil)
 
@@ -80,8 +82,8 @@ seen in the same session."
     (setq gnus-dup-list nil))
   (setq gnus-dup-hashtb (gnus-make-hashtable gnus-duplicate-list-length))
   ;; Enter all Message-IDs into the hash table.
-  (let ((obarray gnus-dup-hashtb))
-    (mapc 'intern gnus-dup-list)))
+  (dolist (g gnus-dup-list)
+    (puthash g t gnus-dup-hashtb)))
 
 (defun gnus-dup-read ()
   "Read the duplicate suppression list."
@@ -116,13 +118,13 @@ seen in the same session."
                 (not (= (gnus-data-mark datum) gnus-canceled-mark))
                 (setq msgid (mail-header-id (gnus-data-header datum)))
                 (not (nnheader-fake-message-id-p msgid))
-                (not (intern-soft msgid gnus-dup-hashtb)))
+                (not (gethash msgid gnus-dup-hashtb)))
        (push msgid gnus-dup-list)
-       (intern msgid gnus-dup-hashtb))))
+       (puthash msgid t gnus-dup-hashtb))))
   ;; Chop off excess Message-IDs from the list.
   (let ((end (nthcdr gnus-duplicate-list-length gnus-dup-list)))
     (when end
-      (mapc (lambda (id) (unintern id gnus-dup-hashtb)) (cdr end))
+      (mapc (lambda (id) (remhash id gnus-dup-hashtb)) (cdr end))
       (setcdr end nil))))
 
 (defun gnus-dup-suppress-articles ()
@@ -134,7 +136,7 @@ seen in the same session."
                   (memq gnus-duplicate-mark gnus-auto-expirable-marks)))
        number)
     (dolist (header gnus-newsgroup-headers)
-      (when (and (intern-soft (mail-header-id header) gnus-dup-hashtb)
+      (when (and (gethash (mail-header-id header) gnus-dup-hashtb)
                 (gnus-summary-article-unread-p (mail-header-number header)))
        (setq gnus-newsgroup-unreads
              (delq (setq number (mail-header-number header))
@@ -152,7 +154,7 @@ seen in the same session."
     (when id
       (setq gnus-dup-list-dirty t)
       (setq gnus-dup-list (delete id gnus-dup-list))
-      (unintern id gnus-dup-hashtb))))
+      (remhash id gnus-dup-hashtb))))
 
 (provide 'gnus-dup)
 
diff --git a/lisp/gnus/gnus-eform.el b/lisp/gnus/gnus-eform.el
index 059d173..a1f71bb 100644
--- a/lisp/gnus/gnus-eform.el
+++ b/lisp/gnus/gnus-eform.el
@@ -1,6 +1,6 @@
 ;;; gnus-eform.el --- a mode for editing forms for Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-fun.el b/lisp/gnus/gnus-fun.el
index f1fd51d..8b71051 100644
--- a/lisp/gnus/gnus-fun.el
+++ b/lisp/gnus/gnus-fun.el
@@ -1,6 +1,6 @@
 ;;; gnus-fun.el --- various frivolous extension functions to Gnus
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-gravatar.el b/lisp/gnus/gnus-gravatar.el
index 95e0927..d271a52 100644
--- a/lisp/gnus/gnus-gravatar.el
+++ b/lisp/gnus/gnus-gravatar.el
@@ -1,6 +1,6 @@
 ;;; gnus-gravatar.el --- Gnus Gravatar support
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Julien Danjou <address@hidden>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 6af27af..bd24c3f 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -1,6 +1,6 @@
 ;;; gnus-group.el --- group mode commands for Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -38,6 +38,7 @@
 
 (eval-when-compile
   (require 'mm-url)
+  (require 'subr-x)
   (let ((features (cons 'gnus-group features)))
     (require 'gnus-sum))
   (unless (boundp 'gnus-cache-active-hashtb)
@@ -496,7 +497,7 @@ simple manner."
 (defvar gnus-tmp-number-of-unread)
 
 (defvar gnus-group-line-format-alist
-  `((?M gnus-tmp-marked-mark ?c)
+  '((?M gnus-tmp-marked-mark ?c)
     (?S gnus-tmp-subscribed ?c)
     (?L gnus-tmp-level ?d)
     (?N (cond ((eq number t) "*" )
@@ -544,7 +545,7 @@ simple manner."
     ))
 
 (defvar gnus-group-mode-line-format-alist
-  `((?S gnus-tmp-news-server ?s)
+  '((?S gnus-tmp-news-server ?s)
     (?M gnus-tmp-news-method ?s)
     (?u gnus-tmp-user-defined ?s)
     (?: gnus-tmp-colon ?s)))
@@ -567,8 +568,6 @@ simple manner."
 ;;; Gnus group mode
 ;;;
 
-(put 'gnus-group-mode 'mode-class 'special)
-
 (gnus-define-keys gnus-group-mode-map
   " " gnus-group-read-group
   "=" gnus-group-select-group
@@ -782,7 +781,7 @@ simple manner."
 
     (easy-menu-define
      gnus-group-reading-menu gnus-group-mode-map ""
-     `("Group"
+     '("Group"
        ["Read" gnus-group-read-group
        :included (not (gnus-topic-mode-p))
        :active (gnus-group-group-name)]
@@ -949,7 +948,7 @@ simple manner."
 
     (easy-menu-define
      gnus-group-misc-menu gnus-group-mode-map ""
-     `("Gnus"
+     '("Gnus"
        ["Send a mail" gnus-group-mail t]
        ["Send a message (mail or news)" gnus-group-post-news t]
        ["Create a local message" gnus-group-news t]
@@ -1106,9 +1105,8 @@ When FORCE, rebuild the tool bar."
          (set (make-local-variable 'tool-bar-map) map))))
   gnus-group-tool-bar-map)
 
-(define-derived-mode gnus-group-mode fundamental-mode "Group"
+(define-derived-mode gnus-group-mode gnus-mode "Group"
   "Major mode for reading news.
-
 All normal editing commands are switched off.
 \\<gnus-group-mode-map>
 The group buffer lists (some of) the groups available.  For instance,
@@ -1131,8 +1129,7 @@ The following commands are available:
   (setq mode-line-process nil)
   (buffer-disable-undo)
   (setq truncate-lines t)
-  (setq buffer-read-only t
-       show-trailing-whitespace nil)
+  (setq show-trailing-whitespace nil)
   (gnus-set-default-directory)
   (gnus-update-format-specifications nil 'group 'group-mode)
   (gnus-update-group-mark-positions)
@@ -1146,7 +1143,7 @@ The following commands are available:
     (let ((gnus-process-mark ?\200)
          (gnus-group-update-hook nil)
          (gnus-group-marked '("dummy.group"))
-         (gnus-active-hashtb (make-vector 10 0)))
+         (gnus-active-hashtb (gnus-make-hashtable 10)))
       (gnus-set-active "dummy.group" '(0 . 0))
       (gnus-set-work-buffer)
       (gnus-group-insert-group-line "dummy.group" 0 nil 0 nil)
@@ -1190,6 +1187,9 @@ The following commands are available:
   (unless (derived-mode-p 'gnus-group-mode)
     (gnus-group-mode)))
 
+;; FIXME: If we never have to coerce group names to unibyte now, how
+;; much of this is necessary?  How much encoding/decoding do we still
+;; have to do?
 (defun gnus-group-name-charset (method group)
   (unless method
     (setq method (gnus-find-method-for-group group)))
@@ -1271,20 +1271,14 @@ Also see the `gnus-group-use-permanent-levels' 
variable."
        ;; has disappeared in the new listing, try to find the next
        ;; one.  If no next one can be found, just leave point at the
        ;; first newsgroup in the buffer.
-       (when (not (gnus-goto-char
-                   (text-property-any
-                    (point-min) (point-max)
-                    'gnus-group (gnus-intern-safe
-                                 group gnus-active-hashtb))))
-         (let ((newsrc (cdddr (gnus-group-entry group))))
-           (while (and newsrc
-                       (not (gnus-goto-char
-                             (text-property-any
-                              (point-min) (point-max) 'gnus-group
-                              (gnus-intern-safe
-                               (caar newsrc) gnus-active-hashtb)))))
-             (setq newsrc (cdr newsrc)))
-           (unless newsrc
+       (when (not (gnus-text-property-search
+                   'gnus-group group nil 'goto))
+         (let ((groups (cdr-safe (member group gnus-group-list))))
+           (while (and groups
+                       (not (gnus-text-property-search
+                             'gnus-group (car groups) 'forward 'goto)))
+             (setq groups (cdr groups)))
+           (unless groups
              (goto-char (point-max))
              (forward-line -1)))))))
     ;; Adjust cursor point.
@@ -1317,7 +1311,6 @@ If REGEXP is a function, list dead groups that the 
function returns non-nil;
 if it is a string, only list groups matching REGEXP."
   (set-buffer gnus-group-buffer)
   (let ((buffer-read-only nil)
-       (newsrc (cdr gnus-newsrc-alist))
        (lowest (or lowest 1))
        (not-in-list (and gnus-group-listed-groups
                          (copy-sequence gnus-group-listed-groups)))
@@ -1325,12 +1318,11 @@ if it is a string, only list groups matching REGEXP."
     (erase-buffer)
     (when (or (< lowest gnus-level-zombie)
              gnus-group-listed-groups)
-      ;; List living groups.
-      (while newsrc
-       (setq info (car newsrc)
+      ;; List living groups, according to order in `gnus-group-list'.
+      (dolist (g (cdr gnus-group-list))
+       (setq info (nth 1 (gethash g gnus-newsrc-hashtb))
              group (gnus-info-group info)
              params (gnus-info-params info)
-             newsrc (cdr newsrc)
              unread (gnus-group-unread group))
        (when not-in-list
          (setq not-in-list (delete group not-in-list)))
@@ -1411,7 +1403,7 @@ if it is a string, only list groups matching REGEXP."
                       (insert " " mark "     *: "
                               (gnus-group-decoded-name group)
                               "\n"))
-            (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb)
+            (list 'gnus-group (gethash group gnus-active-hashtb)
                   'gnus-unread t
                   'gnus-level level))))
       (while groups
@@ -1442,7 +1434,7 @@ if it is a string, only list groups matching REGEXP."
           (not (gnus-ephemeral-group-p group))
           (gnus-dribble-enter
            (concat "(gnus-group-set-info '"
-                   (gnus-prin1-to-string (nth 2 entry))
+                   (gnus-prin1-to-string (nth 1 entry))
                    ")")
            (concat "^(gnus-group-set-info '(\"" (regexp-quote group) "\"")))
       (setq gnus-group-indentation (gnus-group-group-indentation))
@@ -1459,7 +1451,7 @@ if it is a string, only list groups matching REGEXP."
     (if entry
        (progn
          ;; (Un)subscribed group.
-         (setq info (nth 2 entry))
+         (setq info (nth 1 entry))
          (gnus-group-insert-group-line
           group (gnus-info-level info) (gnus-info-marks info)
           (or (car entry) t) (gnus-info-method info)))
@@ -1476,7 +1468,7 @@ if it is a string, only list groups matching REGEXP."
        (gnus-method-simplify (gnus-find-method-for-group group))))))
 
 (defun gnus-number-of-unseen-articles-in-group (group)
-  (let* ((info (nth 2 (gnus-group-entry group)))
+  (let* ((info (nth 1 (gnus-group-entry group)))
         (marked (gnus-info-marks info))
         (seen (cdr (assq 'seen marked)))
         (active (gnus-active group)))
@@ -1548,12 +1540,12 @@ if it is a string, only list groups matching REGEXP."
         (gnus-tmp-newsgroup-description
          (if gnus-description-hashtb
              (or (gnus-group-name-decode
-                  (gnus-gethash gnus-tmp-group gnus-description-hashtb)
+                  (gethash gnus-tmp-group gnus-description-hashtb)
                   group-name-charset) "")
            ""))
         (gnus-tmp-moderated
          (if (and gnus-moderated-hashtb
-                  (gnus-gethash gnus-tmp-group gnus-moderated-hashtb))
+                  (gethash gnus-tmp-group gnus-moderated-hashtb))
              ?m ? ))
         (gnus-tmp-moderated-string
          (if (eq gnus-tmp-moderated ?m) "(m)" ""))
@@ -1579,7 +1571,7 @@ if it is a string, only list groups matching REGEXP."
              gnus-process-mark ? ))
         (buffer-read-only nil)
         beg end
-         gnus-tmp-header)      ; passed as parameter to user-funcs.
+         gnus-tmp-header)        ; passed as parameter to user-funcs.
     (beginning-of-line)
     (setq beg (point))
     (add-text-properties
@@ -1589,7 +1581,7 @@ if it is a string, only list groups matching REGEXP."
        (let ((gnus-tmp-decoded-group (gnus-group-name-decode
                                      gnus-tmp-group group-name-charset)))
         (eval gnus-group-line-format-spec)))
-     `(gnus-group ,(gnus-intern-safe gnus-tmp-group gnus-active-hashtb)
+     `(gnus-group ,gnus-tmp-group
                  gnus-unread ,(if (numberp number)
                                   (string-to-number gnus-tmp-number-of-unread)
                                 t)
@@ -1623,7 +1615,7 @@ Some value are bound so the form can use them."
   (when list
     (let* ((entry (gnus-group-entry group))
            (active (gnus-active group))
-           (info (nth 2 entry))
+           (info (nth 1 entry))
            (method (inline (gnus-server-get-method
                            group (gnus-info-method info))))
            (marked (gnus-info-marks info))
@@ -1694,9 +1686,7 @@ already.  If INFO-UNCHANGED is non-nil, dribble buffer is 
not updated."
       ;; The buffer may be narrowed.
       (save-restriction
         (widen)
-        (let ((ident (gnus-intern-safe group gnus-active-hashtb))
-              (loc (point-min))
-              found buffer-read-only)
+        (let (found buffer-read-only)
          (unless info-unchanged
            ;; Enter the current status into the dribble buffer.
            (let ((entry (gnus-group-entry group)))
@@ -1704,37 +1694,33 @@ already.  If INFO-UNCHANGED is non-nil, dribble buffer 
is not updated."
                         (not (gnus-ephemeral-group-p group)))
                (gnus-dribble-enter
                 (concat "(gnus-group-set-info '"
-                        (gnus-prin1-to-string (nth 2 entry))
+                        (gnus-prin1-to-string (nth 1 entry))
                         ")")
                 (concat "^(gnus-group-set-info '(\""
                         (regexp-quote group) "\"")))))
-          ;; Find all group instances.  If topics are in use, each group
-          ;; may be listed in more than once.
-          (while (setq loc (text-property-any
-                            loc (point-max) 'gnus-group ident))
+          ;; Find all group instances.  If topics are in use, groups
+          ;; may be listed more than once.
+         (goto-char (point-min))
+          (while (gnus-text-property-search
+                  'gnus-group group 'forward 'goto)
             (setq found t)
-            (goto-char loc)
             (let ((gnus-group-indentation (gnus-group-group-indentation)))
               (gnus-delete-line)
               (gnus-group-insert-group-line-info group)
               (save-excursion
                 (forward-line -1)
-                (gnus-run-hooks 'gnus-group-update-group-hook)))
-            (setq loc (1+ loc)))
+                (gnus-run-hooks 'gnus-group-update-group-hook))))
           (unless (or found visible-only)
             ;; No such line in the buffer, find out where it's supposed to
             ;; go, and insert it there (or at the end of the buffer).
             (if gnus-goto-missing-group-function
                 (funcall gnus-goto-missing-group-function group)
-              (let ((entry (cddr (gnus-group-entry group))))
-                (while (and entry (car entry)
+              (let ((entry (cdr (member group gnus-group-list))))
+               (goto-char (point-min))
+                (while (and (car-safe entry)
                             (not
-                             (gnus-goto-char
-                              (text-property-any
-                               (point-min) (point-max)
-                               'gnus-group (gnus-intern-safe
-                                            (caar entry)
-                                            gnus-active-hashtb)))))
+                             (gnus-text-property-search
+                              'gnus-group (car entry) 'forward 'goto)))
                   (setq entry (cdr entry)))
                 (or entry (goto-char (point-max)))))
             ;; Finally insert the line.
@@ -2066,7 +2052,7 @@ that group."
     (unless group
       (error "No group on current line"))
     (setq marked (gnus-info-marks
-                 (nth 2 (setq entry (gnus-group-entry group)))))
+                 (nth 1 (setq entry (gnus-group-entry group)))))
     ;; This group might be a dead group.  In that case we have to get
     ;; the number of unread articles from `gnus-active-hashtb'.
     (setq number
@@ -2141,6 +2127,7 @@ be permanent."
       (let ((group (gnus-group-group-name)))
        (when group
          (gnus-group-decoded-name group)))
+    ;; FIXME: Use rx.
     (let ((regexp "address@hidden,/:address@hidden
 \\(nn[a-z]+\\(?:address@hidden,/:address@hidden)?:\
 address@hidden,./:address@hidden(?:address@hidden,./:address@hidden)*\
@@ -2179,34 +2166,46 @@ be permanent."
 (defun gnus-group-completing-read (&optional prompt collection
                                             require-match initial-input hist
                                             def)
-  "Read a group name with completion.  Non-ASCII group names are allowed.
-The arguments are the same as `completing-read' except that COLLECTION
-and HIST default to `gnus-active-hashtb' and `gnus-group-history'
-respectively if they are omitted.  Regards COLLECTION as a hash table
-if it is not a list."
+  "Read a group name with completion.
+Non-ASCII group names are allowed.  The arguments are the same as
+`completing-read' except that COLLECTION and HIST default to
+`gnus-active-hashtb' and `gnus-group-history' respectively if
+they are omitted.  Can handle COLLECTION as a list, hash table,
+or vector."
   (or collection (setq collection gnus-active-hashtb))
   (let (choices group)
-    (if (listp collection)
-       (dolist (symbol collection)
-         (setq group (symbol-name symbol))
-         (push (if (string-match "[^\000-\177]" group)
-                   (gnus-group-decoded-name group)
-                 group)
-               choices))
-      (mapatoms (lambda (symbol)
-                 (setq group (symbol-name symbol))
-                 (push (if (string-match "[^\000-\177]" group)
-                           (gnus-group-decoded-name group)
-                         group)
-                       choices))
-               collection))
-    (setq group (gnus-completing-read (or prompt "Group") (nreverse choices)
+    (cond ((listp collection)
+          (if (symbolp (car collection))
+              (dolist (symbol collection)
+                (setq group (symbol-name symbol))
+                (push (if (string-match "[^\000-\177]" group)
+                          (gnus-group-decoded-name group)
+                        group)
+                      choices))
+            (setq choices collection)))
+         ((vectorp collection)
+          (mapatoms (lambda (symbol)
+                      (setq group (symbol-name symbol))
+                      (push (if (string-match "[^\000-\177]" group)
+                                (gnus-group-decoded-name group)
+                              group)
+                            choices))
+                    collection))
+         ((hash-table-p collection)
+          (setq choices (hash-table-keys collection))))
+    (setq group (gnus-completing-read (or prompt "Group") (reverse choices)
                                      require-match initial-input
                                      (or hist 'gnus-group-history)
                                      def))
-    (unless (if (listp collection)
-               (member group (mapcar 'symbol-name collection))
-             (symbol-value (intern-soft group collection)))
+    (unless (cond ((and (listp collection)
+                       (symbolp (car collection)))
+                  (member group (mapcar 'symbol-name collection)))
+                 ((listp collection)
+                  (member group collection))
+                 ((vectorp collection)
+                  (symbol-value (intern-soft group collection)))
+                 ((hash-table-p collection)
+                  (gethash group collection)))
       (setq group
            (encode-coding-string
             group (gnus-group-name-charset nil group))))
@@ -2284,7 +2283,8 @@ Return the name of the group if selection was successful."
     (nnheader-init-server-buffer)
     ;; Necessary because of funky inlining.
     (require 'gnus-cache)
-    (setq gnus-newsrc-hashtb (gnus-make-hashtable)))
+    (setq gnus-newsrc-hashtb (gnus-make-hashtable 100)
+         gnus-active-hashtb (gnus-make-hashtable 100)))
   ;; Transform the select method into a unique server.
   (when (stringp method)
     (setq method (gnus-server-to-method method)))
@@ -2301,23 +2301,23 @@ Return the name of the group if selection was 
successful."
                 (gnus-group-prefixed-name (gnus-group-real-name group)
                                           method))))
     (gnus-set-active group nil)
-    (gnus-sethash
+    (puthash
      group
-     `(-1 nil (,group
-              ,gnus-level-default-subscribed nil nil ,method
-              ,(cons
-                (cons 'quit-config
-                      (cond
-                       (quit-config
-                        quit-config)
-                       ((assq gnus-current-window-configuration
-                              gnus-buffer-configuration)
-                        (cons gnus-summary-buffer
-                              gnus-current-window-configuration))
-                       (t
-                        (cons (current-buffer)
-                              (current-window-configuration)))))
-                parameters)))
+     `(-1 (,group
+          ,gnus-level-default-subscribed nil nil ,method
+          ,(cons
+            (cons 'quit-config
+                  (cond
+                   (quit-config
+                    quit-config)
+                   ((assq gnus-current-window-configuration
+                          gnus-buffer-configuration)
+                    (cons gnus-summary-buffer
+                          gnus-current-window-configuration))
+                   (t
+                    (cons (current-buffer)
+                          (current-window-configuration)))))
+            parameters)))
      gnus-newsrc-hashtb)
     (push method gnus-ephemeral-servers)
     (when (gnus-buffer-live-p gnus-group-buffer)
@@ -2566,30 +2566,29 @@ If PROMPT (the prefix) is a number, use the prompt 
specified in
 If FAR, it is likely that the group is not on the current line.
 If TEST-MARKED, the line must be marked."
   (when group
-    (let ((start (point)))
+    (let ((start (point))
+         (active (and (gethash group gnus-active-hashtb)
+                      group)))
       (beginning-of-line)
       (cond
        ;; It's quite likely that we are on the right line, so
        ;; we check the current line first.
        ((and (not far)
-            (eq (get-text-property (point) 'gnus-group)
-                (gnus-intern-safe group gnus-active-hashtb))
+            (equal (get-text-property (point) 'gnus-group) active)
             (or (not test-marked) (gnus-group-mark-line-p)))
        (point))
        ;; Previous and next line are also likely, so we check them as well.
        ((and (not far)
             (save-excursion
               (forward-line -1)
-              (and (eq (get-text-property (point) 'gnus-group)
-                       (gnus-intern-safe group gnus-active-hashtb))
+              (and (equal (get-text-property (point) 'gnus-group) active)
                    (or (not test-marked) (gnus-group-mark-line-p)))))
        (forward-line -1)
        (point))
        ((and (not far)
             (save-excursion
               (forward-line 1)
-              (and (eq (get-text-property (point) 'gnus-group)
-                       (gnus-intern-safe group gnus-active-hashtb))
+              (and (equal (get-text-property (point) 'gnus-group) active)
                    (or (not test-marked) (gnus-group-mark-line-p)))))
        (forward-line 1)
        (point))
@@ -2597,21 +2596,16 @@ If TEST-MARKED, the line must be marked."
        (goto-char (point-min))
        (let (found)
          (while (and (not found)
-                     (gnus-goto-char
-                      (text-property-any
-                       (point) (point-max)
-                       'gnus-group
-                       (gnus-intern-safe group gnus-active-hashtb))))
+                     (gnus-text-property-search
+                      'gnus-group active 'forward 'goto))
            (if (gnus-group-mark-line-p)
                (setq found t)
              (forward-line 1)))
          found))
        (t
        ;; Search through the entire buffer.
-       (if (gnus-goto-char
-            (text-property-any
-             (point-min) (point-max)
-             'gnus-group (gnus-intern-safe group gnus-active-hashtb)))
+       (if (gnus-text-property-search
+            'gnus-group active nil 'goto)
            (point)
          (goto-char start)
          nil))))))
@@ -2779,9 +2773,7 @@ server."
     (gnus-group-change-level
      (setq info (list t nname gnus-level-default-subscribed nil nil meth))
      gnus-level-default-subscribed gnus-level-killed
-     (and (gnus-group-group-name)
-         (gnus-group-entry (gnus-group-group-name)))
-     t)
+     (gnus-group-group-name) t)
     ;; Make it active.
     (gnus-set-active nname (cons 1 0))
     (unless (gnus-ephemeral-group-p name)
@@ -2841,6 +2833,7 @@ If FORCE (the prefix) is non-nil, all the articles in the 
group will
 be deleted.  This is \"deleted\" as in \"removed forever from the face
 of the Earth\".  There is no undo.  The user will be prompted before
 doing the deletion.
+
 Note that you also have to specify FORCE if you want the group to
 be removed from the server, even when it's empty."
   (interactive
@@ -2852,12 +2845,11 @@ be removed from the server, even when it's empty."
     (error "This back end does not support group deletion"))
   (prog1
       (let ((group-decoded (gnus-group-decoded-name group)))
-       (if (and (not no-prompt)
-                (not (gnus-yes-or-no-p
-                      (format
-                       "Do you really want to delete %s%s? "
-                       group-decoded (if force " and all its contents" "")))))
-           ()                          ; Whew!
+       (when (or no-prompt
+                 (gnus-yes-or-no-p
+                  (format
+                   "Do you really want to delete %s%s? "
+                   group-decoded (if force " and all its contents" ""))))
          (gnus-message 6 "Deleting group %s..." group-decoded)
          (if (not (gnus-request-delete-group group force))
              (gnus-error 3 "Couldn't delete group %s" group-decoded)
@@ -3238,7 +3230,7 @@ mail messages or news articles in files that have numeric 
names."
     ;; Subscribe the new group after the group on the current line.
     (gnus-subscribe-group pgroup (gnus-group-group-name) method)
     (gnus-group-update-group pgroup)
-    (forward-line -1)
+    (forward-line)
     (gnus-group-position-point)))
 
 (defun gnus-group-enter-directory (dir)
@@ -3631,7 +3623,7 @@ The return value is the number of articles that were 
marked as read,
 or nil if no action could be taken."
   (let* ((entry (gnus-group-entry group))
         (num (car entry))
-        (marks (gnus-info-marks (nth 2 entry)))
+        (marks (gnus-info-marks (nth 1 entry)))
         (unread (gnus-sequence-of-unread-articles group)))
     ;; Remove entries for this group.
     (nnmail-purge-split-history (gnus-group-real-name group))
@@ -3813,8 +3805,7 @@ group line."
        (or (and (member group gnus-zombie-list)
                gnus-level-zombie)
           gnus-level-killed)
-       (when (gnus-group-group-name)
-        (gnus-group-entry (gnus-group-group-name))))
+       (gnus-group-group-name))
       (unless silent
        (gnus-group-update-group group)))
      (t (error "No such newsgroup: %s" group)))
@@ -3885,10 +3876,12 @@ of groups killed."
              `(progn
                 (gnus-group-goto-group ,(gnus-group-group-name))
                 (gnus-group-yank-group)))
-           (push (cons (car entry) (nth 2 entry))
+           (push (cons (car entry) (nth 1 entry))
                  gnus-list-of-killed-groups))
          (gnus-group-change-level
           (if entry entry group) gnus-level-killed (if entry nil level))
+         ;; FIXME: Since the group has already been removed from
+         ;; `gnus-newsrc-hashtb', this check will always return nil.
          (when (numberp (gnus-group-unread group))
            (gnus-request-update-group-status group 'unsubscribe))
          (message "Killed group %s" (gnus-group-decoded-name group)))
@@ -3906,7 +3899,7 @@ of groups killed."
                   group gnus-level-killed 3))
        (cond
         ((setq entry (gnus-group-entry group))
-         (push (cons (car entry) (nth 2 entry))
+         (push (cons (car entry) (nth 1 entry))
                gnus-list-of-killed-groups)
          (setcdr (cdr entry) (cdddr entry)))
         ((member group gnus-zombie-list)
@@ -3939,9 +3932,7 @@ yanked) a list of yanked groups is returned."
       ;; first newsgroup.
       (setq prev (gnus-group-group-name))
       (gnus-group-change-level
-       info (gnus-info-level (cdr info)) gnus-level-killed
-       (and prev (gnus-group-entry prev))
-       t)
+       info (gnus-info-level (cdr info)) gnus-level-killed prev t)
       (gnus-group-insert-group-line-info group)
       (gnus-request-update-group-status group 'subscribe)
       (gnus-undo-register
@@ -4027,14 +4018,7 @@ entail asking the server for the groups."
   ;; Find all groups and sort them.
   (let ((groups
         (sort
-         (let (list)
-           (mapatoms
-            (lambda (sym)
-              (and (boundp sym)
-                   (symbol-value sym)
-                   (push (symbol-name sym) list)))
-            gnus-active-hashtb)
-           list)
+         (hash-table-keys gnus-active-hashtb)
          'string<))
        (buffer-read-only nil)
        group)
@@ -4046,7 +4030,7 @@ entail asking the server for the groups."
                 (insert "       *: "
                         (gnus-group-decoded-name group)
                         "\n"))
-       (list 'gnus-group (gnus-intern-safe group gnus-active-hashtb)
+       (list 'gnus-group group
             'gnus-unread t
             'gnus-level (inline (gnus-group-level group)))))
     (goto-char (point-min))))
@@ -4146,17 +4130,17 @@ If DONT-SCAN is non-nil, scan non-activated groups as 
well."
         desc)
     (when (and force
               gnus-description-hashtb)
-      (gnus-sethash mname nil gnus-description-hashtb))
+      (remhash mname gnus-description-hashtb))
     (unless group
       (error "No group name given"))
     (when (or (and gnus-description-hashtb
                   ;; We check whether this group's method has been
                   ;; queried for a description file.
-                  (gnus-gethash mname gnus-description-hashtb))
+                  (gethash mname gnus-description-hashtb))
              (setq desc (gnus-group-get-description group))
              (gnus-read-descriptions-file method))
       (gnus-message 1 "%s"
-                   (or desc (gnus-gethash group gnus-description-hashtb)
+                   (or desc (gethash group gnus-description-hashtb)
                        "No description available")))))
 
 ;; Suggested by Per Abrahamsen <address@hidden>.
@@ -4169,12 +4153,8 @@ If DONT-SCAN is non-nil, scan non-activated groups as 
well."
                 (gnus-read-all-descriptions-files)))
     (error "Couldn't request descriptions file"))
   (let ((buffer-read-only nil)
-       b groups)
-    (mapatoms
-     (lambda (group)
-       (push (symbol-name group) groups))
-     gnus-description-hashtb)
-    (setq groups (sort groups 'string<))
+       (groups (sort (hash-table-keys gnus-description-hashtb)))
+       b)
     (erase-buffer)
     (dolist (group groups)
       (setq b (point))
@@ -4197,20 +4177,16 @@ If DONT-SCAN is non-nil, scan non-activated groups as 
well."
        (obuf (current-buffer))
        groups des)
     ;; Go through all newsgroups that are known to Gnus.
-    (mapatoms
-     (lambda (group)
-       (and (symbol-name group)
-           (string-match regexp (symbol-name group))
-           (symbol-value group)
-           (push (symbol-name group) groups)))
+    (maphash
+     (lambda (g-name _)
+       (and (string-match regexp g-name)
+           (push g-name groups)))
      gnus-active-hashtb)
     ;; Also go through all descriptions that are known to Gnus.
     (when search-description
-      (mapatoms
-       (lambda (group)
-        (and (string-match regexp (symbol-value group))
-             (push (symbol-name group) groups)))
-       gnus-description-hashtb))
+      (dolist (g-name (hash-table-keys gnus-description-hashtb))
+       (when (string-match regexp g-name)
+         (push g-name groups))))
     (if (not groups)
        (gnus-message 3 "No groups matched \"%s\"." regexp)
       ;; Print out all the groups.
@@ -4226,8 +4202,8 @@ If DONT-SCAN is non-nil, scan non-activated groups as 
well."
            (let ((charset (gnus-group-name-charset nil prev)))
              (insert (gnus-group-name-decode prev charset) "\n")
              (when (and gnus-description-hashtb
-                        (setq des (gnus-gethash (car groups)
-                                                gnus-description-hashtb)))
+                        (setq des (gethash (car groups)
+                                           gnus-description-hashtb)))
                (insert "  " (gnus-group-name-decode des charset) "\n"))))
          (setq groups (cdr groups)))
        (goto-char (point-min))))
@@ -4472,7 +4448,7 @@ and the second element is the address."
     (let* ((entry (gnus-group-entry
                   (or method-only-group (gnus-info-group info))))
           (part-info info)
-          (info (if method-only-group (nth 2 entry) info))
+          (info (if method-only-group (nth 1 entry) info))
           method)
       (when method-only-group
        (unless entry
@@ -4514,7 +4490,7 @@ and the second element is the address."
       ;; can do the update.
       (if entry
          (progn
-           (setcar (nthcdr 2 entry) info)
+           (setcar (nthcdr 1 entry) info)
            (when (and (not (eq (car entry) t))
                       (gnus-active (gnus-info-group info)))
              (setcar entry (length
@@ -4582,8 +4558,7 @@ and the second element is the address."
 This function can be used in hooks like `gnus-select-group-hook'
 or `gnus-group-catchup-group-hook'."
   (when gnus-newsgroup-name
-    (let ((time (current-time)))
-      (setcdr (cdr time) nil)
+    (let ((time (encode-time nil 'integer)))
       (gnus-group-set-parameter gnus-newsgroup-name 'timestamp time))))
 
 (defsubst gnus-group-timestamp (group)
@@ -4592,11 +4567,11 @@ or `gnus-group-catchup-group-hook'."
 
 (defun gnus-group-timestamp-delta (group)
   "Return the offset in seconds from the timestamp for GROUP to the current 
time, as a floating point number."
-  (let* ((time (or (gnus-group-timestamp group)
-                  (list 0 0)))
-        (delta (time-subtract nil time)))
-    (+ (* (nth 0 delta) 65536.0)
-       (nth 1 delta))))
+  ;; FIXME: This should return a Lisp integer, not a Lisp float,
+  ;; since it is always an integer.
+  (let* ((time (or (gnus-group-timestamp group) 0))
+        (delta (time-since time)))
+    (float-time delta)))
 
 (defun gnus-group-timestamp-string (group)
   "Return a string of the timestamp for GROUP."
@@ -4624,11 +4599,11 @@ This command may read the active file."
                 (assq 'cache marks)))
           lowest
           #'(lambda (group)
-              (or (gnus-gethash group
-                                gnus-cache-active-hashtb)
+              (or (gethash group
+                           gnus-cache-active-hashtb)
                   ;; Cache active file might use "."
                   ;; instead of ":".
-                  (gnus-gethash
+                  (gethash
                    (mapconcat 'identity
                               (split-string group ":")
                               ".")
diff --git a/lisp/gnus/gnus-html.el b/lisp/gnus/gnus-html.el
index f097028..f36c389 100644
--- a/lisp/gnus/gnus-html.el
+++ b/lisp/gnus/gnus-html.el
@@ -1,6 +1,6 @@
 ;;; gnus-html.el --- Render HTML in a buffer.
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: html, web
diff --git a/lisp/gnus/gnus-icalendar.el b/lisp/gnus/gnus-icalendar.el
index 3365c82..28020a1 100644
--- a/lisp/gnus/gnus-icalendar.el
+++ b/lisp/gnus/gnus-icalendar.el
@@ -1,6 +1,6 @@
-;;; gnus-icalendar.el --- reply to iCalendar meeting requests
+;;; gnus-icalendar.el --- reply to iCalendar meeting requests  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Jan Tatarik <address@hidden>
 ;; Keywords: mail, icalendar, org
@@ -147,7 +147,7 @@
                        (icalendar--get-event-property-attributes
                         event field) zone-map))
          (dtdate-dec (icalendar--decode-isodatetime dtdate nil dtdate-zone)))
-    (apply 'encode-time dtdate-dec)))
+    (encode-time dtdate-dec)))
 
 (defun gnus-icalendar-event--find-attendee (ical name-or-email)
   (let* ((event (car (icalendar--all-events ical)))
@@ -244,7 +244,7 @@
                                (map-property ical-property))
                               args)))))
       (mapc #'accumulate-args prop-map)
-      (apply 'make-instance event-class args))))
+      (apply #'make-instance event-class args))))
 
 (defun gnus-icalendar-event-from-buffer (buf &optional attendee-name-or-email)
   "Parse RFC5545 iCalendar in buffer BUF and return an event object.
@@ -301,7 +301,8 @@ status will be retrieved from the first matching attendee 
record."
                     ((string= key "DTSTAMP") (update-dtstamp))
                     ((member key '("ORGANIZER" "DTSTART" "DTEND"
                                    "LOCATION" "DURATION" "SEQUENCE"
-                                   "RECURRENCE-ID" "UID")) line)
+                                   "RECURRENCE-ID" "UID"))
+                      line)
                     (t nil))))
              (when new-line
                (push new-line reply-event-lines))))))
@@ -352,9 +353,9 @@ on the IDENTITIES list."
 
 ;;;
 ;;; gnus-icalendar-org
-;;;
-;;; TODO: this is an optional feature, and it's only available with org-mode
-;;; 7+, so will need to properly handle emacsen with no/outdated org-mode
+;;
+;; TODO: this is an optional feature, and it's only available with org-mode
+;; 7+, so will need to properly handle emacsen with no/outdated org-mode
 
 (require 'org)
 (require 'org-capture)
@@ -367,23 +368,19 @@ on the IDENTITIES list."
 
 (defcustom gnus-icalendar-org-capture-file nil
   "Target Org file for storing captured calendar events."
-  :type '(choice (const nil) file)
-  :group 'gnus-icalendar-org)
+  :type '(choice (const nil) file))
 
 (defcustom gnus-icalendar-org-capture-headline nil
   "Target outline in `gnus-icalendar-org-capture-file' for storing captured 
events."
-  :type '(repeat string)
-  :group 'gnus-icalendar-org)
+  :type '(repeat string))
 
 (defcustom gnus-icalendar-org-template-name "used by gnus-icalendar-org"
   "Org-mode template name."
-  :type '(string)
-  :group 'gnus-icalendar-org)
+  :type '(string))
 
 (defcustom gnus-icalendar-org-template-key "#"
   "Org-mode template hotkey."
-  :type '(string)
-  :group 'gnus-icalendar-org)
+  :type '(string))
 
 (defvar gnus-icalendar-org-enabled-p nil)
 
@@ -413,13 +410,12 @@ Return nil for non-recurring EVENT."
          (end-time (format-time-string "%H:%M" end))
          (end-at-midnight (string= end-time "00:00"))
          (start-end-date-diff
-         (/ (float-time (time-subtract
-                         (org-time-string-to-time end-date)
-                         (org-time-string-to-time start-date)))
-            86400))
+         (time-to-number-of-days (time-subtract
+                                  (org-time-string-to-time end-date)
+                                  (org-time-string-to-time start-date))))
          (org-repeat (gnus-icalendar-event:org-repeat event))
          (repeat (if org-repeat (concat " " org-repeat) ""))
-         (time-1-day '(0 86400)))
+        (time-1-day 86400))
 
     ;; NOTE: special care is needed with appointments ending at midnight
     ;; (typically all-day events): the end time has to be changed to 23:59 to
@@ -655,10 +651,7 @@ is searched."
 (defun gnus-icalendar-show-org-agenda (event)
   (let* ((time-delta (time-subtract (gnus-icalendar-event:end-time event)
                                     (gnus-icalendar-event:start-time event)))
-         (duration-days (1+ (/ (+ (* (car time-delta) (expt 2 16))
-                                  (cadr time-delta))
-                               86400))))
-
+         (duration-days (1+ (floor (encode-time time-delta 'integer) 86400))))
     (org-agenda-list nil (gnus-icalendar-event:start event) duration-days)))
 
 (cl-defmethod gnus-icalendar-event:sync-to-org ((event 
gnus-icalendar-event-request) reply-status)
@@ -666,7 +659,7 @@ is searched."
       (gnus-icalendar--update-org-event event reply-status)
     (gnus-icalendar:org-event-save event reply-status)))
 
-(cl-defmethod gnus-icalendar-event:sync-to-org ((event 
gnus-icalendar-event-cancel) reply-status)
+(cl-defmethod gnus-icalendar-event:sync-to-org ((event 
gnus-icalendar-event-cancel) _reply-status)
   (when (gnus-icalendar-find-org-event-file event)
     (gnus-icalendar--cancel-org-event event)))
 
@@ -689,8 +682,7 @@ is searched."
 
 (defcustom gnus-icalendar-reply-bufname "*CAL*"
   "Buffer used for building iCalendar invitation reply."
-  :type '(string)
-  :group 'gnus-icalendar)
+  :type '(string))
 
 (defcustom gnus-icalendar-additional-identities nil
   "We need to know your identity to make replies to calendar requests work.
@@ -706,17 +698,13 @@ Your identity is guessed automatically from the variables
 If you need even more aliases you can define them here.  It really
 only makes sense to define names or email addresses."
 
-  :type '(repeat string)
-  :group 'gnus-icalendar)
+  :type '(repeat string))
 
-(make-variable-buffer-local
- (defvar gnus-icalendar-reply-status nil))
+(defvar-local gnus-icalendar-reply-status nil)
 
-(make-variable-buffer-local
- (defvar gnus-icalendar-event nil))
+(defvar-local gnus-icalendar-event nil)
 
-(make-variable-buffer-local
- (defvar gnus-icalendar-handle nil))
+(defvar-local gnus-icalendar-handle nil)
 
 (defun gnus-icalendar-identities ()
   "Return list of regexp-quoted names and email addresses belonging to the 
user.
@@ -742,7 +730,8 @@ These will be used to retrieve the RSVP information from 
ical events."
                              (cadr x))))
 
     (with-slots (organizer summary description location recur uid
-                           method rsvp participation-type) event
+                           method rsvp participation-type)
+        event
       (let ((headers `(("Summary" ,summary)
                       ("Location" ,(or location ""))
                       ("Time" ,(gnus-icalendar-event:org-timestamp event))
@@ -848,7 +837,7 @@ These will be used to retrieve the RSVP information from 
ical events."
       ("Tentative" gnus-icalendar-reply (,handle tentative ,event))
       ("Decline" gnus-icalendar-reply (,handle declined ,event)))))
 
-(cl-defmethod gnus-icalendar-event:inline-reply-buttons ((event 
gnus-icalendar-event-reply) handle)
+(cl-defmethod gnus-icalendar-event:inline-reply-buttons ((_event 
gnus-icalendar-event-reply) _handle)
   "No buttons for REPLY events."
   nil)
 
@@ -857,7 +846,7 @@ These will be used to retrieve the RSVP information from 
ical events."
         (gnus-icalendar--get-org-event-reply-status event))
       "Not replied yet"))
 
-(cl-defmethod gnus-icalendar-event:inline-reply-status ((event 
gnus-icalendar-event-reply))
+(cl-defmethod gnus-icalendar-event:inline-reply-status ((_event 
gnus-icalendar-event-reply))
   "No reply status for REPLY events."
   nil)
 
@@ -884,7 +873,7 @@ These will be used to retrieve the RSVP information from 
ical events."
                (when org-entry-exists-p
                  `("Show Org Entry" gnus-icalendar--show-org-event ,event))))))
 
-
+;;;###autoload
 (defun gnus-icalendar-mm-inline (handle)
   (let ((event (gnus-icalendar-event-from-handle handle 
(gnus-icalendar-identities))))
 
@@ -896,7 +885,7 @@ These will be used to retrieve the RSVP information from 
ical events."
            (buttons)
            (when buttons
              (mapc (lambda (x)
-                     (apply 'gnus-icalendar-insert-button x)
+                     (apply #'gnus-icalendar-insert-button x)
                      (insert "    "))
                    buttons)
              (insert "\n\n"))))
@@ -977,6 +966,9 @@ These will be used to retrieve the RSVP information from 
ical events."
 (defvar gnus-mime-action-alist)         ; gnus-art
 
 (defun gnus-icalendar-setup ()
+  ;; FIXME: Get rid of this!
+  ;; The three add-to-list are now redundant (good), but I think the rest
+  ;; is still not automatically setup.
   (add-to-list 'mm-inlined-types "text/calendar")
   (add-to-list 'mm-automatic-display "text/calendar")
   (add-to-list 'mm-inline-media-tests '("text/calendar" 
gnus-icalendar-mm-inline identity))
@@ -991,7 +983,7 @@ These will be used to retrieve the RSVP information from 
ical events."
 
   (require 'gnus-art)
   (add-to-list 'gnus-mime-action-alist
-               (cons "save calendar event" 'gnus-icalendar-save-event)
+               (cons "save calendar event" #'gnus-icalendar-save-event)
                t))
 
 (provide 'gnus-icalendar)
diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el
index 5d5f9eb..e23e53b 100644
--- a/lisp/gnus/gnus-int.el
+++ b/lisp/gnus/gnus-int.el
@@ -1,6 +1,6 @@
 ;;; gnus-int.el --- backend interface functions for Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -257,7 +257,8 @@ If it is down, start it up (again)."
       (insert (format-time-string "%H:%M:%S")
              (format " %.2fs %s %S\n"
                      (if (numberp gnus-backend-trace-elapsed)
-                         (- (float-time) gnus-backend-trace-elapsed)
+                         (float-time
+                          (time-since gnus-backend-trace-elapsed))
                        0)
                      type form))
       (setq gnus-backend-trace-elapsed (float-time)))))
diff --git a/lisp/gnus/gnus-kill.el b/lisp/gnus/gnus-kill.el
index 60732c1..a7ded39 100644
--- a/lisp/gnus/gnus-kill.el
+++ b/lisp/gnus/gnus-kill.el
@@ -1,6 +1,6 @@
 ;;; gnus-kill.el --- kill commands for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <address@hidden>
 ;;     Lars Magne Ingebrigtsen <address@hidden>
@@ -29,11 +29,6 @@
 (require 'gnus-art)
 (require 'gnus-range)
 
-(defcustom gnus-kill-file-mode-hook nil
-  "Hook for Gnus kill file mode."
-  :group 'gnus-score-kill
-  :type 'hook)
-
 (defcustom gnus-kill-expiry-days 7
   "Number of days before expiring unused kill file entries."
   :group 'gnus-score-kill
diff --git a/lisp/gnus/gnus-logic.el b/lisp/gnus/gnus-logic.el
index 2076d8a..90f7420 100644
--- a/lisp/gnus/gnus-logic.el
+++ b/lisp/gnus/gnus-logic.el
@@ -1,6 +1,6 @@
 ;;; gnus-logic.el --- advanced scoring code for Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -162,9 +162,9 @@
     (funcall type (or (aref gnus-advanced-headers index) 0) match)))
 
 (defun gnus-advanced-date (index match type)
-  (let ((date (apply 'encode-time (parse-time-string
-                                  (aref gnus-advanced-headers index))))
-       (match (apply 'encode-time (parse-time-string match))))
+  (let ((date (encode-time (parse-time-string
+                           (aref gnus-advanced-headers index))))
+       (match (encode-time (parse-time-string match))))
     (cond
      ((eq type 'at)
       (equal date match))
diff --git a/lisp/gnus/gnus-mh.el b/lisp/gnus/gnus-mh.el
index e91d4f8..1420d70 100644
--- a/lisp/gnus/gnus-mh.el
+++ b/lisp/gnus/gnus-mh.el
@@ -1,6 +1,6 @@
 ;;; gnus-mh.el --- mh-e interface for Gnus
 
-;; Copyright (C) 1994-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <address@hidden>
 ;;     Lars Magne Ingebrigtsen <address@hidden>
diff --git a/lisp/gnus/gnus-ml.el b/lisp/gnus/gnus-ml.el
index 1c67f5f..6a264e0 100644
--- a/lisp/gnus/gnus-ml.el
+++ b/lisp/gnus/gnus-ml.el
@@ -1,6 +1,6 @@
 ;;; gnus-ml.el --- Mailing list minor mode for Gnus
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Julien Gilles  <address@hidden>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/gnus-mlspl.el b/lisp/gnus/gnus-mlspl.el
index 599b9c6..e9c0de9 100644
--- a/lisp/gnus/gnus-mlspl.el
+++ b/lisp/gnus/gnus-mlspl.el
@@ -1,6 +1,6 @@
 ;;; gnus-mlspl.el --- a group params-based mail splitting mechanism
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Alexandre Oliva <address@hidden>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el
index 660bdf7..b6d649d 100644
--- a/lisp/gnus/gnus-msg.el
+++ b/lisp/gnus/gnus-msg.el
@@ -1,6 +1,6 @@
 ;;; gnus-msg.el --- mail and post interface for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <address@hidden>
 ;;     Lars Magne Ingebrigtsen <address@hidden>
@@ -1542,7 +1542,7 @@ If YANK is non-nil, include the original article."
                        (X-Debbugs-Version
                         . ,(format "%s" (gnus-continuum-version))))))
     (when gnus-bug-create-help-buffer
-      (push `(gnus-bug-kill-buffer) message-send-actions))
+      (push '(gnus-bug-kill-buffer) message-send-actions))
     (goto-char (point-min))
     (message-goto-body)
     (insert "\n\n\n\n\n")
diff --git a/lisp/gnus/gnus-notifications.el b/lisp/gnus/gnus-notifications.el
index 1703df2..3476164 100644
--- a/lisp/gnus/gnus-notifications.el
+++ b/lisp/gnus/gnus-notifications.el
@@ -1,6 +1,6 @@
 ;; gnus-notifications.el -- Send notification on new message in Gnus
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Julien Danjou <address@hidden>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-picon.el b/lisp/gnus/gnus-picon.el
index b6bb5c9..18b46a1 100644
--- a/lisp/gnus/gnus-picon.el
+++ b/lisp/gnus/gnus-picon.el
@@ -1,6 +1,6 @@
 ;;; gnus-picon.el --- displaying pretty icons in Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news xpm annotation glyph faces
diff --git a/lisp/gnus/gnus-range.el b/lisp/gnus/gnus-range.el
index dd37935..b775def 100644
--- a/lisp/gnus/gnus-range.el
+++ b/lisp/gnus/gnus-range.el
@@ -1,6 +1,6 @@
 ;;; gnus-range.el --- range and sequence functions for Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el
index 229d057..634cf92 100644
--- a/lisp/gnus/gnus-registry.el
+++ b/lisp/gnus/gnus-registry.el
@@ -1,6 +1,6 @@
 ;;; gnus-registry.el --- article registry for Gnus
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Ted Zlatanov <address@hidden>
 ;; Keywords: news registry
diff --git a/lisp/gnus/gnus-rfc1843.el b/lisp/gnus/gnus-rfc1843.el
index 4b96845..344ac55 100644
--- a/lisp/gnus/gnus-rfc1843.el
+++ b/lisp/gnus/gnus-rfc1843.el
@@ -1,6 +1,6 @@
 ;;; gnus-rfc1843.el --- HZ (rfc1843) decoding interface functions for Gnus
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <address@hidden>
 ;; Keywords: news HZ HZ+ mail i18n
diff --git a/lisp/gnus/gnus-salt.el b/lisp/gnus/gnus-salt.el
index aff8417..58c05e0 100644
--- a/lisp/gnus/gnus-salt.el
+++ b/lisp/gnus/gnus-salt.el
@@ -1,6 +1,6 @@
 ;;; gnus-salt.el --- alternate summary mode interfaces for Gnus
 
-;; Copyright (C) 1996-1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -396,11 +396,6 @@ Two predefined functions are available:
                (function :tag "Other" nil))
   :group 'gnus-summary-tree)
 
-(defcustom gnus-tree-mode-hook nil
-  "Hook run in tree mode buffers."
-  :type 'hook
-  :group 'gnus-summary-tree)
-
 ;;; Internal variables.
 
 (defvar gnus-tmp-name)
@@ -411,7 +406,7 @@ Two predefined functions are available:
 (defvar gnus-tmp-subject)
 
 (defvar gnus-tree-line-format-alist
-  `((?n gnus-tmp-name ?s)
+  '((?n gnus-tmp-name ?s)
     (?f gnus-tmp-from ?s)
     (?N gnus-tmp-number ?d)
     (?\[ gnus-tmp-open-bracket ?c)
@@ -445,8 +440,6 @@ Two predefined functions are available:
      'undefined 'gnus-tree-read-summary-keys map)
     map))
 
-(put 'gnus-tree-mode 'mode-class 'special)
-
 (defun gnus-tree-make-menu-bar ()
   (unless (boundp 'gnus-tree-menu)
     (easy-menu-define
@@ -454,7 +447,7 @@ Two predefined functions are available:
       '("Tree"
        ["Select article" gnus-tree-select-article t]))))
 
-(define-derived-mode gnus-tree-mode fundamental-mode "Tree"
+(define-derived-mode gnus-tree-mode gnus-mode "Tree"
   "Major mode for displaying thread trees."
   (gnus-set-format 'tree-mode)
   (gnus-set-format 'tree t)
diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el
index 327cc69..2faf0f9 100644
--- a/lisp/gnus/gnus-score.el
+++ b/lisp/gnus/gnus-score.el
@@ -1,6 +1,6 @@
 ;;; gnus-score.el --- scoring code for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <address@hidden>
 ;;     Lars Magne Ingebrigtsen <address@hidden>
@@ -1501,7 +1501,7 @@ If FORMAT, also format the current score file."
       (when (and gnus-summary-default-score
                 scores)
        (let* ((entries gnus-header-index)
-              (now (date-to-day (current-time-string)))
+              (now (time-to-days nil))
               (expire (and gnus-score-expiry-days
                            (- now gnus-score-expiry-days)))
               (headers gnus-newsgroup-headers)
@@ -2234,8 +2234,7 @@ score in `gnus-newsgroup-scored' by SCORE."
          (let* ((score (or (nth 1 kill) gnus-score-interactive-default-score))
                 (date (nth 2 kill))
                 found)
-           (when (setq arts (intern-soft (nth 0 kill) hashtb))
-             (setq arts (symbol-value arts))
+           (when (setq arts (gethash (nth 0 kill) hashtb))
              (setq found t)
              (if trace
                  (while (setq art (pop arts))
@@ -2273,11 +2272,11 @@ score in `gnus-newsgroup-scored' by SCORE."
     (with-syntax-table gnus-adaptive-word-syntax-table
       (while (re-search-forward "\\b\\w+\\b" nil t)
        (setq val
-             (gnus-gethash
+             (gethash
               (setq word (downcase (buffer-substring
                                     (match-beginning 0) (match-end 0))))
               hashtb))
-       (gnus-sethash
+       (puthash
         word
         (append (get-text-property (point-at-eol) 'articles) val)
         hashtb)))
@@ -2289,7 +2288,7 @@ score in `gnus-newsgroup-scored' by SCORE."
                                "."))
                           gnus-default-ignored-adaptive-words)))
       (while ignored
-       (gnus-sethash (pop ignored) nil hashtb)))))
+       (remhash (pop ignored) hashtb)))))
 
 (defun gnus-score-string< (a1 a2)
   ;; Compare headers in articles A2 and A2.
@@ -2380,7 +2379,7 @@ score in `gnus-newsgroup-scored' by SCORE."
               (memq 'word gnus-newsgroup-adaptive))
       (with-temp-buffer
        (let* ((hashtb (gnus-make-hashtable 1000))
-              (date (date-to-day (current-time-string)))
+              (date (time-to-days nil))
               (data gnus-newsgroup-data)
               word d score val)
          (with-syntax-table gnus-adaptive-word-syntax-table
@@ -2400,8 +2399,8 @@ score in `gnus-newsgroup-scored' by SCORE."
                (goto-char (point-min))
                (while (re-search-forward "\\b\\w+\\b" nil t)
                  ;; Put the word and score into the hashtb.
-                 (setq val (gnus-gethash (setq word (match-string 0))
-                                         hashtb))
+                 (setq val (gethash (setq word (match-string 0))
+                                    hashtb))
                  (when (or (not gnus-adaptive-word-length-limit)
                            (> (length word)
                               gnus-adaptive-word-length-limit))
@@ -2409,7 +2408,7 @@ score in `gnus-newsgroup-scored' by SCORE."
                    (if (and gnus-adaptive-word-minimum
                             (< val gnus-adaptive-word-minimum))
                        (setq val gnus-adaptive-word-minimum))
-                   (gnus-sethash word val hashtb)))
+                   (puthash word val hashtb)))
                (erase-buffer))))
          ;; Make all the ignorable words ignored.
          (let ((ignored (append gnus-ignored-adaptive-words
@@ -2420,16 +2419,14 @@ score in `gnus-newsgroup-scored' by SCORE."
                                      "."))
                                 gnus-default-ignored-adaptive-words)))
            (while ignored
-             (gnus-sethash (pop ignored) nil hashtb)))
+             (remhash (pop ignored) hashtb)))
          ;; Now we have all the words and scores, so we
          ;; add these rules to the ADAPT file.
          (set-buffer gnus-summary-buffer)
-         (mapatoms
-          (lambda (word)
-            (when (symbol-value word)
-              (gnus-summary-score-entry
-               "subject" (symbol-name word) 'w (symbol-value word)
-               date nil t)))
+         (maphash
+          (lambda (word val)
+            (gnus-summary-score-entry
+             "subject" word 'w val date nil t))
           hashtb))))))
 
 (defun gnus-score-edit-done ()
diff --git a/lisp/gnus/gnus-sieve.el b/lisp/gnus/gnus-sieve.el
index f09478d..fc0bf30 100644
--- a/lisp/gnus/gnus-sieve.el
+++ b/lisp/gnus/gnus-sieve.el
@@ -1,6 +1,6 @@
 ;;; gnus-sieve.el --- Utilities to manage sieve scripts for Gnus
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: NAGY Andras <address@hidden>,
 ;;     Simon Josefsson <address@hidden>
diff --git a/lisp/gnus/gnus-spec.el b/lisp/gnus/gnus-spec.el
index 379a7f2..b236f0a 100644
--- a/lisp/gnus/gnus-spec.el
+++ b/lisp/gnus/gnus-spec.el
@@ -1,6 +1,6 @@
 ;;; gnus-spec.el --- format spec functions for Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -271,9 +271,7 @@ Return a list of updated types."
               (insert " ")))
         (insert-char ?  (max (- ,column (current-column)) 0))))))
 
-(defun gnus-correct-length (string)
-  "Return the correct width of STRING."
-  (apply #'+ (mapcar #'char-width string)))
+(define-obsolete-function-alias 'gnus-correct-length 'string-width "27.1")
 
 (defun gnus-correct-substring (string start &optional end)
   (let ((wstart 0)
diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el
index dfca5e9..76a0f7d 100644
--- a/lisp/gnus/gnus-srvr.el
+++ b/lisp/gnus/gnus-srvr.el
@@ -1,6 +1,6 @@
 ;;; gnus-srvr.el --- virtual server support for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -36,11 +36,6 @@
 
 (autoload 'gnus-group-make-nnir-group "nnir")
 
-(defcustom gnus-server-mode-hook nil
-  "Hook run in `gnus-server-mode' buffers."
-  :group 'gnus-server
-  :type 'hook)
-
 (defcustom gnus-server-exit-hook nil
   "Hook run when exiting the server buffer."
   :group 'gnus-server
@@ -92,7 +87,7 @@ If nil, a faster, but more primitive, buffer is used instead."
 (defvar gnus-inserted-opened-servers nil)
 
 (defvar gnus-server-line-format-alist
-  `((?h gnus-tmp-how ?s)
+  '((?h gnus-tmp-how ?s)
     (?n gnus-tmp-name ?s)
     (?w gnus-tmp-where ?s)
     (?s gnus-tmp-status ?s)
@@ -100,7 +95,7 @@ If nil, a faster, but more primitive, buffer is used 
instead."
     (?c gnus-tmp-cloud ?s)))
 
 (defvar gnus-server-mode-line-format-alist
-  `((?S gnus-tmp-news-server ?s)
+  '((?S gnus-tmp-news-server ?s)
     (?M gnus-tmp-news-method ?s)
     (?u gnus-tmp-user-defined ?s)))
 
@@ -108,7 +103,7 @@ If nil, a faster, but more primitive, buffer is used 
instead."
 (defvar gnus-server-mode-line-format-spec nil)
 (defvar gnus-server-killed-servers nil)
 
-(defvar gnus-server-mode-map)
+(defvar gnus-server-mode-map nil)
 
 (defcustom gnus-server-menu-hook nil
   "Hook run after the creation of the server mode menu."
@@ -150,11 +145,8 @@ If nil, a faster, but more primitive, buffer is used 
instead."
 
     (gnus-run-hooks 'gnus-server-menu-hook)))
 
-(defvar gnus-server-mode-map nil)
-(put 'gnus-server-mode 'mode-class 'special)
-
 (unless gnus-server-mode-map
-  (setq gnus-server-mode-map (make-sparse-keymap))
+  (setq gnus-server-mode-map (make-keymap))
   (suppress-keymap gnus-server-mode-map)
 
   (gnus-define-keys gnus-server-mode-map
@@ -253,9 +245,8 @@ If nil, a faster, but more primitive, buffer is used 
instead."
     ("(\\(offline\\))" 1 'gnus-server-offline)
     ("(\\(denied\\))" 1 'gnus-server-denied)))
 
-(defun gnus-server-mode ()
+(define-derived-mode gnus-server-mode gnus-mode "Server"
   "Major mode for listing and editing servers.
-
 All normal editing commands are switched off.
 \\<gnus-server-mode-map>
 For more in-depth information on this mode, read the manual
@@ -264,23 +255,16 @@ For more in-depth information on this mode, read the 
manual
 The following commands are available:
 
 \\{gnus-server-mode-map}"
-  ;; FIXME: Use define-derived-mode.
-  (interactive)
   (when (gnus-visual-p 'server-menu 'menu)
     (gnus-server-make-menu-bar))
-  (kill-all-local-variables)
   (gnus-simplify-mode-line)
-  (setq major-mode 'gnus-server-mode)
-  (setq mode-name "Server")
   (gnus-set-default-directory)
   (setq mode-line-process nil)
-  (use-local-map gnus-server-mode-map)
   (buffer-disable-undo)
   (setq truncate-lines t)
-  (setq buffer-read-only t)
   (set (make-local-variable 'font-lock-defaults)
-       '(gnus-server-font-lock-keywords t))
-  (gnus-run-mode-hooks 'gnus-server-mode-hook))
+       '(gnus-server-font-lock-keywords t)))
+
 
 (defun gnus-server-insert-server-line (name method)
   (let* ((gnus-tmp-name name)
@@ -320,21 +304,15 @@ The following commands are available:
 
 (defun gnus-enter-server-buffer ()
   "Set up the server buffer."
-  (gnus-server-setup-buffer)
   (gnus-configure-windows 'server)
   ;; Usually `gnus-configure-windows' will finish with the
   ;; `gnus-server-buffer' selected as the current buffer, but not always (I
   ;; bumped into it when starting from a dedicated *Group* frame, and
   ;; gnus-configure-windows opened *Server* into its own dedicated frame).
-  (with-current-buffer (get-buffer gnus-server-buffer)
+  (with-current-buffer (get-buffer-create gnus-server-buffer)
+    (gnus-server-mode)
     (gnus-server-prepare)))
 
-(defun gnus-server-setup-buffer ()
-  "Initialize the server buffer."
-  (unless (get-buffer gnus-server-buffer)
-    (with-current-buffer (gnus-get-buffer-create gnus-server-buffer)
-      (gnus-server-mode))))
-
 (defun gnus-server-prepare ()
   (gnus-set-format 'server-mode)
   (gnus-set-format 'server t)
@@ -648,8 +626,8 @@ The following commands are available:
   (let ((info (gnus-server-to-method server)))
     (gnus-edit-form
      info "Showing the server."
-     `(lambda (form)
-       (gnus-server-position-point))
+     (lambda (form)
+       (gnus-server-position-point))
      'edit-server)))
 
 (defun gnus-server-scan-server (server)
@@ -717,9 +695,7 @@ claim them."
                function
                (repeat function)))
 
-(defvar gnus-browse-mode-hook nil)
 (defvar gnus-browse-mode-map nil)
-(put 'gnus-browse-mode 'mode-class 'special)
 
 (unless gnus-browse-mode-map
   (setq gnus-browse-mode-map (make-keymap))
@@ -897,9 +873,8 @@ claim them."
       (gnus-message 5 "Connecting to %s...done" (nth 1 method))
       t))))
 
-(define-derived-mode gnus-browse-mode fundamental-mode "Browse Server"
+(define-derived-mode gnus-browse-mode gnus-mode "Browse Server"
   "Major mode for browsing a foreign server.
-
 All normal editing commands are switched off.
 
 \\<gnus-browse-mode-map>
@@ -918,14 +893,17 @@ buffer.
   (setq mode-line-process nil)
   (buffer-disable-undo)
   (setq truncate-lines t)
-  (gnus-set-default-directory)
-  (setq buffer-read-only t))
+  (gnus-set-default-directory))
 
 (defun gnus-browse-read-group (&optional no-article number)
   "Enter the group at the current line.
 If NUMBER, fetch this number of articles."
   (interactive "P")
-  (let ((group (gnus-browse-group-name)))
+  (let* ((full-name (gnus-browse-group-name))
+        (group (if (gnus-native-method-p
+                    (gnus-find-method-for-group full-name))
+                   (gnus-group-short-name full-name)
+                 full-name)))
     (if (or (not (gnus-get-info group))
            (gnus-ephemeral-group-p group))
        (unless (gnus-group-read-ephemeral-group
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index f15d645..9b1be65 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -1,6 +1,6 @@
 ;;; gnus-start.el --- startup functions for Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -543,29 +543,21 @@ Can be used to turn version control on or off."
                (message "Descend hierarchy %s? ([y]nsq): "
                         (substring prefix 1 (1- (length prefix)))))
              (cond ((= ans ?n)
-                    (while (and groups
-                                (setq group (car groups)
-                                      real-group (gnus-group-real-name group))
-                                (string-match prefix real-group))
-                      (push group gnus-killed-list)
-                      (gnus-sethash group group gnus-killed-hashtb)
-                      (setq groups (cdr groups)))
+                    (dolist (g groups)
+                      (when (string-match prefix (gnus-group-real-name g))
+                        (push g gnus-killed-list)
+                        (puthash g t gnus-killed-hashtb)))
                     (setq starts (cdr starts)))
                    ((= ans ?s)
-                    (while (and groups
-                                (setq group (car groups)
-                                      real-group (gnus-group-real-name group))
-                                (string-match prefix real-group))
-                      (gnus-sethash group group gnus-killed-hashtb)
-                      (gnus-subscribe-alphabetically (car groups))
-                      (setq groups (cdr groups)))
+                    (dolist (g groups)
+                      (when (string-match prefix (gnus-group-real-name g))
+                        (puthash g t gnus-killed-hashtb)
+                        (gnus-subscribe-alphabetically g)))
                     (setq starts (cdr starts)))
                    ((= ans ?q)
-                    (while groups
-                      (setq group (car groups))
-                      (push group gnus-killed-list)
-                      (gnus-sethash group group gnus-killed-hashtb)
-                      (setq groups (cdr groups))))
+                    (dolist (g groups)
+                      (push g gnus-killed-list)
+                      (puthash g t gnus-killed-hashtb)))
                    (t nil)))
          (message "Subscribe %s? ([n]yq)" (car groups))
          (while (not (memq (setq ans (read-char-exclusive))
@@ -575,16 +567,14 @@ Can be used to turn version control on or off."
          (setq group (car groups))
          (cond ((= ans ?y)
                 (gnus-subscribe-alphabetically (car groups))
-                (gnus-sethash group group gnus-killed-hashtb))
+                (puthash group t gnus-killed-hashtb))
                ((= ans ?q)
-                (while groups
-                  (setq group (car groups))
-                  (push group gnus-killed-list)
-                  (gnus-sethash group group gnus-killed-hashtb)
-                  (setq groups (cdr groups))))
+                (dolist (g groups)
+                  (push g gnus-killed-list)
+                  (puthash g t gnus-killed-hashtb)))
                (t
                 (push group gnus-killed-list)
-                (gnus-sethash group group gnus-killed-hashtb)))
+                (puthash group t gnus-killed-hashtb)))
          (setq groups (cdr groups)))))))
 
 (defun gnus-subscribe-randomly (newsgroup)
@@ -647,7 +637,7 @@ the first newsgroup."
     ;; We subscribe the group by changing its level to `subscribed'.
     (gnus-group-change-level
      newsgroup gnus-level-default-subscribed
-     gnus-level-killed (gnus-group-entry (or next "dummy.group")))
+     gnus-level-killed (or next "dummy.group"))
     (gnus-request-update-group-status newsgroup 'subscribe)
     (gnus-message 5 "Subscribe newsgroup: %s" newsgroup)
     (run-hook-with-args 'gnus-subscribe-newsgroup-functions newsgroup)
@@ -696,6 +686,7 @@ the first newsgroup."
         gnus-agent-file-loading-cache nil
         gnus-server-method-cache nil
        gnus-newsrc-alist nil
+       gnus-group-list nil
        gnus-newsrc-hashtb nil
        gnus-killed-list nil
        gnus-zombie-list nil
@@ -1018,7 +1009,7 @@ If LEVEL is non-nil, the news will be set up at level 
LEVEL."
              (eq gnus-read-active-file 'some))
       (gnus-update-active-hashtb-from-killed))
     (unless gnus-active-hashtb
-      (setq gnus-active-hashtb (gnus-make-hashtable 4096)))
+      (setq gnus-active-hashtb (gnus-make-hashtable 4000)))
     ;; Initialize the cache.
     (when gnus-use-cache
       (gnus-cache-open))
@@ -1108,7 +1099,7 @@ for new groups, and subscribe the new groups as zombies."
         (gnus-ask-server-for-new-groups)
       ;; Go through the active hashtb and look for new groups.
       (let ((groups 0)
-            group new-newsgroups)
+            new-newsgroups)
         (gnus-message 5 "Looking for new newsgroups...")
         (unless gnus-have-read-active-file
           (gnus-read-active-file))
@@ -1117,30 +1108,26 @@ for new groups, and subscribe the new groups as 
zombies."
           (gnus-make-hashtable-from-killed))
         ;; Go though every newsgroup in `gnus-active-hashtb' and compare
         ;; with `gnus-newsrc-hashtb' and `gnus-killed-hashtb'.
-        (mapatoms
-         (lambda (sym)
-           (if (or (null (setq group (symbol-name sym)))
-                   (not (boundp sym))
-                   (null (symbol-value sym))
-                   (gnus-gethash group gnus-killed-hashtb)
-                   (gnus-gethash group gnus-newsrc-hashtb))
-               ()
-             (let ((do-sub (gnus-matches-options-n group)))
+        (maphash
+         (lambda (g-name active)
+           (unless (or (gethash g-name gnus-killed-hashtb)
+                       (gethash g-name gnus-newsrc-hashtb))
+             (let ((do-sub (gnus-matches-options-n g-name)))
                (cond
                 ((eq do-sub 'subscribe)
                  (setq groups (1+ groups))
-                 (gnus-sethash group group gnus-killed-hashtb)
+                 (puthash g-name t gnus-killed-hashtb)
                  (gnus-call-subscribe-functions
-                  gnus-subscribe-options-newsgroup-method group))
+                  gnus-subscribe-options-newsgroup-method g-name))
                 ((eq do-sub 'ignore)
                  nil)
                 (t
                  (setq groups (1+ groups))
-                 (gnus-sethash group group gnus-killed-hashtb)
+                 (puthash g-name t gnus-killed-hashtb)
                  (if gnus-subscribe-hierarchical-interactive
-                     (push group new-newsgroups)
+                     (push g-name new-newsgroups)
                    (gnus-call-subscribe-functions
-                    gnus-subscribe-newsgroup-method group)))))))
+                    gnus-subscribe-newsgroup-method g-name)))))))
          gnus-active-hashtb)
         (when new-newsgroups
           (gnus-subscribe-hierarchical-interactive new-newsgroups))
@@ -1213,36 +1200,32 @@ for new groups, and subscribe the new groups as 
zombies."
          ;; Enter all the new groups into a hashtable.
          (gnus-active-to-gnus-format method hashtb 'ignore))
        ;; Now all new groups from `method' are in `hashtb'.
-       (mapatoms
-        (lambda (group-sym)
-          (if (or (null (setq group (symbol-name group-sym)))
-                  (not (boundp group-sym))
-                  (null (symbol-value group-sym))
-                  (gnus-gethash group gnus-newsrc-hashtb)
-                  (member group gnus-zombie-list)
-                  (member group gnus-killed-list))
-              ;; The group is already known.
-              ()
+       (maphash
+        (lambda (g-name val)
+          (unless (or (null val) ; The group is already known.
+                      (gethash g-name gnus-newsrc-hashtb)
+                      (member g-name gnus-zombie-list)
+                      (member g-name gnus-killed-list))
             ;; Make this group active.
-            (when (symbol-value group-sym)
-              (gnus-set-active group (symbol-value group-sym)))
+            (when val
+              (gnus-set-active g-name val))
             ;; Check whether we want it or not.
-            (let ((do-sub (gnus-matches-options-n group)))
+            (let ((do-sub (gnus-matches-options-n g-name)))
               (cond
                ((eq do-sub 'subscribe)
                 (cl-incf groups)
-                (gnus-sethash group group gnus-killed-hashtb)
+                (puthash g-name group gnus-killed-hashtb)
                 (gnus-call-subscribe-functions
-                 gnus-subscribe-options-newsgroup-method group))
+                 gnus-subscribe-options-newsgroup-method g-name))
                ((eq do-sub 'ignore)
                 nil)
                (t
                 (cl-incf groups)
-                (gnus-sethash group group gnus-killed-hashtb)
+                (puthash g-name group gnus-killed-hashtb)
                 (if gnus-subscribe-hierarchical-interactive
-                    (push group new-newsgroups)
+                    (push g-name new-newsgroups)
                   (gnus-call-subscribe-functions
-                   gnus-subscribe-newsgroup-method group)))))))
+                   gnus-subscribe-newsgroup-method g-name)))))))
         hashtb))
       (when new-newsgroups
        (gnus-subscribe-hierarchical-interactive new-newsgroups)))
@@ -1263,29 +1246,28 @@ for new groups, and subscribe the new groups as 
zombies."
    gnus-level-default-subscribed gnus-level-killed previous t)
   t)
 
-;; `gnus-group-change-level' is the fundamental function for changing
-;; subscription levels of newsgroups.  This might mean just changing
-;; from level 1 to 2, which is pretty trivial, from 2 to 6 or back
-;; again, which subscribes/unsubscribes a group, which is equally
-;; trivial.  Changing from 1-7 to 8-9 means that you kill a group, and
-;; from 8-9 to 1-7 means that you remove the group from the list of
-;; killed (or zombie) groups and add them to the (kinda) subscribed
-;; groups.  And last but not least, moving from 8 to 9 and 9 to 8,
-;; which is trivial.
-;; ENTRY can either be a string (newsgroup name) or a list (if
-;; FROMKILLED is t, it's a list on the format (NUM INFO-LIST),
-;; otherwise it's a list in the format of the `gnus-newsrc-hashtb'
-;; entries.
-;; LEVEL is the new level of the group, OLDLEVEL is the old level and
-;; PREVIOUS is the group (in hashtb entry format) to insert this group
-;; after.
+
 (defun gnus-group-change-level (entry level &optional oldlevel
                                      previous fromkilled)
+  "Change level of group ENTRY to LEVEL.
+This is the fundamental function for changing subscription levels
+of newsgroups.  This might mean just changing from level 1 to 2,
+which is pretty trivial, from 2 to 6 or back again, which
+subscribes/unsubscribes a group, which is equally trivial.
+Changing from 1-7 to 8-9 means that you kill a group, and from
+8-9 to 1-7 means that you remove the group from the list of
+killed (or zombie) groups and add them to the (kinda) subscribed
+groups.  And last but not least, moving from 8 to 9 and 9 to 8,
+which is trivial.  ENTRY can either be a string (newsgroup name)
+or a list (if FROMKILLED is t, it's a list on the format (NUM
+INFO-LIST), otherwise it's a list in the format of the
+`gnus-newsrc-hashtb' entries.  LEVEL is the new level of the
+group, OLDLEVEL is the old level and PREVIOUS is the group (a
+string name) to insert this group after."
   (let (group info active num)
-    ;; Glean what info we can from the arguments
+    ;; Glean what info we can from the arguments.
     (if (consp entry)
-       (if fromkilled (setq group (nth 1 entry))
-         (setq group (car (nth 2 entry))))
+       (setq group (if fromkilled (nth 1 entry) (car (nth 1 entry))))
       (setq group entry))
     (when (and (stringp entry)
               oldlevel
@@ -1293,21 +1275,17 @@ for new groups, and subscribe the new groups as 
zombies."
       (setq entry (gnus-group-entry entry)))
     (if (and (not oldlevel)
             (consp entry))
-       (setq oldlevel (gnus-info-level (nth 2 entry)))
+       (setq oldlevel (gnus-info-level (nth 1 entry)))
       (setq oldlevel (or oldlevel gnus-level-killed)))
     (when (stringp previous)
       (setq previous (gnus-group-entry previous)))
-
-    (if (and (>= oldlevel gnus-level-zombie)
-            (gnus-group-entry group))
-       ;; We are trying to subscribe a group that is already
-       ;; subscribed.
-       ()                              ; Do nothing.
-
+    ;; Group is already subscribed.
+    (unless (and (>= oldlevel gnus-level-zombie)
+                (gnus-group-entry group))
       (unless (gnus-ephemeral-group-p group)
        (gnus-dribble-enter
         (format "(gnus-group-change-level %S %S %S %S %S)"
-                group level oldlevel (car (nth 2 previous)) fromkilled)))
+                group level oldlevel previous fromkilled)))
 
       ;; Then we remove the newgroup from any old structures, if needed.
       ;; If the group was killed, we remove it from the killed or zombie
@@ -1321,11 +1299,10 @@ for new groups, and subscribe the new groups as 
zombies."
        (t
        (when (and (>= level gnus-level-zombie)
                   entry)
-         (gnus-sethash (car (nth 2 entry)) nil gnus-newsrc-hashtb)
-         (when (nth 3 entry)
-           (setcdr (gnus-group-entry (car (nth 3 entry)))
-                   (cdr entry)))
-         (setcdr (cdr entry) (cdddr entry)))))
+         (remhash (car (nth 1 entry)) gnus-newsrc-hashtb)
+         (setq gnus-group-list (remove group gnus-group-list))
+         (setq gnus-newsrc-alist (delq (assoc group gnus-newsrc-alist)
+                                       gnus-newsrc-alist)))))
 
       ;; Finally we enter (if needed) the list where it is supposed to
       ;; go, and change the subscription level.  If it is to be killed,
@@ -1333,12 +1310,13 @@ for new groups, and subscribe the new groups as 
zombies."
       (cond
        ((>= level gnus-level-zombie)
        ;; Remove from the hash table.
-       (gnus-sethash group nil gnus-newsrc-hashtb)
+       (remhash group gnus-newsrc-hashtb)
+       (setq gnus-group-list (remove group gnus-group-list))
        (if (= level gnus-level-zombie)
            (push group gnus-zombie-list)
          (if (= oldlevel gnus-level-killed)
              ;; Remove from active hashtb.
-             (unintern group gnus-active-hashtb)
+             (remhash group gnus-active-hashtb)
            ;; Don't add it into killed-list if it was killed.
            (push group gnus-killed-list))))
        (t
@@ -1349,7 +1327,7 @@ for new groups, and subscribe the new groups as zombies."
            ;; It was alive, and it is going to stay alive, so we
            ;; just change the level and don't change any pointers or
            ;; hash table entries.
-           (setcar (cdaddr entry) level)
+           (setcar (cdadr entry) level)
          (if (listp entry)
              (setq info (cdr entry)
                    num (car entry))
@@ -1364,23 +1342,16 @@ for new groups, and subscribe the new groups as 
zombies."
              (if method
                  (setq info (list group level nil nil method))
                (setq info (list group level nil)))))
-         (unless previous
-           (setq previous
-                 (let ((p gnus-newsrc-alist))
-                   (while (cddr p)
-                     (setq p (cdr p)))
-                   p)))
-         (setq entry (cons info (cddr previous)))
-         (if (cdr previous)
-             (progn
-               (setcdr (cdr previous) entry)
-               (gnus-sethash group (cons num (cdr previous))
-                             gnus-newsrc-hashtb))
-           (setcdr previous entry)
-           (gnus-sethash group (cons num previous)
-                         gnus-newsrc-hashtb))
-         (when (cdr entry)
-           (setcdr (gnus-group-entry (caadr entry)) entry))
+         ;; Add group.  The exact ordering only matters for
+         ;; `gnus-group-list', though we need to keep the dummy group
+         ;; at the head of `gnus-newsrc-alist'.
+         (push info (cdr gnus-newsrc-alist))
+         (puthash group (list num info) gnus-newsrc-hashtb)
+         (let* ((prev-idx (seq-position gnus-group-list (caadr previous)))
+                (idx (if prev-idx
+                         (1+ prev-idx)
+                       (length gnus-group-list))))
+           (push group (nthcdr idx gnus-group-list)))
          (gnus-dribble-enter
           (format "(gnus-group-set-info '%S)" info)
           (concat "^(gnus-group-set-info '(\"" (regexp-quote group) "\"")))))
@@ -1455,7 +1426,7 @@ newsgroup."
   (defun gnus-cache-possibly-alter-active (group active)
     "Alter the ACTIVE info for GROUP to reflect the articles in the cache."
     (when gnus-cache-active-hashtb
-      (let ((cache-active (gnus-gethash group gnus-cache-active-hashtb)))
+      (let ((cache-active (gethash group gnus-cache-active-hashtb)))
        (when cache-active
          (when (< (car cache-active) (car active))
            (setcar active (car cache-active)))
@@ -1837,19 +1808,24 @@ backend check whether the group actually exists."
       (dolist (info infos)
        (gnus-activate-group (gnus-info-group info) nil nil method t))))))
 
-;; Create a hash table out of the newsrc alist.  The `car's of the
-;; alist elements are used as keys.
 (defun gnus-make-hashtable-from-newsrc-alist ()
+  "Create a hash table from `gnus-newsrc-alist'.
+The keys are group names, and values are a cons of (unread info),
+where unread is an integer count of calculated unread
+messages (or nil), and info is a regular gnus info entry.
+
+The info element is shared with the same element of
+`gnus-newrc-alist', so as to conserve space."
   (let ((alist gnus-newsrc-alist)
        (ohashtb gnus-newsrc-hashtb)
-       prev info method rest methods)
+       info method gname rest methods)
     (setq gnus-newsrc-hashtb (gnus-make-hashtable (length alist)))
     (setq alist
-         (setq prev (setq gnus-newsrc-alist
-                          (if (equal (caar gnus-newsrc-alist)
-                                     "dummy.group")
-                              gnus-newsrc-alist
-                            (cons (list "dummy.group" 0 nil) alist)))))
+         (setq gnus-newsrc-alist
+               (if (equal (caar gnus-newsrc-alist)
+                          "dummy.group")
+                   gnus-newsrc-alist
+                 (cons (list "dummy.group" 0 nil) alist))))
     (while alist
       (setq info (car alist))
       ;; Make the same select-methods identical Lisp objects.
@@ -1858,17 +1834,18 @@ backend check whether the group actually exists."
            (gnus-info-set-method info (car rest))
          (push method methods)))
       ;; Check for duplicates.
-      (if (gnus-gethash (car info) gnus-newsrc-hashtb)
+      (if (gethash (car info) gnus-newsrc-hashtb)
          ;; Remove this entry from the alist.
-         (setcdr prev (cddr prev))
-       (gnus-sethash
+         (setcdr alist (cddr alist))
+       (puthash
         (car info)
         ;; Preserve number of unread articles in groups.
-        (cons (and ohashtb (car (gnus-gethash (car info) ohashtb)))
-              prev)
+        (list (and ohashtb (car (gethash (car info) ohashtb)))
+              info)
         gnus-newsrc-hashtb)
-       (setq prev alist))
+       (push (car info) gnus-group-list))
       (setq alist (cdr alist)))
+    (setq gnus-group-list (nreverse gnus-group-list))
     ;; Make the same select-methods in `gnus-server-alist' identical
     ;; as well.
     (while methods
@@ -1883,10 +1860,10 @@ backend check whether the group actually exists."
     (setq gnus-killed-hashtb
          (gnus-make-hashtable
           (+ (length gnus-killed-list) (length gnus-zombie-list))))
-    (while lists
-      (setq list (symbol-value (pop lists)))
-      (while list
-       (gnus-sethash (car list) (pop list) gnus-killed-hashtb)))))
+    (dolist (g (append gnus-killed-list gnus-zombie-list))
+      ;; NOTE: We have lost the ordering that used to be kept in this
+      ;; variable.
+      (puthash g t gnus-killed-hashtb))))
 
 (defun gnus-parse-active ()
   "Parse active info in the nntp server buffer."
@@ -1900,7 +1877,7 @@ backend check whether the group actually exists."
 
 (defun gnus-make-articles-unread (group articles)
   "Mark ARTICLES in GROUP as unread."
-  (let* ((info (nth 2 (or (gnus-group-entry group)
+  (let* ((info (nth 1 (or (gnus-group-entry group)
                          (gnus-group-entry
                           (gnus-group-real-name group)))))
         (ranges (gnus-info-read info))
@@ -1924,7 +1901,7 @@ backend check whether the group actually exists."
   "Mark ascending ARTICLES in GROUP as unread."
   (let* ((entry (or (gnus-group-entry group)
                     (gnus-group-entry (gnus-group-real-name group))))
-         (info (nth 2 entry))
+         (info (nth 1 entry))
         (ranges (gnus-info-read info))
          (r ranges)
         modified)
@@ -1987,12 +1964,11 @@ backend check whether the group actually exists."
       ;; Insert the change into the group buffer and the dribble file.
       (gnus-group-update-group group t))))
 
-;; Enter all dead groups into the hashtb.
 (defun gnus-update-active-hashtb-from-killed ()
-  (let ((hashtb (setq gnus-active-hashtb (gnus-make-hashtable 4096))))
-    (dolist (list (list gnus-killed-list gnus-zombie-list))
-      (dolist (group list)
-       (gnus-sethash group nil hashtb)))))
+  (let ((hashtb (setq gnus-active-hashtb
+                     (gnus-make-hashtable 4000))))
+    (dolist (g (append gnus-killed-list gnus-zombie-list))
+      (remhash g hashtb))))
 
 (defun gnus-get-killed-groups ()
   "Go through the active hashtb and mark all unknown groups as killed."
@@ -2003,20 +1979,16 @@ backend check whether the group actually exists."
   (unless gnus-killed-hashtb
     (gnus-make-hashtable-from-killed))
   ;; Go through all newsgroups that are known to Gnus - enlarge kill list.
-  (mapatoms
-   (lambda (sym)
-     (let ((groups 0)
-          (group (symbol-name sym)))
-       (if (or (null group)
-              (gnus-gethash group gnus-killed-hashtb)
-              (gnus-gethash group gnus-newsrc-hashtb))
-          ()
-        (let ((do-sub (gnus-matches-options-n group)))
-          (if (or (eq do-sub 'subscribe) (eq do-sub 'ignore))
-              ()
+  (maphash
+   (lambda (g-name active)
+     (let ((groups 0))
+       (unless (or (gethash g-name gnus-killed-hashtb)
+                  (gethash g-name gnus-newsrc-hashtb))
+        (let ((do-sub (gnus-matches-options-n g-name)))
+          (unless (or (eq do-sub 'subscribe) (eq do-sub 'ignore))
             (setq groups (1+ groups))
-            (push group gnus-killed-list)
-            (gnus-sethash group group gnus-killed-hashtb))))))
+            (push g-name gnus-killed-list)
+            (puthash g-name t gnus-killed-hashtb))))))
    gnus-active-hashtb)
   (gnus-dribble-touch))
 
@@ -2129,11 +2101,13 @@ backend check whether the group actually exists."
                             (not (equal method gnus-select-method)))
                        gnus-active-hashtb
                      (setq gnus-active-hashtb
-                           (if (equal method gnus-select-method)
-                               (gnus-make-hashtable
-                                (count-lines (point-min) (point-max)))
-                             (gnus-make-hashtable 4096))))))
+                           (gnus-make-hashtable
+                            (if (equal method gnus-select-method)
+                                (count-lines (point-min) (point-max))
+                              4000))))))
        group max min)
+    (unless gnus-moderated-hashtb
+      (setq gnus-moderated-hashtb (gnus-make-hashtable 100)))
     ;; Delete unnecessary lines.
     (goto-char (point-min))
     (cond
@@ -2143,12 +2117,6 @@ backend check whether the group actually exists."
       (delete-matching-lines (concat "^to\\.\\|" gnus-ignored-newsgroups))))
 
     (goto-char (point-min))
-    (unless (re-search-forward "[\\\"]" nil t)
-      ;; Make the group names readable as a lisp expression even if they
-      ;; contain special characters.
-      (goto-char (point-max))
-      (while (re-search-backward "[][';?()#]" nil t)
-       (insert ?\\)))
 
     ;; Let the Gnus agent save the active file.
     (when (and gnus-agent real-active (gnus-online method))
@@ -2168,49 +2136,38 @@ backend check whether the group actually exists."
                      (insert prefix)
                      (zerop (forward-line 1)))))))
     ;; Store the active file in a hash table.
-    ;; Use a unibyte buffer in order to make `read' read non-ASCII
-    ;; group names (which have been encoded) as unibyte strings.
-    (mm-with-unibyte-buffer
+
+    (with-temp-buffer
       (insert-buffer-substring cur)
       (setq cur (current-buffer))
       (goto-char (point-min))
       (while (not (eobp))
        (condition-case ()
-           (progn
-             (narrow-to-region (point) (point-at-eol))
-             ;; group gets set to a symbol interned in the hash table
-             ;; (what a hack!!) - jwz
-             (setq group (let ((obarray hashtb)) (read cur)))
-             ;; ### The extended group name scheme makes
-             ;; the previous optimization strategy sort of pointless...
-             (when (stringp group)
-               (setq group (intern group hashtb)))
-             (if (and (numberp (setq max (read cur)))
-                      (numberp (setq min (read cur)))
-                      (progn
-                        (skip-chars-forward " \t")
-                        (not
-                         (or (eq (char-after) ?=)
-                             (eq (char-after) ?x)
-                             (eq (char-after) ?j)))))
-                 (progn
-                   (set group (cons min max))
-                   ;; if group is moderated, stick in moderation table
-                   (when (eq (char-after) ?m)
-                     (unless gnus-moderated-hashtb
-                       (setq gnus-moderated-hashtb (gnus-make-hashtable)))
-                     (gnus-sethash (symbol-name group) t
-                                   gnus-moderated-hashtb)))
-               (set group nil)))
+           (if (and (stringp (progn
+                               (setq group (read cur)
+                                     group (cond ((numberp group)
+                                                  (number-to-string group))
+                                                 ((symbolp group)
+                                                  (symbol-name group))
+                                                 ((stringp group)
+                                                  group)))))
+                    (numberp (setq max (read cur)))
+                    (numberp (setq min (read cur)))
+                    (null (progn
+                            (skip-chars-forward " \t")
+                            (memq (char-after)
+                                  '(?= ?x ?j)))))
+               (progn (puthash group (cons min max) hashtb)
+                      ;; If group is moderated, stick it in the
+                      ;; moderation cache.
+                      (when (eq (char-after) ?m)
+                        (puthash group t gnus-moderated-hashtb)))
+             (setq group nil))
          (error
-          (and group
-               (symbolp group)
-               (set group nil))
           (unless ignore-errors
             (gnus-message 3 "Warning - invalid active: %s"
                           (buffer-substring
                            (point-at-bol) (point-at-eol))))))
-       (widen)
        (forward-line 1)))))
 
 (defun gnus-groups-to-gnus-format (method &optional hashtb real-active)
@@ -2238,35 +2195,23 @@ backend check whether the group actually exists."
          (gnus-active-to-gnus-format method hashtb nil real-active))
 
       (goto-char (point-min))
-      ;; We split this into to separate loops, one with the prefix
-      ;; and one without to speed the reading up somewhat.
-      (if prefix
-         (let (min max opoint group)
-           (while (not (eobp))
-             (condition-case ()
-                 (progn
-                   (read cur) (read cur)
-                   (setq min (read cur)
-                         max (read cur)
-                         opoint (point))
-                   (skip-chars-forward " \t")
-                   (insert prefix)
-                   (goto-char opoint)
-                   (set (let ((obarray hashtb)) (read cur))
-                        (cons min max)))
-               (error (and group (symbolp group) (set group nil))))
-             (forward-line 1)))
-       (let (min max group)
-         (while (not (eobp))
-           (condition-case ()
-               (when (eq (char-after) ?2)
-                 (read cur) (read cur)
-                 (setq min (read cur)
-                       max (read cur))
-                 (set (setq group (let ((obarray hashtb)) (read cur)))
-                      (cons min max)))
-             (error (and group (symbolp group) (set group nil))))
-           (forward-line 1)))))))
+      (let (min max group)
+       (while (not (eobp))
+         (condition-case ()
+             (when (eq (char-after) ?2)
+               (read cur) (read cur)
+               (setq min (read cur)
+                     max (read cur)
+                     group (read cur)
+                     group (if (numberp group)
+                               (number-to-string group)
+                             (symbol-name group)))
+               (puthash (if prefix
+                            (concat prefix group)
+                            group)
+                        (cons min max) hashtb))
+           (error (remhash group hashtb)))
+         (forward-line 1))))))
 
 (defun gnus-read-newsrc-file (&optional force)
   "Read startup file.
@@ -2529,16 +2474,11 @@ If FORCE is non-nil, the .newsrc file is read."
   (setq gnus-newsrc-options-n nil)
 
   (unless gnus-active-hashtb
-    (setq gnus-active-hashtb (gnus-make-hashtable 4096)))
+    (setq gnus-active-hashtb (gnus-make-hashtable 4000)))
   (let ((buf (current-buffer))
        (already-read (> (length gnus-newsrc-alist) 1))
-       group subscribed options-symbol newsrc Options-symbol
-       symbol reads num1)
+       group subscribed newsrc reads num1)
     (goto-char (point-min))
-    ;; We intern the symbol `options' in the active hashtb so that we
-    ;; can `eq' against it later.
-    (set (setq options-symbol (intern "options" gnus-active-hashtb)) nil)
-    (set (setq Options-symbol (intern "Options" gnus-active-hashtb)) nil)
 
     (while (not (eobp))
       ;; We first read the first word on the line by narrowing and
@@ -2549,15 +2489,16 @@ If FORCE is non-nil, the .newsrc file is read."
        (point)
        (progn (skip-chars-forward "^ \t!:\n") (point)))
       (goto-char (point-min))
-      (setq symbol
+      (setq group
            (and (/= (point-min) (point-max))
-                (let ((obarray gnus-active-hashtb)) (read buf))))
+                (read buf))
+           group (if (numberp group)
+                     (number-to-string group)
+                   (symbol-name group)))
       (widen)
-      ;; Now, the symbol we have read is either `options' or a group
-      ;; name.  If it is an options line, we just add it to a string.
       (cond
-       ((or (eq symbol options-symbol)
-           (eq symbol Options-symbol))
+       ;; It's possible that "group" is actually an options line.
+       ((string-equal (downcase group) "options")
        (setq gnus-newsrc-options
              ;; This concatting is quite inefficient, but since our
              ;; thorough studies show that approx 99.37% of all
@@ -2571,19 +2512,13 @@ If FORCE is non-nil, the .newsrc file is read."
                                (point-at-bol))
                           (point)))))
        (forward-line -1))
-       (symbol
-       ;; Group names can be just numbers.
-       (when (numberp symbol)
-         (setq symbol (intern (int-to-string symbol) gnus-active-hashtb)))
-       (unless (boundp symbol)
-         (set symbol nil))
+       (group
        ;; It was a group name.
        (setq subscribed (eq (char-after) ?:)
-             group (symbol-name symbol)
              reads nil)
        (if (eolp)
            ;; If the line ends here, this is clearly a buggy line, so
-           ;; we put point a the beginning of line and let the cond
+           ;; we put point at the beginning of line and let the cond
            ;; below do the error handling.
            (beginning-of-line)
          ;; We skip to the beginning of the ranges.
@@ -2622,7 +2557,7 @@ If FORCE is non-nil, the .newsrc file is read."
                ;; It was just a simple number, so we add it to the
                ;; list of ranges.
                (push num1 reads))
-             ;; If the next char in ?\n, then we have reached the end
+             ;; If the next char is ?\n, then we have reached the end
              ;; of the line and return nil.
              (not (eq (char-after) ?\n)))
             ((eq (char-after) ?\n)
@@ -2651,7 +2586,8 @@ If FORCE is non-nil, the .newsrc file is read."
          (let ((info (gnus-get-info group))
                level)
            (if info
-               ;; There is an entry for this file in the alist.
+               ;; There is an entry for this file in
+               ;; `gnus-newsrc-hashtb'.
                (progn
                  (gnus-info-set-read info (nreverse reads))
                  ;; We update the level very gently.  In fact, we
@@ -2679,8 +2615,7 @@ If FORCE is non-nil, the .newsrc file is read."
 
     (setq newsrc (nreverse newsrc))
 
-    (if (not already-read)
-       ()
+    (unless already-read
       ;; We now have two newsrc lists - `newsrc', which is what we
       ;; have read from .newsrc, and `gnus-newsrc-alist', which is
       ;; what we've read from .newsrc.eld.  We have to merge these
@@ -2777,9 +2712,10 @@ If FORCE is non-nil, the .newsrc file is read."
 
 (defvar gnus-save-newsrc-file-last-timestamp nil)
 (defun gnus-save-newsrc-file (&optional force)
-  "Save .newsrc file."
-  ;; Note: We cannot save .newsrc file if all newsgroups are removed
-  ;; from the variable gnus-newsrc-alist.
+  "Save .newsrc file.
+Use the group string names in `gnus-group-list' to pull info
+values from `gnus-newsrc-hashtb', and write a new value of
+`gnus-newsrc-alist'."
   (when (and (or gnus-newsrc-alist gnus-killed-list)
             gnus-current-startup-file)
     ;; Save agent range limits for the currently active method.
@@ -2895,7 +2831,13 @@ If FORCE is non-nil, the .newsrc file is read."
        (gnus-group-set-mode-line)))))
 
 (defun gnus-gnus-to-quick-newsrc-format (&optional minimal name &rest 
specific-variables)
-  "Print Gnus variables such as `gnus-newsrc-alist' in Lisp format."
+  "Print Gnus variables such as `gnus-newsrc-alist' in Lisp format.
+Unless optional argument MINIMAL is non-nil, print human-readable
+information in the header of the file, including the file
+version.  If NAME is present, print that as part of the header.
+
+Variables printed are either the variables specified in
+SPECIFIC-VARIABLES, or those in `gnus-variable-list'."
     (princ (format ";; -*- mode:emacs-lisp; coding: %s; -*-\n"
                   gnus-ding-file-coding-system))
     (if name
@@ -2929,9 +2871,18 @@ If FORCE is non-nil, the .newsrc file is read."
                  ;; Remove the `gnus-killed-list' from the list of variables
                  ;; to be saved, if required.
                  (delq 'gnus-killed-list (copy-sequence gnus-variable-list)))))
-          ;; Peel off the "dummy" group.
-          (gnus-newsrc-alist (cdr gnus-newsrc-alist))
           variable)
+      ;; A bit of a fake-out here: the original value of
+      ;; `gnus-newsrc-alist' isn't written to file, instead it is
+      ;; constructed at the last minute by combining the group
+      ;; ordering in `gnus-group-list' with the group infos from
+      ;; `gnus-newsrc-hashtb'.
+      (set (nth (seq-position gnus-variable-list 'gnus-newsrc-alist)
+               gnus-variable-list)
+          (mapcar (lambda (g)
+                    (nth 1 (gethash g gnus-newsrc-hashtb)))
+                  (delete "dummy.group" gnus-group-list)))
+
       ;; Insert the variables into the file.
       (while variables
        (when (and (boundp (setq variable (pop variables)))
@@ -2956,8 +2907,8 @@ If FORCE is non-nil, the .newsrc file is read."
   (interactive (list (gnus-y-or-n-p "write foreign groups too? ")))
   ;; Generate and save the .newsrc file.
   (with-current-buffer (create-file-buffer gnus-current-startup-file)
-    (let ((newsrc (cdr gnus-newsrc-alist))
-         (standard-output (current-buffer))
+    (let ((standard-output (current-buffer))
+         (groups (delete "dummy.group" (copy-sequence gnus-group-list)))
          info ranges range method)
       (setq buffer-file-name gnus-current-startup-file)
       (setq default-directory (file-name-directory buffer-file-name))
@@ -2971,13 +2922,14 @@ If FORCE is non-nil, the .newsrc file is read."
       (when gnus-newsrc-options
        (insert gnus-newsrc-options))
       ;; Write subscribed and unsubscribed.
-      (while (setq info (pop newsrc))
-       ;; Don't write foreign groups to .newsrc.
+      (dolist (g-name groups)
+       (setq info (nth 1 (gnus-group-entry g-name)))
+       ;; Maybe don't write foreign groups to .newsrc.
        (when (or (null (setq method (gnus-info-method info)))
                  (equal method "native")
                  (inline (gnus-server-equal method gnus-select-method))
                   foreign-ok)
-         (insert (gnus-info-group info)
+         (insert g-name
                  (if (> (gnus-info-level info) gnus-level-subscribed)
                      "!" ":"))
          (when (setq ranges (gnus-info-read info))
@@ -3105,10 +3057,10 @@ If FORCE is non-nil, the .newsrc file is read."
     ;; to avoid trying to re-read after a failed read.
     (unless gnus-description-hashtb
       (setq gnus-description-hashtb
-           (gnus-make-hashtable (length gnus-active-hashtb))))
+           (gnus-make-hashtable (hash-table-size gnus-active-hashtb))))
     ;; Mark this method's desc file as read.
-    (gnus-sethash (gnus-group-prefixed-name "" method) "Has read"
-                 gnus-description-hashtb)
+    (puthash (gnus-group-prefixed-name "" method) "Has read"
+            gnus-description-hashtb)
 
     (gnus-message 5 "Reading descriptions file via %s..." (car method))
     (cond
@@ -3144,29 +3096,26 @@ If FORCE is non-nil, the .newsrc file is read."
                                    (zerop (forward-line 1)))))))
          (goto-char (point-min))
          (while (not (eobp))
-           ;; If we get an error, we set group to 0, which is not a
-           ;; symbol...
            (setq group
                  (condition-case ()
-                     (let ((obarray gnus-description-hashtb))
-                       ;; Group is set to a symbol interned in this
-                       ;; hash table.
-                       (read nntp-server-buffer))
-                   (error 0)))
+                     (read nntp-server-buffer)
+                   (error nil)))
            (skip-chars-forward " \t")
-           ;; ...  which leads to this line being effectively ignored.
-           (when (symbolp group)
+           (when group
+             (setq group (if (numberp group)
+                             (number-to-string group)
+                           (symbol-name group)))
              (let* ((str (buffer-substring
                           (point) (progn (end-of-line) (point))))
-                    (name (symbol-name group))
                     (charset
-                     (or (gnus-group-name-charset method name)
-                         (gnus-parameter-charset name)
+                     (or (gnus-group-name-charset method group)
+                         (gnus-parameter-charset group)
                          gnus-default-charset)))
                ;; Fixme: Don't decode in unibyte mode.
+               ;; Double fixme: We're not in unibyte mode, are we?
                (when (and str charset)
                  (setq str (decode-coding-string str charset)))
-               (set group str)))
+               (puthash group str gnus-description-hashtb)))
            (forward-line 1))))
       (gnus-message 5 "Reading descriptions file...done")
       t))))
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index f9fae37..f09c0fb 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -1,6 +1,6 @@
 ;;; gnus-sum.el --- summary mode commands for Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -39,6 +39,8 @@
 (require 'gmm-utils)
 (require 'mm-decode)
 (require 'nnoo)
+(eval-when-compile
+  (require 'subr-x))
 
 (autoload 'gnus-summary-limit-include-cached "gnus-cache" nil t)
 (autoload 'gnus-cache-write-active "gnus-cache")
@@ -946,13 +948,6 @@ This variable is local to the summary buffers."
   :type '(choice (const :tag "off" nil)
                 integer))
 
-(defcustom gnus-summary-mode-hook nil
-  "A hook for Gnus summary mode.
-This hook is run before any variables are set in the summary buffer."
-  :options '(turn-on-gnus-mailing-list-mode gnus-pick-mode)
-  :group 'gnus-summary-various
-  :type 'hook)
-
 (defcustom gnus-summary-menu-hook nil
   "Hook run after the creation of the summary mode menu."
   :group 'gnus-summary-visual
@@ -1368,7 +1363,15 @@ the normal Gnus MIME machinery."
 (defvar gnus-current-crosspost-group nil)
 (defvar gnus-newsgroup-display nil)
 
-(defvar gnus-newsgroup-dependencies nil)
+(defvar gnus-newsgroup-dependencies nil
+  "A hash table holding dependencies between messages.")
+;; Dependencies are held in a tree structure: a list with the root
+;; message as car, and each immediate child a sublist (perhaps
+;; containing further sublists).  Each message is represented as a
+;; vector of headers.  Each message's list can be looked up in the
+;; dependency table using the message's Message-ID as the key.  The
+;; root key is the string "none".
+
 (defvar gnus-newsgroup-adaptive nil)
 (defvar gnus-summary-display-article-function nil)
 (defvar gnus-summary-highlight-line-function nil
@@ -1430,12 +1433,12 @@ These are paired with what variables they correspond 
with, along with
 the type of the variable (string, integer, character, etc).")
 
 (defvar gnus-summary-dummy-line-format-alist
-  `((?S gnus-tmp-subject ?s)
+  '((?S gnus-tmp-subject ?s)
     (?N gnus-tmp-number ?d)
     (?u gnus-tmp-user-defined ?s)))
 
 (defvar gnus-summary-mode-line-format-alist
-  `((?G gnus-tmp-group-name ?s)
+  '((?G gnus-tmp-group-name ?s)
     (?g (gnus-short-group-name gnus-tmp-group-name) ?s)
     (?p (gnus-group-real-name gnus-tmp-group-name) ?s)
     (?A gnus-tmp-article-number ?d)
@@ -1842,8 +1845,6 @@ increase the score of each group you read."
 ;;; Gnus summary mode
 ;;;
 
-(put 'gnus-summary-mode 'mode-class 'special)
-
 (defvar gnus-article-commands-menu)
 
 ;; Non-orthogonal keys
@@ -2604,7 +2605,7 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs))))
 
     (easy-menu-define
       gnus-summary-post-menu gnus-summary-mode-map ""
-      `("Post"
+      '("Post"
        ["Send a message (mail or news)" gnus-summary-post-news
         :help "Compose a new message (mail or news)"]
        ["Followup" gnus-summary-followup
@@ -2665,7 +2666,7 @@ gnus-summary-show-article-from-menu-as-charset-%s" cs))))
 
     (easy-menu-define
       gnus-summary-misc-menu gnus-summary-mode-map ""
-      `("Gnus"
+      '("Gnus"
        ("Mark Read"
         ["Mark as read" gnus-summary-mark-as-read-forward t]
         ["Mark same subject and select"
@@ -3052,10 +3053,13 @@ When FORCE, rebuild the tool bar."
 
 (defvar bidi-paragraph-direction)
 
-(defun gnus-summary-mode (&optional group)
-  "Major mode for reading articles.
+(defvar gnus-summary-mode-group nil
+  "Variable for communication with `gnus-summary-mode'.
+Allows the `gnus-newsgroup-name' local variable to be set before
+the summary mode hooks are run.")
 
-All normal editing commands are switched off.
+(define-derived-mode gnus-summary-mode gnus-mode "Summary"
+  "Major mode for reading articles.
 \\<gnus-summary-mode-map>
 Each line in this buffer represents one article.  To read an
 article, you can, for instance, type `\\[gnus-summary-next-page]'.  To move 
forwards
@@ -3072,24 +3076,17 @@ buffer; read the info pages for more information 
(`\\[gnus-info-find-node]').
 The following commands are available:
 
 \\{gnus-summary-mode-map}"
-  ;; FIXME: Use define-derived-mode.
-  (interactive)
-  (kill-all-local-variables)
   (let ((gnus-summary-local-variables gnus-newsgroup-variables))
     (gnus-summary-make-local-variables))
   (gnus-summary-make-local-variables)
-  (setq gnus-newsgroup-name group)
+  (setq gnus-newsgroup-name gnus-summary-mode-group)
   (when (gnus-visual-p 'summary-menu 'menu)
     (gnus-summary-make-menu-bar)
     (gnus-summary-make-tool-bar))
   (gnus-make-thread-indent-array)
   (gnus-simplify-mode-line)
-  (setq major-mode 'gnus-summary-mode)
-  (setq mode-name "Summary")
-  (use-local-map gnus-summary-mode-map)
   (buffer-disable-undo)
-  (setq buffer-read-only t
-       show-trailing-whitespace nil
+  (setq show-trailing-whitespace nil
        truncate-lines t
        bidi-paragraph-direction 'left-to-right)
   (add-to-invisibility-spec '(gnus-sum . t))
@@ -3100,14 +3097,13 @@ The following commands are available:
   (make-local-variable 'gnus-summary-dummy-line-format)
   (make-local-variable 'gnus-summary-dummy-line-format-spec)
   (make-local-variable 'gnus-summary-mark-positions)
+  (make-local-variable 'gnus-article-buffer)
+  (make-local-variable 'gnus-article-current)
+  (make-local-variable 'gnus-original-article-buffer)
   (add-hook 'pre-command-hook 'gnus-set-global-variables nil t)
-  (gnus-run-mode-hooks 'gnus-summary-mode-hook)
-  (turn-on-gnus-mailing-list-mode)
   (mm-enable-multibyte)
   (set (make-local-variable 'bookmark-make-record-function)
-       'gnus-summary-bookmark-make-record)
-  (gnus-update-format-specifications nil 'summary 'summary-mode 'summary-dummy)
-  (gnus-update-summary-mark-positions))
+       'gnus-summary-bookmark-make-record))
 
 (defun gnus-summary-make-local-variables ()
   "Make all the local summary buffer variables."
@@ -3478,8 +3474,11 @@ display only a single character."
                                               (current-buffer))))))
 
 (defun gnus-summary-setup-buffer (group)
-  "Initialize summary buffer.
-If the setup was successful, non-nil is returned."
+  "Initialize summary buffer for GROUP.
+This function does all setup work that relies on the specific
+value of GROUP, and puts the buffer in `gnus-summary-mode'.
+
+Returns non-nil if the setup was successful."
   (let ((buffer (gnus-summary-buffer-name group))
        (dead-name (concat "*Dead Summary "
                           (gnus-group-decoded-name group) "*")))
@@ -3493,13 +3492,15 @@ If the setup was successful, non-nil is returned."
          (not gnus-newsgroup-prepared))
       (set-buffer (gnus-get-buffer-create buffer))
       (setq gnus-summary-buffer (current-buffer))
-      (gnus-summary-mode group)
+      (let ((gnus-summary-mode-group group))
+       (gnus-summary-mode))
       (when (gnus-group-quit-config group)
        (set (make-local-variable 'gnus-single-article-buffer) nil))
-      (make-local-variable 'gnus-article-buffer)
-      (make-local-variable 'gnus-article-current)
-      (make-local-variable 'gnus-original-article-buffer)
-      (setq gnus-newsgroup-name group)
+      (turn-on-gnus-mailing-list-mode)
+      ;; These functions don't currently depend on GROUP, but might in
+      ;; the future.
+      (gnus-update-format-specifications nil 'summary 'summary-mode 
'summary-dummy)
+      (gnus-update-summary-mark-positions)
       ;; Set any local variables in the group parameters.
       (gnus-summary-set-local-parameters gnus-newsgroup-name)
       t)))
@@ -3864,20 +3865,20 @@ respectively."
 Returns \"  ?  \" if there's bad input or if another error occurs.
 Input should look like this: \"Sun, 14 Oct 2001 13:34:39 +0200\"."
   (condition-case ()
-      (let* ((messy-date (float-time (gnus-date-get-time messy-date)))
-            (now (float-time))
+      (let* ((messy-date (gnus-date-get-time messy-date))
+            (now (current-time))
             ;;If we don't find something suitable we'll use this one
             (my-format "%b %d '%y"))
-       (let* ((difference (- now messy-date))
+       (let* ((difference (time-subtract now messy-date))
               (templist gnus-user-date-format-alist)
               (top (eval (caar templist))))
-         (while (if (numberp top) (< top difference) (not top))
+         (while (if (numberp top) (time-less-p top difference) (not top))
            (progn
              (setq templist (cdr templist))
              (setq top (eval (caar templist)))))
          (if (stringp (cdr (car templist)))
              (setq my-format (cdr (car templist)))))
-       (format-time-string (eval my-format) (seconds-to-time messy-date)))
+       (format-time-string (eval my-format) messy-date))
     (error "  ?   ")))
 
 (defun gnus-summary-set-local-parameters (group)
@@ -3935,9 +3936,18 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
 (defun gnus-summary-read-group-1 (group show-all no-article
                                        kill-buffer no-display
                                        &optional select-articles)
+  "Display articles and threads in a Summary buffer for GROUP."
+  ;; This function calls `gnus-summary-setup-buffer' to create the
+  ;; buffer, put it in `gnus-summary-mode', and set local variables;
+  ;; `gnus-select-newsgroup' to update the group's active and marks
+  ;; from the server; and `gnus-summary-prepare' to actually insert
+  ;; lines for articles.  The rest of the function is mostly concerned
+  ;; with limiting and positioning and windowing and other visual
+  ;; effects.
+
   ;; Killed foreign groups can't be entered.
   ;;  (when (and (not (gnus-group-native-p group))
-  ;;        (not (gnus-gethash group gnus-newsrc-hashtb)))
+  ;;        (not (gethash group gnus-newsrc-hashtb)))
   ;;    (error "Dead non-native groups can't be entered"))
   (gnus-message 7 "Retrieving newsgroup: %s..."
                (gnus-group-decoded-name group))
@@ -4167,7 +4177,7 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
   "Gather threads by looking at Subject headers."
   (if (not gnus-summary-make-false-root)
       threads
-    (let ((hashtb (gnus-make-hashtable 1024))
+    (let ((hashtb (gnus-make-hashtable 1000))
          (prev threads)
          (result threads)
          subject hthread whole-subject)
@@ -4176,7 +4186,7 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
                       (setq whole-subject (mail-header-subject
                                            (caar threads)))))
        (when subject
-         (if (setq hthread (gnus-gethash subject hashtb))
+         (if (setq hthread (gethash subject hashtb))
              (progn
                ;; We enter a dummy root into the thread, if we
                ;; haven't done that already.
@@ -4190,24 +4200,24 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
                (setcdr prev (cdr threads))
                (setq threads prev))
            ;; Enter this thread into the hash table.
-           (gnus-sethash subject
-                         (if gnus-summary-make-false-root-always
-                             (progn
-                               ;; If you want a dummy root above all
-                               ;; threads...
-                               (setcar threads (list whole-subject
-                                                     (car threads)))
-                               threads)
-                           threads)
-                         hashtb)))
+           (puthash subject
+                    (if gnus-summary-make-false-root-always
+                        (progn
+                          ;; If you want a dummy root above all
+                          ;; threads...
+                          (setcar threads (list whole-subject
+                                                (car threads)))
+                          threads)
+                      threads)
+                    hashtb)))
        (setq prev threads)
        (setq threads (cdr threads)))
       result)))
 
 (defun gnus-gather-threads-by-references (threads)
   "Gather threads by looking at References headers."
-  (let ((idhashtb (gnus-make-hashtable 1024))
-       (thhashtb (gnus-make-hashtable 1024))
+  (let ((idhashtb (gnus-make-hashtable 1000))
+       (thhashtb (gnus-make-hashtable 1000))
        (prev threads)
        (result threads)
        ids references id gthread gid entered ref)
@@ -4218,11 +4228,11 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
              entered nil)
        (while (setq ref (pop ids))
          (setq ids (delete ref ids))
-         (if (not (setq gid (gnus-gethash ref idhashtb)))
+         (if (not (setq gid (gethash ref idhashtb)))
              (progn
-               (gnus-sethash ref id idhashtb)
-               (gnus-sethash id threads thhashtb))
-           (setq gthread (gnus-gethash gid thhashtb))
+               (puthash ref id idhashtb)
+               (puthash id threads thhashtb))
+           (setq gthread (gethash gid thhashtb))
            (unless entered
              ;; We enter a dummy root into the thread, if we
              ;; haven't done that already.
@@ -4234,7 +4244,7 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
              (setcdr (car gthread)
                      (nconc (cdar gthread) (list (car threads)))))
            ;; Add it into the thread hash table.
-           (gnus-sethash id gthread thhashtb)
+           (puthash id gthread thhashtb)
            (setq entered t)
            ;; Remove it from the list of threads.
            (setcdr prev (cdr threads))
@@ -4267,12 +4277,12 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
          ;; We have found a loop.
          (let (ref-dep)
            (setcdr thread (delq (car th) (cdr thread)))
-           (if (boundp (setq ref-dep (intern "none"
-                                             gnus-newsgroup-dependencies)))
-               (setcdr (symbol-value ref-dep)
-                       (nconc (cdr (symbol-value ref-dep))
+           (if (setq ref-dep (gethash "none"
+                                      gnus-newsgroup-dependencies))
+               (setcdr ref-dep
+                       (nconc (cdr ref-dep)
                               (list (car th))))
-             (set ref-dep (list nil (car th))))
+             (puthash ref-dep (list nil (car th)) gnus-newsgroup-dependencies))
            (setq infloop 1
                  stack nil))
        ;; Push all the subthreads onto the stack.
@@ -4283,31 +4293,30 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
   "Go through the dependency hashtb and find the roots.  Return all threads."
   (let (threads)
     (while (catch 'infloop
-            (mapatoms
-             (lambda (refs)
+            (maphash
+             (lambda (_id refs)
                ;; Deal with self-referencing References loops.
-               (when (and (car (symbol-value refs))
+               (when (and (car refs)
                           (not (zerop
                                 (apply
                                  '+
                                  (mapcar
                                   (lambda (thread)
                                     (gnus-thread-loop-p
-                                     (car (symbol-value refs)) thread))
-                                  (cdr (symbol-value refs)))))))
+                                     (car refs) thread))
+                                  (cdr refs))))))
                  (setq threads nil)
                  (throw 'infloop t))
-               (unless (car (symbol-value refs))
+               (unless (car refs)
                  ;; These threads do not refer back to any other
                  ;; articles, so they're roots.
-                 (setq threads (append (cdr (symbol-value refs)) threads))))
+                 (setq threads (append (cdr refs) threads))))
              gnus-newsgroup-dependencies)))
     threads))
 
 ;; Build the thread tree.
 (defsubst gnus-dependencies-add-header (header dependencies force-new)
   "Enter HEADER into the DEPENDENCIES table if it is not already there.
-
 If FORCE-NEW is not nil, enter HEADER into the DEPENDENCIES table even
 if it was already present.
 
@@ -4318,33 +4327,38 @@ Message-ID before being entered.
 
 Returns HEADER if it was entered in the DEPENDENCIES.  Returns nil otherwise."
   (let* ((id (mail-header-id header))
-        (id-dep (and id (intern id dependencies)))
+        ;; An "id-dep" is a list holding the vector headers of this
+        ;; message, plus equivalent "id-deps" for each immediate
+        ;; child message.
+        (id-dep (and id (gethash id dependencies)))
         parent-id ref ref-dep ref-header replaced)
     ;; Enter this `header' in the `dependencies' table.
     (cond
-     ((not id-dep)
+     ((null id)
+      ;; Omit this article altogether if there is no Message-ID.
       (setq header nil))
-     ;; The first two cases do the normal part: enter a new `header'
-     ;; in the `dependencies' table.
-     ((not (boundp id-dep))
-      (set id-dep (list header)))
-     ((null (car (symbol-value id-dep)))
-      (setcar (symbol-value id-dep) header))
-
+     ;; Enter a new id and `header' in the `dependencies' table.
+     ((null id-dep)
+      (setq id-dep (puthash id (list header) dependencies)))
+     ;; A child message has already added this id, just insert the header.
+     ((null (car id-dep))
+      (setcar (gethash id dependencies) header)
+      (setq id-dep (gethash id dependencies)))
      ;; From here the `header' was already present in the
      ;; `dependencies' table.
      (force-new
       ;; Overrides an existing entry;
       ;; just set the header part of the entry.
-      (setcar (symbol-value id-dep) header)
+      (setcar (gethash id dependencies) header)
       (setq replaced t))
 
      ;; Renames the existing `header' to a unique Message-ID.
      ((not gnus-summary-ignore-duplicates)
       ;; An article with this Message-ID has already been seen.
       ;; We rename the Message-ID.
-      (set (setq id-dep (intern (setq id (nnmail-message-id)) dependencies))
-          (list header))
+      (setq id-dep (puthash (setq id (nnmail-message-id))
+                           (list header)
+                           dependencies))
       (mail-header-set-id header id))
 
      ;; The last case ignores an existing entry, except it adds any
@@ -4354,8 +4368,8 @@ Returns HEADER if it was entered in the DEPENDENCIES.  
Returns nil otherwise."
      ;; table was *not* modified.
      (t
       (mail-header-set-xref
-       (car (symbol-value id-dep))
-       (concat (or (mail-header-xref (car (symbol-value id-dep)))
+       (car id-dep)
+       (concat (or (mail-header-xref (car id-dep))
                   "")
               (or (mail-header-xref header) "")))
       (setq header nil)))
@@ -4365,23 +4379,27 @@ Returns HEADER if it was entered in the DEPENDENCIES.  
Returns nil otherwise."
       (setq parent-id (gnus-parent-id (mail-header-references header)))
       (setq ref parent-id)
       (while (and ref
-                 (setq ref-dep (intern-soft ref dependencies))
-                 (boundp ref-dep)
-                 (setq ref-header (car (symbol-value ref-dep))))
+                 (setq ref-dep (gethash ref dependencies))
+                 (setq ref-header (car-safe ref-dep)))
        (if (string= id ref)
            ;; Yuk!  This is a reference loop.  Make the article be a
            ;; root article.
            (progn
-             (mail-header-set-references (car (symbol-value id-dep)) "none")
+             (mail-header-set-references (car id-dep) "none")
              (setq ref nil)
              (setq parent-id nil))
          (setq ref (gnus-parent-id (mail-header-references ref-header)))))
-      (setq ref-dep (intern (or parent-id "none") dependencies))
-      (if (boundp ref-dep)
-         (setcdr (symbol-value ref-dep)
-                 (nconc (cdr (symbol-value ref-dep))
-                        (list (symbol-value id-dep))))
-       (set ref-dep (list nil (symbol-value id-dep)))))
+      (setq ref (or parent-id "none")
+           ref-dep (gethash ref dependencies))
+      ;; Add `header' to its parent's list of children, creating that
+      ;; list if the parent isn't yet registered in the dependency
+      ;; table.
+      (if ref-dep
+         (setcdr (gethash ref dependencies)
+                 (nconc (cdr ref-dep)
+                        (list id-dep)))
+       (puthash ref (list nil id-dep)
+                dependencies)))
     header))
 
 (defun gnus-extract-message-id-from-in-reply-to (string)
@@ -4444,15 +4462,14 @@ Returns HEADER if it was entered in the DEPENDENCIES.  
Returns nil otherwise."
   ;; server, that is.
   (let ((mail-parse-charset gnus-newsgroup-charset)
        id heads)
-    (mapatoms
-     (lambda (refs)
-       (when (not (car (symbol-value refs)))
-        (setq heads (cdr (symbol-value refs)))
+    (maphash
+     (lambda (id refs)
+       (when (not (car refs))
+        (setq heads (cdr refs))
         (while heads
           (if (memq (mail-header-number (caar heads))
                     gnus-newsgroup-dormant)
               (setq heads (cdr heads))
-            (setq id (symbol-name refs))
             (while (and (setq id (gnus-build-get-header id))
                         (not (car (gnus-id-to-thread id)))))
             (setq heads nil)))))
@@ -4733,7 +4750,7 @@ If LINE, insert the rebuilt thread starting on line LINE."
 
 (defun gnus-id-to-thread (id)
   "Return the (sub-)thread where ID appears."
-  (gnus-gethash id gnus-newsgroup-dependencies))
+  (gethash id gnus-newsgroup-dependencies))
 
 (defun gnus-id-to-article (id)
   "Return the article number of ID."
@@ -4779,7 +4796,7 @@ If LINE, insert the rebuilt thread starting on line LINE."
   (let (headers thread last-id)
     ;; First go up in this thread until we find the root.
     (setq last-id (gnus-root-id id)
-         headers (message-flatten-list (gnus-id-to-thread last-id)))
+         headers (flatten-tree (gnus-id-to-thread last-id)))
     ;; We have now found the real root of this thread.  It might have
     ;; been gathered into some loose thread, so we have to search
     ;; through the threads to find the thread we wanted.
@@ -5075,7 +5092,7 @@ Unscored articles will be counted as having a score of 
zero."
   "Return the highest article number in THREAD."
   (apply 'max (mapcar (lambda (header)
                        (mail-header-number header))
-                     (message-flatten-list thread))))
+                     (flatten-tree thread))))
 
 (defun gnus-article-sort-by-most-recent-date (h1 h2)
   "Sort articles by number."
@@ -5095,7 +5112,7 @@ Unscored articles will be counted as having a score of 
zero."
         (mapcar (lambda (header) (float-time
                                   (gnus-date-get-time
                                    (mail-header-date header))))
-                (message-flatten-list thread))))
+                (flatten-tree thread))))
 
 (defun gnus-thread-total-score-1 (root)
   ;; This function find the total score of the thread below ROOT.
@@ -5586,7 +5603,7 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
          (if (eq (car (gnus-find-method-for-group group)) 'nnvirtual)
              t
            gnus-summary-ignore-duplicates))
-        (info (nth 2 entry))
+        (info (nth 1 entry))
         charset articles fetched-articles cached)
 
     (unless (gnus-check-server
@@ -5605,7 +5622,7 @@ If SELECT-ARTICLES, only select those articles from 
GROUP."
           (decode-coding-string group charset)
           (decode-coding-string (gnus-status-message group) charset))))
 
-    (unless (gnus-request-group group t nil (gnus-get-info group))
+    (unless (gnus-request-group group t nil info)
       (when (derived-mode-p 'gnus-summary-mode)
        (gnus-kill-buffer (current-buffer)))
       (error "Couldn't request group %s: %s"
@@ -6208,9 +6225,9 @@ The resulting hash table is returned, or nil if no Xrefs 
were found."
          (setq number
                (string-to-number (substring xrefs (match-beginning 2)
                                          (match-end 2))))
-         (if (setq entry (gnus-gethash group xref-hashtb))
+         (if (setq entry (gethash group xref-hashtb))
              (setcdr entry (cons number (cdr entry)))
-           (gnus-sethash group (cons number nil) xref-hashtb)))))
+           (puthash group (cons number nil) xref-hashtb)))))
     (and start xref-hashtb)))
 
 (defun gnus-mark-xrefs-as-read (from-newsgroup headers unreads)
@@ -6220,10 +6237,9 @@ The resulting hash table is returned, or nil if no Xrefs 
were found."
     (with-current-buffer gnus-group-buffer
       (when (setq xref-hashtb
                  (gnus-create-xref-hashtb from-newsgroup headers unreads))
-       (mapatoms
-        (lambda (group)
-          (unless (string= from-newsgroup (setq name (symbol-name group)))
-            (setq idlist (symbol-value group))
+       (maphash
+        (lambda (group idlist)
+          (unless (string= from-newsgroup group)
             ;; Dead groups are not updated.
             (and (prog1
                      (setq info (gnus-get-info name))
@@ -6249,7 +6265,7 @@ The resulting hash table is returned, or nil if no Xrefs 
were found."
 
 (defun gnus-compute-read-articles (group articles)
   (let* ((entry (gnus-group-entry group))
-        (info (nth 2 entry))
+        (info (nth 1 entry))
         (active (gnus-active group))
         ninfo)
     (when entry
@@ -6286,7 +6302,7 @@ The resulting hash table is returned, or nil if no Xrefs 
were found."
   "Update the info of GROUP to say that ARTICLES are read."
   (let* ((num 0)
         (entry (gnus-group-entry group))
-        (info (nth 2 entry))
+        (info (nth 1 entry))
         (active (gnus-active group))
         (set-marks
          (gnus-method-option-p
@@ -7728,7 +7744,7 @@ be displayed."
   (unless (derived-mode-p 'gnus-summary-mode)
     (set-buffer gnus-summary-buffer))
   (let ((article (or article (gnus-summary-article-number)))
-       (all-headers (not (not all-headers))) ;Must be t or nil.
+        (all-headers (and all-headers t)) ; Must be t or nil.
        gnus-summary-display-article-function)
     (and (not pseudo)
         (gnus-summary-article-pseudo-p article)
@@ -8848,11 +8864,11 @@ fetch-old-headers verbiage, and so on."
                   (null gnus-thread-expunge-below)))
     (push gnus-newsgroup-limit gnus-newsgroup-limits)
     (setq gnus-newsgroup-limit nil)
-    (mapatoms
-     (lambda (node)
-       (unless (car (symbol-value node))
+    (maphash
+     (lambda (id deps)
+       (unless (car deps)
         ;; These threads have no parents -- they are roots.
-        (let ((nodes (cdr (symbol-value node)))
+        (let ((nodes (cdr deps))
               thread)
           (while nodes
             (if (and gnus-thread-expunge-below
@@ -9962,13 +9978,12 @@ ACTION can be either `move' (the default), `crosspost' 
or `copy'."
                 (crosspost "Crosspost" "Crossposting")))
        (copy-buf (save-excursion
                    (nnheader-set-temp-buffer " *copy article*")))
-       art-group to-method new-xref article to-groups
+        art-group to-method new-xref to-groups
        articles-to-update-marks encoded)
     (unless (assq action names)
       (error "Unknown action %s" action))
     ;; Read the newsgroup name.
-    (when (and (not to-newsgroup)
-              (not select-method))
+    (unless (or to-newsgroup select-method)
       (if (and gnus-move-split-methods
               (not
                (and (memq gnus-current-article articles)
@@ -10013,8 +10028,7 @@ ACTION can be either `move' (the default), `crosspost' 
or `copy'."
                  (or (car select-method)
                      (gnus-group-decoded-name to-newsgroup))
                  articles)
-    (while articles
-      (setq article (pop articles))
+    (dolist (article articles)
       ;; Set any marks that may have changed in the summary buffer.
       (when gnus-preserve-marks
        (gnus-summary-push-marks-to-backend article))
@@ -10023,8 +10037,9 @@ ACTION can be either `move' (the default), `crosspost' 
or `copy'."
        (cond
        ;; Move the article.
        ((eq action 'move)
-        ;; Remove this article from future suppression.
-        (gnus-dup-unsuppress-article article)
+         (when gnus-suppress-duplicates
+           ;; Remove this article from future suppression.
+           (gnus-dup-unsuppress-article article))
         (let* ((from-method (gnus-find-method-for-group
                              gnus-newsgroup-name))
                (to-method (or select-method
@@ -12288,12 +12303,11 @@ save those articles instead."
     (nreverse split-name)))
 
 (defun gnus-valid-move-group-p (group)
-  (and (symbolp group)
-       (boundp group)
-       (symbol-name group)
-       (symbol-value group)
-       (gnus-get-function (gnus-find-method-for-group
-                          (symbol-name group)) 'request-accept-article t)))
+  (when (and (stringp group)
+            (null (string-empty-p group)))
+    (gnus-get-function (gnus-find-method-for-group
+                       group)
+                      'request-accept-article t)))
 
 (defun gnus-read-move-group-name (prompt default articles prefix)
   "Read a group name."
@@ -12304,27 +12318,24 @@ save those articles instead."
                  (if (> (length articles) 1)
                      (format "these %d articles" (length articles))
                    "this article")))
-        valid-names
+        (valid-names
+         (seq-filter #'gnus-valid-move-group-p
+                     (hash-table-keys gnus-active-hashtb)))
         (to-newsgroup
-         (progn
-           (mapatoms (lambda (g)
-                       (when (gnus-valid-move-group-p g)
-                         (push g valid-names)))
-                     gnus-active-hashtb)
-            (cond
-             ((null split-name)
-              (gnus-group-completing-read
-               prom
-               valid-names
-               nil prefix nil default))
-             ((= 1 (length split-name))
-              (gnus-group-completing-read
-               prom
-              valid-names
-               nil prefix 'gnus-group-history (car split-name)))
-             (t
-              (gnus-completing-read
-               prom (nreverse split-name) nil nil 'gnus-group-history)))))
+          (cond
+           ((null split-name)
+            (gnus-group-completing-read
+             prom
+            valid-names
+             nil prefix nil default))
+           ((= 1 (length split-name))
+            (gnus-group-completing-read
+             prom
+            valid-names
+             nil prefix 'gnus-group-history (car split-name)))
+           (t
+            (gnus-completing-read
+             prom (nreverse split-name) nil nil 'gnus-group-history))))
          (to-method (gnus-server-to-method (gnus-group-method to-newsgroup)))
         encoded)
     (when to-newsgroup
diff --git a/lisp/gnus/gnus-topic.el b/lisp/gnus/gnus-topic.el
index 111f2ae..e2c728d 100644
--- a/lisp/gnus/gnus-topic.el
+++ b/lisp/gnus/gnus-topic.el
@@ -1,6 +1,6 @@
 ;;; gnus-topic.el --- a folding minor mode for Gnus group buffers
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Ilja Weis <address@hidden>
 ;;     Lars Magne Ingebrigtsen <address@hidden>
@@ -31,6 +31,8 @@
 (require 'gnus-group)
 (require 'gnus-start)
 (require 'gnus-util)
+(eval-when-compile
+  (require 'subr-x))
 
 (defgroup gnus-topic nil
   "Group topics."
@@ -85,7 +87,7 @@ See Info node `(gnus)Formatting Variables'."
 (defvar gnus-topic-inhibit-change-level nil)
 
 (defconst gnus-topic-line-format-alist
-  `((?n name ?s)
+  '((?n name ?s)
     (?v visible ?s)
     (?i indentation ?s)
     (?g number-of-groups ?d)
@@ -99,8 +101,7 @@ See Info node `(gnus)Formatting Variables'."
 
 (defun gnus-group-topic-name ()
   "The name of the topic on the current line."
-  (let ((topic (get-text-property (point-at-bol) 'gnus-topic)))
-    (and topic (symbol-name topic))))
+  (get-text-property (point-at-bol) 'gnus-topic))
 
 (defun gnus-group-topic-level ()
   "The level of the topic on the current line."
@@ -144,8 +145,7 @@ See Info node `(gnus)Formatting Variables'."
 
 (defun gnus-topic-goto-topic (topic)
   (when topic
-    (gnus-goto-char (text-property-any (point-min) (point-max)
-                                      'gnus-topic (intern topic)))))
+    (gnus-text-property-search 'gnus-topic topic nil 'goto)))
 
 (defun gnus-topic-jump-to-topic (topic)
   "Go to TOPIC."
@@ -167,8 +167,7 @@ See Info node `(gnus)Formatting Variables'."
                                     (point) 'gnus-topic))
                    (get-text-property (max (1- (point)) (point-min))
                                       'gnus-topic))))))
-    (when result
-      (symbol-name result))))
+    result))
 
 (defun gnus-current-topics (&optional topic)
   "Return a list of all current topics, lowest in hierarchy first.
@@ -195,7 +194,7 @@ If RECURSIVE is t, return groups in its subtopics too."
     (while groups
       (when (setq group (pop groups))
        (setq entry (gnus-group-entry group)
-             info (nth 2 entry)
+             info (nth 1 entry)
              params (gnus-info-params info)
              active (gnus-active group)
              unread (or (car entry)
@@ -462,7 +461,7 @@ If LOWEST is non-nil, list all newsgroups of level LOWEST 
or higher."
        (gnus-group-prepare-flat-list-dead
         (seq-remove (lambda (group)
                           (or (gnus-group-entry group)
-                              (gnus-gethash group gnus-killed-hashtb)))
+                              (gethash group gnus-killed-hashtb)))
                         not-in-list)
         gnus-level-killed ?K regexp)))
 
@@ -536,7 +535,7 @@ articles in the topic and its subtopics."
                    (funcall regexp entry))
                   ((null regexp) t)
                   (t nil))))
-             (setq info (nth 2 entry))
+             (setq info (nth 1 entry))
              (gnus-group-prepare-logic
               (gnus-info-group info)
               (and (or (not gnus-group-listed-groups)
@@ -557,7 +556,7 @@ articles in the topic and its subtopics."
                      (car active))
               nil)
            ;; Living groups.
-           (when (setq info (nth 2 entry))
+           (when (setq info (nth 1 entry))
              (gnus-group-insert-group-line
               (gnus-info-group info)
               (gnus-info-level info) (gnus-info-marks info)
@@ -646,7 +645,7 @@ articles in the topic and its subtopics."
         (point)
         (prog1 (1+ (point))
           (eval gnus-topic-line-format-spec))
-        (list 'gnus-topic (intern name)
+        (list 'gnus-topic name
               'gnus-topic-level level
               'gnus-topic-unread unread
               'gnus-active active-topic
@@ -844,10 +843,9 @@ articles in the topic and its subtopics."
   ;; they belong to some topic.
   (let* ((tgroups (apply 'append (mapcar 'cdr gnus-topic-alist)))
         (entry (last (assoc (caar gnus-topic-topology) gnus-topic-alist)))
-        (newsrc (cdr gnus-newsrc-alist))
-        group)
-    (while newsrc
-      (unless (member (setq group (gnus-info-group (pop newsrc))) tgroups)
+        (groups (cdr gnus-group-list)))
+    (dolist (group groups)
+      (unless (member group tgroups)
        (setcdr entry (list group))
        (setq entry (cdr entry)))))
   ;; Go through all topics and make sure they contain only living groups.
@@ -888,7 +886,7 @@ articles in the topic and its subtopics."
        (while (setq group (pop topic))
          (when (and (or (gnus-active group)
                         (gnus-info-method (gnus-get-info group)))
-                    (not (gnus-gethash group gnus-killed-hashtb)))
+                    (not (gethash group gnus-killed-hashtb)))
            (push group filtered-topic)))
        (push (cons topic-name (nreverse filtered-topic)) result)))
     (setq gnus-topic-alist (nreverse result))))
@@ -898,7 +896,7 @@ articles in the topic and its subtopics."
   (with-current-buffer gnus-group-buffer
     (let ((inhibit-read-only t))
       (unless gnus-topic-inhibit-change-level
-       (gnus-group-goto-group (or (car (nth 2 previous)) group))
+       (gnus-group-goto-group (or (car (nth 1 previous)) group))
        (when (and gnus-topic-mode
                   gnus-topic-alist
                   (not gnus-topic-inhibit-change-level))
@@ -956,7 +954,7 @@ articles in the topic and its subtopics."
   (if (not group)
       (if (not (memq 'gnus-topic props))
          (goto-char (point-max))
-       (let ((topic (symbol-name (cadr (memq 'gnus-topic props)))))
+       (let ((topic (cadr (memq 'gnus-topic props))))
          (or (gnus-topic-goto-topic topic)
              (gnus-topic-goto-topic (gnus-topic-next-topic topic)))))
     (if (gnus-group-goto-group group)
@@ -992,12 +990,8 @@ articles in the topic and its subtopics."
   ;; First we make sure that we have really read the active file.
   (when (or force
            (not gnus-topic-active-alist))
-    (let (groups)
-      ;; Get a list of all groups available.
-      (mapatoms (lambda (g) (when (symbol-value g)
-                             (push (symbol-name g) groups)))
-               gnus-active-hashtb)
-      (setq groups (sort groups 'string<))
+    ;; Get a list of all groups available.
+    (let ((groups (sort (hash-table-keys gnus-active-hashtb) #'string<)))
       ;; Init the variables.
       (setq gnus-topic-active-topology (list (list "" 'visible)))
       (setq gnus-topic-active-alist nil)
@@ -1202,7 +1196,7 @@ If performed over a topic line, toggle folding the topic."
     (save-excursion
       (gnus-message 5 "Expiring groups in %s..." topic)
       (let ((gnus-group-marked
-            (mapcar (lambda (entry) (car (nth 2 entry)))
+            (mapcar (lambda (entry) (car (nth 1 entry)))
                     (gnus-topic-find-groups topic gnus-level-killed t
                                             nil t))))
        (gnus-group-expire-articles nil))
@@ -1216,7 +1210,7 @@ Also see `gnus-group-catchup'."
       (call-interactively 'gnus-group-catchup-current)
     (save-excursion
       (let* ((groups
-              (mapcar (lambda (entry) (car (nth 2 entry)))
+              (mapcar (lambda (entry) (car (nth 1 entry)))
                       (gnus-topic-find-groups topic gnus-level-killed t
                                               nil t)))
             (inhibit-read-only t)
@@ -1449,7 +1443,7 @@ If NON-RECURSIVE (which is the prefix) is t, don't mark 
its subtopics."
                                            (not non-recursive))))
        (while groups
          (funcall (if unmark 'gnus-group-remove-mark 'gnus-group-set-mark)
-                  (gnus-info-group (nth 2 (pop groups)))))))))
+                  (gnus-info-group (nth 1 (pop groups)))))))))
 
 (defun gnus-topic-unmark-topic (topic &optional _dummy non-recursive)
   "Remove the process mark from all groups in the TOPIC.
diff --git a/lisp/gnus/gnus-undo.el b/lisp/gnus/gnus-undo.el
index d487262..179679a 100644
--- a/lisp/gnus/gnus-undo.el
+++ b/lisp/gnus/gnus-undo.el
@@ -1,6 +1,6 @@
 ;;; gnus-undo.el --- minor mode for undoing in Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 2e4b054..6b0f29b 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -1,6 +1,6 @@
 ;;; gnus-util.el --- utility functions for Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -35,12 +35,13 @@
 (eval-when-compile (require 'cl-lib))
 
 (require 'time-date)
+(require 'text-property-search)
 
 (defcustom gnus-completing-read-function 'gnus-emacs-completing-read
   "Function use to do completing read."
   :version "24.1"
   :group 'gnus-meta
-  :type `(radio (function-item
+  :type '(radio (function-item
                  :doc "Use Emacs standard `completing-read' function."
                  gnus-emacs-completing-read)
                (function-item
@@ -104,13 +105,6 @@ This is a compatibility function for different Emacsen."
 (put 'gnus-eval-in-buffer-window 'lisp-indent-function 1)
 (put 'gnus-eval-in-buffer-window 'edebug-form-spec '(form body))
 
-(defmacro gnus-intern-safe (string hashtable)
-  "Get hash value.  Arguments are STRING and HASHTABLE."
-  `(let ((symbol (intern ,string ,hashtable)))
-     (or (boundp symbol)
-        (set symbol nil))
-     symbol))
-
 (defsubst gnus-goto-char (point)
   (and point (goto-char point)))
 
@@ -139,7 +133,7 @@ This is a compatibility function for different Emacsen."
 
 (defun gnus-extract-address-components (from)
   "Extract address components from a From header.
-Given an RFC-822 address FROM, extract full name and canonical address.
+Given an RFC-822 (or later) address FROM, extract name and address.
 Returns a list of the form (FULL-NAME CANONICAL-ADDRESS).  Much more simple
 solution than `mail-header-parse-address', which works much better, but
 is slower."
@@ -199,6 +193,36 @@ is slower."
                   (search-forward ":" eol t)
                   (point)))))
 
+(defun gnus-text-property-search (prop value &optional forward-only goto end)
+  "Search current buffer for text property PROP with VALUE.
+Behaves like a combination of `text-property-any' and
+`text-property-search-forward'.  Searches for the beginning of a
+text property `equal' to VALUE.  Returns the value of point at
+the beginning of the matching text property span.
+
+If FORWARD-ONLY is non-nil, only search forward from point.
+
+If GOTO is non-nil, move point to the beginning of that span
+instead.
+
+If END is non-nil, use the end of the span instead."
+  (let* ((start (point))
+        (found (progn
+                 (unless forward-only
+                   (goto-char (point-min)))
+                 (text-property-search-forward
+                  prop value #'equal)))
+        (target (when found
+                  (if end
+                      (prop-match-end found)
+                    (prop-match-beginning found)))))
+    (when target
+      (if goto
+         (goto-char target)
+       (prog1
+           target
+         (goto-char start))))))
+
 (declare-function gnus-find-method-for-group "gnus" (group &optional info))
 (declare-function gnus-group-name-decode "gnus-group" (string charset))
 (declare-function gnus-group-name-charset "gnus-group" (method group))
@@ -390,22 +414,9 @@ Cache the result as a text property stored in DATE."
   "Quote all \"%\"'s in STRING."
   (replace-regexp-in-string "%" "%%" string))
 
-;; Make a hash table (default and minimum size is 256).
-;; Optional argument HASHSIZE specifies the table size.
-(defun gnus-make-hashtable (&optional hashsize)
-  (make-vector (if hashsize (max (gnus-create-hash-size hashsize) 256) 256) 0))
-
-;; Make a number that is suitable for hashing; bigger than MIN and
-;; equal to some 2^x.  Many machines (such as sparcs) do not have a
-;; hardware modulo operation, so they implement it in software.  On
-;; many sparcs over 50% of the time to intern is spent in the modulo.
-;; Yes, it's slower than actually computing the hash from the string!
-;; So we use powers of 2 so people can optimize the modulo to a mask.
-(defun gnus-create-hash-size (min)
-  (let ((i 1))
-    (while (< i min)
-      (setq i (* 2 i)))
-    i))
+(defsubst gnus-make-hashtable (&optional size)
+  "Make a hash table of SIZE, testing on `equal'."
+  (make-hash-table :size (or size 300) :test #'equal))
 
 (defcustom gnus-verbose 6
   "Integer that says how verbose Gnus should be.
@@ -1174,18 +1185,16 @@ ARG is passed to the first function."
       ;; The buffer should be in the unibyte mode because group names
       ;; are ASCII text or encoded non-ASCII text (i.e., unibyte).
       (mm-disable-multibyte)
-      (mapatoms
-       (lambda (sym)
-        (when (and sym
-                   (boundp sym)
-                   (symbol-value sym))
-          (insert (format "%S %d %d y\n"
+      (maphash
+       (lambda (group active)
+        (when active
+          (insert (format "%s %d %d y\n"
                           (if full-names
-                              sym
-                            (intern (gnus-group-real-name (symbol-name sym))))
-                          (or (cdr (symbol-value sym))
-                              (car (symbol-value sym)))
-                          (car (symbol-value sym))))))
+                              group
+                            (gnus-group-real-name group))
+                          (or (cdr active)
+                              (car active))
+                          (car active)))))
        hashtb)
       (goto-char (point-max))
       (while (search-backward "\\." nil t)
diff --git a/lisp/gnus/gnus-uu.el b/lisp/gnus/gnus-uu.el
index a171a38..253ee24 100644
--- a/lisp/gnus/gnus-uu.el
+++ b/lisp/gnus/gnus-uu.el
@@ -1,6 +1,6 @@
 ;;; gnus-uu.el --- extract (uu)encoded files in Gnus
 
-;; Copyright (C) 1985-1987, 1993-1998, 2000-2018 Free Software
+;; Copyright (C) 1985-1987, 1993-1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
diff --git a/lisp/gnus/gnus-vm.el b/lisp/gnus/gnus-vm.el
index 24235d9..6042365 100644
--- a/lisp/gnus/gnus-vm.el
+++ b/lisp/gnus/gnus-vm.el
@@ -1,6 +1,6 @@
 ;;; gnus-vm.el --- vm interface for Gnus
 
-;; Copyright (C) 1994-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
 ;; Author: Per Persson <address@hidden>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/gnus-win.el b/lisp/gnus/gnus-win.el
index ff3073a..5f7154c 100644
--- a/lisp/gnus/gnus-win.el
+++ b/lisp/gnus/gnus-win.el
@@ -1,6 +1,6 @@
 ;;; gnus-win.el --- window configuration functions for Gnus
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index 2786323..989347c 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -1,6 +1,6 @@
 ;;; gnus.el --- a newsreader for GNU Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1987-1990, 1993-1998, 2000-2018 Free Software
+;; Copyright (C) 1987-1990, 1993-1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <address@hidden>
@@ -29,7 +29,8 @@
 
 (run-hooks 'gnus-load-hook)
 
-(eval-when-compile (require 'cl-lib))
+(eval-when-compile (require 'cl-lib)
+                  (require 'subr-x))
 (require 'wid-edit)
 (require 'mm-util)
 (require 'nnheader)
@@ -637,6 +638,12 @@ be set in `.emacs' instead."
   "Face used for low interest read articles."
   :group 'gnus-summary)
 
+;;; Base gnus-mode
+
+(define-derived-mode gnus-mode special-mode nil
+  "Base mode from which all other gnus modes derive.
+This does nothing but derive from `special-mode', and should not
+be used directly.")
 
 ;;;
 ;;; Gnus buffers
@@ -2447,28 +2454,37 @@ such as a mark that says whether an article is stored 
in the cache
 gnus-registry.el will populate this if it's loaded.")
 
 (defvar gnus-newsrc-hashtb nil
-  "Hashtable of `gnus-newsrc-alist'.")
+  "Hash table of `gnus-newsrc-alist'.")
+
+(defvar gnus-group-list nil
+  "Ordered list of group names as strings.
+This variable only exists to provide easy access to the ordering
+of `gnus-newsrc-alist'.")
 
 (defvar gnus-killed-list nil
   "List of killed newsgroups.")
 
 (defvar gnus-killed-hashtb nil
-  "Hash table equivalent of `gnus-killed-list'.")
+  "Hash table equivalent of `gnus-killed-list'.
+This is a hash table purely for the fast membership test: values
+are always t.")
 
 (defvar gnus-zombie-list nil
   "List of almost dead newsgroups.")
 
 (defvar gnus-description-hashtb nil
-  "Descriptions of newsgroups.")
+  "Hash table mapping group names to their descriptions.")
 
 (defvar gnus-list-of-killed-groups nil
   "List of newsgroups that have recently been killed by the user.")
 
 (defvar gnus-active-hashtb nil
-  "Hashtable of active articles.")
+  "Hash table mapping group names to their active entry.")
 
 (defvar gnus-moderated-hashtb nil
-  "Hashtable of moderated newsgroups.")
+  "Hash table of moderated groups.
+This is a hash table purely for the fast membership test: values
+are always t.")
 
 ;; Save window configuration.
 (defvar gnus-prev-winconf nil)
@@ -2764,7 +2780,7 @@ See Info node `(gnus)Formatting Variables'."
 
 (defun gnus-suppress-keymap (keymap)
   (suppress-keymap keymap)
-  (let ((keys `([delete] "\177" "\M-u"))) ;[mouse-2]
+  (let ((keys '([delete] "\177" "\M-u"))) ;[mouse-2]
     (while keys
       (define-key keymap (pop keys) 'undefined))))
 
@@ -2794,36 +2810,21 @@ See Info node `(gnus)Formatting Variables'."
 (defun gnus-header-from (header)
   (mail-header-from header))
 
-(defmacro gnus-gethash (string hashtable)
-  "Get hash value of STRING in HASHTABLE."
-  `(symbol-value (intern-soft ,string ,hashtable)))
-
-(defmacro gnus-gethash-safe (string hashtable)
-  "Get hash value of STRING in HASHTABLE.
-Return nil if not defined."
-  `(let ((sym (intern-soft ,string ,hashtable)))
-     (and (boundp sym) (symbol-value sym))))
-
-(defmacro gnus-sethash (string value hashtable)
-  "Set hash value.  Arguments are STRING, VALUE, and HASHTABLE."
-  `(set (intern ,string ,hashtable) ,value))
-(put 'gnus-sethash 'edebug-form-spec '(form form form))
-
 (defmacro gnus-group-unread (group)
   "Get the currently computed number of unread articles in GROUP."
-  `(car (gnus-gethash ,group gnus-newsrc-hashtb)))
+  `(car (gethash ,group gnus-newsrc-hashtb)))
 
 (defmacro gnus-group-entry (group)
   "Get the newsrc entry for GROUP."
-  `(gnus-gethash ,group gnus-newsrc-hashtb))
+  `(gethash ,group gnus-newsrc-hashtb))
 
 (defmacro gnus-active (group)
   "Get active info on GROUP."
-  `(gnus-gethash ,group gnus-active-hashtb))
+  `(gethash ,group gnus-active-hashtb))
 
 (defmacro gnus-set-active (group active)
   "Set GROUP's active info."
-  `(gnus-sethash ,group ,active gnus-active-hashtb))
+  `(puthash ,group ,active gnus-active-hashtb))
 
 ;; Info access macros.
 
@@ -2887,10 +2888,10 @@ Return nil if not defined."
        (setcar rank (cons (car rank) ,score)))))
 
 (defmacro gnus-get-info (group)
-  `(nth 2 (gnus-gethash ,group gnus-newsrc-hashtb)))
+  `(nth 1 (gethash ,group gnus-newsrc-hashtb)))
 
 (defun gnus-set-info (group info)
-  (setcar (nthcdr 2 (gnus-gethash group gnus-newsrc-hashtb))
+  (setcdr (gethash group gnus-newsrc-hashtb)
          info))
 
 
@@ -3179,7 +3180,7 @@ that that variable is buffer-local to the summary 
buffers."
 
 (defun gnus-kill-ephemeral-group (group)
   "Remove ephemeral GROUP from relevant structures."
-  (gnus-sethash group nil gnus-newsrc-hashtb))
+  (remhash group gnus-newsrc-hashtb))
 
 (defun gnus-simplify-mode-line ()
   "Make mode lines a bit simpler."
@@ -3745,7 +3746,7 @@ just the host name."
     ;; otherwise collapse to select method.
     (let* ((colon (string-match ":" group))
           (server (and colon (substring group 0 colon)))
-          (plus (and server (string-match "+" server))))
+          (plus (and server (string-match "\\+" server))))
       (when server
        (if plus
            (setq foreign (substring server (+ 1 plus)
diff --git a/lisp/gnus/gssapi.el b/lisp/gnus/gssapi.el
index d13aacc..7811763 100644
--- a/lisp/gnus/gssapi.el
+++ b/lisp/gnus/gssapi.el
@@ -1,6 +1,6 @@
 ;;; gssapi.el --- GSSAPI/Kerberos 5 interface for Emacs
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 ;;         Lars Magne Ingebrigtsen <address@hidden>
diff --git a/lisp/gnus/legacy-gnus-agent.el b/lisp/gnus/legacy-gnus-agent.el
index 128886e..5d5be44 100644
--- a/lisp/gnus/legacy-gnus-agent.el
+++ b/lisp/gnus/legacy-gnus-agent.el
@@ -1,6 +1,6 @@
 ;;; gnus-agent.el --- Legacy unplugged support for Gnus
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Kevin Greiner <address@hidden>
 ;; Keywords: news
diff --git a/lisp/gnus/mail-source.el b/lisp/gnus/mail-source.el
index 5af2920..7514e64 100644
--- a/lisp/gnus/mail-source.el
+++ b/lisp/gnus/mail-source.el
@@ -1,6 +1,6 @@
 ;;; mail-source.el --- functions for fetching mail
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news, mail
@@ -647,9 +647,9 @@ Deleting old (> %s day(s)) incoming mail file `%s'." diff 
bfile)
          ;; Don't check for old incoming files more than once per day to
          ;; save a lot of file accesses.
          (when (or (null mail-source-incoming-last-checked-time)
-                   (> (float-time
-                       (time-since mail-source-incoming-last-checked-time))
-                      (* 24 60 60)))
+                   (time-less-p
+                    (* 24 60 60)
+                    (time-since mail-source-incoming-last-checked-time)))
            (setq mail-source-incoming-last-checked-time (current-time))
            (mail-source-delete-old-incoming
             mail-source-delete-incoming
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 66356b6..dae4b0d 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -1,6 +1,6 @@
 ;;; message.el --- composing mail and news messages -*- lexical-binding: t -*-
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: mail, news
@@ -1285,11 +1285,10 @@ called and its result is inserted."
              (goto-char (point-min))
              (let ((case-fold-search nil))
                (re-search-forward "^OR\\>" nil t))))
-      ;; According to RFC822, "The field-name must be composed of printable
-      ;; ASCII characters (i. e., characters that have decimal values between
-      ;; 33 and 126, except colon)", i. e., any chars except ctl chars,
-      ;; space, or colon.
-      '(looking-at "[ \t]\\|[][!\"#$%&'()*+,-./0-9;<=>address@hidden|}~]+:"))
+      ;; According to RFC 822 and its successors, the field name must
+      ;; consist of printable US-ASCII characters other than colon,
+      ;; i.e., decimal 33-56 and 59-126.
+      '(looking-at "[ \t]\\|[][!\"#$%&'()*+,-./0-9;<=>address@hidden|}~]+:"))
   "Set this non-nil if the system's mailer runs the header and body together.
 \(This problem exists on Sunos 4 when sendmail is run in remote mode.)
 The value should be an expression to test whether the problem will
@@ -1733,7 +1732,7 @@ no, only reply back to the author."
   :type 'boolean)
 
 (defcustom message-user-fqdn nil
-  "Domain part of Message-Ids."
+  "Domain part of Message-IDs."
   :version "22.1"
   :group 'message-headers
   :link '(custom-manual "(message)News Headers")
@@ -1791,8 +1790,8 @@ You must have the \"hashcash\" binary installed, see 
`hashcash-path'."
     (concat
      "From "
 
-     ;; Many things can happen to an RFC 822 mailbox before it is put into
-     ;; a `From' line.  The leading phrase can be stripped, e.g.
+     ;; Many things can happen to an RFC 822 (or later) mailbox before it is
+     ;; put into a `From' line.  The leading phrase can be stripped, e.g.
      ;; `Joe <@w.x:address@hidden>' -> `<@w.x:address@hidden>'.  The <> can be 
stripped, e.g.
      ;; `<@x.y:address@hidden>' -> address@hidden:address@hidden'.  Everything 
starting with a CRLF
      ;; can be removed, e.g.
@@ -1853,7 +1852,7 @@ You must have the \"hashcash\" binary installed, see 
`hashcash-path'."
   "Alist of header names/filler functions.")
 
 (defvar message-header-format-alist
-  `((From)
+  '((From)
     (Newsgroups)
     (To)
     (Cc)
@@ -2716,7 +2715,7 @@ systematically send encrypted emails when possible."
 
 (easy-menu-define
   message-mode-menu message-mode-map "Message Menu."
-  `("Message"
+  '("Message"
     ["Yank Original" message-yank-original message-reply-buffer]
     ["Fill Yanked Message" message-fill-yanked-message t]
     ["Insert Signature" message-insert-signature t]
@@ -2750,7 +2749,7 @@ systematically send encrypted emails when possible."
 
 (easy-menu-define
   message-mode-field-menu message-mode-map ""
-  `("Field"
+  '("Field"
     ["To" message-goto-to t]
     ["From" message-goto-from t]
     ["Subject" message-goto-subject t]
@@ -5400,6 +5399,17 @@ Otherwise, generate and save a value for 
`canlock-password' first."
             (message "Denied posting -- only quoted text.")
             nil)))))))
 
+(defun message--rotate-fixnum-left (n)
+  "Rotate the fixnum N left by one bit in a fixnum word.
+The result is a fixnum."
+  (logior (if (natnump n) 0 1)
+         (ash (cond ((< (ash most-positive-fixnum -1) n)
+                     (logior n most-negative-fixnum))
+                    ((< n (ash most-negative-fixnum -1))
+                     (logand n most-positive-fixnum))
+                    (n))
+              1)))
+
 (defun message-checksum ()
   "Return a \"checksum\" for the current buffer."
   (let ((sum 0))
@@ -5409,7 +5419,7 @@ Otherwise, generate and save a value for 
`canlock-password' first."
        (concat "^" (regexp-quote mail-header-separator) "$"))
       (while (not (eobp))
        (when (not (looking-at "[ \t\n]"))
-         (setq sum (logxor (ash sum 1) (if (natnump sum) 0 1)
+         (setq sum (logxor (message--rotate-fixnum-left sum)
                            (char-after))))
        (forward-char 1)))
     sum))
@@ -5531,7 +5541,7 @@ In posting styles use `(\"Expires\" (make-expires-date 
30))'."
   (let* ((cur (decode-time))
         (nday (+ days (nth 3 cur))))
     (setf (nth 3 cur) nday)
-    (message-make-date (apply 'encode-time cur))))
+    (message-make-date (encode-time cur))))
 
 (defun message-make-message-id ()
   "Make a unique Message-ID."
@@ -5721,7 +5731,7 @@ In posting styles use `(\"Expires\" (make-expires-date 
30))'."
        (insert fullname)
        (goto-char (point-min))
        ;; Look for a character that cannot appear unquoted
-       ;; according to RFC 822.
+       ;; according to RFC 822 (or later).
        (when (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]" nil 1)
          ;; Quote fullname, escaping specials.
          (goto-char (point-min))
@@ -5735,8 +5745,7 @@ In posting styles use `(\"Expires\" (make-expires-date 
30))'."
        (let ((fullname-start (point)))
          (insert fullname)
          (goto-char fullname-start)
-         ;; RFC 822 says \ and nonmatching parentheses
-         ;; must be escaped in comments.
+         ;; \ and nonmatching parentheses must be escaped in comments.
          ;; Escape every instance of ()\ ...
          (while (re-search-forward "[()\\]" nil 1)
            (replace-match "\\\\\\&" t))
@@ -7459,7 +7468,7 @@ Optional DIGEST will use digest to forward."
     ;; Consider there is no illegible text.
     (add-text-properties
      b (point)
-     `(no-illegible-text t rear-nonsticky t start-open t))))
+     '(no-illegible-text t rear-nonsticky t start-open t))))
 
 (defun message-forward-make-body-mml (forward-buffer)
   (insert "\n\n<#mml type=message/rfc822 disposition=inline>\n")
@@ -8015,18 +8024,11 @@ regular text mode tabbing command."
               (skip-chars-backward "^, \t\n") (point))))
        (completion-ignore-case t)
        (e (progn (skip-chars-forward "^,\t\n ") (point)))
-       group collection)
-    (when (and (boundp 'gnus-active-hashtb)
-              gnus-active-hashtb)
-      (mapatoms
-       (lambda (symbol)
-        (setq group (symbol-name symbol))
-        (push (if (string-match "[^\000-\177]" group)
-                  (gnus-group-decoded-name group)
-                group)
-              collection))
-       gnus-active-hashtb))
-    (completion-in-region b e collection)))
+       (collection (when (and (boundp 'gnus-active-hashtb)
+                              gnus-active-hashtb)
+                     (hash-table-keys gnus-active-hashtb))))
+    (when collection
+      (completion-in-region b e collection))))
 
 (defun message-expand-name ()
   (cond ((and (memq 'eudc message-expand-name-databases)
@@ -8051,7 +8053,7 @@ regular text mode tabbing command."
 If SHOW is non-nil, the arguments TEXT... are displayed in a temp buffer.
 The following arguments may contain lists of values."
   (if (and show
-          (setq text (message-flatten-list text)))
+          (setq text (flatten-tree text)))
       (save-window-excursion
         (with-output-to-temp-buffer " *MESSAGE information message*"
           (with-current-buffer " *MESSAGE information message*"
@@ -8061,15 +8063,7 @@ The following arguments may contain lists of values."
        (funcall ask question))
     (funcall ask question)))
 
-(defun message-flatten-list (list)
-  "Return a new, flat list that contains all elements of LIST.
-
-\(message-flatten-list \\='(1 (2 3 (4 5 (6))) 7))
-=> (1 2 3 4 5 6 7)"
-  (cond ((consp list)
-        (apply 'append (mapcar 'message-flatten-list list)))
-       (list
-        (list list))))
+(define-obsolete-function-alias 'message-flatten-list #'flatten-tree "27.1")
 
 (defun message-generate-new-buffer-clone-locals (name &optional varstr)
   "Create and return a buffer with name based on NAME using 
`generate-new-buffer'.
diff --git a/lisp/gnus/mm-archive.el b/lisp/gnus/mm-archive.el
index 6c6361a..7e2a914 100644
--- a/lisp/gnus/mm-archive.el
+++ b/lisp/gnus/mm-archive.el
@@ -1,6 +1,6 @@
 ;;; mm-archive.el --- Functions for parsing archive files as MIME
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; This file is part of GNU Emacs.
diff --git a/lisp/gnus/mm-bodies.el b/lisp/gnus/mm-bodies.el
index e292dac..e1e1a12 100644
--- a/lisp/gnus/mm-bodies.el
+++ b/lisp/gnus/mm-bodies.el
@@ -1,6 +1,6 @@
 ;;; mm-bodies.el --- Functions for decoding MIME things
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;;     MORIOKA Tomohiko <address@hidden>
@@ -35,7 +35,7 @@
 ;; BS, vertical TAB, form feed, and ^_
 ;;
 ;; Note that CR is *not* included, as that would allow a non-paired CR
-;; in the body contrary to RFC 2822:
+;; in the body contrary to RFC 822 (or later):
 ;;
 ;;   - CR and LF MUST only occur together as CRLF; they MUST NOT
 ;;     appear independently in the body.
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index 3e6883b..3f25541 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -1,6 +1,6 @@
 ;;; mm-decode.el --- Functions for decoding MIME things  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;;     MORIOKA Tomohiko <address@hidden>
@@ -190,45 +190,45 @@ before the external MIME handler is invoked."
   :group 'mime-display)
 
 (defcustom mm-inline-media-tests
-  '(("image/p?jpeg"
+  `(("image/p?jpeg"
      mm-inline-image
-     (lambda (handle)
+     ,(lambda (handle)
        (mm-valid-and-fit-image-p 'jpeg handle)))
     ("image/png"
      mm-inline-image
-     (lambda (handle)
+     ,(lambda (handle)
        (mm-valid-and-fit-image-p 'png handle)))
     ("image/gif"
      mm-inline-image
-     (lambda (handle)
+     ,(lambda (handle)
        (mm-valid-and-fit-image-p 'gif handle)))
     ("image/tiff"
      mm-inline-image
-     (lambda (handle)
+     ,(lambda (handle)
        (mm-valid-and-fit-image-p 'tiff handle)))
     ("image/xbm"
      mm-inline-image
-     (lambda (handle)
+     ,(lambda (handle)
        (mm-valid-and-fit-image-p 'xbm handle)))
     ("image/x-xbitmap"
      mm-inline-image
-     (lambda (handle)
+     ,(lambda (handle)
        (mm-valid-and-fit-image-p 'xbm handle)))
     ("image/xpm"
      mm-inline-image
-     (lambda (handle)
+     ,(lambda (handle)
        (mm-valid-and-fit-image-p 'xpm handle)))
     ("image/x-xpixmap"
      mm-inline-image
-     (lambda (handle)
+     ,(lambda (handle)
        (mm-valid-and-fit-image-p 'xpm handle)))
     ("image/bmp"
      mm-inline-image
-     (lambda (handle)
+     ,(lambda (handle)
        (mm-valid-and-fit-image-p 'bmp handle)))
     ("image/x-portable-bitmap"
      mm-inline-image
-     (lambda (handle)
+     ,(lambda (handle)
        (mm-valid-and-fit-image-p 'pbm handle)))
     ("text/plain" mm-inline-text identity)
     ("text/enriched" mm-inline-text identity)
@@ -246,13 +246,14 @@ before the external MIME handler is invoked."
     ("text/x-org" mm-display-org-inline identity)
     ("text/html"
      mm-inline-text-html
-     (lambda (handle)
+     ,(lambda (_handle)
        mm-text-html-renderer))
     ("text/x-vcard"
      mm-inline-text-vcard
-     (lambda (handle)
+     ,(lambda (_handle)
        (or (featurep 'vcard)
           (locate-library "vcard"))))
+    ("text/calendar" gnus-icalendar-mm-inline identity)
     ("message/delivery-status" mm-inline-text identity)
     ("message/rfc822" mm-inline-message identity)
     ("message/partial" mm-inline-partial identity)
@@ -261,13 +262,13 @@ before the external MIME handler is invoked."
     ("application/x-.?tar\\(-.*\\)?" mm-archive-dissect-and-inline identity)
     ("application/zip" mm-archive-dissect-and-inline identity)
     ("audio/wav" mm-inline-audio
-     (lambda (handle)
-       (and (or (featurep 'nas-sound) (featurep 'native-sound))
+     ,(lambda (_handle)
+       (and (fboundp 'device-sound-enabled-p)
            (device-sound-enabled-p))))
     ("audio/au"
      mm-inline-audio
-     (lambda (handle)
-       (and (or (featurep 'nas-sound) (featurep 'native-sound))
+     ,(lambda (_handle)
+       (and (fboundp 'device-sound-enabled-p)
            (device-sound-enabled-p))))
     ("application/pgp-signature" ignore identity)
     ("application/x-pkcs7-signature" ignore identity)
@@ -279,7 +280,7 @@ before the external MIME handler is invoked."
     ("multipart/related" ignore identity)
     ("image/.*"
      mm-inline-image
-     (lambda (handle)
+     ,(lambda (handle)
        (and (mm-valid-image-format-p 'imagemagick)
            (mm-with-unibyte-buffer
              (mm-insert-part handle)
@@ -331,6 +332,7 @@ a list of regexps."
 
 (defcustom mm-automatic-display
   '("text/plain" "text/enriched" "text/richtext" "text/html" "text/x-verbatim"
+    "text/calendar"
     "text/x-vcard" "image/.*" "message/delivery-status" "multipart/.*"
     "message/rfc822" "text/x-patch" "text/dns" "application/pgp-signature"
     "application/emacs-lisp" "application/x-emacs-lisp"
@@ -763,7 +765,7 @@ MIME-Version header before proceeding."
         (mb enable-multibyte-characters)
         beg)
     (goto-char (point-min))
-    (search-forward-regexp "^\n" nil t)
+    (search-forward-regexp "^\n" nil 'move) ;; There might be no body.
     (setq beg (point))
     (with-current-buffer
           (generate-new-buffer " *mm*")
@@ -890,6 +892,7 @@ external if displayed external."
            (when method
              (message "Viewing with %s" method))
            (let ((mm (current-buffer))
+                 (attachment-filename (mm-handle-filename handle))
                  (non-viewer (assq 'non-viewer
                                    (mailcap-mime-info
                                     (mm-handle-media-type handle) t))))
@@ -899,6 +902,9 @@ external if displayed external."
                        (when (and (boundp 'gnus-summary-buffer)
                                   (bufferp gnus-summary-buffer)
                                   (buffer-name gnus-summary-buffer))
+                         (when attachment-filename
+                           (with-current-buffer mm
+                             (rename-buffer (format "*mm* %s" 
attachment-filename) t)))
                          ;; So that we pop back to the right place, sort of.
                          (switch-to-buffer gnus-summary-buffer)
                          (switch-to-buffer mm))
diff --git a/lisp/gnus/mm-encode.el b/lisp/gnus/mm-encode.el
index 361e85f..7d10409 100644
--- a/lisp/gnus/mm-encode.el
+++ b/lisp/gnus/mm-encode.el
@@ -1,6 +1,6 @@
 ;;; mm-encode.el --- Functions for encoding MIME things
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;;     MORIOKA Tomohiko <address@hidden>
diff --git a/lisp/gnus/mm-extern.el b/lisp/gnus/mm-extern.el
index fbae669..c305443 100644
--- a/lisp/gnus/mm-extern.el
+++ b/lisp/gnus/mm-extern.el
@@ -1,6 +1,6 @@
 ;;; mm-extern.el --- showing message/external-body  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <address@hidden>
 ;; Keywords: message external-body
diff --git a/lisp/gnus/mm-partial.el b/lisp/gnus/mm-partial.el
index 51dc8b8..c68ab4a 100644
--- a/lisp/gnus/mm-partial.el
+++ b/lisp/gnus/mm-partial.el
@@ -1,6 +1,6 @@
 ;;; mm-partial.el --- showing message/partial
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <address@hidden>
 ;; Keywords: message partial
diff --git a/lisp/gnus/mm-url.el b/lisp/gnus/mm-url.el
index 1008c60..b53a1bc 100644
--- a/lisp/gnus/mm-url.el
+++ b/lisp/gnus/mm-url.el
@@ -1,6 +1,6 @@
 ;;; mm-url.el --- a wrapper of url functions/commands for Gnus
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <address@hidden>
 
diff --git a/lisp/gnus/mm-util.el b/lisp/gnus/mm-util.el
index 14a232f..00a8a53 100644
--- a/lisp/gnus/mm-util.el
+++ b/lisp/gnus/mm-util.el
@@ -1,6 +1,6 @@
 ;;; mm-util.el --- Utility functions for Mule and low level things  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;;     MORIOKA Tomohiko <address@hidden>
@@ -241,7 +241,7 @@ superset of iso-8859-1."
        (widget-convert
         'list
         `(set :inline t :format "%v" ,@(nreverse rest))
-        `(repeat :inline t :tag "Other options"
+        '(repeat :inline t :tag "Other options"
                  (cons :format "%v"
                        (symbol :size 3 :format "(%v")
                        (symbol :size 3 :format " . %v)\n")))))))
diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el
index cf6d6d1..a00d640 100644
--- a/lisp/gnus/mm-uu.el
+++ b/lisp/gnus/mm-uu.el
@@ -1,6 +1,6 @@
 ;;; mm-uu.el --- Return uu stuff as mm handles
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <address@hidden>
 ;; Keywords: postscript uudecode binhex shar forward gnatsweb pgp
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index 15eac11..8ce0943 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -1,6 +1,6 @@
 ;;; mm-view.el --- functions for viewing MIME objects
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; This file is part of GNU Emacs.
@@ -370,10 +370,12 @@
          (enriched-decode (point-min) (point-max))))
       (mm-handle-set-undisplayer
        handle
-       `(lambda ()
-          (let ((inhibit-read-only t))
-           (delete-region ,(copy-marker (point-min) t)
-                          ,(point-max-marker))))))))
+       (if (= (point-min) (point-max))
+          #'ignore
+        `(lambda ()
+           (let ((inhibit-read-only t))
+             (delete-region ,(copy-marker (point-min) t)
+                            ,(point-max-marker)))))))))
 
 (defun mm-insert-inline (handle text)
   "Insert TEXT inline from HANDLE."
@@ -491,7 +493,8 @@ If MODE is not set, try to find mode automatically."
            (let ((auto-mode-alist
                   (delq (rassq 'doc-view-mode-maybe auto-mode-alist)
                         (copy-sequence auto-mode-alist))))
-             (set-auto-mode)))
+             (set-auto-mode)
+             (setq mode major-mode)))
          ;; The mode function might have already turned on font-lock.
          ;; Do not fontify if the guess mode is fundamental.
          (unless (or font-lock-mode
diff --git a/lisp/gnus/mml-sec.el b/lisp/gnus/mml-sec.el
index 9a64853..db7489f 100644
--- a/lisp/gnus/mml-sec.el
+++ b/lisp/gnus/mml-sec.el
@@ -1,6 +1,6 @@
 ;;; mml-sec.el --- A package with security functions for MML documents
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 
@@ -659,6 +659,8 @@ The passphrase is read and cached."
     (catch 'break
       (dolist (uid uids nil)
        (if (and (stringp (epg-user-id-string uid))
+                 (car (mail-header-parse-address
+                       (epg-user-id-string uid)))
                 (equal (downcase (car (mail-header-parse-address
                                        (epg-user-id-string uid))))
                        (downcase (car (mail-header-parse-address
diff --git a/lisp/gnus/mml-smime.el b/lisp/gnus/mml-smime.el
index 9df33d0..78fac8a 100644
--- a/lisp/gnus/mml-smime.el
+++ b/lisp/gnus/mml-smime.el
@@ -1,6 +1,6 @@
 ;;; mml-smime.el --- S/MIME support for MML
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 ;; Keywords: Gnus, MIME, S/MIME, MML
diff --git a/lisp/gnus/mml.el b/lisp/gnus/mml.el
index 9fd72a9..f6d358d 100644
--- a/lisp/gnus/mml.el
+++ b/lisp/gnus/mml.el
@@ -1,6 +1,6 @@
 ;;; mml.el --- A package for parsing and validating MML documents
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; This file is part of GNU Emacs.
@@ -29,6 +29,7 @@
 (require 'mml-sec)
 (eval-when-compile (require 'cl-lib))
 (eval-when-compile (require 'url))
+(eval-when-compile (require 'gnus-util))
 
 (autoload 'message-make-message-id "message")
 (declare-function gnus-setup-posting-charset "gnus-msg" (group))
@@ -982,8 +983,10 @@ If HANDLES is non-nil, use it instead reparsing the 
buffer."
   (unless handles
     (setq handles (mm-dissect-buffer t)))
   (goto-char (point-min))
-  (search-forward "\n\n" nil t)
-  (delete-region (point) (point-max))
+  (if (search-forward "\n\n" nil 'move)
+      (delete-region (point) (point-max))
+    ;; No content in the part that is the sole part of this message.
+    (insert (if (bolp) "\n" "\n\n")))
   (if (stringp (car handles))
       (mml-insert-mime handles)
     (mml-insert-mime handles t))
@@ -1152,7 +1155,7 @@ If HANDLES is non-nil, use it instead reparsing the 
buffer."
 
 (easy-menu-define
   mml-menu mml-mode-map ""
-  `("Attachments"
+  '("Attachments"
     ["Attach File..." mml-attach-file :help "Attach a file at point"]
     ["Attach Buffer..." mml-attach-buffer
      :help "Attach a buffer to the outgoing message"]
@@ -1545,7 +1548,6 @@ Should be adopted if code in `message-send-mail' is 
changed."
 
 (defvar mml-preview-buffer nil)
 
-(autoload 'gnus-make-hashtable "gnus-util")
 (autoload 'widget-button-press "wid-edit" nil t)
 (declare-function widget-event-point "wid-edit" (event))
 ;; If gnus-buffer-configuration is bound this is loaded.
diff --git a/lisp/gnus/mml1991.el b/lisp/gnus/mml1991.el
index b2056b2..ce282ec 100644
--- a/lisp/gnus/mml1991.el
+++ b/lisp/gnus/mml1991.el
@@ -1,6 +1,6 @@
 ;;; mml1991.el --- Old PGP message format (RFC 1991) support for MML
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Sascha Lüdecke <address@hidden>,
 ;;     Simon Josefsson <address@hidden> (Mailcrypt interface, Gnus glue)
diff --git a/lisp/gnus/mml2015.el b/lisp/gnus/mml2015.el
index 403b5e1..d7876a3 100644
--- a/lisp/gnus/mml2015.el
+++ b/lisp/gnus/mml2015.el
@@ -1,6 +1,6 @@
 ;;; mml2015.el --- MIME Security with Pretty Good Privacy (PGP)
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <address@hidden>
 ;; Keywords: PGP MIME MML
diff --git a/lisp/gnus/nnagent.el b/lisp/gnus/nnagent.el
index 1b2b13e..64f3a86 100644
--- a/lisp/gnus/nnagent.el
+++ b/lisp/gnus/nnagent.el
@@ -1,6 +1,6 @@
 ;;; nnagent.el --- offline backend for Gnus
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/nnbabyl.el b/lisp/gnus/nnbabyl.el
index 9f80a75..3b31645 100644
--- a/lisp/gnus/nnbabyl.el
+++ b/lisp/gnus/nnbabyl.el
@@ -1,6 +1,6 @@
 ;;; nnbabyl.el --- rmail mbox access for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;;     Masanobu UMEDA <address@hidden>
@@ -624,7 +624,7 @@
 (defun nnbabyl-check-mbox ()
   "Go through the nnbabyl mbox and make sure that no article numbers are 
reused."
   (interactive)
-  (let ((idents (make-vector 1000 0))
+  (let ((idents (gnus-make-hashtable 1000))
        id)
     (save-excursion
       (when (or (not nnbabyl-mbox-buffer)
@@ -633,13 +633,13 @@
       (set-buffer nnbabyl-mbox-buffer)
       (goto-char (point-min))
       (while (re-search-forward "^X-Gnus-Newsgroup: \\([^ ]+\\) "  nil t)
-       (if (intern-soft (setq id (match-string 1)) idents)
+       (if (gethash (setq id (match-string 1)) idents)
            (progn
              (delete-region (point-at-bol) (progn (forward-line 1) (point)))
              (nnheader-message 7 "Moving %s..." id)
              (nnbabyl-save-mail
               (nnmail-article-group 'nnbabyl-active-number)))
-         (intern id idents)))
+         (puthash id t idents)))
       (when (buffer-modified-p (current-buffer))
        (save-buffer))
       (nnmail-save-active nnbabyl-group-alist nnbabyl-active-file)
diff --git a/lisp/gnus/nndiary.el b/lisp/gnus/nndiary.el
index 0b300c1..c8b7eed 100644
--- a/lisp/gnus/nndiary.el
+++ b/lisp/gnus/nndiary.el
@@ -1,6 +1,6 @@
 ;;; nndiary.el --- A diary back end for Gnus
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author:        Didier Verna <address@hidden>
 ;; Maintainer:    Didier Verna <address@hidden>
@@ -1278,28 +1278,28 @@ all.  This may very well take some time.")
       (push
        (cond ((eq (cdr reminder) 'minute)
              (time-subtract
-              (apply 'encode-time 0 (nthcdr 1 date-elts))
-              (seconds-to-time (* (car reminder) 60.0))))
+              (apply #'encode-time 0 (nthcdr 1 date-elts))
+              (encode-time (* (car reminder) 60.0))))
             ((eq (cdr reminder) 'hour)
              (time-subtract
-              (apply 'encode-time 0 0 (nthcdr 2 date-elts))
-              (seconds-to-time (* (car reminder) 3600.0))))
+              (apply #'encode-time 0 0 (nthcdr 2 date-elts))
+              (encode-time (* (car reminder) 3600.0))))
             ((eq (cdr reminder) 'day)
              (time-subtract
-              (apply 'encode-time 0 0 0 (nthcdr 3 date-elts))
-              (seconds-to-time (* (car reminder) 86400.0))))
+              (apply #'encode-time 0 0 0 (nthcdr 3 date-elts))
+              (encode-time (* (car reminder) 86400.0))))
             ((eq (cdr reminder) 'week)
              (time-subtract
-              (apply 'encode-time 0 0 0 monday (nthcdr 4 date-elts))
-              (seconds-to-time (* (car reminder) 604800.0))))
+              (apply #'encode-time 0 0 0 monday (nthcdr 4 date-elts))
+              (encode-time (* (car reminder) 604800.0))))
             ((eq (cdr reminder) 'month)
              (time-subtract
-              (apply 'encode-time 0 0 0 1 (nthcdr 4 date-elts))
-              (seconds-to-time (* (car reminder) 18748800.0))))
+              (apply #'encode-time 0 0 0 1 (nthcdr 4 date-elts))
+              (encode-time (* (car reminder) 18748800.0))))
             ((eq (cdr reminder) 'year)
              (time-subtract
-              (apply 'encode-time 0 0 0 1 1 (nthcdr 5 date-elts))
-              (seconds-to-time (* (car reminder) 400861056.0)))))
+              (apply #'encode-time 0 0 0 1 1 (nthcdr 5 date-elts))
+              (encode-time (* (car reminder) 400861056.0)))))
        res))
     (sort res 'time-less-p)))
 
diff --git a/lisp/gnus/nndir.el b/lisp/gnus/nndir.el
index 6dc6c33..82502df 100644
--- a/lisp/gnus/nndir.el
+++ b/lisp/gnus/nndir.el
@@ -1,6 +1,6 @@
 ;;; nndir.el --- single directory newsgroup access for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
diff --git a/lisp/gnus/nndoc.el b/lisp/gnus/nndoc.el
index 76e785d..8f1217b 100644
--- a/lisp/gnus/nndoc.el
+++ b/lisp/gnus/nndoc.el
@@ -1,6 +1,6 @@
 ;;; nndoc.el --- single file access for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;;     Masanobu UMEDA <address@hidden>
diff --git a/lisp/gnus/nndraft.el b/lisp/gnus/nndraft.el
index cee7c92..bc475ee 100644
--- a/lisp/gnus/nndraft.el
+++ b/lisp/gnus/nndraft.el
@@ -1,6 +1,6 @@
 ;;; nndraft.el --- draft article access for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
diff --git a/lisp/gnus/nneething.el b/lisp/gnus/nneething.el
index ced75c8..f64007a 100644
--- a/lisp/gnus/nneething.el
+++ b/lisp/gnus/nneething.el
@@ -1,6 +1,6 @@
 ;;; nneething.el --- arbitrary file access for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;;     Masanobu UMEDA <address@hidden>
@@ -319,7 +319,7 @@ included.")
      "Subject: " (file-name-nondirectory file) (or extra-msg "") "\n"
      "Message-ID: <nneething-" (nneething-encode-file-name file)
      "@" (system-name) ">\n"
-     (if (zerop (float-time (file-attribute-modification-time atts))) ""
+     (if (time-equal-p 0 (file-attribute-modification-time atts)) ""
        (concat "Date: "
               (current-time-string (file-attribute-modification-time atts))
               "\n"))
diff --git a/lisp/gnus/nnfolder.el b/lisp/gnus/nnfolder.el
index 8ef6f2a..1c83045 100644
--- a/lisp/gnus/nnfolder.el
+++ b/lisp/gnus/nnfolder.el
@@ -1,6 +1,6 @@
 ;;; nnfolder.el --- mail folder access for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 ;;      ShengHuo Zhu <address@hidden> (adding NOV)
diff --git a/lisp/gnus/nngateway.el b/lisp/gnus/nngateway.el
index 8b7898c..92e36a2 100644
--- a/lisp/gnus/nngateway.el
+++ b/lisp/gnus/nngateway.el
@@ -1,6 +1,6 @@
 ;;; nngateway.el --- posting news via mail gateways
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/nnheader.el b/lisp/gnus/nnheader.el
index 83a9c3f..090b842 100644
--- a/lisp/gnus/nnheader.el
+++ b/lisp/gnus/nnheader.el
@@ -1,6 +1,6 @@
 ;;; nnheader.el --- header access macros for Gnus and its backends
 
-;; Copyright (C) 1987-1990, 1993-1998, 2000-2018 Free Software
+;; Copyright (C) 1987-1990, 1993-1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <address@hidden>
@@ -408,7 +408,7 @@ on your system, you could say something like:
   `(let ((id (nnheader-nov-field)))
      (if (string-match "^<[^>]+>$" id)
         ,(if nnheader-uniquify-message-id
-             `(if (string-match "address@hidden@" id)
+             '(if (string-match "address@hidden@" id)
                   (concat (substring id 0 (match-beginning 0))
                           (substring id (1- (match-end 0))))
                 id)
@@ -1042,12 +1042,7 @@ See `find-file-noselect' for the arguments."
 ;; When changing this function, consider changing `pop3-accept-process-output'
 ;; as well.
 (defun nnheader-accept-process-output (process)
-  (accept-process-output
-   process
-   (truncate nnheader-read-timeout)
-   (truncate (* (- nnheader-read-timeout
-                  (truncate nnheader-read-timeout))
-               1000))))
+  (accept-process-output process nnheader-read-timeout))
 
 (defun nnheader-update-marks-actions (backend-marks actions)
   (dolist (action actions)
@@ -1080,7 +1075,7 @@ See `find-file-noselect' for the arguments."
 (defvar nnheader-last-message-time '(0 0))
 (defun nnheader-message-maybe (&rest args)
   (let ((now (current-time)))
-    (when (> (float-time (time-subtract now nnheader-last-message-time)) 1)
+    (when (time-less-p 1 (time-subtract now nnheader-last-message-time))
       (setq nnheader-last-message-time now)
       (apply 'nnheader-message args))))
 
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el
index 12892c5..ac1d286 100644
--- a/lisp/gnus/nnimap.el
+++ b/lisp/gnus/nnimap.el
@@ -1,6 +1,6 @@
 ;;; nnimap.el --- IMAP interface for Gnus
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;;         Simon Josefsson <address@hidden>
@@ -386,12 +386,12 @@ textual parts.")
        (with-current-buffer buffer
          (when (and nnimap-object
                     (nnimap-last-command-time nnimap-object)
-                    (> (float-time
-                        (time-subtract
-                         now
-                         (nnimap-last-command-time nnimap-object)))
-                       ;; More than five minutes since the last command.
-                       (* 5 60)))
+                    (time-less-p
+                     ;; More than five minutes since the last command.
+                     (* 5 60)
+                     (time-subtract
+                      now
+                      (nnimap-last-command-time nnimap-object))))
             (ignore-errors              ;E.g. "buffer foo has no process".
               (nnimap-send-command "NOOP"))))))))
 
@@ -413,8 +413,11 @@ textual parts.")
        nil
       stream)))
 
+;; This is only needed for Windows XP or earlier
 (defun nnimap-map-port (port)
-  (if (equal port "imaps")
+  (if (and (eq system-type 'windows-nt)
+           (<= (car (x-server-version)) 5)
+           (equal port "imaps"))
       "993"
     port))
 
@@ -804,7 +807,7 @@ textual parts.")
     (insert "\n--" boundary "--\n")))
 
 (defun nnimap-find-wanted-parts (structure)
-  (message-flatten-list (nnimap-find-wanted-parts-1 structure "")))
+  (flatten-tree (nnimap-find-wanted-parts-1 structure "")))
 
 (defun nnimap-find-wanted-parts-1 (structure prefix)
   (let ((num 1)
@@ -1203,8 +1206,8 @@ If LIMIT, first try to limit the search to the N last 
articles."
            ;; We don't really care about the article number, because
            ;; that's determined by the IMAP server later.  So just
            ;; return the group name.
-           `(lambda (group)
-              (list (list group)))))))
+           (lambda (group)
+              (list (list group)))))))
   (setq group (nnimap-decode-gnus-group group))
   (when (nnimap-change-group nil server)
     (nnmail-check-syntax)
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el
index 7e5f56e..37a38a5 100644
--- a/lisp/gnus/nnir.el
+++ b/lisp/gnus/nnir.el
@@ -1,6 +1,6 @@
 ;;; nnir.el --- Search mail with various search engines  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <address@hidden>
 ;; Swish-e and Swish++ backends by:
@@ -518,6 +518,24 @@ that it is for notmuch, not Namazu."
   :type '(regexp)
   :group 'nnir)
 
+(defcustom nnir-notmuch-filter-group-names-function nil
+  "Whether and how to use Gnus group names as \"path:\" search terms.
+When nil, the groups being searched in are not used as notmuch
+:path search terms.  It's still possible to use \"path:\" terms
+manually within the search query, however.
+
+When a function, map this function over all the group names.  To
+use the group names unchanged, set to (lambda (g) g).  Multiple
+transforms (for instance, converting \".\" to \"/\") can be added
+like so:
+
+\(add-function :filter-return
+   nnir-notmuch-filter-group-names-function
+   (lambda (g) (replace-regexp-in-string \"\\\\.\" \"/\" g)))"
+  :version "27.1"
+  :type '(choice function
+                nil))
+
 ;;; Developer Extension Variable:
 
 (defvar nnir-engines
@@ -639,7 +657,7 @@ skips all prompting."
   (let ((backend (car (gnus-server-to-method server))))
     (if backend
        (nnoo-change-server backend server definitions)
-      (add-hook 'gnus-summary-mode-hook 'nnir-mode)
+      (add-hook 'gnus-summary-prepared-hook 'nnir-mode)
       (nnoo-change-server 'nnir server definitions))))
 
 (deffoo nnir-request-group (group &optional server dont-check _info)
@@ -1167,7 +1185,7 @@ returning the one at the supplied position."
 
 (defun nnir-imap-end-of-input ()
   "Are we at the end of input?"
-  (skip-chars-forward "[[:blank:]]")
+  (skip-chars-forward "[:blank:]")
   (looking-at "$"))
 
 
@@ -1505,23 +1523,31 @@ Tested with Namazu 2.0.6 on a GNU/Linux system."
                                (> (nnir-artitem-rsv x)
                                   (nnir-artitem-rsv y)))))))))
 
-(defun nnir-run-notmuch (query server &optional _group)
+(defun nnir-run-notmuch (query server &optional groups)
   "Run QUERY against notmuch.
 Returns a vector of (group name, file name) pairs (also vectors,
-actually)."
-
-  ;; (when group
-  ;;   (error "The notmuch backend cannot search specific groups"))
+actually).  If GROUPS is a list of group names, use them to
+construct path: search terms (see the variable
+`nnir-notmuch-filter-group-names-function')."
 
   (save-excursion
-    (let ( (qstring (cdr (assq 'query query)))
-          (groupspec (cdr (assq 'notmuch-group query)))
+    (let* ((qstring (cdr (assq 'query query)))
           (prefix (nnir-read-server-parm 'nnir-notmuch-remove-prefix server))
            artlist
           (article-pattern (if (string-match "\\`nnmaildir:"
                                              (gnus-group-server server))
-                              ":[0-9]+"
-                            "^[0-9]+$"))
+                               ":[0-9]+"
+                             "^[0-9]+$"))
+          (groups (when nnir-notmuch-filter-group-names-function
+                    (delq nil
+                          (mapcar nnir-notmuch-filter-group-names-function
+                                  (mapcar #'gnus-group-short-name groups)))))
+          (pathquery (when groups
+                       (concat " ("
+                               (mapconcat (lambda (g)
+                                            (format "path:%s" g))
+                                          groups " or")
+                               ")")))
            artno dirnam filenam)
 
       (when (equal "" qstring)
@@ -1530,10 +1556,14 @@ actually)."
       (set-buffer (get-buffer-create nnir-tmp-buffer))
       (erase-buffer)
 
-      (if groupspec
-          (message "Doing notmuch query %s on %s..." qstring groupspec)
+      (if groups
+          (message "Doing notmuch query %s on %s..."
+                  qstring (mapconcat #'identity groups " "))
         (message "Doing notmuch query %s..." qstring))
 
+      (when groups
+       (setq qstring (concat qstring pathquery)))
+
       (let* ((cp-list `( ,nnir-notmuch-program
                          nil            ; input from /dev/null
                          t              ; output
@@ -1571,10 +1601,7 @@ actually)."
         (when (string-match article-pattern artno)
           (when (not (null dirnam))
 
-           ;; maybe limit results to matching groups.
-           (when (or (not groupspec)
-                     (string-match groupspec dirnam))
-             (nnir-add-result dirnam artno "" prefix server artlist)))))
+           (nnir-add-result dirnam artno "" prefix server artlist))))
 
       (message "Massaging notmuch output...done")
 
diff --git a/lisp/gnus/nnmail.el b/lisp/gnus/nnmail.el
index 13c4303..a95cdb4 100644
--- a/lisp/gnus/nnmail.el
+++ b/lisp/gnus/nnmail.el
@@ -1,6 +1,6 @@
 ;;; nnmail.el --- mail support functions for the Gnus mail backends
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news, mail
@@ -489,7 +489,7 @@ Example:
     (from . "from\\|sender\\|resent-from")
     (nato . "to\\|cc\\|resent-to\\|resent-cc")
     (naany . "from\\|to\\|cc\\|sender\\|resent-from\\|resent-to\\|resent-cc")
-    (list . "list-id\\|list-post\\|x-mailing-list\||x-beenthere\\|x-loop"))
+    (list . "list-id\\|list-post\\|x-mailing-list\\|x-beenthere\\|x-loop"))
   "Alist of abbreviations allowed in `nnmail-split-fancy'."
   :group 'nnmail-split
   :type '(repeat (cons :format "%v" symbol regexp)))
@@ -1543,11 +1543,8 @@ See the documentation for the variable 
`nnmail-split-fancy' for details."
                                               (format "%s-active-timestamp"
                                                       backend)))
                              (error 'none))))
-                    (not (consp timestamp))
-                    (equal timestamp '(0 0))
-                    (> (nth 0 file-time) (nth 0 timestamp))
-                    (and (= (nth 0 file-time) (nth 0 timestamp))
-                         (> (nth 1 file-time) (nth 1 timestamp))))))
+                    (eq timestamp 'none)
+                    (time-less-p timestamp file-time))))
        (save-excursion
          (or (eq timestamp 'none)
              (set (intern (format "%s-active-timestamp" backend))
@@ -1885,7 +1882,7 @@ If TIME is nil, then return the cutoff time for oldness 
instead."
             (setq days (days-to-time days))
             ;; Compare the time with the current time.
             (if (null time)
-                (time-subtract nil days)
+                (time-since days)
               (ignore-errors (time-less-p days (time-since time)))))))))
 
 (declare-function gnus-group-mark-article-read "gnus-group" (group article))
diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el
index afaf3dc..9d02773 100644
--- a/lisp/gnus/nnmaildir.el
+++ b/lisp/gnus/nnmaildir.el
@@ -68,7 +68,9 @@
 (require 'message)
 (require 'nnmail)
 
-(eval-when-compile (require 'cl-lib))
+(eval-when-compile
+  (require 'cl-lib)
+  (require 'subr-x))
 
 (defconst nnmaildir-version "Gnus")
 
@@ -135,11 +137,10 @@ This variable is set by `nnmaildir-request-article'.")
 (defconst nnmaildir--delivery-pid (concat "P" (number-to-string (emacs-pid))))
 (defvar   nnmaildir--delivery-count nil)
 
-;; An obarry containing symbols whose names are server names and whose values
-;; are servers:
-(defvar nnmaildir--servers (make-vector 3 0))
-;; The current server:
-(defvar nnmaildir--cur-server nil)
+(defvar nnmaildir--servers nil
+  "Alist mapping server name strings to servers.")
+(defvar nnmaildir--cur-server nil
+  "The current server.")
 
 ;; A copy of nnmail-extra-headers
 (defvar nnmaildir--extra nil)
@@ -172,17 +173,17 @@ This variable is set by `nnmaildir-request-article'.")
   (nov    nil :type vector)) ;; cached nov structure, or nil
 
 (cl-defstruct nnmaildir--grp
-  (name  nil :type string)  ;; "group.name"
-  (new   nil :type list)    ;; new/ modtime
-  (cur   nil :type list)    ;; cur/ modtime
-  (min   1   :type natnum)  ;; minimum article number
-  (count 0   :type natnum)  ;; count of articles
-  (nlist nil :type list)    ;; list of articles, ordered descending by number
-  (flist nil :type vector)  ;; obarray mapping filename prefix->article
-  (mlist nil :type vector)  ;; obarray mapping message-id->article
-  (cache nil :type vector)  ;; nov cache
-  (index nil :type natnum)  ;; index of next cache entry to replace
-  (mmth  nil :type vector)) ;; obarray mapping mark name->dir modtime
+  (name  nil :type string)     ;; "group.name"
+  (new   nil :type list)       ;; new/ modtime
+  (cur   nil :type list)       ;; cur/ modtime
+  (min   1   :type natnum)     ;; minimum article number
+  (count 0   :type natnum)     ;; count of articles
+  (nlist nil :type list)       ;; list of articles, ordered descending by 
number
+  (flist nil :type hash-table)  ;; hash table mapping filename prefix->article
+  (mlist nil :type hash-table)  ;; hash table mapping message-id->article
+  (cache nil :type vector)     ;; nov cache
+  (index nil :type natnum)     ;; index of next cache entry to replace
+  (mmth  nil :type hash-table))        ;; hash table mapping mark name->dir 
modtime
                                        ; ("Mark Mod Time Hash")
 
 (cl-defstruct nnmaildir--srv
@@ -191,7 +192,7 @@ This variable is set by `nnmaildir-request-article'.")
   (prefix       nil :type string)         ;; "nnmaildir+address:"
   (dir          nil :type string)         ;; "/expanded/path/to/server/dir/"
   (ls           nil :type function)       ;; directory-files function
-  (groups       nil :type vector)         ;; obarray mapping group name->group
+  (groups       nil :type hash-table)     ;; hash table mapping group 
name->group
   (curgrp       nil :type nnmaildir--grp) ;; current group, or nil
   (error        nil :type string)         ;; last error message, or nil
   (mtime        nil :type list)           ;; modtime of dir
@@ -238,17 +239,17 @@ This variable is set by `nnmaildir-request-article'.")
       (setf (nnmaildir--grp-count group) count)
       (setf (nnmaildir--grp-nlist group) new-nlist)
       (setcdr nlist-pre nlist-post)
-      (unintern prefix flist)
-      (unintern msgid mlist))))
+      (remhash prefix flist)
+      (remhash msgid mlist))))
 
 (defun nnmaildir--nlist-art (group num)
   (let ((entry (assq num (nnmaildir--grp-nlist group))))
     (if entry
        (cdr entry))))
 (defmacro nnmaildir--flist-art (list file)
-  `(symbol-value (intern-soft ,file ,list)))
+  `(gethash ,file ,list))
 (defmacro nnmaildir--mlist-art (list msgid)
-  `(symbol-value (intern-soft ,msgid ,list)))
+  `(gethash ,msgid ,list))
 
 (defun nnmaildir--pgname (server gname)
   (let ((prefix (nnmaildir--srv-prefix server)))
@@ -337,12 +338,12 @@ This variable is set by `nnmaildir-request-article'.")
     (if (null server)
        (unless (setq server nnmaildir--cur-server)
          (throw 'return nil))
-      (unless (setq server (intern-soft server nnmaildir--servers))
+      (unless (setq server (alist-get server nnmaildir--servers
+                                     nil nil #'equal))
        (throw 'return nil))
-      (setq server (symbol-value server)
-           nnmaildir--cur-server server))
+      (setq nnmaildir--cur-server server))
     (let ((groups (nnmaildir--srv-groups server)))
-      (when groups
+      (when (and groups (null (hash-table-empty-p groups)))
        (unless (nnmaildir--srv-method server)
          (setf (nnmaildir--srv-method server)
                (or (gnus-server-to-method
@@ -350,7 +351,7 @@ This variable is set by `nnmaildir-request-article'.")
                    (throw 'return nil))))
        (if (null group)
            (nnmaildir--srv-curgrp server)
-         (symbol-value (intern-soft group groups)))))))
+         (gethash group groups))))))
 
 (defun nnmaildir--tab-to-space (string)
   (let ((pos 0))
@@ -574,15 +575,15 @@ This variable is set by `nnmaildir-request-article'.")
        (if insert-nlist
            (setcdr nlist (cons (cons num article) nlist-cdr))
          (setf (nnmaildir--grp-nlist group) nlist))
-       (set (intern (nnmaildir--art-prefix article)
-                    (nnmaildir--grp-flist group))
-            article)
-       (set (intern (nnmaildir--art-msgid article)
-                    (nnmaildir--grp-mlist group))
-            article)
-       (set (intern (nnmaildir--grp-name group)
-                    (nnmaildir--srv-groups server))
-            group))
+       (puthash (nnmaildir--art-prefix article)
+                article
+                (nnmaildir--grp-flist group))
+       (puthash (nnmaildir--art-msgid article)
+                article
+                (nnmaildir--grp-mlist group))
+       (puthash (nnmaildir--grp-name group)
+                group
+                (nnmaildir--srv-groups server)))
       (nnmaildir--cache-nov group article nov)
       t)))
 
@@ -650,9 +651,6 @@ This variable is set by `nnmaildir-request-article'.")
          (if (< (car entry) low) (throw 'iterate-loop nil))
          (funcall func (cdr entry)))))))
 
-(defun nnmaildir--up2-1 (n)
-  (if (zerop n) 1 (1- (ash 1 (1+ (logb n))))))
-
 (defun nnmaildir--system-name ()
   (replace-regexp-in-string
    ":" "\\072"
@@ -677,19 +675,20 @@ This variable is set by `nnmaildir-request-article'.")
        (nnmaildir--srv-groups nnmaildir--cur-server)
        t))
 
-(defun nnmaildir-open-server (server &optional defs)
-  (let ((x server)
-       dir size)
+(defun nnmaildir-open-server (server-string &optional defs)
+  (let ((server (alist-get server-string nnmaildir--servers
+                          nil nil #'equal))
+       dir size x)
     (catch 'return
-      (setq server (intern-soft x nnmaildir--servers))
       (if server
-         (and (setq server (symbol-value server))
-              (nnmaildir--srv-groups server)
+         (and (nnmaildir--srv-groups server)
               (setq nnmaildir--cur-server server)
               (throw 'return t))
-       (setq server (make-nnmaildir--srv :address x))
+       (setq server (make-nnmaildir--srv :address server-string))
        (let ((inhibit-quit t))
-         (set (intern x nnmaildir--servers) server)))
+         (setf (alist-get server-string nnmaildir--servers
+                          nil nil #'equal)
+               server)))
       (setq dir (assq 'directory defs))
       (unless dir
        (setf (nnmaildir--srv-error server)
@@ -713,8 +712,7 @@ This variable is set by `nnmaildir-request-article'.")
                (concat "Not a function: " (prin1-to-string x)))
          (throw 'return nil)))
       (setf (nnmaildir--srv-ls server) x)
-      (setq size (length (funcall x dir nil "\\`[^.]" 'nosort))
-           size (nnmaildir--up2-1 size))
+      (setq size (length (funcall x dir nil "\\`[^.]" 'nosort)))
       (and (setq x (assq 'get-new-mail defs))
           (setq x (cdr x))
           (car x)
@@ -734,7 +732,8 @@ This variable is set by `nnmaildir-request-article'.")
                    x (file-name-as-directory x))
              (setf (nnmaildir--srv-target-prefix server) x))
          (setf (nnmaildir--srv-target-prefix server) "")))
-      (setf (nnmaildir--srv-groups server) (make-vector size 0))
+      (setf (nnmaildir--srv-groups server)
+           (gnus-make-hashtable size))
       (setq nnmaildir--cur-server server)
       t)))
 
@@ -764,7 +763,7 @@ This variable is set by `nnmaildir-request-article'.")
 
 (defun nnmaildir--scan (gname scan-msgs groups _method srv-dir srv-ls)
   (catch 'return
-    (let ((36h-ago (- (float-time) 129600))
+    (let ((36h-ago (time-since 129600))
          absdir nndir tdir ndir cdir nattr cattr isnew pgname read-only ls
          files num dir flist group x)
       (setq absdir (nnmaildir--srvgrp-dir srv-dir gname)
@@ -833,10 +832,10 @@ This variable is set by `nnmaildir-request-article'.")
                       (cons (match-string 1 f) (match-string 2 f)))
                     files)))
       (when isnew
-       (setq num (nnmaildir--up2-1 (length files)))
-       (setf (nnmaildir--grp-flist group) (make-vector num 0))
-       (setf (nnmaildir--grp-mlist group) (make-vector num 0))
-       (setf (nnmaildir--grp-mmth group) (make-vector 1 0))
+       (setq num (length files))
+       (setf (nnmaildir--grp-flist group) (gnus-make-hashtable num))
+       (setf (nnmaildir--grp-mlist group) (gnus-make-hashtable num))
+       (setf (nnmaildir--grp-mmth group) (gnus-make-hashtable 1))
        (setq num (nnmaildir--param pgname 'nov-cache-size))
        (if (numberp num) (if (< num 1) (setq num 1))
          (setq num 16
@@ -862,7 +861,7 @@ This variable is set by `nnmaildir-request-article'.")
                (cl-incf num)))))
        (setf (nnmaildir--grp-cache group) (make-vector num nil))
         (let ((inhibit-quit t))
-          (set (intern gname groups) group))
+          (puthash gname group groups))
        (or scan-msgs (throw 'return t)))
       (setq flist (nnmaildir--grp-flist group)
            files (mapcar
@@ -901,49 +900,46 @@ This variable is set by `nnmaildir-request-article'.")
          groups (nnmaildir--srv-groups nnmaildir--cur-server)
          target-prefix (nnmaildir--srv-target-prefix nnmaildir--cur-server))
     (nnmaildir--with-work-buffer
-      (save-match-data
-       (if (stringp scan-group)
-           (if (nnmaildir--scan scan-group t groups method srv-dir srv-ls)
-               (if (nnmaildir--srv-gnm nnmaildir--cur-server)
-                   (nnmail-get-new-mail 'nnmaildir nil nil scan-group))
-             (unintern scan-group groups))
-         (setq x (file-attribute-modification-time (file-attributes srv-dir))
-               scan-group (null scan-group))
-         (if (equal x (nnmaildir--srv-mtime nnmaildir--cur-server))
-             (if scan-group
-                 (mapatoms (lambda (sym)
-                             (nnmaildir--scan (symbol-name sym) t groups
-                                              method srv-dir srv-ls))
-                           groups))
-           (setq dirs (funcall srv-ls srv-dir nil "\\`[^.]" 'nosort)
-                 dirs (if (zerop (length target-prefix))
-                          dirs
-                        (seq-remove
-                         (lambda (dir)
-                           (and (>= (length dir) (length target-prefix))
-                                (string= (substring dir 0
-                                                    (length target-prefix))
-                                         target-prefix)))
-                         dirs))
-                 seen (nnmaildir--up2-1 (length dirs))
-                 seen (make-vector seen 0))
-           (dolist (grp-dir dirs)
-             (if (nnmaildir--scan grp-dir scan-group groups method srv-dir
-                                  srv-ls)
-                 (intern grp-dir seen)))
-           (setq x nil)
-           (mapatoms (lambda (group)
-                       (setq group (symbol-name group))
-                       (unless (intern-soft group seen)
-                         (setq x (cons group x))))
-                     groups)
-           (dolist (grp x)
-             (unintern grp groups))
-           (setf (nnmaildir--srv-mtime nnmaildir--cur-server)
-                 (file-attribute-modification-time (file-attributes srv-dir))))
-         (and scan-group
-              (nnmaildir--srv-gnm nnmaildir--cur-server)
-              (nnmail-get-new-mail 'nnmaildir nil nil))))))
+     (save-match-data
+       (if (stringp scan-group)
+          (if (nnmaildir--scan scan-group t groups method srv-dir srv-ls)
+              (when (nnmaildir--srv-gnm nnmaildir--cur-server)
+                (nnmail-get-new-mail 'nnmaildir nil nil scan-group))
+            (remhash scan-group groups))
+        (setq x (file-attribute-modification-time (file-attributes srv-dir))
+              scan-group (null scan-group))
+        (if (equal x (nnmaildir--srv-mtime nnmaildir--cur-server))
+            (when scan-group
+              (maphash (lambda (group-name _group)
+                         (nnmaildir--scan group-name t groups
+                                          method srv-dir srv-ls))
+                       groups))
+          (setq dirs (funcall srv-ls srv-dir nil "\\`[^.]" 'nosort)
+                dirs (if (zerop (length target-prefix))
+                         dirs
+                       (seq-remove
+                        (lambda (dir)
+                          (and (>= (length dir) (length target-prefix))
+                               (string= (substring dir 0
+                                                   (length target-prefix))
+                                        target-prefix)))
+                        dirs)))
+          (dolist (grp-dir dirs)
+            (when (nnmaildir--scan grp-dir scan-group groups
+                                   method srv-dir srv-ls)
+              (push grp-dir seen)))
+          (setq x nil)
+          (maphash (lambda (gname _group)
+                     (unless (member gname seen)
+                       (push gname x)))
+                   groups)
+          (dolist (grp x)
+            (remhash grp groups))
+          (setf (nnmaildir--srv-mtime nnmaildir--cur-server)
+                (file-attribute-modification-time (file-attributes srv-dir))))
+        (and scan-group
+             (nnmaildir--srv-gnm nnmaildir--cur-server)
+             (nnmail-get-new-mail 'nnmaildir nil nil))))))
   t)
 
 (defun nnmaildir-request-list (&optional server)
@@ -952,10 +948,9 @@ This variable is set by `nnmaildir-request-article'.")
     (nnmaildir--prepare server nil)
     (nnmaildir--with-nntp-buffer
       (erase-buffer)
-      (mapatoms (lambda (group)
-                 (setq pgname (symbol-name group)
-                       pgname (nnmaildir--pgname nnmaildir--cur-server pgname)
-                       group (symbol-value group)
+      (maphash (lambda (gname group)
+                 (setq pgname (nnmaildir--pgname nnmaildir--cur-server gname)
+
                        ro (nnmaildir--param pgname 'read-only))
                  (insert (replace-regexp-in-string
                           " " "\\ "
@@ -1035,8 +1030,7 @@ This variable is set by `nnmaildir-request-article'.")
                       (append
                        (mapcar 'cdr nnmaildir-flag-mark-mapping)
                        (mapcar 'intern (funcall ls dir nil "\\`[^.]" 
'nosort))))
-           new-mmth (nnmaildir--up2-1 (length all-marks))
-           new-mmth (make-vector new-mmth 0)
+           new-mmth (make-hash-table :size (length all-marks))
            old-mmth (nnmaildir--grp-mmth group))
       (dolist (mark all-marks)
        (setq markdir (nnmaildir--subdir dir (symbol-name mark))
@@ -1063,8 +1057,8 @@ This variable is set by `nnmaildir-request-article'.")
                    curdir-mtime)
                   (t
                    markdir-mtime))))
-         (set (intern (symbol-name mark) new-mmth) mtime)
-         (when (equal mtime (symbol-value (intern-soft (symbol-name mark) 
old-mmth)))
+         (puthash mark mtime new-mmth)
+         (when (equal mtime (gethash mark old-mmth))
            (setq ranges (assq mark old-marks))
            (if ranges (setq ranges (cdr ranges)))
            (throw 'got-ranges nil))
@@ -1126,7 +1120,7 @@ This variable is set by `nnmaildir-request-article'.")
   (nnmaildir--prepare server nil)
   (catch 'return
     (let ((target-prefix (nnmaildir--srv-target-prefix nnmaildir--cur-server))
-         srv-dir dir groups)
+         srv-dir dir)
       (when (zerop (length gname))
        (setf (nnmaildir--srv-error nnmaildir--cur-server)
              "Invalid (empty) group name")
@@ -1140,8 +1134,8 @@ This variable is set by `nnmaildir-request-article'.")
              (concat "Invalid characters (null, tab, or /) in group name: "
                      gname))
        (throw 'return nil))
-      (setq groups (nnmaildir--srv-groups nnmaildir--cur-server))
-      (when (intern-soft gname groups)
+      (when (gethash
+            gname (nnmaildir--srv-groups nnmaildir--cur-server))
        (setf (nnmaildir--srv-error nnmaildir--cur-server)
              (concat "Group already exists: " gname))
        (throw 'return nil))
@@ -1186,7 +1180,7 @@ This variable is set by `nnmaildir-request-article'.")
                      new-name))
        (throw 'return nil))
       (if (string-equal gname new-name) (throw 'return t))
-      (when (intern-soft new-name
+      (when (gethash new-name
                         (nnmaildir--srv-groups nnmaildir--cur-server))
        (setf (nnmaildir--srv-error nnmaildir--cur-server)
              (concat "Group already exists: " new-name))
@@ -1199,16 +1193,18 @@ This variable is set by `nnmaildir-request-article'.")
         (setf (nnmaildir--srv-error nnmaildir--cur-server)
               (concat "Error renaming link: " (prin1-to-string err)))
         (throw 'return nil)))
+      ;; FIXME: Why are we making copies of the group and the groups
+      ;; hashtable?  Why not just set the group's new name, and puthash the
+      ;; group under that new name?
       (setq x (nnmaildir--srv-groups nnmaildir--cur-server)
-           groups (make-vector (length x) 0))
-      (mapatoms (lambda (sym)
-                 (unless (eq (symbol-value sym) group)
-                   (set (intern (symbol-name sym) groups)
-                        (symbol-value sym))))
+           groups (gnus-make-hashtable (hash-table-size x)))
+      (maphash (lambda (gname g)
+                 (unless (eq g group)
+                   (puthash gname g groups)))
                x)
       (setq group (copy-sequence group))
       (setf (nnmaildir--grp-name group) new-name)
-      (set (intern new-name groups) group)
+      (puthash new-name group groups)
       (setf (nnmaildir--srv-groups nnmaildir--cur-server) groups)
       t)))
 
@@ -1231,7 +1227,7 @@ This variable is set by `nnmaildir-request-article'.")
        (throw 'return nil))
       (if (eq group (nnmaildir--srv-curgrp nnmaildir--cur-server))
          (setf (nnmaildir--srv-curgrp nnmaildir--cur-server) nil))
-      (unintern gname (nnmaildir--srv-groups nnmaildir--cur-server))
+      (remhash gname (nnmaildir--srv-groups nnmaildir--cur-server))
       (if (not force)
          (progn
            (setq grp-dir (directory-file-name grp-dir))
@@ -1332,10 +1328,9 @@ This variable is set by `nnmaildir-request-article'.")
              article (nnmaildir--mlist-art list num-msgid))
        (if article (setq num-msgid (nnmaildir--art-num article))
          (catch 'found
-           (mapatoms
-              (lambda (group-sym)
-                (setq group (symbol-value group-sym)
-                      list (nnmaildir--grp-mlist group)
+           (maphash
+              (lambda (_gname group)
+                (setq list (nnmaildir--grp-mlist group)
                       article (nnmaildir--mlist-art list num-msgid))
                 (when article
                   (setq num-msgid (nnmaildir--art-num article))
@@ -1467,7 +1462,7 @@ This variable is set by `nnmaildir-request-article'.")
       (unless (string-equal nnmaildir--delivery-time file)
        (setq nnmaildir--delivery-time file
              nnmaildir--delivery-count 0))
-      (setq file (concat file "M" (number-to-string (caddr time))))
+      (setq file (concat file (format-time-string "M%6N" time)))
       (setq file (concat file nnmaildir--delivery-pid)
            file (concat file "Q" (number-to-string nnmaildir--delivery-count))
            file (concat file "." (nnmaildir--system-name))
@@ -1522,7 +1517,7 @@ This variable is set by `nnmaildir-request-article'.")
       (setq groups (nnmaildir--srv-groups nnmaildir--cur-server)
            ga (car group-art) group-art (cdr group-art)
            gname (car ga))
-      (or (intern-soft gname groups)
+      (or (gethash gname groups)
          (nnmaildir-request-create-group gname)
          (throw 'return nil)) ;; not that nnmail bothers to check :(
       (unless (nnmaildir-request-accept-article gname)
@@ -1539,7 +1534,7 @@ This variable is set by `nnmaildir-request-article'.")
            (mapcar
             (lambda (ga)
               (setq gname (car ga))
-              (and (or (intern-soft gname groups)
+              (and (or (gethash gname groups)
                        (nnmaildir-request-create-group gname))
                    (nnmaildir-request-accept-article gname)
                    ga))
@@ -1553,7 +1548,7 @@ This variable is set by `nnmaildir-request-article'.")
 (defun nnmaildir-request-expire-articles (ranges &optional gname server force)
   (let ((no-force (not force))
        (group (nnmaildir--prepare server gname))
-       pgname time boundary bound-iter high low target dir nlist
+       pgname time boundary high low target dir nlist
        didnt nnmaildir--file nnmaildir-article-file-name
        deactivate-mark)
     (catch 'return
@@ -1577,14 +1572,7 @@ This variable is set by `nnmaildir-request-article'.")
       (when no-force
        (unless (integerp time) ;; handle 'never
          (throw 'return (gnus-uncompress-range ranges)))
-       (setq boundary (current-time)
-             high (- (car boundary) (/ time 65536))
-             low (- (cadr boundary) (% time 65536)))
-       (if (< low 0)
-           (setq low (+ low 65536)
-                 high (1- high)))
-       (setcar (cdr boundary) low)
-       (setcar boundary high))
+       (setq boundary (time-since time)))
       (setq dir (nnmaildir--srv-dir nnmaildir--cur-server)
            dir (nnmaildir--srvgrp-dir dir gname)
            dir (nnmaildir--cur dir)
@@ -1602,15 +1590,8 @@ This variable is set by `nnmaildir-request-article'.")
            ((null time)
             (nnmaildir--expired-article group article))
            ((and no-force
-                 (progn
-                   (setq time (file-attribute-modification-time time)
-                         bound-iter boundary)
-                   (while (and bound-iter time
-                               (= (car bound-iter) (car time)))
-                     (setq bound-iter (cdr bound-iter)
-                           time (cdr time)))
-                   (and bound-iter time
-                        (car-less-than-car bound-iter time))))
+                 (time-less-p boundary
+                              (file-attribute-modification-time time)))
             (setq didnt (cons (nnmaildir--art-num article) didnt)))
            (t
             (setq nnmaildir-article-file-name nnmaildir--file
@@ -1763,36 +1744,38 @@ This variable is set by `nnmaildir-request-article'.")
                  (lambda (dir)
                    (cons dir (funcall ls dir nil "\\`[^.]" 'nosort)))
                  dirs)
-           files (funcall ls msgdir nil "\\`[^.]" 'nosort)
-           flist (nnmaildir--up2-1 (length files))
-           flist (make-vector flist 0))
+           files (funcall ls msgdir nil "\\`[^.]" 'nosort))
       (save-match-data
        (dolist (file files)
          (string-match "\\`\\([^:]*\\)\\(:.*\\)?\\'" file)
-         (intern (match-string 1 file) flist)))
+         (push (match-string 1 file) flist)))
       (dolist (dir dirs)
        (setq files (cdr dir)
              dir (file-name-as-directory (car dir)))
        (dolist (file files)
-         (unless (or (intern-soft file flist) (string= file ":"))
+         (unless (or (member file flist) (string= file ":"))
            (setq file (concat dir file))
            (delete-file file))))
       t)))
 
 (defun nnmaildir-close-server (&optional server)
-  (nnmaildir--prepare server nil)
-  (when nnmaildir--cur-server
+  "Close SERVER, or the current maildir server."
+  (when (nnmaildir--prepare server nil)
     (setq server nnmaildir--cur-server
          nnmaildir--cur-server nil)
-    (unintern (nnmaildir--srv-address server) nnmaildir--servers))
+
+    ;; This slightly obscure invocation of `alist-get' removes SERVER from
+    ;; `nnmaildir-servers'.
+    (setf (alist-get (nnmaildir--srv-address server)
+                    nnmaildir--servers server 'remove #'equal)
+         server))
   t)
 
 (defun nnmaildir-request-close ()
-  (let (servers buffer)
-    (mapatoms (lambda (server)
-               (setq servers (cons (symbol-name server) servers)))
-             nnmaildir--servers)
-    (mapc 'nnmaildir-close-server servers)
+  (let ((servers
+        (mapcar #'car nnmaildir--servers))
+       buffer)
+    (mapc #'nnmaildir-close-server servers)
     (setq buffer (get-buffer " *nnmaildir work*"))
     (if buffer (kill-buffer buffer))
     (setq buffer (get-buffer " *nnmaildir nov*"))
diff --git a/lisp/gnus/nnmairix.el b/lisp/gnus/nnmairix.el
index 24188f5..501ea1d 100644
--- a/lisp/gnus/nnmairix.el
+++ b/lisp/gnus/nnmairix.el
@@ -1,6 +1,6 @@
 ;;; nnmairix.el --- Mairix back end for Gnus, the Emacs newsreader
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: David Engster <address@hidden>
 ;; Keywords: mail searching
@@ -1774,7 +1774,7 @@ If VERSION is a string: must be contained in mairix 
version output."
        (setq versionstring
              (let* ((commandsplit (split-string nnmairix-mairix-command))
                     (args (append (list (car commandsplit))
-                                 `(nil t nil) (cdr commandsplit) '("-V"))))
+                                  '(nil t nil) (cdr commandsplit) '("-V"))))
              (apply 'call-process args)
              (goto-char (point-min))
              (re-search-forward "mairix.*")
diff --git a/lisp/gnus/nnmbox.el b/lisp/gnus/nnmbox.el
index 05342da..bba4133 100644
--- a/lisp/gnus/nnmbox.el
+++ b/lisp/gnus/nnmbox.el
@@ -1,6 +1,6 @@
 ;;; nnmbox.el --- mail mbox access for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;;     Masanobu UMEDA <address@hidden>
diff --git a/lisp/gnus/nnmh.el b/lisp/gnus/nnmh.el
index d0f8ec2..f4b36dc 100644
--- a/lisp/gnus/nnmh.el
+++ b/lisp/gnus/nnmh.el
@@ -1,6 +1,6 @@
 ;;; nnmh.el --- mhspool access for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;;     Masanobu UMEDA <address@hidden>
diff --git a/lisp/gnus/nnml.el b/lisp/gnus/nnml.el
index e7a5b99..5770777 100644
--- a/lisp/gnus/nnml.el
+++ b/lisp/gnus/nnml.el
@@ -1,6 +1,6 @@
 ;;; nnml.el --- mail spool access for Gnus
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Authors: Didier Verna <address@hidden> (adding compaction)
 ;;     Simon Josefsson <address@hidden>
diff --git a/lisp/gnus/nnoo.el b/lisp/gnus/nnoo.el
index 1e69af6..0cf2362 100644
--- a/lisp/gnus/nnoo.el
+++ b/lisp/gnus/nnoo.el
@@ -1,6 +1,6 @@
 ;;; nnoo.el --- OO Gnus Backends
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
diff --git a/lisp/gnus/nnregistry.el b/lisp/gnus/nnregistry.el
index bb00caa..4bc74ce 100644
--- a/lisp/gnus/nnregistry.el
+++ b/lisp/gnus/nnregistry.el
@@ -1,7 +1,7 @@
 ;;; nnregistry.el --- access to articles via Gnus' message-id registry
 ;;; -*- coding: utf-8 -*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Authors: Ludovic Courtès <address@hidden>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/nnrss.el b/lisp/gnus/nnrss.el
index f80e2c5..7f2accc 100644
--- a/lisp/gnus/nnrss.el
+++ b/lisp/gnus/nnrss.el
@@ -1,6 +1,6 @@
 ;;; nnrss.el --- interfacing with RSS
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <address@hidden>
 ;; Keywords: RSS
@@ -446,16 +446,16 @@ nnrss: %s: Not valid XML %s and libxml-parse-html-region 
doesn't work %s"
 (autoload 'timezone-parse-date "timezone")
 
 (defun nnrss-normalize-date (date)
-  "Return a date string of DATE in the RFC822 style.
+  "Return a date string of DATE in the style of RFC 822 and its successors.
 This function handles the ISO 8601 date format described in
-URL `http://www.w3.org/TR/NOTE-datetime', and also the RFC822 style
+URL `http://www.w3.org/TR/NOTE-datetime', and also the RFC 822 style
 which RSS 2.0 allows."
   (let (case-fold-search vector year month day time zone cts given)
     (cond ((null date))                        ; do nothing for this case
          ;; if the date is just digits (unix time stamp):
          ((string-match "^[0-9]+$" date)
-          (setq given (seconds-to-time (string-to-number date))))
-         ;; RFC822
+          (setq given (encode-time (string-to-number date))))
+         ;; RFC 822
          ((string-match " [0-9]+ " date)
           (setq vector (timezone-parse-date date)
                 year (string-to-number (aref vector 0)))
diff --git a/lisp/gnus/nnspool.el b/lisp/gnus/nnspool.el
index 2f16b65..767631c 100644
--- a/lisp/gnus/nnspool.el
+++ b/lisp/gnus/nnspool.el
@@ -1,6 +1,6 @@
 ;;; nnspool.el --- spool access for GNU Emacs
 
-;; Copyright (C) 1988-1990, 1993-1998, 2000-2018 Free Software
+;; Copyright (C) 1988-1990, 1993-1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <address@hidden>
@@ -305,25 +305,18 @@ there.")
        (while (and (not (looking-at
                          "\\([^ ]+\\) +\\([0-9]+\\)[0-9][0-9][0-9] "))
                    (zerop (forward-line -1))))
-       ;; We require nnheader which requires gnus-util.
-       (let ((seconds (float-time (date-to-time date)))
+       (let ((seconds (encode-time (date-to-time date) 'integer))
              groups)
          ;; Go through lines and add the latest groups to a list.
          (while (and (looking-at "\\([^ ]+\\) +[0-9]+ ")
                      (progn
-                       ;; We insert a .0 to make the list reader
-                       ;; interpret the number as a float.  It is far
-                       ;; too big to be stored in a lisp integer.
-                       (goto-char (1- (match-end 0)))
-                       (insert ".0")
-                       (> (progn
-                            (goto-char (match-end 1))
-                            (read (current-buffer)))
-                          seconds))
-                     (push (buffer-substring
-                            (match-beginning 1) (match-end 1))
-                           groups)
-                     (zerop (forward-line -1))))
+                       (goto-char (match-end 1))
+                       (< seconds (read (current-buffer))))
+                     (progn
+                       (push (buffer-substring
+                              (match-beginning 1) (match-end 1))
+                             groups)
+                       (zerop (forward-line -1)))))
          (erase-buffer)
          (dolist (group groups)
            (insert group " 0 0 y\n")))
diff --git a/lisp/gnus/nntp.el b/lisp/gnus/nntp.el
index be9e495..e2fa1d8 100644
--- a/lisp/gnus/nntp.el
+++ b/lisp/gnus/nntp.el
@@ -1,6 +1,6 @@
 ;;; nntp.el --- nntp access for Gnus
 
-;; Copyright (C) 1987-1990, 1992-1998, 2000-2018 Free Software
+;; Copyright (C) 1987-1990, 1992-1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
diff --git a/lisp/gnus/nnvirtual.el b/lisp/gnus/nnvirtual.el
index 777c5c1..c80bbf6 100644
--- a/lisp/gnus/nnvirtual.el
+++ b/lisp/gnus/nnvirtual.el
@@ -1,6 +1,6 @@
 ;;; nnvirtual.el --- virtual newsgroups access for Gnus
 
-;; Copyright (C) 1994-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
 ;; Author: David Moore <address@hidden>
 ;;     Lars Magne Ingebrigtsen <address@hidden>
@@ -234,14 +234,12 @@ component group will show up when you enter the virtual 
group.")
          nnvirtual-mapping-marks nil
          nnvirtual-info-installed nil)
     (when nnvirtual-component-regexp
-      ;; Go through the newsrc alist and find all component groups.
-      (let ((newsrc (cdr gnus-newsrc-alist))
-           group)
-       (while (setq group (car (pop newsrc)))
-         (when (string-match nnvirtual-component-regexp group) ; Match
-           ;; Add this group to the list of component groups.
-           (setq nnvirtual-component-groups
-                 (cons group (delete group nnvirtual-component-groups)))))))
+      ;; Go through the list of groups and find all component groups.
+      (dolist (group (cdr gnus-group-list))
+       (when (string-match nnvirtual-component-regexp group) ; Match
+         ;; Add this group to the list of component groups.
+         (setq nnvirtual-component-groups
+               (cons group (delete group nnvirtual-component-groups))))))
     (if (not nnvirtual-component-groups)
        (nnheader-report 'nnvirtual "No component groups: %s" server)
       t)))
@@ -372,7 +370,7 @@ component group will show up when you enter the virtual 
group.")
 (defun nnvirtual-convert-headers ()
   "Convert HEAD headers into NOV headers."
   (with-current-buffer nntp-server-buffer
-    (let* ((dependencies (make-vector 100 0))
+    (let* ((dependencies (make-hash-table :test #'equal))
           (headers (gnus-get-newsgroup-headers dependencies)))
       (erase-buffer)
       (mapc 'nnheader-insert-nov headers))))
diff --git a/lisp/gnus/nnweb.el b/lisp/gnus/nnweb.el
index a64f10f..7b87502 100644
--- a/lisp/gnus/nnweb.el
+++ b/lisp/gnus/nnweb.el
@@ -1,6 +1,6 @@
 ;;; nnweb.el --- retrieving articles via web search engines
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
@@ -109,7 +109,7 @@ Valid types include `google', `dejanews', and `gmane'.")
 (deffoo nnweb-request-scan (&optional group server)
   (nnweb-possibly-change-server group server)
   (if nnweb-ephemeral-p
-      (setq nnweb-hashtb (gnus-make-hashtable 4095))
+      (setq nnweb-hashtb (gnus-make-hashtable 4000))
     (unless nnweb-articles
       (nnweb-read-overview group)))
   (funcall (nnweb-definition 'map))
@@ -229,11 +229,11 @@ Valid types include `google', `dejanews', and `gmane'.")
        (nnheader-insert-nov (cadr (pop articles)))))))
 
 (defun nnweb-set-hashtb (header data)
-  (gnus-sethash (nnweb-identifier (mail-header-xref header))
+  (puthash (nnweb-identifier (mail-header-xref header))
                data nnweb-hashtb))
 
 (defun nnweb-get-hashtb (url)
-  (gnus-gethash (nnweb-identifier url) nnweb-hashtb))
+  (gethash (nnweb-identifier url) nnweb-hashtb))
 
 (defun nnweb-identifier (ident)
   (funcall (nnweb-definition 'identifier) ident))
@@ -268,7 +268,7 @@ Valid types include `google', `dejanews', and `gmane'.")
   (unless nnweb-group-alist
     (nnweb-read-active))
   (unless nnweb-hashtb
-    (setq nnweb-hashtb (gnus-make-hashtable 4095)))
+    (setq nnweb-hashtb (make-hash-table :size 4000 :test #'equal)))
   (when group
     (setq nnweb-group group)))
 
diff --git a/lisp/gnus/score-mode.el b/lisp/gnus/score-mode.el
index 9bceb4e..8ba1eae 100644
--- a/lisp/gnus/score-mode.el
+++ b/lisp/gnus/score-mode.el
@@ -1,6 +1,6 @@
 ;;; score-mode.el --- mode for editing Gnus score files
 
-;; Copyright (C) 1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news, mail
diff --git a/lisp/gnus/smiley.el b/lisp/gnus/smiley.el
index 226a4ce..fb1e8de 100644
--- a/lisp/gnus/smiley.el
+++ b/lisp/gnus/smiley.el
@@ -1,6 +1,6 @@
 ;;; smiley.el --- displaying smiley faces
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;; Keywords: news mail multimedia
diff --git a/lisp/gnus/smime.el b/lisp/gnus/smime.el
index ab2a5b0..9a38a6c 100644
--- a/lisp/gnus/smime.el
+++ b/lisp/gnus/smime.el
@@ -1,6 +1,6 @@
 ;;; smime.el --- S/MIME support library  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 ;; Keywords: SMIME X.509 PEM OpenSSL
diff --git a/lisp/gnus/spam-report.el b/lisp/gnus/spam-report.el
index e43c01b..f611a21 100644
--- a/lisp/gnus/spam-report.el
+++ b/lisp/gnus/spam-report.el
@@ -1,6 +1,6 @@
 ;;; spam-report.el --- Reporting spam
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Ted Zlatanov <address@hidden>
 ;; Keywords: network, spam, mail, gmane, report
diff --git a/lisp/gnus/spam-stat.el b/lisp/gnus/spam-stat.el
index 3625132..6cf43df 100644
--- a/lisp/gnus/spam-stat.el
+++ b/lisp/gnus/spam-stat.el
@@ -1,6 +1,6 @@
 ;;; spam-stat.el --- detecting spam based on statistics
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <address@hidden>
 ;; Keywords: network
diff --git a/lisp/gnus/spam-wash.el b/lisp/gnus/spam-wash.el
index 272d3d7..4d7975f 100644
--- a/lisp/gnus/spam-wash.el
+++ b/lisp/gnus/spam-wash.el
@@ -1,6 +1,6 @@
 ;;; spam-wash.el --- wash spam before analysis
 
-;; Copyright (C) 2004, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Andrew Cohen <address@hidden>
 ;; Keywords: mail
diff --git a/lisp/gnus/spam.el b/lisp/gnus/spam.el
index 710e0e8..4d31d0a 100644
--- a/lisp/gnus/spam.el
+++ b/lisp/gnus/spam.el
@@ -1,6 +1,6 @@
 ;;; spam.el --- Identifying spam
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Maintainer: Ted Zlatanov <address@hidden>
@@ -2137,7 +2137,7 @@ See `spam-ifile-database'."
           (apply 'call-process-region
                  (point-min) (point-max) spam-ifile-program
                  nil temp-buffer-name nil "-c"
-                 (if db-param `(,db-param "-q") `("-q"))))
+                 (if db-param `(,db-param "-q") '("-q"))))
         ;; check the return now (we're back in the temp buffer)
         (goto-char (point-min))
         (if (not (eobp))
@@ -2166,7 +2166,7 @@ Uses `gnus-newsgroup-name' if category is nil (for ham 
registration)."
              (point-min) (point-max) spam-ifile-program
              nil nil nil
              add-or-delete-option category
-             (if db `(,db "-h") `("-h"))))))
+             (if db `(,db "-h") '("-h"))))))
 
 (defun spam-ifile-register-spam-routine (articles &optional unregister)
   (spam-ifile-register-with-ifile articles spam-ifile-spam-category 
unregister))
@@ -2473,7 +2473,7 @@ With a non-nil REMOVE, remove the ADDRESSES."
                      (point-min) (point-max)
                      spam-bogofilter-program
                      nil temp-buffer-name nil
-                     (if db `("-d" ,db "-v") `("-v"))))
+                     (if db `("-d" ,db "-v") '("-v"))))
             (setq return (spam-check-bogofilter-headers score))))
         return)
     (gnus-error 5 "`spam.el' doesn't support obsolete bogofilter versions")))
@@ -2501,7 +2501,7 @@ With a non-nil REMOVE, remove the ADDRESSES."
                      (point-min) (point-max)
                      spam-bogofilter-program
                      nil nil nil switch
-                     (if db `("-d" ,db "-v") `("-v")))))))
+                     (if db `("-d" ,db "-v") '("-v")))))))
     (gnus-error 5 "`spam.el' doesn't support obsolete bogofilter versions")))
 
 (defun spam-bogofilter-register-spam-routine (articles &optional unregister)
diff --git a/lisp/help-at-pt.el b/lisp/help-at-pt.el
index fcc4b86..dc73ba5 100644
--- a/lisp/help-at-pt.el
+++ b/lisp/help-at-pt.el
@@ -1,6 +1,6 @@
 ;;; help-at-pt.el --- local help through the keyboard
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Luc Teirlinck <address@hidden>
 ;; Keywords: help
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index ec46a47..06b4ec8 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -1,6 +1,6 @@
 ;;; help-fns.el --- Complex help functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1993-1994, 1998-2018 Free Software
+;; Copyright (C) 1985-1986, 1993-1994, 1998-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -68,12 +68,15 @@ The functions will receive the function name as argument.")
 
 (defun help--loaded-p (file)
   "Try and figure out if FILE has already been loaded."
+  ;; FIXME: this regexp business is not good enough: for file
+  ;; `toto', it will say `toto' is loaded when in reality it was
+  ;; just cedet/semantic/toto that has been loaded.
   (or (let ((feature (intern-soft file)))
         (and feature (featurep feature)))
       (let* ((re (load-history-regexp file))
              (done nil))
         (dolist (x load-history)
-          (and (car x) (string-match-p re (car x)) (setq done t)))
+          (and (stringp (car x)) (string-match-p re (car x)) (setq done t)))
         done)))
 
 (defun help--load-prefixes (prefixes)
@@ -83,11 +86,9 @@ The functions will receive the function name as argument.")
     (dolist (file files)
       ;; FIXME: Should we scan help-definition-prefixes to remove
       ;; other prefixes of the same file?
-      ;; FIXME: this regexp business is not good enough: for file
-      ;; `toto', it will say `toto' is loaded when in reality it was
-      ;; just cedet/semantic/toto that has been loaded.
       (unless (help--loaded-p file)
-        (load file 'noerror 'nomessage)))))
+        (with-demoted-errors "while loading: %S"
+          (load file 'noerror 'nomessage))))))
 
 (defun help--symbol-completion-table (string pred action)
   (let ((prefixes (radix-tree-prefixes (help-definition-prefixes) string)))
@@ -520,7 +521,7 @@ FILE is the file where FUNCTION was probably defined."
         (target (cons t function))
         found)
     (while (and load-hist (not found))
-      (and (caar load-hist)
+      (and (stringp (caar load-hist))
           (equal (file-name-sans-extension (caar load-hist)) file)
           (setq found (member target (cdar load-hist))))
       (setq load-hist (cdr load-hist)))
@@ -1141,7 +1142,7 @@ current buffer and the selected frame, respectively."
                                    (format
                                      "Describe symbol (default %s): " v-or-f)
                                  "Describe symbol: ")
-                               obarray
+                               #'help--symbol-completion-table
                                (lambda (vv)
                                   (cl-some (lambda (x) (funcall (nth 1 x) vv))
                                            describe-symbol-backends))
diff --git a/lisp/help-macro.el b/lisp/help-macro.el
index 86559eb..a16d1e3 100644
--- a/lisp/help-macro.el
+++ b/lisp/help-macro.el
@@ -1,6 +1,6 @@
 ;;; help-macro.el --- makes command line help such as help-for-help
 
-;; Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Lynn Slater <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 56cb080..6cc3f0d 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -1,6 +1,6 @@
 ;;; help-mode.el --- `help-mode' used by *Help* buffers
 
-;; Copyright (C) 1985-1986, 1993-1994, 1998-2018 Free Software
+;; Copyright (C) 1985-1986, 1993-1994, 1998-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/help.el b/lisp/help.el
index ad782f7..d1f4735 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1,6 +1,6 @@
 ;;; help.el --- help commands for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1993-1994, 1998-2018 Free Software
+;; Copyright (C) 1985-1986, 1993-1994, 1998-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -425,13 +425,11 @@ is specified by the variable `message-log-max'."
 (defun view-order-manuals ()
   "Display information on how to buy printed copies of Emacs manuals."
   (interactive)
-;;  (view-help-file "ORDERS")
   (info "(emacs)Printed Books"))
 
 (defun view-emacs-FAQ ()
   "Display the Emacs Frequently Asked Questions (FAQ) file."
   (interactive)
-  ;; (find-file-read-only (expand-file-name "FAQ" data-directory))
   (info "(efaq)"))
 
 (defun view-emacs-problems ()
@@ -444,7 +442,8 @@ is specified by the variable `message-log-max'."
   (interactive)
   (view-help-file "DEBUG"))
 
-;; This used to visit MORE.STUFF; maybe it should just be removed.
+;; This used to visit a plain text file etc/MORE.STUFF;
+;; maybe this command should just be removed.
 (defun view-external-packages ()
   "Display info on where to get more Emacs packages."
   (interactive)
diff --git a/lisp/hex-util.el b/lisp/hex-util.el
index f79fcb3..26fb525 100644
--- a/lisp/hex-util.el
+++ b/lisp/hex-util.el
@@ -1,6 +1,6 @@
 ;;; hex-util.el --- Functions to encode/decode hexadecimal string -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Shuhei KOBAYASHI <address@hidden>
 ;; Keywords: data
diff --git a/lisp/hexl.el b/lisp/hexl.el
index 230b64d..c1c2d70 100644
--- a/lisp/hexl.el
+++ b/lisp/hexl.el
@@ -1,6 +1,6 @@
 ;;; hexl.el --- edit a file in a hex dump format using the hexl filter -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1989, 1994, 1998, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1989, 1994, 1998, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Keith Gabryelski <address@hidden>
@@ -1089,7 +1089,7 @@ This function is assumed to be used as callback function 
for `hl-line-mode'."
 ;; startup stuff.
 
 (easy-menu-define hexl-menu hexl-mode-map "Hexl Mode menu"
-  `("Hexl"
+  '("Hexl"
     :help "Hexl-specific Features"
 
     ["Backward short" hexl-backward-short
diff --git a/lisp/hfy-cmap.el b/lisp/hfy-cmap.el
index ee6e18e..a34efa6 100644
--- a/lisp/hfy-cmap.el
+++ b/lisp/hfy-cmap.el
@@ -1,6 +1,6 @@
 ;;; hfy-cmap.el --- Fallback color name -> rgb mapping for `htmlfontify'
 
-;; Copyright (C) 2002-2003, 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2003, 2009-2019 Free Software Foundation, Inc.
 
 ;; Emacs Lisp Archive Entry
 ;; Package: htmlfontify
diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el
index 08b5811..c2568a5 100644
--- a/lisp/hi-lock.el
+++ b/lisp/hi-lock.el
@@ -1,6 +1,6 @@
 ;;; hi-lock.el --- minor mode for interactive automatic highlighting  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: David M. Koppelman <address@hidden>
 ;; Keywords: faces, minor-mode, matching, display
@@ -177,6 +177,26 @@ Instead, each hi-lock command will cycle through the faces 
in
   "Face for hi-lock mode."
   :group 'hi-lock-faces)
 
+(defface hi-salmon
+  '((((min-colors 88) (background dark))
+     (:background "light salmon" :foreground "black"))
+    (((background dark)) (:background "red" :foreground "black"))
+    (((min-colors 88)) (:background "light salmon"))
+    (t (:background "red")))
+  "Face for hi-lock mode."
+  :group 'hi-lock-faces
+  :version "27.1")
+
+(defface hi-aquamarine
+  '((((min-colors 88) (background dark))
+     (:background "aquamarine" :foreground "black"))
+    (((background dark)) (:background "blue" :foreground "black"))
+    (((min-colors 88)) (:background "aquamarine"))
+    (t (:background "blue")))
+  "Face for hi-lock mode."
+  :group 'hi-lock-faces
+  :version "27.1")
+
 (defface hi-black-b
   '((t (:weight bold)))
   "Face for hi-lock mode."
@@ -189,13 +209,13 @@ Instead, each hi-lock command will cycle through the 
faces in
   :group 'hi-lock-faces)
 
 (defface hi-green-b
-  '((((min-colors 88)) (:weight bold :foreground "green1"))
+  '((((min-colors 88)) (:weight bold :foreground "green3"))
     (t (:weight bold :foreground "green")))
   "Face for hi-lock mode."
   :group 'hi-lock-faces)
 
 (defface hi-red-b
-  '((((min-colors 88)) (:weight bold :foreground "red1"))
+  '((((min-colors 88)) (:weight bold :foreground "firebrick2"))
     (t (:weight bold :foreground "red")))
   "Face for hi-lock mode."
   :group 'hi-lock-faces)
@@ -216,8 +236,8 @@ Instead, each hi-lock command will cycle through the faces 
in
 (define-obsolete-variable-alias 'hi-lock-face-history
                                 'hi-lock-face-defaults "23.1")
 (defvar hi-lock-face-defaults
-  '("hi-yellow" "hi-pink" "hi-green" "hi-blue" "hi-black-b"
-    "hi-blue-b" "hi-red-b" "hi-green-b" "hi-black-hb")
+  '("hi-yellow" "hi-pink" "hi-green" "hi-blue" "hi-salmon" "hi-aquamarine"
+    "hi-black-b" "hi-blue-b" "hi-red-b" "hi-green-b" "hi-black-hb")
   "Default faces for hi-lock interactive functions.")
 
 (define-obsolete-variable-alias 'hi-lock-regexp-history
@@ -559,7 +579,7 @@ then remove all hi-lock highlighting."
         (x-popup-menu
          t
          (cons
-          `keymap
+          'keymap
           (cons "Select Pattern to Unhighlight"
                 (mapcar (lambda (pattern)
                           (list (car pattern)
diff --git a/lisp/hilit-chg.el b/lisp/hilit-chg.el
index 70bf6b4..272f758 100644
--- a/lisp/hilit-chg.el
+++ b/lisp/hilit-chg.el
@@ -1,6 +1,6 @@
 ;;; hilit-chg.el --- minor mode displaying buffer changes with special face
 
-;; Copyright (C) 1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Richard Sharman <address@hidden>
 ;; Keywords: faces
diff --git a/lisp/hippie-exp.el b/lisp/hippie-exp.el
index 2d286be..404f448 100644
--- a/lisp/hippie-exp.el
+++ b/lisp/hippie-exp.el
@@ -1,6 +1,6 @@
 ;;; hippie-exp.el --- expand text trying various ways to find its expansion
 
-;; Copyright (C) 1992, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Anders Holst <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/hl-line.el b/lisp/hl-line.el
index f0ee22a..1c09bc2 100644
--- a/lisp/hl-line.el
+++ b/lisp/hl-line.el
@@ -1,6 +1,6 @@
 ;;; hl-line.el --- highlight the current line  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author:  Dave Love <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index 10cfca3..9fc029e 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -1,6 +1,6 @@
 ;;; htmlfontify.el --- htmlize a buffer/source tree with optional hyperlinks 
-*- lexical-binding: t -*-
 
-;; Copyright (C) 2002-2003, 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2003, 2009-2019 Free Software Foundation, Inc.
 
 ;; Emacs Lisp Archive Entry
 ;; Package: htmlfontify
diff --git a/lisp/ibuf-ext.el b/lisp/ibuf-ext.el
index 32ec91d..1b69574 100644
--- a/lisp/ibuf-ext.el
+++ b/lisp/ibuf-ext.el
@@ -1,6 +1,6 @@
 ;;; ibuf-ext.el --- extensions for ibuffer  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Colin Walters <address@hidden>
 ;; Maintainer: John Paul Wallington <address@hidden>
@@ -723,7 +723,7 @@ specification, with the same structure as an element of the 
list
   (not
    (not
     (pcase (car filter)
-      (`or
+      ('or
        ;;; ATTN: Short-circuiting alternative with parallel structure w/`and
        ;;(catch 'has-match
        ;;  (dolist (filter-spec (cdr filter) nil)
@@ -732,12 +732,12 @@ specification, with the same structure as an element of 
the list
        (memq t (mapcar #'(lambda (x)
                            (ibuffer-included-in-filter-p buf x))
                        (cdr filter))))
-      (`and
+      ('and
        (catch 'no-match
          (dolist (filter-spec (cdr filter) t)
            (unless (ibuffer-included-in-filter-p buf filter-spec)
              (throw 'no-match nil)))))
-      (`saved
+      ('saved
        (let ((data (assoc (cdr filter) ibuffer-saved-filters)))
         (unless data
           (ibuffer-filter-disable t)
@@ -1051,14 +1051,14 @@ turned into separate filters, like [name: foo] and 
[mode: bar-mode]."
          (tail (cdr filters))
          (value
           (pcase (caar filters)
-            ((or `or 'and) (nconc head tail))
-            (`saved
+            ((or 'or 'and) (nconc head tail))
+            ('saved
              (let ((data (assoc head ibuffer-saved-filters)))
                (unless data
                  (ibuffer-filter-disable)
                  (error "Unknown saved filter %s" head))
                (append (cdr data) tail)))
-            (`not (cons (ibuffer-unary-operand (car filters)) tail))
+            ('not (cons (ibuffer-unary-operand (car filters)) tail))
             (_
              (error "Filter type %s is not compound" (caar filters))))))
     (setq ibuffer-filtering-qualifiers value))
@@ -1197,12 +1197,12 @@ Interactively, prompt for NAME, and use the current 
filters."
 
 (defun ibuffer-format-qualifier-1 (qualifier)
   (pcase (car qualifier)
-    (`saved
+    ('saved
      (concat " [filter: " (cdr qualifier) "]"))
-    (`or
+    ('or
      (concat " [OR" (mapconcat #'ibuffer-format-qualifier
                                (cdr qualifier) "") "]"))
-    (`and
+    ('and
      (concat " [AND" (mapconcat #'ibuffer-format-qualifier
                                 (cdr qualifier) "") "]"))
     (_
@@ -1948,11 +1948,10 @@ Otherwise buffers whose name matches an element of
   (ibuffer-mark-on-buffer
    #'(lambda (buf)
        (with-current-buffer buf
-        ;; hacked from midnight.el
         (when buffer-display-time
-          (let* ((now (float-time))
-                 (then (float-time buffer-display-time)))
-            (> (- now then) (* 60 60 ibuffer-old-time))))))))
+          (time-less-p
+           (* 60 60 ibuffer-old-time)
+           (time-since buffer-display-time)))))))
 
 ;;;###autoload
 (defun ibuffer-mark-special-buffers ()
diff --git a/lisp/ibuf-macs.el b/lisp/ibuf-macs.el
index 72a35a5..2b28f18 100644
--- a/lisp/ibuf-macs.el
+++ b/lisp/ibuf-macs.el
@@ -1,6 +1,6 @@
 ;;; ibuf-macs.el --- macros for ibuffer  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Colin Walters <address@hidden>
 ;; Maintainer: John Paul Wallington <address@hidden>
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 78dab1c..2d3c140 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -1,6 +1,6 @@
 ;;; ibuffer.el --- operate on buffers like dired  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Colin Walters <address@hidden>
 ;; Maintainer: John Paul Wallington <address@hidden>
@@ -150,12 +150,12 @@ elisp byte-compiler."
   :group 'ibuffer)
 
 (defcustom ibuffer-fontification-alist
-  `((10 buffer-read-only font-lock-constant-face)
+  '((10 buffer-read-only font-lock-constant-face)
     (15 (and buffer-file-name
             (string-match ibuffer-compressed-file-name-regexp
                           buffer-file-name))
        font-lock-doc-face)
-    (20 (string-match "^*" (buffer-name)) font-lock-keyword-face)
+    (20 (string-match "^\\*" (buffer-name)) font-lock-keyword-face)
     (25 (and (string-match "^ " (buffer-name))
             (null buffer-file-name))
        italic)
@@ -1613,8 +1613,8 @@ If point is on a group name, this function operates on 
that group."
     `(truncate-string-to-width ,strvar ,maxvar nil ?\s)))
 
 (defun ibuffer-compile-make-format-form (strvar widthform alignment)
-  (let* ((left `(make-string tmp2 ?\s))
-        (right `(make-string (- tmp1 tmp2) ?\s)))
+  (let* ((left '(make-string tmp2 ?\s))
+        (right '(make-string (- tmp1 tmp2) ?\s)))
     `(progn
        (setq tmp1 ,widthform
             tmp2 (/ tmp1 2))
@@ -1737,7 +1737,7 @@ If point is on a group name, this function operates on 
that group."
                      outforms)
                     (push `(setq str ,callform
                                   ,@(when strlen-used
-                                      `(strlen (string-width str))))
+                                      '(strlen (string-width str))))
                           outforms)
                     (setq outforms
                           (append outforms
@@ -2205,7 +2205,7 @@ the value of point at the beginning of the line for that 
buffer."
                     strname
                     (propertize strname 'mouse-face 'highlight 'keymap hmap)))
                  strname)))))
-        (add-text-properties opos (point) `(ibuffer-title-header t))
+        (add-text-properties opos (point) '(ibuffer-title-header t))
         (insert "\n")
         ;; Add the underlines
         (let ((str (save-excursion
@@ -2255,7 +2255,7 @@ the value of point at the beginning of the line for that 
buffer."
                                                align)
                       summary))))))
           (point))
-        `(ibuffer-summary t)))))
+        '(ibuffer-summary t)))))
 
 
 (defun ibuffer-redisplay (&optional silent)
diff --git a/lisp/icomplete.el b/lisp/icomplete.el
index ad5a9d0..10fd3a6 100644
--- a/lisp/icomplete.el
+++ b/lisp/icomplete.el
@@ -1,6 +1,6 @@
-;;; icomplete.el --- minibuffer completion incremental feedback
+;;; icomplete.el --- minibuffer completion incremental feedback -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1992-1994, 1997, 1999, 2001-2018 Free Software
+;; Copyright (C) 1992-1994, 1997, 1999, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Ken Manheimer <address@hidden>
@@ -145,7 +145,7 @@ icompletion is occurring."
 
 (defvar icomplete-minibuffer-map
   (let ((map (make-sparse-keymap)))
-    (define-key map [?\M-\t] 'minibuffer-force-complete)
+    (define-key map [?\M-\t] 'icomplete-force-complete)
     (define-key map [?\C-j]  'icomplete-force-complete-and-exit)
     (define-key map [?\C-.]  'icomplete-forward-completions)
     (define-key map [?\C-,]  'icomplete-backward-completions)
@@ -162,6 +162,12 @@ the default otherwise."
       (minibuffer-force-complete-and-exit)
     (minibuffer-complete-and-exit)))
 
+(defun icomplete-force-complete ()
+  "Complete the icomplete minibuffer."
+  (interactive)
+  ;; We're not at all interested in cycling here (bug#34077).
+  (minibuffer-force-complete nil nil 'dont-cycle))
+
 (defun icomplete-forward-completions ()
   "Step forward completions by one entry.
 Second entry becomes the first and can be selected with
@@ -368,8 +374,21 @@ If there are multiple possibilities, `icomplete-separator' 
separates them.
 The displays for unambiguous matches have ` [Matched]' appended
 \(whether complete or not), or ` [No matches]', if no eligible
 matches exist."
-  (let* ((minibuffer-completion-table candidates)
-        (minibuffer-completion-predicate predicate)
+  (let* ((ignored-extension-re
+          (and minibuffer-completing-file-name
+               icomplete-with-completion-tables
+               completion-ignored-extensions
+               (concat "\\(?:\\`\\.\\./\\|"
+                       (regexp-opt completion-ignored-extensions)
+                       "\\)\\'")))
+         (minibuffer-completion-table candidates)
+        (minibuffer-completion-predicate
+          (if ignored-extension-re
+              (lambda (cand)
+                (and (not (string-match ignored-extension-re cand))
+                     (or (null predicate)
+                         (funcall predicate cand))))
+            predicate))
         (md (completion--field-metadata (icomplete--field-beg)))
         (comps (completion-all-sorted-completions
                  (icomplete--field-beg) (icomplete--field-end)))
@@ -380,11 +399,8 @@ matches exist."
     ;; `concat'/`mapconcat' is the slow part.
     (if (not (consp comps))
        (progn ;;(debug (format "Candidates=%S field=%S" candidates name))
-              (format " %sNo matches%s" open-bracket close-bracket))
+         (format " %sNo matches%s" open-bracket close-bracket))
       (if last (setcdr last nil))
-      (when (and minibuffer-completing-file-name
-                 icomplete-with-completion-tables)
-        (setq comps (completion-pcm--filename-try-filter comps)))
       (let* ((most-try
               (if (and base-size (> base-size 0))
                   (completion-try-completion
@@ -470,11 +486,11 @@ matches exist."
                  (if prefix-len (substring (car comps) prefix-len) (car comps))
                  comps (cdr comps))
            (setq prospects-len
-                           (+ (string-width comp)
-                             (string-width icomplete-separator)
-                             prospects-len))
-                    (if (< prospects-len prospects-max)
-                        (push comp prospects)
+                  (+ (string-width comp)
+                    (string-width icomplete-separator)
+                    prospects-len))
+           (if (< prospects-len prospects-max)
+               (push comp prospects)
              (setq limit t))))
        (setq prospects (nreverse prospects))
        ;; Decorate first of the prospects.
diff --git a/lisp/ido.el b/lisp/ido.el
index 7bf4a92..0854014 100644
--- a/lisp/ido.el
+++ b/lisp/ido.el
@@ -1,6 +1,6 @@
 ;;; ido.el --- interactively do things with buffers and files -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <address@hidden>
 ;; Based on: iswitchb by Stephen Eglen <address@hidden>
@@ -1515,20 +1515,20 @@ Removes badly formatted data and ignored directories."
                                (files (cdr (cdr (car l)))))
                            (and
                             (stringp dir)
-                            (consp time)
-                            (cond
-                             ((integerp (car time))
-                              (and (not (zerop (float-time time)))
-                                   (ido-may-cache-directory dir)))
-                             ((eq (car time) 'ftp)
-                              (and (numberp (cdr time))
-                                   (ido-is-ftp-directory dir)
-                                   (ido-cache-ftp-valid (cdr time))))
-                             ((eq (car time) 'unc)
-                              (and (numberp (cdr time))
-                                   (ido-is-unc-host dir)
-                                   (ido-cache-unc-valid (cdr time))))
-                             (t nil))
+                            (if (condition-case nil
+                                    (not (time-equal-p time 0))
+                                  (error))
+                                (ido-may-cache-directory dir)
+                              (and
+                               (consp time)
+                               (numberp (cdr time))
+                               (cond
+                                ((eq (car time) 'ftp)
+                                 (and (ido-is-ftp-directory dir)
+                                      (ido-cache-ftp-valid (cdr time))))
+                                ((eq (car time) 'unc)
+                                 (and (ido-is-unc-host dir)
+                                      (ido-cache-unc-valid (cdr time)))))))
                             (let ((s files) (ok t))
                               (while s
                                 (if (stringp (car s))
@@ -1688,27 +1688,27 @@ is enabled then some keybindings are changed in the 
keymap."
     (when viper-p
       (define-key map [remap viper-intercept-ESC-key] 'ignore))
     (pcase ido-cur-item
-     ((or `file `dir)
-      (when ido-context-switch-command
-       (define-key map "\C-x\C-b" ido-context-switch-command)
-       (define-key map "\C-x\C-d" 'ignore))
-      (when viper-p
-       (define-key map [remap viper-backward-char]
-         'ido-delete-backward-updir)
-       (define-key map [remap viper-del-backward-char-in-insert]
-         'ido-delete-backward-updir)
-       (define-key map [remap viper-delete-backward-word]
-         'ido-delete-backward-word-updir))
-      (set-keymap-parent map
-                        (if (eq ido-cur-item 'file)
-                            ido-file-completion-map
-                          ido-file-dir-completion-map)))
-     (`buffer
-      (when ido-context-switch-command
-       (define-key map "\C-x\C-f" ido-context-switch-command))
-      (set-keymap-parent map ido-buffer-completion-map))
-     (_
-      (set-keymap-parent map ido-common-completion-map)))
+      ((or 'file 'dir)
+       (when ido-context-switch-command
+        (define-key map "\C-x\C-b" ido-context-switch-command)
+        (define-key map "\C-x\C-d" 'ignore))
+       (when viper-p
+        (define-key map [remap viper-backward-char]
+          'ido-delete-backward-updir)
+        (define-key map [remap viper-del-backward-char-in-insert]
+          'ido-delete-backward-updir)
+        (define-key map [remap viper-delete-backward-word]
+          'ido-delete-backward-word-updir))
+       (set-keymap-parent map
+                         (if (eq ido-cur-item 'file)
+                             ido-file-completion-map
+                           ido-file-dir-completion-map)))
+      ('buffer
+       (when ido-context-switch-command
+        (define-key map "\C-x\C-f" ido-context-switch-command))
+       (set-keymap-parent map ido-buffer-completion-map))
+      (_
+       (set-keymap-parent map ido-common-completion-map)))
     (setq ido-completion-map map)))
 
 (defun ido-final-slash (dir &optional fix-it)
@@ -3621,8 +3621,7 @@ Uses and updates `ido-dir-file-cache'."
                             (ido-cache-unc-valid (cdr ctime)))))
           (t
            (if attr
-               (setq valid (and (= (car ctime) (car mtime))
-                                (= (car (cdr ctime)) (car (cdr mtime))))))))
+               (setq valid (time-equal-p ctime mtime)))))
          (unless valid
            (setq ido-dir-file-cache (delq cached ido-dir-file-cache)
                  cached nil)))
@@ -3789,13 +3788,13 @@ frame, rather than all frames, regardless of value of 
`ido-all-frames'."
                       (not (and (eq ido-cur-item 'buffer)
                                 ido-buffer-disable-smart-matches))
                       (not ido-enable-regexp)
-                      (not (string-match "$\\'" rex0))
+                      (not (string-match "\\$\\'" rex0))
                       (concat "\\`" rex0 (if slash "/" "") "\\'")))
         (suffix-re (and do-full slash
                         (not (and (eq ido-cur-item 'buffer)
                                   ido-buffer-disable-smart-matches))
                         (not ido-enable-regexp)
-                        (not (string-match "$\\'" rex0))
+                        (not (string-match "\\$\\'" rex0))
                         (concat rex0 "/\\'")))
         (prefix-re (and full-re (not ido-enable-prefix)
                         (concat "\\`" rexq)))
@@ -3966,8 +3965,24 @@ If `ido-change-word-sub' cannot be found in WORD, return 
nil."
     (exit-minibuffer)
     t))
 
+;; This is a shameless copy of `switch-to-completions'.
+(defun ido-switch-to-completions ()
+  "Select the window showing `ido-completion-buffer'."
+  (interactive)
+  (let ((window (or (get-buffer-window ido-completion-buffer 0)
+                   ;; Make sure we have a completions window.
+                    (progn (ido-completion-help)
+                           (get-buffer-window ido-completion-buffer 0)))))
+    (when window
+      (select-window window)
+      ;; In the new buffer, go to the first completion.
+      ;; FIXME: Perhaps this should be done in `ido-completion-help'.
+      (when (bobp)
+       (next-completion 1)))))
+
+
 (defun ido-completion-help ()
-  "Show possible completions in a \"*File Completions*\" buffer."
+  "Show possible completions in the `ido-completion-buffer'."
   (interactive)
   (setq ido-rescan nil)
   (let ((temp-buf (and ido-completion-buffer
diff --git a/lisp/ielm.el b/lisp/ielm.el
index 8d1efcd..82aff99 100644
--- a/lisp/ielm.el
+++ b/lisp/ielm.el
@@ -1,6 +1,6 @@
 ;;; ielm.el --- interaction mode for Emacs Lisp  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Smith <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/iimage.el b/lisp/iimage.el
index 22e1500..e51108e 100644
--- a/lisp/iimage.el
+++ b/lisp/iimage.el
@@ -1,6 +1,6 @@
 ;;; iimage.el --- Inline image minor mode.
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: KOSEKI Yoshinori <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index 17e566d..c9b31e9 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -1,6 +1,6 @@
 ;;; image-dired.el --- use dired to browse and manipulate your images -*- 
lexical-binding: t -*-
 ;;
-;; Copyright (C) 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 ;;
 ;; Version: 0.4.11
 ;; Keywords: multimedia
diff --git a/lisp/image-file.el b/lisp/image-file.el
index 19dc787..bc5ef44 100644
--- a/lisp/image-file.el
+++ b/lisp/image-file.el
@@ -1,6 +1,6 @@
 ;;; image-file.el --- support for visiting image files
 ;;
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <address@hidden>
 ;; Keywords: multimedia
diff --git a/lisp/image-mode.el b/lisp/image-mode.el
index 606c661..fa1362c 100644
--- a/lisp/image-mode.el
+++ b/lisp/image-mode.el
@@ -1,6 +1,6 @@
 ;;; image-mode.el --- support for visiting image files  -*- lexical-binding: t 
-*-
 ;;
-;; Copyright (C) 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Richard Stallman <address@hidden>
 ;; Keywords: multimedia
@@ -53,7 +53,7 @@ See `image-mode-winprops'.")
 It is called with one argument, the initial WINPROPS.")
 
 ;; FIXME this doesn't seem mature yet. Document in manual when it is.
-(defvar image-transform-resize nil
+(defvar-local image-transform-resize nil
   "The image resize operation.
 Its value should be one of the following:
  - nil, meaning no resizing.
@@ -61,10 +61,10 @@ Its value should be one of the following:
  - `fit-width', meaning to fit the image to the window width.
  - A number, which is a scale factor (the default size is 1).")
 
-(defvar image-transform-scale 1.0
+(defvar-local image-transform-scale 1.0
   "The scale factor of the image being displayed.")
 
-(defvar image-transform-rotation 0.0
+(defvar-local image-transform-rotation 0.0
   "Rotation angle for the image in the current Image mode buffer.")
 
 (defvar image-transform-right-angle-fudge 0.0001
@@ -741,9 +741,11 @@ was inserted."
         (type (if (image--imagemagick-wanted-p filename)
                   'imagemagick
                 (image-type file-or-data nil data-p)))
+         ;; :scale 1: If we do not set this, create-image will apply
+         ;; default scaling based on font size.
         (image (if (not edges)
-                   (create-image file-or-data type data-p)
-                 (create-image file-or-data type data-p
+                   (create-image file-or-data type data-p :scale 1)
+                 (create-image file-or-data type data-p :scale 1
                                :max-width (- (nth 2 edges) (nth 0 edges))
                                :max-height (- (nth 3 edges) (nth 1 edges)))))
         (inhibit-read-only t)
@@ -786,7 +788,7 @@ was inserted."
 (defun image--imagemagick-wanted-p (filename)
   (and (fboundp 'imagemagick-types)
        (not (eq imagemagick-types-inhibit t))
-       (not (and (file-name-extension filename)
+       (not (and filename (file-name-extension filename)
                  (memq (intern (upcase (file-name-extension filename)) obarray)
                        imagemagick-types-inhibit)))))
 
diff --git a/lisp/image.el b/lisp/image.el
index 74a2304..6da3a0b 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -1,6 +1,6 @@
 ;;; image.el --- image API  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: multimedia
@@ -415,13 +415,20 @@ must be available."
 (defun create-image (file-or-data &optional type data-p &rest props)
   "Create an image.
 FILE-OR-DATA is an image file name or image data.
+
 Optional TYPE is a symbol describing the image type.  If TYPE is omitted
 or nil, try to determine the image type from its first few bytes
 of image data.  If that doesn't work, and FILE-OR-DATA is a file name,
 use its file extension as image type.
+
 Optional DATA-P non-nil means FILE-OR-DATA is a string containing image data.
+
 Optional PROPS are additional image attributes to assign to the image,
-like, e.g. `:mask MASK'.
+like, e.g. `:mask MASK'.  If the property `:scale' is not given and the
+display has a high resolution (more exactly, when the average width of a
+character in the default font is more than 10 pixels), the image is
+automatically scaled up in proportion to the default font.
+
 Value is the image created, or nil if images of type TYPE are not supported.
 
 Images should not be larger than specified by `max-image-size'.
@@ -797,19 +804,22 @@ If the image has a non-nil :speed property, it acts as a 
multiplier
 for the animation speed.  A negative value means to animate in reverse."
   (when (and (buffer-live-p (plist-get (cdr image) :animate-buffer))
              ;; Delayed more than two seconds more than expected.
-            (or (<= (- (float-time) target-time) 2)
+            (or (time-less-p (time-since target-time) 2)
                 (progn
                   (message "Stopping animation; animation possibly too big")
                   nil)))
     (image-show-frame image n t)
     (let* ((speed (image-animate-get-speed image))
-          (time (float-time))
+          (time (current-time))
           (animation (image-multi-frame-p image))
+          (time-to-load-image (time-since time))
+          (stated-delay-time (/ (or (cdr animation)
+                                    image-default-frame-delay)
+                                (float (abs speed))))
           ;; Subtract off the time we took to load the image from the
           ;; stated delay time.
-          (delay (max (+ (* (or (cdr animation) image-default-frame-delay)
-                            (/ 1.0 (abs speed)))
-                         time (- (float-time)))
+          (delay (max (float-time (time-subtract stated-delay-time
+                                                 time-to-load-image))
                       image-minimum-frame-delay))
           done)
       (setq n (if (< speed 0)
@@ -918,7 +928,7 @@ has no effect."
   :version "24.3")
 
 (defcustom imagemagick-enabled-types
-  '(3FR ART ARW AVS BMP BMP2 BMP3 CAL CALS CMYK CMYKA CR2 CRW
+  '(3FR ARW AVS BMP BMP2 BMP3 CAL CALS CMYK CMYKA CR2 CRW
     CUR CUT DCM DCR DCX DDS DJVU DNG DPX EXR FAX FITS GBR GIF
     GIF87 GRB HRZ ICB ICO ICON J2C JNG JP2 JPC JPEG JPG JPX K25
     KDC MIFF MNG MRW MSL MSVG MTV NEF ORF OTB PBM PCD PCDS PCL
@@ -952,7 +962,7 @@ has no effect."
   :set (lambda (symbol value)
         (set-default symbol value)
         (imagemagick-register-types))
-  :version "24.3")
+  :version "26.2")                      ; remove ART (bug#22289)
 
 (imagemagick-register-types)
 
@@ -982,8 +992,8 @@ default is 20%."
     image))
 
 (defun image--get-imagemagick-and-warn ()
-  (unless (or (fboundp 'imagemagick-types) (featurep 'ns))
-    (error "Cannot rescale images without ImageMagick support"))
+  (unless (or (fboundp 'imagemagick-types) (image-scaling-p))
+    (error "Cannot rescale images on this terminal"))
   (let ((image (image--get-image)))
     (image-flush image)
     (when (fboundp 'imagemagick-types)
diff --git a/lisp/image/compface.el b/lisp/image/compface.el
index 67b9ca3..2375261 100644
--- a/lisp/image/compface.el
+++ b/lisp/image/compface.el
@@ -1,6 +1,6 @@
 ;;; compface.el --- functions for converting X-Face headers
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el
index e7c472d..cf61119 100644
--- a/lisp/image/gravatar.el
+++ b/lisp/image/gravatar.el
@@ -1,6 +1,6 @@
 ;;; gravatar.el --- Get Gravatars
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Julien Danjou <address@hidden>
 ;; Keywords: news
diff --git a/lisp/imenu.el b/lisp/imenu.el
index 09d50da..df39ff3 100644
--- a/lisp/imenu.el
+++ b/lisp/imenu.el
@@ -1,6 +1,6 @@
 ;;; imenu.el --- framework for mode-specific buffer indexes  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1994-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Ake Stenhoff <address@hidden>
 ;;         Lars Lindberg <address@hidden>
diff --git a/lisp/indent.el b/lisp/indent.el
index 73a7d0e..34757a4 100644
--- a/lisp/indent.el
+++ b/lisp/indent.el
@@ -1,6 +1,6 @@
 ;;; indent.el --- indentation commands for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985, 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Package: emacs
diff --git a/lisp/info-look.el b/lisp/info-look.el
index dec16cf..1d761c7 100644
--- a/lisp/info-look.el
+++ b/lisp/info-look.el
@@ -1,7 +1,7 @@
 ;;; info-look.el --- major-mode-sensitive Info index lookup facility -*- 
lexical-binding: t -*-
 ;; An older version of this was known as libc.el.
 
-;; Copyright (C) 1995-1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Ralph Schleicher <address@hidden>
 ;;         (did not show signs of life (Nov 2001)  -stef)
diff --git a/lisp/info-xref.el b/lisp/info-xref.el
index 5e029b0..c55398b 100644
--- a/lisp/info-xref.el
+++ b/lisp/info-xref.el
@@ -1,6 +1,6 @@
 ;;; info-xref.el --- check external references in an Info document -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Kevin Ryde <address@hidden>
 ;; Keywords: docs
@@ -71,7 +71,7 @@ you should set this variable to nil."
 (defun info-xref-lock-file-p (filename)
   "Return non-nil if FILENAME is an Emacs lock file.
 A lock file is \".#foo.txt\" etc per `lock-buffer'."
-  (string-match "\\(\\`\\|\\/\\)\\.#" filename))
+  (string-match "\\(\\`\\|/\\)\\.#" filename))
 
 (defun info-xref-subfile-p (filename)
   "Return t if FILENAME is an info subfile.
diff --git a/lisp/info.el b/lisp/info.el
index f2e2957..f2a064a 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1,6 +1,6 @@
 ;; info.el --- Info package for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1992-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: help
@@ -642,14 +642,14 @@ Do the right thing if the file has been compressed or 
zipped."
          (insert-file-contents-literally fullname visit)
          (let ((inhibit-read-only t)
                (coding-system-for-write 'no-conversion)
-               (inhibit-null-byte-detection t) ; Index nodes include null bytes
+               (inhibit-nul-byte-detection t) ; Index nodes include null bytes
                (default-directory (or (file-name-directory fullname)
                                       default-directory)))
            (or (consp decoder)
                (setq decoder (list decoder)))
            (apply #'call-process-region (point-min) (point-max)
                   (car decoder) t t nil (cdr decoder))))
-      (let ((inhibit-null-byte-detection t)) ; Index nodes include null bytes
+      (let ((inhibit-nul-byte-detection t)) ; Index nodes include null bytes
        (insert-file-contents fullname visit)))
 
     ;; Clear the caches of modified Info files.
@@ -1377,7 +1377,7 @@ is non-nil)."
                          ;; Index nodes include null bytes.  DIR
                          ;; files should not have indices, but who
                          ;; knows...
-                         (let ((inhibit-null-byte-detection t))
+                         (let ((inhibit-nul-byte-detection t))
                            (insert-file-contents file)
                            (setq Info-dir-file-name file)
                            (push (current-buffer) buffers)
@@ -1531,7 +1531,7 @@ is non-nil)."
            (save-restriction
              (narrow-to-region start (point))
              (goto-char (point-min))
-             (while (re-search-forward "^* \\([^:\n]+:\\(:\\|[^.\n]+\\).\\)" 
nil 'move)
+             (while (re-search-forward "^\\* \\([^:\n]+:\\(:\\|[^.\n]+\\).\\)" 
nil 'move)
                ;; Fold case straight away; `member-ignore-case' here wasteful.
                (let ((x (downcase (match-string 1))))
                  (if (member x seen)
@@ -1602,7 +1602,7 @@ is non-nil)."
   "Unescape double quotes and backslashes in VALUE."
   (let ((start 0)
        (unquote value))
-    (while (string-match "[^\\\"]*\\(\\\\\\)[\\\\\"]" unquote start)
+    (while (string-match "[^\\\"]*\\(\\\\\\)[\\\"]" unquote start)
       (setq unquote (replace-match "" t t unquote 1))
       (setq start (- (match-end 0) 1)))
     unquote))
@@ -1619,7 +1619,7 @@ escaped (\\\",\\\\)."
   (let ((start 0)
        (parameter-alist))
     (while (string-match
-           "\\s *\\([^=]+\\)=\\(?:\\([^\\s 
\"]+\\)\\|\\(?:\"\\(\\(?:[^\\\"]\\|\\\\[\\\\\"]\\)*\\)\"\\)\\)"
+           "\\s *\\([^=]+\\)=\\(?:\\([^\\s 
\"]+\\)\\|\\(?:\"\\(\\(?:[^\\\"]\\|\\\\[\\\"]\\)*\\)\"\\)\\)"
            parameter-string start)
       (setq start (match-end 0))
       (push (cons (match-string 1 parameter-string)
@@ -2734,7 +2734,7 @@ Because of ambiguities, this should be concatenated with 
something like
           (user-error "No menu in this node"))
         (cond
          ((eq (car-safe action) 'boundaries) nil)
-         ((eq action 'metadata) `(metadata (category . info-menu)))
+         ((eq action 'metadata) '(metadata (category . info-menu)))
          ((eq action 'lambda)
           (re-search-forward
            (concat "\n\\* +" (regexp-quote string) ":") nil t))
@@ -5204,7 +5204,7 @@ The INDENT level is ignored."
 TEXT is the text of the button we clicked on, a + or - item.
 TOKEN is data related to this node (NAME . FILE).
 INDENT is the current indentation depth."
-  (cond ((string-match "+" text)       ;we have to expand this file
+  (cond ((string-match "\\+" text)     ;we have to expand this file
         (speedbar-change-expand-button-char ?-)
         (if (speedbar-with-writable
              (save-excursion
diff --git a/lisp/informat.el b/lisp/informat.el
index ff34496..8108ffe 100644
--- a/lisp/informat.el
+++ b/lisp/informat.el
@@ -1,6 +1,6 @@
 ;;; informat.el --- info support functions package for Emacs
 
-;; Copyright (C) 1986, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: help
diff --git a/lisp/international/ccl.el b/lisp/international/ccl.el
index a80452f..51626f5 100644
--- a/lisp/international/ccl.el
+++ b/lisp/international/ccl.el
@@ -1,6 +1,6 @@
 ;;; ccl.el --- CCL (Code Conversion Language) compiler  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/characters.el b/lisp/international/characters.el
index 23d9df6..012827b 100644
--- a/lisp/international/characters.el
+++ b/lisp/international/characters.el
@@ -1,6 +1,6 @@
 ;;; characters.el --- set syntax and category for multibyte characters
 
-;; Copyright (C) 1997, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2000-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -987,11 +987,12 @@ with L, LRE, or LRO Unicode bidi character type.")
           (#x103D . #x103E)
           (#x1058 . #x1059)
           (#x105E . #x1160)
-          (#x1171 . #x1074)
+          (#x1071 . #x1074)
           (#x1082 . #x1082)
           (#x1085 . #x1086)
           (#x108D . #x108D)
           (#x109D . #x109D)
+           (#x1160 . #x11FF)
           (#x135D . #x135F)
           (#x1712 . #x1714)
           (#x1732 . #x1734)
@@ -1081,6 +1082,7 @@ with L, LRE, or LRO Unicode bidi character type.")
           (#xABE5 . #xABE5)
           (#xABE8 . #xABE8)
           (#xABED . #xABED)
+           (#xD7B0 . #xD7FB)
           (#xFB1E . #xFB1E)
           (#xFE00 . #xFE0F)
           (#xFE20 . #xFE2F)
@@ -1217,10 +1219,11 @@ with L, LRE, or LRO Unicode bidi character type.")
           (#xFE30 . #xFE6F)
           (#xFF01 . #xFF60)
           (#xFFE0 . #xFFE6)
-          (#x16FE0 . #x16FE1)
-          (#x17000 . #x187F1)
+          (#x16FE0 . #x16FE3)
+          (#x17000 . #x187F7)
           (#x18800 . #x18AF2)
-          (#x1B000 . #x1B11E)
+          (#x1B000 . #x1B152)
+           (#x1B164 . #x1B167)
            (#x1B170 . #x1B2FB)
           (#x1F004 . #x1F004)
           (#x1F0CF . #x1F0CF)
@@ -1250,17 +1253,22 @@ with L, LRE, or LRO Unicode bidi character type.")
           (#x1F680 . #x1F6C5)
           (#x1F6CC . #x1F6CC)
           (#x1F6D0 . #x1F6D2)
+           (#x1F6D5 . #x1F6D5)
           (#x1F6EB . #x1F6EC)
-          (#x1F6F4 . #x1F6F9)
-          (#x1F910 . #x1F93E)
-          (#x1F940 . #x1F970)
+          (#x1F6F4 . #x1F6FA)
+           (#x1F7E0 . #x1F7EB)
+          (#x1F90D . #x1F971)
           (#x1F973 . #x1F976)
-          (#x1F97A . #x1F97A)
-          (#x1F97C . #x1F9A2)
-          (#x1F9B0 . #x1F9B9)
-          (#x1F9C0 . #x1F9C2)
-           (#x1F9D0 . #x1F9FF)
+          (#x1F97A . #x1F9A2)
+           (#x1F9A5 . #x1F9AA)
+           (#x1F9AE . #x1F9CA)
+           (#x1F9CD . #x1F9FF)
+           (#x1FA00 . #x1FA53)
            (#x1FA60 . #x1FA6D)
+           (#x1FA70 . #x1FA73)
+           (#x1FA78 . #x1FA7A)
+           (#x1FA80 . #x1FA82)
+           (#x1FA90 . #x1FA95)
           (#x20000 . #x2FFFF)
           (#x30000 . #x3FFFF))))
   (dolist (elt l)
@@ -1334,7 +1342,7 @@ Setup char-width-table appropriate for non-CJK language 
environment."
 
 
 ;; Setting char-script-table.
-(if purify-flag
+(if dump-mode
     ;; While dumping, we can't use require, and international is not
     ;; in load-path.
     (load "international/charscript")
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index 529262a..0413646 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -1,6 +1,6 @@
 ;;; fontset.el --- commands for handling fontset
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -222,6 +222,7 @@
         (hanifi-rohingya #x10D00)
         (old-sogdian #x10F00)
         (sogdian #x10F30)
+        (elymaic #x10fe0)
        (mahajani #x11150)
        (sinhala-archaic-number #x111E1)
        (khojki #x11200)
@@ -234,6 +235,7 @@
        (takri #x11680)
         (dogra #x11800)
        (warang-citi #x118A1)
+        (nandinagari #x119a0)
         (zanabazar-square #x11A00)
         (soyombo #x11A50)
        (pau-cin-hau #x11AC0)
@@ -257,15 +259,19 @@
        (ancient-greek-musical-notation #x1D200)
        (tai-xuan-jing-symbol #x1D300)
        (counting-rod-numeral #x1D360)
+        (nyiakeng-puachue-hmong #x1e100)
+        (wancho #x1e2c0)
        (mende-kikakui #x1E810)
         (adlam #x1E900)
+        (indic-siyaq-number #x1ec71)
+        (ottoman-siyaq-number #x1ed01)
        (mahjong-tile #x1F000)
        (domino-tile #x1F030)))
 
 (defvar otf-script-alist)
 
-;; The below was synchronized with the latest Jul 23, 2017 version of
-;; https://www.microsoft.com/typography/otspec/scripttags.htm.
+;; The below was synchronized with the latest Aug 16, 2018 version of
+;; https://docs.microsoft.com/en-us/typography/opentype/spec/scripttags
 (setq otf-script-alist
       '((adlm . adlam)
         (ahom . ahom)
@@ -300,6 +306,7 @@
        (dsrt . deseret)
        (deva . devanagari)
        (dev2 . devanagari)
+        (dogr . dogra)
         (dupl . duployan-shorthand)
        (egyp . egyptian)
         (elba . elbasan)
@@ -311,11 +318,13 @@
        (grek . greek)
        (gujr . gujarati)
        (gjr2 . gujarati)
+        (gong . gunjala-gondi)
        (guru . gurmukhi)
        (gur2 . gurmukhi)
        (hani . han)
        (hang . hangul)
        (jamo . hangul)
+        (rohg . hanifi-rohingya)
        (hano . hanunoo)
         (hatr . hatran)
        (hebr . hebrew)
@@ -324,9 +333,9 @@
        (prti . inscriptional-parthian)
        (java . javanese)
        (kthi . kaithi)
-       (kana . kana)   ; Hiragana
        (knda . kannada)
        (knd2 . kannada)
+       (kana . kana)   ; Hiragana
        (kali . kayah-li)
        (khar . kharoshthi)
        (khmr . khmer)
@@ -342,12 +351,15 @@
         (lyci . lycian)
         (lydi . lydian)
         (mahj . mahajani)
+        (maka . makasar)
         (marc . marchen)
        (mlym . malayalam)
        (mlm2 . malayalam)
        (mand . mandaic)
         (mani . manichaean)
+        (gonm . masaram-gondi)
        (math . mathematical)
+        (medf . medefaidrin)
        (mtei . meetei-mayek)
         (mend . mende-kikakui)
        (merc . meroitic)
@@ -363,12 +375,14 @@
         (nbat . nabataean)
         (newa . newa)
        (nko\  . nko)
+        (nshu . nushu)
        (ogam . ogham)
        (olck . ol-chiki)
        (ital . old_italic)
        (xpeo . old_persian)
         (narb . old-north-arabian)
         (perm . old-permic)
+        (sogo . old-sogdian)
        (sarb . old-south-arabian)
        (orkh . old-turkic)
        (orya . oriya)
@@ -392,7 +406,9 @@
         (sidd . siddham)
         (sgnw . sutton-sign-writing)
        (sinh . sinhala)
+        (sogd . sogdian)
        (sora . sora-sompeng)
+        (soyo . soyombo)
        (sund . sundanese)
        (sylo . syloti_nagri)
        (syrc . syriac)
@@ -416,7 +432,8 @@
        (ugar . ugaritic)
        (vai\  . vai)
         (wara . warang-citi)
-       (yi\ \   . yi)))
+       (yi\ \   . yi)
+        (zanb . zanabazar-square)))
 
 ;; Set standard fontname specification of characters in the default
 ;; fontset to find an appropriate font for each script/charset.  The
@@ -815,9 +832,16 @@
              (#x4DC0 . #x4DFF) ;; Yijing Hexagram Symbols
              (#xFE10 . #xFE1F) ;; Vertical Forms
              (#x10100 . #x1013F)       ;; Aegean Numbers
+             (#x10190 . #x101CF)       ;; Ancient Symbols
+             (#x101D0 . #x101FF)       ;; Phaistos Disc
              (#x102E0 . #x102FF)       ;; Coptic Epact Numbers
              (#x1D000 . #x1D0FF)       ;; Byzantine Musical Symbols
              (#x1D200 . #x1D24F)       ;; Ancient Greek Musical Notation
+             (#x1D2E0 . #x1D2FF)       ;; Mayan Numerals
+             (#x1D300 . #x1D35F)       ;; Tai Xuan Jing Symbols
+             (#x1D360 . #x1D37F)       ;; Counting Rod Numerals
+             (#x1F000 . #x1F02F)       ;; Mahjong Tiles
+             (#x1F030 . #x1F09F)       ;; Domino Tiles
              (#x1F0A0 . #x1F0FF)       ;; Playing Cards
              (#x1F100 . #x1F1FF)       ;; Enclosed Alphanumeric Suppl
              (#x1F300 . #x1F5FF)       ;; Misc Symbols and Pictographs
@@ -826,7 +850,9 @@
              (#x1F680 . #x1F6FF)       ;; Transport and Map Symbols
              (#x1F700 . #x1F77F)       ;; Alchemical Symbols
              (#x1F780 . #x1F7FF)       ;; Geometric Shapes Extended
-             (#x1F800 . #x1F8FF)))     ;; Supplemental Arrows-C
+             (#x1F800 . #x1F8FF)       ;; Supplemental Arrows-C
+             (#x1F900 . #x1F9FF)       ;; Supplemental Symbols and Pictographs
+             (#x1FA00 . #x1FA6F)))     ;; Chess Symbols
     (set-fontset-font "fontset-default" symbol-subgroup
                       '("Symbola" . "iso10646-1") nil 'prepend))
   ;; Box Drawing and Block Elements
diff --git a/lisp/international/isearch-x.el b/lisp/international/isearch-x.el
index 19a45c7..6c2a2dc 100644
--- a/lisp/international/isearch-x.el
+++ b/lisp/international/isearch-x.el
@@ -1,6 +1,6 @@
 ;;; isearch-x.el --- extended isearch handling commands
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/iso-ascii.el b/lisp/international/iso-ascii.el
index bcb285e..395e6c4 100644
--- a/lisp/international/iso-ascii.el
+++ b/lisp/international/iso-ascii.el
@@ -1,6 +1,6 @@
 ;;; iso-ascii.el --- set up char tables for ISO 8859/1 on ASCII terminals
 
-;; Copyright (C) 1987, 1995, 1998, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1987, 1995, 1998, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Howard Gayle
diff --git a/lisp/international/iso-cvt.el b/lisp/international/iso-cvt.el
index 452e2c2..7877c00 100644
--- a/lisp/international/iso-cvt.el
+++ b/lisp/international/iso-cvt.el
@@ -1,7 +1,7 @@
 ;;; iso-cvt.el --- translate ISO 8859-1 from/to various encodings -*- coding: 
utf-8 -*-
 ;; This file was formerly called gm-lingo.el.
 
-;; Copyright (C) 1993-1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Gschwind <address@hidden>
 ;; Keywords: tex, iso, latin, i18n
diff --git a/lisp/international/iso-transl.el b/lisp/international/iso-transl.el
index 0856b4f..b573e1e 100644
--- a/lisp/international/iso-transl.el
+++ b/lisp/international/iso-transl.el
@@ -1,6 +1,6 @@
 ;;; iso-transl.el --- keyboard input for ISO 10646 chars -*- coding: utf-8 -*-
 
-;; Copyright (C) 1987, 1993-1999, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1987, 1993-1999, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Howard Gayle
diff --git a/lisp/international/ja-dic-cnv.el b/lisp/international/ja-dic-cnv.el
index 60943f7..578cd63 100644
--- a/lisp/international/ja-dic-cnv.el
+++ b/lisp/international/ja-dic-cnv.el
@@ -1,6 +1,6 @@
 ;;; ja-dic-cnv.el --- convert a Japanese dictionary (SKK-JISYO.L) to Emacs Lisp
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
@@ -32,15 +32,15 @@
 ;; input method (e.g. quail-japanese) can utilize the dictionary.
 
 ;; The format of SKK dictionary is quite simple.  Each line has the
-;; form "KANASTRING /CONV1/CONV2/.../" which means KANASTRING ($B2>L>J8(B
-;; $B;zNs(B) can be converted to one of CONVi.  CONVi is a Kanji ($B4A;z(B)
-;; and Kana ($B2>L>(B) mixed string.
+;; form "KANASTRING /CONV1/CONV2/.../" which means KANASTRING (仮名文
+;; 字列) can be converted to one of CONVi.  CONVi is a Kanji (漢字)
+;; and Kana (仮名) mixed string.
 ;;
-;; KANASTRING may have a trailing ASCII letter for Okurigana ($BAw$j2>L>(B)
+;; KANASTRING may have a trailing ASCII letter for Okurigana (送り仮名)
 ;; information.  For instance, the trailing letter `k' means that one
-;; of the following Okurigana is allowed: $B$+$-$/$1$3(B.  So, in that
-;; case, the string "KANASTRING$B$/(B" can be converted to one of 
"CONV1$B$/(B",
-;; CONV2$B$/(B, ...
+;; of the following Okurigana is allowed: かきくけこ.  So, in that
+;; case, the string "KANASTRINGく" can be converted to one of "CONV1く",
+;; CONV2く, ...
 
 ;;; Code:
 
@@ -76,25 +76,25 @@
 (defconst skkdic-postfix-list '(skkdic-postfix-list))
 
 (defconst skkdic-postfix-data
-  '(("$B$$$-(B" "$B9T(B")
-    ("$B$,$+$j(B" "$B78(B")
-    ("$B$,$/(B" "$B3X(B")
-    ("$B$,$o(B" "address@hidden(B")
-    ("$B$7$c(B" "$B<R(B")
-    ("$B$7$e$&(B" "$B=8(B")
-    ("$B$7$g$&(B" "$B>^(B" "$B>k(B")
-    ("$B$8$g$&(B" "$B>k(B")
-    ("$B$;$s(B" "address@hidden(B")
-    ("address@hidden(B" "$B3Y(B")
-    ("$B$A$c$/(B" "$BCe(B")
-    ("$B$F$s(B" "$BE9(B")
-    ("$B$H$&$2(B" "$BF=(B")
-    ("$B$I$*$j(B" "$BDL$j(B")
-    ("$B$d$^(B" "$B;3(B")
-    ("$B$P$7(B" "$B66(B")
-    ("$B$O$D(B" "$BH/(B")
-    ("$B$b$/(B" "$BL\(B")
-    ("$B$f$-(B" "$B9T(B")))
+  '(("いき" "行")
+    ("がかり" "係")
+    ("がく" "学")
+    ("がわ" "川")
+    ("しゃ" "社")
+    ("しゅう" "集")
+    ("しょう" "賞" "城")
+    ("じょう" "城")
+    ("せん" "線")
+    ("だけ" "岳")
+    ("ちゃく" "着")
+    ("てん" "店")
+    ("とうげ" "峠")
+    ("どおり" "通り")
+    ("やま" "山")
+    ("ばし" "橋")
+    ("はつ" "発")
+    ("もく" "目")
+    ("ゆき" "行")))
 
 (defun skkdic-convert-postfix (skkbuf buf)
   (message "Processing POSTFIX entries ...")
@@ -124,7 +124,7 @@
        (setq l (cdr l)))))
 
   ;; Search postfix entries.
-  (while (re-search-forward "^[#<>?]\\(\\(\\cH\\|$B!<(B\\)+\\) " nil t)
+  (while (re-search-forward "^[#<>?]\\(\\(\\cH\\|ー\\)+\\) " nil t)
     (let ((kana (match-string-no-properties 1))
          str candidates)
       (while (looking-at "/[#0-9 ]*\\([^/\n]*\\)/")
@@ -157,7 +157,7 @@
     (insert ";; Setting prefix entries.\n"
            "(skkdic-set-prefix\n"))
   (save-excursion
-    (while (re-search-forward "^\\(\\(\\cH\\|$B!<(B\\)+\\)[<>?] " nil t)
+    (while (re-search-forward "^\\(\\(\\cH\\|ー\\)+\\)[<>?] " nil t)
       (let ((kana (match-string-no-properties 1))
            str candidates)
        (while (looking-at "/\\([^/\n]+\\)/")
@@ -275,7 +275,7 @@
     (let ((progress (make-progress-reporter "Collecting OKURI-NASI entries"
                                             (point) (point-max)
                                             nil 10)))
-      (while (re-search-forward "^\\(\\(\\cH\\|$B!<(B\\)+\\) \\(/\\cj.*\\)/$"
+      (while (re-search-forward "^\\(\\(\\cH\\|ー\\)+\\) \\(/\\cj.*\\)/$"
                                nil t)
         (let ((kana (match-string-no-properties 1))
              (candidates (skkdic-get-candidate-list (match-beginning 3)
@@ -452,7 +452,7 @@ To get complete usage, invoke:
       (aset vec i
            (if (< ch 128)              ; CH is an ASCII letter for OKURIGANA,
                (- ch)                  ;  represented by a negative code.
-             (if (= ch ?$B!<(B)              ; `$B!<(B' is represented by 
0.
+             (if (= ch ?ー)             ; `ー' is represented by 0.
                  0
                (- (logand (encode-char ch 'japanese-jisx0208) #xFF) 32))))
       (setq i (1+ i)))
@@ -541,9 +541,4 @@ To get complete usage, invoke:
         map)))
 
 (provide 'ja-dic-cnv)
-
-;; Local Variables:
-;; coding: iso-2022-7bit
-;; End:
-
 ;;; ja-dic-cnv.el ends here
diff --git a/lisp/international/ja-dic-utl.el b/lisp/international/ja-dic-utl.el
index 86ba374..498fb23 100644
--- a/lisp/international/ja-dic-utl.el
+++ b/lisp/international/ja-dic-utl.el
@@ -53,23 +53,23 @@
   "Nested alist for OKURI-NASI entries of SKK dictionary.")
 
 (defconst skkdic-okurigana-table
-  '((?$B$!(B . ?a) (?$B$"(B . ?a) (?$B$#(B . ?i) (?$B$$(B . ?i) 
(?$B$%(B . ?u)
-    (?$B$&(B . ?u) (?$B$'(B . ?e) (?$B$((B . ?e) (?$B$)(B . ?o) 
(?$B$*(B . ?o)
-    (?$B$+(B . ?k) (?$B$,(B . ?g) (?$B$-(B . ?k) (?$B$.(B . ?g) 
(?$B$/(B . ?k)
-    (?$B$0(B . ?g) (?$B$1(B . ?k) (?$B$2(B . ?g) (?$B$3(B . ?k) 
(?$B$4(B . ?g)
-    (?$B$5(B . ?s) (?$B$6(B . ?z) (?$B$7(B . ?s) (?$B$8(B . ?j) 
(?$B$9(B . ?s)
-    (?$B$:(B . ?z) (?$B$;(B . ?s) (?$B$<(B . ?z) (?$B$=(B . ?s) 
(?$B$>(B . ?z)
-    (?$B$?(B . ?t) (address@hidden(B . ?d) (?$B$A(B . ?t) (?$B$B(B . ?d) 
(?$B$C(B . ?t)
-    (?$B$D(B . ?t) (?$B$E(B . ?d) (?$B$F(B . ?t) (?$B$G(B . ?d) 
(?$B$H(B . ?t) (?$B$I(B . ?d)
-    (?$B$J(B . ?n) (?$B$K(B . ?n) (?$B$L(B . ?n) (?$B$M(B . ?n) 
(?$B$N(B . ?n)
-    (?$B$O(B . ?h) (?$B$P(B . ?b) (?$B$Q(B . ?p) (?$B$R(B . ?h) 
(?$B$S(B . ?b)
-    (?$B$T(B . ?p) (?$B$U(B . ?h) (?$B$V(B . ?b) (?$B$W(B . ?p) 
(?$B$X(B . ?h)
-    (?$B$Y(B . ?b) (?$B$Z(B . ?p) (?$B$[(B . ?h) (?$B$\(B . ?b) 
(?$B$](B . ?p)
-    (?$B$^(B . ?m) (?$B$_(B . ?m) (?$B$`(B . ?m) (?$B$a(B . ?m) 
(?$B$b(B . ?m)
-    (?$B$c(B . ?y) (?$B$d(B . ?y) (?$B$e(B . ?y) (?$B$f(B . ?y) 
(?$B$g(B . ?y) (?$B$h(B . ?y)
-    (?$B$i(B . ?r) (?$B$j(B . ?r) (?$B$k(B . ?r) (?$B$l(B . ?r) 
(?$B$m(B . ?r)
-    (?$B$o(B . ?w) (?$B$p(B . ?w) (?$B$q(B . ?w) (?$B$r(B . ?w)
-    (?$B$s(B . ?n)
+  '((?ぁ . ?a) (?あ . ?a) (?ぃ . ?i) (?い . ?i) (?ぅ . ?u)
+    (?う . ?u) (?ぇ . ?e) (?え . ?e) (?ぉ . ?o) (?お . ?o)
+    (?か . ?k) (?が . ?g) (?き . ?k) (?ぎ . ?g) (?く . ?k)
+    (?ぐ . ?g) (?け . ?k) (?げ . ?g) (?こ . ?k) (?ご . ?g)
+    (?さ . ?s) (?ざ . ?z) (?し . ?s) (?じ . ?j) (?す . ?s)
+    (?ず . ?z) (?せ . ?s) (?ぜ . ?z) (?そ . ?s) (?ぞ . ?z)
+    (?た . ?t) (?だ . ?d) (?ち . ?t) (?ぢ . ?d) (?っ . ?t)
+    (?つ . ?t) (?づ . ?d) (?て . ?t) (?で . ?d) (?と . ?t) (?ど . ?d)
+    (?な . ?n) (?に . ?n) (?ぬ . ?n) (?ね . ?n) (?の . ?n)
+    (?は . ?h) (?ば . ?b) (?ぱ . ?p) (?ひ . ?h) (?び . ?b)
+    (?ぴ . ?p) (?ふ . ?h) (?ぶ . ?b) (?ぷ . ?p) (?へ . ?h)
+    (?べ . ?b) (?ぺ . ?p) (?ほ . ?h) (?ぼ . ?b) (?ぽ . ?p)
+    (?ま . ?m) (?み . ?m) (?む . ?m) (?め . ?m) (?も . ?m)
+    (?ゃ . ?y) (?や . ?y) (?ゅ . ?y) (?ゆ . ?y) (?ょ . ?y) (?よ . ?y)
+    (?ら . ?r) (?り . ?r) (?る . ?r) (?れ . ?r) (?ろ . ?r)
+    (?わ . ?w) (?ゐ . ?w) (?ゑ . ?w) (?を . ?w)
+    (?ん . ?n)
     )
   "Alist of Okuriganas vs trailing ASCII letters in OKURI-ARI entry.")
 
@@ -125,14 +125,14 @@ LEIM is available from the same ftp directory as 
Emacs.")))
     ;; At first, generate vector VEC from SEQ for looking up SKK
     ;; alists.  Nth element in VEC corresponds to Nth element in SEQ.
     ;; The values are decided as follows.
-    ;;   If SEQ[N] is `$B!<(B', VEC[N] is 0,
+    ;;   If SEQ[N] is `ー', VEC[N] is 0,
     ;;   else if SEQ[N] is a Hiragana character, VEC[N] is:
     ;;     ((The 2nd position code of SEQ[N]) - 32),
     ;;   else VEC[N] is 128.
     (while (< i len)
       (let ((ch (aref seq i))
            code)
-       (cond ((= ch ?$B!<(B)
+       (cond ((= ch ?ー)
               (aset vec i 0))
              ((and (>= ch (car skkdic-jisx0208-hiragana-block))
                    (<= ch (cdr skkdic-jisx0208-hiragana-block)))
@@ -218,9 +218,4 @@ LEIM is available from the same ftp directory as Emacs.")))
 
 ;;
 (provide 'ja-dic-utl)
-
-;; Local Variables:
-;; coding: iso-2022-7bit
-;; End:
-
 ;;; ja-dic-utl.el ends here
diff --git a/lisp/international/kinsoku.el b/lisp/international/kinsoku.el
index ac660dd..690a80e 100644
--- a/lisp/international/kinsoku.el
+++ b/lisp/international/kinsoku.el
@@ -1,6 +1,6 @@
-;;; kinsoku.el --- `Kinsoku' processing funcs -*- coding: iso-2022-7bit; -*-
+;;; kinsoku.el --- `Kinsoku' processing funcs
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -62,19 +62,19 @@ The value 0 means there's no limitation.")
                   idx (1+ idx)))
           str2)
         ;; Katakana JISX0201
-        "(I!#'()*+,-./0^_(B"
+        "。」ァィゥェォャュョッー゙゚"
         ;; Japanese JISX0208
-        "$B!"!#!$!%!&!'!(!)!*!+!,!-!.!/!0!1!2!3!4!5!6!7!8!9!:!;!<!=!>(B\
address@hidden(B\
-$B$!$#$%$'$)$C$c$e$g$n%!%#%%%'%)%C%c%e%g%n%u%v(B"
+        "、。,.・:;?!゛゜´`¨^ ̄_ヽヾゝゞ〃仝々〆〇ー—‐\
+/\〜‖|…‥’”)〕]}〉》」』】°′″℃\
+ぁぃぅぇぉっゃゅょゎァィゥェォッャュョヮヵヶ"
         ;; Chinese GB2312
-        "$A!"!##.#,!$!%!&!'!(!)!*!+!,!-!/!1#)!3!5!7!9!;!=(B\
-$A!?#;#:address@hidden/#\#"#_#~#|(e(B"
+        "、。.,・ˉˇ¨〃々―~‖…’”)〕〉》」』〗\
+】;:?!±×÷∶°′″℃/\"_ ̄|ㄥ"
         ;; Chinese BIG5
-        "$(0!"!#!$!%!&!'!(!)!*!+!,!-!.!/!0!1!2(B\
-$(0!3!4!5!6!7!8!9!:!;!<!=!?!A!C!E!G!I!K(B\
-$(0!M!O!Q!S!U!W!Y![!]!_!a!c!e!g!i!k!q(B\
-$(0"#"$"%"&"'"(")"*"+","2"3"4"j"k"l"x%7(B"))
+        ",、。.‧;:?!︰…‥﹐﹑﹒·﹔\
+﹕﹖﹗|–︱—︳╴︴﹏)︶}︸〕︺】\
+︼》︾〉﹀」﹂』﹄﹚﹜﹞’”〞′〃\
+¯ ̄_ˍ﹉﹊﹍﹎﹋﹌×÷±℃℉﹩°ㄥ"))
        (len (length kinsoku-bol))
        (idx 0)
        ch)
@@ -102,16 +102,16 @@ The value 0 means there's no limitation.")
                   idx (1+ idx)))
           str2)
         ;; JISX0201 Katakana
-        "(I"(B"
+        "「"
         ;; Japanese JISX0208
-        "$B!F!H!J!L!N!P!R!T!V!X!Z!k!l!m!n!w!x(B"
+        "‘“(〔[{〈《「『【°′″℃@§"
         ;; Chinese GB2312
-         "$A!.!0#"#(!2!4!6!8!:!<!>address@hidden(B\
-$A(E(F(G(H(I(J(K(L(M(N(O(P(Q(R(S(T(U(V(W(X(Y(h(B\
-\$(0!>address@hidden(B"
+         "‘“"(〔〈《「『〖【°′″@℃§\
+ㄅㄆㄇㄈㄉㄊㄋㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄨ\
+\(︵{︷〔︹【︻《︽〈︿「﹁『﹃﹙﹛﹝"
         ;; Chinese BIG5
-        "$(0!d!f!h!j!k!q!p"i"j"k"n"x$u$v$w$x$y$z${(B\
-$(0$|$}$~%!%"%#%$%%%&%'%(%)%*%+%:(B"))
+        "‘“〝‵′〃§@℃℉﹫°ㄅㄆㄇㄈㄉㄊㄋ\
+ㄌㄍㄎㄏㄐㄑㄒㄓㄔㄕㄖㄗㄘㄙㄨ"))
        (len (length kinsoku-eol))
        (idx 0)
        ch)
diff --git a/lisp/international/kkc.el b/lisp/international/kkc.el
index a56d3cb..6691ee9 100644
--- a/lisp/international/kkc.el
+++ b/lisp/international/kkc.el
@@ -1,6 +1,6 @@
-;;; kkc.el --- Kana Kanji converter    -*- coding: iso-2022-7bit; -*-
+;;; kkc.el --- Kana Kanji converter
 
-;; Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -36,7 +36,7 @@
 
 (require 'ja-dic-utl)
 
-(defvar kkc-input-method-title "$B4A(B"
+(defvar kkc-input-method-title "漢"
   "String denoting KKC input method.
 This string is shown at mode line when users are in KKC mode.")
 
diff --git a/lisp/international/latexenc.el b/lisp/international/latexenc.el
index 9afcd6d..83acce6 100644
--- a/lisp/international/latexenc.el
+++ b/lisp/international/latexenc.el
@@ -1,6 +1,6 @@
 ;;; latexenc.el --- guess correct coding system in LaTeX files -*-coding: 
utf-8 -*-
 
-;; Copyright (C) 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Arne Jørgensen <address@hidden>
 ;; Keywords: mule, coding system, latex
diff --git a/lisp/international/latin1-disp.el 
b/lisp/international/latin1-disp.el
index df2c1dc..1b7bc49 100644
--- a/lisp/international/latin1-disp.el
+++ b/lisp/international/latin1-disp.el
@@ -1,6 +1,6 @@
 ;;; latin1-disp.el --- display tables for other ISO 8859 on Latin-1 terminals 
-*-coding: utf-8;-*-
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;; Keywords: i18n
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index b755ae0..dfa9e4e 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -1,6 +1,6 @@
 ;;; mule-cmds.el --- commands for multilingual environment  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -1330,7 +1330,7 @@ This is the input method activated automatically by the 
command
 `toggle-input-method' (\\[toggle-input-method])."
   :link  '(custom-manual "(emacs)Input Methods")
   :group 'mule
-  :type `(choice (const nil)
+  :type '(choice (const nil)
                  mule-input-method-string)
   :set-after '(current-language-environment))
 
@@ -1943,7 +1943,7 @@ See `set-language-info-alist' for use in programs."
             (set-language-info-alist (car elt) (cdr elt)))
           ;; re-set the environment in case its parameters changed
           (set-language-environment current-language-environment)))
-  :type `(alist
+  :type '(alist
          :key-type (string :tag "Language environment"
                            :completions
                             (lambda (string pred action)
@@ -2181,22 +2181,27 @@ See `set-language-info-alist' for use in programs."
 (defconst locale-language-names
   (purecopy
    '(
-    ;; Locale names of the form address@hidden
-    ;; as specified in the Single Unix Spec, Version 2.
-    ;; LANGUAGE is a language code taken from ISO 639:1988 (E/F)
-    ;; with additions from ISO 639/RA Newsletter No.1/1989;
-    ;; see Internet RFC 2165 (1997-06) and
-    ;; http://www.evertype.com/standards/iso639/iso639-en.html
-    ;; TERRITORY is a country code taken from ISO 3166
-    ;; http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/en_listp1.html.
-    ;; CODESET and MODIFIER are implementation-dependent.
+     ;; Locale names of the form address@hidden
+     ;; as specified in the Single Unix Spec, Version 2.
+     ;; LANGUAGE is a language code taken from ISO 639:1988 (E/F)
+     ;; with additions from ISO 639/RA Newsletter No.1/1989;
+     ;; see Internet RFC 2165 (1997-06) and
+     ;; http://www.evertype.com/standards/iso639/iso639-en.html
+     ;; TERRITORY is a country code taken from ISO 3166
+     ;; http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/en_listp1.html.
+     ;; CODESET and MODIFIER are implementation-dependent.
+
+     ;; Language names for which there are no locales (yet) are
+     ;; commented out.
 
      ;; jasonr comments: MS Windows uses three letter codes for
      ;; languages instead of the two letter ISO codes that POSIX
-     ;; uses. In most cases the first two letters are the same, so
-     ;; most of the regexps in locale-language-names work. Japanese
-     ;; and Chinese are exceptions, which are listed in the
-     ;; non-standard section at the bottom of locale-language-names.
+     ;; uses.  In most cases the first two letters are the same, so
+     ;; most of the regexps in locale-language-names work.  Japanese,
+     ;; Chinese, and some others are exceptions, which are listed in the
+     ;; non-standard section at the bottom of locale-language-names, or
+     ;; in the main section, if otherwise we would pick up the wrong
+     ;; entry (because the first matching entry is used).
 
     ("aa_DJ" . "Latin-1") ; Afar
     ("aa" . "UTF-8")
@@ -2204,11 +2209,12 @@ See `set-language-info-alist' for use in programs."
     ("af" . "Latin-1") ; Afrikaans
     ("am" "Ethiopic" utf-8) ; Amharic
     ("an" . "Latin-9") ; Aragonese
+    ("arn" . "UTF-8") ; MS-Windows Mapudungun, Mapuche
     ("ar" . "Arabic")
-    ; as Assamese
+    ("as" . "UTF-8") ; Assamese
     ; ay Aymara
     ("az" . "UTF-8") ; Azerbaijani
-    ; ba Bashkir
+    ("ba" . "UTF-8") ; Bashkir, Cyrillic script
     ("be" "Belarusian" cp1251) ; Belarusian [Byelorussian until early 1990s]
     ("bg" "Bulgarian" cp1251) ; Bulgarian
     ; bh Bihari
@@ -2219,12 +2225,12 @@ See `set-language-info-alist' for use in programs."
     ("bs" . "Latin-2") ; Bosnian
     ("byn" . "UTF-8")  ; Bilin; Blin
     ("ca" "Catalan" iso-8859-1) ; Catalan
-    ; co Corsican
+    ("co" . "UTF-8") ; Corsican
     ("cs" "Czech" iso-8859-2)
     ("cy" "Welsh" iso-8859-14)
     ("da" . "Latin-1") ; Danish
     ("de" "German" iso-8859-1)
-    ; dv Divehi
+    ("dv" . "UTF-8") ; Divehi
     ; dz Bhutani
     ("ee" . "Latin-4") ; Ewe
     ("el" "Greek" iso-8859-7)
@@ -2238,6 +2244,8 @@ See `set-language-info-alist' for use in programs."
     ("et" . "Latin-9") ; Estonian
     ("eu" . "Latin-1") ; Basque
     ("fa" "Persian" utf-8) ; Persian
+    ("fil" . "UTF-8") ; Filipino
+    ("fpo" . "UTF-8") ; MS-Windows Filipino
     ("fi" . "Latin-9") ; Finnish
     ("fj" . "Latin-1") ; Fiji
     ("fo" . "Latin-1") ; Faroese
@@ -2246,6 +2254,7 @@ See `set-language-info-alist' for use in programs."
     ("ga" . "Latin-1") ; Irish Gaelic (new orthography)
     ("gd" . "Latin-9") ; Scots Gaelic
     ("gez" "Ethiopic" utf-8) ; Geez
+    ("gla" . "Latin-9") ; MS-Windows Scots Gaelic
     ("gl" . "Latin-1") ; Gallegan; Galician
     ; gn Guarani
     ("gu" "Gujarati" utf-8) ; Gujarati
@@ -2256,27 +2265,33 @@ See `set-language-info-alist' for use in programs."
     ("hni_IN" . "UTF-8") ; Chhattisgarhi
     ("hr" "Croatian" iso-8859-2) ; Croatian
     ("hu" . "Latin-2") ; Hungarian
-    ; hy Armenian
+    ("hy" . "UTF-8") ;  Armenian
     ; ia Interlingua
     ("id" . "Latin-1") ; Indonesian
     ; ie Interlingue
-    ; ik Inupiak
+    ("ig" . "UTF-8") ; Igbo (Nigeria)
+    ("ibo" . "UTF-8") ; MS-Windows Igbo
+    ; ik Inupiak, Inupiaq
     ("is" . "Latin-1") ; Icelandic
     ("it" "Italian" iso-8859-1) ; Italian
     ; iu Inuktitut
     ("iw" "Hebrew" iso-8859-8)
     ("ja" "Japanese" euc-jp)
     ; jw Javanese
+    ("kal" . "Latin-1") ; MS-Windows Greenlandic
     ("ka" "Georgian" georgian-ps) ; Georgian
-    ; kk Kazakh
+    ("kk" . "UTF-8") ; Kazakh
     ("kl" . "Latin-1") ; Greenlandic
     ("km" "Khmer" utf-8) ; Cambodian, Khmer
+    ("knk" "Devanagari" utf-8) ; MS-Windows Konkani
+    ("kok" "Devanagari" utf-8) ; Konkani
     ("kn" "Kannada" utf-8)
     ("ko" "Korean" euc-kr)
     ("ks" . "UTF-8") ; Kashmiri
     ; ku Kurdish
     ("kw" . "Latin-1") ; Cornish
     ("ky" . "UTF-8") ; Kirghiz
+    ("lao" "Lao" utf-8) ; MS-Windows Lao
     ("la" . "Latin-1") ; Latin
     ("lb" . "Latin-1") ; Luxemburgish
     ("lg" . "Latin-6") ; Ganda, a.k.a. Luganda
@@ -2287,18 +2302,22 @@ See `set-language-info-alist' for use in programs."
     ; mg Malagasy
     ("mi" . "Latin-7") ; Maori
     ("mk" "Cyrillic-ISO" iso-8859-5) ; Macedonian
+    ("mlt" . "Latin-3") ; MS-Windows Maltese
     ("ml" "Malayalam" utf-8)
     ("mn" . "UTF-8") ; Mongolian
-    ; mo Moldavian
+    ; mo Moldavian (retired)
+    ("mri" . "Latin-7") ; MS-Windows Maori
     ("mr" "Devanagari" utf-8) ; Marathi
     ("ms" . "Latin-1") ; Malay
     ("mt" . "Latin-3") ; Maltese
+    ("mym" "Malayalam" utf-8) ; MS-Windows Malayalam
     ("my" "Burmese" utf-8) ; Burmese
     ; na Nauru
     ("nb" . "Latin-1") ; Norwegian
     ("ne" "Devanagari" utf-8) ; Nepali
     ("nl" "Dutch" iso-8859-1)
     ("nn" . "Latin-1") ; Norwegian Nynorsk
+    ("non" . "Latin-1") ; MS-Windows Norwegian Nynorsk
     ("no" . "Latin-1") ; Norwegian
     ("nr_ZA" . "UTF-8") ; South Ndebele
     ("nso_ZA" . "UTF-8") ; Pedi
@@ -2308,7 +2327,8 @@ See `set-language-info-alist' for use in programs."
     ("or" "Oriya" utf-8)
     ("pa" "Punjabi" utf-8) ; Punjabi
     ("pl" "Polish" iso-8859-2) ; Polish
-    ; ps Pashto, Pushto
+    ("ps" . "UTF-8") ; Pashto, Pushto
+    ("pas" . "UTF-8") ; MS-Windows Pashto
     ("pt_BR" "Brazilian Portuguese" iso-8859-1) ; Brazilian Portuguese
     ("pt" . "Latin-1") ; Portuguese
     ; qu Quechua
@@ -2318,7 +2338,7 @@ See `set-language-info-alist' for use in programs."
     ("ru_RU.koi8r" "Cyrillic-KOI8" koi8-r)
     ("ru_RU" "Russian" iso-8859-5)
     ("ru_UA" "Russian" koi8-u)
-    ; rw Kinyarwanda
+    ("rw" . "UTF-8") ; Kinyarwanda
     ("sa" . "Devanagari") ; Sanskrit
     ; sd Sindhi
     ("se" . "UTF-8") ; Northern Sami
@@ -2339,6 +2359,7 @@ See `set-language-info-alist' for use in programs."
     ; su Sundanese
     ("sv" "Swedish" iso-8859-1)                ; Swedish
     ("sw" . "Latin-1") ; Swahili
+    ("taj" "Tajik" koi8-t) ; MS-Windows Tajik w/Cyrillic script
     ("ta" "Tamil" utf-8)
     ("te" "Telugu" utf-8) ; Telugu
     ("tg" "Tajik" koi8-t)
@@ -2348,15 +2369,17 @@ See `set-language-info-alist' for use in programs."
     ("th" "Thai" iso-8859-11)
     ("ti" "Ethiopic" utf-8) ; Tigrinya
     ("tig_ER" . "UTF-8") ; Tigre
-    ; tk Turkmen
+    ("tk" . "Latin-5") ; Turkmen
+    ("tuk" . "Latin-5") ; MS-Windows Turkmen
     ("tl" . "Latin-1") ; Tagalog
     ("tn" . "Latin-9") ; Setswana, Tswana
     ; to Tonga
     ("tr" "Turkish" iso-8859-9)
+    ("tsn" . "Latin-9") ; MS-Windows Tswana
     ("ts" . "Latin-1") ; Tsonga
     ("tt" . "UTF-8") ; Tatar
     ; tw Twi
-    ; ug Uighur
+    ("ug" . "UTF-8") ; Uighur
     ("uk" "Ukrainian" koi8-u)
     ("ur" . "UTF-8") ; Urdu
     ("address@hidden" . "UTF-8"); Uzbek
@@ -2365,10 +2388,10 @@ See `set-language-info-alist' for use in programs."
     ("vi" "Vietnamese" utf-8)
     ; vo Volapuk
     ("wa" . "Latin-1") ; Walloon
-    ; wo Wolof
+    ("wo" . "UTF-8") ; Wolof
     ("xh" . "Latin-1") ; Xhosa
     ("yi" . "Windows-1255") ; Yiddish
-    ; yo Yoruba
+    ("yo" . "UTF-8") ; Yoruba
     ; za Zhuang
     ("zh_HK" . "Chinese-Big5")
     ; zh_HK/BIG5-HKSCS \
@@ -2378,6 +2401,9 @@ See `set-language-info-alist' for use in programs."
     ("zh_CN.GB18030" "Chinese-GB18030")
     ("zh_CN.UTF-8" . "Chinese-GBK")
     ("zh_CN" . "Chinese-GB")
+    ("zhh" . "Chinese-Big5") ; MS-Windows Chinese (Hong Kong S.A.R.)
+    ("zhi" . "Chinese-GBK") ; MS-Windows Chinese (Singapore)
+    ("zhm" . "Chinese-Big5") ; MS-Windows Chinese (Macao S.A.R.)
     ("zh" . "Chinese-GB")
     ("zu" . "Latin-1") ; Zulu
 
@@ -2395,12 +2421,23 @@ See `set-language-info-alist' for use in programs."
     ("sp" . "Cyrillic-ISO") ; Serbian (Cyrillic alphabet), e.g. X11R6.4
     ("su" . "Latin-1") ; Finnish, e.g. Solaris 2.6
     ("jp" . "Japanese") ; e.g. MS Windows
-    ("chs" . "Chinese-GBK") ; MS Windows Chinese Simplified
-    ("cht" . "Chinese-BIG5") ; MS Windows Chinese Traditional
+    ("chs" . "Chinese-GBK") ; MS Windows Chinese Simplified (PRC)
+    ("cht" . "Chinese-BIG5") ; MS Windows Chinese Traditional (Taiwan)
     ("gbz" . "UTF-8") ; MS Windows Dari Persian
     ("div" . "UTF-8") ; MS Windows Divehi (Maldives)
     ("wee" . "Latin-2") ; MS Windows Lower Sorbian
     ("wen" . "Latin-2") ; MS Windows Upper Sorbian
+    ("ind" . "Latin-1") ; MS-Windows Indonesian
+    ("sme" . "UTF-8") ; MS-Windows Northern Sami (Norway)
+    ("smf" . "UTF-8") ; MS-Windows Northern Sami (Sweden)
+    ("smg" . "UTF-8") ; MS-Windows Northern Sami (Finland)
+    ("kdi" "Kannada" utf-8) ; MS-Windows Kannada
+    ("mar" "Devanagari" utf-8) ; MS-Windows Marathi
+    ("khm" "Khmer" utf-8) ; MS-Windows Khmer
+    ("iri" . "Latin-1") ; MS-Windows Irish Gaelic
+    ; mwk  MS-Windows Mohawk (Canada)
+    ("uig" . "UTF-8") ; MS-Windows Uighur
+    ("kin" . "UTF-8") ;  MS-Windows Kinyarwanda
     ))
   "Alist of locale regexps vs the corresponding languages and coding systems.
 Each element has this form:
@@ -2702,10 +2739,20 @@ See also `locale-charset-language-names', 
`locale-language-names',
              (output-coding
               (if noninteractive
                   (intern (format "cp%d" (w32-get-console-output-codepage)))
-                code-page-coding)))
-       (when (coding-system-p code-page-coding)
+                code-page-coding))
+             (multibyte-code-page-coding
+              (or (and (boundp 'w32-multibyte-code-page)
+                       (not (zerop w32-multibyte-code-page))
+                       (intern (format "cp%d" w32-multibyte-code-page)))
+                  code-page-coding))
+             (locale-coding
+              (if noninteractive
+                  code-page-coding
+                multibyte-code-page-coding)))
+       (when (and (coding-system-p code-page-coding)
+                   (coding-system-p locale-coding))
           (or output-coding (setq output-coding code-page-coding))
-         (unless frame (setq locale-coding-system code-page-coding))
+         (unless frame (setq locale-coding-system locale-coding))
          (set-keyboard-coding-system code-page-coding frame)
          (set-terminal-coding-system output-coding frame)
          (setq default-file-name-coding-system ansi-code-page-coding))))
@@ -2727,7 +2774,6 @@ See also `locale-charset-language-names', 
`locale-language-names',
       (let ((paper (locale-info 'paper))
             locale)
        (if paper
-           ;; This will always be null at the time of writing.
            (cond
             ((equal paper '(216 279))
              (setq ps-paper-type 'letter))
@@ -2930,12 +2976,13 @@ on encoding."
                (#x14400 . #x14646)
               ;; (#x14647 . #x167FF) unused
               (#x16800 . #x16F9F)
-               (#x16FE0 . #x16FE0)
+               (#x16FE0 . #x16FE3)
                ;; (#x17000 . #x187FF) Tangut Ideographs
                ;; (#x18800 . #x18AFF) Tangut Components
               ;; (#x18B00 . #x1AFFF) unused
-              (#x1B000 . #x1B12F)
-               ;; (#x1B130 . #x1B16F) unused
+              (#x1B000 . #x1B11F)
+               ;; (#x1B120 . #x1B14F) unused
+               (#x1B150 . #x1B16F)
                (#x1B170 . #x1B2FF)
               ;; (#x1B300 . #x1BBFF) unused
                (#x1BC00 . #x1BCAF)
diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el
index b08150a..c84dc81 100644
--- a/lisp/international/mule-conf.el
+++ b/lisp/international/mule-conf.el
@@ -1,6 +1,6 @@
 ;;; mule-conf.el --- configure multilingual environment
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 
2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
@@ -1066,6 +1066,15 @@
   :mime-charset 'ebcdic-uk
   :map "EBCDICUK")
 
+(define-charset 'ibm038
+  "International version of EBCDIC"
+  :short-name "IBM038"
+  :code-space [0 255]
+  :mime-charset 'ibm038
+  :map "IBM038")
+(define-charset-alias 'ebcdic-int 'ibm038)
+(define-charset-alias 'cp038 'ibm038)
+
 (define-charset 'ibm1047
   ;; Says groff:
   "IBM1047, `EBCDIC Latin 1/Open Systems' used by OS/390 Unix."
diff --git a/lisp/international/mule-diag.el b/lisp/international/mule-diag.el
index c9829e3..472529f 100644
--- a/lisp/international/mule-diag.el
+++ b/lisp/international/mule-diag.el
@@ -1,6 +1,6 @@
 ;;; mule-diag.el --- show diagnosis of multilingual environment (Mule)
 
-;; Copyright (C) 1997-1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/mule-util.el b/lisp/international/mule-util.el
index cf2b29c..8ad2127 100644
--- a/lisp/international/mule-util.el
+++ b/lisp/international/mule-util.el
@@ -1,6 +1,6 @@
 ;;; mule-util.el --- utility functions for multilingual environment (mule)  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 1997-1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -393,17 +393,17 @@ QUALITY can be:
                                        japanese-cp932 korean-cp949)))
          (setq type 'single-byte))
     (pcase type
-      (`utf-8
+      ('utf-8
        (when (coding-system-get coding-system :bom)
          (setq byte (max 0 (- byte 3))))
        (if (= eol 1)
            (filepos-to-bufferpos--dos (+ pm byte) #'byte-to-position)
          (byte-to-position (+ pm byte))))
-      (`single-byte
+      ('single-byte
        (if (= eol 1)
            (filepos-to-bufferpos--dos (+ pm byte) #'identity)
          (+ pm byte)))
-      ((and `utf-16
+      ((and 'utf-16
             ;; FIXME: For utf-16, we could use the same approach as used for
             ;; dos EOLs (counting the number of non-BMP chars instead of the
             ;; number of lines).
@@ -419,8 +419,8 @@ QUALITY can be:
          (+ pm byte)))
       (_
        (pcase quality
-         (`approximate (byte-to-position (+ pm byte)))
-         (`exact
+         ('approximate (byte-to-position (+ pm byte)))
+         ('exact
           ;; Rather than assume that the file exists and still holds the right
           ;; data, we reconstruct it based on the buffer's content.
           (let ((buf (current-buffer)))
@@ -470,7 +470,7 @@ QUALITY can be:
                                        japanese-cp932 korean-cp949)))
          (setq type 'single-byte))
     (pcase type
-      (`utf-8
+      ('utf-8
        (setq byte (position-bytes position))
        (when (null byte)
          (if (<= position 0)
@@ -482,9 +482,9 @@ QUALITY can be:
           (if (coding-system-get coding-system :bom) 3 0)
           ;; Account for CR in CRLF pairs.
           lineno))
-      (`single-byte
+      ('single-byte
        (+ position -1 lineno))
-      ((and `utf-16
+      ((and 'utf-16
             ;; FIXME: For utf-16, we could use the same approach as used for
             ;; dos EOLs (counting the number of non-BMP chars instead of the
             ;; number of lines).
@@ -498,8 +498,8 @@ QUALITY can be:
           lineno))
       (_
        (pcase quality
-         (`approximate (+ (position-bytes position) -1 lineno))
-         (`exact
+         ('approximate (+ (position-bytes position) -1 lineno))
+         ('exact
           ;; Rather than assume that the file exists and still holds the right
           ;; data, we reconstruct its relevant portion.
           (let ((buf (current-buffer)))
diff --git a/lisp/international/mule.el b/lisp/international/mule.el
index a4f3441..ba30fee 100644
--- a/lisp/international/mule.el
+++ b/lisp/international/mule.el
@@ -1,6 +1,6 @@
 ;;; mule.el --- basic commands for multilingual environment
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -343,7 +343,7 @@ Return t if file exists."
            ;; Have the original buffer current while we eval.
            (eval-buffer buffer nil
                         ;; This is compatible with what `load' does.
-                        (if purify-flag file fullname)
+                         (if dump-mode file fullname)
                         nil t))
        (let (kill-buffer-hook kill-buffer-query-functions)
          (kill-buffer buffer)))
@@ -819,10 +819,10 @@ VALUE is a CCL program name defined by 
`define-ccl-program'.  The
 CCL program reads a character sequence and writes a byte sequence
 as an encoding result.
 
-`:inhibit-null-byte-detection'
+`:inhibit-nul-byte-detection'
 
 VALUE non-nil means Emacs ignore null bytes on code detection.
-See the variable `inhibit-null-byte-detection'.  This attribute
+See the variable `inhibit-nul-byte-detection'.  This attribute
 is meaningful only when `:coding-type' is `undecided'.
 
 `:inhibit-iso-escape-detection'
@@ -867,7 +867,7 @@ non-ASCII files.  This attribute is meaningful only when
                                      :ccl-encoder
                                      :valids))
                                   ((eq coding-type 'undecided)
-                                   '(:inhibit-null-byte-detection
+                                   '(:inhibit-nul-byte-detection
                                      :inhibit-iso-escape-detection
                                      :prefer-utf-8))))))
 
@@ -920,8 +920,8 @@ non-ASCII files.  This attribute is meaningful only when
          (cons :name (cons name (cons :docstring (cons (purecopy docstring)
                                                        props)))))
     (setcdr (assq :plist common-attrs) props)
-    (apply 'define-coding-system-internal
-          name (mapcar 'cdr (append common-attrs spec-attrs)))))
+    (apply #'define-coding-system-internal
+          name (mapcar #'cdr (append common-attrs spec-attrs)))))
 
 (defun coding-system-doc-string (coding-system)
   "Return the documentation string for CODING-SYSTEM."
@@ -1852,9 +1852,12 @@ or nil."
 
 Each function in this list should be written to operate on the
 current buffer, but should not modify it in any way.  The buffer
-will contain undecoded text of parts of the file.  Each function
+will contain the text of parts of the file.  Each function
 should take one argument, SIZE, which says how many characters
-\(starting from point) it should look at.
+\(starting from point) it should look at.  The function might be
+called both when the file is visited and Emacs wants to decode
+its contents, and when the file's buffer is about to be saved
+and Emacs wants to determine how to encode its contents.
 
 If one of these functions succeeds in determining a coding
 system, it should return that coding system.  Otherwise, it
@@ -2501,7 +2504,18 @@ This function is intended to be added to 
`auto-coding-functions'."
                   (let ((sym-type (coding-system-type sym))
                         (bfcs-type
                          (coding-system-type buffer-file-coding-system)))
-                    (if (and (coding-system-equal 'utf-8 sym-type)
+                    ;; If the buffer is unibyte, its encoding is
+                    ;; immaterial (it is just the default value of
+                    ;; buffer-file-coding-system), so we ignore it.
+                    ;; This situation happens when this function is
+                    ;; called as part of visiting a file, as opposed
+                    ;; to when saving a buffer to a file.
+                    (if (and enable-multibyte-characters
+                             ;; 'charset' will signal an error in
+                             ;; coding-system-equal, since it isn't a
+                             ;; coding-system.  So test that up front.
+                             (not (equal sym-type 'charset))
+                             (coding-system-equal 'utf-8 sym-type)
                              (coding-system-equal 'utf-8 bfcs-type))
                         buffer-file-coding-system
                      sym))
@@ -2541,7 +2555,7 @@ This function is intended to be added to 
`auto-coding-functions'."
     ;; (allowing for whitespace at bob).  Note: 'DOCTYPE NETSCAPE' is
     ;; useful for Mozilla bookmark files.
     (when (and (re-search-forward 
"\\`[[:space:]\n]*\\(<!doctype[[:space:]\n]+\\(html\\|netscape\\)\\|<html\\)" 
size t)
-              (re-search-forward 
"<meta\\s-+\\(http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']text/\\sw+;\\s-*\\)?charset=[\"']?\\(.+?\\)[\"'\\s-/>]"
 size t))
+              (re-search-forward 
"<meta\\s-+\\(http-equiv=[\"']?content-type[\"']?\\s-+content=[\"']text/\\sw+;\\s-*\\)?charset=[\"']?\\(.+?\\)[\"'[:space:]/>]"
 size t))
       (let* ((match (match-string 2))
             (sym (intern (downcase match))))
        (if (coding-system-p sym)
@@ -2552,7 +2566,8 @@ This function is intended to be added to 
`auto-coding-functions'."
             (let ((sym-type (coding-system-type sym))
                   (bfcs-type
                    (coding-system-type buffer-file-coding-system)))
-              (if (and (coding-system-equal 'utf-8 sym-type)
+              (if (and enable-multibyte-characters
+                       (coding-system-equal 'utf-8 sym-type)
                        (coding-system-equal 'utf-8 bfcs-type))
                   buffer-file-coding-system
                sym))
diff --git a/lisp/international/ogonek.el b/lisp/international/ogonek.el
index fe3e340..543f2e3 100644
--- a/lisp/international/ogonek.el
+++ b/lisp/international/ogonek.el
@@ -1,6 +1,6 @@
 ;;; ogonek.el --- change the encoding of Polish diacritics
 
-;; Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Włodek Bzyl
 ;;        Ryszard Kubiak
diff --git a/lisp/international/quail.el b/lisp/international/quail.el
index ec15cca..bd05fce 100644
--- a/lisp/international/quail.el
+++ b/lisp/international/quail.el
@@ -1,6 +1,6 @@
 ;;; quail.el --- provides simple input method for multilingual text
 
-;; Copyright (C) 1997-1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/international/rfc1843.el b/lisp/international/rfc1843.el
index 84231d3..545ee4e 100644
--- a/lisp/international/rfc1843.el
+++ b/lisp/international/rfc1843.el
@@ -1,6 +1,6 @@
 ;;; rfc1843.el --- HZ (rfc1843) decoding  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <address@hidden>
 ;; Keywords: news HZ HZ+ mail i18n
diff --git a/lisp/international/titdic-cnv.el b/lisp/international/titdic-cnv.el
index e6ba3ad..e6065fb 100644
--- a/lisp/international/titdic-cnv.el
+++ b/lisp/international/titdic-cnv.el
@@ -1,6 +1,6 @@
-;;; titdic-cnv.el --- convert cxterm dictionary (TIT format) to Quail package 
-*- coding:iso-2022-7bit; -*-
+;;; titdic-cnv.el --- convert cxterm dictionary (TIT format) to Quail package 
-*- coding: utf-8-emacs; lexical-binding:t -*-
 
-;; Copyright (C) 1997-1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -83,9 +83,9 @@
 ;; how to select a translation from a list of candidates.
 
 (defvar quail-cxterm-package-ext-info
-  '(("chinese-4corner" "$(0(?-F(B")
-    ("chinese-array30" "$(0#R#O(B")
-    ("chinese-ccdospy" "$AKuF4(B"
+  '(("chinese-4corner" "四角")
+    ("chinese-array30" "30")
+    ("chinese-ccdospy" "缩拼"
      "Pinyin base input method for Chinese charset GB2312 (`chinese-gb2312').
 
 Pinyin is the standard Roman transliteration method for Chinese.
@@ -94,10 +94,10 @@ method `chinese-py'.
 
 This input method works almost the same way as `chinese-py'.  The
 difference is that you type a single key for these Pinyin spelling.
-    Pinyin:  zh  en  eng ang ch  an  ao  ai  ong sh  ing  yu($A(9(B)
+    Pinyin:  zh  en  eng ang ch  an  ao  ai  ong sh  ing  yu(ü)
     keyseq:   a   f   g   h   i   j   k   l   s   u   y   v
 For example:
-    Chinese:  $A0!(B    $A9{(B    $AVP(B    $AND(B    $A9b(B    
$ASq(B    $AH+(B
+    Chinese:  啊    果    中    文    光    玉    全
     Pinyin:   a    guo   zhong  wen  guang  yu   quan
     Keyseq:   a1   guo4   as1   wf4  guh1  yu..6 qvj6
 
@@ -106,14 +106,14 @@ For example:
 For double-width GB2312 characters corresponding to ASCII, use the
 input method `chinese-qj'.")
 
-    ("chinese-ecdict" "$(05CKH(B"
+    ("chinese-ecdict" "英漢"
 "In this input method, you enter a Chinese (Big5) character or word
 by typing the corresponding English word.  For example, if you type
-\"computer\", \"$(0IZH+(B\" is input.
+\"computer\", \"電腦\" is input.
 
 \\<quail-translation-docstring>")
 
-    ("chinese-etzy" "$(06/0D(B"
+    ("chinese-etzy" "倚注"
 "Zhuyin base input method for Chinese Big5 characters (`chinese-big5-1',
 `chinese-big5-2').
 
@@ -122,20 +122,20 @@ compose one Chinese character.
 
 In this input method, you enter a Chinese character by first typing
 keys corresponding to Zhuyin symbols (see the above table) followed by
-SPC, 1, 2, 3, or 4 specifying a tone (SPC:$(0?v(N(B, 1:$(0M=Vy(B, 
2:$(0Dm(N(B, 3: $(0&9Vy(B,
-4:$(0(+Vy(B).
+SPC, 1, 2, 3, or 4 specifying a tone (SPC:陰平, 1:輕聲, 2:陽平, 3: 上聲,
+4:去聲).
 
 \\<quail-translation-docstring>")
 
-    ("chinese-punct-b5" "$(0O:(BB"
+    ("chinese-punct-b5" "標B"
      "Input method for Chinese punctuation and symbols of Big5
 \(`chinese-big5-1' and `chinese-big5-2').")
 
-    ("chinese-punct" "$A1j(BG"
+    ("chinese-punct" "标G"
      "Input method for Chinese punctuation and symbols of GB2312
 \(`chinese-gb2312').")
 
-    ("chinese-py-b5" "$(03<(BB"
+    ("chinese-py-b5" "拼B"
      "Pinyin base input method for Chinese Big5 characters
 \(`chinese-big5-1', `chinese-big5-2').
 
@@ -153,28 +153,28 @@ method `chinese-qj-b5'.
 The input method `chinese-py' and `chinese-tonepy' are also Pinyin
 based, but for the character set GB2312 (`chinese-gb2312').")
 
-    ("chinese-qj-b5" "$(0)A(BB")
+    ("chinese-qj-b5" "全B")
 
-    ("chinese-qj" "$AH+(BG")
+    ("chinese-qj" "全G")
 
-    ("chinese-sw" "$AJWN2(B"
+    ("chinese-sw" "首尾"
 "Radical base input method for Chinese charset GB2312 (`chinese-gb2312').
 
 In this input method, you enter a Chinese character by typing two
-keys.  The first key corresponds to the first ($AJW(B) radical, the second
-key corresponds to the last ($AN2(B) radical.  The correspondence of keys
+keys.  The first key corresponds to the first (首) radical, the second
+key corresponds to the last (尾) radical.  The correspondence of keys
 and radicals is as below:
 
  first radical:
  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
- $APD(B $AZ"(B $AJ,(B $AX<(B $A;p(B $A?Z(B $A^P(B $Ac_(B 
$AZ%(B $A\3(B $AXi(B $AD>(B $Alj(B $Ab;(B $ATB(B $Afy(B 
$AJ/(B $AMu(B $A0K(B $AX/(B $AHU(B $AeA(B $Aak(B $AVq(B 
$AR;(B $AHK(B
+ 心 冖 尸 丶 火 口 扌 氵 讠 艹 亻 木 礻 饣 月 纟 石 王 八 丿 日 辶 犭 竹 一 人
  last radical:
  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z
- $ASV(B $AI=(B $AMA(B $A56(B $AZb(B $A?Z(B $ARB(B $Aqb(B 
$A4s(B $A6!(B $A[L(B $Ala(B $AJ.(B $A4u(B $AXg(B $ACE(B 
$A=q(B $AX-(B $AE.(B $ARR(B $A`m(B $AP!(B $A3'(B $A3f(B 
$A_.(B $A27(B
+ 又 山 土 刀 阝 口 衣 疋 大 丁 厶 灬 十 歹 冂 门 今 丨 女 乙 囗 小 厂 虫 弋 卜
 
 \\<quail-translation-docstring>")
 
-    ("chinese-tonepy" "$A5wF4(B"
+    ("chinese-tonepy" "调拼"
      "Pinyin base input method for Chinese charset GB2312 (`chinese-gb2312').
 
 Pinyin is the standard roman transliteration method for Chinese.
@@ -183,18 +183,18 @@ method `chinese-py'.
 
 This input method works almost the same way as `chinese-py'.  The
 difference is that you must type 1..5 after each Pinyin spelling to
-specify a tone (1:$ARuF=(B, 2:$AQtF=(B, 3:$AIOIy(B, 4$AOBIy(B, 
5:$AGaIy(B).
+specify a tone (1:阴平, 2:阳平, 3:上声, 4下声, 5:轻声).
 
 \\<quail-translation-docstring>
 
-For instance, to input $ADc(B, you type \"n i 3 3\", the first \"n i\" is
+For instance, to input 你, you type \"n i 3 3\", the first \"n i\" is
 a Pinyin, the next \"3\" specifies tone, and the last \"3\" selects
 the third character from the candidate list.
 
 For double-width GB2312 characters corresponding to ASCII, use the
 input method `chinese-qj'.")
 
-    ("chinese-zozy" "$(0I\0D(B"
+    ("chinese-zozy" "零注"
 "Zhuyin base input method for Chinese Big5 characters (`chinese-big5-1',
 `chinese-big5-2').
 
@@ -203,8 +203,8 @@ compose a Chinese character.
 
 In this input method, you enter a Chinese character by first typing
 keys corresponding to Zhuyin symbols (see the above table) followed by
-SPC, 6, 3, 4, or 7 specifying a tone (SPC:$(0?v(N(B, 6:$(0Dm(N(B, 
3:$(0&9Vy(B, 4:$(0(+Vy(B,
-7:$(0M=Vy(B).
+SPC, 6, 3, 4, or 7 specifying a tone (SPC:陰平, 6:陽平, 3:上聲, 4:去聲,
+7:輕聲).
 
 \\<quail-translation-docstring>")))
 
@@ -348,7 +348,7 @@ SPC, 6, 3, 4, or 7 specifying a tone (SPC:$(0?v(N(B, 
6:$(0Dm(N(B, 3:$(0&9Vy
       (princ (nth 2 (assoc tit-encode tit-encode-list)))
       (princ "\" \"")
       (princ (or title
-                (if (string-match 
"[:$A!K$(0!(!J(B]+\\([^:$A!K$(0!(!K(B]+\\)" tit-prompt)
+                (if (string-match "[:∷:【]+\\([^:∷:】]+\\)" tit-prompt)
                     (substring tit-prompt (match-beginning 1) (match-end 1))
                   tit-prompt)))
       (princ "\"\n"))
@@ -417,9 +417,7 @@ SPC, 6, 3, 4, or 7 specifying a tone (SPC:$(0?v(N(B, 
6:$(0Dm(N(B, 3:$(0&9Vy
 ;; function call.
 (defun tit-process-body ()
   (message "Formatting translation rules...")
-  (let* ((template (list nil nil))
-        (second (cdr template))
-        (prev-key "")
+  (let* ((prev-key "")
         ch key translations pos)
     (princ "(quail-define-rules\n")
     (while (null (eobp))
@@ -500,8 +498,7 @@ the generated Quail package is saved."
            (goto-char (point-min))
            (decode-coding-region (point-min) (point-max) coding-system)
            ;; Explicitly set eol format to `unix'.
-           (setq coding-system-for-write
-                 (coding-system-change-eol-conversion coding-system 'unix))
+           (setq coding-system-for-write 'utf-8-unix)
            (remove-text-properties (point-min) (point-max) '(charset nil)))
 
          (set-buffer-multibyte t)
@@ -522,7 +519,6 @@ the generated Quail package is saved."
          (princ ";; Local Variables:\n")
          (princ ";; version-control: never\n")
          (princ ";; no-update-autoloads: t\n")
-         (princ (format ";; coding: %s\n" coding-system-for-write))
          (princ ";; End:\n"))))))
 
 ;;;###autoload
@@ -581,7 +577,7 @@ To get complete usage, invoke \"emacs -batch -f 
batch-titdic-convert -h\"."
 ;;    )
 
 (defvar quail-misc-package-ext-info
-  '(("chinese-b5-tsangchi" "$(06A(BB"
+  '(("chinese-b5-tsangchi" "倉B"
      "cangjie-table.b5" big5 "tsang-b5.el"
      tsang-b5-converter
      "\
@@ -591,7 +587,7 @@ To get complete usage, invoke \"emacs -batch -f 
batch-titdic-convert -h\"."
 ;; # unmodified versions is granted without royalty provided
 ;; # this notice is preserved.")
 
-    ("chinese-b5-quick" "$(0X|(BB"
+    ("chinese-b5-quick" "簡B"
      "cangjie-table.b5" big5 "quick-b5.el"
      quick-b5-converter
      "\
@@ -601,7 +597,7 @@ To get complete usage, invoke \"emacs -batch -f 
batch-titdic-convert -h\"."
 ;; # unmodified versions is granted without royalty provided
 ;; # this notice is preserved.")
 
-    ("chinese-cns-tsangchi" "$(GT?(BC"
+    ("chinese-cns-tsangchi" "倉C"
      "cangjie-table.cns" iso-2022-cn-ext "tsang-cns.el"
      tsang-cns-converter
      "\
@@ -611,7 +607,7 @@ To get complete usage, invoke \"emacs -batch -f 
batch-titdic-convert -h\"."
 ;; # unmodified versions is granted without royalty provided
 ;; # this notice is preserved.")
 
-    ("chinese-cns-quick" "$(Gv|(BC"
+    ("chinese-cns-quick" "簡C"
      "cangjie-table.cns" iso-2022-cn-ext "quick-cns.el"
      quick-cns-converter
      "\
@@ -621,7 +617,7 @@ To get complete usage, invoke \"emacs -batch -f 
batch-titdic-convert -h\"."
 ;; # unmodified versions is granted without royalty provided
 ;; # this notice is preserved.")
 
-    ("chinese-py" "$AF4(BG"
+    ("chinese-py" "拼G"
      "pinyin.map" cn-gb-2312 "PY.el"
      py-converter
      "\
@@ -649,7 +645,7 @@ To get complete usage, invoke \"emacs -batch -f 
batch-titdic-convert -h\"."
 ;; You should have received a copy of the GNU General Public License along with
 ;; CCE.  If not, see <https://www.gnu.org/licenses/>.")
 
-    ("chinese-ziranma" "$AWTH;(B"
+    ("chinese-ziranma" "自然"
      "ziranma.cin" cn-gb-2312 "ZIRANMA.el"
      ziranma-converter
      "\
@@ -677,7 +673,7 @@ To get complete usage, invoke \"emacs -batch -f 
batch-titdic-convert -h\"."
 ;; You should have received a copy of the GNU General Public License along with
 ;; CCE.  If not, see <https://www.gnu.org/licenses/>.")
 
-    ("chinese-ctlau" "$AAuTA(B"
+    ("chinese-ctlau" "刘粤"
      "CTLau.html" cn-gb-2312 "CTLau.el"
      ctlau-gb-converter
      "\
@@ -702,7 +698,7 @@ To get complete usage, invoke \"emacs -batch -f 
batch-titdic-convert -h\"."
 ;; # You should have received a copy of the GNU General Public License
 ;; # along with this program.  If not, see <https://www.gnu.org/licenses/>.")
 
-    ("chinese-ctlaub" "$(0N,Gn(B"
+    ("chinese-ctlaub" "劉粵"
      "CTLau-b5.html" big5 "CTLau-b5.el"
      ctlau-b5-converter
      "\
@@ -732,38 +728,38 @@ To get complete usage, invoke \"emacs -batch -f 
batch-titdic-convert -h\"."
 ;; dictionary in the buffer DICBUF.  The input method name of the
 ;; Quail package is NAME, and the title string is TITLE.
 
-;; TSANG-P is non-nil, generate $(06AQo(B input method.  Otherwise
-;; generate $(0X|/y(B (simple version of $(06AQo(B).  If BIG5-P is 
non-nil, the
+;; TSANG-P is non-nil, generate 倉頡 input method.  Otherwise
+;; generate 簡易 (simple version of 倉頡).  If BIG5-P is non-nil, the
 ;; input method is for inputting Big5 characters.  Otherwise the input
 ;; method is for inputting CNS characters.
 
-(defun tsang-quick-converter (dicbuf name title tsang-p big5-p)
-  (let ((fulltitle (if tsang-p (if big5-p "$(06AQo(B" "$(GT?on(B")
-                    (if big5-p "$(0X|/y(B" "$(Gv|Mx(B")))
+(defun tsang-quick-converter (dicbuf tsang-p big5-p)
+  (let ((fulltitle (if tsang-p (if big5-p "倉頡" "倉頡")
+                    (if big5-p "簡易" "簡易")))
        dic)
     (goto-char (point-max))
     (if big5-p
-       (insert (format "\"$(0&d'GTT&,!J(B%s$(0!K(BBIG5
+       (insert (format "\"中文輸入【%s】BIG5
 
-       $(0KHM$(B%s$(0TT&,WoOu(B
+       漢語%s輸入鍵盤
 
-   [Q $(0'D(B] [W $(0(q(B] [E $(0'V(B] [R $(0&H(B] [T $(0'>(B] [Y 
$(0&4(B] [U $(0&U(B] [I $(0'B(B] [O $(0&*(B] [P $(0'A(B]
+   [Q 手] [W 田] [E 水] [R 口] [T 廿] [Y 卜] [U 山] [I 戈] [O 人] [P 心]
 
-    [A $(0'K(B] [S $(0&T(B] [D $(0'N(B] [F $(0'W(B] [G $(0&I(B] [H 
$(0*M(B] [J $(0&3(B] [L $(0&d(B]
+    [A 日] [S 尸] [D 木] [F 火] [G 土] [H 竹] [J 十] [L 中]
 
-      [Z  ] [X $(0[E(B] [C $(01[(B] [V $(0&M(B] [B $(0'M(B] [N 
$(0&_(B] [M $(0&"(B]
+      [Z  ] [X 難] [C 金] [V 女] [B 月] [N 弓] [M 一]
 
 \\\\<quail-translation-docstring>\"\n"
                        fulltitle fulltitle))
-      (insert (format "\"$(GDcEFrSD+!J(B%s$(G!K(BCNS
+      (insert (format "\"中文輸入【%s】CNS
 
-       $(GiGk#(B%s$(GrSD+uomu(B
+       漢語%s輸入鍵盤
 
-   [Q $(GEC(B] [W $(GFp(B] [E $(GEU(B] [R $(GDG(B] [T $(GE=(B] [Y 
$(GD3(B] [U $(GDT(B] [I $(GEA(B] [O $(GD)(B] [P $(address@hidden(B]
+   [Q 手] [W 田] [E 水] [R 口] [T 廿] [Y 卜] [U 山] [I 戈] [O 人] [P 心]
 
-    [A $(GEJ(B] [S $(GDS(B] [D $(GEM(B] [F $(GEV(B] [G $(GDH(B] [H 
$(GHL(B] [J $(GD2(B] [L $(GDc(B]
+    [A 日] [S 尸] [D 木] [F 火] [G 土] [H 竹] [J 十] [L 中]
 
-      [Z  ] [X $(GyE(B] [C $(GOZ(B] [V $(GDL(B] [B $(GEL(B] [N 
$(GD^(B] [M $(GD!(B]
+      [Z  ] [X 難] [C 金] [V 女] [B 月] [N 弓] [M 一]
 
 \\\\<quail-translation-docstring>\"\n"
                      fulltitle fulltitle)))
@@ -782,7 +778,7 @@ To get complete usage, invoke \"emacs -batch -f 
batch-titdic-convert -h\"."
        (while (not (eobp))
          (forward-char 5)
          (let ((trans (char-to-string (following-char)))
-               key slot)
+               key)
            (re-search-forward "\\([A-Z]+\\)\r*$" nil t)
            (setq key (downcase
                       (if (or tsang-p
@@ -799,63 +795,63 @@ To get complete usage, invoke \"emacs -batch -f 
batch-titdic-convert -h\"."
     (setq dic (sort dic (function (lambda (x y) (string< (car x ) (car y))))))
     (dolist (elt dic)
       (insert (format "(%S\t%S)\n" (car elt) (cdr elt))))
-    (let ((punctuation '((";" "$(0!'!2!"!#!.!/(B" "$(G!'!2!"!#!.!/(B")
-                        (":" "$(0!(!+!3!%!$!&!0!1(B" 
"$(G!(!+!3!%!$!&!0!1(B")
-                        ("'" "$(0!e!d(B" "$(G!e!d(B")
-                        ("\"" "$(0!g!f!h!i!q(B" "$(G!g!f!h!i!q(B")
-                        ("\\" "$(0"`"b#M(B" "$(G"`"b#M(B")
-                        ("|" "$(0!6!8!:"^(B" "$(G!6!8!:"^(B")
-                        ("/" "$(0"_"a#L(B" "$(G"_"a#L(B")
-                        ("?" "$(0!)!4(B" "$(G!)!4(B")
-                        ("<" "$(0!R"6"A!T"H(B" "$(G!R"6"A!T"H(B")
-                        (">" "$(0!S"7"B!U(B" "$(G!S"7"B!U(B")
-                        ("[" "$(0!F!J!b!H!L!V!Z!X!\(B" 
"$(G!F!J!b!H!L!V!Z!X!\(B")
-                        ("]" "$(0!G!K!c!I!M!W![!Y!](B" 
"$(G!G!K!c!I!M!W![!Y!](B")
-                        ("{" "$(0!B!`!D(B " "$(G!B!`!D(B ")
-                        ("}" "$(0!C!a!E(B" "$(G!C!a!E(B")
-                        ("`" "$(0!j!k(B" "$(G!j!k(B")
-                        ("~" "$(0"D"+",!<!=(B" "$(G"D"+",!<!=(B")
-                        ("!" "$(0!*!5(B" "$(G!*!5(B")
-                        ("@" "$(0"i"n(B" "$(G"i"n(B")
-                        ("#" "$(0!l"-(B" "$(G!l"-(B")
-                        ("$" "$(0"c"l(B" "$(G"c"l(B")
-                        ("%" "$(0"h"m(B" "$(G"h"m(B")
-                        ("&" "$(0!m".(B" "$(G!m".(B")
-                        ("*" "$(0!n"/!o!w!x(B" "$(G!n"/!o!w!x(B")
-                        ("(" "$(0!>address@hidden(B" "$(G!>address@hidden(B")
-                        (")" "$(0!?!_!A(B" "$(G!?!_!A(B")
-                        ("-" "$(0!7!9"#"$"1"@(B" "$(G!7!9"#"$"1"@(B")
-                        ("_" "$(0"%"&(B" "$(G"%"&(B")
-                        ("=" "$(0"8"C(B" "$(G"8"C(B")
-                        ("+" "$(0"0"?(B" "$(G"0"?(B"))))
+    (let ((punctuation '((";" ";﹔,、﹐﹑" ";﹔,、﹐﹑")
+                        (":" ":︰﹕.。‧﹒·" ":︰﹕.。・﹒·")
+                        ("'" "’‘" "’‘")
+                        ("\"" "”“〝〞〃" "”“〝〞〃")
+                        ("\\" "\﹨╲" "\﹨╲")
+                        ("|" "|︱︳∣" "︱︲��|")
+                        ("/" "/∕╱" "/∕╱")
+                        ("?" "?﹖" "?﹖")
+                        ("<" "〈<﹤︿∠" "〈<﹤︿∠")
+                        (">" "〉>﹥﹀" "〉>﹦﹀")
+                        ("[" "〔【﹝︹︻「『﹁﹃" "〔【﹝︹︻「『﹁﹃")
+                        ("]" "〕】﹞︺︼」』﹂﹄" "〕】﹞︺︼」』﹂﹄")
+                        ("{" "{﹛︷ " "{﹛︷ ")
+                        ("}" "}﹜︸" "}﹜︸")
+                        ("`" "‵′" "′‵")
+                        ("~" "~﹋﹌︴﹏" "∼﹋﹌����")
+                        ("!" "!﹗" "!﹗")
+                        ("@" "@﹫" "@﹫")
+                        ("#" "#﹟" "#﹟")
+                        ("$" "$﹩" "$﹩")
+                        ("%" "%﹪" "%﹪")
+                        ("&" "&﹠" "&﹠")
+                        ("*" "*﹡※☆★" "*﹡※☆★")
+                        ("(" "(﹙︵" "(﹙︵")
+                        (")" ")﹚︶" ")﹚︶")
+                        ("-" "–—¯ ̄-﹣" "—–‾��-﹣")
+                        ("_" "_ˍ" "_��")
+                        ("=" "=﹦" "=﹥")
+                        ("+" "+﹢" "+﹢"))))
     (dolist (elt punctuation)
       (insert (format "(%S %S)\n" (concat "z" (car elt))
                      (if big5-p (nth 1 elt) (nth 2 elt))))))
     (insert ")\n")))
 
-(defun tsang-b5-converter (dicbuf name title)
-  (tsang-quick-converter dicbuf name title t t))
+(defun tsang-b5-converter (dicbuf)
+  (tsang-quick-converter dicbuf t t))
 
-(defun quick-b5-converter (dicbuf name title)
-  (tsang-quick-converter dicbuf name title nil t))
+(defun quick-b5-converter (dicbuf)
+  (tsang-quick-converter dicbuf nil t))
 
-(defun tsang-cns-converter (dicbuf name title)
-  (tsang-quick-converter dicbuf name title t nil))
+(defun tsang-cns-converter (dicbuf)
+  (tsang-quick-converter dicbuf t nil))
 
-(defun quick-cns-converter (dicbuf name title)
-  (tsang-quick-converter dicbuf name title nil nil))
+(defun quick-cns-converter (dicbuf)
+  (tsang-quick-converter dicbuf nil nil))
 
 ;; Generate a code of a Quail package in the current buffer from
 ;; Pinyin dictionary in the buffer DICBUF.  The input method name of
 ;; the Quail package is NAME, and the title string is TITLE.
 
-(defun py-converter (dicbuf name title)
+(defun py-converter (dicbuf)
   (goto-char (point-max))
-  (insert (format "%S\n" "$A::WVJdHk!KF4Rt!K(B
+  (insert (format "%S\n" "汉字输入∷拼音∷
 
-       $AF4Rt7=08(B
+       拼音方案
 
- $AP!P4S"NDWVD84z1m!8F4Rt!97{:E#,(B \"u(yu) $ATrSC(B u: $A1mJ>!C(B
+ 小写英文字母代表「拼音」符号, \"u(yu) 则用 u: 表示∶
 
 Pinyin base input method for Chinese charset GB2312 (`chinese-gb2312').
 
@@ -869,14 +865,14 @@ character.  The sequence is made by the combination of 
the initials
           iang ing iong u ua uo uai ui uan un uan ueng yu yue yuan yun
 
   (Note: In the correct Pinyin writing, the sequence \"yu\" in the last
-   four finals should be written by the character u-umlaut `$A(9(B'.)
+   four finals should be written by the character u-umlaut `ü'.)
 
 With this input method, you enter a Chinese character by first
 entering its pinyin spelling.
 
 \\<quail-translation-docstring>
 
-For instance, to input $ADc(B, you type \"n i C-n 3\".  The first \"n i\"
+For instance, to input 你, you type \"n i C-n 3\".  The first \"n i\"
 is a Pinyin, \"C-n\" selects the next group of candidates (each group
 contains at most 10 characters), \"3\" select the third character in
 that group.
@@ -924,14 +920,14 @@ method `chinese-tonepy' with which you must specify tones 
by digits
 ;; Ziranma dictionary in the buffer DICBUF.  The input method name of
 ;; the Quail package is NAME, and the title string is TITLE.
 
-(defun ziranma-converter (dicbuf name title)
+(defun ziranma-converter (dicbuf)
   (let (dic)
     (with-current-buffer dicbuf
       (goto-char (point-min))
       (search-forward "\n%keyname end")
       (forward-line 1)
       (let ((table (make-hash-table :test 'equal))
-           elt pos key trans val)
+           pos key trans val)
        (while (not (eobp))
          (setq pos (point))
          (skip-chars-forward "^ \t")
@@ -959,22 +955,22 @@ method `chinese-tonepy' with which you must specify tones 
by digits
                 table)))
     (setq dic (sort dic (function (lambda (x y) (string< (car x) (car y))))))
     (goto-char (point-max))
-    (insert (format "%S\n" "$A::WVJdHk!K!>WTH;!?!K(B
-
-                            $A<|EL6TUU1m(B:
- $A)3)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)W)%)%)7(B
- $A)'#Q(B  $A)'#W(B  $A)'#E(B  $A)'#R(B  $A)'#T(B  $A)'#Y(B  
$A)'#U(Bsh$A)'#I(Bch$A)'#O(B  $A)'#P(B  $A)'(B
- $A)'(B  iu$A)'(B  ua$A)'(B   e$A)'(B uan$A)'(B  ue$A)'(B 
uai$A)'(B   u$A)'(B   i$A)'(B   o$A)'(B  un$A)'(B
- $A)'(B    $A)'(B  ia$A)'(B    $A)'(B van$A)'(B  ve$A)'(B 
ing$A)'(B    $A)'(B    $A)'(B  uo$A)'(B  vn$A)'(B
- $A);)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)?(B
-   $A)'#A(B  $A)'#S(B  $A)'#D(B  $A)'#F(B  $A)'#G(B  $A)'#H(B  
$A)'#J(B  $A)'#K(B  $A)'#L(B  $A)'(B
-   $A)'(B   a$A)'(Biong$A)'(Buang$A)'(B  en$A)'(B eng$A)'(B 
ang$A)'(B  an$A)'(B  ao$A)'(B  ai$A)'(B
-   $A)'(B    $A)'(B ong$A)'(Biang$A)'(B    $A)'(B  ng$A)'(B    
$A)'(B    $A)'(B    $A)'(B    $A)'(B
-   $A);)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)_)W)%)%)7(B
-     $A)'#Z(B  $A)'#X(B  $A)'#C(B  $A)'#V(Bzh$A)'#B(B  $A)'#N(B  
$A)'#M(B  $A)'#,(B  $A)'#.(B  $A)'(B $A#/(B $A)'(B
-     $A)'(B  ei$A)'(B  ie$A)'(B iao$A)'(B  ui$A)'(B  ou$A)'(B  
in$A)'(B ian$A)'G0R3)':sR3)'7{:E)'(B
-     $A)'(B    $A)'(B    $A)'(B    $A)'(B   v$A)'(B    $A)'(B    
$A)'(B    $A)'(B    $A)'(B    $A)'(B    $A)'(B
-     $A);)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)_)%)%)?(B
+    (insert (format "%S\n" "汉字输入∷【自然】∷
+
+                            键盘对照表:
+ ┏━━┳━━┳━━┳━━┳━━┳━━┳━━┳━━┳━━┳━━┓
+ ┃Q  ┃W  ┃E  ┃R  ┃T  ┃Y  ┃Ush┃Ich┃O  ┃P  ┃
+ ┃  iu┃  ua┃   e┃ uan┃  ue┃ uai┃   u┃   i┃   o┃  un┃
+ ┃    ┃  ia┃    ┃ van┃  ve┃ ing┃    ┃    ┃  uo┃  vn┃
+ ┗┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━┛
+   ┃A  ┃S  ┃D  ┃F  ┃G  ┃H  ┃J  ┃K  ┃L  ┃
+   ┃   a┃iong┃uang┃  en┃ eng┃ ang┃  an┃  ao┃  ai┃
+   ┃    ┃ ong┃iang┃    ┃  ng┃    ┃    ┃    ┃    ┃
+   ┗┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━┻┳━━┓
+     ┃Z  ┃X  ┃C  ┃Vzh┃B  ┃N  ┃M  ┃,  ┃.  ┃ / ┃
+     ┃  ei┃  ie┃ iao┃  ui┃  ou┃  in┃ ian┃前页┃后页┃符号┃
+     ┃    ┃    ┃    ┃   v┃    ┃    ┃    ┃    ┃    ┃    ┃
+     ┗━━┻━━┻━━┻━━┻━━┻━━┻━━┻━━┻━━┻━━┛
 
 
 Pinyin base input method for Chinese GB2312 characters (`chinese-gb2312').
@@ -986,34 +982,34 @@ method `chinese-py'.
 Unlike the standard spelling of Pinyin, in this input method all
 initials and finals are assigned to single keys (see the above table).
 For instance, the initial \"ch\" is assigned to the key `i', the final
-\"iu\" is assigned to the key `q', and tones 1, 2, 3, 4, and $AGaIy(B are
+\"iu\" is assigned to the key `q', and tones 1, 2, 3, 4, and 轻声 are
 assigned to the keys `q', `w', `e', `r', `t' respectively.
 
 \\<quail-translation-docstring>
 
 To input one-letter words, you type 4 keys, the first two for the
 Pinyin of the letter, next one for tone, and the last one is always a
-quote (').  For instance, \"vsq'\" input $AVP(B.  Exceptions are these
+quote (').  For instance, \"vsq'\" input 中.  Exceptions are these
 letters.  You can input them just by typing a single key.
 
-       Character: $A04(B $A2;(B $A4N(B $A5D(B $A6~(B $A7"(B 
$A8v(B $A:M(B $A3v(B $A<0(B $A?I(B $AAK(B $AC;(B
+       Character: 按 不 次 的 二 发 个 和 出 及 可 了 没
        Key:       a  b  c  d  e  f  g  h  i  j  k  l  m
-       Character: $ADc(B $AE7(B $AF,(B $AF_(B $AHK(B $AH}(B 
$AK{(B $AJG(B $AWE(B $ANR(B $AP!(B $AR;(B $ATZ(B
+       Character: 你 欧 片 七 人 三 他 是 着 我 小 一 在
        Key:       n  o  p  q  r  s  t  u  v  w  x  y  z
 
 To input two-letter words, you have two ways.  One way is to type 4
 keys, two for the first Pinyin, two for the second Pinyin.  For
-instance, \"vsgo\" inputs $AVP9z(B.  Another way is to type 3 keys: 2
+instance, \"vsgo\" inputs 中国.  Another way is to type 3 keys: 2
 initials of two letters, and quote (').  For instance, \"vg'\" also
-inputs $AVP9z(B.
+inputs 中国.
 
 To input three-letter words, you type 4 keys: initials of three
-letters, and the last is quote (').  For instance, \"bjy'2\" inputs $A11(B
-$A>)Q<(B (the last `2' is to select one of the candidates).
+letters, and the last is quote (').  For instance, \"bjy'2\" inputs 北
+京鸭 (the last `2' is to select one of the candidates).
 
 To input words of more than three letters, you type 4 keys, initials
 of the first three letters and the last letter.  For instance,
-\"bjdt\" inputs $A11>)5gJSL((B.
+\"bjdt\" inputs 北京电视台.
 
 To input symbols and punctuation, type `/' followed by one of `a' to
 `z', then select one of the candidates."))
@@ -1033,7 +1029,7 @@ To input symbols and punctuation, type `/' followed by 
one of `a' to
 ;; method name of the Quail package is NAME, and the title string is
 ;; TITLE.  DESCRIPTION is the string shown by describe-input-method.
 
-(defun ctlau-converter (dicbuf name title description)
+(defun ctlau-converter (dicbuf description)
   (goto-char (point-max))
   (insert (format "%S\n" description))
   (insert "  '((\"\C-?\" . quail-delete-last-char)
@@ -1043,7 +1039,7 @@ To input symbols and punctuation, type `/' followed by 
one of `a' to
    (\"<\" . quail-prev-translation))
   nil nil nil nil)\n\n")
   (insert "(quail-define-rules\n")
-  (let (dicbuf-start dicbuf-end key-start key (pos (point)))
+  (let (dicbuf-start dicbuf-end key-start (pos (point)))
     ;; Find the dictionary, which starts below a horizontal rule and
     ;; ends at the second to last line in the HTML file.
     (with-current-buffer dicbuf
@@ -1060,7 +1056,7 @@ To input symbols and punctuation, type `/' followed by 
one of `a' to
     ;; which the file is converted have no Big5 equivalent.  Go
     ;; through and delete them.
     (goto-char pos)
-    (while (search-forward "$(0!{(B" nil t)
+    (while (search-forward "□" nil t)
       (delete-char -1))
     ;; Uppercase keys in dictionary need to be downcased.  Backslashes
     ;; at the beginning of keys need to be turned into double
@@ -1082,33 +1078,33 @@ To input symbols and punctuation, type `/' followed by 
one of `a' to
       (forward-line 1)))
   (insert ")\n"))
 
-(defun ctlau-gb-converter (dicbuf name title)
-  (ctlau-converter dicbuf name title
-"$A::WVJdHk!KAuN}OiJ=TARt!K(B
+(defun ctlau-gb-converter (dicbuf)
+  (ctlau-converter dicbuf
+"汉字输入∷刘锡祥式粤音∷
 
- $AAuN}OiJ=TASoW"Rt7=08(B
+ 刘锡祥式粤语注音方案
  Sidney Lau's Cantonese transcription scheme as described in his book
  \"Elementary Cantonese\", The Government Printer, Hong Kong, 1972.
- This file was prepared by Fung Fung Lee (address@hidden(B).
+ This file was prepared by Fung Fung Lee (李枫峰).
  Originally converted from CTCPS3.tit
  Last modified: June 2, 1993.
 
  Some infrequent GB characters are accessed by typing \\, followed by
- the Cantonese romanization of the respective radical ($A2?JW(B)."))
+ the Cantonese romanization of the respective radical (部首)."))
 
-(defun ctlau-b5-converter (dicbuf name title)
-  (ctlau-converter dicbuf name title
-"$(0KH)tTT&,!(N,Tg>A*#Gn5x!((B
+(defun ctlau-b5-converter (dicbuf)
+  (ctlau-converter dicbuf
+"漢字輸入:劉錫祥式粵音:
 
- $(0N,Tg>A*#GnM$0D5x'J7{(B
+ 劉錫祥式粵語注音方案
  Sidney Lau's Cantonese transcription scheme as described in his book
  \"Elementary Cantonese\", The Government Printer, Hong Kong, 1972.
- This file was prepared by Fung Fung Lee ($(0,XFS76(B).
+ This file was prepared by Fung Fung Lee (李楓峰).
  Originally converted from CTCPS3.tit
  Last modified: June 2, 1993.
 
  Some infrequent characters are accessed by typing \\, followed by
- the Cantonese romanization of the respective radical ($(0?f5}(B)."))
+ the Cantonese romanization of the respective radical (部首)."))
 
 (declare-function dos-8+3-filename "dos-fns.el" (filename))
 
@@ -1122,8 +1118,7 @@ the generated Quail package is saved."
   (let ((tail quail-misc-package-ext-info)
        coding-system-for-write
        slot
-       name title dicfile coding quailfile converter copyright
-       dicbuf)
+       name title dicfile coding quailfile converter copyright)
     (while tail
       (setq slot (car tail)
            dicfile (nth 2 slot)
@@ -1148,8 +1143,7 @@ the generated Quail package is saved."
              copyright (nth 6 slot))
        (message "Converting %s to %s..." dicfile quailfile)
        ;; Explicitly set eol format to `unix'.
-       (setq coding-system-for-write
-             (coding-system-change-eol-conversion coding 'unix))
+       (setq coding-system-for-write 'utf-8-unix)
        (with-temp-file (expand-file-name quailfile dirname)
          (insert (format-message ";; Quail package `%s'\n" name))
          (insert (format-message
@@ -1174,11 +1168,10 @@ the generated Quail package is saved."
               (insert-file-contents filename)
               (let ((dicbuf (current-buffer)))
                 (with-current-buffer dstbuf
-                  (funcall converter dicbuf name title)))))
+                  (funcall converter dicbuf)))))
          (insert ";; Local Variables:\n"
                  ";; version-control: never\n"
                  ";; no-update-autoloads: t\n"
-                 (format ";; coding: %s\n" coding)
                  ";; End:\n\n"
                  ";;; " quailfile " ends here\n"))
        (message "Converting %s to %s...done" dicfile quailfile))
@@ -1210,6 +1203,38 @@ to store generated Quail packages."
        (miscdic-convert filename dir))))
   (kill-emacs 0))
 
+(defun pinyin-convert ()
+  "Convert text file pinyin.map into an elisp library.
+The library is named pinyin.el, and contains the constant
+`pinyin-character-map'."
+  (let ((src-file (car command-line-args-left))
+        (dst-file (cadr command-line-args-left))
+        (coding-system-for-write 'utf-8-unix))
+    (with-temp-file dst-file
+      (insert ";; This file is automatically generated from pinyin.map,\
+ by the\n;; function pinyin-convert.\n\n")
+      (insert "(defconst pinyin-character-map\n'(")
+      (let ((pos (point)))
+        (insert-file-contents src-file)
+        (goto-char pos)
+        (re-search-forward "^[a-z]")
+        (beginning-of-line)
+        (delete-region pos (point))
+        (while (not (eobp))
+          (insert "(\"")
+          (skip-chars-forward "a-z")
+          (insert "\" . \"")
+          (delete-char 1)
+          (end-of-line)
+          (while (= (preceding-char) ?\r)
+           (delete-char -1))
+          (insert "\")")
+          (forward-line 1)))
+      (insert ")\n\"An alist holding correspondences between pinyin syllables\
+ and\nChinese characters.\")\n\n")
+      (insert "(provide 'pinyin)\n"))
+    (kill-emacs 0)))
+
 ;; Prevent "Local Variables" above confusing Emacs.
 
 
diff --git a/lisp/international/ucs-normalize.el 
b/lisp/international/ucs-normalize.el
index a43c900..6f1e770 100644
--- a/lisp/international/ucs-normalize.el
+++ b/lisp/international/ucs-normalize.el
@@ -1,6 +1,6 @@
 ;;; ucs-normalize.el --- Unicode normalization NFC/NFD/NFKD/NFKC
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Taichi Kawabata <address@hidden>
 ;; Keywords: unicode, normalization
@@ -30,7 +30,7 @@
 ;;
 ;; HFS-Normalization:
 ;; Reference:
-;; http://developer.apple.com/technotes/tn/tn1150.html
+;; https://developer.apple.com/library/archive/technotes/tn/tn1150.html
 ;;
 ;; HFS Normalization excludes following area for decomposition.
 ;;
@@ -109,7 +109,9 @@
 
 (defconst ucs-normalize-version "1.2")
 
-(eval-when-compile (require 'cl-lib))
+(eval-when-compile
+  (require 'cl-lib)
+  (require 'regexp-opt))
 
 (declare-function nfd "ucs-normalize" (char))
 
diff --git a/lisp/international/utf-7.el b/lisp/international/utf-7.el
index 513422b..876baf2 100644
--- a/lisp/international/utf-7.el
+++ b/lisp/international/utf-7.el
@@ -1,6 +1,6 @@
 ;;; utf-7.el --- utf-7 coding system
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;; Keywords: i18n, mail
diff --git a/lisp/international/utf7.el b/lisp/international/utf7.el
index 61c698c..0e67a62 100644
--- a/lisp/international/utf7.el
+++ b/lisp/international/utf7.el
@@ -1,6 +1,6 @@
 ;;; utf7.el --- UTF-7 encoding/decoding for Emacs   -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Jon K Hellan <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/isearch.el b/lisp/isearch.el
index 580b3ac..6280afe 100644
--- a/lisp/isearch.el
+++ b/lisp/isearch.el
@@ -1,6 +1,6 @@
 ;;; isearch.el --- incremental search minor mode -*- lexical-binding: t -*-
 
-;; Copyright (C) 1992-1997, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1997, 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Daniel LaLiberte <address@hidden>
 ;; Maintainer: address@hidden
@@ -54,6 +54,7 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl-lib))
+(declare-function tmm-menubar-keymap "tmm.el")
 
 ;; Some additional options and constants.
 
@@ -71,21 +72,11 @@
 If t, random control and meta characters terminate the search
 and are then executed normally.
 If `edit', edit the search string instead of exiting.
-If `move', extend the search string by motion commands
-that have the `isearch-move' property on their symbols
-equal to `enabled', or the shift-translated command is
-not disabled by the value `disabled' of the same property.
-If `shift-move', extend the search string by motion commands
-while holding down the shift key.
-Both `move' and `shift-move' extend the search string by yanking text
-that ends at the new position after moving point in the current buffer.
 If `append', the characters which you type that are not interpreted by
 the incremental search are simply appended to the search string.
 If nil, run the command without exiting Isearch."
   :type '(choice (const :tag "Terminate incremental search" t)
                  (const :tag "Edit the search string" edit)
-                 (const :tag "Extend the search string by motion commands" 
move)
-                 (const :tag "Extend the search string by shifted motion keys" 
shift-move)
                  (const :tag "Append control characters to the search string" 
append)
                  (const :tag "Don't terminate incremental search" nil))
   :version "27.1")
@@ -208,11 +199,14 @@ or to the end of the buffer for a backward search.")
 to the search status stack.")
 
 (defvar isearch-filter-predicate #'isearch-filter-visible
-  "Predicate that filters the search hits that would normally be available.
-Search hits that dissatisfy the predicate are skipped.  The function
-has two arguments: the positions of start and end of text matched by
-the search.  If this function returns nil, continue searching without
-stopping at this match.
+  "Predicate to filter hits of Isearch and replace commands.
+Isearch hits that don't satisfy the predicate will be skipped.
+The value should be a function of two arguments; it will be
+called with the the positions of the start and the end of the
+text matched by Isearch and replace commands.  If this function
+returns nil, Isearch and replace commands will continue searching
+without stopping at resp. replacing this match.
+
 If you use `add-function' to modify this variable, you can use the
 `isearch-message-prefix' advice property to specify the prefix string
 displayed in the search message.")
@@ -316,6 +310,16 @@ this variable is set to the symbol `all-windows'."
   :group 'lazy-highlight
   :group 'isearch)
 
+(defcustom isearch-lazy-count nil
+  "Show match numbers in the search prompt.
+When both this option and `isearch-lazy-highlight' are non-nil,
+show the current match number and the total number of matches
+in the buffer (or its restriction)."
+  :type 'boolean
+  :group 'lazy-count
+  :group 'isearch
+  :version "27.1")
+
 ;;; Lazy highlight customization.
 
 (defgroup lazy-highlight nil
@@ -386,6 +390,29 @@ and doesn't remove full-buffer highlighting after a 
search."
   :group 'lazy-highlight
   :group 'basic-faces)
 
+;;; Lazy count customization.
+
+(defgroup lazy-count nil
+  "Lazy counting feature for reporting the number of matches."
+  :prefix "lazy-count-"
+  :version "27.1"
+  :group 'isearch
+  :group 'matching)
+
+(defcustom lazy-count-prefix-format "%s/%s "
+  "Format of the current/total number of matches for the prompt prefix."
+  :type '(choice (const :tag "No prefix" nil)
+                 (string :tag "Prefix format string" "%s/%s "))
+  :group 'lazy-count
+  :version "27.1")
+
+(defcustom lazy-count-suffix-format nil
+  "Format of the current/total number of matches for the prompt suffix."
+  :type '(choice (const :tag "No suffix" nil)
+                 (string :tag "Suffix format string" " [%s of %s]"))
+  :group 'lazy-count
+  :version "27.1")
+
 
 ;; Define isearch help map.
 
@@ -456,6 +483,170 @@ This is like `describe-bindings', but displays only 
Isearch keys."
 
 ;; Define isearch-mode keymap.
 
+(defun isearch-tmm-menubar ()
+  "Run `tmm-menubar' while `isearch-mode' is enabled."
+  (interactive)
+  (require 'tmm)
+  (run-hooks 'menu-bar-update-hook)
+  (let ((command nil))
+    (let ((menu-bar (tmm-menubar-keymap)))
+      (with-isearch-suspended
+       (setq command (let ((isearch-mode t)) ; Show bindings from
+                                             ; `isearch-mode-map' in
+                                             ; tmm's prompt.
+                       (tmm-prompt menu-bar nil nil t)))))
+    (call-interactively command)))
+
+(defvar isearch-menu-bar-commands
+  '(isearch-tmm-menubar menu-bar-open mouse-minor-mode-menu)
+  "List of commands that can open a menu during Isearch.")
+
+(defvar isearch-menu-bar-yank-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [isearch-yank-pop]
+      '(menu-item "Previous kill" isearch-yank-pop
+                  :help "Replace previous yanked kill on search string"))
+    (define-key map [isearch-yank-kill]
+      '(menu-item "Current kill" isearch-yank-kill
+                  :help "Append current kill to search string"))
+    (define-key map [isearch-yank-line]
+      '(menu-item "Rest of line" isearch-yank-line
+                  :help "Yank the rest of the current line on search string"))
+    (define-key map [isearch-yank-symbol-or-char]
+      '(menu-item "Symbol/char"
+                  isearch-yank-symbol-or-char
+                  :help "Yank next symbol or char on search string"))
+    (define-key map [isearch-yank-word-or-char]
+      '(menu-item "Word/char"
+                  isearch-yank-word-or-char
+                  :help "Yank next word or char on search string"))
+    (define-key map [isearch-yank-char]
+      '(menu-item "Char" isearch-yank-char
+                  :help "Yank char at point on search string"))
+    map))
+
+(defvar isearch-menu-bar-map
+  (let ((map (make-sparse-keymap "Isearch")))
+    (define-key map [isearch-complete]
+      '(menu-item "Complete current search string" isearch-complete
+                  :help "Complete current search string over search history"))
+    (define-key map [isearch-complete-separator]
+      '(menu-item "--"))
+    (define-key map [isearch-query-replace-regexp]
+      '(menu-item "Replace search string as regexp" 
isearch-query-replace-regexp
+                  :help "Replace matches for current search string as regexp"))
+    (define-key map [isearch-query-replace]
+      '(menu-item "Replace search string" isearch-query-replace
+                  :help "Replace matches for current search string"))
+    (define-key map [isearch-occur]
+      '(menu-item "Show all matches for search string" isearch-occur
+                  :help "Show all matches for current search string"))
+    (define-key map [isearch-highlight-regexp]
+      '(menu-item "Highlight all matches for search string"
+                  isearch-highlight-regexp
+                  :help "Highlight all matches for current search string"))
+    (define-key map [isearch-search-replace-separator]
+      '(menu-item "--"))
+    (define-key map [isearch-toggle-specified-input-method]
+      '(menu-item "Turn on specific input method"
+                  isearch-toggle-specified-input-method
+                  :help "Turn on specific input method for search"))
+    (define-key map [isearch-toggle-input-method]
+      '(menu-item "Toggle input method" isearch-toggle-input-method
+                  :help "Toggle input method for search"))
+    (define-key map [isearch-input-method-separator]
+      '(menu-item "--"))
+    (define-key map [isearch-char-by-name]
+      '(menu-item "Search for char by name" isearch-char-by-name
+                  :help "Search for character by name"))
+    (define-key map [isearch-quote-char]
+      '(menu-item "Search for literal char" isearch-quote-char
+                  :help "Search for literal char"))
+    (define-key map [isearch-special-char-separator]
+      '(menu-item "--"))
+    (define-key map [isearch-toggle-word]
+      '(menu-item "Word matching" isearch-toggle-word
+                  :help "Word matching"
+                  :button (:toggle
+                           . (eq isearch-regexp-function 
'word-search-regexp))))
+    (define-key map [isearch-toggle-symbol]
+      '(menu-item "Symbol matching" isearch-toggle-symbol
+                  :help "Symbol matching"
+                  :button (:toggle
+                           . (eq isearch-regexp-function
+                                 'isearch-symbol-regexp))))
+    (define-key map [isearch-toggle-regexp]
+      '(menu-item "Regexp matching" isearch-toggle-regexp
+                  :help "Regexp matching"
+                  :button (:toggle . isearch-regexp)))
+    (define-key map [isearch-toggle-invisible]
+      '(menu-item "Invisible text matching" isearch-toggle-invisible
+                  :help "Invisible text matching"
+                  :button (:toggle . isearch-invisible)))
+    (define-key map [isearch-toggle-char-fold]
+      '(menu-item "Character folding matching" isearch-toggle-char-fold
+                  :help "Character folding matching"
+                  :button (:toggle
+                           . (eq isearch-regexp-function
+                                 'char-fold-to-regexp))))
+    (define-key map [isearch-toggle-case-fold]
+      '(menu-item "Case folding matching" isearch-toggle-case-fold
+                  :help "Case folding matching"
+                  :button (:toggle . isearch-case-fold-search)))
+    (define-key map [isearch-toggle-lax-whitespace]
+      '(menu-item "Lax whitespace matching" isearch-toggle-lax-whitespace
+                  :help "Lax whitespace matching"
+                  :button (:toggle . isearch-lax-whitespace)))
+    (define-key map [isearch-toggle-separator]
+      '(menu-item "--"))
+    (define-key map [isearch-yank-menu]
+      `(menu-item "Yank on search string" ,isearch-menu-bar-yank-map))
+    (define-key map [isearch-edit-string]
+      '(menu-item "Edit current search string" isearch-edit-string
+                  :help "Edit current search string"))
+    (define-key map [isearch-ring-retreat]
+      '(menu-item "Edit previous search string" isearch-ring-retreat
+                  :help "Edit previous search string in Isearch history"))
+    (define-key map [isearch-ring-advance]
+      '(menu-item "Edit next search string" isearch-ring-advance
+                  :help "Edit next search string in Isearch history"))
+    (define-key map [isearch-del-char]
+      '(menu-item "Delete last char from search string" isearch-del-char
+                  :help "Delete last character from search string"))
+    (define-key map [isearch-delete-char]
+      '(menu-item "Undo last input item" isearch-delete-char
+                  :help "Undo the effect of the last Isearch command"))
+    (define-key map [isearch-end-of-buffer]
+      '(menu-item "Go to last match" isearch-end-of-buffer
+                  :help "Go to last occurrence of current search string"))
+    (define-key map [isearch-beginning-of-buffer]
+      '(menu-item "Go to first match" isearch-beginning-of-buffer
+                  :help "Go to first occurrence of current search string"))
+    (define-key map [isearch-repeat-backward]
+      '(menu-item "Repeat search backward" isearch-repeat-backward
+                  :help "Repeat current search backward"))
+    (define-key map [isearch-repeat-forward]
+      '(menu-item "Repeat search forward" isearch-repeat-forward
+                  :help "Repeat current search forward"))
+    (define-key map [isearch-nonincremental]
+      '(menu-item "Nonincremental search" isearch-exit
+                  :help "Start nonincremental search"
+                  :visible (string-equal isearch-string "")))
+    (define-key map [isearch-exit]
+      '(menu-item "Finish search" isearch-exit
+                  :help "Finish search leaving point where it is"
+                  :visible (not (string-equal isearch-string ""))))
+    (define-key map [isearch-abort]
+      '(menu-item "Remove characters not found" isearch-abort
+                  :help "Quit current search"
+                  :visible (not isearch-success)))
+    (define-key map [isearch-cancel]
+      `(menu-item "Cancel search" isearch-cancel
+                  :help "Cancel current search and return to starting point"
+                  :filter ,(lambda (binding)
+                             (if isearch-success 'isearch-abort binding))))
+    map))
+
 (defvar isearch-mode-map
   (let ((i 0)
        (map (make-keymap)))
@@ -511,6 +702,9 @@ This is like `describe-bindings', but displays only Isearch 
keys."
     (define-key map    "\C-y" 'isearch-yank-kill)
     (define-key map "\M-s\C-e" 'isearch-yank-line)
 
+    (define-key map "\M-s\M-<" 'isearch-beginning-of-buffer)
+    (define-key map "\M-s\M->" 'isearch-end-of-buffer)
+
     (define-key map (char-to-string help-char) isearch-help-map)
     (define-key map [help] isearch-help-map)
     (define-key map [f1] isearch-help-map)
@@ -562,9 +756,59 @@ This is like `describe-bindings', but displays only 
Isearch keys."
     ;; characters to the search string.  See iso-transl.el.
     (define-key map "\C-x8\r" 'isearch-char-by-name)
 
+    (define-key map [menu-bar search-menu]
+      (list 'menu-item "Isearch" isearch-menu-bar-map))
+    (define-key map [remap tmm-menubar] 'isearch-tmm-menubar)
+
     map)
   "Keymap for `isearch-mode'.")
 
+(defvar isearch-tool-bar-old-map nil
+  "Variable holding the old local value of `tool-bar-map', if any.")
+
+(defun isearch-tool-bar-image (image-name)
+  "Return an image specification for IMAGE-NAME."
+  (eval (tool-bar--image-expression image-name)))
+
+(defvar isearch-tool-bar-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map [isearch-describe-mode]
+      (list 'menu-item "Help" 'isearch-describe-mode
+            :help "Get help for Isearch"
+            :image '(isearch-tool-bar-image "help")))
+    (define-key map [isearch-occur]
+      (list 'menu-item "Show hits" 'isearch-occur
+            :help "Show each search hit"
+            :image '(isearch-tool-bar-image "index")))
+    (define-key map [isearch-query-replace]
+      (list 'menu-item "Replace" 'isearch-query-replace
+            :help "Replace search string"
+            :image '(isearch-tool-bar-image "search-replace")))
+    (define-key map [isearch-delete-char]
+      (list 'menu-item "Undo" 'isearch-delete-char
+            :help "Undo last input item"
+            :image '(isearch-tool-bar-image "undo")))
+    (define-key map [isearch-exit]
+      (list 'menu-item "Finish" 'isearch-exit
+            :help "Finish search leaving point where it is"
+            :image '(isearch-tool-bar-image "exit")
+            :visible '(not (string-equal isearch-string ""))))
+    (define-key map [isearch-cancel]
+      (list 'menu-item "Abort" 'isearch-cancel
+            :help "Abort search"
+            :image '(isearch-tool-bar-image "close")
+            :filter (lambda (binding)
+                      (if isearch-success 'isearch-abort binding))))
+    (define-key map [isearch-repeat-forward]
+      (list 'menu-item "Repeat forward" 'isearch-repeat-forward
+            :help "Repeat search forward"
+            :image '(isearch-tool-bar-image "right-arrow")))
+    (define-key map [isearch-repeat-backward]
+      (list 'menu-item "Repeat backward" 'isearch-repeat-backward
+            :help "Repeat search backward"
+            :image '(isearch-tool-bar-image "left-arrow")))
+    map))
+
 (defvar minibuffer-local-isearch-map
   (let ((map (make-sparse-keymap)))
     (set-keymap-parent map minibuffer-local-map)
@@ -695,11 +939,19 @@ Each element is an `isearch--state' struct where the 
slots are
 
 ;; Minor-mode-alist changes - kind of redundant with the
 ;; echo area, but if isearching in multiple windows, it can be useful.
+;; Also, clicking the mode-line indicator pops up
+;; `isearch-menu-bar-map'.
 
 (or (assq 'isearch-mode minor-mode-alist)
     (nconc minor-mode-alist
           (list '(isearch-mode isearch-mode))))
 
+;; We add an entry for `isearch-mode' to `minor-mode-map-alist' so
+;; that `isearch-menu-bar-map' can show on the menu bar.
+(or (assq 'isearch-mode minor-mode-map-alist)
+    (nconc minor-mode-map-alist
+           (list (cons 'isearch-mode isearch-mode-map))))
+
 (defvar-local isearch-mode nil) ;; Name of the minor mode, if non-nil.
 
 (define-key global-map "\C-s" 'isearch-forward)
@@ -725,6 +977,8 @@ Type \\[isearch-exit] to exit, leaving point at location 
found.
 Type LFD (C-j) to match end of line.
 Type \\[isearch-repeat-forward] to search again forward,\
  \\[isearch-repeat-backward] to search again backward.
+Type \\[isearch-beginning-of-buffer] to go to the first match,\
+ \\[isearch-end-of-buffer] to go to the last match.
 Type \\[isearch-yank-word-or-char] to yank next word or character in buffer
   onto the end of the search string, and search for it.
 Type \\[isearch-del-char] to delete character from end of search string.
@@ -854,21 +1108,26 @@ as a regexp.  See the command `isearch-forward-regexp' 
for more information."
   (interactive "P\np")
   (isearch-mode nil (null not-regexp) nil (not no-recursive-edit)))
 
-(defun isearch-forward-symbol-at-point ()
+(defun isearch-forward-symbol-at-point (&optional arg)
   "Do incremental search forward for a symbol found near point.
 Like ordinary incremental search except that the symbol found at point
 is added to the search string initially as a regexp surrounded
 by symbol boundary constructs \\_< and \\_>.
-See the command `isearch-forward-symbol' for more information."
-  (interactive)
+See the command `isearch-forward-symbol' for more information.
+With a prefix argument, search for ARGth symbol forward if ARG is
+positive, or search for ARGth symbol backward if ARG is negative."
+  (interactive "P")
   (isearch-forward-symbol nil 1)
-  (let ((bounds (find-tag-default-bounds)))
+  (let ((bounds (find-tag-default-bounds))
+        (count (and arg (prefix-numeric-value arg))))
     (cond
      (bounds
       (when (< (car bounds) (point))
        (goto-char (car bounds)))
       (isearch-yank-string
-       (buffer-substring-no-properties (car bounds) (cdr bounds))))
+       (buffer-substring-no-properties (car bounds) (cdr bounds)))
+      (when count
+        (isearch-repeat-forward count)))
      (t
       (setq isearch-error "No symbol at point")
       (isearch-push-state)
@@ -940,11 +1199,18 @@ used to set the value of `isearch-regexp-function'."
        isearch-input-method-local-p (local-variable-p 'input-method-function)
        regexp-search-ring-yank-pointer nil
 
+       isearch-pre-scroll-point nil
+       isearch-pre-move-point nil
+
        ;; Save the original value of `minibuffer-message-timeout', and
        ;; set it to nil so that isearch's messages don't get timed out.
        isearch-original-minibuffer-message-timeout minibuffer-message-timeout
        minibuffer-message-timeout nil)
 
+  (if (local-variable-p 'tool-bar-map)
+      (setq isearch-tool-bar-old-map tool-bar-map))
+  (setq-local tool-bar-map isearch-tool-bar-map)
+
   ;; We must bypass input method while reading key.  When a user type
   ;; printable character, appropriate input method is turned on in
   ;; minibuffer to read multibyte characters.
@@ -982,7 +1248,7 @@ used to set the value of `isearch-regexp-function'."
 
   (add-hook 'pre-command-hook 'isearch-pre-command-hook)
   (add-hook 'post-command-hook 'isearch-post-command-hook)
-  (add-hook 'mouse-leave-buffer-hook 'isearch-done)
+  (add-hook 'mouse-leave-buffer-hook 'isearch-mouse-leave-buffer)
   (add-hook 'kbd-macro-termination-hook 'isearch-done)
 
   ;; isearch-mode can be made modal (in the sense of not returning to
@@ -1079,7 +1345,7 @@ NOPUSH is t and EDIT is t."
 
   (remove-hook 'pre-command-hook 'isearch-pre-command-hook)
   (remove-hook 'post-command-hook 'isearch-post-command-hook)
-  (remove-hook 'mouse-leave-buffer-hook 'isearch-done)
+  (remove-hook 'mouse-leave-buffer-hook 'isearch-mouse-leave-buffer)
   (remove-hook 'kbd-macro-termination-hook 'isearch-done)
   (setq isearch-lazy-highlight-start nil)
   (when (buffer-live-p isearch--current-buffer)
@@ -1094,6 +1360,7 @@ NOPUSH is t and EDIT is t."
   (setq minibuffer-message-timeout isearch-original-minibuffer-message-timeout)
   (isearch-dehighlight)
   (lazy-highlight-cleanup lazy-highlight-cleanup)
+  (setq isearch-lazy-highlight-last-string nil)
   (let ((found-start (window-group-start))
        (found-point (point)))
     (when isearch-window-configuration
@@ -1111,6 +1378,12 @@ NOPUSH is t and EDIT is t."
       (setq input-method-function isearch-input-method-function)
     (kill-local-variable 'input-method-function))
 
+  (if isearch-tool-bar-old-map
+      (progn
+        (setq-local tool-bar-map isearch-tool-bar-old-map)
+        (setq isearch-tool-bar-old-map nil))
+    (kill-local-variable 'tool-bar-map))
+
   (force-mode-line-update)
 
   ;; If we ended in the middle of some intangible text,
@@ -1143,6 +1416,19 @@ NOPUSH is t and EDIT is t."
 
   (and (not edit) isearch-recursive-edit (exit-recursive-edit)))
 
+(defvar isearch-mouse-commands '(mouse-minor-mode-menu)
+  "List of mouse commands that are allowed during Isearch.")
+
+(defun isearch-mouse-leave-buffer ()
+  "Exit Isearch unless the mouse command is allowed in Isearch.
+
+Mouse commands are allowed in Isearch if they have a non-nil
+`isearch-scroll' property or if they are listed in
+`isearch-mouse-commands'."
+  (unless (or (memq this-command isearch-mouse-commands)
+              (eq (get this-command 'isearch-scroll) t))
+    (isearch-done)))
+
 (defun isearch-update-ring (string &optional regexp)
   "Add STRING to the beginning of the search ring.
 REGEXP if non-nil says use the regexp search ring."
@@ -1408,7 +1694,11 @@ You can update the global isearch variables by setting 
new values to
 
        ;; Reinvoke the pending search.
        (isearch-search)
-       (isearch-push-state)            ; this pushes the correct state
+        ;; If no code has changed the search parameters, then pushing
+        ;; a new state of Isearch should not be necessary.
+        (unless (and isearch-cmds
+                     (equal (car isearch-cmds) (isearch--get-state)))
+          (isearch-push-state))        ; this pushes the correct state
        (isearch-update)
        (if isearch-nonincremental
            (progn
@@ -1514,8 +1804,8 @@ Use `isearch-exit' to quit without signaling."
       (isearch-pop-state))
     (isearch-update)))
 
-(defun isearch-repeat (direction)
-  ;; Utility for isearch-repeat-forward and -backward.
+(defun isearch-repeat (direction &optional count)
+  ;; Utility for isearch-repeat-forward and isearch-repeat-backward.
   (if (eq isearch-forward (eq direction 'forward))
       ;; C-s in forward or C-r in reverse.
       (if (equal isearch-string "")
@@ -1546,32 +1836,105 @@ Use `isearch-exit' to quit without signaling."
 
   (if (equal isearch-string "")
       (setq isearch-success t)
-    (if (and isearch-success
-            (equal (point) isearch-other-end)
-            (not isearch-just-started))
-       ;; If repeating a search that found
-       ;; an empty string, ensure we advance.
-       (if (if isearch-forward (eobp) (bobp))
-           ;; If there's nowhere to advance to, fail (and wrap next time).
-           (progn
-             (setq isearch-success nil)
-             (ding))
-         (forward-char (if isearch-forward 1 -1))
+    ;; For the case when count > 1, don't keep intermediate states
+    ;; added to isearch-cmds by isearch-push-state in this loop.
+    (let ((isearch-cmds isearch-cmds))
+      (while (<= 0 (setq count (1- (or count 1))))
+       (if (and isearch-success
+                (equal (point) isearch-other-end)
+                (not isearch-just-started))
+           ;; If repeating a search that found
+           ;; an empty string, ensure we advance.
+           (if (if isearch-forward (eobp) (bobp))
+               ;; If there's nowhere to advance to, fail (and wrap next time).
+               (progn
+                 (setq isearch-success nil)
+                 (ding))
+             (forward-char (if isearch-forward 1 -1))
+             (isearch-search))
          (isearch-search))
-      (isearch-search)))
+       (when (> count 0)
+         ;; Update isearch-cmds, so if isearch-search fails later,
+         ;; it can restore old successful state from isearch-cmds.
+         (isearch-push-state))
+       ;; Stop looping on failure.
+       (when (or (not isearch-success) isearch-error)
+         (setq count 0)))))
 
   (isearch-push-state)
   (isearch-update))
 
-(defun isearch-repeat-forward ()
-  "Repeat incremental search forwards."
-  (interactive)
-  (isearch-repeat 'forward))
-
-(defun isearch-repeat-backward ()
-  "Repeat incremental search backwards."
-  (interactive)
-  (isearch-repeat 'backward))
+(defun isearch-repeat-forward (&optional arg)
+  "Repeat incremental search forwards.
+With a numeric argument, repeat the search ARG times.
+A negative argument searches backwards.
+\\<isearch-mode-map>
+This command finds the next relative occurrence of the current
+search string.  To find the absolute occurrence from the beginning
+of the buffer, type \\[isearch-beginning-of-buffer] with a numeric argument."
+  (interactive "P")
+  (if arg
+      (let ((count (prefix-numeric-value arg)))
+        (cond ((< count 0)
+               (isearch-repeat-backward (abs count))
+               ;; Reverse the direction back
+               (isearch-repeat 'forward))
+              (t
+               ;; Take into account one iteration to reverse direction
+               (when (not isearch-forward) (setq count (1+ count)))
+               (isearch-repeat 'forward count))))
+    (isearch-repeat 'forward)))
+
+(defun isearch-repeat-backward (&optional arg)
+  "Repeat incremental search backwards.
+With a numeric argument, repeat the search ARG times.
+A negative argument searches forwards.
+\\<isearch-mode-map>
+This command finds the next relative occurrence of the current
+search string.  To find the absolute occurrence from the end
+of the buffer, type \\[isearch-end-of-buffer] with a numeric argument."
+  (interactive "P")
+  (if arg
+      (let ((count (prefix-numeric-value arg)))
+        (cond ((< count 0)
+               (isearch-repeat-forward (abs count))
+               ;; Reverse the direction back
+               (isearch-repeat 'backward))
+              (t
+               ;; Take into account one iteration to reverse direction
+               (when isearch-forward (setq count (1+ count)))
+               (isearch-repeat 'backward count))))
+    (isearch-repeat 'backward)))
+
+(defun isearch-beginning-of-buffer (&optional arg)
+  "Go to the first occurrence of the current search string.
+Move point to the beginning of the buffer and search forwards from the top.
+\\<isearch-mode-map>
+With a numeric argument, go to the ARGth absolute occurrence counting from
+the beginning of the buffer.  To find the next relative occurrence forwards,
+type \\[isearch-repeat-forward] with a numeric argument."
+  (interactive "p")
+  (if (and arg (< arg 0))
+      (isearch-end-of-buffer (abs arg))
+    ;; For the case when the match is at bobp,
+    ;; don't forward char in isearch-repeat
+    (setq isearch-just-started t)
+    (goto-char (point-min))
+    (isearch-repeat 'forward arg)))
+
+(defun isearch-end-of-buffer (&optional arg)
+  "Go to the last occurrence of the current search string.
+Move point to the end of the buffer and search backwards from the bottom.
+\\<isearch-mode-map>
+With a numeric argument, go to the ARGth absolute occurrence counting from
+the end of the buffer.  To find the next relative occurrence backwards,
+type \\[isearch-repeat-backward] with a numeric argument."
+  (interactive "p")
+  (if (and arg (< arg 0))
+      (isearch-beginning-of-buffer (abs arg))
+    (setq isearch-just-started t)
+    (goto-char (point-max))
+    (isearch-repeat 'backward arg)))
 
 
 ;;; Toggles for `isearch-regexp-function' and `search-default-mode'.
@@ -2357,6 +2720,12 @@ to the barrier."
 (put 'split-window-right 'isearch-scroll t)
 (put 'split-window-below 'isearch-scroll t)
 (put 'enlarge-window 'isearch-scroll t)
+(put 'enlarge-window-horizontally 'isearch-scroll t)
+(put 'shrink-window-horizontally 'isearch-scroll t)
+(put 'shrink-window 'isearch-scroll t)
+;; The next two commands don't exit Isearch in isearch-mouse-leave-buffer
+(put 'mouse-drag-mode-line 'isearch-scroll t)
+(put 'mouse-drag-vertical-line 'isearch-scroll t)
 
 ;; Aliases for split-window-*
 (put 'split-window-vertically 'isearch-scroll t)
@@ -2371,9 +2740,13 @@ to the barrier."
 (defcustom isearch-allow-scroll nil
   "Whether scrolling is allowed during incremental search.
 If non-nil, scrolling commands can be used in Isearch mode.
-However, the current match will never scroll offscreen.
-If nil, scrolling commands will first cancel Isearch mode."
-  :type 'boolean
+However, you cannot scroll far enough that the current match is
+no longer visible (is off screen).  But if the value is `unlimited'
+that limitation is removed and you can scroll any distance off screen.
+If nil, scrolling commands exit Isearch mode."
+  :type '(choice (const :tag "Scrolling exits Isearch" nil)
+                 (const :tag "Scrolling with current match on screen" t)
+                 (const :tag "Scrolling with current match off screen" 
unlimited))
   :group 'isearch)
 
 (defcustom isearch-allow-prefix t
@@ -2437,6 +2810,21 @@ the bottom."
 (defvar isearch-pre-scroll-point nil)
 (defvar isearch-pre-move-point nil)
 
+(defcustom isearch-yank-on-move nil
+  "Motion keys yank text to the search string while you move the cursor.
+If `shift', extend the search string by motion commands while holding down
+the shift key.  The search string is extended by yanking text that
+ends at the new position after moving point in the current buffer.
+If t, extend the search string without the shift key pressed.
+To enable motion commands, put the `isearch-move' property on their
+symbols to `enabled', or to disable an automatically detected
+shift-translated command, use the property value `disabled'."
+  :type '(choice (const :tag "Motion keys exit Isearch" nil)
+                 (const :tag "Motion keys extend the search string" t)
+                 (const :tag "Shifted motion keys extend the search string" 
shift))
+  :group 'isearch
+  :version "27.1")
+
 (defun isearch-pre-command-hook ()
   "Decide whether to exit Isearch mode before executing the command.
 Don't exit Isearch if the key sequence that invoked this command
@@ -2453,7 +2841,12 @@ See more for options in `search-exit-option'."
      ;; `set-transient-map' thingy like `universal-argument--mode'.
      ((not (eq overriding-terminal-local-map 
isearch--saved-overriding-local-map)))
      ;; Don't exit Isearch for isearch key bindings.
-     ((commandp (lookup-key isearch-mode-map key nil)))
+     ((or (commandp (lookup-key isearch-mode-map key nil))
+          (commandp
+           (lookup-key
+            `(keymap (tool-bar menu-item nil ,isearch-tool-bar-map)) key))))
+     ;; Allow key bindings that open a menubar.
+     ((memq this-command isearch-menu-bar-commands))
      ;; Optionally edit the search string instead of exiting.
      ((eq search-exit-option 'edit)
       (setq this-command 'isearch-edit-string))
@@ -2466,7 +2859,8 @@ See more for options in `search-exit-option'."
               (or (eq (get this-command 'isearch-scroll) t)
                   (eq (get this-command 'scroll-command) t))))
       (when isearch-allow-scroll
-       (setq isearch-pre-scroll-point (point))))
+       (unless (eq isearch-allow-scroll 'unlimited)
+          (setq isearch-pre-scroll-point (point)))))
      ;; A mouse click on the isearch message starts editing the search string.
      ((and (eq (car-safe main-event) 'down-mouse-1)
           (window-minibuffer-p (posn-window (event-start main-event))))
@@ -2474,14 +2868,16 @@ See more for options in `search-exit-option'."
       (read-event)
       (setq this-command 'isearch-edit-string))
      ;; Don't terminate the search for motion commands.
-     ((or (and (eq search-exit-option 'move)
-               (symbolp this-command)
-               (or (eq (get this-command 'isearch-move) 'enabled)
-                   (and (not (eq (get this-command 'isearch-move) 'disabled))
-                        (stringp (nth 1 (interactive-form this-command)))
-                        (string-match-p "^^" (nth 1 (interactive-form 
this-command))))))
-          (and (eq search-exit-option 'shift-move)
-               this-command-keys-shift-translated))
+     ((and isearch-yank-on-move
+           (symbolp this-command)
+           (not (eq (get this-command 'isearch-move) 'disabled))
+           (or (eq (get this-command 'isearch-move) 'enabled)
+               (and (eq isearch-yank-on-move t)
+                    (stringp (nth 1 (interactive-form this-command)))
+                    (string-match-p "^\\^"
+                                   (nth 1 (interactive-form this-command))))
+               (and (eq isearch-yank-on-move 'shift)
+                    this-command-keys-shift-translated)))
       (setq this-command-keys-shift-translated nil)
       (setq isearch-pre-move-point (point)))
      ;; Append control characters to the search string
@@ -2495,29 +2891,31 @@ See more for options in `search-exit-option'."
       (isearch-clean-overlays)))))
 
 (defun isearch-post-command-hook ()
-  (cond
-   (isearch-pre-scroll-point
-    (let ((ab-bel (isearch-string-out-of-window isearch-pre-scroll-point)))
-      (if ab-bel
-         (isearch-back-into-window (eq ab-bel 'above) isearch-pre-scroll-point)
-       (goto-char isearch-pre-scroll-point)))
-    (setq isearch-pre-scroll-point nil)
-    (isearch-update))
-   ((memq search-exit-option '(move shift-move))
-    (when (and isearch-pre-move-point
-               (not (eq isearch-pre-move-point (point))))
-      (let ((string (buffer-substring-no-properties
-                     (or isearch-other-end isearch-opoint) (point))))
-        (if isearch-regexp (setq string (regexp-quote string)))
-        (setq isearch-string string)
-        (setq isearch-message (mapconcat 'isearch-text-char-description
-                                         string ""))
-        (setq isearch-yank-flag t)
-        (setq isearch-forward (<= (or isearch-other-end isearch-opoint) 
(point)))
-        (when isearch-forward
-          (goto-char isearch-pre-move-point))
-        (isearch-search-and-update)))
-    (setq isearch-pre-move-point nil))))
+   (when isearch-pre-scroll-point
+     (let ((ab-bel (isearch-string-out-of-window isearch-pre-scroll-point)))
+       (if ab-bel
+          (isearch-back-into-window (eq ab-bel 'above) 
isearch-pre-scroll-point)
+        (goto-char isearch-pre-scroll-point)))
+     (setq isearch-pre-scroll-point nil)
+     (isearch-update))
+   (when (eq isearch-allow-scroll 'unlimited)
+     (when isearch-lazy-highlight
+       (isearch-lazy-highlight-new-loop)))
+   (when isearch-pre-move-point
+     (when (not (eq isearch-pre-move-point (point)))
+       (let ((string (buffer-substring-no-properties
+                      (or isearch-other-end isearch-opoint) (point))))
+         (if isearch-regexp (setq string (regexp-quote string)))
+         (setq isearch-string string)
+         (setq isearch-message (mapconcat 'isearch-text-char-description
+                                          string ""))
+         (setq isearch-yank-flag t)
+         (setq isearch-forward (<= (or isearch-other-end isearch-opoint) 
(point)))
+         (when isearch-forward
+           (goto-char isearch-pre-move-point))
+         (isearch-search-and-update)))
+     (setq isearch-pre-move-point nil))
+  (force-mode-line-update))
 
 (defun isearch-quote-char (&optional count)
   "Quote special characters for incremental search.
@@ -2794,16 +3192,41 @@ the word mode."
                        (concat " [" current-input-method-title "]: "))
                     ": ")
                   )))
-    (propertize (concat (upcase (substring m 0 1)) (substring m 1))
+    (propertize (concat (isearch-lazy-count-format)
+                        (upcase (substring m 0 1)) (substring m 1))
                'face 'minibuffer-prompt)))
 
 (defun isearch-message-suffix (&optional c-q-hack)
   (propertize (concat (if c-q-hack "^Q" "")
-                     (if isearch-error
-                         (concat " [" isearch-error "]")
-                       "")
-                     (or isearch-message-suffix-add ""))
-              'face 'minibuffer-prompt))
+                     (isearch-lazy-count-format 'suffix)
+                     (if isearch-error
+                         (concat " [" isearch-error "]")
+                       "")
+                     (or isearch-message-suffix-add ""))
+             'face 'minibuffer-prompt))
+
+(defun isearch-lazy-count-format (&optional suffix-p)
+  "Format the current match number and the total number of matches.
+When SUFFIX-P is non-nil, the returned string is indended for
+isearch-message-suffix prompt.  Otherwise, for isearch-message-prefix."
+  (let ((format-string (if suffix-p
+                           lazy-count-suffix-format
+                         lazy-count-prefix-format)))
+    (if (and format-string
+             isearch-lazy-count
+             isearch-lazy-count-current
+             (not isearch-error)
+             (not isearch-suspended))
+        (format format-string
+                (if isearch-forward
+                    isearch-lazy-count-current
+                  (if (eq isearch-lazy-count-current 0)
+                      0
+                    (- isearch-lazy-count-total
+                       isearch-lazy-count-current
+                       -1)))
+                (or isearch-lazy-count-total "?"))
+      "")))
 
 
 ;; Searching
@@ -3090,10 +3513,13 @@ Optional third argument, if t, means if fail just 
return nil (no error).
              (setq isearch-hidden t)))))))
 
 (defun isearch-filter-visible (beg end)
-  "Test whether the current search hit is visible at least partially.
-Return non-nil if the text from BEG to END is visible to Isearch as
-determined by `isearch-range-invisible' unless invisible text can be
-searched too when `search-invisible' is t."
+  "Return non-nil if text between BEG and END is deemed visible by Isearch.
+This function is intended to be used as `isearch-filter-predicate'.
+It returns non-nil if the text between BEG and END is visible to
+Isearch, at least partially, as determined by `isearch-range-invisible'.
+If `search-invisible' is t, which allows Isearch matches inside
+invisible text, this function will always return non-nil, regardless
+of what `isearch-range-invisible' says."
   (or (eq search-invisible t)
       (not (isearch-range-invisible beg end))))
 
@@ -3202,6 +3628,10 @@ since they have special meaning in a regexp."
 (defvar isearch-lazy-highlight-window-group nil)
 (defvar isearch-lazy-highlight-window-start nil)
 (defvar isearch-lazy-highlight-window-end nil)
+(defvar isearch-lazy-highlight-window-start-changed nil)
+(defvar isearch-lazy-highlight-window-end-changed nil)
+(defvar isearch-lazy-highlight-point-min nil)
+(defvar isearch-lazy-highlight-point-max nil)
 (defvar isearch-lazy-highlight-buffer nil)
 (defvar isearch-lazy-highlight-case-fold-search nil)
 (defvar isearch-lazy-highlight-regexp nil)
@@ -3212,6 +3642,9 @@ since they have special meaning in a regexp."
 (defvar isearch-lazy-highlight-regexp-function nil)
 (defvar isearch-lazy-highlight-forward nil)
 (defvar isearch-lazy-highlight-error nil)
+(defvar isearch-lazy-count-current nil)
+(defvar isearch-lazy-count-total nil)
+(defvar isearch-lazy-count-hash (make-hash-table))
 
 (defun lazy-highlight-cleanup (&optional force procrastinate)
   "Stop lazy highlighting and remove extra highlighting from current buffer.
@@ -3251,19 +3684,46 @@ by other Emacs features."
                          isearch-lax-whitespace))
                 (not (eq isearch-lazy-highlight-regexp-lax-whitespace
                          isearch-regexp-lax-whitespace))
-                (not (or lazy-highlight-buffer
-                         (= (window-group-start)
-                            isearch-lazy-highlight-window-start)))
-                (not (or lazy-highlight-buffer
-                         (= (window-group-end) ; Window may have been 
split/joined.
-                            isearch-lazy-highlight-window-end)))
                 (not (eq isearch-forward
                          isearch-lazy-highlight-forward))
                 ;; In case we are recovering from an error.
                 (not (equal isearch-error
-                            isearch-lazy-highlight-error))))
+                            isearch-lazy-highlight-error))
+                (if lazy-highlight-buffer
+                    (not (= (point-min)
+                            isearch-lazy-highlight-point-min))
+                  (setq isearch-lazy-highlight-window-start-changed
+                        (not (= (window-group-start)
+                                isearch-lazy-highlight-window-start))))
+                (if lazy-highlight-buffer
+                    (not (= (point-max)
+                            isearch-lazy-highlight-point-max))
+                  (setq isearch-lazy-highlight-window-end-changed
+                        (not (= (window-group-end) ; Window may have been 
split/joined.
+                                isearch-lazy-highlight-window-end))))))
     ;; something important did indeed change
     (lazy-highlight-cleanup t (not (equal isearch-string ""))) ;stop old timer
+    (when isearch-lazy-count
+      (when (or (equal isearch-string "")
+                ;; Check if this place was reached by a condition above
+                ;; other than changed window boundaries (that shouldn't
+                ;; reset the counter)
+                (and (not isearch-lazy-highlight-window-start-changed)
+                     (not isearch-lazy-highlight-window-end-changed))
+                ;; Also check for changes in buffer boundaries in
+                ;; a possibly narrowed buffer in case lazy-highlight-buffer
+                ;; is nil, thus the same check was not performed above
+                (not (= (point-min)
+                        isearch-lazy-highlight-point-min))
+                (not (= (point-max)
+                        isearch-lazy-highlight-point-max)))
+        ;; Reset old counter before going to count new numbers
+        (clrhash isearch-lazy-count-hash)
+        (setq isearch-lazy-count-current nil
+              isearch-lazy-count-total nil)
+        (funcall (or isearch-message-function #'isearch-message))))
+    (setq isearch-lazy-highlight-window-start-changed nil)
+    (setq isearch-lazy-highlight-window-end-changed nil)
     (setq isearch-lazy-highlight-error isearch-error)
     ;; It used to check for `(not isearch-error)' here, but actually
     ;; lazy-highlighting might find matches to highlight even when
@@ -3274,6 +3734,8 @@ by other Emacs features."
           isearch-lazy-highlight-window-group (selected-window-group)
          isearch-lazy-highlight-window-start (window-group-start)
          isearch-lazy-highlight-window-end   (window-group-end)
+         isearch-lazy-highlight-point-min    (point-min)
+         isearch-lazy-highlight-point-max    (point-max)
          isearch-lazy-highlight-buffer       lazy-highlight-buffer
          ;; Start lazy-highlighting at the beginning of the found
          ;; match (`isearch-other-end').  If no match, use point.
@@ -3305,7 +3767,16 @@ by other Emacs features."
     (unless (equal isearch-string "")
       (setq isearch-lazy-highlight-timer
             (run-with-idle-timer lazy-highlight-initial-delay nil
-                                 'isearch-lazy-highlight-start)))))
+                                 'isearch-lazy-highlight-start))))
+  ;; Update the current match number only in isearch-mode and
+  ;; unless isearch-mode is used specially with isearch-message-function
+  (when (and isearch-lazy-count isearch-mode (null isearch-message-function))
+    ;; Update isearch-lazy-count-current only when it was already set
+    ;; at the end of isearch-lazy-highlight-buffer-update
+    (when isearch-lazy-count-current
+      (setq isearch-lazy-count-current
+            (gethash (point) isearch-lazy-count-hash 0))
+      (isearch-message))))
 
 (defun isearch-lazy-highlight-search (string bound)
   "Search ahead for the next or previous match, for lazy highlighting.
@@ -3426,7 +3897,8 @@ Attempt to do the search exactly the way the pending 
Isearch would."
                        (goto-char (min (or isearch-lazy-highlight-end-limit 
(point-max))
                                        window-end)))))))
            (if nomore
-               (when isearch-lazy-highlight-buffer
+               (when (or isearch-lazy-highlight-buffer
+                         (and isearch-lazy-count (null 
isearch-lazy-count-current)))
                  (if isearch-lazy-highlight-forward
                      (setq isearch-lazy-highlight-end (point-min))
                    (setq isearch-lazy-highlight-start (point-max)))
@@ -3440,7 +3912,8 @@ Attempt to do the search exactly the way the pending 
Isearch would."
   "Update highlighting of other matches in the full buffer."
   (let ((max lazy-highlight-buffer-max-at-a-time)
         (looping t)
-        nomore window-start window-end)
+        nomore window-start window-end
+        (opoint (point)))
     (with-local-quit
       (save-selected-window
        (if (and (window-live-p isearch-lazy-highlight-window)
@@ -3475,8 +3948,18 @@ Attempt to do the search exactly the way the pending 
Isearch would."
                            (if (= mb (point-min))
                                (setq found nil)
                              (forward-char -1)))
-                       ;; Already highlighted by isearch-lazy-highlight-update
-                       (unless (and (>= mb window-start) (<= me window-end))
+                       (when isearch-lazy-count
+                         (setq isearch-lazy-count-total
+                               (1+ (or isearch-lazy-count-total 0)))
+                         (puthash (if isearch-lazy-highlight-forward me mb)
+                                  isearch-lazy-count-total
+                                  isearch-lazy-count-hash))
+                       ;; Don't highlight the match when this loop is used
+                       ;; only to count matches or when matches were already
+                       ;; highlighted within the current window boundaries
+                       ;; by isearch-lazy-highlight-update
+                       (unless (or (not isearch-lazy-highlight-buffer)
+                                   (and (>= mb window-start) (<= me 
window-end)))
                          ;; non-zero-length match
                          (isearch-lazy-highlight-match mb me)))
                      ;; Remember the current position of point for
@@ -3490,7 +3973,13 @@ Attempt to do the search exactly the way the pending 
Isearch would."
                (if (not found)
                    (setq looping nil
                          nomore  t))))
-           (unless nomore
+           (if nomore
+               (when (and isearch-lazy-count isearch-mode (null 
isearch-message-function))
+                 (unless isearch-lazy-count-total
+                   (setq isearch-lazy-count-total 0))
+                 (setq isearch-lazy-count-current
+                       (gethash opoint isearch-lazy-count-hash 0))
+                 (isearch-message))
              (setq isearch-lazy-highlight-timer
                    (run-at-time lazy-highlight-interval nil
                                 'isearch-lazy-highlight-buffer-update)))))))))
diff --git a/lisp/isearchb.el b/lisp/isearchb.el
index 87922ca..ee392b3 100644
--- a/lisp/isearchb.el
+++ b/lisp/isearchb.el
@@ -1,6 +1,6 @@
 ;;; isearchb --- a marriage between iswitchb and isearch
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/jit-lock.el b/lisp/jit-lock.el
index 2b13c60..48998a8 100644
--- a/lisp/jit-lock.el
+++ b/lisp/jit-lock.el
@@ -1,6 +1,6 @@
 ;;; jit-lock.el --- just-in-time fontification  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Gerd Moellmann <address@hidden>
 ;; Keywords: faces files
diff --git a/lisp/jka-cmpr-hook.el b/lisp/jka-cmpr-hook.el
index d800b60..3aa84f4 100644
--- a/lisp/jka-cmpr-hook.el
+++ b/lisp/jka-cmpr-hook.el
@@ -1,6 +1,6 @@
 ;;; jka-cmpr-hook.el --- preloaded code to enable jka-compr.el
 
-;; Copyright (C) 1993-1995, 1997, 1999-2000, 2002-2018 Free Software
+;; Copyright (C) 1993-1995, 1997, 1999-2000, 2002-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Jay K. Adams <address@hidden>
diff --git a/lisp/jka-compr.el b/lisp/jka-compr.el
index bb43e88..63fb449 100644
--- a/lisp/jka-compr.el
+++ b/lisp/jka-compr.el
@@ -1,6 +1,6 @@
 ;;; jka-compr.el --- reading/writing/loading compressed files
 
-;; Copyright (C) 1993-1995, 1997, 1999-2018 Free Software Foundation,
+;; Copyright (C) 1993-1995, 1997, 1999-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Jay K. Adams <address@hidden>
diff --git a/lisp/json.el b/lisp/json.el
index 112f269..44b3c33 100644
--- a/lisp/json.el
+++ b/lisp/json.el
@@ -1,6 +1,6 @@
 ;;; json.el --- JavaScript Object Notation parser / generator -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Theresa O'Connor <address@hidden>
 ;; Version: 1.4
@@ -49,10 +49,13 @@
 ;; 2008-02-21 - Installed in GNU Emacs.
 ;; 2011-10-17 - Patch `json-alist-p' and `json-plist-p' to avoid recursion -tzz
 ;; 2012-10-25 - Added pretty-printed reformatting -Ryan Crum (address@hidden)
+;; 2019-02-02 - Pretty-printing now uses replace-region-contents and support 
for
+;;              minimization -tsdh
 
 ;;; Code:
 
 (require 'map)
+(require 'subr-x)
 
 ;; Parameters
 
@@ -523,8 +526,8 @@ Please see the documentation of `json-object-type' and 
`json-key-type'."
     ;; Skip over the "}"
     (json-advance)
     (pcase json-object-type
-      (`alist (nreverse elements))
-      (`plist (json--plist-reverse elements))
+      ('alist (nreverse elements))
+      ('plist (json--plist-reverse elements))
       (_ elements))))
 
 ;; Hash table encoding
@@ -641,8 +644,8 @@ become JSON objects."
     ;; Skip over the "]"
     (json-advance)
     (pcase json-array-type
-      (`vector (nreverse (vconcat elements)))
-      (`list (nreverse elements)))))
+      ('vector (nreverse (vconcat elements)))
+      ('list (nreverse elements)))))
 
 ;; Array encoding
 
@@ -730,36 +733,50 @@ Advances point just past JSON object."
         ((hash-table-p object) (json-encode-hash-table object))
         (t                     (signal 'json-error (list object)))))
 
-;; Pretty printing
-
-(defun json-pretty-print-buffer ()
-  "Pretty-print current buffer."
-  (interactive)
-  (json-pretty-print (point-min) (point-max)))
-
-(defun json-pretty-print (begin end)
-  "Pretty-print selected region."
-  (interactive "r")
-  (atomic-change-group
-    (let ((json-encoding-pretty-print t)
-          ;; Distinguish an empty objects from 'null'
-          (json-null :json-null)
-          ;; Ensure that ordering is maintained
-          (json-object-type 'alist)
-          (txt (delete-and-extract-region begin end)))
-      (insert (json-encode (json-read-from-string txt))))))
-
-(defun json-pretty-print-buffer-ordered ()
-  "Pretty-print current buffer with object keys ordered."
-  (interactive)
+;; Pretty printing & minimizing
+
+(defun json-pretty-print-buffer (&optional minimize)
+  "Pretty-print current buffer.
+With prefix argument MINIMIZE, minimize it instead."
+  (interactive "P")
+  (json-pretty-print (point-min) (point-max) minimize))
+
+(defvar json-pretty-print-max-secs 2.0
+  "Maximum time for `json-pretty-print's comparison.
+The function `json-pretty-print' uses `replace-region-contents'
+(which see) passing the value of this variable as argument
+MAX-SECS.")
+
+(defun json-pretty-print (begin end &optional minimize)
+  "Pretty-print selected region.
+With prefix argument MINIMIZE, minimize it instead."
+  (interactive "r\nP")
+  (let ((json-encoding-pretty-print (null minimize))
+        ;; Distinguish an empty objects from 'null'
+        (json-null :json-null)
+        ;; Ensure that ordering is maintained
+        (json-object-type 'alist))
+    (replace-region-contents
+     begin end
+     (lambda () (json-encode (json-read)))
+     json-pretty-print-max-secs
+     ;; FIXME: What's a good value here?  Can we use something better,
+     ;; e.g., by deriving a value from the size of the region?
+     64)))
+
+(defun json-pretty-print-buffer-ordered (&optional minimize)
+  "Pretty-print current buffer with object keys ordered.
+With prefix argument MINIMIZE, minimize it instead."
+  (interactive "P")
   (let ((json-encoding-object-sort-predicate 'string<))
-    (json-pretty-print-buffer)))
+    (json-pretty-print-buffer minimize)))
 
-(defun json-pretty-print-ordered (begin end)
-  "Pretty-print the region with object keys ordered."
-  (interactive "r")
+(defun json-pretty-print-ordered (begin end &optional minimize)
+  "Pretty-print the region with object keys ordered.
+With prefix argument MINIMIZE, minimize it instead."
+  (interactive "r\nP")
   (let ((json-encoding-object-sort-predicate 'string<))
-    (json-pretty-print begin end)))
+    (json-pretty-print begin end minimize)))
 
 (provide 'json)
 
diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index 14d730a..c02e685 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -1,12 +1,12 @@
 ;;; jsonrpc.el --- JSON-RPC library                  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: João Távora <address@hidden>
 ;; Maintainer: João Távora <address@hidden>
 ;; Keywords: processes, languages, extensions
 ;; Package-Requires: ((emacs "25.2"))
-;; Version: 1.0.6
+;; Version: 1.0.7
 
 ;; This is an Elpa :core package.  Don't use functionality that is not
 ;; compatible with Emacs 25.2.
@@ -184,7 +184,7 @@ dispatcher in CONNECTION."
                                                    (cdr oops))
                                         "Internal error")))))
                   (error
-                   `(:error (:code -32603 :message "Internal error"))))))
+                   '(:error (:code -32603 :message "Internal error"))))))
           (apply #'jsonrpc--reply connection id reply)))
        (;; A remote notification
         method
@@ -421,13 +421,13 @@ connection object, called when the process dies .")
 With optional CLEANUP, kill any associated buffers. "
   (unwind-protect
       (cl-loop
-       with proc = (jsonrpc--process conn)
+       with proc = (jsonrpc--process conn) for i from 0
+       while (not (process-get proc 'jsonrpc-sentinel-cleanup-started))
+       unless (zerop i) do
+       (jsonrpc--warn "Sentinel for %s still hasn't run,  deleting it!" proc)
        do
        (delete-process proc)
-       (accept-process-output nil 0.1)
-       while (not (process-get proc 'jsonrpc-sentinel-done))
-       do (jsonrpc--warn
-           "Sentinel for %s still hasn't run,  deleting it!" proc))
+       (accept-process-output nil 0.1))
     (when cleanup
       (kill-buffer (process-buffer (jsonrpc--process conn)))
       (kill-buffer (jsonrpc-stderr-buffer conn)))))
@@ -486,14 +486,14 @@ With optional CLEANUP, kill any associated buffers. "
                  (pcase-let ((`(,_success ,_error ,timeout) triplet))
                    (when timeout (cancel-timer timeout))))
                (jsonrpc--request-continuations connection))
+      (process-put proc 'jsonrpc-sentinel-cleanup-started t)
       (unwind-protect
           ;; Call all outstanding error handlers
           (maphash (lambda (_id triplet)
                      (pcase-let ((`(,_success ,error ,_timeout) triplet))
-                       (funcall error `(:code -1 :message "Server died"))))
+                       (funcall error '(:code -1 :message "Server died"))))
                    (jsonrpc--request-continuations connection))
         (jsonrpc--message "Server exited with status %s" (process-exit-status 
proc))
-        (process-put proc 'jsonrpc-sentinel-done t)
         (delete-process proc)
         (funcall (jsonrpc--on-shutdown connection) connection)))))
 
diff --git a/lisp/kermit.el b/lisp/kermit.el
index 8108fca..f6ed1fb 100644
--- a/lisp/kermit.el
+++ b/lisp/kermit.el
@@ -1,6 +1,6 @@
 ;;; kermit.el --- additions to shell mode for use with kermit
 
-;; Copyright (C) 1988, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Jeff Norden <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/kmacro.el b/lisp/kmacro.el
index 08a27ae..fc34e16 100644
--- a/lisp/kmacro.el
+++ b/lisp/kmacro.el
@@ -1,6 +1,6 @@
 ;;; kmacro.el --- enhanced keyboard macros -*- lexical-binding: t -*-
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Kim F. Storm <address@hidden>
 ;; Keywords: keyboard convenience
@@ -256,7 +256,10 @@ Can be set directly via `kmacro-set-format', which see.")
 (defun kmacro-insert-counter (arg)
   "Insert current value of `kmacro-counter', then increment it by ARG.
 Interactively, ARG defaults to 1.  With \\[universal-argument], insert
-current value of `kmacro-counter', but do not increment it."
+the previous value of `kmacro-counter', and do not increment the
+current value.
+The previous value of the counter is the one it had before
+the last increment."
   (interactive "P")
   (if kmacro-initial-counter-value
       (setq kmacro-counter kmacro-initial-counter-value
@@ -685,9 +688,10 @@ the current value of `kmacro-counter').
 
 When used during defining/executing a macro, inserts the current value
 of `kmacro-counter' and increments the counter value by ARG (or by 1 if no
-prefix argument).  With just \\[universal-argument], inserts the current value
-of `kmacro-counter', but does not modify the counter; this is the
-same as incrementing the counter by zero.
+prefix argument).  With just \\[universal-argument], inserts the previous
+value of `kmacro-counter', and does not modify the counter; this is
+different from incrementing the counter by zero.  (The previous value
+of the counter is the one it had before the last increment.)
 
 The macro counter can be set directly via \\[kmacro-set-counter] and 
\\[kmacro-add-counter].
 The format of the inserted value of the counter can be controlled
diff --git a/lisp/language/china-util.el b/lisp/language/china-util.el
index 3004d5f..1638565 100644
--- a/lisp/language/china-util.el
+++ b/lisp/language/china-util.el
@@ -1,6 +1,6 @@
 ;;; china-util.el --- utilities for Chinese  -*- coding: utf-8 -*-
 
-;; Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -168,7 +168,7 @@ Return the length of resulting text."
              ;; ESC ESC -> ESC
              (delete-char 1)
            (forward-char -1)
-           (if (looking-at iso2022-gb-designation)
+           (if (looking-at "\e\\$A")
                (progn
                  (delete-region (match-beginning 0) (match-end 0))
                  (insert hz-gb-designation)
diff --git a/lisp/language/chinese.el b/lisp/language/chinese.el
index af9ff63..5f8dea5 100644
--- a/lisp/language/chinese.el
+++ b/lisp/language/chinese.el
@@ -1,6 +1,6 @@
 ;;; chinese.el --- support for Chinese -*- coding: utf-8; -*-
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/cyril-util.el b/lisp/language/cyril-util.el
index a86ce2d..2db320c 100644
--- a/lisp/language/cyril-util.el
+++ b/lisp/language/cyril-util.el
@@ -1,6 +1,6 @@
 ;;; cyril-util.el --- utilities for Cyrillic scripts
 
-;; Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Keywords: mule, multilingual, Cyrillic
 
diff --git a/lisp/language/cyrillic.el b/lisp/language/cyrillic.el
index 0fcabef..75d4249 100644
--- a/lisp/language/cyrillic.el
+++ b/lisp/language/cyrillic.el
@@ -1,6 +1,6 @@
 ;;; cyrillic.el --- support for Cyrillic -*- coding: utf-8; -*-
 
-;; Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -95,7 +95,7 @@
 (define-coding-system-alias 'cp878 'cyrillic-koi8)
 
 (set-language-info-alist
- "Cyrillic-KOI8" `((charset koi8)
+ "Cyrillic-KOI8" '((charset koi8)
                   (coding-system cyrillic-koi8)
                   (coding-priority cyrillic-koi8 cyrillic-iso-8bit)
                   (ctext-non-standard-encodings "koi8-r")
@@ -131,7 +131,7 @@ Support for Russian using koi8-r and the russian-computer 
input method.")
   :mime-charset 'koi8-u)
 
 (set-language-info-alist
- "Ukrainian" `((charset koi8-u)
+ "Ukrainian" '((charset koi8-u)
               (coding-system koi8-u)
               (coding-priority koi8-u)
               (nonascii-translation . koi8-u)
@@ -151,7 +151,7 @@ Support for Russian using koi8-r and the russian-computer 
input method.")
 (define-coding-system-alias 'alternativnyj 'cyrillic-alternativnyj)
 
 (set-language-info-alist
- "Cyrillic-ALT" `((charset alternativnyj)
+ "Cyrillic-ALT" '((charset alternativnyj)
                  (coding-system cyrillic-alternativnyj)
                  (coding-priority cyrillic-alternativnyj)
                  (nonascii-translation . alternativnyj)
@@ -229,7 +229,7 @@ Support for Russian using koi8-r and the russian-computer 
input method.")
 ;;  '("Cyrillic"))
 
 (set-language-info-alist
- "Tajik" `((coding-system koi8-t)
+ "Tajik" '((coding-system koi8-t)
           (coding-priority koi8-t)
           (nonascii-translation . cyrillic-koi8-t)
           (charset koi8-t)
@@ -239,7 +239,7 @@ Support for Russian using koi8-r and the russian-computer 
input method.")
  '("Cyrillic"))
 
 (set-language-info-alist
- "Bulgarian" `((coding-system windows-1251)
+ "Bulgarian" '((coding-system windows-1251)
               (coding-priority windows-1251)
               (nonascii-translation . windows-1251)
               (charset windows-1251)
@@ -250,7 +250,7 @@ Support for Russian using koi8-r and the russian-computer 
input method.")
  '("Cyrillic"))
 
 (set-language-info-alist
- "Belarusian" `((coding-system windows-1251)
+ "Belarusian" '((coding-system windows-1251)
                (coding-priority windows-1251)
                (nonascii-translation . windows-1251)
                (charset windows-1251)
@@ -262,7 +262,7 @@ Support for Russian using koi8-r and the russian-computer 
input method.")
  '("Cyrillic"))
 
 (set-language-info-alist
- "Ukrainian" `((coding-system koi8-u)
+ "Ukrainian" '((coding-system koi8-u)
               (coding-priority koi8-u)
               (input-method . "ukrainian-computer")
               (documentation
diff --git a/lisp/language/czech.el b/lisp/language/czech.el
index 7d1c6db..b43d956 100644
--- a/lisp/language/czech.el
+++ b/lisp/language/czech.el
@@ -1,6 +1,6 @@
 ;;; czech.el --- support for Czech -*- coding: utf-8 -*-
 
-;; Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Milan Zamazal <address@hidden>
 ;; Maintainer: Pavel Janík <address@hidden>
diff --git a/lisp/language/english.el b/lisp/language/english.el
index 72a85eb..09ed423 100644
--- a/lisp/language/english.el
+++ b/lisp/language/english.el
@@ -1,6 +1,6 @@
 ;;; english.el --- support for English
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -62,6 +62,14 @@ Nothing special is needed to handle English.")
   :mnemonic ?*)
 (define-coding-system-alias 'cp1047 'ibm1047)
 
+(define-coding-system 'ibm038
+  "International version of EBCDIC"
+  :coding-type 'charset
+  :charset-list '(ibm038)
+  :mnemonic ?*)
+(define-coding-system-alias 'ebcdic-int 'ibm038)
+(define-coding-system-alias 'cp038 'ibm038)
+
 ;; Make "ASCII" an alias of "English" language environment.
 (set-language-info-alist
  "ASCII" (cdr (assoc "English" language-info-alist)))
diff --git a/lisp/language/ethio-util.el b/lisp/language/ethio-util.el
index 1ea0168..04b15dd 100644
--- a/lisp/language/ethio-util.el
+++ b/lisp/language/ethio-util.el
@@ -1,6 +1,6 @@
 ;;; ethio-util.el --- utilities for Ethiopic   -*- coding: utf-8-emacs; -*-
 
-;; Copyright (C) 1997-1998, 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2002-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -804,7 +804,7 @@ The 2nd and 3rd arguments BEGIN and END specify the region."
 
     ;; Special Ethiopic punctuation.
     (goto-char (point-min))
-    (while (re-search-forward "\\ce[»\\.\\?]\\|«\\ce" nil t)
+    (while (re-search-forward "\\ce[».?]\\|«\\ce" nil t)
       (cond
        ((= (setq ch (preceding-char)) ?\»)
        (delete-char -1)
diff --git a/lisp/language/ethiopic.el b/lisp/language/ethiopic.el
index 1e59cbf..52d1fb0 100644
--- a/lisp/language/ethiopic.el
+++ b/lisp/language/ethiopic.el
@@ -1,6 +1,6 @@
 ;;; ethiopic.el --- support for Ethiopic       -*- coding: utf-8-emacs; -*-
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/european.el b/lisp/language/european.el
index 4a89770..8c38175 100644
--- a/lisp/language/european.el
+++ b/lisp/language/european.el
@@ -1,6 +1,6 @@
 ;;; european.el --- support for European languages -*- coding: utf-8; -*-
 
-;; Copyright (C) 1997-1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -541,7 +541,7 @@ method and applying Turkish case rules for the characters 
i, I, ı, İ.")))
  '("European"))
 
 (set-language-info-alist
- "Welsh" `((coding-system utf-8 latin-8) ; the input method is Unicode-based
+ "Welsh" '((coding-system utf-8 latin-8) ; the input method is Unicode-based
           (coding-priority utf-8 latin-8)
           (nonascii-translation . iso-8859-14)
           (input-method . "welsh")
@@ -558,7 +558,7 @@ method and applying Turkish case rules for the characters 
i, I, ı, İ.")))
  '("European"))
 
 (set-language-info-alist
- "Latin-7" `((coding-system latin-7)
+ "Latin-7" '((coding-system latin-7)
             (coding-priority latin-7)
             (nonascii-translation . iso-8859-13)
             (input-method . "latin-prefix")
@@ -566,7 +566,7 @@ method and applying Turkish case rules for the characters 
i, I, ı, İ.")))
  '("European"))
 
 (set-language-info-alist
- "Lithuanian" `((coding-system latin-7 windows-1257)
+ "Lithuanian" '((coding-system latin-7 windows-1257)
                (coding-priority latin-7)
                (nonascii-translation . iso-8859-13)
                (input-method . "lithuanian-keyboard")
@@ -574,7 +574,7 @@ method and applying Turkish case rules for the characters 
i, I, ı, İ.")))
  '("European"))
 
 (set-language-info-alist
- "Latvian" `((coding-system latin-7 windows-1257)
+ "Latvian" '((coding-system latin-7 windows-1257)
             (coding-priority latin-7)
             (nonascii-translation . iso-8859-13)
             (input-method . "latvian-keyboard")
diff --git a/lisp/language/georgian.el b/lisp/language/georgian.el
index e50ebce..2c3d3fb 100644
--- a/lisp/language/georgian.el
+++ b/lisp/language/georgian.el
@@ -1,6 +1,6 @@
 ;;; georgian.el --- language support for Georgian
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;; Keywords: i18n
@@ -37,7 +37,7 @@
   :charset-list '(georgian-academy))
 
 (set-language-info-alist
- "Georgian" `((coding-system georgian-ps)
+ "Georgian" '((coding-system georgian-ps)
              (coding-priority georgian-ps)
              (input-method . "georgian")
              (nonascii-translation . georgian-ps)
diff --git a/lisp/language/greek.el b/lisp/language/greek.el
index 7408bef..bb5cdbf 100644
--- a/lisp/language/greek.el
+++ b/lisp/language/greek.el
@@ -1,6 +1,6 @@
 ;;; greek.el --- support for Greek
 
-;; Copyright (C) 2002, 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002, 2013-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/hanja-util.el b/lisp/language/hanja-util.el
index 97189b8..0c7ed51 100644
--- a/lisp/language/hanja-util.el
+++ b/lisp/language/hanja-util.el
@@ -1,6 +1,6 @@
 ;;; hanja-util.el --- Korean Hanja util module  -*- coding: utf-8 -*-
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Jihyun Cho <address@hidden>
 ;; Keywords: multilingual, input method, Korean, Hanja
diff --git a/lisp/language/hebrew.el b/lisp/language/hebrew.el
index c004337..ca3058b 100644
--- a/lisp/language/hebrew.el
+++ b/lisp/language/hebrew.el
@@ -1,6 +1,6 @@
 ;;; hebrew.el --- support for Hebrew -*- coding: utf-8 -*-
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/ind-util.el b/lisp/language/ind-util.el
index 85e9918..9b4af19 100644
--- a/lisp/language/ind-util.el
+++ b/lisp/language/ind-util.el
@@ -1,6 +1,6 @@
 ;;; ind-util.el --- Transliteration and Misc. Tools for Indian Languages -*- 
coding: utf-8-emacs; -*-
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer:  KAWABATA, Taichi <address@hidden>
 ;; Keywords: multilingual, Indian, Devanagari
diff --git a/lisp/language/indian.el b/lisp/language/indian.el
index e4f8ba5..d63e9b4 100644
--- a/lisp/language/indian.el
+++ b/lisp/language/indian.el
@@ -1,6 +1,6 @@
 ;;; indian.el --- Indian languages support -*- coding: utf-8; -*-
 
-;; Copyright (C) 1997, 1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
diff --git a/lisp/language/japan-util.el b/lisp/language/japan-util.el
index 19ef063..b1eb3d9 100644
--- a/lisp/language/japan-util.el
+++ b/lisp/language/japan-util.el
@@ -1,6 +1,6 @@
-;;; japan-util.el --- utilities for Japanese -*- coding: iso-2022-7bit; -*-
+;;; japan-util.el --- utilities for Japanese
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -29,36 +29,34 @@
 
 ;;;###autoload
 (defun setup-japanese-environment-internal ()
-  ;; By default, we use 'japanese-iso-8bit for file names.  But, the
-  ;; following prefer-coding-system will override it.
-  (if (memq system-type '(windows-nt ms-dos cygwin))
-      (prefer-coding-system 'japanese-shift-jis)
-    (prefer-coding-system 'japanese-iso-8bit))
+  (prefer-coding-system (if (memq system-type '(windows-nt ms-dos cygwin))
+                           'japanese-shift-jis
+                         'utf-8))
   (use-cjk-char-width-table 'ja_JP))
 
 (defconst japanese-kana-table
-  '((?$B$"(B ?$B%"(B ?(I1(B) (?$B$$(B ?$B%$(B ?(I2(B) (?$B$&(B 
?$B%&(B ?(I3(B) (?$B$((B ?$B%((B ?(I4(B) (?$B$*(B ?$B%*(B 
?(I5(B)
-    (?$B$+(B ?$B%+(B ?(I6(B) (?$B$-(B ?$B%-(B ?(I7(B) (?$B$/(B 
?$B%/(B ?(I8(B) (?$B$1(B ?$B%1(B ?(I9(B) (?$B$3(B ?$B%3(B 
?(I:(B)
-    (?$B$5(B ?$B%5(B ?(I;(B) (?$B$7(B ?$B%7(B ?(I<(B) (?$B$9(B 
?$B%9(B ?(I=(B) (?$B$;(B ?$B%;(B ?(I>(B) (?$B$=(B ?$B%=(B 
?(I?(B)
-    (?$B$?(B ?$B%?(B ?(address@hidden(B) (?$B$A(B ?$B%A(B ?(IA(B) 
(?$B$D(B ?$B%D(B ?(IB(B) (?$B$F(B ?$B%F(B ?(IC(B) (?$B$H(B 
?$B%H(B ?(ID(B)
-    (?$B$J(B ?$B%J(B ?(IE(B) (?$B$K(B ?$B%K(B ?(IF(B) (?$B$L(B 
?$B%L(B ?(IG(B) (?$B$M(B ?$B%M(B ?(IH(B) (?$B$N(B ?$B%N(B 
?(II(B)
-    (?$B$O(B ?$B%O(B ?(IJ(B) (?$B$R(B ?$B%R(B ?(IK(B) (?$B$U(B 
?$B%U(B ?(IL(B) (?$B$X(B ?$B%X(B ?(IM(B) (?$B$[(B ?$B%[(B 
?(IN(B)
-    (?$B$^(B ?$B%^(B ?(IO(B) (?$B$_(B ?$B%_(B ?(IP(B) (?$B$`(B 
?$B%`(B ?(IQ(B) (?$B$a(B ?$B%a(B ?(IR(B) (?$B$b(B ?$B%b(B 
?(IS(B)
-    (?$B$d(B ?$B%d(B ?(IT(B) (?$B$f(B ?$B%f(B ?(IU(B) (?$B$h(B 
?$B%h(B ?(IV(B)
-    (?$B$i(B ?$B%i(B ?(IW(B) (?$B$j(B ?$B%j(B ?(IX(B) (?$B$k(B 
?$B%k(B ?(IY(B) (?$B$l(B ?$B%l(B ?(IZ(B) (?$B$m(B ?$B%m(B 
?(I[(B)
-    (?$B$o(B ?$B%o(B ?(I\(B) (?$B$p(B ?$B%p(B "(I2(B") (?$B$q(B 
?$B%q(B "(I4(B") (?$B$r(B ?$B%r(B ?(I&(B)
-    (?$B$s(B ?$B%s(B ?(I](B)
-    (?$B$,(B ?$B%,(B "(I6^(B") (?$B$.(B ?$B%.(B "(I7^(B") 
(?$B$0(B ?$B%0(B "(I8^(B") (?$B$2(B ?$B%2(B "(I9^(B") (?$B$4(B 
?$B%4(B "(I:^(B")
-    (?$B$6(B ?$B%6(B "(I;^(B") (?$B$8(B ?$B%8(B "(I<^(B") 
(?$B$:(B ?$B%:(B "(I=^(B") (?$B$<(B ?$B%<(B "(I>^(B") (?$B$>(B 
?$B%>(B "(I?^(B")
-    (address@hidden(B address@hidden(B "(address@hidden(B") (?$B$B(B 
?$B%B(B "(IA^(B") (?$B$E(B ?$B%E(B "(IB^(B") (?$B$G(B ?$B%G(B 
"(IC^(B") (?$B$I(B ?$B%I(B "(ID^(B")
-    (?$B$P(B ?$B%P(B "(IJ^(B") (?$B$S(B ?$B%S(B "(IK^(B") 
(?$B$V(B ?$B%V(B "(IL^(B") (?$B$Y(B ?$B%Y(B "(IM^(B") (?$B$\(B 
?$B%\(B "(IN^(B")
-    (?$B$Q(B ?$B%Q(B "(IJ_(B") (?$B$T(B ?$B%T(B "(IK_(B") 
(?$B$W(B ?$B%W(B "(IL_(B") (?$B$Z(B ?$B%Z(B "(IM_(B") (?$B$](B 
?$B%](B "(IN_(B")
-    (?$B$!(B ?$B%!(B ?(I'(B) (?$B$#(B ?$B%#(B ?(I((B) (?$B$%(B 
?$B%%(B ?(I)(B) (?$B$'(B ?$B%'(B ?(I*(B) (?$B$)(B ?$B%)(B 
?(I+(B)
-    (?$B$C(B ?$B%C(B ?(I/(B)
-    (?$B$c(B ?$B%c(B ?(I,(B) (?$B$e(B ?$B%e(B ?(I-(B) (?$B$g(B 
?$B%g(B ?(I.(B)
-    (?$B$n(B ?$B%n(B "(I\(B")
-    (?$B!5(B ?$B!3(B) (?$B!6(B ?$B!4(B)
-    ("$B$&!+(B" ?$B%t(B "(I3^(B") (nil ?$B%u(B "(I6(B") (nil 
?$B%v(B "(I9(B"))
+  '((?あ ?ア ?ア) (?い ?イ ?イ) (?う ?ウ ?ウ) (?え ?エ ?エ) (?お ?オ ?オ)
+    (?か ?カ ?カ) (?き ?キ ?キ) (?く ?ク ?ク) (?け ?ケ ?ケ) (?こ ?コ ?コ)
+    (?さ ?サ ?サ) (?し ?シ ?シ) (?す ?ス ?ス) (?せ ?セ ?セ) (?そ ?ソ ?ソ)
+    (?た ?タ ?タ) (?ち ?チ ?チ) (?つ ?ツ ?ツ) (?て ?テ ?テ) (?と ?ト ?ト)
+    (?な ?ナ ?ナ) (?に ?ニ ?ニ) (?ぬ ?ヌ ?ヌ) (?ね ?ネ ?ネ) (?の ?ノ ?ノ)
+    (?は ?ハ ?ハ) (?ひ ?ヒ ?ヒ) (?ふ ?フ ?フ) (?へ ?ヘ ?ヘ) (?ほ ?ホ ?ホ)
+    (?ま ?マ ?マ) (?み ?ミ ?ミ) (?む ?ム ?ム) (?め ?メ ?メ) (?も ?モ ?モ)
+    (?や ?ヤ ?ヤ) (?ゆ ?ユ ?ユ) (?よ ?ヨ ?ヨ)
+    (?ら ?ラ ?ラ) (?り ?リ ?リ) (?る ?ル ?ル) (?れ ?レ ?レ) (?ろ ?ロ ?ロ)
+    (?わ ?ワ ?ワ) (?ゐ ?ヰ "イ") (?ゑ ?ヱ "エ") (?を ?ヲ ?ヲ)
+    (?ん ?ン ?ン)
+    (?が ?ガ "ガ") (?ぎ ?ギ "ギ") (?ぐ ?グ "グ") (?げ ?ゲ "ゲ") (?ご ?ゴ "ゴ")
+    (?ざ ?ザ "ザ") (?じ ?ジ "ジ") (?ず ?ズ "ズ") (?ぜ ?ゼ "ゼ") (?ぞ ?ゾ "ゾ")
+    (?だ ?ダ "ダ") (?ぢ ?ヂ "ヂ") (?づ ?ヅ "ヅ") (?で ?デ "デ") (?ど ?ド "ド")
+    (?ば ?バ "バ") (?び ?ビ "ビ") (?ぶ ?ブ "ブ") (?べ ?ベ "ベ") (?ぼ ?ボ "ボ")
+    (?ぱ ?パ "パ") (?ぴ ?ピ "ピ") (?ぷ ?プ "プ") (?ぺ ?ペ "ペ") (?ぽ ?ポ "ポ")
+    (?ぁ ?ァ ?ァ) (?ぃ ?ィ ?ィ) (?ぅ ?ゥ ?ゥ) (?ぇ ?ェ ?ェ) (?ぉ ?ォ ?ォ)
+    (?っ ?ッ ?ッ)
+    (?ゃ ?ャ ?ャ) (?ゅ ?ュ ?ュ) (?ょ ?ョ ?ョ)
+    (?ゎ ?ヮ "ワ")
+    (?ゝ ?ヽ) (?ゞ ?ヾ)
+    ("う゛" ?ヴ "ヴ") (nil ?ヵ "カ") (nil ?ヶ "ケ"))
   "Japanese JISX0208 Kana character table.
 Each element is of the form (HIRAGANA KATAKANA HANKAKU-KATAKANA), where
 HIRAGANA and KATAKANA belong to `japanese-jisx0208',
@@ -98,15 +96,15 @@ HANKAKU-KATAKANA belongs to `japanese-jisx0201-kana'.")
          (put-char-code-property jisx0201 'jisx0208 katakana)))))
 
 (defconst japanese-symbol-table
-  '((?\$B!!(B ?\ ) (?$B!$(B ?, ?(I$(B) (?$B!%(B ?. ?(I!(B) 
(?$B!"(B ?, ?(I$(B) (?$B!#(B ?. ?(I!(B) (?$B!&(B nil ?(I%(B)
-    (?$B!'(B ?:) (?$B!((B ?\;) (?$B!)(B ??) (?$B!*(B ?!) (?$B!+(B 
nil ?(I^(B) (?$B!,(B nil ?(I_(B)
-    (?$B!-(B ?') (?$B!.(B ?`) (?$B!0(B ?^) (?$B!2(B ?_) (?$B!<(B ?- 
?(I0(B) (?$B!=(B ?-) (?$B!>(B ?-)
-    (?$B!?(B ?/) (address@hidden(B ?\\) (?$B!A(B ?~)  (?$B!C(B ?|) 
(?$B!F(B ?`) (?$B!G(B ?') (?$B!H(B ?\") (?$B!I(B ?\")
-    (?\$B!J(B ?\() (?\$B!K(B ?\)) (?\$B!N(B ?\[) (?\$B!O(B ?\]) 
(?\$B!P(B ?{) (?\$B!Q(B ?})
-    (?$B!R(B ?<) (?$B!S(B ?>) (?\$B!V(B nil ?\(I"(B) (?\$B!W(B nil 
?\(I#(B)
-    (?$B!\(B ?+) (?$B!](B ?-) (?$B!a(B ?=) (?$B!c(B ?<) (?$B!d(B ?>)
-    (?$B!l(B ?') (?$B!m(B ?\") (?$B!o(B ?\\) (?$B!p(B ?$) (?$B!s(B 
?%) (?$B!t(B ?#) (?$B!u(B ?&) (?$B!v(B ?*)
-    (?$B!w(B ?@)
+  '((?\  ?\ ) (?, ?, ?、) (?. ?. ?。) (?、 ?, ?、) (?。 ?. ?。) (?・ nil ?・)
+    (?: ?:) (?; ?\;) (?? ??) (?! ?!) (?゛ nil ?゙) (?゜ nil ?゚)
+    (?´ ?') (?` ?`) (?^ ?^) (?_ ?_) (?ー ?- ?ー) (?— ?-) (?‐ ?-)
+    (?/ ?/) (?\ ?\\) (?〜 ?~)  (?| ?|) (?‘ ?`) (?’ ?') (?“ ?\") (?” ?\")
+    (?\( ?\() (?\) ?\)) (?\[ ?\[) (?\] ?\]) (?\{ ?{) (?\} ?})
+    (?〈 ?<) (?〉 ?>) (?\「 nil ?\「) (?\」 nil ?\」)
+    (?+ ?+) (?− ?-) (?= ?=) (?< ?<) (?> ?>)
+    (?′ ?') (?″ ?\") (?¥ ?\\) (?$ ?$) (?% ?%) (?# ?#) (?& ?&) (?* ?*)
+    (?@ ?@)
     ;; cp932-2-byte
     (#x2015 ?-) (#xFF5E ?~) (#xFF0D ?-))
   "Japanese JISX0208 and CP932 symbol character table.
@@ -134,18 +132,18 @@ and HANKAKU belongs to `japanese-jisx0201-kana'.")
              (put-char-code-property jisx0201 'jisx0208 jisx0208))))))
 
 (defconst japanese-alpha-numeric-table
-  '((?$B#0(B . ?0) (?$B#1(B . ?1) (?$B#2(B . ?2) (?$B#3(B . ?3) 
(?$B#4(B . ?4)
-    (?$B#5(B . ?5) (?$B#6(B . ?6) (?$B#7(B . ?7) (?$B#8(B . ?8) 
(?$B#9(B . ?9)
-    (?$B#A(B . ?A) (?$B#B(B . ?B) (?$B#C(B . ?C) (?$B#D(B . ?D) 
(?$B#E(B . ?E)
-    (?$B#F(B . ?F) (?$B#G(B . ?G) (?$B#H(B . ?H) (?$B#I(B . ?I) 
(?$B#J(B . ?J)
-    (?$B#K(B . ?K) (?$B#L(B . ?L) (?$B#M(B . ?M) (?$B#N(B . ?N) 
(?$B#O(B . ?O)
-    (?$B#P(B . ?P) (?$B#Q(B . ?Q) (?$B#R(B . ?R) (?$B#S(B . ?S) 
(?$B#T(B . ?T)
-    (?$B#U(B . ?U) (?$B#V(B . ?V) (?$B#W(B . ?W) (?$B#X(B . ?X) 
(?$B#Y(B . ?Y) (?$B#Z(B . ?Z)
-    (?$B#a(B . ?a) (?$B#b(B . ?b) (?$B#c(B . ?c) (?$B#d(B . ?d) 
(?$B#e(B . ?e)
-    (?$B#f(B . ?f) (?$B#g(B . ?g) (?$B#h(B . ?h) (?$B#i(B . ?i) 
(?$B#j(B . ?j)
-    (?$B#k(B . ?k) (?$B#l(B . ?l) (?$B#m(B . ?m) (?$B#n(B . ?n) 
(?$B#o(B . ?o)
-    (?$B#p(B . ?p) (?$B#q(B . ?q) (?$B#r(B . ?r) (?$B#s(B . ?s) 
(?$B#t(B . ?t)
-    (?$B#u(B . ?u) (?$B#v(B . ?v) (?$B#w(B . ?w) (?$B#x(B . ?x) 
(?$B#y(B . ?y) (?$B#z(B . ?z))
+  '((?0 . ?0) (?1 . ?1) (?2 . ?2) (?3 . ?3) (?4 . ?4)
+    (?5 . ?5) (?6 . ?6) (?7 . ?7) (?8 . ?8) (?9 . ?9)
+    (?A . ?A) (?B . ?B) (?C . ?C) (?D . ?D) (?E . ?E)
+    (?F . ?F) (?G . ?G) (?H . ?H) (?I . ?I) (?J . ?J)
+    (?K . ?K) (?L . ?L) (?M . ?M) (?N . ?N) (?O . ?O)
+    (?P . ?P) (?Q . ?Q) (?R . ?R) (?S . ?S) (?T . ?T)
+    (?U . ?U) (?V . ?V) (?W . ?W) (?X . ?X) (?Y . ?Y) (?Z . ?Z)
+    (?a . ?a) (?b . ?b) (?c . ?c) (?d . ?d) (?e . ?e)
+    (?f . ?f) (?g . ?g) (?h . ?h) (?i . ?i) (?j . ?j)
+    (?k . ?k) (?l . ?l) (?m . ?m) (?n . ?n) (?o . ?o)
+    (?p . ?p) (?q . ?q) (?r . ?r) (?s . ?s) (?t . ?t)
+    (?u . ?u) (?v . ?v) (?w . ?w) (?x . ?x) (?y . ?y) (?z . ?z))
   "Japanese JISX0208 alpha numeric character table.
 Each element is of the form (ALPHA-NUMERIC . ASCII), where ALPHA-NUMERIC
 belongs to `japanese-jisx0208', ASCII belongs to `ascii'.")
diff --git a/lisp/language/japanese.el b/lisp/language/japanese.el
index f6d9e1b..fabeab8 100644
--- a/lisp/language/japanese.el
+++ b/lisp/language/japanese.el
@@ -1,6 +1,6 @@
-;;; japanese.el --- support for Japanese -*- coding: iso-2022-7bit -*-
+;;; japanese.el --- support for Japanese
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -210,7 +210,7 @@ eucJP-ms is defined in 
<http://www.opengroup.or.jp/jvc/cde/appendix.html>."
                                iso-2022-jp-2)
              (input-method . "japanese")
              (features japan-util)
-             (sample-text . "Japanese ($BF|K\8l(B)   $B$3$s$K$A$O(B, 
(I:]FAJ(B")
+             (sample-text . "Japanese (日本語)    こんにちは, コンニチハ")
              (documentation . t)))
 
 (let ((map
diff --git a/lisp/language/korea-util.el b/lisp/language/korea-util.el
index 04f7e8d..464a4ce 100644
--- a/lisp/language/korea-util.el
+++ b/lisp/language/korea-util.el
@@ -1,6 +1,6 @@
 ;;; korea-util.el --- utilities for Korean
 
-;; Copyright (C) 1997, 1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
 ;;   2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/korean.el b/lisp/language/korean.el
index 8e5ecb9..2c9780e 100644
--- a/lisp/language/korean.el
+++ b/lisp/language/korean.el
@@ -1,6 +1,6 @@
 ;;; korean.el --- support for Korean -*- coding: utf-8 -*-
 
-;; Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/lao-util.el b/lisp/language/lao-util.el
index 554f7cf..92b41e4 100644
--- a/lisp/language/lao-util.el
+++ b/lisp/language/lao-util.el
@@ -1,6 +1,6 @@
 ;;; lao-util.el --- utilities for Lao -*- coding: utf-8; -*-
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
 ;;   2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/lao.el b/lisp/language/lao.el
index 04ccd66..ff6578d 100644
--- a/lisp/language/lao.el
+++ b/lisp/language/lao.el
@@ -1,6 +1,6 @@
 ;;; lao.el --- support for Lao -*- coding: utf-8 -*-
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
 ;;   2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/romanian.el b/lisp/language/romanian.el
index c91726e..0a5d0ca 100644
--- a/lisp/language/romanian.el
+++ b/lisp/language/romanian.el
@@ -1,6 +1,6 @@
 ;;; romanian.el --- support for Romanian -*- coding: utf-8 -*-
 
-;; Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author:    Dan Nicolaescu <address@hidden>
 ;; Keywords: multilingual, Romanian, i18n
diff --git a/lisp/language/slovak.el b/lisp/language/slovak.el
index 2e935f8..4dfdb54 100644
--- a/lisp/language/slovak.el
+++ b/lisp/language/slovak.el
@@ -1,6 +1,6 @@
 ;;; slovak.el --- support for Slovak -*- coding: utf-8 -*-
 
-;; Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Authors:    Tibor Šimko <address@hidden>,
 ;;             Milan Zamazal <address@hidden>
diff --git a/lisp/language/tai-viet.el b/lisp/language/tai-viet.el
index fb5904f..b202abf 100644
--- a/lisp/language/tai-viet.el
+++ b/lisp/language/tai-viet.el
@@ -1,6 +1,6 @@
 ;;; tai-viet.el --- support for Tai Viet -*- coding: utf-8 -*-
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H13PRO009
diff --git a/lisp/language/thai-util.el b/lisp/language/thai-util.el
index d6c9732..d0f6649 100644
--- a/lisp/language/thai-util.el
+++ b/lisp/language/thai-util.el
@@ -1,6 +1,6 @@
 ;;; thai-util.el --- utilities for Thai -*- coding: utf-8; -*-
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/thai.el b/lisp/language/thai.el
index a896fe5..01ec0c0 100644
--- a/lisp/language/thai.el
+++ b/lisp/language/thai.el
@@ -1,6 +1,6 @@
 ;;; thai.el --- support for Thai -*- coding: utf-8 -*-
 
-;; Copyright (C) 1997-1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/tibet-util.el b/lisp/language/tibet-util.el
index a1aad7f..68faf20 100644
--- a/lisp/language/tibet-util.el
+++ b/lisp/language/tibet-util.el
@@ -1,6 +1,6 @@
 ;;; tibet-util.el --- utilities for Tibetan   -*- coding: utf-8-emacs; -*-
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/tibetan.el b/lisp/language/tibetan.el
index cf14d64..4be25ce 100644
--- a/lisp/language/tibetan.el
+++ b/lisp/language/tibetan.el
@@ -1,6 +1,6 @@
 ;;; tibetan.el --- support for Tibetan language -*- coding: utf-8-emacs; -*-
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -451,7 +451,7 @@
 ;;; (includes some punctuation conversion rules)
 ;;;
 (defconst tibetan-precomposition-rule-alist
-  `(("ཕྱྭ" . "����")
+  '(("ཕྱྭ" . "����")
     ("གྲྭ" . "����")
     ("ཚྭ" . "����")
     ("རྩྭ" . "����")
diff --git a/lisp/language/utf-8-lang.el b/lisp/language/utf-8-lang.el
index 4b8718f..d4897c9 100644
--- a/lisp/language/utf-8-lang.el
+++ b/lisp/language/utf-8-lang.el
@@ -1,6 +1,6 @@
 ;;; utf-8-lang.el --- generic UTF-8 language environment
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;; Keywords: i18n
@@ -25,24 +25,24 @@
 ;;; Code:
 
 (set-language-info-alist
- "UTF-8" `((coding-system utf-8)
+ "UTF-8" '((coding-system utf-8)
           (coding-priority utf-8)
           (charset unicode-bmp unicode)
-;; Presumably not relevant now.
-;;        (setup-function
-;;         . (lambda ()
-;;             ;; Use Unicode font under Windows.  Jason Rumney fecit.
-;;             (if (and (fboundp 'w32-add-charset-info)
-;;                      (not (boundp 'w32-unicode-charset-defined)))
-;;                 (w32-add-charset-info "iso10646-1" 'w32-charset-ansi t))))
-;; Is this appropriate?
-;;        (exit-function
-;;         . (lambda ()
-;;             (if (and (fboundp 'w32-add-charset-info)
-;;                      (not (boundp 'w32-unicode-charset-defined)))
-;;                 (setq w32-charset-info-alist
-;;                       (delete (assoc "iso10646-1")
-;;                               w32-charset-info-alist)))))
+           ;; Presumably not relevant now.
+           ;;     (setup-function
+           ;;      . (lambda ()
+           ;;          ;; Use Unicode font under Windows.  Jason Rumney fecit.
+           ;;          (if (and (fboundp 'w32-add-charset-info)
+           ;;                   (not (boundp 'w32-unicode-charset-defined)))
+           ;;              (w32-add-charset-info "iso10646-1" 
'w32-charset-ansi t))))
+           ;; Is this appropriate?
+           ;;     (exit-function
+           ;;      . (lambda ()
+           ;;          (if (and (fboundp 'w32-add-charset-info)
+           ;;                   (not (boundp 'w32-unicode-charset-defined)))
+           ;;              (setq w32-charset-info-alist
+           ;;                    (delete (assoc "iso10646-1")
+           ;;                            w32-charset-info-alist)))))
           (input-method . "rfc1345")   ; maybe not the best choice
           (documentation . "\
 This language environment is a generic one for the Unicode character set
diff --git a/lisp/language/viet-util.el b/lisp/language/viet-util.el
index a926c19..d83aeb5 100644
--- a/lisp/language/viet-util.el
+++ b/lisp/language/viet-util.el
@@ -1,6 +1,6 @@
 ;;; viet-util.el --- utilities for Vietnamese  -*- coding: utf-8; -*-
 
-;; Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/language/vietnamese.el b/lisp/language/vietnamese.el
index 31c3755..432dd3e 100644
--- a/lisp/language/vietnamese.el
+++ b/lisp/language/vietnamese.el
@@ -1,6 +1,6 @@
 ;;; vietnamese.el --- support for Vietnamese -*- coding: utf-8; -*-
 
-;; Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 ;;   2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -72,9 +72,9 @@
 (define-coding-system-alias 'viqr 'vietnamese-viqr)
 
 (set-language-info-alist
- "Vietnamese" `((charset viscii)
+ "Vietnamese" '((charset viscii)
                (coding-system vietnamese-viscii vietnamese-vscii
-                               vietnamese-tcvn vietnamese-viqr windows-1258)
+                              vietnamese-tcvn vietnamese-viqr windows-1258)
                (nonascii-translation . viscii)
                (coding-priority vietnamese-viscii)
                (input-method . "vietnamese-viqr")
diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el
index eda67cd..0e8e5f6 100644
--- a/lisp/ldefs-boot.el
+++ b/lisp/ldefs-boot.el
@@ -33,25 +33,17 @@ Quit current game           \\[5x5-quit-game]
 \(fn &optional SIZE)" t nil)
 
 (autoload '5x5-crack-randomly "5x5" "\
-Attempt to crack 5x5 using random solutions.
-
-\(fn)" t nil)
+Attempt to crack 5x5 using random solutions." t nil)
 
 (autoload '5x5-crack-mutating-current "5x5" "\
-Attempt to crack 5x5 by mutating the current solution.
-
-\(fn)" t nil)
+Attempt to crack 5x5 by mutating the current solution." t nil)
 
 (autoload '5x5-crack-mutating-best "5x5" "\
-Attempt to crack 5x5 by mutating the best solution.
-
-\(fn)" t nil)
+Attempt to crack 5x5 by mutating the best solution." t nil)
 
 (autoload '5x5-crack-xor-mutate "5x5" "\
 Attempt to crack 5x5 by xoring the current and best solution.
-Mutate the result.
-
-\(fn)" t nil)
+Mutate the result." t nil)
 
 (autoload '5x5-crack "5x5" "\
 Attempt to find a solution for 5x5.
@@ -99,9 +91,7 @@ Ada mode is the major mode for editing Ada code.
 ;;; Generated autoloads from progmodes/ada-stmt.el
 
 (autoload 'ada-header "ada-stmt" "\
-Insert a descriptive header at the top of the file.
-
-\(fn)" t nil)
+Insert a descriptive header at the top of the file." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"ada-stmt" '("ada-")))
 
@@ -149,9 +139,7 @@ ChangeLog entry, one element will be chosen at random.")
 (custom-autoload 'add-log-mailing-address "add-log" t)
 
 (autoload 'prompt-for-change-log-name "add-log" "\
-Prompt for a change log name.
-
-\(fn)" nil nil)
+Prompt for a change log name." nil nil)
 
 (autoload 'find-change-log "add-log" "\
 Find a change log file for \\[add-change-log-entry] and return the name.
@@ -242,9 +230,7 @@ identifiers followed by `:' or `='.  See variables
 `add-log-current-defun-header-regexp' and
 `add-log-current-defun-function'.
 
-Has a preference of looking backwards.
-
-\(fn)" nil nil)
+Has a preference of looking backwards." nil nil)
 
 (autoload 'change-log-merge "add-log" "\
 Merge the contents of change log file OTHER-LOG with this buffer.
@@ -490,16 +476,12 @@ to be colored.
 \(fn BEG END TITLE &optional RULES EXCLUDE-RULES)" t nil)
 
 (autoload 'align-unhighlight-rule "align" "\
-Remove any highlighting that was added by `align-highlight-rule'.
-
-\(fn)" t nil)
+Remove any highlighting that was added by `align-highlight-rule'." t nil)
 
 (autoload 'align-newline-and-indent "align" "\
 A replacement function for `newline-and-indent', aligning as it goes.
 The alignment is done by calling `align' on the region that was
-indented.
-
-\(fn)" t nil)
+indented." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"align" '("align-")))
 
@@ -523,9 +505,7 @@ Establishes allout processing as part of visiting a file if
 `allout-auto-activation' is non-nil, or removes it otherwise.
 
 The proper way to use this is through customizing the setting of
-`allout-auto-activation'.
-
-\(fn)" nil nil)
+`allout-auto-activation'." nil nil)
 
 (defvar allout-auto-activation nil "\
 Configure allout outline mode auto-activation.
@@ -577,9 +557,7 @@ With value nil, inhibit any automatic allout-mode 
activation.")
 (put 'allout-layout 'safe-local-variable (lambda (x) (or (numberp x) (listp x) 
(memq x '(: * + -)))))
 
 (autoload 'allout-mode-p "allout" "\
-Return t if `allout-mode' is active in current buffer.
-
-\(fn)" nil t)
+Return t if `allout-mode' is active in current buffer." nil t)
 
 (autoload 'allout-mode "allout" "\
 Toggle Allout outline mode.
@@ -990,9 +968,7 @@ the buffer *Birthday-Present-for-Name*.
 (push (purecopy '(ansi-color 3 4 2)) package--builtin-versions)
 
 (autoload 'ansi-color-for-comint-mode-on "ansi-color" "\
-Set `ansi-color-for-comint-mode' to t.
-
-\(fn)" t nil)
+Set `ansi-color-for-comint-mode' to t." t nil)
 
 (autoload 'ansi-color-process-output "ansi-color" "\
 Maybe translate SGR control sequences of comint output into text properties.
@@ -1033,9 +1009,7 @@ the rules.
 If the file for a super-grammar cannot be determined, special file names
 are used according to variable `antlr-unknown-file-formats' and a
 commentary with value `antlr-help-unknown-file-text' is added.  The
-*Help* buffer always starts with the text in `antlr-help-rules-intro'.
-
-\(fn)" t nil)
+*Help* buffer always starts with the text in `antlr-help-rules-intro'." t nil)
 
 (autoload 'antlr-mode "antlr-mode" "\
 Major mode for editing ANTLR grammar files.
@@ -1044,9 +1018,7 @@ Major mode for editing ANTLR grammar files.
 
 (autoload 'antlr-set-tabs "antlr-mode" "\
 Use ANTLR's convention for TABs according to `antlr-tab-offset-alist'.
-Used in `antlr-mode'.  Also a useful function in `java-mode-hook'.
-
-\(fn)" nil nil)
+Used in `antlr-mode'.  Also a useful function in `java-mode-hook'." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"antlr-mode" '("antlr-")))
 
@@ -1566,9 +1538,7 @@ let-binding.")
 (push (purecopy '(auth-source-pass 4 0 1)) package--builtin-versions)
 
 (autoload 'auth-source-pass-enable "auth-source-pass" "\
-Enable auth-source-password-store.
-
-\(fn)" nil nil)
+Enable auth-source-password-store." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"auth-source-pass" '("auth-source-pass-")))
 
@@ -1654,9 +1624,7 @@ Major mode for editing Autoconf configure.ac files.
 
 (autoload 'auto-insert "autoinsert" "\
 Insert default contents into new files if variable `auto-insert' is non-nil.
-Matches the visited file name against the elements of `auto-insert-alist'.
-
-\(fn)" t nil)
+Matches the visited file name against the elements of `auto-insert-alist'." t 
nil)
 
 (autoload 'define-auto-insert "autoinsert" "\
 Associate CONDITION with (additional) ACTION in `auto-insert-alist'.
@@ -1738,9 +1706,7 @@ write its autoloads into the specified file instead.
 Update loaddefs.el autoloads in batch mode.
 Calls `update-directory-autoloads' on the command line arguments.
 Definitions are written to `generated-autoload-file' (which
-should be non-nil).
-
-\(fn)" nil nil)
+should be non-nil)." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"autoload" '("autoload-" "generate" "make-autoload" "no-update-autoloads")))
 
@@ -1774,9 +1740,7 @@ without being changed in the part that is already in the 
buffer.
 Turn on Auto-Revert Mode.
 
 This function is designed to be added to hooks, for example:
-  (add-hook \\='c-mode-hook #\\='turn-on-auto-revert-mode)
-
-\(fn)" nil nil)
+  (add-hook \\='c-mode-hook #\\='turn-on-auto-revert-mode)" nil nil)
 
 (autoload 'auto-revert-tail-mode "autorevert" "\
 Toggle reverting tail of buffer when the file grows.
@@ -1807,9 +1771,7 @@ Use `auto-revert-mode' for changes other than appends!
 Turn on Auto-Revert Tail Mode.
 
 This function is designed to be added to hooks, for example:
-  (add-hook \\='my-logfile-mode-hook #\\='turn-on-auto-revert-tail-mode)
-
-\(fn)" nil nil)
+  (add-hook \\='my-logfile-mode-hook #\\='turn-on-auto-revert-tail-mode)" nil 
nil)
 
 (defvar global-auto-revert-mode nil "\
 Non-nil if Global Auto-Revert mode is enabled.
@@ -1907,9 +1869,7 @@ definition of \"random distance\".)
 
 (autoload 'backtrace "backtrace" "\
 Print a trace of Lisp function calls currently active.
-Output stream used is value of `standard-output'.
-
-\(fn)" nil nil)
+Output stream used is value of `standard-output'." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"backtrace" '("backtrace-")))
 
@@ -1942,9 +1902,7 @@ Run script using `bat-run' and `bat-run-args'.
 (autoload 'battery "battery" "\
 Display battery status information in the echo area.
 The text being displayed in the echo area is controlled by the variables
-`battery-echo-area-format' and `battery-status-function'.
-
-\(fn)" t nil)
+`battery-echo-area-format' and `battery-status-function'." t nil)
 
 (defvar display-battery-mode nil "\
 Non-nil if Display-Battery mode is enabled.
@@ -2289,7 +2247,7 @@ a reflection.
  (define-key ctl-x-r-map "M" 'bookmark-set-no-overwrite)
  (define-key ctl-x-r-map "l" 'bookmark-bmenu-list)
 
-(defvar bookmark-map (let ((map (make-sparse-keymap))) (define-key map "x" 
'bookmark-set) (define-key map "m" 'bookmark-set) (define-key map "M" 
'bookmark-set-no-overwrite) (define-key map "j" 'bookmark-jump) (define-key map 
"g" 'bookmark-jump) (define-key map "o" 'bookmark-jump-other-window) 
(define-key map "i" 'bookmark-insert) (define-key map "e" 'edit-bookmarks) 
(define-key map "f" 'bookmark-insert-location) (define-key map "r" 
'bookmark-rename) (define-key map "d" 'bookmark-delete)  [...]
+(defvar bookmark-map (let ((map (make-sparse-keymap))) (define-key map "x" 
'bookmark-set) (define-key map "m" 'bookmark-set) (define-key map "M" 
'bookmark-set-no-overwrite) (define-key map "j" 'bookmark-jump) (define-key map 
"g" 'bookmark-jump) (define-key map "o" 'bookmark-jump-other-window) 
(define-key map "5" 'bookmark-jump-other-frame) (define-key map "i" 
'bookmark-insert) (define-key map "e" 'edit-bookmarks) (define-key map "f" 
'bookmark-insert-location) (define-key map "r" 'bookmar [...]
 Keymap containing bindings to bookmark functions.
 It is not bound to any key by default: to bind it
 so that you have a bookmark prefix, just use `global-set-key' and bind a
@@ -2380,6 +2338,11 @@ Jump to BOOKMARK in another window.  See `bookmark-jump' 
for more.
 
 \(fn BOOKMARK)" t nil)
 
+(autoload 'bookmark-jump-other-frame "bookmark" "\
+Jump to BOOKMARK in another frame.  See `bookmark-jump' for more.
+
+\(fn BOOKMARK)" t nil)
+
 (autoload 'bookmark-relocate "bookmark" "\
 Relocate BOOKMARK-NAME to another file, reading file name with minibuffer.
 
@@ -2438,9 +2401,7 @@ probably because we were called from there.
 \(fn BOOKMARK-NAME &optional BATCH)" t nil)
 
 (autoload 'bookmark-write "bookmark" "\
-Write bookmarks to a file (reading the file name with the minibuffer).
-
-\(fn)" t nil)
+Write bookmarks to a file (reading the file name with the minibuffer)." t nil)
 
 (function-put 'bookmark-write 'interactive-only 'bookmark-save)
 
@@ -2487,18 +2448,14 @@ unique numeric suffixes \"<2>\", \"<3>\", etc.
 Display a list of existing bookmarks.
 The list is displayed in a buffer named `*Bookmark List*'.
 The leftmost column displays a D if the bookmark is flagged for
-deletion, or > if it is flagged for displaying.
-
-\(fn)" t nil)
+deletion, or > if it is flagged for displaying." t nil)
 
 (defalias 'list-bookmarks 'bookmark-bmenu-list)
 
 (defalias 'edit-bookmarks 'bookmark-bmenu-list)
 
 (autoload 'bookmark-bmenu-search "bookmark" "\
-Incremental search of bookmarks, hiding the non-matches as we go.
-
-\(fn)" t nil)
+Incremental search of bookmarks, hiding the non-matches as we go." t nil)
 
 (defvar menu-bar-bookmark-map (let ((map (make-sparse-keymap "Bookmark 
functions"))) (bindings--define-key map [load] '(menu-item "Load a Bookmark 
File..." bookmark-load :help "Load bookmarks from a bookmark file)")) 
(bindings--define-key map [write] '(menu-item "Save Bookmarks As..." 
bookmark-write :help "Write bookmarks to a file (reading the file name with the 
minibuffer)")) (bindings--define-key map [save] '(menu-item "Save Bookmarks" 
bookmark-save :help "Save currently defined bookm [...]
 
@@ -2542,9 +2499,7 @@ narrowed.
 \(fn &optional BUFFER)" t nil)
 
 (autoload 'browse-url-of-dired-file "browse-url" "\
-In Dired, ask a WWW browser to display the file named on this line.
-
-\(fn)" t nil)
+In Dired, ask a WWW browser to display the file named on this line." t nil)
 
 (autoload 'browse-url-of-region "browse-url" "\
 Ask a WWW browser to display the current region.
@@ -2867,21 +2822,15 @@ from `browse-url-elinks-wrapper'.
 (autoload 'bs-cycle-next "bs" "\
 Select next buffer defined by buffer cycling.
 The buffers taking part in buffer cycling are defined
-by buffer configuration `bs-cycle-configuration-name'.
-
-\(fn)" t nil)
+by buffer configuration `bs-cycle-configuration-name'." t nil)
 
 (autoload 'bs-cycle-previous "bs" "\
 Select previous buffer defined by buffer cycling.
 The buffers taking part in buffer cycling are defined
-by buffer configuration `bs-cycle-configuration-name'.
-
-\(fn)" t nil)
+by buffer configuration `bs-cycle-configuration-name'." t nil)
 
 (autoload 'bs-customize "bs" "\
-Customization of group bs for Buffer Selection Menu.
-
-\(fn)" t nil)
+Customization of group bs for Buffer Selection Menu." t nil)
 
 (autoload 'bs-show "bs" "\
 Make a menu of buffers so you can manipulate buffers or the buffer list.
@@ -2918,9 +2867,7 @@ columns on its right towards the left.
 \\[bubbles-set-game-easy] sets the difficulty to easy.
 \\[bubbles-set-game-medium] sets the difficulty to medium.
 \\[bubbles-set-game-difficult] sets the difficulty to difficult.
-\\[bubbles-set-game-hard] sets the difficulty to hard.
-
-\(fn)" t nil)
+\\[bubbles-set-game-hard] sets the difficulty to hard." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"bubbles" '("bubbles-")))
 
@@ -3060,9 +3007,7 @@ invoked interactively.
 (autoload 'batch-byte-compile-if-not-done "bytecomp" "\
 Like `byte-compile-file' but doesn't recompile if already up to date.
 Use this from the command line, with `-batch';
-it won't work in an interactive Emacs.
-
-\(fn)" nil nil)
+it won't work in an interactive Emacs." nil nil)
 
 (autoload 'batch-byte-compile "bytecomp" "\
 Run `byte-compile-file' on the files remaining on the command line.
@@ -3086,7 +3031,7 @@ and corresponding effects.
 
 \(fn &optional ARG)" nil nil)
 
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"bytecomp" '("batch-byte-compile-file" "byte-" 
"displaying-byte-compile-warnings" "emacs-lisp-file-regexp" "no-byte-compile")))
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"bytecomp" '("batch-byte-compile-file" "byte-" 
"displaying-byte-compile-warnings" "emacs-lisp-" "no-byte-compile")))
 
 ;;;***
 
@@ -3622,9 +3567,7 @@ See Info node `(calc)Defining Functions'.
 
 (autoload 'calculator "calculator" "\
 Run the Emacs calculator.
-See the documentation for `calculator-mode' for more information.
-
-\(fn)" t nil)
+See the documentation for `calculator-mode' for more information." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"calculator" '("calculator-")))
 
@@ -3734,9 +3677,7 @@ it fails.
 ;;; Generated autoloads from progmodes/cc-engine.el
 
 (autoload 'c-guess-basic-syntax "cc-engine" "\
-Return the syntactic context of the current line.
-
-\(fn)" nil nil)
+Return the syntactic context of the current line." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"cc-engine" '("c-")))
 
@@ -3914,9 +3855,7 @@ should be used.
 
 This function attempts to use file contents to determine whether
 the code is C or C++ and based on that chooses whether to enable
-`c-mode' or `c++-mode'.
-
-\(fn)" nil nil)
+`c-mode' or `c++-mode'." nil nil)
 
 (autoload 'c++-mode "cc-mode" "\
 Major mode for editing C++ code.
@@ -4489,9 +4428,7 @@ to the action header.
 \(fn)" t nil)
 
 (autoload 'cfengine-auto-mode "cfengine" "\
-Choose `cfengine2-mode' or `cfengine3-mode' by buffer contents.
-
-\(fn)" t nil)
+Choose `cfengine2-mode' or `cfengine3-mode' by buffer contents." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"cfengine" '("cfengine")))
 
@@ -4569,9 +4506,7 @@ Return t when OBJ is a list of strings.
 (autoload 'checkdoc "checkdoc" "\
 Interactively check the entire buffer for style errors.
 The current status of the check will be displayed in a buffer which
-the users will view as each check is completed.
-
-\(fn)" t nil)
+the users will view as each check is completed." t nil)
 
 (autoload 'checkdoc-interactive "checkdoc" "\
 Interactively check the current buffer for doc string errors.
@@ -4599,9 +4534,7 @@ checkdoc status window instead of the usual behavior.
 Evaluate and check documentation for the current buffer.
 Evaluation is done first because good documentation for something that
 doesn't work is just not useful.  Comments, doc strings, and rogue
-spacing are all verified.
-
-\(fn)" t nil)
+spacing are all verified." t nil)
 
 (autoload 'checkdoc-current-buffer "checkdoc" "\
 Check current buffer for document, comment, error style, and rogue spaces.
@@ -4627,9 +4560,8 @@ a separate buffer.
 
 (autoload 'checkdoc-continue "checkdoc" "\
 Find the next doc string in the current buffer which has a style error.
-Prefix argument TAKE-NOTES means to continue through the whole buffer and
-save warnings in a separate buffer.  Second optional argument START-POINT
-is the starting location.  If this is nil, `point-min' is used instead.
+Prefix argument TAKE-NOTES means to continue through the whole
+buffer and save warnings in a separate buffer.
 
 \(fn &optional TAKE-NOTES)" t nil)
 
@@ -4660,9 +4592,7 @@ Optional argument TAKE-NOTES causes all errors to be 
logged.
 Evaluate the current form with `eval-defun' and check its documentation.
 Evaluation is done first so the form will be read before the
 documentation is checked.  If there is a documentation error, then the display
-of what was evaluated will be overwritten by the diagnostic message.
-
-\(fn)" t nil)
+of what was evaluated will be overwritten by the diagnostic message." t nil)
 
 (autoload 'checkdoc-defun "checkdoc" "\
 Examine the doc string of the function or variable under point.
@@ -4676,65 +4606,47 @@ space at the end of each line.
 (autoload 'checkdoc-ispell "checkdoc" "\
 Check the style and spelling of everything interactively.
 Calls `checkdoc' with spell-checking turned on.
-Prefix argument is the same as for `checkdoc'
-
-\(fn)" t nil)
+Prefix argument is the same as for `checkdoc'" t nil)
 
 (autoload 'checkdoc-ispell-current-buffer "checkdoc" "\
 Check the style and spelling of the current buffer.
 Calls `checkdoc-current-buffer' with spell-checking turned on.
-Prefix argument is the same as for `checkdoc-current-buffer'
-
-\(fn)" t nil)
+Prefix argument is the same as for `checkdoc-current-buffer'" t nil)
 
 (autoload 'checkdoc-ispell-interactive "checkdoc" "\
 Check the style and spelling of the current buffer interactively.
 Calls `checkdoc-interactive' with spell-checking turned on.
-Prefix argument is the same as for `checkdoc-interactive'
-
-\(fn)" t nil)
+Prefix argument is the same as for `checkdoc-interactive'" t nil)
 
 (autoload 'checkdoc-ispell-message-interactive "checkdoc" "\
 Check the style and spelling of message text interactively.
 Calls `checkdoc-message-interactive' with spell-checking turned on.
-Prefix argument is the same as for `checkdoc-message-interactive'
-
-\(fn)" t nil)
+Prefix argument is the same as for `checkdoc-message-interactive'" t nil)
 
 (autoload 'checkdoc-ispell-message-text "checkdoc" "\
 Check the style and spelling of message text interactively.
 Calls `checkdoc-message-text' with spell-checking turned on.
-Prefix argument is the same as for `checkdoc-message-text'
-
-\(fn)" t nil)
+Prefix argument is the same as for `checkdoc-message-text'" t nil)
 
 (autoload 'checkdoc-ispell-start "checkdoc" "\
 Check the style and spelling of the current buffer.
 Calls `checkdoc-start' with spell-checking turned on.
-Prefix argument is the same as for `checkdoc-start'
-
-\(fn)" t nil)
+Prefix argument is the same as for `checkdoc-start'" t nil)
 
 (autoload 'checkdoc-ispell-continue "checkdoc" "\
 Check the style and spelling of the current buffer after point.
 Calls `checkdoc-continue' with spell-checking turned on.
-Prefix argument is the same as for `checkdoc-continue'
-
-\(fn)" t nil)
+Prefix argument is the same as for `checkdoc-continue'" t nil)
 
 (autoload 'checkdoc-ispell-comments "checkdoc" "\
 Check the style and spelling of the current buffer's comments.
 Calls `checkdoc-comments' with spell-checking turned on.
-Prefix argument is the same as for `checkdoc-comments'
-
-\(fn)" t nil)
+Prefix argument is the same as for `checkdoc-comments'" t nil)
 
 (autoload 'checkdoc-ispell-defun "checkdoc" "\
 Check the style and spelling of the current defun with Ispell.
 Calls `checkdoc-defun' with spell-checking turned on.
-Prefix argument is the same as for `checkdoc-defun'
-
-\(fn)" t nil)
+Prefix argument is the same as for `checkdoc-defun'" t nil)
 
 (autoload 'checkdoc-minor-mode "checkdoc" "\
 Toggle automatic docstring checking (Checkdoc minor mode).
@@ -4753,9 +4665,7 @@ checking of documentation strings.
 \(fn &optional ARG)" t nil)
 
 (autoload 'checkdoc-package-keywords "checkdoc" "\
-Find package keywords that aren't in `finder-known-keywords'.
-
-\(fn)" t nil)
+Find package keywords that aren't in `finder-known-keywords'." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"checkdoc" '("checkdoc-")))
 
@@ -4772,9 +4682,7 @@ Return the length of resulting text.
 \(fn BEG END)" t nil)
 
 (autoload 'decode-hz-buffer "china-util" "\
-Decode HZ/ZW encoded text in the current buffer.
-
-\(fn)" t nil)
+Decode HZ/ZW encoded text in the current buffer." t nil)
 
 (autoload 'encode-hz-region "china-util" "\
 Encode the text in the current region to HZ.
@@ -4783,9 +4691,7 @@ Return the length of resulting text.
 \(fn BEG END)" t nil)
 
 (autoload 'encode-hz-buffer "china-util" "\
-Encode the text in the current buffer to HZ.
-
-\(fn)" t nil)
+Encode the text in the current buffer to HZ." t nil)
 
 (autoload 'post-read-decode-hz "china-util" "\
 
@@ -4819,9 +4725,7 @@ The number of commands listed is controlled by 
`list-command-history-max'.
 Calls value of `list-command-history-filter' (if non-nil) on each history
 element to judge if that element should be excluded from the list.
 
-The buffer is left in Command History mode.
-
-\(fn)" t nil)
+The buffer is left in Command History mode." t nil)
 
 (autoload 'command-history "chistory" "\
 Examine commands from `command-history' in a buffer.
@@ -4834,9 +4738,7 @@ and digits provide prefix arguments.  Tab does not indent.
 \\{command-history-map}
 
 This command always recompiles the Command History listing
-and runs the normal hook `command-history-hook'.
-
-\(fn)" t nil)
+and runs the normal hook `command-history-hook'." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"chistory" '("command-history-" "default-command-history-filter" 
"list-command-history-")))
 
@@ -5522,9 +5424,7 @@ doesn't have enough contents to decide, this is identical 
to
 See also `conf-space-mode', `conf-colon-mode', `conf-javaprop-mode',
 `conf-ppd-mode' and `conf-xdefaults-mode'.
 
-\\{conf-mode-map}
-
-\(fn)" t nil)
+\\{conf-mode-map}" t nil)
 
 (autoload 'conf-unix-mode "conf-mode" "\
 Conf Mode starter for Unix style Conf files.
@@ -5716,9 +5616,7 @@ interactively.
 Convert 2 digit years to 4 digit years.
 Uses heuristic: year >= 50 means 19xx, < 50 means 20xx.
 If `copyright-year-ranges' (which see) is non-nil, also
-independently replaces consecutive years with a range.
-
-\(fn)" t nil)
+independently replaces consecutive years with a range." t nil)
 
 (autoload 'copyright "copyright" "\
 Insert a copyright by $ORGANIZATION notice at cursor.
@@ -5928,9 +5826,7 @@ Run `perldoc' on WORD.
 \(fn WORD)" t nil)
 
 (autoload 'cperl-perldoc-at-point "cperl-mode" "\
-Run a `perldoc' on the word around point.
-
-\(fn)" t nil)
+Run a `perldoc' on the word around point." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"cperl-mode" '("cperl-" "pod2man-program")))
 
@@ -5948,9 +5844,7 @@ A prefix arg suppresses display of that buffer.
 \(fn ARG)" t nil)
 
 (autoload 'cpp-parse-edit "cpp" "\
-Edit display information for cpp conditionals.
-
-\(fn)" t nil)
+Edit display information for cpp conditionals." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"cpp" '("cpp-")))
 
@@ -6108,7 +6002,10 @@ if ARG is `toggle'; disable the mode otherwise.
 ;;;;;;  (0 0 0 0))
 ;;; Generated autoloads from emacs-lisp/cursor-sensor.el
 
-(defvar cursor-sensor-inhibit nil)
+(defvar cursor-sensor-inhibit nil "\
+When non-nil, suspend `cursor-sensor-mode' and `cursor-intangible-mode'.
+By convention, this is a list of symbols where each symbol stands for the
+\"cause\" of the suspension.")
 
 (autoload 'cursor-intangible-mode "cursor-sensor" "\
 Keep cursor outside of any `cursor-intangible' text property.
@@ -6226,9 +6123,7 @@ the resulting list value now.  Otherwise, add an entry to
 Select a customization buffer which you can use to set user options.
 User options are structured into \"groups\".
 Initially the top-level group `Emacs' and its immediate subgroups
-are shown; the contents of those subgroups are initially hidden.
-
-\(fn)" t nil)
+are shown; the contents of those subgroups are initially hidden." t nil)
 
 (autoload 'customize-mode "cus-edit" "\
 Customize options related to a major or minor mode.
@@ -6331,19 +6226,13 @@ suggest to customize that face, if it's customizable.
 \(fn &optional FACE)" t nil)
 
 (autoload 'customize-unsaved "cus-edit" "\
-Customize all options and faces set in this session but not saved.
-
-\(fn)" t nil)
+Customize all options and faces set in this session but not saved." t nil)
 
 (autoload 'customize-rogue "cus-edit" "\
-Customize all user variables modified outside customize.
-
-\(fn)" t nil)
+Customize all user variables modified outside customize." t nil)
 
 (autoload 'customize-saved "cus-edit" "\
-Customize all saved options and faces.
-
-\(fn)" t nil)
+Customize all saved options and faces." t nil)
 
 (autoload 'customize-apropos "cus-edit" "\
 Customize loaded options, faces and groups matching PATTERN.
@@ -6376,9 +6265,7 @@ Customize all loaded groups matching REGEXP.
 (autoload 'custom-prompt-customize-unsaved-options "cus-edit" "\
 Prompt user to customize any unsaved customization options.
 Return non-nil if user chooses to customize, for use in
-`kill-emacs-query-functions'.
-
-\(fn)" nil nil)
+`kill-emacs-query-functions'." nil nil)
 
 (autoload 'custom-buffer-create "cus-edit" "\
 Create a buffer containing OPTIONS.
@@ -6442,14 +6329,10 @@ and hence will not set `custom-file' to that file 
either.")
 (custom-autoload 'custom-file "cus-edit" t)
 
 (autoload 'custom-save-all "cus-edit" "\
-Save all customizations in `custom-file'.
-
-\(fn)" nil nil)
+Save all customizations in `custom-file'." nil nil)
 
 (autoload 'customize-save-customized "cus-edit" "\
-Save all user options which have been set in this session.
-
-\(fn)" t nil)
+Save all user options which have been set in this session." t nil)
 
 (autoload 'custom-menu-create "cus-edit" "\
 Create menu for customization group SYMBOL.
@@ -6847,7 +6730,7 @@ Trigger a debugger invocation when VARIABLE is changed.
 
 When called interactively, prompt for VARIABLE in the minibuffer.
 
-This works by calling `add-variable-watch' on VARIABLE.  If you
+This works by calling `add-variable-watcher' on VARIABLE.  If you
 quit from the debugger, this will abort the change (unless the
 change is caused by the termination of a let-binding).
 
@@ -6882,9 +6765,7 @@ To specify a nil argument interactively, exit with an 
empty minibuffer.
 ;;; Generated autoloads from play/decipher.el
 
 (autoload 'decipher "decipher" "\
-Format a buffer of ciphertext for cryptanalysis and enter Decipher mode.
-
-\(fn)" t nil)
+Format a buffer of ciphertext for cryptanalysis and enter Decipher mode." t 
nil)
 
 (autoload 'decipher-mode "decipher" "\
 Major mode for decrypting monoalphabetic substitution ciphers.
@@ -6900,9 +6781,7 @@ The most useful commands are:
 \\[decipher-frequency-count]  Display the frequency of each ciphertext letter
 \\[decipher-adjacency-list]  Show adjacency list for current letter (lists 
letters appearing next to it)
 \\[decipher-make-checkpoint]  Save the current cipher alphabet (checkpoint)
-\\[decipher-restore-checkpoint]  Restore a saved cipher alphabet (checkpoint)
-
-\(fn)" t nil)
+\\[decipher-restore-checkpoint]  Restore a saved cipher alphabet (checkpoint)" 
t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"decipher" '("decipher-")))
 
@@ -6913,9 +6792,7 @@ The most useful commands are:
 (push (purecopy '(delim-col 2 1)) package--builtin-versions)
 
 (autoload 'delimit-columns-customize "delim-col" "\
-Customization of `columns' group.
-
-\(fn)" t nil)
+Customization of `columns' group." t nil)
 
 (autoload 'delimit-columns-region "delim-col" "\
 Prettify all columns in a text region.
@@ -7064,13 +6941,22 @@ The position information includes POS; the total size 
of BUFFER; the
 region limits, if narrowed; the column number; and the horizontal
 scroll amount, if the buffer is horizontally scrolled.
 
-The character information includes the character code; charset and
-code points in it; syntax; category; how the character is encoded in
-BUFFER and in BUFFER's file; character composition information (if
-relevant); the font and font glyphs used to display the character;
-the character's canonical name and other properties defined by the
-Unicode Data Base; and widgets, buttons, overlays, and text properties
-relevant to POS.
+The character information includes:
+ its codepoint;
+ its charset (see `char-charset'), overridden by the `charset' text
+   property at POS, if any;
+ the codepoint of the character in the above charset;
+ the character's script (as defined by `char-script-table')
+ the character's syntax, as produced by `syntax-after'
+   and `internal-describe-syntax-value';
+ its category (see `char-category-set' and `describe-char-categories');
+ how to input the character using the keyboard and input methods;
+ how the character is encoded in BUFFER and in BUFFER's file;
+ the font and font glyphs used to display the character;
+ the composition information for displaying the character (if relevant);
+ the character's canonical name and other properties defined by the
+   Unicode Data Base;
+ and widgets, buttons, overlays, and text properties relevant to POS.
 
 \(fn POS &optional BUFFER)" t nil)
 
@@ -7085,9 +6971,7 @@ of `eldoc-echo-area-use-multiline-p' variable and width of
 minibuffer window for width limit.
 
 This function is meant to be used as a value of
-`eldoc-documentation-function' variable.
-
-\(fn)" nil nil)
+`eldoc-documentation-function' variable." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"descr-text" '("describe-")))
 
@@ -7246,9 +7130,7 @@ a regular expression in the list 
`desktop-clear-preserve-buffers'.
 Furthermore, it clears the variables listed in `desktop-globals-to-clear'.
 When called interactively and `desktop-restore-frames' is non-nil, it also
 deletes all frames except the selected one (and its minibuffer frame,
-if different).
-
-\(fn)" t nil)
+if different)." t nil)
 
 (autoload 'desktop-save "desktop" "\
 Save the desktop in a desktop file.
@@ -7280,9 +7162,7 @@ without further confirmation.
 
 (autoload 'desktop-remove "desktop" "\
 Delete desktop file in `desktop-dirname'.
-This function also sets `desktop-dirname' to nil.
-
-\(fn)" t nil)
+This function also sets `desktop-dirname' to nil." t nil)
 
 (autoload 'desktop-read "desktop" "\
 Read and process the desktop file in directory DIRNAME.
@@ -7304,14 +7184,10 @@ directory DIRNAME.
 \(fn DIRNAME)" t nil)
 
 (autoload 'desktop-save-in-desktop-dir "desktop" "\
-Save the desktop in directory `desktop-dirname'.
-
-\(fn)" t nil)
+Save the desktop in directory `desktop-dirname'." t nil)
 
 (autoload 'desktop-revert "desktop" "\
-Revert to the last loaded desktop.
-
-\(fn)" t nil)
+Revert to the last loaded desktop." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"desktop" '("desktop-")))
 
@@ -7343,9 +7219,7 @@ NODISPLAY is non-nil, don't redisplay the article buffer.
 \(fn &optional NODISPLAY)" t nil)
 
 (autoload 'gnus-article-outlook-deuglify-article "deuglify" "\
-Deuglify broken Outlook (Express) articles and redisplay.
-
-\(fn)" t nil)
+Deuglify broken Outlook (Express) articles and redisplay." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"deuglify" '("gnus-")))
 
@@ -7704,9 +7578,7 @@ redefine OBJECT if it is a symbol.
 ;;; Generated autoloads from disp-table.el
 
 (autoload 'make-display-table "disp-table" "\
-Return a new, empty display table.
-
-\(fn)" nil nil)
+Return a new, empty display table." nil nil)
 
 (autoload 'display-table-slot "disp-table" "\
 Return the value of the extra slot in DISPLAY-TABLE named SLOT.
@@ -7730,9 +7602,7 @@ Describe the display table DT in a help buffer.
 \(fn DT)" nil nil)
 
 (autoload 'describe-current-display-table "disp-table" "\
-Describe the display table in use in the selected window and buffer.
-
-\(fn)" t nil)
+Describe the display table in use in the selected window and buffer." t nil)
 
 (autoload 'standard-display-8bit "disp-table" "\
 Display characters representing raw bytes in the range L to H literally.
@@ -7930,9 +7800,7 @@ Turning on DNS mode runs `dns-mode-hook'.
  (defalias 'zone-mode 'dns-mode)
 
 (autoload 'dns-mode-soa-increment-serial "dns-mode" "\
-Locate SOA record and increment the serial field.
-
-\(fn)" t nil)
+Locate SOA record and increment the serial field." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"dns-mode" '("dns-mode-")))
 
@@ -7956,16 +7824,12 @@ and DVI files (as PNG images) in Emacs buffers.
 
 You can use \\<doc-view-mode-map>\\[doc-view-toggle-display] to
 toggle between displaying the document or editing it as text.
-\\{doc-view-mode-map}
-
-\(fn)" t nil)
+\\{doc-view-mode-map}" t nil)
 
 (autoload 'doc-view-mode-maybe "doc-view" "\
 Switch to `doc-view-mode' if possible.
 If the required external tools are not available, then fallback
-to the next best mode.
-
-\(fn)" nil nil)
+to the next best mode." nil nil)
 
 (autoload 'doc-view-minor-mode "doc-view" "\
 Toggle displaying buffer via Doc View (Doc View minor mode).
@@ -7992,9 +7856,7 @@ See the command `doc-view-mode' for more information on 
this mode.
 ;;; Generated autoloads from play/doctor.el
 
 (autoload 'doctor "doctor" "\
-Switch to *doctor* buffer and start giving psychotherapy.
-
-\(fn)" t nil)
+Switch to *doctor* buffer and start giving psychotherapy." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"doctor" '("doc" "make-doctor-variables")))
 
@@ -8053,9 +7915,7 @@ strings when pressed twice.  See `double-map' for details.
 (push (purecopy '(dunnet 2 2)) package--builtin-versions)
 
 (autoload 'dunnet "dunnet" "\
-Switch to *dungeon* buffer and start game.
-
-\(fn)" t nil)
+Switch to *dungeon* buffer and start game." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"dunnet" '("dun" "obj-special")))
 
@@ -8416,9 +8276,7 @@ To implement dynamic menus, either call this from
 (push (purecopy '(ebnf2ps 4 4)) package--builtin-versions)
 
 (autoload 'ebnf-customize "ebnf2ps" "\
-Customization for ebnf group.
-
-\(fn)" t nil)
+Customization for ebnf group." t nil)
 
 (autoload 'ebnf-print-directory "ebnf2ps" "\
 Generate and print a PostScript syntactic chart image of DIRECTORY.
@@ -8489,9 +8347,7 @@ Generate and spool a PostScript syntactic chart image of 
the buffer.
 Like `ebnf-print-buffer' except that the PostScript image is saved in a
 local buffer to be sent to the printer later.
 
-Use the command `ebnf-despool' to send the spooled images to the printer.
-
-\(fn)" t nil)
+Use the command `ebnf-despool' to send the spooled images to the printer." t 
nil)
 
 (autoload 'ebnf-spool-region "ebnf2ps" "\
 Generate a PostScript syntactic chart image of the region and spool locally.
@@ -8541,9 +8397,7 @@ The EPS file name has the following form:
             file name used in this case will be \"ebnf--A_B_+_C.eps\".
 
 WARNING: This function does *NOT* ask any confirmation to override existing
-        files.
-
-\(fn)" t nil)
+        files." t nil)
 
 (autoload 'ebnf-eps-region "ebnf2ps" "\
 Generate a PostScript syntactic chart image of the region in an EPS file.
@@ -8592,9 +8446,7 @@ See also `ebnf-syntax-buffer'.
 \(fn FILE &optional DO-NOT-KILL-BUFFER-WHEN-DONE)" t nil)
 
 (autoload 'ebnf-syntax-buffer "ebnf2ps" "\
-Do a syntactic analysis of the current buffer.
-
-\(fn)" t nil)
+Do a syntactic analysis of the current buffer." t nil)
 
 (autoload 'ebnf-syntax-region "ebnf2ps" "\
 Do a syntactic analysis of a region.
@@ -8602,9 +8454,7 @@ Do a syntactic analysis of a region.
 \(fn FROM TO)" t nil)
 
 (autoload 'ebnf-setup "ebnf2ps" "\
-Return the current ebnf2ps setup.
-
-\(fn)" nil nil)
+Return the current ebnf2ps setup." nil nil)
 
 (autoload 'ebnf-find-style "ebnf2ps" "\
 Return style definition if NAME is already defined; otherwise, return nil.
@@ -8670,9 +8520,7 @@ Returns the old style symbol.
 
 See also `ebnf-push-style'.
 
-See `ebnf-style-database' documentation.
-
-\(fn)" t nil)
+See `ebnf-style-database' documentation." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"ebnf2ps" '("ebnf-")))
 
@@ -8694,9 +8542,7 @@ Tree mode key bindings:
 \(fn)" t nil)
 
 (autoload 'ebrowse-electric-choose-tree "ebrowse" "\
-Return a buffer containing a tree or nil if no tree found or canceled.
-
-\(fn)" t nil)
+Return a buffer containing a tree or nil if no tree found or canceled." t nil)
 
 (autoload 'ebrowse-member-mode "ebrowse" "\
 Major mode for Ebrowse member buffers.
@@ -8704,54 +8550,34 @@ Major mode for Ebrowse member buffers.
 \(fn)" t nil)
 
 (autoload 'ebrowse-tags-view-declaration "ebrowse" "\
-View declaration of member at point.
-
-\(fn)" t nil)
+View declaration of member at point." t nil)
 
 (autoload 'ebrowse-tags-find-declaration "ebrowse" "\
-Find declaration of member at point.
-
-\(fn)" t nil)
+Find declaration of member at point." t nil)
 
 (autoload 'ebrowse-tags-view-definition "ebrowse" "\
-View definition of member at point.
-
-\(fn)" t nil)
+View definition of member at point." t nil)
 
 (autoload 'ebrowse-tags-find-definition "ebrowse" "\
-Find definition of member at point.
-
-\(fn)" t nil)
+Find definition of member at point." t nil)
 
 (autoload 'ebrowse-tags-find-declaration-other-window "ebrowse" "\
-Find declaration of member at point in other window.
-
-\(fn)" t nil)
+Find declaration of member at point in other window." t nil)
 
 (autoload 'ebrowse-tags-view-definition-other-window "ebrowse" "\
-View definition of member at point in other window.
-
-\(fn)" t nil)
+View definition of member at point in other window." t nil)
 
 (autoload 'ebrowse-tags-find-definition-other-window "ebrowse" "\
-Find definition of member at point in other window.
-
-\(fn)" t nil)
+Find definition of member at point in other window." t nil)
 
 (autoload 'ebrowse-tags-find-declaration-other-frame "ebrowse" "\
-Find definition of member at point in other frame.
-
-\(fn)" t nil)
+Find definition of member at point in other frame." t nil)
 
 (autoload 'ebrowse-tags-view-definition-other-frame "ebrowse" "\
-View definition of member at point in other frame.
-
-\(fn)" t nil)
+View definition of member at point in other frame." t nil)
 
 (autoload 'ebrowse-tags-find-definition-other-frame "ebrowse" "\
-Find definition of member at point in other frame.
-
-\(fn)" t nil)
+Find definition of member at point in other frame." t nil)
 
 (autoload 'ebrowse-tags-complete-symbol "ebrowse" "\
 Perform completion on the C++ symbol preceding point.
@@ -8803,14 +8629,10 @@ Prefix arg ARG says how much.
 \(fn ARG)" t nil)
 
 (autoload 'ebrowse-electric-position-menu "ebrowse" "\
-List positions in the position stack in an electric buffer.
-
-\(fn)" t nil)
+List positions in the position stack in an electric buffer." t nil)
 
 (autoload 'ebrowse-save-tree "ebrowse" "\
-Save current tree in same file it was loaded from.
-
-\(fn)" t nil)
+Save current tree in same file it was loaded from." t nil)
 
 (autoload 'ebrowse-save-tree-as "ebrowse" "\
 Write the current tree data structure to a file.
@@ -8820,9 +8642,7 @@ Otherwise, FILE-NAME specifies the file to save the tree 
in.
 \(fn &optional FILE-NAME)" t nil)
 
 (autoload 'ebrowse-statistics "ebrowse" "\
-Display statistics for a class tree.
-
-\(fn)" t nil)
+Display statistics for a class tree." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"ebrowse" '("ebrowse-" "electric-buffer-menu-mode-hook")))
 
@@ -8880,9 +8700,7 @@ With prefix arg NOCONFIRM, execute current line as-is 
without editing.
 ;;; Generated autoloads from ecomplete.el
 
 (autoload 'ecomplete-setup "ecomplete" "\
-Read the .ecompleterc file.
-
-\(fn)" nil nil)
+Read the .ecompleterc file." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"ecomplete" '("ecomplete-")))
 
@@ -9240,19 +9058,13 @@ If the current defun is actually a call to `defvar' or 
`defcustom',
 evaluating it this way resets the variable using its initial value
 expression even if the variable already has some other value.
 \(Normally `defvar' and `defcustom' do not alter the value if there
-already is one.)
-
-\(fn)" t nil)
+already is one.)" t nil)
 
 (autoload 'edebug-all-defs "edebug" "\
-Toggle edebugging of all definitions.
-
-\(fn)" t nil)
+Toggle edebugging of all definitions." t nil)
 
 (autoload 'edebug-all-forms "edebug" "\
-Toggle edebugging of all forms.
-
-\(fn)" t nil)
+Toggle edebugging of all forms." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"edebug" '("cancel-edebug-on-entry" "edebug" "get-edebug-spec" 
"global-edebug-")))
 
@@ -9283,9 +9095,7 @@ arguments after setting up the Ediff buffers.
 (autoload 'ediff-current-file "ediff" "\
 Start ediff between current buffer and its file on disk.
 This command can be used instead of `revert-buffer'.  If there is
-nothing to revert then this command fails.
-
-\(fn)" t nil)
+nothing to revert then this command fails." t nil)
 
 (autoload 'ediff-backup "ediff" "\
 Run Ediff on FILE and its backup file.
@@ -9393,6 +9203,7 @@ MERGE-AUTOSTORE-DIR is the directory in which to store 
merged files.
 
 (autoload 'ediff-windows-wordwise "ediff" "\
 Compare WIND-A and WIND-B, which are selected by clicking, wordwise.
+This compares the portions of text visible in each of the two windows.
 With prefix argument, DUMB-MODE, or on a non-windowing display, works as
 follows:
 If WIND-A is nil, use selected window.
@@ -9404,6 +9215,7 @@ arguments after setting up the Ediff buffers.
 
 (autoload 'ediff-windows-linewise "ediff" "\
 Compare WIND-A and WIND-B, which are selected by clicking, linewise.
+This compares the portions of text visible in each of the two windows.
 With prefix argument, DUMB-MODE, or on a non-windowing display, works as
 follows:
 If WIND-A is nil, use selected window.
@@ -9417,8 +9229,8 @@ arguments after setting up the Ediff buffers.
 Run Ediff on a pair of regions in specified buffers.
 BUFFER-A and BUFFER-B are the buffers to be compared.
 Regions (i.e., point and mark) can be set in advance or marked interactively.
-This function is effective only for relatively small regions, up to 200
-lines.  For large regions, use `ediff-regions-linewise'.
+This function might be slow for large regions.  If you find it slow,
+use `ediff-regions-linewise' instead.
 STARTUP-HOOKS is a list of functions that Emacs calls without
 arguments after setting up the Ediff buffers.
 
@@ -9545,9 +9357,7 @@ arguments after setting up the Ediff buffers.
 
 (autoload 'ediff-version "ediff" "\
 Return string describing the version of Ediff.
-When called interactively, displays the version.
-
-\(fn)" t nil)
+When called interactively, displays the version." t nil)
 
 (autoload 'ediff-documentation "ediff" "\
 Display Ediff's manual.
@@ -9556,44 +9366,28 @@ With optional NODE, goes to that node.
 \(fn &optional NODE)" t nil)
 
 (autoload 'ediff-files-command "ediff" "\
-Call `ediff-files' with the next two command line arguments.
-
-\(fn)" nil nil)
+Call `ediff-files' with the next two command line arguments." nil nil)
 
 (autoload 'ediff3-files-command "ediff" "\
-Call `ediff3-files' with the next three command line arguments.
-
-\(fn)" nil nil)
+Call `ediff3-files' with the next three command line arguments." nil nil)
 
 (autoload 'ediff-merge-command "ediff" "\
-Call `ediff-merge-files' with the next two command line arguments.
-
-\(fn)" nil nil)
+Call `ediff-merge-files' with the next two command line arguments." nil nil)
 
 (autoload 'ediff-merge-with-ancestor-command "ediff" "\
-Call `ediff-merge-files-with-ancestor' with the next three command line 
arguments.
-
-\(fn)" nil nil)
+Call `ediff-merge-files-with-ancestor' with the next three command line 
arguments." nil nil)
 
 (autoload 'ediff-directories-command "ediff" "\
-Call `ediff-directories' with the next three command line arguments.
-
-\(fn)" nil nil)
+Call `ediff-directories' with the next three command line arguments." nil nil)
 
 (autoload 'ediff-directories3-command "ediff" "\
-Call `ediff-directories3' with the next four command line arguments.
-
-\(fn)" nil nil)
+Call `ediff-directories3' with the next four command line arguments." nil nil)
 
 (autoload 'ediff-merge-directories-command "ediff" "\
-Call `ediff-merge-directories' with the next three command line arguments.
-
-\(fn)" nil nil)
+Call `ediff-merge-directories' with the next three command line arguments." 
nil nil)
 
 (autoload 'ediff-merge-directories-with-ancestor-command "ediff" "\
-Call `ediff-merge-directories-with-ancestor' with the next four command line 
arguments.
-
-\(fn)" nil nil)
+Call `ediff-merge-directories-with-ancestor' with the next four command line 
arguments." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"ediff" '("ediff-")))
 
@@ -9609,10 +9403,7 @@ Call `ediff-merge-directories-with-ancestor' with the 
next four command line arg
 ;;;### (autoloads nil "ediff-help" "vc/ediff-help.el" (0 0 0 0))
 ;;; Generated autoloads from vc/ediff-help.el
 
-(autoload 'ediff-customize "ediff-help" "\
-
-
-\(fn)" t nil)
+(autoload 'ediff-customize "ediff-help" nil t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"ediff-help" '("ediff-")))
 
@@ -9636,9 +9427,7 @@ Call `ediff-merge-directories-with-ancestor' with the 
next four command line arg
 ;;; Generated autoloads from vc/ediff-mult.el
 
 (autoload 'ediff-show-registry "ediff-mult" "\
-Display Ediff's registry.
-
-\(fn)" t nil)
+Display Ediff's registry." t nil)
 
 (defalias 'eregistry 'ediff-show-registry)
 
@@ -9659,16 +9448,12 @@ Display Ediff's registry.
 (autoload 'ediff-toggle-multiframe "ediff-util" "\
 Switch from multiframe display to single-frame display and back.
 To change the default, set the variable `ediff-window-setup-function',
-which see.
-
-\(fn)" t nil)
+which see." t nil)
 
 (autoload 'ediff-toggle-use-toolbar "ediff-util" "\
 Enable or disable Ediff toolbar.
 Works only in versions of Emacs that support toolbars.
-To change the default, set the variable `ediff-use-toolbar-p', which see.
-
-\(fn)" t nil)
+To change the default, set the variable `ediff-use-toolbar-p', which see." t 
nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"ediff-util" '("ediff-")))
 
@@ -9751,9 +9536,7 @@ Argument BOTTOM is the bottom margin in number of lines 
or percent of window.
 \(fn TOP BOTTOM)" t nil)
 
 (autoload 'edt-emulation-on "edt" "\
-Turn on EDT Emulation.
-
-\(fn)" t nil)
+Turn on EDT Emulation." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"edt" '("edt-")))
 
@@ -9981,15 +9764,11 @@ A complicated directory may require a lot of memory.
 
 (autoload 'elint-current-buffer "elint" "\
 Lint the current buffer.
-If necessary, this first calls `elint-initialize'.
-
-\(fn)" t nil)
+If necessary, this first calls `elint-initialize'." t nil)
 
 (autoload 'elint-defun "elint" "\
 Lint the function at point.
-If necessary, this first calls `elint-initialize'.
-
-\(fn)" t nil)
+If necessary, this first calls `elint-initialize'." t nil)
 
 (autoload 'elint-initialize "elint" "\
 Initialize elint.
@@ -10031,9 +9810,7 @@ For example, to instrument all ELP functions, do the 
following:
 Display current profiling results.
 If `elp-reset-after-results' is non-nil, then current profiling
 information for all instrumented functions is reset after results are
-displayed.
-
-\(fn)" t nil)
+displayed." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"elp" '("elp-")))
 
@@ -10243,15 +10020,9 @@ Run Emerge on two buffers, giving another buffer as 
the ancestor.
 
 \(fn BUFFER-A BUFFER-B BUFFER-ANCESTOR &optional STARTUP-HOOKS QUIT-HOOKS)" t 
nil)
 
-(autoload 'emerge-files-command "emerge" "\
-
-
-\(fn)" nil nil)
-
-(autoload 'emerge-files-with-ancestor-command "emerge" "\
-
+(autoload 'emerge-files-command "emerge" nil nil nil)
 
-\(fn)" nil nil)
+(autoload 'emerge-files-with-ancestor-command "emerge" nil nil nil)
 
 (autoload 'emerge-files-remote "emerge" "\
 
@@ -10514,24 +10285,16 @@ Insert selected KEYS after the point.
 ;;; Generated autoloads from epa-dired.el
 
 (autoload 'epa-dired-do-decrypt "epa-dired" "\
-Decrypt marked files.
-
-\(fn)" t nil)
+Decrypt marked files." t nil)
 
 (autoload 'epa-dired-do-verify "epa-dired" "\
-Verify marked files.
-
-\(fn)" t nil)
+Verify marked files." t nil)
 
 (autoload 'epa-dired-do-sign "epa-dired" "\
-Sign marked files.
-
-\(fn)" t nil)
+Sign marked files." t nil)
 
 (autoload 'epa-dired-do-encrypt "epa-dired" "\
-Encrypt marked files.
-
-\(fn)" t nil)
+Encrypt marked files." t nil)
 
 ;;;***
 
@@ -10543,15 +10306,9 @@ Encrypt marked files.
 
 \(fn OPERATION &rest ARGS)" nil nil)
 
-(autoload 'epa-file-enable "epa-file" "\
+(autoload 'epa-file-enable "epa-file" nil t nil)
 
-
-\(fn)" t nil)
-
-(autoload 'epa-file-disable "epa-file" "\
-
-
-\(fn)" t nil)
+(autoload 'epa-file-disable "epa-file" nil t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"epa-file" '("epa-")))
 
@@ -10572,17 +10329,13 @@ if ARG is `toggle'; disable the mode otherwise.
 
 (autoload 'epa-mail-decrypt "epa-mail" "\
 Decrypt OpenPGP armors in the current buffer.
-The buffer is expected to contain a mail message.
-
-\(fn)" t nil)
+The buffer is expected to contain a mail message." t nil)
 
 (function-put 'epa-mail-decrypt 'interactive-only 't)
 
 (autoload 'epa-mail-verify "epa-mail" "\
 Verify OpenPGP cleartext signed messages in the current buffer.
-The buffer is expected to contain a mail message.
-
-\(fn)" t nil)
+The buffer is expected to contain a mail message." t nil)
 
 (function-put 'epa-mail-verify 'interactive-only 't)
 
@@ -10611,9 +10364,7 @@ SIGNERS is a list of keys to sign the message with.
 
 (autoload 'epa-mail-import-keys "epa-mail" "\
 Import keys in the OpenPGP armor format in the current buffer.
-The buffer is expected to contain a mail message.
-
-\(fn)" t nil)
+The buffer is expected to contain a mail message." t nil)
 
 (function-put 'epa-mail-import-keys 'interactive-only 't)
 
@@ -10671,9 +10422,7 @@ version requirement is met.
 \(fn PROTOCOL &optional NO-CACHE PROGRAM-ALIST)" nil nil)
 
 (autoload 'epg-configuration "epg-config" "\
-Return a list of internal configuration parameters of `epg-gpg-program'.
-
-\(fn)" nil nil)
+Return a list of internal configuration parameters of `epg-gpg-program'." nil 
nil)
 
 (make-obsolete 'epg-configuration 'epg-find-configuration '"25.1")
 
@@ -10701,9 +10450,7 @@ Look at CONFIG and try to expand GROUP.
 (push (purecopy '(erc 5 3)) package--builtin-versions)
 
 (autoload 'erc-select-read-args "erc" "\
-Prompt the user for values of nick, server, port, and password.
-
-\(fn)" nil nil)
+Prompt the user for values of nick, server, port, and password." nil nil)
 
 (autoload 'erc "erc" "\
 ERC is a powerful, modular, and extensible IRC client.
@@ -10910,14 +10657,10 @@ Otherwise, connect to HOST:PORT as USER and /join 
CHANNEL.
 (autoload 'erc-determine-network "erc-networks" "\
 Return the name of the network or \"Unknown\" as a symbol.  Use the
 server parameter NETWORK if provided, otherwise parse the server name and
-search for a match in `erc-networks-alist'.
-
-\(fn)" nil nil)
+search for a match in `erc-networks-alist'." nil nil)
 
 (autoload 'erc-server-select "erc-networks" "\
-Interactively select a server to connect to using `erc-server-alist'.
-
-\(fn)" t nil)
+Interactively select a server to connect to using `erc-server-alist'." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"erc-networks" '("erc-")))
 
@@ -11104,9 +10847,7 @@ Display the documentation for TEST-OR-TEST-NAME (a 
symbol or ert-test).
 (put 'ert-with-test-buffer 'lisp-indent-function 1)
 
 (autoload 'ert-kill-all-test-buffers "ert-x" "\
-Kill all test buffers that are still live.
-
-\(fn)" t nil)
+Kill all test buffers that are still live." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"ert-x" '("ert-")))
 
@@ -11320,14 +11061,9 @@ Returns t if it visits a tags table, or nil if there 
are no more in the list.
 Return a list of files in the current tags table.
 Assumes the tags table is the current buffer.  The file names are returned
 as they appeared in the `etags' command that created the table, usually
-without directory names.
+without directory names." nil nil)
 
-\(fn)" nil nil)
-
-(autoload 'tags-lazy-completion-table "etags" "\
-
-
-\(fn)" nil nil)
+(autoload 'tags-lazy-completion-table "etags" nil nil nil)
  (defun tags-completion-at-point-function ()
   (if (or tags-table-list tags-file-name)
       (progn
@@ -11475,7 +11211,7 @@ argument is passed to `next-file', which see).
 
 \(fn &optional FIRST-TIME)" t nil)
 
-(make-obsolete 'tags-loop-continue 'multifile-continue '"27.1")
+(make-obsolete 'tags-loop-continue 'fileloop-continue '"27.1")
 
 (autoload 'tags-search "etags" "\
 Search through all files listed in tags table for match for REGEXP.
@@ -11494,7 +11230,7 @@ Do `query-replace-regexp' of FROM with TO on all files 
listed in tags table.
 Third arg DELIMITED (prefix arg) means replace only word-delimited matches.
 If you exit (\\[keyboard-quit], RET or q), you can resume the query replace
 with the command \\[tags-loop-continue].
-For non-interactive use, superceded by `multifile-initialize-replace'.
+For non-interactive use, superceded by `fileloop-initialize-replace'.
 
 \(fn FROM TO &optional DELIMITED FILES)" t nil)
 
@@ -11518,22 +11254,15 @@ Display list of all tags in tags table REGEXP matches.
 (autoload 'select-tags-table "etags" "\
 Select a tags table file from a menu of those you have already used.
 The list of tags tables to select from is stored in `tags-table-set-list';
-see the doc of that variable if you want to add names to the list.
-
-\(fn)" t nil)
+see the doc of that variable if you want to add names to the list." t nil)
 
 (autoload 'complete-tag "etags" "\
 Perform tags completion on the text around point.
 Completes to the set of names listed in the current tags table.
 The string to complete is chosen in the same way as the default
-for \\[find-tag] (which see).
-
-\(fn)" t nil)
-
-(autoload 'etags--xref-backend "etags" "\
+for \\[find-tag] (which see)." t nil)
 
-
-\(fn)" nil nil)
+(autoload 'etags--xref-backend "etags" nil nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"etags" '("default-tags-table-function" "etags-" "file-of-tag" "find-tag-" 
"goto-tag-location-function" "initialize-new-tags-table" "last-tag" 
"list-tags-function" "select-tags-table-" "snarf-tag-function" "tag" 
"verify-tags-table-function" "xref-")))
 
@@ -11543,10 +11272,7 @@ for \\[find-tag] (which see).
 ;;;;;;  0 0))
 ;;; Generated autoloads from language/ethio-util.el
 
-(autoload 'setup-ethiopic-environment-internal "ethio-util" "\
-
-
-\(fn)" nil nil)
+(autoload 'setup-ethiopic-environment-internal "ethio-util" nil nil nil)
 
 (autoload 'ethio-sera-to-fidel-buffer "ethio-util" "\
 Convert the current buffer from SERA to FIDEL.
@@ -11635,9 +11361,7 @@ The markers \"<sera>\" and \"</sera>\" themselves are 
not deleted.
 \(fn &optional FORCE)" t nil)
 
 (autoload 'ethio-modify-vowel "ethio-util" "\
-Modify the vowel of the FIDEL that is under the cursor.
-
-\(fn)" t nil)
+Modify the vowel of the FIDEL that is under the cursor." t nil)
 
 (autoload 'ethio-replace-space "ethio-util" "\
 Replace ASCII spaces with Ethiopic word separators in the region.
@@ -11660,14 +11384,10 @@ This function is deprecated.
 \(fn ARG)" t nil)
 
 (autoload 'ethio-fidel-to-tex-buffer "ethio-util" "\
-Convert each fidel characters in the current buffer into a fidel-tex command.
-
-\(fn)" t nil)
+Convert each fidel characters in the current buffer into a fidel-tex command." 
t nil)
 
 (autoload 'ethio-tex-to-fidel-buffer "ethio-util" "\
-Convert fidel-tex commands in the current buffer into fidel chars.
-
-\(fn)" t nil)
+Convert fidel-tex commands in the current buffer into fidel chars." t nil)
 
 (autoload 'ethio-fidel-to-java-buffer "ethio-util" "\
 Convert Ethiopic characters into the Java escape sequences.
@@ -11676,24 +11396,16 @@ Each escape sequence is of the form \\uXXXX, where 
XXXX is the
 character's codepoint (in hex) in Unicode.
 
 If `ethio-java-save-lowercase' is non-nil, use [0-9a-f].
-Otherwise, [0-9A-F].
-
-\(fn)" nil nil)
+Otherwise, [0-9A-F]." nil nil)
 
 (autoload 'ethio-java-to-fidel-buffer "ethio-util" "\
-Convert the Java escape sequences into corresponding Ethiopic characters.
-
-\(fn)" nil nil)
+Convert the Java escape sequences into corresponding Ethiopic characters." nil 
nil)
 
 (autoload 'ethio-find-file "ethio-util" "\
-Transliterate file content into Ethiopic depending on filename suffix.
-
-\(fn)" nil nil)
+Transliterate file content into Ethiopic depending on filename suffix." nil 
nil)
 
 (autoload 'ethio-write-file "ethio-util" "\
-Transliterate Ethiopic characters in ASCII depending on the file extension.
-
-\(fn)" nil nil)
+Transliterate Ethiopic characters in ASCII depending on the file extension." 
nil nil)
 
 (autoload 'ethio-insert-ethio-space "ethio-util" "\
 Insert the Ethiopic word delimiter (the colon-like character).
@@ -11756,9 +11468,7 @@ queries the server for the existing fields and displays 
a corresponding form.
 
 (autoload 'eudc-load-eudc "eudc" "\
 Load the Emacs Unified Directory Client.
-This does nothing except loading eudc by autoload side-effect.
-
-\(fn)" t nil)
+This does nothing except loading eudc by autoload side-effect." t nil)
 
 (defvar eudc-tools-menu (let ((map (make-sparse-keymap "Directory Servers"))) 
(define-key map [phone] `(menu-item ,(purecopy "Get Phone") eudc-get-phone 
:help ,(purecopy "Get the phone field of name from the directory server"))) 
(define-key map [email] `(menu-item ,(purecopy "Get Email") eudc-get-email 
:help ,(purecopy "Get the email field of NAME from the directory server"))) 
(define-key map [separator-eudc-email] menu-bar-separator) (define-key map 
[expand-inline] `(menu-item ,(purecop [...]
 
@@ -11810,14 +11520,10 @@ Display a button for the JPEG DATA.
 
 (autoload 'eudc-insert-record-at-point-into-bbdb "eudc-export" "\
 Insert record at point into the BBDB database.
-This function can only be called from a directory query result buffer.
-
-\(fn)" t nil)
+This function can only be called from a directory query result buffer." t nil)
 
 (autoload 'eudc-try-bbdb-insert "eudc-export" "\
-Call `eudc-insert-record-at-point-into-bbdb' if on a record.
-
-\(fn)" t nil)
+Call `eudc-insert-record-at-point-into-bbdb' if on a record." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"eudc-export" '("eudc-")))
 
@@ -11828,9 +11534,7 @@ Call `eudc-insert-record-at-point-into-bbdb' if on a 
record.
 ;;; Generated autoloads from net/eudc-hotlist.el
 
 (autoload 'eudc-edit-hotlist "eudc-hotlist" "\
-Edit the hotlist of directory servers in a specialized buffer.
-
-\(fn)" t nil)
+Edit the hotlist of directory servers in a specialized buffer." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"eudc-hotlist" '("eudc-hotlist-")))
 
@@ -11908,7 +11612,10 @@ Fetch URL and render the page.
 If the input doesn't look like an URL or a domain name, the
 word(s) will be searched for via `eww-search-prefix'.
 
-\(fn URL)" t nil)
+If called with a prefix ARG, use a new buffer instead of reusing
+the default EWW buffer.
+
+\(fn URL &optional ARG)" t nil)
  (defalias 'browse-web 'eww)
 
 (autoload 'eww-open-file "eww" "\
@@ -11921,9 +11628,7 @@ Search the web for the text between BEG and END.
 If region is active (and not whitespace), search the web for
 the text between BEG and END.  Else, prompt the user for a search
 string.  See the `eww-search-prefix' variable for the search
-engine used.
-
-\(fn)" t nil)
+engine used." t nil)
 
 (autoload 'eww-mode "eww" "\
 Mode for browsing the web.
@@ -11936,9 +11641,7 @@ Mode for browsing the web.
 \(fn URL &optional NEW-WINDOW)" nil nil)
 
 (autoload 'eww-list-bookmarks "eww" "\
-Display the bookmarks.
-
-\(fn)" t nil)
+Display the bookmarks." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"eww" '("eww-")))
 
@@ -11974,9 +11677,7 @@ executable.
 (autoload 'executable-make-buffer-file-executable-if-script-p "executable" "\
 Make file executable according to umask if not already executable.
 If file already has any execute bits set at all, do not change existing
-file modes.
-
-\(fn)" nil nil)
+file modes." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"executable" '("executable-")))
 
@@ -12011,21 +11712,15 @@ If ARG is omitted, point is placed at the end of the 
expanded text.
 
 (autoload 'expand-abbrev-hook "expand" "\
 Abbrev hook used to do the expansion job of expand abbrevs.
-See `expand-add-abbrevs'.  Value is non-nil if expansion was done.
-
-\(fn)" nil nil)
+See `expand-add-abbrevs'.  Value is non-nil if expansion was done." nil nil)
 
 (autoload 'expand-jump-to-previous-slot "expand" "\
 Move the cursor to the previous slot in the last abbrev expansion.
-This is used only in conjunction with `expand-add-abbrevs'.
-
-\(fn)" t nil)
+This is used only in conjunction with `expand-add-abbrevs'." t nil)
 
 (autoload 'expand-jump-to-next-slot "expand" "\
 Move the cursor to the next slot in the last abbrev expansion.
-This is used only in conjunction with `expand-add-abbrevs'.
-
-\(fn)" t nil)
+This is used only in conjunction with `expand-add-abbrevs'." t nil)
  (define-key abbrev-map "p" 'expand-jump-to-previous-slot)
  (define-key abbrev-map "n" 'expand-jump-to-next-slot)
 
@@ -12279,9 +11974,7 @@ Besides the choice of face, it is the same as 
`buffer-face-mode'.
 (push (purecopy '(faceup 0 0 6)) package--builtin-versions)
 
 (autoload 'faceup-view-buffer "faceup" "\
-Display the faceup representation of the current buffer.
-
-\(fn)" t nil)
+Display the faceup representation of the current buffer." t nil)
 
 (autoload 'faceup-write-file "faceup" "\
 Save the faceup representation of the current buffer to the file FILE-NAME.
@@ -12301,9 +11994,7 @@ Convert BUFFER containing Faceup markup to a new buffer 
and display it.
 \(fn &optional BUFFER)" t nil)
 
 (autoload 'faceup-clean-buffer "faceup" "\
-Remove faceup markup from buffer.
-
-\(fn)" t nil)
+Remove faceup markup from buffer." t nil)
 
 (autoload 'faceup-defexplainer "faceup" "\
 Define an Ert explainer function for FUNCTION.
@@ -12324,9 +12015,7 @@ FUNCTION must return an explanation when the test fails 
and
 (autoload 'feedmail-send-it "feedmail" "\
 Send the current mail buffer using the Feedmail package.
 This is a suitable value for `send-mail-function'.  It can be used
-with various lower-level mechanisms to provide features such as queueing.
-
-\(fn)" nil nil)
+with various lower-level mechanisms to provide features such as queueing." nil 
nil)
 
 (autoload 'feedmail-run-the-queue-no-prompts "feedmail" "\
 Like `feedmail-run-the-queue', but suppress confirmation prompts.
@@ -12426,14 +12115,10 @@ If `dired-at-point-require-prefix' is set, the prefix 
meaning is reversed.
 
 (autoload 'ffap-guess-file-name-at-point "ffap" "\
 Try to get a file name at point.
-This hook is intended to be put in `file-name-at-point-functions'.
-
-\(fn)" nil nil)
+This hook is intended to be put in `file-name-at-point-functions'." nil nil)
 
 (autoload 'ffap-bindings "ffap" "\
-Evaluate the forms in variable `ffap-bindings'.
-
-\(fn)" t nil)
+Evaluate the forms in variable `ffap-bindings'." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"ffap" '("dired-at-point-" "ffap-" "find-file-literally-at-point")))
 
@@ -12498,6 +12183,41 @@ the name is considered already unique; only the second 
substitution
 
 ;;;***
 
+;;;### (autoloads nil "fileloop" "fileloop.el" (0 0 0 0))
+;;; Generated autoloads from fileloop.el
+
+(autoload 'fileloop-initialize "fileloop" "\
+Initialize a new round of operation on several files.
+FILES can be either a list of file names, or an iterator (used with 
`iter-next')
+which returns a file name at each step.
+SCAN-FUNCTION is a function called with no argument inside a buffer
+and it should return non-nil if that buffer has something on which to operate.
+OPERATE-FUNCTION is a function called with no argument; it is expected
+to perform the operation on the current file buffer and when done
+should return non-nil to mean that we should immediately continue
+operating on the next file and nil otherwise.
+
+\(fn FILES SCAN-FUNCTION OPERATE-FUNCTION)" nil nil)
+
+(autoload 'fileloop-initialize-search "fileloop" "\
+
+
+\(fn REGEXP FILES CASE-FOLD)" nil nil)
+
+(autoload 'fileloop-initialize-replace "fileloop" "\
+Initialize a new round of query&replace on several files.
+FROM is a regexp and TO is the replacement to use.
+FILES describes the file, as in `fileloop-initialize'.
+CASE-FOLD can be t, nil, or `default', the latter one meaning to obey
+the default setting of `case-fold-search'.
+DELIMITED if non-nil means replace only word-delimited matches.
+
+\(fn FROM TO FILES CASE-FOLD &optional DELIMITED)" nil nil)
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"fileloop" '("fileloop-")))
+
+;;;***
+
 ;;;### (autoloads nil "filenotify" "filenotify.el" (0 0 0 0))
 ;;; Generated autoloads from filenotify.el
 
@@ -12564,19 +12284,13 @@ Delete all MODE settings of file-local VARIABLE from 
.dir-locals.el.
 \(fn MODE VARIABLE)" t nil)
 
 (autoload 'copy-file-locals-to-dir-locals "files-x" "\
-Copy file-local variables to .dir-locals.el.
-
-\(fn)" t nil)
+Copy file-local variables to .dir-locals.el." t nil)
 
 (autoload 'copy-dir-locals-to-file-locals "files-x" "\
-Copy directory-local variables to the Local Variables list.
-
-\(fn)" t nil)
+Copy directory-local variables to the Local Variables list." t nil)
 
 (autoload 'copy-dir-locals-to-file-locals-prop-line "files-x" "\
-Copy directory-local variables to the -*- line.
-
-\(fn)" t nil)
+Copy directory-local variables to the -*- line." t nil)
 
 (defvar enable-connection-local-variables t "\
 Non-nil means enable use of connection-local variables.")
@@ -12617,13 +12331,11 @@ will not be changed.
 
 \(fn CRITERIA)" nil nil)
 
-(autoload 'with-connection-local-profiles "files-x" "\
-Apply connection-local variables according to PROFILES in current buffer.
+(autoload 'with-connection-local-variables "files-x" "\
+Apply connection-local variables according to `default-directory'.
 Execute BODY, and unwind connection-local variables.
 
-\(fn PROFILES &rest BODY)" nil t)
-
-(function-put 'with-connection-local-profiles 'lisp-indent-function '1)
+\(fn &rest BODY)" nil t)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"files-x" '("connection-local-" "dir-locals-to-string" 
"hack-connection-local-variables" "modify-" "read-file-local-variable")))
 
@@ -12634,9 +12346,7 @@ Execute BODY, and unwind connection-local variables.
 
 (autoload 'filesets-init "filesets" "\
 Filesets initialization.
-Set up hooks, load the cache file -- if existing -- and build the menu.
-
-\(fn)" nil nil)
+Set up hooks, load the cache file -- if existing -- and build the menu." nil 
nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"filesets" '("filesets-")))
 
@@ -12968,19 +12678,13 @@ See `find-function-on-key'.
 \(fn KEY)" t nil)
 
 (autoload 'find-function-at-point "find-func" "\
-Find directly the function at point in the other window.
-
-\(fn)" t nil)
+Find directly the function at point in the other window." t nil)
 
 (autoload 'find-variable-at-point "find-func" "\
-Find directly the variable at point in the other window.
-
-\(fn)" t nil)
+Find directly the variable at point in the other window." t nil)
 
 (autoload 'find-function-setup-keys "find-func" "\
-Define some key bindings for the find-function family of functions.
-
-\(fn)" nil nil)
+Define some key bindings for the find-function family of functions." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"find-func" '("find-" "read-library-name")))
 
@@ -13013,9 +12717,7 @@ Change the filter on a `find-lisp-find-dired' buffer to 
REGEXP.
 (push (purecopy '(finder 1 0)) package--builtin-versions)
 
 (autoload 'finder-list-keywords "finder" "\
-Display descriptions of the keywords in the Finder buffer.
-
-\(fn)" t nil)
+Display descriptions of the keywords in the Finder buffer." t nil)
 
 (autoload 'finder-commentary "finder" "\
 Display FILE's commentary section.
@@ -13024,9 +12726,7 @@ FILE should be in a form suitable for passing to 
`locate-library'.
 \(fn FILE)" t nil)
 
 (autoload 'finder-by-keyword "finder" "\
-Find packages matching a given keyword.
-
-\(fn)" t nil)
+Find packages matching a given keyword." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"finder" '("finder-" "generated-finder-keywords-file")))
 
@@ -13074,7 +12774,7 @@ to get the effect of a C-q.
 
 ;;;### (autoloads nil "flymake" "progmodes/flymake.el" (0 0 0 0))
 ;;; Generated autoloads from progmodes/flymake.el
-(push (purecopy '(flymake 1 0)) package--builtin-versions)
+(push (purecopy '(flymake 1 0 5)) package--builtin-versions)
 
 (autoload 'flymake-log "flymake" "\
 Log, at level LEVEL, the message MSG formatted with ARGS.
@@ -13091,7 +12791,12 @@ TYPE is a key to symbol and TEXT is a description of 
the problem
 detected in this region.  DATA is any object that the caller
 wishes to attach to the created diagnostic for later retrieval.
 
-\(fn BUFFER BEG END TYPE TEXT &optional DATA)" nil nil)
+OVERLAY-PROPERTIES is an an alist of properties attached to the
+created diagnostic, overriding the default properties and any
+properties of `flymake-overlay-control' of the diagnostic's
+type.
+
+\(fn BUFFER BEG END TYPE TEXT &optional DATA OVERLAY-PROPERTIES)" nil nil)
 
 (autoload 'flymake-diagnostics "flymake" "\
 Get Flymake diagnostics in region determined by BEG and END.
@@ -13152,14 +12857,10 @@ special *Flymake log* buffer.
 \(fn &optional ARG)" t nil)
 
 (autoload 'flymake-mode-on "flymake" "\
-Turn Flymake mode on.
-
-\(fn)" nil nil)
+Turn Flymake mode on." nil nil)
 
 (autoload 'flymake-mode-off "flymake" "\
-Turn Flymake mode off.
-
-\(fn)" nil nil)
+Turn Flymake mode off." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"flymake" '("flymake-")))
 
@@ -13194,9 +12895,7 @@ REPORT-FN is Flymake's callback.
 ;;; Generated autoloads from textmodes/flyspell.el
 
 (autoload 'flyspell-prog-mode "flyspell" "\
-Turn on `flyspell-mode' for comments and strings.
-
-\(fn)" t nil)
+Turn on `flyspell-mode' for comments and strings." t nil)
 (defvar flyspell-mode nil "Non-nil if Flyspell mode is enabled.")
 
 (autoload 'flyspell-mode "flyspell" "\
@@ -13236,19 +12935,13 @@ in your init file.
 \(fn &optional ARG)" t nil)
 
 (autoload 'turn-on-flyspell "flyspell" "\
-Unconditionally turn on Flyspell mode.
-
-\(fn)" nil nil)
+Unconditionally turn on Flyspell mode." nil nil)
 
 (autoload 'turn-off-flyspell "flyspell" "\
-Unconditionally turn off Flyspell mode.
-
-\(fn)" nil nil)
+Unconditionally turn off Flyspell mode." nil nil)
 
 (autoload 'flyspell-mode-off "flyspell" "\
-Turn Flyspell mode off.
-
-\(fn)" nil nil)
+Turn Flyspell mode off." nil nil)
 
 (autoload 'flyspell-region "flyspell" "\
 Flyspell text between BEG and END.
@@ -13259,9 +12952,7 @@ of a misspelled word removed when you've corrected it.
 \(fn BEG END)" t nil)
 
 (autoload 'flyspell-buffer "flyspell" "\
-Flyspell whole buffer.
-
-\(fn)" t nil)
+Flyspell whole buffer." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"flyspell" '("flyspell-" "mail-mode-flyspell-verify" "make-flyspell-overlay" 
"sgml-mode-flyspell-verify" "tex")))
 
@@ -13279,14 +12970,10 @@ Flyspell whole buffer.
 ;;; Generated autoloads from follow.el
 
 (autoload 'turn-on-follow-mode "follow" "\
-Turn on Follow mode.  Please see the function `follow-mode'.
-
-\(fn)" nil nil)
+Turn on Follow mode.  Please see the function `follow-mode'." nil nil)
 
 (autoload 'turn-off-follow-mode "follow" "\
-Turn off Follow mode.  Please see the function `follow-mode'.
-
-\(fn)" nil nil)
+Turn off Follow mode.  Please see the function `follow-mode'." nil nil)
 
 (autoload 'follow-mode "follow" "\
 Toggle Follow mode.
@@ -14143,14 +13830,10 @@ prompt the user for the name of an NNTP server to use.
 ;;; Generated autoloads from gnus/gnus-agent.el
 
 (autoload 'gnus-unplugged "gnus-agent" "\
-Start Gnus unplugged.
-
-\(fn)" t nil)
+Start Gnus unplugged." t nil)
 
 (autoload 'gnus-plugged "gnus-agent" "\
-Start Gnus plugged.
-
-\(fn)" t nil)
+Start Gnus plugged." t nil)
 
 (autoload 'gnus-slave-unplugged "gnus-agent" "\
 Read news as a slave unplugged.
@@ -14166,14 +13849,10 @@ customize gnus-agent to nil.
 
 This will modify the `gnus-setup-news-hook', and
 `message-send-mail-real-function' variables, and install the Gnus agent
-minor mode in all Gnus buffers.
-
-\(fn)" t nil)
+minor mode in all Gnus buffers." t nil)
 
 (autoload 'gnus-agent-possibly-save-gcc "gnus-agent" "\
-Save GCC if Gnus is unplugged.
-
-\(fn)" nil nil)
+Save GCC if Gnus is unplugged." nil nil)
 
 (autoload 'gnus-agent-rename-group "gnus-agent" "\
 Rename fully-qualified OLD-GROUP as NEW-GROUP.
@@ -14194,9 +13873,7 @@ supported.
 \(fn GROUP)" nil nil)
 
 (autoload 'gnus-agent-get-undownloaded-list "gnus-agent" "\
-Construct list of articles that have not been downloaded.
-
-\(fn)" nil nil)
+Construct list of articles that have not been downloaded." nil nil)
 
 (autoload 'gnus-agent-possibly-alter-active "gnus-agent" "\
 Possibly expand a group's active range to include articles
@@ -14212,14 +13889,10 @@ variables.  Returns the first non-nil value found.
 \(fn GROUP SYMBOL)" nil nil)
 
 (autoload 'gnus-agent-batch-fetch "gnus-agent" "\
-Start Gnus and fetch session.
-
-\(fn)" t nil)
+Start Gnus and fetch session." t nil)
 
 (autoload 'gnus-agent-batch "gnus-agent" "\
-Start Gnus, send queue and fetch session.
-
-\(fn)" t nil)
+Start Gnus, send queue and fetch session." t nil)
 
 (autoload 'gnus-agent-regenerate "gnus-agent" "\
 Regenerate all agent covered files.
@@ -14235,9 +13908,7 @@ CLEAN is obsolete and ignored.
 ;;; Generated autoloads from gnus/gnus-art.el
 
 (autoload 'gnus-article-prepare-display "gnus-art" "\
-Make the current buffer look like a nice article.
-
-\(fn)" nil nil)
+Make the current buffer look like a nice article." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"gnus-art" '("article-" "gnus-")))
 
@@ -14262,9 +13933,7 @@ Make the current buffer look like a nice article.
 ;;; Generated autoloads from gnus/gnus-bookmark.el
 
 (autoload 'gnus-bookmark-set "gnus-bookmark" "\
-Set a bookmark for this article.
-
-\(fn)" t nil)
+Set a bookmark for this article." t nil)
 
 (autoload 'gnus-bookmark-jump "gnus-bookmark" "\
 Jump to a Gnus bookmark (BMK-NAME).
@@ -14275,9 +13944,7 @@ Jump to a Gnus bookmark (BMK-NAME).
 Display a list of existing Gnus bookmarks.
 The list is displayed in a buffer named `*Gnus Bookmark List*'.
 The leftmost column displays a D if the bookmark is flagged for
-deletion, or > if it is flagged for displaying.
-
-\(fn)" t nil)
+deletion, or > if it is flagged for displaying." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"gnus-bookmark" '("gnus-bookmark-")))
 
@@ -14290,9 +13957,7 @@ deletion, or > if it is flagged for displaying.
 Go through all groups and put the articles into the cache.
 
 Usage:
-$ emacs -batch -l ~/.emacs -l gnus -f gnus-jog-cache
-
-\(fn)" t nil)
+$ emacs -batch -l ~/.emacs -l gnus -f gnus-jog-cache" t nil)
 
 (autoload 'gnus-cache-generate-active "gnus-cache" "\
 Generate the cache active file.
@@ -14366,9 +14031,7 @@ DELAY is a string, giving the length of the time.  
Possible values are:
 \(fn DELAY)" t nil)
 
 (autoload 'gnus-delay-send-queue "gnus-delay" "\
-Send all the delayed messages that are due now.
-
-\(fn)" t nil)
+Send all the delayed messages that are due now." t nil)
 
 (autoload 'gnus-delay-initialize "gnus-delay" "\
 Initialize the gnus-delay package.
@@ -14412,9 +14075,7 @@ Checking delayed messages is skipped if optional arg 
NO-CHECK is non-nil.
 ;;; Generated autoloads from gnus/gnus-dired.el
 
 (autoload 'turn-on-gnus-dired-mode "gnus-dired" "\
-Convenience method to turn on gnus-dired-mode.
-
-\(fn)" t nil)
+Convenience method to turn on gnus-dired-mode." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"gnus-dired" '("gnus-dired-")))
 
@@ -14424,9 +14085,7 @@ Convenience method to turn on gnus-dired-mode.
 ;;; Generated autoloads from gnus/gnus-draft.el
 
 (autoload 'gnus-draft-reminder "gnus-draft" "\
-Reminder user if there are unsent drafts.
-
-\(fn)" t nil)
+Reminder user if there are unsent drafts." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"gnus-draft" '("gnus-")))
 
@@ -14459,14 +14118,10 @@ Return file from DIR with extension EXT, omitting 
matches of OMIT, processed by
 (autoload 'gnus-random-x-face "gnus-fun" "\
 Return X-Face header data chosen randomly from `gnus-x-face-directory'.
 
-Files matching `gnus-x-face-omit-files' are not considered.
-
-\(fn)" t nil)
+Files matching `gnus-x-face-omit-files' are not considered." t nil)
 
 (autoload 'gnus-insert-random-x-face-header "gnus-fun" "\
-Insert a random X-Face header from `gnus-x-face-directory'.
-
-\(fn)" t nil)
+Insert a random X-Face header from `gnus-x-face-directory'." t nil)
 
 (autoload 'gnus-x-face-from-file "gnus-fun" "\
 Insert an X-Face header based on an image FILE.
@@ -14500,14 +14155,10 @@ FILE should be a PNG file that's 48x48 and smaller 
than or equal to
 (autoload 'gnus-random-face "gnus-fun" "\
 Return randomly chosen Face from `gnus-face-directory'.
 
-Files matching `gnus-face-omit-files' are not considered.
-
-\(fn)" t nil)
+Files matching `gnus-face-omit-files' are not considered." t nil)
 
 (autoload 'gnus-insert-random-face-header "gnus-fun" "\
-Insert a random Face header from `gnus-face-directory'.
-
-\(fn)" nil nil)
+Insert a random Face header from `gnus-face-directory'." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"gnus-fun" '("gnus-")))
 
@@ -14591,9 +14242,7 @@ Pop up a frame and enter GROUP.
 
 (autoload 'gnus-batch-score "gnus-kill" "\
 Run batched scoring.
-Usage: emacs -batch -l ~/.emacs -l gnus -f gnus-batch-score
-
-\(fn)" t nil)
+Usage: emacs -batch -l ~/.emacs -l gnus -f gnus-batch-score" t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"gnus-kill" '("gnus-")))
 
@@ -14616,10 +14265,7 @@ Usage: emacs -batch -l ~/.emacs -l gnus -f 
gnus-batch-score
 ;;;### (autoloads nil "gnus-ml" "gnus/gnus-ml.el" (0 0 0 0))
 ;;; Generated autoloads from gnus/gnus-ml.el
 
-(autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" "\
-
-
-\(fn)" nil nil)
+(autoload 'turn-on-gnus-mailing-list-mode "gnus-ml" nil nil nil)
 
 (autoload 'gnus-mailing-list-insinuate "gnus-ml" "\
 Setup group parameters from List-Post header.
@@ -14683,9 +14329,7 @@ instead.  This variable is set by 
`gnus-group-split-setup'.
 Use information from group parameters in order to split mail.
 See `gnus-group-split-fancy' for more information.
 
-`gnus-group-split' is a valid value for `nnmail-split-methods'.
-
-\(fn)" nil nil)
+`gnus-group-split' is a valid value for `nnmail-split-methods'." nil nil)
 
 (autoload 'gnus-group-split-fancy "gnus-mlspl" "\
 Uses information from group parameters in order to split mail.
@@ -14783,9 +14427,7 @@ or equal to `gnus-notifications-minimum-level' and send 
a
 notification using `notifications-notify' for it.
 
 This is typically a function to add in
-`gnus-after-getting-new-news-hook'
-
-\(fn)" nil nil)
+`gnus-after-getting-new-news-hook'" nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"gnus-notifications" '("gnus-notifications-")))
 
@@ -14796,21 +14438,15 @@ This is typically a function to add in
 
 (autoload 'gnus-treat-from-picon "gnus-picon" "\
 Display picons in the From header.
-If picons are already displayed, remove them.
-
-\(fn)" t nil)
+If picons are already displayed, remove them." t nil)
 
 (autoload 'gnus-treat-mail-picon "gnus-picon" "\
 Display picons in the Cc and To headers.
-If picons are already displayed, remove them.
-
-\(fn)" t nil)
+If picons are already displayed, remove them." t nil)
 
 (autoload 'gnus-treat-newsgroups-picon "gnus-picon" "\
 Display picons in the Newsgroups and Followup-To headers.
-If picons are already displayed, remove them.
-
-\(fn)" t nil)
+If picons are already displayed, remove them." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"gnus-picon" '("gnus-picon-")))
 
@@ -14890,14 +14526,10 @@ Add NUM into sorted LIST by side effect.
 ;;; Generated autoloads from gnus/gnus-registry.el
 
 (autoload 'gnus-registry-initialize "gnus-registry" "\
-Initialize the Gnus registry.
-
-\(fn)" t nil)
+Initialize the Gnus registry." t nil)
 
 (autoload 'gnus-registry-install-hooks "gnus-registry" "\
-Install the registry hooks.
-
-\(fn)" t nil)
+Install the registry hooks." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"gnus-registry" '("gnus-")))
 
@@ -14933,22 +14565,15 @@ Update the Sieve script in gnus-sieve-file, by 
replacing the region
 between gnus-sieve-region-start and gnus-sieve-region-end with
 \(gnus-sieve-script gnus-sieve-select-method gnus-sieve-crosspost), then
 execute gnus-sieve-update-shell-command.
-See the documentation for these variables and functions for details.
-
-\(fn)" t nil)
+See the documentation for these variables and functions for details." t nil)
 
 (autoload 'gnus-sieve-generate "gnus-sieve" "\
 Generate the Sieve script in gnus-sieve-file, by replacing the region
 between gnus-sieve-region-start and gnus-sieve-region-end with
 \(gnus-sieve-script gnus-sieve-select-method gnus-sieve-crosspost).
-See the documentation for these variables and functions for details.
-
-\(fn)" t nil)
+See the documentation for these variables and functions for details." t nil)
 
-(autoload 'gnus-sieve-article-add-rule "gnus-sieve" "\
-
-
-\(fn)" t nil)
+(autoload 'gnus-sieve-article-add-rule "gnus-sieve" nil t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"gnus-sieve" '("gnus-sieve-")))
 
@@ -15117,9 +14742,7 @@ By default, goto-address binds `goto-address-at-point' 
to mouse-2 and C-c RET
 only on URLs and e-mail addresses.
 
 Also fontifies the buffer appropriately (see `goto-address-fontify-p' and
-`goto-address-highlight-p' for more information).
-
-\(fn)" t nil)
+`goto-address-highlight-p' for more information)." t nil)
 (put 'goto-address 'safe-local-eval-function t)
 
 (autoload 'goto-address-mode "goto-addr" "\
@@ -15197,7 +14820,7 @@ List of hook functions run by `grep-process-setup' (see 
`run-hooks').")
 
 (custom-autoload 'grep-setup-hook "grep" t)
 
-(defconst grep-regexp-alist `((,(concat "^\\(?:" 
"\\(?1:[^\0\n]+\\)\\(?3:\0\\)\\(?2:[0-9]+\\):" "\\|" "\\(?1:" 
"\\(?:[a-zA-Z]:\\)?" "[^\n:]+?[^\n/:]\\):[\11 ]*\\(?2:[1-9][0-9]*\\)[\11 ]*:" 
"\\)") 1 2 (,(lambda nil (when grep-highlight-matches (let* ((beg (match-end 
0)) (end (save-excursion (goto-char beg) (line-end-position))) (mbeg 
(text-property-any beg end 'font-lock-face 'grep-match-face))) (when mbeg (- 
mbeg beg))))) \, (lambda nil (when grep-highlight-matches (let* ((beg 
(match-end [...]
+(defconst grep-regexp-alist `((,(concat "^\\(?:" 
"\\(?1:[^\0\n]+\\)\\(?3:\0\\)\\(?2:[0-9]+\\):" "\\|" "\\(?1:" 
"\\(?:[a-zA-Z]:\\)?" "[^\n:]+?[^\n/:]\\):[\11 ]*\\(?2:[1-9][0-9]*\\)[\11 ]*:" 
"\\)") 1 2 (,(lambda nil (when grep-highlight-matches (let* ((beg (match-end 
0)) (end (save-excursion (goto-char beg) (line-end-position))) (mbeg 
(text-property-any beg end 'font-lock-face grep-match-face))) (when mbeg (- 
mbeg beg))))) \, (lambda nil (when grep-highlight-matches (let* ((beg 
(match-end  [...]
 Regexp used to match grep hits.
 See `compilation-error-regexp-alist' for format details.")
 
@@ -15232,14 +14855,9 @@ History list for grep-find.")
 
 (autoload 'grep-process-setup "grep" "\
 Setup compilation variables and buffer for `grep'.
-Set up `compilation-exit-message-function' and run `grep-setup-hook'.
-
-\(fn)" nil nil)
-
-(autoload 'grep-compute-defaults "grep" "\
+Set up `compilation-exit-message-function' and run `grep-setup-hook'." nil nil)
 
-
-\(fn)" nil nil)
+(autoload 'grep-compute-defaults "grep" nil nil nil)
 
 (autoload 'grep-mode "grep" "\
 Sets `grep-last-buffer' and `compilation-window-height'.
@@ -15566,9 +15184,7 @@ and `handwrite-13pt' set up for various sizes of output.
 Variables: `handwrite-linespace'     (default 12)
            `handwrite-fontsize'      (default 11)
            `handwrite-numlines'      (default 60)
-           `handwrite-pagenumbering' (default nil)
-
-\(fn)" t nil)
+           `handwrite-pagenumbering' (default nil)" t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"handwrite" '("handwrite-" "menu-bar-handwrite-map")))
 
@@ -15595,17 +15211,13 @@ Towers of Hanoi, UNIX doomsday version.
 Displays 32-ring towers that have been progressing at one move per
 second since 1970-01-01 00:00:00 GMT.
 
-Repent before ring 31 moves.
-
-\(fn)" t nil)
+Repent before ring 31 moves." t nil)
 
 (autoload 'hanoi-unix-64 "hanoi" "\
 Like hanoi-unix, but pretend to have a 64-bit clock.
 This is, necessarily (as of Emacs 20.3), a crock.  When the
 current-time interface is made s2G-compliant, hanoi.el will need
-to be updated.
-
-\(fn)" t nil)
+to be updated." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"hanoi" '("hanoi-")))
 
@@ -15672,9 +15284,7 @@ can also be t, if that is the value of the `kbd-help' 
property.
 Return the keyboard help string at point.
 If the `kbd-help' text or overlay property at point produces a
 string, return it.  Otherwise, use the `help-echo' property.
-If this produces no string either, return nil.
-
-\(fn)" nil nil)
+If this produces no string either, return nil." nil nil)
 
 (autoload 'display-local-help "help-at-pt" "\
 Display local help in the echo area.
@@ -15691,15 +15301,11 @@ mainly meant for use from Lisp.
 
 (autoload 'help-at-pt-cancel-timer "help-at-pt" "\
 Cancel any timer set by `help-at-pt-set-timer'.
-This disables `help-at-pt-display-when-idle'.
-
-\(fn)" t nil)
+This disables `help-at-pt-display-when-idle'." t nil)
 
 (autoload 'help-at-pt-set-timer "help-at-pt" "\
 Enable `help-at-pt-display-when-idle'.
-This is done by setting a timer, if none is currently active.
-
-\(fn)" t nil)
+This is done by setting a timer, if none is currently active." t nil)
 
 (defvar help-at-pt-display-when-idle 'never "\
 Automatically show local help on point-over.
@@ -15902,14 +15508,10 @@ Commands:
 \(fn)" t nil)
 
 (autoload 'help-mode-setup "help-mode" "\
-Enter Help Mode in the current buffer.
-
-\(fn)" nil nil)
+Enter Help Mode in the current buffer." nil nil)
 
 (autoload 'help-mode-finish "help-mode" "\
-Finalize Help Mode setup in current buffer.
-
-\(fn)" nil nil)
+Finalize Help Mode setup in current buffer." nil nil)
 
 (autoload 'help-setup-xref "help-mode" "\
 Invoked from commands using the \"*Help*\" buffer to install some xref info.
@@ -15931,9 +15533,7 @@ If `help-xref-following' is non-nil, this is the name 
of the
 current buffer.  Signal an error if this buffer is not derived
 from `help-mode'.
 Otherwise, return \"*Help*\", creating a buffer with that name if
-it does not already exist.
-
-\(fn)" nil nil)
+it does not already exist." nil nil)
 
 (autoload 'help-make-xrefs "help-mode" "\
 Parse and hyperlink documentation cross-references in the given BUFFER.
@@ -15997,14 +15597,10 @@ BOOKMARK is a bookmark name or a bookmark record.
 ;;; Generated autoloads from emacs-lisp/helper.el
 
 (autoload 'Helper-describe-bindings "helper" "\
-Describe local key bindings of current mode.
-
-\(fn)" t nil)
+Describe local key bindings of current mode." t nil)
 
 (autoload 'Helper-help "helper" "\
-Provide help for current mode.
-
-\(fn)" t nil)
+Provide help for current mode." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"helper" '("Helper-")))
 
@@ -16105,9 +15701,7 @@ and edit the file in `hexl-mode'.
 
 (autoload 'hexlify-buffer "hexl" "\
 Convert a binary buffer to hexl format.
-This discards the buffer's undo information.
-
-\(fn)" t nil)
+This discards the buffer's undo information." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"hexl" '("dehexlify-buffer" "hexl-")))
 
@@ -16267,9 +15861,7 @@ unless you use a prefix argument.
 Uses `find-tag-default-as-symbol-regexp' to retrieve the symbol at point.
 
 This uses Font lock mode if it is enabled; otherwise it uses overlays,
-in which case the highlighting will not update as you type.
-
-\(fn)" t nil)
+in which case the highlighting will not update as you type." t nil)
 
 (defalias 'unhighlight-regexp 'hi-lock-unface-buffer)
 
@@ -16287,9 +15879,7 @@ Write interactively added patterns, if any, into buffer 
at point.
 
 Interactively added patterns are those normally specified using
 `highlight-regexp' and `highlight-lines-matching-regexp'; they can
-be found in variable `hi-lock-interactive-patterns'.
-
-\(fn)" t nil)
+be found in variable `hi-lock-interactive-patterns'." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"hi-lock" '("hi-lock-" "turn-on-hi-lock-if-enabled")))
 
@@ -16404,9 +15994,7 @@ Key bindings:
 \(fn &optional ARG)" t nil)
 
 (autoload 'turn-off-hideshow "hideshow" "\
-Unconditionally turn off `hs-minor-mode'.
-
-\(fn)" nil nil)
+Unconditionally turn off `hs-minor-mode'." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"hideshow" '("hs-")))
 
@@ -16466,14 +16054,10 @@ This allows you to manually remove highlighting from 
uninteresting changes.
 \(fn BEG END)" t nil)
 
 (autoload 'highlight-changes-next-change "hilit-chg" "\
-Move to the beginning of the next change, if in Highlight Changes mode.
-
-\(fn)" t nil)
+Move to the beginning of the next change, if in Highlight Changes mode." t nil)
 
 (autoload 'highlight-changes-previous-change "hilit-chg" "\
-Move to the beginning of the previous change, if in Highlight Changes mode.
-
-\(fn)" t nil)
+Move to the beginning of the previous change, if in Highlight Changes mode." t 
nil)
 
 (autoload 'highlight-changes-rotate-faces "hilit-chg" "\
 Rotate the faces if in Highlight Changes mode and the changes are visible.
@@ -16487,9 +16071,7 @@ You can automatically rotate colors when the buffer is 
saved by adding
 this function to `write-file-functions' as a buffer-local value.  To do
 this, eval the following in the buffer to be saved:
 
-  (add-hook \\='write-file-functions \\='highlight-changes-rotate-faces nil t)
-
-\(fn)" t nil)
+  (add-hook \\='write-file-functions \\='highlight-changes-rotate-faces nil 
t)" t nil)
 
 (autoload 'highlight-compare-buffers "hilit-chg" "\
 Compare two buffers and highlight the differences.
@@ -17356,51 +16938,37 @@ RET   Select the buffer at the front of the list of 
matches.
 \\[ido-completion-help]        Show list of matching buffers in separate 
window.
 \\[ido-enter-find-file]        Drop into `ido-find-file'.
 \\[ido-kill-buffer-at-head]    Kill buffer at head of buffer list.
-\\[ido-toggle-ignore]  Toggle ignoring buffers listed in `ido-ignore-buffers'.
-
-\(fn)" t nil)
+\\[ido-toggle-ignore]  Toggle ignoring buffers listed in 
`ido-ignore-buffers'." t nil)
 
 (autoload 'ido-switch-buffer-other-window "ido" "\
 Switch to another buffer and show it in another window.
 The buffer name is selected interactively by typing a substring.
-For details of keybindings, see `ido-switch-buffer'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-switch-buffer'." t nil)
 
 (autoload 'ido-display-buffer "ido" "\
 Display a buffer in another window but don't select it.
 The buffer name is selected interactively by typing a substring.
-For details of keybindings, see `ido-switch-buffer'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-switch-buffer'." t nil)
 
 (autoload 'ido-display-buffer-other-frame "ido" "\
 Display a buffer preferably in another frame.
 The buffer name is selected interactively by typing a substring.
-For details of keybindings, see `ido-switch-buffer'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-switch-buffer'." t nil)
 
 (autoload 'ido-kill-buffer "ido" "\
 Kill a buffer.
 The buffer name is selected interactively by typing a substring.
-For details of keybindings, see `ido-switch-buffer'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-switch-buffer'." t nil)
 
 (autoload 'ido-insert-buffer "ido" "\
 Insert contents of a buffer in current buffer after point.
 The buffer name is selected interactively by typing a substring.
-For details of keybindings, see `ido-switch-buffer'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-switch-buffer'." t nil)
 
 (autoload 'ido-switch-buffer-other-frame "ido" "\
 Switch to another buffer and show it in another frame.
 The buffer name is selected interactively by typing a substring.
-For details of keybindings, see `ido-switch-buffer'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-switch-buffer'." t nil)
 
 (autoload 'ido-find-file-in-dir "ido" "\
 Switch to another file starting from DIR.
@@ -17448,100 +17016,72 @@ RET  Select the file at the front of the list of 
matches.
 \\[ido-toggle-case]    Toggle case-sensitive searching of file names.
 \\[ido-toggle-literal] Toggle literal reading of this file.
 \\[ido-completion-help]        Show list of matching files in separate window.
-\\[ido-toggle-ignore]  Toggle ignoring files listed in `ido-ignore-files'.
-
-\(fn)" t nil)
+\\[ido-toggle-ignore]  Toggle ignoring files listed in `ido-ignore-files'." t 
nil)
 
 (autoload 'ido-find-file-other-window "ido" "\
 Switch to another file and show it in another window.
 The file name is selected interactively by typing a substring.
-For details of keybindings, see `ido-find-file'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-find-file'." t nil)
 
 (autoload 'ido-find-alternate-file "ido" "\
 Find another file, select its buffer, kill previous buffer.
 The file name is selected interactively by typing a substring.
-For details of keybindings, see `ido-find-file'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-find-file'." t nil)
 
 (autoload 'ido-find-alternate-file-other-window "ido" "\
 Find file as a replacement for the file in the next window.
 The file name is selected interactively by typing a substring.
-For details of keybindings, see `ido-find-file'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-find-file'." t nil)
 
 (autoload 'ido-find-file-read-only "ido" "\
 Edit file read-only with name obtained via minibuffer.
 The file name is selected interactively by typing a substring.
-For details of keybindings, see `ido-find-file'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-find-file'." t nil)
 
 (autoload 'ido-find-file-read-only-other-window "ido" "\
 Edit file read-only in other window with name obtained via minibuffer.
 The file name is selected interactively by typing a substring.
-For details of keybindings, see `ido-find-file'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-find-file'." t nil)
 
 (autoload 'ido-find-file-read-only-other-frame "ido" "\
 Edit file read-only in other frame with name obtained via minibuffer.
 The file name is selected interactively by typing a substring.
-For details of keybindings, see `ido-find-file'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-find-file'." t nil)
 
 (autoload 'ido-display-file "ido" "\
 Display a file in another window but don't select it.
 The file name is selected interactively by typing a substring.
-For details of keybindings, see `ido-find-file'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-find-file'." t nil)
 
 (autoload 'ido-find-file-other-frame "ido" "\
 Switch to another file and show it in another frame.
 The file name is selected interactively by typing a substring.
-For details of keybindings, see `ido-find-file'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-find-file'." t nil)
 
 (autoload 'ido-write-file "ido" "\
 Write current buffer to a file.
 The file name is selected interactively by typing a substring.
-For details of keybindings, see `ido-find-file'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-find-file'." t nil)
 
 (autoload 'ido-insert-file "ido" "\
 Insert contents of file in current buffer.
 The file name is selected interactively by typing a substring.
-For details of keybindings, see `ido-find-file'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-find-file'." t nil)
 
 (autoload 'ido-dired "ido" "\
 Call `dired' the Ido way.
 The directory is selected interactively by typing a substring.
-For details of keybindings, see `ido-find-file'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-find-file'." t nil)
 
 (autoload 'ido-dired-other-window "ido" "\
 \"Edit\" a directory.  Like `ido-dired' but selects in another window.
 The directory is selected interactively by typing a substring.
-For details of keybindings, see `ido-find-file'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-find-file'." t nil)
 
 (autoload 'ido-dired-other-frame "ido" "\
 \"Edit\" a directory.  Like `ido-dired' but makes a new frame.
 The directory is selected interactively by typing a substring.
-For details of keybindings, see `ido-find-file'.
-
-\(fn)" t nil)
+For details of keybindings, see `ido-find-file'." t nil)
 
 (autoload 'ido-read-buffer "ido" "\
 Ido replacement for the built-in `read-buffer'.
@@ -17646,9 +17186,7 @@ be determined.
 (autoload 'image-type-from-buffer "image" "\
 Determine the image type from data in the current buffer.
 Value is a symbol specifying the image type or nil if type cannot
-be determined.
-
-\(fn)" nil nil)
+be determined." nil nil)
 
 (autoload 'image-type-from-file-header "image" "\
 Determine the type of image file FILE from its first few bytes.
@@ -17689,20 +17227,25 @@ The buffer is considered to contain an 
auto-detectable image if
 its beginning matches an image type in `image-type-header-regexps',
 and that image type is present in `image-type-auto-detectable' with a
 non-nil value.  If that value is non-nil, but not t, then the image type
-must be available.
-
-\(fn)" nil nil)
+must be available." nil nil)
 
 (autoload 'create-image "image" "\
 Create an image.
 FILE-OR-DATA is an image file name or image data.
+
 Optional TYPE is a symbol describing the image type.  If TYPE is omitted
 or nil, try to determine the image type from its first few bytes
 of image data.  If that doesn't work, and FILE-OR-DATA is a file name,
 use its file extension as image type.
+
 Optional DATA-P non-nil means FILE-OR-DATA is a string containing image data.
+
 Optional PROPS are additional image attributes to assign to the image,
-like, e.g. `:mask MASK'.
+like, e.g. `:mask MASK'.  If the property `:scale' is not given and the
+display has a high resolution (more exactly, when the average width of a
+character in the default font is more than 10 pixels), the image is
+automatically scaled up in proportion to the default font.
+
 Value is the image created, or nil if images of type TYPE are not supported.
 
 Images should not be larger than specified by `max-image-size'.
@@ -17820,9 +17363,7 @@ Emacs visits them in Image mode.  They are also added to
 `image-type-file-name-regexps', so that the `image-type' function
 recognizes these files as having image type `imagemagick'.
 
-If Emacs is compiled without ImageMagick support, this does nothing.
-
-\(fn)" nil nil)
+If Emacs is compiled without ImageMagick support, this does nothing." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"image" '("image")))
 
@@ -17908,9 +17449,7 @@ With prefix argument ARG, remove tag from file at point.
 \(fn ARG)" t nil)
 
 (autoload 'image-dired-jump-thumbnail-buffer "image-dired" "\
-Jump to thumbnail buffer.
-
-\(fn)" t nil)
+Jump to thumbnail buffer." t nil)
 
 (autoload 'image-dired-minor-mode "image-dired" "\
 Setup easy-to-use keybindings for the commands to be used in dired mode.
@@ -17927,19 +17466,13 @@ if ARG is `toggle'; disable the mode otherwise.
 (define-obsolete-function-alias 'image-dired-setup-dired-keybindings 
'image-dired-minor-mode "26.1")
 
 (autoload 'image-dired-display-thumbs-append "image-dired" "\
-Append thumbnails to `image-dired-thumbnail-buffer'.
-
-\(fn)" t nil)
+Append thumbnails to `image-dired-thumbnail-buffer'." t nil)
 
 (autoload 'image-dired-display-thumb "image-dired" "\
-Shorthand for `image-dired-display-thumbs' with prefix argument.
-
-\(fn)" t nil)
+Shorthand for `image-dired-display-thumbs' with prefix argument." t nil)
 
 (autoload 'image-dired-dired-display-external "image-dired" "\
-Display file at point using an external viewer.
-
-\(fn)" t nil)
+Display file at point using an external viewer." t nil)
 
 (autoload 'image-dired-dired-display-image "image-dired" "\
 Display current image file.
@@ -17949,9 +17482,7 @@ With prefix argument ARG, display image in its original 
size.
 \(fn &optional ARG)" t nil)
 
 (autoload 'image-dired-dired-comment-files "image-dired" "\
-Add comment to current or marked files in dired.
-
-\(fn)" t nil)
+Add comment to current or marked files in dired." t nil)
 
 (autoload 'image-dired-mark-tagged-files "image-dired" "\
 Use regexp to mark files with matching tag.
@@ -17959,16 +17490,12 @@ A `tag' is a keyword, a piece of meta data, 
associated with an
 image file and stored in image-dired's database file.  This command
 lets you input a regexp and this will be matched against all tags
 on all image files in the database file.  The files that have a
-matching tag will be marked in the dired buffer.
-
-\(fn)" t nil)
+matching tag will be marked in the dired buffer." t nil)
 
 (autoload 'image-dired-dired-edit-comment-and-tags "image-dired" "\
 Edit comment and tags of current or marked image files.
 Edit comment and tags for all marked image files in an
-easy-to-use form.
-
-\(fn)" t nil)
+easy-to-use form." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"image-dired" '("image-dired-")))
 
@@ -18002,9 +17529,7 @@ the variable is set using \\[customize].")
 (custom-autoload 'image-file-name-regexps "image-file" nil)
 
 (autoload 'image-file-name-regexp "image-file" "\
-Return a regular expression matching image-file filenames.
-
-\(fn)" nil nil)
+Return a regular expression matching image-file filenames." nil nil)
 
 (autoload 'insert-image-file "image-file" "\
 Insert the image file FILE into the current buffer.
@@ -18050,9 +17575,7 @@ You can use \\<image-mode-map>\\[image-toggle-display] 
or \\<image-mode-map>\\[i
 to toggle between display as an image and display as text or hex.
 
 Key bindings:
-\\{image-mode-map}
-
-\(fn)" t nil)
+\\{image-mode-map}" t nil)
 
 (autoload 'image-minor-mode "image-mode" "\
 Toggle Image minor mode in this buffer.
@@ -18071,9 +17594,7 @@ actual image.
 (autoload 'image-mode-to-text "image-mode" "\
 Set a non-image mode as major mode in combination with image minor mode.
 A non-mage major mode found from `auto-mode-alist' or fundamental mode
-displays an image file as text.
-
-\(fn)" nil nil)
+displays an image file as text." nil nil)
 
 (autoload 'image-bookmark-jump "image-mode" "\
 
@@ -18216,9 +17737,7 @@ See the command `imenu' for more information.
 (autoload 'imenu-add-menubar-index "imenu" "\
 Add an Imenu \"Index\" entry on the menu bar for the current buffer.
 
-A trivial interface to `imenu-add-to-menubar' suitable for use in a hook.
-
-\(fn)" t nil)
+A trivial interface to `imenu-add-to-menubar' suitable for use in a hook." t 
nil)
 
 (autoload 'imenu "imenu" "\
 Jump to a place in the buffer chosen using a buffer menu or mouse menu.
@@ -18336,21 +17855,15 @@ See a list of available Info commands in `Info-mode'.
 \(fn &optional FILE-OR-NODE BUFFER)" t nil)
 
 (autoload 'info-emacs-manual "info" "\
-Display the Emacs manual in Info mode.
-
-\(fn)" t nil)
+Display the Emacs manual in Info mode." t nil)
 
 (autoload 'info-emacs-bug "info" "\
-Display the \"Reporting Bugs\" section of the Emacs manual in Info mode.
-
-\(fn)" t nil)
+Display the \"Reporting Bugs\" section of the Emacs manual in Info mode." t 
nil)
 
 (autoload 'info-standalone "info" "\
 Run Emacs as a standalone Info reader.
 Usage:  emacs -f info-standalone [filename]
-In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself.
-
-\(fn)" nil nil)
+In standalone mode, \\<Info-mode-map>\\[Info-exit] exits Emacs itself." nil 
nil)
 
 (autoload 'Info-on-current-buffer "info" "\
 Use Info mode to browse the current Info buffer.
@@ -18360,9 +17873,7 @@ otherwise, that defaults to `Top'.
 \(fn &optional NODENAME)" t nil)
 
 (autoload 'Info-directory "info" "\
-Go to the Info directory node.
-
-\(fn)" t nil)
+Go to the Info directory node." t nil)
 
 (autoload 'Info-index "info" "\
 Look up a string TOPIC in the index for this manual and go to that entry.
@@ -18474,9 +17985,7 @@ the variable `Info-file-list-for-emacs'.
 
 (autoload 'Info-speedbar-browser "info" "\
 Initialize speedbar to display an Info node browser.
-This will add a speedbar major display mode.
-
-\(fn)" t nil)
+This will add a speedbar major display mode." t nil)
 
 (autoload 'Info-bookmark-jump "info" "\
 This implements the `handler' function interface for the record
@@ -18504,9 +18013,7 @@ completion alternatives to currently visited manuals.
 Throw away all cached data.
 This command is useful if the user wants to start at the beginning without
 quitting Emacs, for example, after some Info documents were updated on the
-system.
-
-\(fn)" t nil)
+system." t nil)
  (put 'info-lookup-symbol 'info-file "emacs")
 
 (autoload 'info-lookup-symbol "info-look" "\
@@ -18589,9 +18096,7 @@ info files don't necessarily have a \".info\" extension 
and in
 particular the Emacs manuals normally don't.  If you have a
 source code directory in `Info-directory-list' then a lot of
 extraneous files might be read.  This will be time consuming but
-should be harmless.
-
-\(fn)" t nil)
+should be harmless." t nil)
 
 (autoload 'info-xref-check-all-custom "info-xref" "\
 Check info references in all customize groups and variables.
@@ -18600,9 +18105,7 @@ of the `custom-links' for a variable.
 
 Any `custom-load' autoloads in variables are loaded in order to
 get full link information.  This will be a lot of Lisp packages
-and can take a long time.
-
-\(fn)" t nil)
+and can take a long time." t nil)
 
 (autoload 'info-xref-docstrings "info-xref" "\
 Check docstring info node references in source files.
@@ -18656,23 +18159,17 @@ should be saved in place of the original visited file.
 The subfiles are written in the same directory the original file is
 in, with names generated by appending `-' and a number to the original
 file name.  The indirect file still functions as an Info file, but it
-contains just the tag table and a directory of subfiles.
-
-\(fn)" t nil)
+contains just the tag table and a directory of subfiles." t nil)
 
 (autoload 'Info-validate "informat" "\
 Check current buffer for validity as an Info file.
-Check that every node pointer points to an existing node.
-
-\(fn)" t nil)
+Check that every node pointer points to an existing node." t nil)
 
 (autoload 'batch-info-validate "informat" "\
 Runs `Info-validate' on the files remaining on the command line.
 Must be used only with -batch, and kills Emacs on completion.
 Each file will be processed even if an error occurred previously.
-For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\"
-
-\(fn)" nil nil)
+For example, invoke \"emacs -batch -f batch-info-validate $info/ ~/*.info\"" 
nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"informat" '("Info-validate-")))
 
@@ -18716,14 +18213,10 @@ Only checks one based on which kind of Emacs is being 
run.
 ;;; Generated autoloads from international/isearch-x.el
 
 (autoload 'isearch-toggle-specified-input-method "isearch-x" "\
-Select an input method and turn it on in interactive search.
-
-\(fn)" t nil)
+Select an input method and turn it on in interactive search." t nil)
 
 (autoload 'isearch-toggle-input-method "isearch-x" "\
-Toggle input method in interactive search.
-
-\(fn)" t nil)
+Toggle input method in interactive search." t nil)
 
 (autoload 'isearch-process-search-multibyte-characters "isearch-x" "\
 
@@ -18742,9 +18235,7 @@ Toggle input method in interactive search.
 Active isearchb mode for subsequent alphanumeric keystrokes.
 Executing this command again will terminate the search; or, if
 the search has not yet begun, will toggle to the last buffer
-accessed via isearchb.
-
-\(fn)" t nil)
+accessed via isearchb." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"isearchb" '("isearchb")))
 
@@ -18843,9 +18334,7 @@ Warn that format is write-only.
 \(fn &rest IGNORE)" t nil)
 
 (autoload 'iso-cvt-define-menu "iso-cvt" "\
-Add submenus to the File menu, to convert to and from various formats.
-
-\(fn)" t nil)
+Add submenus to the File menu, to convert to and from various formats." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"iso-cvt" '("iso-")))
 
@@ -18964,9 +18453,7 @@ SPC:   Accept word this time.
 `m':   Place typed-in value in personal dictionary, then recheck current word.
 `C-l':  Redraw screen.
 `C-r':  Recursive edit.
-`C-z':  Suspend Emacs or iconify frame.
-
-\(fn)" nil nil)
+`C-z':  Suspend Emacs or iconify frame." nil nil)
 
 (autoload 'ispell-kill-ispell "ispell" "\
 Kill current Ispell process (so that you may start a fresh one).
@@ -18992,14 +18479,10 @@ amount for last line processed.
 \(fn REG-START REG-END &optional RECHECKP SHIFT)" t nil)
 
 (autoload 'ispell-comments-and-strings "ispell" "\
-Check comments and strings in the current buffer for spelling errors.
-
-\(fn)" t nil)
+Check comments and strings in the current buffer for spelling errors." t nil)
 
 (autoload 'ispell-buffer "ispell" "\
-Check the current buffer for spelling errors interactively.
-
-\(fn)" t nil)
+Check the current buffer for spelling errors interactively." t nil)
 
 (autoload 'ispell-buffer-with-debug "ispell" "\
 `ispell-buffer' with some output sent to `ispell-debug-buffer' buffer.
@@ -19008,9 +18491,7 @@ If APPEND is non-n il, append the info to previous 
buffer if exists.
 \(fn &optional APPEND)" t nil)
 
 (autoload 'ispell-continue "ispell" "\
-Continue a halted spelling session beginning with the current word.
-
-\(fn)" t nil)
+Continue a halted spelling session beginning with the current word." t nil)
 
 (autoload 'ispell-complete-word "ispell" "\
 Try to complete the word before or at point.
@@ -19022,9 +18503,7 @@ Standard ispell choices are then available.
 \(fn &optional INTERIOR-FRAG)" t nil)
 
 (autoload 'ispell-complete-word-interior-frag "ispell" "\
-Completes word matching character sequence inside a word.
-
-\(fn)" t nil)
+Completes word matching character sequence inside a word." t nil)
 
 (autoload 'ispell "ispell" "\
 Interactively check a region or buffer for spelling errors.
@@ -19034,9 +18513,7 @@ that region.  Otherwise spell-check the buffer.
 Ispell dictionaries are not distributed with Emacs.  If you are
 looking for a dictionary, please see the distribution of the GNU ispell
 program, or do an Internet search; there are various dictionaries
-available on the net.
-
-\(fn)" t nil)
+available on the net." t nil)
 
 (autoload 'ispell-minor-mode "ispell" "\
 Toggle last-word spell checking (Ispell minor mode).
@@ -19077,9 +18554,7 @@ in your init file:
 
 You can bind this to the key C-c i in GNUS or mail by adding to
 `news-reply-mode-hook' or `mail-mode-hook' the following lambda expression:
-   (function (lambda () (local-set-key \"\\C-ci\" \\='ispell-message)))
-
-\(fn)" t nil)
+   (function (lambda () (local-set-key \"\\C-ci\" \\='ispell-message)))" t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"ispell" '("check-ispell-version" "ispell-")))
 
@@ -19105,10 +18580,7 @@ You can bind this to the key C-c i in GNUS or mail by 
adding to
 ;;;;;;  0 0))
 ;;; Generated autoloads from language/japan-util.el
 
-(autoload 'setup-japanese-environment-internal "japan-util" "\
-
-
-\(fn)" nil nil)
+(autoload 'setup-japanese-environment-internal "japan-util" nil nil nil)
 
 (autoload 'japanese-katakana "japan-util" "\
 Convert argument to Katakana and return that.
@@ -19198,9 +18670,7 @@ It is not recommended to set this variable permanently 
to anything but nil.")
 Uninstall jka-compr.
 This removes the entries in `file-name-handler-alist' and `auto-mode-alist'
 and `inhibit-local-variables-suffixes' that were added
-by `jka-compr-installed'.
-
-\(fn)" nil nil)
+by `jka-compr-installed'." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"jka-compr" '("compression-error" "jka-compr-")))
 
@@ -19245,7 +18715,7 @@ locally, like so:
 
 ;;;### (autoloads nil "jsonrpc" "jsonrpc.el" (0 0 0 0))
 ;;; Generated autoloads from jsonrpc.el
-(push (purecopy '(jsonrpc 1 0 6)) package--builtin-versions)
+(push (purecopy '(jsonrpc 1 0 7)) package--builtin-versions)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"jsonrpc" '("jrpc-default-request-timeout" "jsonrpc-")))
 
@@ -19442,9 +18912,10 @@ the current value of `kmacro-counter').
 
 When used during defining/executing a macro, inserts the current value
 of `kmacro-counter' and increments the counter value by ARG (or by 1 if no
-prefix argument).  With just \\[universal-argument], inserts the current value
-of `kmacro-counter', but does not modify the counter; this is the
-same as incrementing the counter by zero.
+prefix argument).  With just \\[universal-argument], inserts the previous
+value of `kmacro-counter', and does not modify the counter; this is
+different from incrementing the counter by zero.  (The previous value
+of the counter is the one it had before the last increment.)
 
 The macro counter can be set directly via \\[kmacro-set-counter] and 
\\[kmacro-add-counter].
 The format of the inserted value of the counter can be controlled
@@ -19487,10 +18958,7 @@ If kbd macro currently being defined end it before 
activating it.
 The kind of Korean keyboard for Korean input method.
 \"\" for 2, \"3\" for 3.")
 
-(autoload 'setup-korean-environment-internal "korea-util" "\
-
-
-\(fn)" nil nil)
+(autoload 'setup-korean-environment-internal "korea-util" nil nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"korea-util" '("exit-korean-environment" "isearch-" "korean-key-bindings" 
"quail-hangul-switch-" "toggle-korean-input-method")))
 
@@ -19954,9 +19422,7 @@ argument.")
 (autoload 'lpr-buffer "lpr" "\
 Print buffer contents without pagination or page headers.
 See the variables `lpr-switches' and `lpr-command'
-for customization of the printer command.
-
-\(fn)" t nil)
+for customization of the printer command." t nil)
 
 (autoload 'print-buffer "lpr" "\
 Paginate and print buffer contents.
@@ -19970,9 +19436,7 @@ Otherwise, the switches in `lpr-headers-switches' are 
used
 in the print command itself; we expect them to request pagination.
 
 See the variables `lpr-switches' and `lpr-command'
-for further customization of the printer command.
-
-\(fn)" t nil)
+for further customization of the printer command." t nil)
 
 (autoload 'lpr-region "lpr" "\
 Print region contents without pagination or page headers.
@@ -20127,7 +19591,8 @@ and then select the region of un-tablified names and use
 ;;; Generated autoloads from mail/mail-extr.el
 
 (autoload 'mail-extract-address-components "mail-extr" "\
-Given an RFC-822 address ADDRESS, extract full name and canonical address.
+Extract full name and canonical address from ADDRESS.
+ADDRESS should be in RFC 822 (or later) format.
 Returns a list of the form (FULL-NAME CANONICAL-ADDRESS).  If no
 name can be extracted, FULL-NAME will be nil.  Also see
 `mail-extr-ignore-single-names' and
@@ -20165,14 +19630,9 @@ Convert mail domain DOMAIN to the country it 
corresponds to.
 ;;; Generated autoloads from mail/mail-hist.el
 
 (autoload 'mail-hist-define-keys "mail-hist" "\
-Define keys for accessing mail header history.  For use in hooks.
-
-\(fn)" nil nil)
-
-(autoload 'mail-hist-enable "mail-hist" "\
+Define keys for accessing mail header history.  For use in hooks." nil nil)
 
-
-\(fn)" nil nil)
+(autoload 'mail-hist-enable "mail-hist" nil nil nil)
 
 (defvar mail-hist-keep-history t "\
 Non-nil means keep a history for headers and text of outgoing mail.")
@@ -20184,9 +19644,7 @@ Put headers and contents of this message into mail 
header history.
 Each header has its own independent history, as does the body of the
 message.
 
-This function normally would be called when the message is sent.
-
-\(fn)" nil nil)
+This function normally would be called when the message is sent." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"mail-hist" '("mail-hist-")))
 
@@ -20218,7 +19676,7 @@ This function normally would be called when the message 
is sent.
 ;;; Generated autoloads from mail/mail-utils.el
 
 (defvar mail-use-rfc822 nil "\
-If non-nil, use a full, hairy RFC822 parser on mail addresses.
+If non-nil, use a full, hairy RFC 822 (or later) parser on mail addresses.
 Otherwise, (the default) use a smaller, somewhat faster, and
 often correct parser.")
 
@@ -20319,9 +19777,7 @@ the entries in your `mail-personal-alias-file'.
 \(fn &optional ARG)" t nil)
 
 (autoload 'mail-abbrevs-setup "mailabbrev" "\
-Initialize use of the `mailabbrev' package.
-
-\(fn)" nil nil)
+Initialize use of the `mailabbrev' package." nil nil)
 
 (autoload 'build-mail-abbrevs "mailabbrev" "\
 Read mail aliases from personal mail alias file and set `mail-abbrevs'.
@@ -20382,9 +19838,7 @@ if it is quoted with double-quotes.
 
 (autoload 'mail-completion-at-point-function "mailalias" "\
 Compute completion data for mail aliases.
-For use on `completion-at-point-functions'.
-
-\(fn)" nil nil)
+For use on `completion-at-point-functions'." nil nil)
 
 (autoload 'mail-complete "mailalias" "\
 Perform completion on header field or word preceding point.
@@ -20412,9 +19866,7 @@ current header, calls `mail-complete-function' and 
passes prefix ARG if any.
 (autoload 'mailclient-send-it "mailclient" "\
 Pass current buffer on to the system's mail client.
 Suitable value for `send-mail-function'.
-The mail client is taken to be the handler of mailto URLs.
-
-\(fn)" nil nil)
+The mail client is taken to be the handler of mailto URLs." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"mailclient" '("mailclient-")))
 
@@ -20566,9 +20018,7 @@ An adapted `makefile-mode' that knows about imake.
 
 (autoload 'make-command-summary "makesum" "\
 Make a summary of current key bindings in the buffer *Summary*.
-Previous contents of that buffer are killed first.
-
-\(fn)" t nil)
+Previous contents of that buffer are killed first." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"makesum" '("double-column")))
 
@@ -20641,9 +20091,9 @@ Default bookmark handler for Man buffers.
 
 ;;;### (autoloads nil "map" "emacs-lisp/map.el" (0 0 0 0))
 ;;; Generated autoloads from emacs-lisp/map.el
-(push (purecopy '(map 1 2)) package--builtin-versions)
+(push (purecopy '(map 2 0)) package--builtin-versions)
 
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"map" '("map")))
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"map" '("map-")))
 
 ;;;***
 
@@ -20798,14 +20248,10 @@ If ARG, allow editing of the cancellation message.
 (autoload 'message-supersede "message" "\
 Start composing a message to supersede the current message.
 This is done simply by taking the old article and adding a Supersedes
-header line with the old Message-ID.
-
-\(fn)" t nil)
+header line with the old Message-ID." t nil)
 
 (autoload 'message-recover "message" "\
-Reread contents of current buffer from its last auto-save file.
-
-\(fn)" t nil)
+Reread contents of current buffer from its last auto-save file." t nil)
 
 (autoload 'message-forward "message" "\
 Forward the current message via mail.
@@ -20825,9 +20271,7 @@ Optional DIGEST will use digest to forward.
 \(fn FORWARD-BUFFER)" nil nil)
 
 (autoload 'message-insinuate-rmail "message" "\
-Let RMAIL use message to forward.
-
-\(fn)" t nil)
+Let RMAIL use message to forward." t nil)
 
 (autoload 'message-resend "message" "\
 Resend the current article to ADDRESS.
@@ -20838,9 +20282,7 @@ Resend the current article to ADDRESS.
 Re-mail the current message.
 This only makes sense if the current message is a bounce message that
 contains some mail you have written which has been bounced back to
-you.
-
-\(fn)" t nil)
+you." t nil)
 
 (autoload 'message-mail-other-window "message" "\
 Like `message-mail' command, but display mail buffer in another window.
@@ -20905,9 +20347,7 @@ Major mode for editing MetaPost sources.
 
 (autoload 'metamail-interpret-header "metamail" "\
 Interpret a header part of a MIME message in current buffer.
-Its body part is not interpreted at all.
-
-\(fn)" t nil)
+Its body part is not interpreted at all." t nil)
 
 (autoload 'metamail-interpret-body "metamail" "\
 Interpret a body part of a MIME message in current buffer.
@@ -20971,15 +20411,11 @@ redisplayed as output is inserted.
 
 (autoload 'mh-smail "mh-comp" "\
 Compose a message with the MH mail system.
-See `mh-send' for more details on composing mail.
-
-\(fn)" t nil)
+See `mh-send' for more details on composing mail." t nil)
 
 (autoload 'mh-smail-other-window "mh-comp" "\
 Compose a message with the MH mail system in other window.
-See `mh-send' for more details on composing mail.
-
-\(fn)" t nil)
+See `mh-send' for more details on composing mail." t nil)
 
 (autoload 'mh-smail-batch "mh-comp" "\
 Compose a message with the MH mail system.
@@ -21050,9 +20486,7 @@ Quit editing and delete draft message.
 If for some reason you are not happy with the draft, you can use
 this command to kill the draft buffer and delete the draft
 message. Use the command \\[kill-buffer] if you don't want to
-delete the draft message.
-
-\(fn)" t nil)
+delete the draft message." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"mh-comp" '("mh-")))
 
@@ -21076,9 +20510,7 @@ delete the draft message.
 (put 'mh-lib-progs 'risky-local-variable t)
 
 (autoload 'mh-version "mh-e" "\
-Display version information about MH-E and the MH mail handling system.
-
-\(fn)" t nil)
+Display version information about MH-E and the MH mail handling system." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"mh-e" '("defcustom-mh" "defface-mh" "defgroup-mh" "mh-")))
 
@@ -21338,9 +20770,7 @@ The relevant variables are 
`clean-buffer-list-delay-general',
 While processing buffers, this procedure displays messages containing
 the current date/time, buffer name, how many seconds ago it was
 displayed (can be nil if the buffer was never displayed) and its
-lifetime, i.e., its \"age\" when it will be purged.
-
-\(fn)" t nil)
+lifetime, i.e., its \"age\" when it will be purged." t nil)
 
 (autoload 'midnight-delay-set "midnight" "\
 Modify `midnight-timer' according to `midnight-delay'.
@@ -21407,14 +20837,10 @@ Ignores CHAR at point.
 \(fn ARG CHAR)" t nil)
 
 (autoload 'mark-beginning-of-buffer "misc" "\
-Set mark at the beginning of the buffer.
-
-\(fn)" t nil)
+Set mark at the beginning of the buffer." t nil)
 
 (autoload 'mark-end-of-buffer "misc" "\
-Set mark at the end of the buffer.
-
-\(fn)" t nil)
+Set mark at the end of the buffer." t nil)
 
 (autoload 'upcase-char "misc" "\
 Uppercasify ARG chars starting from point.  Point doesn't move.
@@ -21441,9 +20867,7 @@ upper atmosphere.  These cause momentary pockets of 
higher-pressure
 air to form, which act as lenses that deflect incoming cosmic rays,
 focusing them to strike the drive platter and flip the desired bit.
 You can type `M-x butterfly C-M-c' to run it.  This is a permuted
-variation of `C-x M-c M-butterfly' from url `http://xkcd.com/378/'.
-
-\(fn)" t nil)
+variation of `C-x M-c M-butterfly' from url `http://xkcd.com/378/'." t nil)
 
 (autoload 'list-dynamic-libraries "misc" "\
 Display a list of all dynamic libraries known to Emacs.
@@ -21504,9 +20928,7 @@ Sequence of files visited by multiple file buffers 
Isearch.")
 
 (autoload 'multi-isearch-setup "misearch" "\
 Set up isearch to search multiple buffers.
-Intended to be added to `isearch-mode-hook'.
-
-\(fn)" nil nil)
+Intended to be added to `isearch-mode-hook'." nil nil)
 
 (autoload 'multi-isearch-buffers "misearch" "\
 Start multi-buffer Isearch on a list of BUFFERS.
@@ -21689,9 +21111,7 @@ Assume text has been decoded if DECODED is non-nil.
 ;;; Generated autoloads from gnus/mml.el
 
 (autoload 'mml-to-mime "mml" "\
-Translate the current buffer from MML to MIME.
-
-\(fn)" nil nil)
+Translate the current buffer from MML to MIME." nil nil)
 
 (autoload 'mml-attach-file "mml" "\
 Attach a file to the outgoing MIME message.
@@ -21780,10 +21200,7 @@ will be computed and used.
 
 \(fn CONT)" nil nil)
 
-(autoload 'mml2015-self-encrypt "mml2015" "\
-
-
-\(fn)" nil nil)
+(autoload 'mml2015-self-encrypt "mml2015" nil nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"mml2015" '("mml2015-")))
 
@@ -21920,9 +21337,7 @@ To test this function, evaluate:
 ;;; Generated autoloads from mpc.el
 
 (autoload 'mpc "mpc" "\
-Main entry point for MPC.
-
-\(fn)" t nil)
+Main entry point for MPC." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"mpc" '("mpc-" "tag-browser-tagtypes")))
 
@@ -21932,9 +21347,7 @@ Main entry point for MPC.
 ;;; Generated autoloads from play/mpuz.el
 
 (autoload 'mpuz "mpuz" "\
-Multiplication puzzle with GNU Emacs.
-
-\(fn)" t nil)
+Multiplication puzzle with GNU Emacs." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"mpuz" '("mpuz-")))
 
@@ -22043,14 +21456,10 @@ in place of `..':
   `default-process-coding-system' for read
   eol-type of `default-process-coding-system' for read
   `default-process-coding-system' for write
-  eol-type of `default-process-coding-system'
-
-\(fn)" t nil)
+  eol-type of `default-process-coding-system'" t nil)
 
 (autoload 'describe-current-coding-system "mule-diag" "\
-Display coding systems currently used, in detail.
-
-\(fn)" t nil)
+Display coding systems currently used, in detail." t nil)
 
 (autoload 'list-coding-systems "mule-diag" "\
 Display a list of all coding systems.
@@ -22062,9 +21471,7 @@ but still contains full information about each coding 
system.
 \(fn &optional ARG)" t nil)
 
 (autoload 'list-coding-categories "mule-diag" "\
-Display a list of all coding categories.
-
-\(fn)" nil nil)
+Display a list of all coding categories." nil nil)
 
 (autoload 'describe-font "mule-diag" "\
 Display information about a font whose name is FONTNAME.
@@ -22087,9 +21494,7 @@ see the function `describe-fontset' for the format of 
the list.
 \(fn ARG)" t nil)
 
 (autoload 'list-input-methods "mule-diag" "\
-Display information about all input methods.
-
-\(fn)" t nil)
+Display information about all input methods." t nil)
 
 (autoload 'mule-diag "mule-diag" "\
 Display diagnosis of the multilingual environment (Mule).
@@ -22097,9 +21502,7 @@ Display diagnosis of the multilingual environment 
(Mule).
 This shows various information related to the current multilingual
 environment, including lists of input methods, coding systems,
 character sets, and fontsets (if Emacs is running under a window
-system which uses fontsets).
-
-\(fn)" t nil)
+system which uses fontsets)." t nil)
 
 (autoload 'font-show-log "mule-diag" "\
 Show log of font listing and opening.
@@ -22268,41 +21671,6 @@ QUALITY can be:
 
 ;;;***
 
-;;;### (autoloads nil "multifile" "multifile.el" (0 0 0 0))
-;;; Generated autoloads from multifile.el
-
-(autoload 'multifile-initialize "multifile" "\
-Initialize a new round of operation on several files.
-FILES can be either a list of file names, or an iterator (used with 
`iter-next')
-which returns a file name at each step.
-SCAN-FUNCTION is a function called with no argument inside a buffer
-and it should return non-nil if that buffer has something on which to operate.
-OPERATE-FUNCTION is a function called with no argument; it is expected
-to perform the operation on the current file buffer and when done
-should return non-nil to mean that we should immediately continue
-operating on the next file and nil otherwise.
-
-\(fn FILES SCAN-FUNCTION OPERATE-FUNCTION)" nil nil)
-
-(autoload 'multifile-initialize-search "multifile" "\
-
-
-\(fn REGEXP FILES CASE-FOLD)" nil nil)
-
-(autoload 'multifile-initialize-replace "multifile" "\
-Initialize a new round of query&replace on several files.
-FROM is a regexp and TO is the replacement to use.
-FILES describes the file, as in `multifile-initialize'.
-CASE-FOLD can be t, nil, or `default', the latter one meaning to obey
-the default setting of `case-fold-search'.
-DELIMITED if non-nil means replace only word-delimited matches.
-
-\(fn FROM TO FILES CASE-FOLD &optional DELIMITED)" nil nil)
-
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"multifile" '("multifile-")))
-
-;;;***
-
 ;;;### (autoloads nil "mwheel" "mwheel.el" (0 0 0 0))
 ;;; Generated autoloads from mwheel.el
 
@@ -22314,29 +21682,19 @@ DELIMITED if non-nil means replace only 
word-delimited matches.
 ;;; Generated autoloads from net/net-utils.el
 
 (autoload 'ifconfig "net-utils" "\
-Run `ifconfig-program' and display diagnostic output.
-
-\(fn)" t nil)
+Run `ifconfig-program' and display diagnostic output." t nil)
 
 (autoload 'iwconfig "net-utils" "\
-Run `iwconfig-program' and display diagnostic output.
-
-\(fn)" t nil)
+Run `iwconfig-program' and display diagnostic output." t nil)
 
 (autoload 'netstat "net-utils" "\
-Run `netstat-program' and display diagnostic output.
-
-\(fn)" t nil)
+Run `netstat-program' and display diagnostic output." t nil)
 
 (autoload 'arp "net-utils" "\
-Run `arp-program' and display diagnostic output.
-
-\(fn)" t nil)
+Run `arp-program' and display diagnostic output." t nil)
 
 (autoload 'route "net-utils" "\
-Run `route-program' and display diagnostic output.
-
-\(fn)" t nil)
+Run `route-program' and display diagnostic output." t nil)
 
 (autoload 'traceroute "net-utils" "\
 Run `traceroute-program' for TARGET.
@@ -22361,9 +21719,7 @@ This command uses `nslookup-program' for looking up the 
DNS information.
 \(fn HOST &optional NAME-SERVER)" t nil)
 
 (autoload 'nslookup "net-utils" "\
-Run `nslookup-program'.
-
-\(fn)" t nil)
+Run `nslookup-program'." t nil)
 
 (autoload 'dns-lookup-host "net-utils" "\
 Look up the DNS information for HOST (name or IP address).
@@ -22405,10 +21761,7 @@ The port is deduced from 
`network-connection-service-alist'.
 
 \(fn ARG SEARCH-STRING)" t nil)
 
-(autoload 'whois-reverse-lookup "net-utils" "\
-
-
-\(fn)" t nil)
+(autoload 'whois-reverse-lookup "net-utils" nil t nil)
 
 (autoload 'network-connection-to-service "net-utils" "\
 Open a network connection to SERVICE on HOST.
@@ -22555,9 +21908,7 @@ gnutls-boot (as returned by `gnutls-boot-parameters').
 (autoload 'newsticker-running-p "newst-backend" "\
 Check whether newsticker is running.
 Return t if newsticker is running, nil otherwise.  Newsticker is
-considered to be running if the newsticker timer list is not empty.
-
-\(fn)" nil nil)
+considered to be running if the newsticker timer list is not empty." nil nil)
 
 (autoload 'newsticker-start "newst-backend" "\
 Start the newsticker.
@@ -22577,9 +21928,7 @@ Run `newsticker-start-hook' if newsticker was not 
running already.
 ;;; Generated autoloads from net/newst-plainview.el
 
 (autoload 'newsticker-plainview "newst-plainview" "\
-Start newsticker plainview.
-
-\(fn)" t nil)
+Start newsticker plainview." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"newst-plainview" '("newsticker-")))
 
@@ -22590,9 +21939,7 @@ Start newsticker plainview.
 ;;; Generated autoloads from net/newst-reader.el
 
 (autoload 'newsticker-show-news "newst-reader" "\
-Start reading news.  You may want to bind this to a key.
-
-\(fn)" t nil)
+Start reading news.  You may want to bind this to a key." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"newst-reader" '("newsticker-")))
 
@@ -22606,16 +21953,12 @@ Start reading news.  You may want to bind this to a 
key.
 Check whether newsticker's actual ticker is running.
 Return t if ticker is running, nil otherwise.  Newsticker is
 considered to be running if the newsticker timer list is not
-empty.
-
-\(fn)" nil nil)
+empty." nil nil)
 
 (autoload 'newsticker-start-ticker "newst-ticker" "\
 Start newsticker's ticker (but not the news retrieval).
 Start display timer for the actual ticker if wanted and not
-running already.
-
-\(fn)" t nil)
+running already." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"newst-ticker" '("newsticker-")))
 
@@ -22626,9 +21969,7 @@ running already.
 ;;; Generated autoloads from net/newst-treeview.el
 
 (autoload 'newsticker-treeview "newst-treeview" "\
-Start newsticker treeview.
-
-\(fn)" t nil)
+Start newsticker treeview." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"newst-treeview" '("newsticker-")))
 
@@ -22709,9 +22050,7 @@ symbol in the alist.
 
 (autoload 'nnfolder-generate-active-file "nnfolder" "\
 Look for mbox folders in the nnfolder directory and make them into groups.
-This command does not work if you use short group names.
-
-\(fn)" t nil)
+This command does not work if you use short group names." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"nnfolder" '("nnfolder-")))
 
@@ -23457,9 +22796,7 @@ Many aspects this mode can be customized using
  (add-to-list 'auto-mode-alist '("\\.m\\'" . octave-maybe-mode))
 
 (autoload 'octave-maybe-mode "octave" "\
-Select `octave-mode' if the current buffer seems to hold Octave code.
-
-\(fn)" nil nil)
+Select `octave-mode' if the current buffer seems to hold Octave code." nil nil)
 
 (autoload 'octave-mode "octave" "\
 Major mode for editing Octave code.
@@ -23569,14 +22906,10 @@ FULL is given.
 \(fn &optional HERE FULL MESSAGE)" t nil)
 
 (autoload 'turn-on-orgtbl "org" "\
-Unconditionally turn on `orgtbl-mode'.
-
-\(fn)" nil nil)
+Unconditionally turn on `orgtbl-mode'." nil nil)
 
 (autoload 'org-clock-persistence-insinuate "org" "\
-Set up hooks for clock persistence.
-
-\(fn)" nil nil)
+Set up hooks for clock persistence." nil nil)
 
 (autoload 'org-mode "org" "\
 Outline-based notes management and organizer, alias
@@ -23674,14 +23007,10 @@ if ARG is `toggle'; disable the mode otherwise.
 \(fn &optional ARG)" t nil)
 
 (autoload 'turn-on-orgstruct "org" "\
-Unconditionally turn on `orgstruct-mode'.
-
-\(fn)" nil nil)
+Unconditionally turn on `orgstruct-mode'." nil nil)
 
 (autoload 'turn-on-orgstruct++ "org" "\
-Unconditionally turn on `orgstruct++-mode'.
-
-\(fn)" nil nil)
+Unconditionally turn on `orgstruct++-mode'." nil nil)
 
 (autoload 'org-run-like-in-org-mode "org" "\
 Run a command, pretending that the current buffer is in Org mode.
@@ -23711,18 +23040,14 @@ active region.
 
 (autoload 'org-insert-link-global "org" "\
 Insert a link like Org mode does.
-This command can be called in any mode to insert a link in Org syntax.
-
-\(fn)" t nil)
+This command can be called in any mode to insert a link in Org syntax." t nil)
 
 (autoload 'org-open-at-point-global "org" "\
 Follow a link or time-stamp like Org mode does.
 This command can be called in any mode to follow an external link
 or a time-stamp that has Org mode syntax.  Its behavior is
 undefined when called on internal links (e.g., fuzzy links).
-Raise an error when there is nothing to follow.  
-
-\(fn)" t nil)
+Raise an error when there is nothing to follow.  " t nil)
 
 (autoload 'org-open-link-from-string "org" "\
 Open a link in the string S, as if it was in Org mode.
@@ -23741,9 +23066,7 @@ With `\\[universal-argument] \\[universal-argument]' 
prefix, restrict available
 (autoload 'org-cycle-agenda-files "org" "\
 Cycle through the files in `org-agenda-files'.
 If the current buffer visits an agenda file, find the next one in the list.
-If the current buffer does not, find the first agenda file.
-
-\(fn)" t nil)
+If the current buffer does not, find the first agenda file." t nil)
 
 (autoload 'org-submit-bug-report "org" "\
 Submit a bug report on Org via mail.
@@ -23752,9 +23075,7 @@ Don't hesitate to report any problems or inaccurate 
documentation.
 
 If you don't have setup sending mail from (X)Emacs, please copy the
 output buffer into your mail program, as it gives us important
-information about your Org version and configuration.
-
-\(fn)" t nil)
+information about your Org version and configuration." t nil)
 
 (autoload 'org-reload "org" "\
 Reload all Org Lisp files.
@@ -23763,9 +23084,7 @@ With prefix arg UNCOMPILED, load the uncompiled 
versions.
 \(fn &optional UNCOMPILED)" t nil)
 
 (autoload 'org-customize "org" "\
-Call the customize function with org as argument.
-
-\(fn)" t nil)
+Call the customize function with org as argument." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"org" '("org" "turn-on-org-cdlatex")))
 
@@ -24003,9 +23322,7 @@ in the file.  Otherwise, restriction will be to the 
current subtree.
 
 (autoload 'org-calendar-goto-agenda "org-agenda" "\
 Compute the Org agenda for the calendar date displayed at the cursor.
-This is a command that has to be installed in `calendar-mode-map'.
-
-\(fn)" t nil)
+This is a command that has to be installed in `calendar-mode-map'." t nil)
 
 (autoload 'org-agenda-to-appt "org-agenda" "\
 Activate appointments found in `org-agenda-files'.
@@ -24117,9 +23434,7 @@ of the day at point (if any) or the current HH:MM time.
 \(fn &optional GOTO KEYS)" t nil)
 
 (autoload 'org-capture-import-remember-templates "org-capture" "\
-Set `org-capture-templates' to be similar to `org-remember-templates'.
-
-\(fn)" t nil)
+Set `org-capture-templates' to be similar to `org-remember-templates'." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"org-capture" '("org-")))
 
@@ -24137,14 +23452,9 @@ Set `org-capture-templates' to be similar to 
`org-remember-templates'.
 ;;; Generated autoloads from org/org-colview.el
 
 (autoload 'org-columns-remove-overlays "org-colview" "\
-Remove all currently active column overlays.
-
-\(fn)" t nil)
-
-(autoload 'org-columns-get-format-and-top-level "org-colview" "\
+Remove all currently active column overlays." t nil)
 
-
-\(fn)" nil nil)
+(autoload 'org-columns-get-format-and-top-level "org-colview" nil nil nil)
 
 (autoload 'org-columns "org-colview" "\
 Turn on column view on an Org mode file.
@@ -24190,14 +23500,10 @@ PARAMS is a property list of parameters:
 \(fn PARAMS)" nil nil)
 
 (autoload 'org-columns-insert-dblock "org-colview" "\
-Create a dynamic block capturing a column view table.
-
-\(fn)" t nil)
+Create a dynamic block capturing a column view table." t nil)
 
 (autoload 'org-agenda-columns "org-colview" "\
-Turn on or update column view in the agenda.
-
-\(fn)" t nil)
+Turn on or update column view in the agenda." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"org-colview" '("org-")))
 
@@ -24207,9 +23513,7 @@ Turn on or update column view in the agenda.
 ;;; Generated autoloads from org/org-compat.el
 
 (autoload 'org-check-version "org-compat" "\
-Try very hard to provide sensible version strings.
-
-\(fn)" nil t)
+Try very hard to provide sensible version strings." nil t)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"org-compat" '("org-")))
 
@@ -24249,9 +23553,7 @@ Try very hard to provide sensible version strings.
 ;;; Generated autoloads from org/org-duration.el
 
 (autoload 'org-duration-set-regexps "org-duration" "\
-Set duration related regexps.
-
-\(fn)" t nil)
+Set duration related regexps." t nil)
 
 (autoload 'org-duration-p "org-duration" "\
 Non-nil when string S is a time duration.
@@ -24532,15 +23834,11 @@ Load FILE with optional arguments NOERROR and 
MUSTSUFFIX.
 
 (autoload 'org-release "org-version" "\
 The release version of Org.
-Inserted by installing Org mode or when a release is made.
-
-\(fn)" nil nil)
+Inserted by installing Org mode or when a release is made." nil nil)
 
 (autoload 'org-git-version "org-version" "\
 The Git version of Org mode.
-Inserted by installing Org or when a release is made.
-
-\(fn)" nil nil)
+Inserted by installing Org or when a release is made." nil nil)
 
 ;;;***
 
@@ -24736,9 +24034,7 @@ that code in the early init-file.
 
 (autoload 'package-activate-all "package" "\
 Activate all installed packages.
-The variable `package-load-list' controls which packages to load.
-
-\(fn)" nil nil)
+The variable `package-load-list' controls which packages to load." nil nil)
 
 (autoload 'package-import-keyring "package" "\
 Import keys from FILE.
@@ -24778,9 +24074,7 @@ Specially, if current buffer is a directory, the -pkg.el
 description file is not mandatory, in which case the information
 is derived from the main .el file in the directory.
 
-Downloads and installs required packages as needed.
-
-\(fn)" t nil)
+Downloads and installs required packages as needed." t nil)
 
 (autoload 'package-install-file "package" "\
 Install a package from a file.
@@ -24791,9 +24085,7 @@ directory.
 
 (autoload 'package-install-selected-packages "package" "\
 Ensure packages in `package-selected-packages' are installed.
-If some packages are not installed propose to install them.
-
-\(fn)" t nil)
+If some packages are not installed propose to install them." t nil)
 
 (autoload 'package-reinstall "package" "\
 Reinstall package PKG.
@@ -24807,9 +24099,7 @@ Remove packages that are no more needed.
 
 Packages that are no more needed by other packages in
 `package-selected-packages' and their dependencies
-will be deleted.
-
-\(fn)" t nil)
+will be deleted." t nil)
 
 (autoload 'describe-package "package" "\
 Display the full documentation of PACKAGE (a symbol).
@@ -24832,9 +24122,7 @@ short description.
 Return the version number of the package in which this is used.
 Assumes it is used from an Elisp file placed inside the top-level directory
 of an installed ELPA package.
-The return value is a string (or nil in case we can't find it).
-
-\(fn)" nil nil)
+The return value is a string (or nil in case we can't find it)." nil nil)
 
 (function-put 'package-get-version 'pure 't)
 
@@ -24895,7 +24183,7 @@ matching parenthesis is highlighted in 
`show-paren-style' after
 
 (autoload 'parse-time-string "parse-time" "\
 Parse the time-string STRING into (SEC MIN HOUR DAY MON YEAR DOW DST TZ).
-STRING should be on something resembling an RFC2822 string, a la
+STRING should be something resembling an RFC 822 (or later) date-time, e.g.,
 \"Fri, 25 Mar 2016 16:24:56 +0100\", but this function is
 somewhat liberal in what format it accepts, and will attempt to
 return a \"likely\" value even for somewhat malformed strings.
@@ -25031,6 +24319,10 @@ Emacs Lisp manual for more information and examples.
 
 (function-put 'pcase 'lisp-indent-function '1)
 
+(put 'pcase 'function-documentation '(pcase--make-docstring))
+
+(autoload 'pcase--make-docstring "pcase" nil nil nil)
+
 (autoload 'pcase-exhaustive "pcase" "\
 The exhaustive version of `pcase' (which see).
 If EXP fails to match any of the patterns in CASES, an error is signaled.
@@ -25052,34 +24344,45 @@ variable name being but a special case of it).
 (function-put 'pcase-lambda 'lisp-indent-function 'defun)
 
 (autoload 'pcase-let* "pcase" "\
-Like `let*' but where you can use `pcase' patterns for bindings.
-BODY should be an expression, and BINDINGS should be a list of bindings
-of the form (PATTERN EXP).
-See `pcase-let' for discussion of how PATTERN is matched.
+Like `let*', but supports destructuring BINDINGS using `pcase' patterns.
+As with `pcase-let', BINDINGS are of the form (PATTERN EXP), but the
+EXP in each binding in BINDINGS can use the results of the destructuring
+bindings that precede it in BINDINGS' order.
+
+Each EXP should match (i.e. be of compatible structure) to its
+respective PATTERN; a mismatch may signal an error or may go
+undetected, binding variables to arbitrary values, such as nil.
 
 \(fn BINDINGS &rest BODY)" nil t)
 
 (function-put 'pcase-let* 'lisp-indent-function '1)
 
 (autoload 'pcase-let "pcase" "\
-Like `let' but where you can use `pcase' patterns for bindings.
-BODY should be a list of expressions, and BINDINGS should be a list of bindings
-of the form (PATTERN EXP).
-The PATTERNs are only used to extract data, so the code does not test
-whether the data does match the corresponding patterns: a mismatch
-may signal an error or may go undetected, binding variables to arbitrary
-values, such as nil.
+Like `let', but supports destructuring BINDINGS using `pcase' patterns.
+BODY should be a list of expressions, and BINDINGS should be a list of
+bindings of the form (PATTERN EXP).
+All EXPs are evaluated first, and then used to perform destructuring
+bindings by matching each EXP against its respective PATTERN.  Then
+BODY is evaluated with those bindings in effect.
+
+Each EXP should match (i.e. be of compatible structure) to its
+respective PATTERN; a mismatch may signal an error or may go
+undetected, binding variables to arbitrary values, such as nil.
 
 \(fn BINDINGS &rest BODY)" nil t)
 
 (function-put 'pcase-let 'lisp-indent-function '1)
 
 (autoload 'pcase-dolist "pcase" "\
-Superset of `dolist' where the VAR binding can be a `pcase' PATTERN.
-More specifically, this is just a shorthand for the following combination
-of `dolist' and `pcase-let':
-
-    (dolist (x LIST) (pcase-let ((PATTERN x)) BODY...))
+Eval BODY once for each set of bindings defined by PATTERN and LIST elements.
+PATTERN should be a `pcase' pattern describing the structure of
+LIST elements, and LIST is a list of objects that match PATTERN,
+i.e. have a structure that is compatible with PATTERN.
+For each element of LIST, this macro binds the variables in
+PATTERN to the corresponding subfields of the LIST element, and
+then evaluates BODY with these bindings in effect.  The
+destructuring bindings of variables in PATTERN to the subfields
+of the elements of LIST is performed as if by `pcase-let'.
 
 \(fn (PATTERN LIST) BODY...)" nil t)
 
@@ -25107,9 +24410,7 @@ for the result of evaluating EXP (first arg to `pcase').
 ;;; Generated autoloads from pcmpl-cvs.el
 
 (autoload 'pcomplete/cvs "pcmpl-cvs" "\
-Completion rules for the `cvs' command.
-
-\(fn)" nil nil)
+Completion rules for the `cvs' command." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"pcmpl-cvs" '("pcmpl-cvs-")))
 
@@ -25119,29 +24420,19 @@ Completion rules for the `cvs' command.
 ;;; Generated autoloads from pcmpl-gnu.el
 
 (autoload 'pcomplete/gzip "pcmpl-gnu" "\
-Completion for `gzip'.
-
-\(fn)" nil nil)
+Completion for `gzip'." nil nil)
 
 (autoload 'pcomplete/bzip2 "pcmpl-gnu" "\
-Completion for `bzip2'.
-
-\(fn)" nil nil)
+Completion for `bzip2'." nil nil)
 
 (autoload 'pcomplete/make "pcmpl-gnu" "\
-Completion for GNU `make'.
-
-\(fn)" nil nil)
+Completion for GNU `make'." nil nil)
 
 (autoload 'pcomplete/tar "pcmpl-gnu" "\
-Completion for the GNU tar utility.
-
-\(fn)" nil nil)
+Completion for the GNU tar utility." nil nil)
 
 (autoload 'pcomplete/find "pcmpl-gnu" "\
-Completion for the GNU find utility.
-
-\(fn)" nil nil)
+Completion for the GNU find utility." nil nil)
 
 (defalias 'pcomplete/gdb 'pcomplete/xargs)
 
@@ -25153,19 +24444,13 @@ Completion for the GNU find utility.
 ;;; Generated autoloads from pcmpl-linux.el
 
 (autoload 'pcomplete/kill "pcmpl-linux" "\
-Completion for GNU/Linux `kill', using /proc filesystem.
-
-\(fn)" nil nil)
+Completion for GNU/Linux `kill', using /proc filesystem." nil nil)
 
 (autoload 'pcomplete/umount "pcmpl-linux" "\
-Completion for GNU/Linux `umount'.
-
-\(fn)" nil nil)
+Completion for GNU/Linux `umount'." nil nil)
 
 (autoload 'pcomplete/mount "pcmpl-linux" "\
-Completion for GNU/Linux `mount'.
-
-\(fn)" nil nil)
+Completion for GNU/Linux `mount'." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"pcmpl-linux" '("pcmpl-linux-" "pcomplete-pare-list")))
 
@@ -25175,9 +24460,7 @@ Completion for GNU/Linux `mount'.
 ;;; Generated autoloads from pcmpl-rpm.el
 
 (autoload 'pcomplete/rpm "pcmpl-rpm" "\
-Completion for the `rpm' command.
-
-\(fn)" nil nil)
+Completion for the `rpm' command." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"pcmpl-rpm" '("pcmpl-rpm-")))
 
@@ -25187,54 +24470,36 @@ Completion for the `rpm' command.
 ;;; Generated autoloads from pcmpl-unix.el
 
 (autoload 'pcomplete/cd "pcmpl-unix" "\
-Completion for `cd'.
-
-\(fn)" nil nil)
+Completion for `cd'." nil nil)
 
 (defalias 'pcomplete/pushd 'pcomplete/cd)
 
 (autoload 'pcomplete/rmdir "pcmpl-unix" "\
-Completion for `rmdir'.
-
-\(fn)" nil nil)
+Completion for `rmdir'." nil nil)
 
 (autoload 'pcomplete/rm "pcmpl-unix" "\
-Completion for `rm'.
-
-\(fn)" nil nil)
+Completion for `rm'." nil nil)
 
 (autoload 'pcomplete/xargs "pcmpl-unix" "\
-Completion for `xargs'.
-
-\(fn)" nil nil)
+Completion for `xargs'." nil nil)
 
 (defalias 'pcomplete/time 'pcomplete/xargs)
 
 (autoload 'pcomplete/which "pcmpl-unix" "\
-Completion for `which'.
-
-\(fn)" nil nil)
+Completion for `which'." nil nil)
 
 (autoload 'pcomplete/chown "pcmpl-unix" "\
-Completion for the `chown' command.
-
-\(fn)" nil nil)
+Completion for the `chown' command." nil nil)
 
 (autoload 'pcomplete/chgrp "pcmpl-unix" "\
-Completion for the `chgrp' command.
-
-\(fn)" nil nil)
+Completion for the `chgrp' command." nil nil)
 
 (autoload 'pcomplete/ssh "pcmpl-unix" "\
-Completion rules for the `ssh' command.
-
-\(fn)" nil nil)
+Completion rules for the `ssh' command." nil nil)
 
 (autoload 'pcomplete/scp "pcmpl-unix" "\
 Completion rules for the `scp' command.
-Includes files as well as host names followed by a colon.
-
-\(fn)" nil nil)
+Includes files as well as host names followed by a colon." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"pcmpl-unix" '("pcmpl-")))
 
@@ -25244,23 +24509,17 @@ Includes files as well as host names followed by a 
colon.
 ;;; Generated autoloads from pcmpl-x.el
 
 (autoload 'pcomplete/tlmgr "pcmpl-x" "\
-Completion for the `tlmgr' command.
-
-\(fn)" nil nil)
+Completion for the `tlmgr' command." nil nil)
 
 (autoload 'pcomplete/ack "pcmpl-x" "\
 Completion for the `ack' command.
 Start an argument with `-' to complete short options and `--' for
-long options.
-
-\(fn)" nil nil)
+long options." nil nil)
 
 (defalias 'pcomplete/ack-grep 'pcomplete/ack)
 
 (autoload 'pcomplete/ag "pcmpl-x" "\
-Completion for the `ag' command.
-
-\(fn)" nil nil)
+Completion for the `ag' command." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"pcmpl-x" '("pcmpl-x-")))
 
@@ -25277,36 +24536,24 @@ completion functions list (it should occur fairly 
early in the list).
 \(fn &optional INTERACTIVELY)" t nil)
 
 (autoload 'pcomplete-reverse "pcomplete" "\
-If cycling completion is in use, cycle backwards.
-
-\(fn)" t nil)
+If cycling completion is in use, cycle backwards." t nil)
 
 (autoload 'pcomplete-expand-and-complete "pcomplete" "\
 Expand the textual value of the current argument.
-This will modify the current buffer.
-
-\(fn)" t nil)
+This will modify the current buffer." t nil)
 
 (autoload 'pcomplete-continue "pcomplete" "\
-Complete without reference to any cycling completions.
-
-\(fn)" t nil)
+Complete without reference to any cycling completions." t nil)
 
 (autoload 'pcomplete-expand "pcomplete" "\
 Expand the textual value of the current argument.
-This will modify the current buffer.
-
-\(fn)" t nil)
+This will modify the current buffer." t nil)
 
 (autoload 'pcomplete-help "pcomplete" "\
-Display any help information relative to the current argument.
-
-\(fn)" t nil)
+Display any help information relative to the current argument." t nil)
 
 (autoload 'pcomplete-list "pcomplete" "\
-Show the list of possible completions for the current argument.
-
-\(fn)" t nil)
+Show the list of possible completions for the current argument." t nil)
 
 (autoload 'pcomplete-comint-setup "pcomplete" "\
 Setup a comint buffer to use pcomplete.
@@ -25317,9 +24564,7 @@ this is `comint-dynamic-complete-functions'.
 \(fn COMPLETEF-SYM)" nil nil)
 
 (autoload 'pcomplete-shell-setup "pcomplete" "\
-Setup `shell-mode' to use pcomplete.
-
-\(fn)" nil nil)
+Setup `shell-mode' to use pcomplete." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"pcomplete" '("pcomplete-")))
 
@@ -25577,9 +24822,7 @@ by supplying an argument.
 Entry to this mode calls the value of `picture-mode-hook' if non-nil.
 
 Note that Picture mode commands will work outside of Picture mode, but
-they are not by default assigned to keys.
-
-\(fn)" t nil)
+they are not by default assigned to keys." t nil)
 
 (defalias 'edit-picture 'picture-mode)
 
@@ -25587,6 +24830,13 @@ they are not by default assigned to keys.
 
 ;;;***
 
+;;;### (autoloads nil "pinyin" "language/pinyin.el" (0 0 0 0))
+;;; Generated autoloads from language/pinyin.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"pinyin" '("pinyin-character-map")))
+
+;;;***
+
 ;;;### (autoloads nil "pixel-scroll" "pixel-scroll.el" (0 0 0 0))
 ;;; Generated autoloads from pixel-scroll.el
 
@@ -25654,9 +24904,7 @@ Move left and right bats and try to bounce the ball to 
your opponent.
 
 pong-mode keybindings:\\<pong-mode-map>
 
-\\{pong-mode-map}
-
-\(fn)" t nil)
+\\{pong-mode-map}" t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"pong" '("pong-")))
 
@@ -25686,9 +24934,7 @@ to make output that `read' can handle, whenever this is 
possible.
 \(fn OBJECT)" nil nil)
 
 (autoload 'pp-buffer "pp" "\
-Prettify the current buffer with printed representation of a Lisp object.
-
-\(fn)" nil nil)
+Prettify the current buffer with printed representation of a Lisp object." nil 
nil)
 
 (autoload 'pp "pp" "\
 Output the pretty-printed representation of OBJECT, any Lisp object.
@@ -25950,16 +25196,12 @@ See also documentation for `pr-list-directory'.
 (autoload 'pr-printify-buffer "printing" "\
 Replace nonprinting characters in buffer with printable representations.
 The printable representations use ^ (for ASCII control characters) or hex.
-The characters tab, linefeed, space, return and formfeed are not affected.
-
-\(fn)" t nil)
+The characters tab, linefeed, space, return and formfeed are not affected." t 
nil)
 
 (autoload 'pr-printify-region "printing" "\
 Replace nonprinting characters in region with printable representations.
 The printable representations use ^ (for ASCII control characters) or hex.
-The characters tab, linefeed, space, return and formfeed are not affected.
-
-\(fn)" t nil)
+The characters tab, linefeed, space, return and formfeed are not affected." t 
nil)
 
 (autoload 'pr-txt-directory "printing" "\
 Print directory using text printer.
@@ -25975,19 +25217,13 @@ See also documentation for `pr-list-directory'.
 \(fn &optional DIR FILE-REGEXP)" t nil)
 
 (autoload 'pr-txt-buffer "printing" "\
-Print buffer using text printer.
-
-\(fn)" t nil)
+Print buffer using text printer." t nil)
 
 (autoload 'pr-txt-region "printing" "\
-Print region using text printer.
-
-\(fn)" t nil)
+Print region using text printer." t nil)
 
 (autoload 'pr-txt-mode "printing" "\
-Print major mode using text printer.
-
-\(fn)" t nil)
+Print major mode using text printer." t nil)
 
 (autoload 'pr-despool-preview "printing" "\
 Preview spooled PostScript.
@@ -26085,9 +25321,7 @@ file name.
 \(fn N-UP IFILENAME &optional OFILENAME)" t nil)
 
 (autoload 'pr-toggle-file-duplex "printing" "\
-Toggle duplex for PostScript file.
-
-\(fn)" t nil)
+Toggle duplex for PostScript file." t nil)
 
 (autoload 'pr-toggle-file-tumble "printing" "\
 Toggle tumble for PostScript file.
@@ -26095,34 +25329,22 @@ Toggle tumble for PostScript file.
 If tumble is off, produces a printing suitable for binding on the left or
 right.
 If tumble is on, produces a printing suitable for binding at the top or
-bottom.
-
-\(fn)" t nil)
+bottom." t nil)
 
 (autoload 'pr-toggle-file-landscape "printing" "\
-Toggle landscape for PostScript file.
-
-\(fn)" t nil)
+Toggle landscape for PostScript file." t nil)
 
 (autoload 'pr-toggle-ghostscript "printing" "\
-Toggle printing using ghostscript.
-
-\(fn)" t nil)
+Toggle printing using ghostscript." t nil)
 
 (autoload 'pr-toggle-faces "printing" "\
-Toggle printing with faces.
-
-\(fn)" t nil)
+Toggle printing with faces." t nil)
 
 (autoload 'pr-toggle-spool "printing" "\
-Toggle spooling.
-
-\(fn)" t nil)
+Toggle spooling." t nil)
 
 (autoload 'pr-toggle-duplex "printing" "\
-Toggle duplex.
-
-\(fn)" t nil)
+Toggle duplex." t nil)
 
 (autoload 'pr-toggle-tumble "printing" "\
 Toggle tumble.
@@ -26130,54 +25352,34 @@ Toggle tumble.
 If tumble is off, produces a printing suitable for binding on the left or
 right.
 If tumble is on, produces a printing suitable for binding at the top or
-bottom.
-
-\(fn)" t nil)
+bottom." t nil)
 
 (autoload 'pr-toggle-landscape "printing" "\
-Toggle landscape.
-
-\(fn)" t nil)
+Toggle landscape." t nil)
 
 (autoload 'pr-toggle-upside-down "printing" "\
-Toggle upside-down.
-
-\(fn)" t nil)
+Toggle upside-down." t nil)
 
 (autoload 'pr-toggle-line "printing" "\
-Toggle line number.
-
-\(fn)" t nil)
+Toggle line number." t nil)
 
 (autoload 'pr-toggle-zebra "printing" "\
-Toggle zebra stripes.
-
-\(fn)" t nil)
+Toggle zebra stripes." t nil)
 
 (autoload 'pr-toggle-header "printing" "\
-Toggle printing header.
-
-\(fn)" t nil)
+Toggle printing header." t nil)
 
 (autoload 'pr-toggle-header-frame "printing" "\
-Toggle printing header frame.
-
-\(fn)" t nil)
+Toggle printing header frame." t nil)
 
 (autoload 'pr-toggle-lock "printing" "\
-Toggle menu lock.
-
-\(fn)" t nil)
+Toggle menu lock." t nil)
 
 (autoload 'pr-toggle-region "printing" "\
-Toggle whether the region is automagically detected.
-
-\(fn)" t nil)
+Toggle whether the region is automagically detected." t nil)
 
 (autoload 'pr-toggle-mode "printing" "\
-Toggle auto mode.
-
-\(fn)" t nil)
+Toggle auto mode." t nil)
 
 (autoload 'pr-customize "printing" "\
 Customization of the `printing' group.
@@ -26195,19 +25397,13 @@ Help for the printing package.
 \(fn &rest IGNORE)" t nil)
 
 (autoload 'pr-ps-name "printing" "\
-Interactively select a PostScript printer.
-
-\(fn)" t nil)
+Interactively select a PostScript printer." t nil)
 
 (autoload 'pr-txt-name "printing" "\
-Interactively select a text printer.
-
-\(fn)" t nil)
+Interactively select a text printer." t nil)
 
 (autoload 'pr-ps-utility "printing" "\
-Interactively select a PostScript utility.
-
-\(fn)" t nil)
+Interactively select a PostScript utility." t nil)
 
 (autoload 'pr-show-ps-setup "printing" "\
 Show current ps-print settings.
@@ -26400,28 +25596,24 @@ pattern to search for.
 (autoload 'project-find-file "project" "\
 Visit a file (with completion) in the current project's roots.
 The completion default is the filename at point, if one is
-recognized.
-
-\(fn)" t nil)
+recognized." t nil)
 
 (autoload 'project-or-external-find-file "project" "\
 Visit a file (with completion) in the current project's roots or external 
roots.
 The completion default is the filename at point, if one is
-recognized.
-
-\(fn)" t nil)
+recognized." t nil)
 
 (autoload 'project-search "project" "\
 Search for REGEXP in all the files of the project.
 Stops when a match is found.
-To continue searching for next match, use command \\[multifile-continue].
+To continue searching for next match, use command \\[fileloop-continue].
 
 \(fn REGEXP)" t nil)
 
-(autoload 'project-query-replace "project" "\
+(autoload 'project-query-replace-regexp "project" "\
 Search for REGEXP in all the files of the project.
 Stops when a match is found.
-To continue searching for next match, use command \\[multifile-continue].
+To continue searching for next match, use command \\[fileloop-continue].
 
 \(fn FROM TO)" t nil)
 
@@ -26567,9 +25759,7 @@ Any other value is treated as t.")
 (custom-autoload 'ps-print-color-p "ps-print" t)
 
 (autoload 'ps-print-customize "ps-print" "\
-Customization of ps-print group.
-
-\(fn)" t nil)
+Customization of ps-print group." t nil)
 
 (autoload 'ps-print-buffer "ps-print" "\
 Generate and print a PostScript image of the buffer.
@@ -26611,9 +25801,7 @@ Generate and spool a PostScript image of the buffer.
 Like `ps-print-buffer' except that the PostScript image is saved in a local
 buffer to be sent to the printer later.
 
-Use the command `ps-despool' to send the spooled images to the printer.
-
-\(fn)" t nil)
+Use the command `ps-despool' to send the spooled images to the printer." t nil)
 
 (autoload 'ps-spool-buffer-with-faces "ps-print" "\
 Generate and spool a PostScript image of the buffer.
@@ -26621,9 +25809,7 @@ Like the command `ps-spool-buffer', but includes font, 
color, and underline
 information in the generated image.  This command works only if you are using
 a window system, so it has a way to determine color values.
 
-Use the command `ps-despool' to send the spooled images to the printer.
-
-\(fn)" t nil)
+Use the command `ps-despool' to send the spooled images to the printer." t nil)
 
 (autoload 'ps-spool-region "ps-print" "\
 Generate a PostScript image of the region and spool locally.
@@ -26660,9 +25846,7 @@ image in a file with that name.
 Display the correspondence between a line length and a font size.
 Done using the current ps-print setup.
 Try: pr -t file | awk \\='{printf \"%3d %s
-\", length($0), $0}\\=' | sort -r | head
-
-\(fn)" t nil)
+\", length($0), $0}\\=' | sort -r | head" t nil)
 
 (autoload 'ps-nb-pages-buffer "ps-print" "\
 Display number of pages to print this buffer, for various font heights.
@@ -26677,9 +25861,7 @@ The table depends on the current ps-print setup.
 \(fn NB-LINES)" t nil)
 
 (autoload 'ps-setup "ps-print" "\
-Return the current PostScript-generation setup.
-
-\(fn)" nil nil)
+Return the current PostScript-generation setup." nil nil)
 
 (autoload 'ps-extend-face-list "ps-print" "\
 Extend face in ALIST-SYM.
@@ -26830,9 +26012,7 @@ them into characters should be done separately.
 ;;; Generated autoloads from international/quail.el
 
 (autoload 'quail-title "quail" "\
-Return the title of the current Quail package.
-
-\(fn)" nil nil)
+Return the title of the current Quail package." nil nil)
 
 (autoload 'quail-use-package "quail" "\
 Start using Quail package PACKAGE-NAME.
@@ -27216,9 +26396,7 @@ Browse the URL, with `completing-read' prompt, 
associated with LOOKUP.
 \(fn LOOKUP)" t nil)
 
 (autoload 'quickurl-edit-urls "quickurl" "\
-Pull `quickurl-url-file' into a buffer for hand editing.
-
-\(fn)" t nil)
+Pull `quickurl-url-file' into a buffer for hand editing." t nil)
 
 (autoload 'quickurl-list-mode "quickurl" "\
 A mode for browsing the quickurl URL list.
@@ -27230,9 +26408,7 @@ The key bindings for `quickurl-list-mode' are:
 \(fn)" t nil)
 
 (autoload 'quickurl-list "quickurl" "\
-Display `quickurl-list' as a formatted list using `quickurl-list-mode'.
-
-\(fn)" t nil)
+Display `quickurl-list' as a formatted list using `quickurl-list-mode'." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"quickurl" '("quickurl-")))
 
@@ -27302,9 +26478,7 @@ the regexp builder.  It displays a buffer named 
\"*RE-Builder*\"
 in another window, initially containing an empty regexp.
 
 As you edit the regexp in the \"*RE-Builder*\" buffer, the
-matching parts of the target buffer will be highlighted.
-
-\(fn)" t nil)
+matching parts of the target buffer will be highlighted." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"re-builder" '("re-builder-unload-function" "reb-")))
 
@@ -27395,9 +26569,7 @@ Copy the region-rectangle and save it as the last 
killed one.
 \(fn START END)" t nil)
 
 (autoload 'yank-rectangle "rect" "\
-Yank the last killed rectangle with upper left corner at point.
-
-\(fn)" t nil)
+Yank the last killed rectangle with upper left corner at point." t nil)
 
 (autoload 'insert-rectangle "rect" "\
 Insert text of RECTANGLE with upper left corner at point.
@@ -27539,9 +26711,7 @@ For true \"word wrap\" behavior, use `visual-line-mode' 
instead.
 (autoload 'reftex-index-phrases-mode "reftex-index" nil t)
 
 (autoload 'turn-on-reftex "reftex" "\
-Turn on RefTeX mode.
-
-\(fn)" nil nil)
+Turn on RefTeX mode." nil nil)
 
 (autoload 'reftex-mode "reftex" "\
 Minor mode with distinct support for \\label, \\ref and \\cite in LaTeX.
@@ -27583,9 +26753,7 @@ on the menu bar.
 
 (autoload 'reftex-reset-scanning-information "reftex" "\
 Reset the symbols containing information from buffer scanning.
-This enforces rescanning the buffer on next use.
-
-\(fn)" nil nil)
+This enforces rescanning the buffer on next use." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"reftex" '("reftex-")))
 
@@ -27685,6 +26853,9 @@ Each string should be unique in STRINGS and should not 
contain
 any regexps, quoted or not.  Optional PAREN specifies how the
 returned regexp is surrounded by grouping constructs.
 
+If STRINGS is the empty list, the return value is a regexp that
+never matches anything.
+
 The optional argument PAREN can be any of the following:
 
 a string
@@ -27706,8 +26877,14 @@ nil
     necessary to ensure that a postfix operator appended to it will
     apply to the whole expression.
 
-The resulting regexp is equivalent to but usually more efficient
-than that of a simplified version:
+The optional argument KEEP-ORDER, if nil or omitted, allows the
+returned regexp to match the strings in any order.  If non-nil,
+the match is guaranteed to be performed in the order given, as if
+the strings were made into a regexp by joining them with the
+`\\|' operator.
+
+Up to reordering, the resulting regexp is equivalent to but
+usually more efficient than that of a simplified version:
 
  (defun simplified-regexp-opt (strings &optional paren)
    (let ((parens
@@ -27716,11 +26893,11 @@ than that of a simplified version:
                 ((eq paren \\='symbols) \\='(\"\\\\_<\\\\(\" . 
\"\\\\)\\\\_>\"))
                 ((null paren)          \\='(\"\\\\(?:\" . \"\\\\)\"))
                 (t                       \\='(\"\\\\(\" . \"\\\\)\")))))
-     (concat (car paren)
+     (concat (car parens)
              (mapconcat \\='regexp-quote strings \"\\\\|\")
-             (cdr paren))))
+             (cdr parens))))
 
-\(fn STRINGS &optional PAREN)" nil nil)
+\(fn STRINGS &optional PAREN KEEP-ORDER)" nil nil)
 
 (autoload 'regexp-opt-depth "regexp-opt" "\
 Return the depth of REGEXP.
@@ -27768,14 +26945,10 @@ Call `remember' in another frame.
 
 (autoload 'remember-clipboard "remember" "\
 Remember the contents of the current clipboard.
-Most useful for remembering things from other applications.
-
-\(fn)" t nil)
+Most useful for remembering things from other applications." t nil)
 
 (autoload 'remember-diary-extract-entries "remember" "\
-Extract diary entries from the region.
-
-\(fn)" nil nil)
+Extract diary entries from the region." nil nil)
 
 (autoload 'remember-notes "remember" "\
 Return the notes buffer, creating it if needed, and maybe switch to it.
@@ -28225,9 +27398,7 @@ Instead, these commands are available:
 \\[rmail-summary-by-recipients]   Summarize only messages with particular 
recipient(s).
 \\[rmail-summary-by-regexp]   Summarize only messages with particular 
regexp(s).
 \\[rmail-summary-by-topic]   Summarize only messages with subject line 
regexp(s).
-\\[rmail-toggle-header]        Toggle display of complete header.
-
-\(fn)" t nil)
+\\[rmail-toggle-header]        Toggle display of complete header." t nil)
 
 (autoload 'rmail-input "rmail" "\
 Run Rmail on file FILENAME.
@@ -28450,9 +27621,7 @@ Return a pattern.
 (autoload 'rng-nxml-mode-init "rng-nxml" "\
 Initialize `nxml-mode' to take advantage of `rng-validate-mode'.
 This is typically called from `nxml-mode-hook'.
-Validation will be enabled if `rng-nxml-auto-validate-flag' is non-nil.
-
-\(fn)" t nil)
+Validation will be enabled if `rng-nxml-auto-validate-flag' is non-nil." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"rng-nxml" '("rng-")))
 
@@ -28610,14 +27779,10 @@ To terminate the ROT13 display, delete that window.  
As long as that window
 is not deleted, any buffer displayed in it will become instantly encoded
 in ROT13.
 
-See also `toggle-rot13-mode'.
-
-\(fn)" t nil)
+See also `toggle-rot13-mode'." t nil)
 
 (autoload 'toggle-rot13-mode "rot13" "\
-Toggle the use of ROT13 encoding for the current window.
-
-\(fn)" t nil)
+Toggle the use of ROT13 encoding for the current window." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"rot13" '("rot13-")))
 
@@ -28803,7 +27968,7 @@ CHAR
      matches 0 through 9.
 
 `control', `cntrl'
-     matches ASCII control characters.
+     matches any character whose code is in the range 0-31.
 
 `hex-digit', `hex', `xdigit'
      matches 0 through 9, a through f and A through F.
@@ -28890,7 +28055,9 @@ CHAR
      matches a character with category CATEGORY.  CATEGORY must be
      either a character to use for C, or one of the following symbols.
 
-     `consonant'                       (\\c0 in string notation)
+     `space-for-indent'                 (\\c\\s in string notation)
+     `base'                             (\\c.)
+     `consonant'                       (\\c0)
      `base-vowel'                      (\\c1)
      `upper-diacritical-mark'          (\\c2)
      `lower-diacritical-mark'          (\\c3)
@@ -28908,7 +28075,9 @@ CHAR
      `japanese-hiragana-two-byte'      (\\cH)
      `indian-two-byte'                 (\\cI)
      `japanese-katakana-two-byte'      (\\cK)
+     `strong-left-to-right'             (\\cL)
      `korean-hangul-two-byte'          (\\cN)
+     `strong-right-to-left'             (\\cR)
      `cyrillic-two-byte'               (\\cY)
      `combining-diacritic'             (\\c^)
      `ascii'                           (\\ca)
@@ -30006,7 +29175,7 @@ Otherwise, let mailer send back a message to report 
errors.")
 (defvar send-mail-function (if (and (boundp 'smtpmail-smtp-server) 
smtpmail-smtp-server) 'smtpmail-send-it 'sendmail-query-once) "\
 Function to call to send the current buffer as mail.
 The headers should be delimited by a line which is
-not a valid RFC822 header or continuation line,
+not a valid RFC 822 (or later) header or continuation line,
 that matches the variable `mail-header-separator'.
 This is used by the default mail-sending commands.  See also
 `message-send-mail-function' for use with the Message package.")
@@ -30120,9 +29289,7 @@ before you edit the message, so you can edit or delete 
the lines.")
 
 (autoload 'sendmail-query-once "sendmail" "\
 Query for `send-mail-function' and send mail with it.
-This also saves the value of `send-mail-function' via Customize.
-
-\(fn)" nil nil)
+This also saves the value of `send-mail-function' via Customize." nil nil)
 
 (define-mail-user-agent 'sendmail-user-agent 'sendmail-user-agent-compose 
'mail-send-and-exit)
 
@@ -30245,7 +29412,7 @@ Like `mail' command, but display mail buffer in another 
frame.
 
 ;;;### (autoloads nil "seq" "emacs-lisp/seq.el" (0 0 0 0))
 ;;; Generated autoloads from emacs-lisp/seq.el
-(push (purecopy '(seq 2 20)) package--builtin-versions)
+(push (purecopy '(seq 2 21)) package--builtin-versions)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"seq" '("seq-")))
 
@@ -30364,9 +29531,7 @@ part):
 \\{ses-mode-print-map}
 These are active only in the minibuffer, when entering or editing a
 formula:
-\\{ses-mode-edit-map}
-
-\(fn)" t nil)
+\\{ses-mode-edit-map}" t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"ses" '("1value" "noreturn" "ses")))
 
@@ -30576,9 +29741,7 @@ sites in the cluster.
 Declare a single file to be shared between sites.
 It may have different filenames on each site.  When this file is edited, the
 new version will be copied to each of the other locations.  Sites can be
-specific hostnames, or names of clusters (see `shadow-define-cluster').
-
-\(fn)" t nil)
+specific hostnames, or names of clusters (see `shadow-define-cluster')." t nil)
 
 (autoload 'shadow-define-regexp-group "shadowfile" "\
 Make each of a group of files be shared between hosts.
@@ -30586,14 +29749,10 @@ Prompts for regular expression; files matching this 
are shared between a list
 of sites, which are also prompted for.  The filenames must be identical on all
 hosts (if they aren't, use `shadow-define-literal-group' instead of this
 function).  Each site can be either a hostname or the name of a cluster (see
-`shadow-define-cluster').
-
-\(fn)" t nil)
+`shadow-define-cluster')." t nil)
 
 (autoload 'shadow-initialize "shadowfile" "\
-Set up file shadowing.
-
-\(fn)" t nil)
+Set up file shadowing." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"shadowfile" '("shadow")))
 
@@ -30940,9 +30099,7 @@ if ARG is `toggle'; disable the mode otherwise.
 
 (autoload 'smerge-start-session "smerge-mode" "\
 Turn on `smerge-mode' and move point to first conflict marker.
-If no conflict maker is found, turn off `smerge-mode'.
-
-\(fn)" t nil)
+If no conflict maker is found, turn off `smerge-mode'." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"smerge-mode" '("smerge-")))
 
@@ -30984,15 +30141,10 @@ interactively.  If there's no argument, do it at the 
current buffer.
 ;;;### (autoloads nil "smtpmail" "mail/smtpmail.el" (0 0 0 0))
 ;;; Generated autoloads from mail/smtpmail.el
 
-(autoload 'smtpmail-send-it "smtpmail" "\
-
-
-\(fn)" nil nil)
+(autoload 'smtpmail-send-it "smtpmail" nil nil nil)
 
 (autoload 'smtpmail-send-queued-mail "smtpmail" "\
-Send mail that was queued as a result of setting `smtpmail-queue-mail'.
-
-\(fn)" t nil)
+Send mail that was queued as a result of setting `smtpmail-queue-mail'." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"smtpmail" '("smtpmail-")))
 
@@ -31015,9 +30167,7 @@ Snake mode keybindings:
 \\[snake-move-left]    Makes the snake move left
 \\[snake-move-right]   Makes the snake move right
 \\[snake-move-up]      Makes the snake move up
-\\[snake-move-down]    Makes the snake move down
-
-\(fn)" t nil)
+\\[snake-move-down]    Makes the snake move down" t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"snake" '("snake-")))
 
@@ -31034,9 +30184,7 @@ Comments start with -- and end with newline or another 
--.
 Delete converts tabs to spaces as it moves back.
 \\{snmp-mode-map}
 Turning on snmp-mode runs the hooks in `snmp-common-mode-hook', then
-`snmp-mode-hook'.
-
-\(fn)" t nil)
+`snmp-mode-hook'." t nil)
 
 (autoload 'snmpv2-mode "snmp-mode" "\
 Major mode for editing SNMPv2 MIBs.
@@ -31046,9 +30194,7 @@ Comments start with -- and end with newline or another 
--.
 Delete converts tabs to spaces as it moves back.
 \\{snmp-mode-map}
 Turning on snmp-mode runs the hooks in `snmp-common-mode-hook',
-then `snmpv2-mode-hook'.
-
-\(fn)" t nil)
+then `snmpv2-mode-hook'." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"snmp-mode" '("snmp")))
 
@@ -31401,16 +30547,12 @@ Customize `spam-report-url-ping-function' to use this 
function.
 Add spam-report support to the Agent.
 Spam reports will be queued with \\[spam-report-url-to-file] when
 the Agent is unplugged, and will be submitted in a batch when the
-Agent is plugged.
-
-\(fn)" t nil)
+Agent is plugged." t nil)
 
 (autoload 'spam-report-deagentize "spam-report" "\
 Remove spam-report support from the Agent.
 Spam reports will be queued with the method used when
-\\[spam-report-agentize] was run.
-
-\(fn)" t nil)
+\\[spam-report-agentize] was run." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"spam-report" '("spam-report-")))
 
@@ -31448,9 +30590,7 @@ supported at a time.
 (autoload 'speedbar-get-focus "speedbar" "\
 Change frame focus to or from the speedbar frame.
 If the selected frame is not speedbar, then speedbar frame is
-selected.  If the speedbar frame is active, then select the attached frame.
-
-\(fn)" t nil)
+selected.  If the speedbar frame is active, then select the attached frame." t 
nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"speedbar" '("speedbar-")))
 
@@ -31460,14 +30600,10 @@ selected.  If the speedbar frame is active, then 
select the attached frame.
 ;;; Generated autoloads from play/spook.el
 
 (autoload 'spook "spook" "\
-Adds that special touch of class to your outgoing mail.
-
-\(fn)" t nil)
+Adds that special touch of class to your outgoing mail." t nil)
 
 (autoload 'snarf-spooks "spook" "\
-Return a vector containing the lines from `spook-phrases-file'.
-
-\(fn)" nil nil)
+Return a vector containing the lines from `spook-phrases-file'." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"spook" '("spook-phrase")))
 
@@ -31863,8 +30999,7 @@ The default comes from `process-coding-system-alist' and
 your might try undecided-dos as a coding system.  If this doesn't help,
 Try to set `comint-output-filter-functions' like this:
 
-\(setq comint-output-filter-functions (append comint-output-filter-functions
-                                            \\='(comint-strip-ctrl-m)))
+\(add-hook 'comint-output-filter-functions #\\='comint-strip-ctrl-m 'append)
 
 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)
 
@@ -32217,14 +31352,10 @@ Displays the command which STROKE maps to, reading 
STROKE interactively.
 \(fn STROKE)" t nil)
 
 (autoload 'strokes-help "strokes" "\
-Get instruction on using the Strokes package.
-
-\(fn)" t nil)
+Get instruction on using the Strokes package." t nil)
 
 (autoload 'strokes-load-user-strokes "strokes" "\
-Load user-defined strokes from file named by `strokes-file'.
-
-\(fn)" t nil)
+Load user-defined strokes from file named by `strokes-file'." t nil)
 
 (autoload 'strokes-list-strokes "strokes" "\
 Pop up a buffer containing an alphabetical listing of strokes in STROKES-MAP.
@@ -32275,9 +31406,7 @@ Optional FORCE non-nil will ignore the buffer's 
read-only status.
 \(fn &optional BUFFER FORCE)" t nil)
 
 (autoload 'strokes-compose-complex-stroke "strokes" "\
-Read a complex stroke and insert its glyph into the current buffer.
-
-\(fn)" t nil)
+Read a complex stroke and insert its glyph into the current buffer." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"strokes" '("strokes-")))
 
@@ -32297,16 +31426,14 @@ Studlify-case the current word, or COUNT words if 
given an argument.
 \(fn COUNT)" t nil)
 
 (autoload 'studlify-buffer "studly" "\
-Studlify-case the current buffer.
-
-\(fn)" t nil)
+Studlify-case the current buffer." t nil)
 
 ;;;***
 
 ;;;### (autoloads nil "subr-x" "emacs-lisp/subr-x.el" (0 0 0 0))
 ;;; Generated autoloads from emacs-lisp/subr-x.el
 
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"subr-x" '("and-let*" "hash-table-" "if-let" "internal--" "string-" "thread-" 
"when-let")))
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"subr-x" '("and-let*" "hash-table-" "if-let" "internal--" 
"replace-region-contents" "string-" "thread-" "when-let")))
 
 ;;;***
 
@@ -32434,9 +31561,7 @@ original message but it does require a few things:
 
 The region need not be active (and typically isn't when this
 function is called).  Also, the hook `sc-pre-hook' is run before,
-and `sc-post-hook' is run after the guts of this function.
-
-\(fn)" nil nil)
+and `sc-post-hook' is run after the guts of this function." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"supercite" '("sc-")))
 
@@ -32676,10 +31801,7 @@ all the table specific features.
 
 \(fn &optional ARG)" t nil)
 
-(autoload 'table-unrecognize "table" "\
-
-
-\(fn)" t nil)
+(autoload 'table-unrecognize "table" nil t nil)
 
 (autoload 'table-recognize-region "table" "\
 Recognize all tables within region.
@@ -32703,10 +31825,7 @@ the table specific features.
 
 \(fn &optional ARG)" t nil)
 
-(autoload 'table-unrecognize-table "table" "\
-
-
-\(fn)" t nil)
+(autoload 'table-unrecognize-table "table" nil t nil)
 
 (autoload 'table-recognize-cell "table" "\
 Recognize a table cell that contains current point.
@@ -32718,10 +31837,7 @@ plain text and loses all the table specific features.
 
 \(fn &optional FORCE NO-COPY ARG)" t nil)
 
-(autoload 'table-unrecognize-cell "table" "\
-
-
-\(fn)" t nil)
+(autoload 'table-unrecognize-cell "table" nil t nil)
 
 (autoload 'table-heighten-cell "table" "\
 Heighten the current cell by N lines by expanding the cell vertically.
@@ -32812,15 +31928,11 @@ DIRECTION is one of symbols; right, left, above or 
below.
 
 (autoload 'table-split-cell-vertically "table" "\
 Split current cell vertically.
-Creates a cell above and a cell below the current point location.
-
-\(fn)" t nil)
+Creates a cell above and a cell below the current point location." t nil)
 
 (autoload 'table-split-cell-horizontally "table" "\
 Split current cell horizontally.
-Creates a cell on the left and a cell on the right of the current point 
location.
-
-\(fn)" t nil)
+Creates a cell on the left and a cell on the right of the current point 
location." t nil)
 
 (autoload 'table-split-cell "table" "\
 Split current cell in ORIENTATION.
@@ -33087,9 +32199,7 @@ companion command to `table-capture' this way.
 Convert a table into plain text by removing the frame from a table.
 Remove the frame from a table and deactivate the table.  This command
 converts a table into plain text without frames.  It is a companion to
-`table-capture' which does the opposite process.
-
-\(fn)" t nil)
+`table-capture' which does the opposite process." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"table" '("*table--" "table-")))
 
@@ -33111,9 +32221,7 @@ Connect to display DISPLAY for the Emacs talk group.
 \(fn DISPLAY)" t nil)
 
 (autoload 'talk "talk" "\
-Connect to the Emacs talk group from the current X display or tty frame.
-
-\(fn)" t nil)
+Connect to the Emacs talk group from the current X display or tty frame." t 
nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"talk" '("talk-")))
 
@@ -33301,9 +32409,7 @@ If BYTE-COMPILE is non-nil, byte compile each function 
after instrumenting.
 \(fn FILENAME &optional BYTE-COMPILE)" t nil)
 
 (autoload 'testcover-this-defun "testcover" "\
-Start coverage on function under point.
-
-\(fn)" t nil)
+Start coverage on function under point." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"testcover" '("testcover-")))
 
@@ -33330,7 +32436,7 @@ tetris-mode keybindings:
 \\[tetris-rotate-next] Rotates the shape anticlockwise
 \\[tetris-move-bottom] Drops the shape to the bottom of the playing area
 
-\(fn)" t nil)
+" t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"tetris" '("tetris-")))
 
@@ -33485,9 +32591,7 @@ Tries to determine (by looking at the beginning of the 
file) whether
 this file is for plain TeX, LaTeX, or SliTeX and calls `plain-tex-mode',
 `latex-mode', or `slitex-mode', respectively.  If it cannot be determined,
 such as if there are no commands in the file, the value of `tex-default-mode'
-says which mode to use.
-
-\(fn)" t nil)
+says which mode to use." t nil)
 
 (defalias 'TeX-mode 'tex-mode)
 
@@ -33625,10 +32729,7 @@ Entering SliTeX mode runs the hook `text-mode-hook', 
then the hook
 
 \(fn)" t nil)
 
-(autoload 'tex-start-shell "tex-mode" "\
-
-
-\(fn)" nil nil)
+(autoload 'tex-start-shell "tex-mode" nil nil nil)
 
 (autoload 'doctex-mode "tex-mode" "\
 Major mode to edit DocTeX files.
@@ -33799,9 +32900,7 @@ Compose Thai characters in STRING and return the 
resulting string.
 \(fn STRING)" nil nil)
 
 (autoload 'thai-compose-buffer "thai-util" "\
-Compose Thai characters in the current buffer.
-
-\(fn)" t nil)
+Compose Thai characters in the current buffer." t nil)
 
 (autoload 'thai-composition-function "thai-util" "\
 
@@ -33863,19 +32962,13 @@ a symbol as a valid THING.
 \(fn THING &optional NO-PROPERTIES)" nil nil)
 
 (autoload 'sexp-at-point "thingatpt" "\
-Return the sexp at point, or nil if none is found.
-
-\(fn)" nil nil)
+Return the sexp at point, or nil if none is found." nil nil)
 
 (autoload 'symbol-at-point "thingatpt" "\
-Return the symbol at point, or nil if none is found.
-
-\(fn)" nil nil)
+Return the symbol at point, or nil if none is found." nil nil)
 
 (autoload 'number-at-point "thingatpt" "\
-Return the number at point, or nil if none is found.
-
-\(fn)" nil nil)
+Return the number at point, or nil if none is found." nil nil)
 
 (autoload 'list-at-point "thingatpt" "\
 Return the Lisp list at point, or nil if none is found.
@@ -33899,9 +32992,7 @@ An EVENT has the format
 \(fn EVENT)" t nil)
 
 (autoload 'list-threads "thread" "\
-Display a list of threads.
-
-\(fn)" t nil)
+Display a list of threads." t nil)
  (put 'list-threads 'disabled "Beware: manually canceling threads can ruin 
your Emacs session.")
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"thread" '("thread-list-")))
@@ -33924,21 +33015,15 @@ and SAME-WINDOW to show thumbs in the same window.
 \(fn DIR &optional REG SAME-WINDOW)" t nil)
 
 (autoload 'thumbs-dired-show-marked "thumbs" "\
-In dired, make a thumbs buffer with marked files.
-
-\(fn)" t nil)
+In dired, make a thumbs buffer with marked files." t nil)
 
 (autoload 'thumbs-dired-show "thumbs" "\
-In dired, make a thumbs buffer with all files in current directory.
-
-\(fn)" t nil)
+In dired, make a thumbs buffer with all files in current directory." t nil)
 
 (defalias 'thumbs 'thumbs-show-from-dir)
 
 (autoload 'thumbs-dired-setroot "thumbs" "\
-In dired, call the setroot program on the image at point.
-
-\(fn)" t nil)
+In dired, call the setroot program on the image at point." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"thumbs" '("thumbs-")))
 
@@ -33999,15 +33084,11 @@ are decomposed into normal Tibetan character 
sequences.
 
 (autoload 'tibetan-decompose-buffer "tibet-util" "\
 Decomposes Tibetan characters in the buffer into their components.
-See also the documentation of the function `tibetan-decompose-region'.
-
-\(fn)" t nil)
+See also the documentation of the function `tibetan-decompose-region'." t nil)
 
 (autoload 'tibetan-compose-buffer "tibet-util" "\
 Composes Tibetan character components in the buffer.
-See also docstring of the function tibetan-compose-region.
-
-\(fn)" t nil)
+See also docstring of the function tibetan-compose-region." t nil)
 
 (autoload 'tibetan-post-read-conversion "tibet-util" "\
 
@@ -34074,9 +33155,7 @@ Otherwise, if
    `tildify-space-string' variable,
 remove the hard space and leave only the space character.
 
-This function is meant to be used as a `post-self-insert-hook'.
-
-\(fn)" t nil)
+This function is meant to be used as a `post-self-insert-hook'." t nil)
 
 (autoload 'tildify-mode "tildify" "\
 Adds electric behavior to space character.
@@ -34115,9 +33194,7 @@ Enable display of time, load level, and mail flag in 
mode lines.
 This display updates automatically every minute.
 If `display-time-day-and-date' is non-nil, the current day and date
 are displayed as well.
-This runs the normal hook `display-time-hook' after each update.
-
-\(fn)" t nil)
+This runs the normal hook `display-time-hook' after each update." t nil)
 
 (defvar display-time-mode nil "\
 Non-nil if Display-Time mode is enabled.
@@ -34148,9 +33225,7 @@ runs the normal hook `display-time-hook' after each 
update.
 (autoload 'display-time-world "time" "\
 Enable updating display of times in various time zones.
 `display-time-world-list' specifies the zones.
-To turn off the world time display, go to that window and type `q'.
-
-\(fn)" t nil)
+To turn off the world time display, go to that window and type `q'." t nil)
 
 (autoload 'emacs-uptime "time" "\
 Return a string giving the uptime of this instance of Emacs.
@@ -34160,9 +33235,7 @@ For example, the Unix uptime command format is \"%D, 
%z%2h:%.2m\".
 \(fn &optional FORMAT)" t nil)
 
 (autoload 'emacs-init-time "time" "\
-Return a string giving the duration of the Emacs initialization.
-
-\(fn)" t nil)
+Return a string giving the duration of the Emacs initialization." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"time" '("display-time-" "legacy-style-world-list" "time--display-world-list" 
"zoneinfo-style-world-list")))
 
@@ -34174,6 +33247,7 @@ Return a string giving the duration of the Emacs 
initialization.
 
 (autoload 'date-to-time "time-date" "\
 Parse a string DATE that represents a date-time and return a time value.
+DATE should be in one of the forms recognized by `parse-time-string'.
 If DATE lacks timezone information, GMT is assumed.
 
 \(fn DATE)" nil nil)
@@ -34291,9 +33365,7 @@ The format of the time stamp is set by the variable 
`time-stamp-pattern' or
 `time-stamp-format'.  The variables `time-stamp-pattern',
 `time-stamp-line-limit', `time-stamp-start', `time-stamp-end',
 `time-stamp-count', and `time-stamp-inserts-lines' control finding
-the template.
-
-\(fn)" t nil)
+the template." t nil)
 
 (autoload 'time-stamp-toggle-active "time-stamp" "\
 Toggle `time-stamp-active', setting whether \\[time-stamp] updates a buffer.
@@ -34379,15 +33451,11 @@ working on.
 
 (autoload 'timeclock-query-out "timeclock" "\
 Ask the user whether to clock out.
-This is a useful function for adding to `kill-emacs-query-functions'.
-
-\(fn)" nil nil)
+This is a useful function for adding to `kill-emacs-query-functions'." nil nil)
 
 (autoload 'timeclock-reread-log "timeclock" "\
 Re-read the timeclock, to account for external changes.
-Returns the new value of `timeclock-discrepancy'.
-
-\(fn)" t nil)
+Returns the new value of `timeclock-discrepancy'." t nil)
 
 (autoload 'timeclock-workday-remaining-string "timeclock" "\
 Return a string representing the amount of time left today.
@@ -34460,7 +33528,7 @@ To get complete usage, invoke \"emacs -batch -f 
batch-titdic-convert -h\".
 
 \(fn &optional FORCE)" nil nil)
 
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"titdic-cnv" '("batch-miscdic-convert" "ctlau-" "miscdic-convert" 
"py-converter" "quail-" "quick-" "tit-" "tsang-" "ziranma-converter")))
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"titdic-cnv" '("batch-miscdic-convert" "ctlau-" "miscdic-convert" 
"pinyin-convert" "py-converter" "quail-" "quick-" "tit-" "tsang-" 
"ziranma-converter")))
 
 ;;;***
 
@@ -34501,8 +33569,10 @@ MENU is like the MENU argument to `x-popup-menu': 
either a
 keymap or an alist of alists.
 DEFAULT-ITEM, if non-nil, specifies an initial default choice.
 Its value should be an event that has a binding in MENU.
+NO-EXECUTE, if non-nil, means to return the command the user selects
+instead of executing it.
 
-\(fn MENU &optional IN-POPUP DEFAULT-ITEM)" nil nil)
+\(fn MENU &optional IN-POPUP DEFAULT-ITEM NO-EXECUTE)" nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"tmm" '("tmm-")))
 
@@ -34719,7 +33789,7 @@ the output buffer or changing the window configuration.
 
 ;;;### (autoloads nil "tramp" "net/tramp.el" (0 0 0 0))
 ;;; Generated autoloads from net/tramp.el
-(push (purecopy '(tramp 2 4 1 -1)) package--builtin-versions)
+(push (purecopy '(tramp 2 4 2 -1)) package--builtin-versions)
 
 (defvar tramp-mode t "\
 Whether Tramp is enabled.
@@ -34762,9 +33832,7 @@ Unload Tramp file name handlers from 
`file-name-handler-alist'." (dolist (fnh fi
 If non-nil, external packages signal that they are in file name completion.")
 
 (autoload 'tramp-unload-tramp "tramp" "\
-Discard Tramp from loading remote files.
-
-\(fn)" t nil)
+Discard Tramp from loading remote files." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"tramp" '("tramp-" "with-")))
 
@@ -34793,16 +33861,16 @@ List of suffixes which indicate a compressed file.
 It must be supported by libarchive(3).")
 
 (defmacro tramp-archive-autoload-file-name-regexp nil "\
-Regular expression matching archive file names." `(concat "\\`" "\\(" ".+" 
"\\." (regexp-opt tramp-archive-suffixes) "\\(?:" "\\." (regexp-opt 
tramp-archive-compression-suffixes) "\\)*" "\\)" "\\(" "/" ".*" "\\)" "\\'"))
+Regular expression matching archive file names." '(concat "\\`" "\\(" ".+" 
"\\." (regexp-opt tramp-archive-suffixes) "\\(?:" "\\." (regexp-opt 
tramp-archive-compression-suffixes) "\\)*" "\\)" "\\(" "/" ".*" "\\)" "\\'"))
 
-(defalias 'tramp-archive-autoload-file-name-handler 
'tramp-autoload-file-name-handler)
+(defalias 'tramp-archive-autoload-file-name-handler 
#'tramp-autoload-file-name-handler)
 
 (defun tramp-register-archive-file-name-handler nil "\
-Add archive file name handler to `file-name-handler-alist'." (when 
tramp-archive-enabled (add-to-list 'file-name-handler-alist (cons 
(tramp-archive-autoload-file-name-regexp) 
'tramp-archive-autoload-file-name-handler)) (put 
'tramp-archive-autoload-file-name-handler 'safe-magic t)))
+Add archive file name handler to `file-name-handler-alist'." (when 
tramp-archive-enabled (add-to-list 'file-name-handler-alist (cons 
(tramp-archive-autoload-file-name-regexp) 
#'tramp-archive-autoload-file-name-handler)) (put 
'tramp-archive-autoload-file-name-handler 'safe-magic t)))
 
-(add-hook 'after-init-hook 'tramp-register-archive-file-name-handler)
+(add-hook 'after-init-hook #'tramp-register-archive-file-name-handler)
 
-(add-hook 'tramp-archive-unload-hook (lambda nil (remove-hook 'after-init-hook 
'tramp-register-archive-file-name-handler)))
+(add-hook 'tramp-archive-unload-hook (lambda nil (remove-hook 'after-init-hook 
#'tramp-register-archive-file-name-handler)))
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"tramp-archive" '("tramp-" "with-parsed-tramp-archive-file-name")))
 
@@ -34833,11 +33901,6 @@ Add archive file name handler to 
`file-name-handler-alist'." (when tramp-archive
 ;;;### (autoloads nil "tramp-ftp" "net/tramp-ftp.el" (0 0 0 0))
 ;;; Generated autoloads from net/tramp-ftp.el
 
-(autoload 'tramp-ftp-enable-ange-ftp "tramp-ftp" "\
-Reenable Ange-FTP, when Tramp is unloaded.
-
-\(fn)" nil nil)
-
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"tramp-ftp" '("tramp-")))
 
 ;;;***
@@ -34849,6 +33912,22 @@ Reenable Ange-FTP, when Tramp is unloaded.
 
 ;;;***
 
+;;;### (autoloads nil "tramp-integration" "net/tramp-integration.el"
+;;;;;;  (0 0 0 0))
+;;; Generated autoloads from net/tramp-integration.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"tramp-integration" '("tramp-")))
+
+;;;***
+
+;;;### (autoloads nil "tramp-rclone" "net/tramp-rclone.el" (0 0 0
+;;;;;;  0))
+;;; Generated autoloads from net/tramp-rclone.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"tramp-rclone" '("tramp-rclone-")))
+
+;;;***
+
 ;;;### (autoloads nil "tramp-sh" "net/tramp-sh.el" (0 0 0 0))
 ;;; Generated autoloads from net/tramp-sh.el
 
@@ -34863,6 +33942,14 @@ Reenable Ange-FTP, when Tramp is unloaded.
 
 ;;;***
 
+;;;### (autoloads nil "tramp-sudoedit" "net/tramp-sudoedit.el" (0
+;;;;;;  0 0 0))
+;;; Generated autoloads from net/tramp-sudoedit.el
+
+(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"tramp-sudoedit" '("tramp-sudoedit-")))
+
+;;;***
+
 ;;;### (autoloads nil "tramp-uu" "net/tramp-uu.el" (0 0 0 0))
 ;;; Generated autoloads from net/tramp-uu.el
 
@@ -34944,9 +34031,7 @@ Associate another buffer with this one in two-column 
minor mode.
 Can also be used to associate a just previously visited file, by
 accepting the proposed default buffer.
 
-\(See  \\[describe-mode] .)
-
-\(fn)" t nil)
+\(See  \\[describe-mode] .)" t nil)
 
 (autoload '2C-split "two-column" "\
 Split a two-column text at point, into two buffers in two-column minor mode.
@@ -35070,16 +34155,12 @@ During the break, a demo selected from the functions 
listed in
 `type-break-demo-functions' is run.
 
 After the typing break is finished, the next break is scheduled
-as per the function `type-break-schedule'.
-
-\(fn)" t nil)
+as per the function `type-break-schedule'." t nil)
 
 (autoload 'type-break-statistics "type-break" "\
 Print statistics about typing breaks in a temporary buffer.
 This includes the last time a typing break was taken, when the next one is
-scheduled, the keystroke thresholds and the current keystroke count, etc.
-
-\(fn)" t nil)
+scheduled, the keystroke thresholds and the current keystroke count, etc." t 
nil)
 
 (autoload 'type-break-guesstimate-keystroke-threshold "type-break" "\
 Guess values for the minimum/maximum keystroke threshold for typing breaks.
@@ -35229,9 +34310,7 @@ Convert old-style Rmail Babyl files to mbox format.
 Specify the input Rmail Babyl file names as command line arguments.
 For each Rmail file, the corresponding output file name
 is made by adding `.mail' at the end.
-For example, invoke `emacs -batch -f batch-unrmail RMAIL'.
-
-\(fn)" nil nil)
+For example, invoke `emacs -batch -f batch-unrmail RMAIL'." nil nil)
 
 (autoload 'unrmail "unrmail" "\
 Convert old-style Rmail Babyl file FILE to mbox format file TO-FILE.
@@ -35811,9 +34890,7 @@ parses to
 ;;; Generated autoloads from url/url-privacy.el
 
 (autoload 'url-setup-privacy-info "url-privacy" "\
-Setup variables that expose info about you and your system.
-
-\(fn)" t nil)
+Setup variables that expose info about you and your system." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"url-privacy" '("url-device-type")))
 
@@ -36224,7 +35301,12 @@ first backend that could register the file is used.
 \(fn &optional VC-FILESET COMMENT)" t nil)
 
 (autoload 'vc-version-diff "vc" "\
-Report diffs between revisions of the fileset in the repository history.
+Report diffs between REV1 and REV2 revisions of the fileset.
+
+\(fn FILES REV1 REV2)" t nil)
+
+(autoload 'vc-root-version-diff "vc" "\
+Report diffs between REV1 and REV2 revisions of the whole tree.
 
 \(fn FILES REV1 REV2)" t nil)
 
@@ -36270,9 +35352,7 @@ saving the buffer.
 
 (autoload 'vc-root-dir "vc" "\
 Return the root directory for the current VC tree.
-Return nil if the root directory cannot be identified.
-
-\(fn)" nil nil)
+Return nil if the root directory cannot be identified." nil nil)
 
 (autoload 'vc-revision-other-window "vc" "\
 Visit revision REV of the current file in another window.
@@ -36284,9 +35364,7 @@ If `F.~REV~' already exists, use it instead of checking 
it out again.
 (autoload 'vc-insert-headers "vc" "\
 Insert headers into a file for use with a version control system.
 Headers desired are inserted at point, and are pulled from
-the variable `vc-BACKEND-header'.
-
-\(fn)" t nil)
+the variable `vc-BACKEND-header'." t nil)
 
 (autoload 'vc-merge "vc" "\
 Perform a version control merge operation.
@@ -36300,9 +35378,7 @@ between two revisions into the current fileset.  This 
asks for
 two revisions to merge from in the minibuffer.  If the first
 revision is a branch number, then merge all changes from that
 branch.  If the first revision is empty, merge the most recent
-changes from the current branch.
-
-\(fn)" t nil)
+changes from the current branch." t nil)
 
 (autoload 'vc-message-unresolved-conflicts "vc" "\
 Display a message indicating unresolved conflicts in FILENAME.
@@ -36311,6 +35387,9 @@ Display a message indicating unresolved conflicts in 
FILENAME.
 
 (defalias 'vc-resolve-conflicts 'smerge-ediff)
 
+(autoload 'vc-find-conflicted-file "vc" "\
+Visit the next conflicted file in the current project." t nil)
+
 (autoload 'vc-create-tag "vc" "\
 Descending recursively from DIR, make a tag called NAME.
 For each registered file, the working revision becomes part of
@@ -36381,9 +35460,7 @@ mark.
 (autoload 'vc-revert "vc" "\
 Revert working copies of the selected fileset to their repository contents.
 This asks for confirmation if the buffer contents are not identical
-to the working revision (except for keyword expansion).
-
-\(fn)" t nil)
+to the working revision (except for keyword expansion)." t nil)
 
 (define-obsolete-function-alias 'vc-revert-buffer 'vc-revert "23.1")
 
@@ -37510,9 +36587,7 @@ positions (integers or markers) specifying the stretch 
of the region.
 \(fn FROM TO)" t nil)
 
 (autoload 'viet-decode-viqr-buffer "viet-util" "\
-Convert `VIQR' mnemonics of the current buffer to Vietnamese characters.
-
-\(fn)" t nil)
+Convert `VIQR' mnemonics of the current buffer to Vietnamese characters." t 
nil)
 
 (autoload 'viet-encode-viqr-region "viet-util" "\
 Convert Vietnamese characters of the current region to `VIQR' mnemonics.
@@ -37522,9 +36597,7 @@ positions (integers or markers) specifying the stretch 
of the region.
 \(fn FROM TO)" t nil)
 
 (autoload 'viet-encode-viqr-buffer "viet-util" "\
-Convert Vietnamese characters of the current buffer to `VIQR' mnemonics.
-
-\(fn)" t nil)
+Convert Vietnamese characters of the current buffer to `VIQR' mnemonics." t 
nil)
 
 (autoload 'viqr-post-read-conversion "viet-util" "\
 
@@ -37792,9 +36865,7 @@ This function runs the normal hook `view-mode-hook'.
 \(fn &optional QUIT-RESTORE EXIT-ACTION)" nil nil)
 
 (autoload 'View-exit-and-edit "view" "\
-Exit View mode and make the current buffer editable.
-
-\(fn)" t nil)
+Exit View mode and make the current buffer editable." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"view" '("View-" "view-")))
 
@@ -37806,14 +36877,10 @@ Exit View mode and make the current buffer editable.
 
 (autoload 'toggle-viper-mode "viper" "\
 Toggle Viper on/off.
-If Viper is enabled, turn it off.  Otherwise, turn it on.
-
-\(fn)" t nil)
+If Viper is enabled, turn it off.  Otherwise, turn it on." t nil)
 
 (autoload 'viper-mode "viper" "\
-Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Top'.
-
-\(fn)" t nil)
+Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Top'." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"viper" '("set-viper-state-in-major-mode" "this-major-mode-requires-vi-state" 
"viper-")))
 
@@ -38007,9 +37074,7 @@ buffer, the target of the links, and the permission 
bits of the
 files.  After typing \\[wdired-finish-edit], Emacs modifies the files and
 directories to reflect your edits.
 
-See `wdired-mode'.
-
-\(fn)" t nil)
+See `wdired-mode'." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"wdired" '("wdired-")))
 
@@ -38025,9 +37090,7 @@ See the documentation for the `webjump-sites' variable 
for how to customize the
 hotlist.
 
 Please submit bug reports and other feedback to the author, Neil W. Van Dyke
-<address@hidden>.
-
-\(fn)" t nil)
+<address@hidden>." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"webjump" '("webjump-")))
 
@@ -38348,9 +37411,7 @@ The problems cleaned up are:
    `space-after-tab::space', replace TABs by SPACEs.
 
 See `whitespace-style', `indent-tabs-mode' and `tab-width' for
-documentation.
-
-\(fn)" t nil)
+documentation." t nil)
 
 (autoload 'whitespace-cleanup-region "whitespace" "\
 Cleanup some blank problems at region.
@@ -38512,9 +37573,7 @@ Recommended as a parent keymap for modes using widgets.
 Note that such modes will need to require wid-edit.")
 
 (autoload 'widget-setup "wid-edit" "\
-Setup current buffer so editing string widgets works.
-
-\(fn)" nil nil)
+Setup current buffer so editing string widgets works." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"wid-edit" '("widget-")))
 
@@ -38529,7 +37588,8 @@ With no prefix argument, or with prefix argument equal 
to zero,
 \"left\" is relative to the position of point in the window; otherwise
 it is relative to the top edge (for positive ARG) or the bottom edge
 \(for negative ARG) of the current window.
-If no window is at the desired location, an error is signaled.
+If no window is at the desired location, an error is signaled
+unless `windmove-create-window' is non-nil and a new window is created.
 
 \(fn &optional ARG)" t nil)
 
@@ -38539,7 +37599,8 @@ With no prefix argument, or with prefix argument equal 
to zero, \"up\"
 is relative to the position of point in the window; otherwise it is
 relative to the left edge (for positive ARG) or the right edge (for
 negative ARG) of the current window.
-If no window is at the desired location, an error is signaled.
+If no window is at the desired location, an error is signaled
+unless `windmove-create-window' is non-nil and a new window is created.
 
 \(fn &optional ARG)" t nil)
 
@@ -38549,7 +37610,8 @@ With no prefix argument, or with prefix argument equal 
to zero,
 \"right\" is relative to the position of point in the window;
 otherwise it is relative to the top edge (for positive ARG) or the
 bottom edge (for negative ARG) of the current window.
-If no window is at the desired location, an error is signaled.
+If no window is at the desired location, an error is signaled
+unless `windmove-create-window' is non-nil and a new window is created.
 
 \(fn &optional ARG)" t nil)
 
@@ -38559,7 +37621,8 @@ With no prefix argument, or with prefix argument equal 
to zero,
 \"down\" is relative to the position of point in the window; otherwise
 it is relative to the left edge (for positive ARG) or the right edge
 \(for negative ARG) of the current window.
-If no window is at the desired location, an error is signaled.
+If no window is at the desired location, an error is signaled
+unless `windmove-create-window' is non-nil and a new window is created.
 
 \(fn &optional ARG)" t nil)
 
@@ -38571,6 +37634,102 @@ Default value of MODIFIERS is `shift'.
 
 \(fn &optional MODIFIERS)" t nil)
 
+(autoload 'windmove-display-left "windmove" "\
+Display the next buffer in window to the left of the current one.
+See the logic of the prefix ARG in `windmove-display-in-direction'.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'windmove-display-up "windmove" "\
+Display the next buffer in window above the current one.
+See the logic of the prefix ARG in `windmove-display-in-direction'.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'windmove-display-right "windmove" "\
+Display the next buffer in window to the right of the current one.
+See the logic of the prefix ARG in `windmove-display-in-direction'.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'windmove-display-down "windmove" "\
+Display the next buffer in window below the current one.
+See the logic of the prefix ARG in `windmove-display-in-direction'.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'windmove-display-same-window "windmove" "\
+Display the next buffer in the same window.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'windmove-display-default-keybindings "windmove" "\
+Set up keybindings for directional buffer display.
+Keys are bound to commands that display the next buffer in the specified
+direction.  Keybindings are of the form MODIFIERS-{left,right,up,down},
+where MODIFIERS is either a list of modifiers or a single modifier.
+Default value of MODIFIERS is `shift-meta'.
+
+\(fn &optional MODIFIERS)" t nil)
+
+(autoload 'windmove-delete-left "windmove" "\
+Delete the window to the left of the current one.
+If prefix ARG is `C-u', delete the selected window and
+select the window that was to the left of the current one.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'windmove-delete-up "windmove" "\
+Delete the window above the current one.
+If prefix ARG is `C-u', delete the selected window and
+select the window that was above the current one.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'windmove-delete-right "windmove" "\
+Delete the window to the right of the current one.
+If prefix ARG is `C-u', delete the selected window and
+select the window that was to the right of the current one.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'windmove-delete-down "windmove" "\
+Delete the window below the current one.
+If prefix ARG is `C-u', delete the selected window and
+select the window that was below the current one.
+
+\(fn &optional ARG)" t nil)
+
+(autoload 'windmove-delete-default-keybindings "windmove" "\
+Set up keybindings for directional window deletion.
+Keys are bound to commands that delete windows in the specified
+direction.  Keybindings are of the form PREFIX MODIFIERS-{left,right,up,down},
+where PREFIX is a prefix key and MODIFIERS is either a list of modifiers or
+a single modifier.  Default value of PREFIX is `C-x' and MODIFIERS is `shift'.
+
+\(fn &optional PREFIX MODIFIERS)" t nil)
+
+(autoload 'windmove-swap-states-left "windmove" "\
+Swap the states with the window on the left from the current one." t nil)
+
+(autoload 'windmove-swap-states-up "windmove" "\
+Swap the states with the window above from the current one." t nil)
+
+(autoload 'windmove-swap-states-down "windmove" "\
+Swap the states with the window below from the current one." t nil)
+
+(autoload 'windmove-swap-states-right "windmove" "\
+Swap the states with the window on the right from the current one." t nil)
+
+(autoload 'windmove-swap-states-default-keybindings "windmove" "\
+Set up keybindings for directional window swap states.
+Keys are bound to commands that swap the states of the selected window
+with the window in the specified direction.  Keybindings are of the form
+MODIFIERS-{left,right,up,down}, where MODIFIERS is either a list of modifiers
+or a single modifier.  Default value of MODIFIERS is `shift-super'.
+
+\(fn &optional MODIFIERS)" t nil)
+
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"windmove" '("windmove-")))
 
 ;;;***
@@ -38636,9 +37795,7 @@ should be a topic string and non-nil RE-CACHE forces 
re-caching.
 \(fn &optional TOPIC RE-CACHE)" t nil)
 
 (autoload 'woman-dired-find-file "woman" "\
-In dired, run the WoMan man-page browser on this file.
-
-\(fn)" t nil)
+In dired, run the WoMan man-page browser on this file." t nil)
 
 (autoload 'woman-find-file "woman" "\
 Find, decode and browse a specific UN*X man-page source file FILE-NAME.
@@ -38761,20 +37918,13 @@ If LIMIT is non-nil, then do not consider characters 
beyond LIMIT.
 ;;;### (autoloads nil "xref" "progmodes/xref.el" (0 0 0 0))
 ;;; Generated autoloads from progmodes/xref.el
 
-(autoload 'xref-find-backend "xref" "\
-
-
-\(fn)" nil nil)
+(autoload 'xref-find-backend "xref" nil nil nil)
 
 (autoload 'xref-pop-marker-stack "xref" "\
-Pop back to where \\[xref-find-definitions] was last invoked.
-
-\(fn)" t nil)
+Pop back to where \\[xref-find-definitions] was last invoked." t nil)
 
 (autoload 'xref-marker-stack-empty-p "xref" "\
-Return t if the marker stack is empty; nil otherwise.
-
-\(fn)" nil nil)
+Return t if the marker stack is empty; nil otherwise." nil nil)
 
 (autoload 'xref-find-definitions "xref" "\
 Find the definition of the identifier at point.
@@ -38908,9 +38058,7 @@ Yenc decode region between START and END using an 
internal decoder.
 \(fn START END)" t nil)
 
 (autoload 'yenc-extract-filename "yenc" "\
-Extract file name from an yenc header.
-
-\(fn)" nil nil)
+Extract file name from an yenc header." nil nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"yenc" '("yenc-")))
 
@@ -38927,9 +38075,7 @@ Extract file name from an yenc header.
 ;;; Generated autoloads from play/zone.el
 
 (autoload 'zone "zone" "\
-Zone out, completely.
-
-\(fn)" t nil)
+Zone out, completely." t nil)
 
 (if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"zone" '("zone-")))
 
@@ -39007,43 +38153,44 @@ Zone out, completely.
 ;;;;;;  "international/uni-digit.el" "international/uni-lowercase.el"
 ;;;;;;  "international/uni-mirrored.el" "international/uni-name.el"
 ;;;;;;  "international/uni-numeric.el" "international/uni-old-name.el"
-;;;;;;  "international/uni-titlecase.el" "international/uni-uppercase.el"
-;;;;;;  "isearch.el" "jit-lock.el" "jka-cmpr-hook.el" "language/burmese.el"
-;;;;;;  "language/cham.el" "language/chinese.el" "language/cyrillic.el"
-;;;;;;  "language/czech.el" "language/english.el" "language/ethiopic.el"
-;;;;;;  "language/european.el" "language/georgian.el" "language/greek.el"
-;;;;;;  "language/hebrew.el" "language/indian.el" "language/japanese.el"
-;;;;;;  "language/khmer.el" "language/korean.el" "language/lao.el"
-;;;;;;  "language/misc-lang.el" "language/romanian.el" "language/sinhala.el"
-;;;;;;  "language/slovak.el" "language/tai-viet.el" "language/thai.el"
-;;;;;;  "language/tibetan.el" "language/utf-8-lang.el" "language/vietnamese.el"
-;;;;;;  "ldefs-boot.el" "leim/ja-dic/ja-dic.el" "leim/leim-list.el"
-;;;;;;  "leim/quail/4Corner.el" "leim/quail/ARRAY30.el" "leim/quail/CCDOSPY.el"
-;;;;;;  "leim/quail/CTLau-b5.el" "leim/quail/CTLau.el" "leim/quail/ECDICT.el"
-;;;;;;  "leim/quail/ETZY.el" "leim/quail/PY-b5.el" "leim/quail/PY.el"
-;;;;;;  "leim/quail/Punct-b5.el" "leim/quail/Punct.el" "leim/quail/QJ-b5.el"
-;;;;;;  "leim/quail/QJ.el" "leim/quail/SW.el" "leim/quail/TONEPY.el"
-;;;;;;  "leim/quail/ZIRANMA.el" "leim/quail/ZOZY.el" "leim/quail/arabic.el"
-;;;;;;  "leim/quail/croatian.el" "leim/quail/cyril-jis.el" 
"leim/quail/cyrillic.el"
-;;;;;;  "leim/quail/czech.el" "leim/quail/georgian.el" "leim/quail/greek.el"
-;;;;;;  "leim/quail/hanja-jis.el" "leim/quail/hanja.el" "leim/quail/hanja3.el"
-;;;;;;  "leim/quail/hebrew.el" "leim/quail/ipa-praat.el" 
"leim/quail/latin-alt.el"
-;;;;;;  "leim/quail/latin-ltx.el" "leim/quail/latin-post.el" 
"leim/quail/latin-pre.el"
-;;;;;;  "leim/quail/persian.el" "leim/quail/programmer-dvorak.el"
-;;;;;;  "leim/quail/py-punct.el" "leim/quail/pypunct-b5.el" 
"leim/quail/quick-b5.el"
-;;;;;;  "leim/quail/quick-cns.el" "leim/quail/rfc1345.el" 
"leim/quail/sgml-input.el"
-;;;;;;  "leim/quail/slovak.el" "leim/quail/symbol-ksc.el" 
"leim/quail/tamil-dvorak.el"
-;;;;;;  "leim/quail/tsang-b5.el" "leim/quail/tsang-cns.el" 
"leim/quail/vntelex.el"
-;;;;;;  "leim/quail/vnvni.el" "leim/quail/welsh.el" "loadup.el" 
"mail/blessmail.el"
-;;;;;;  "mail/rmailedit.el" "mail/rmailkwd.el" "mail/rmailmm.el"
-;;;;;;  "mail/rmailmsc.el" "mail/rmailsort.el" "mail/rmailsum.el"
-;;;;;;  "mail/undigest.el" "menu-bar.el" "mh-e/mh-gnus.el" 
"mh-e/mh-loaddefs.el"
-;;;;;;  "minibuffer.el" "mouse.el" "net/tramp-loaddefs.el" "newcomment.el"
-;;;;;;  "obarray.el" "org/ob-core.el" "org/ob-keys.el" "org/ob-lob.el"
-;;;;;;  "org/ob-matlab.el" "org/ob-tangle.el" "org/ob.el" "org/org-archive.el"
-;;;;;;  "org/org-attach.el" "org/org-bbdb.el" "org/org-clock.el"
-;;;;;;  "org/org-datetree.el" "org/org-element.el" "org/org-feed.el"
-;;;;;;  "org/org-footnote.el" "org/org-id.el" "org/org-indent.el"
+;;;;;;  "international/uni-special-lowercase.el" 
"international/uni-special-titlecase.el"
+;;;;;;  "international/uni-special-uppercase.el" 
"international/uni-titlecase.el"
+;;;;;;  "international/uni-uppercase.el" "isearch.el" "jit-lock.el"
+;;;;;;  "jka-cmpr-hook.el" "language/burmese.el" "language/cham.el"
+;;;;;;  "language/chinese.el" "language/cyrillic.el" "language/czech.el"
+;;;;;;  "language/english.el" "language/ethiopic.el" "language/european.el"
+;;;;;;  "language/georgian.el" "language/greek.el" "language/hebrew.el"
+;;;;;;  "language/indian.el" "language/japanese.el" "language/khmer.el"
+;;;;;;  "language/korean.el" "language/lao.el" "language/misc-lang.el"
+;;;;;;  "language/romanian.el" "language/sinhala.el" "language/slovak.el"
+;;;;;;  "language/tai-viet.el" "language/thai.el" "language/tibetan.el"
+;;;;;;  "language/utf-8-lang.el" "language/vietnamese.el" "ldefs-boot.el"
+;;;;;;  "leim/ja-dic/ja-dic.el" "leim/leim-list.el" "leim/quail/4Corner.el"
+;;;;;;  "leim/quail/ARRAY30.el" "leim/quail/CCDOSPY.el" 
"leim/quail/CTLau-b5.el"
+;;;;;;  "leim/quail/CTLau.el" "leim/quail/ECDICT.el" "leim/quail/ETZY.el"
+;;;;;;  "leim/quail/PY-b5.el" "leim/quail/PY.el" "leim/quail/Punct-b5.el"
+;;;;;;  "leim/quail/Punct.el" "leim/quail/QJ-b5.el" "leim/quail/QJ.el"
+;;;;;;  "leim/quail/SW.el" "leim/quail/TONEPY.el" "leim/quail/ZIRANMA.el"
+;;;;;;  "leim/quail/ZOZY.el" "leim/quail/arabic.el" "leim/quail/croatian.el"
+;;;;;;  "leim/quail/cyril-jis.el" "leim/quail/cyrillic.el" 
"leim/quail/czech.el"
+;;;;;;  "leim/quail/georgian.el" "leim/quail/greek.el" 
"leim/quail/hanja-jis.el"
+;;;;;;  "leim/quail/hanja.el" "leim/quail/hanja3.el" "leim/quail/hebrew.el"
+;;;;;;  "leim/quail/ipa-praat.el" "leim/quail/latin-alt.el" 
"leim/quail/latin-ltx.el"
+;;;;;;  "leim/quail/latin-post.el" "leim/quail/latin-pre.el" 
"leim/quail/persian.el"
+;;;;;;  "leim/quail/programmer-dvorak.el" "leim/quail/py-punct.el"
+;;;;;;  "leim/quail/pypunct-b5.el" "leim/quail/quick-b5.el" 
"leim/quail/quick-cns.el"
+;;;;;;  "leim/quail/rfc1345.el" "leim/quail/sgml-input.el" 
"leim/quail/slovak.el"
+;;;;;;  "leim/quail/symbol-ksc.el" "leim/quail/tamil-dvorak.el" 
"leim/quail/tsang-b5.el"
+;;;;;;  "leim/quail/tsang-cns.el" "leim/quail/vntelex.el" "leim/quail/vnvni.el"
+;;;;;;  "leim/quail/welsh.el" "loadup.el" "mail/blessmail.el" 
"mail/rmailedit.el"
+;;;;;;  "mail/rmailkwd.el" "mail/rmailmm.el" "mail/rmailmsc.el" 
"mail/rmailsort.el"
+;;;;;;  "mail/rmailsum.el" "mail/undigest.el" "menu-bar.el" "mh-e/mh-gnus.el"
+;;;;;;  "mh-e/mh-loaddefs.el" "minibuffer.el" "mouse.el" 
"net/tramp-loaddefs.el"
+;;;;;;  "newcomment.el" "obarray.el" "org/ob-core.el" "org/ob-keys.el"
+;;;;;;  "org/ob-lob.el" "org/ob-matlab.el" "org/ob-tangle.el" "org/ob.el"
+;;;;;;  "org/org-archive.el" "org/org-attach.el" "org/org-bbdb.el"
+;;;;;;  "org/org-clock.el" "org/org-datetree.el" "org/org-element.el"
+;;;;;;  "org/org-feed.el" "org/org-footnote.el" "org/org-id.el" 
"org/org-indent.el"
 ;;;;;;  "org/org-install.el" "org/org-irc.el" "org/org-mobile.el"
 ;;;;;;  "org/org-plot.el" "org/org-table.el" "org/org-timer.el" 
"org/ox-ascii.el"
 ;;;;;;  "org/ox-beamer.el" "org/ox-html.el" "org/ox-icalendar.el"
diff --git a/lisp/leim/quail/arabic.el b/lisp/leim/quail/arabic.el
index c4e1268..cf2effd 100644
--- a/lisp/leim/quail/arabic.el
+++ b/lisp/leim/quail/arabic.el
@@ -1,6 +1,6 @@
 ;;; arabic.el --- Quail package for inputting Arabic   -*- coding: utf-8;-*-
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Cloos <address@hidden>
 ;; Keywords: mule, input method, Arabic
diff --git a/lisp/leim/quail/croatian.el b/lisp/leim/quail/croatian.el
index 6124254..9d3def9 100644
--- a/lisp/leim/quail/croatian.el
+++ b/lisp/leim/quail/croatian.el
@@ -1,6 +1,6 @@
 ;;; croatian.el -- Quail package for inputting Croatian  -*-coding: utf-8;-*-
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Hrvoje Nikšić <address@hidden>
 ;; Keywords: i18n
diff --git a/lisp/leim/quail/cyril-jis.el b/lisp/leim/quail/cyril-jis.el
index 2876bae..67271ab 100644
--- a/lisp/leim/quail/cyril-jis.el
+++ b/lisp/leim/quail/cyril-jis.el
@@ -1,6 +1,6 @@
 ;;; cyril-jis.el --- Quail package for inputting JISX0208 Cyrillic letters
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -32,114 +32,110 @@
 ;;; Code:
 
 (quail-define-package
- "cyrillic-jis-russian" "Cyrillic" "$B'('+(B" nil
- "$B'+'8'5','&'/(B keyboard layout same as JCUKEN (JIS X0208.1983 encoding)"
+ "cyrillic-jis-russian" "Cyrillic" "ЖЙ" nil
+ "ЙЦУКЕН keyboard layout same as JCUKEN (JIS X0208.1983 encoding)"
  nil t t t t nil nil nil nil nil t)
 
-;;  1! 2@ 3# 4" 5: 6, 7. 8* 9( 0) -_ =+ ,L!(B
-;;   ,L9(B  ,LF(B  ,LC(B  ,L:(B  ,L5(B  ,L=(B  ,L3(B  ,LH(B  
,LI(B  ,L7(B  ,LE(B  ,Lj(B
-;;    ,LD(B  ,LK(B  ,L2(B  ,L0(B  ,L?(B  ,address@hidden(B  ,L>(B 
 ,L;(B  ,L4(B  ,L6(B  ,LM(B
-;;     ,LO(B  ,LG(B  ,LA(B  ,L<(B  ,L8(B  ,LB(B  ,LL(B  ,L1(B  
,LN(B  /?
+;;  1! 2@ 3# 4" 5: 6, 7. 8* 9( 0) -_ =+ Ё
+;;   Й  Ц  У  К  Е  Н  Г  Ш  Щ  З  Х  ъ
+;;    Ф  Ы  В  А  П  Р  О  Л  Д  Ж  Э
+;;     Я  Ч  С  М  И  Т  Ь  Б  Ю  /?
 
 (quail-define-rules
- ("1" ?$B#1(B)
- ("2" ?$B#2(B)
- ("3" ?$B#3(B)
- ("4" ?$B#4(B)
- ("5" ?$B#5(B)
- ("6" ?$B#6(B)
- ("7" ?$B#7(B)
- ("8" ?$B#8(B)
- ("9" ?$B#9(B)
- ("0" ?$B#0(B)
- ("-" ?$B!](B)
- ("=" ?$B!a(B)
- ("`" ?$B'W(B)
- ("q" ?$B'[(B)
- ("w" ?$B'h(B)
- ("e" ?$B'e(B)
- ("r" ?$B'\(B)
- ("t" ?$B'V(B)
- ("y" ?$B'_(B)
- ("u" ?$B'T(B)
- ("i" ?$B'j(B)
- ("o" ?$B'k(B)
- ("p" ?$B'Y(B)
- ("[" ?$B'g(B)
- ("]" ?$B'l(B)
- ("a" ?$B'f(B)
- ("s" ?$B'm(B)
- ("d" ?$B'S(B)
- ("f" ?$B'Q(B)
- ("g" ?$B'a(B)
- ("h" ?$B'b(B)
- ("j" ?$B'`(B)
- ("k" ?$B'](B)
- ("l" ?$B'U(B)
- (";" ?$B'X(B)
- ("'" ?$B'o(B)
- ("\\" address@hidden(B)
- ("z" ?$B'q(B)
- ("x" ?$B'i(B)
- ("c" ?$B'c(B)
- ("v" ?$B'^(B)
- ("b" ?$B'Z(B)
- ("n" ?$B'd(B)
- ("m" ?$B'n(B)
- ("," ?$B'R(B)
- ("." ?$B'p(B)
- ("/" ?$B!?(B)
+ ("1" ?1)
+ ("2" ?2)
+ ("3" ?3)
+ ("4" ?4)
+ ("5" ?5)
+ ("6" ?6)
+ ("7" ?7)
+ ("8" ?8)
+ ("9" ?9)
+ ("0" ?0)
+ ("-" ?−)
+ ("=" ?=)
+ ("`" ?ё)
+ ("q" ?й)
+ ("w" ?ц)
+ ("e" ?у)
+ ("r" ?к)
+ ("t" ?е)
+ ("y" ?н)
+ ("u" ?г)
+ ("i" ?ш)
+ ("o" ?щ)
+ ("p" ?з)
+ ("[" ?х)
+ ("]" ?ъ)
+ ("a" ?ф)
+ ("s" ?ы)
+ ("d" ?в)
+ ("f" ?а)
+ ("g" ?п)
+ ("h" ?р)
+ ("j" ?о)
+ ("k" ?л)
+ ("l" ?д)
+ (";" ?ж)
+ ("'" ?э)
+ ("\\" ?\)
+ ("z" ?я)
+ ("x" ?ч)
+ ("c" ?с)
+ ("v" ?м)
+ ("b" ?и)
+ ("n" ?т)
+ ("m" ?ь)
+ ("," ?б)
+ ("." ?ю)
+ ("/" ?/)
 
- ("!" ?$B!*(B)
- ("@" ?$B!w(B)
- ("#" ?$B!t(B)
- ("$" ?$B!I(B)
- ("%" ?$B!'(B)
- ("^" ?$B!$(B)
- ("&" ?$B!%(B)
- ("*" ?$B!v(B)
- ("(" ?$B!J(B)
-  (")" ?$B!K(B)
- ("_" ?$B!2(B)
- ("+" ?$B!\(B)
- ("~" ?$B''(B)
- ("Q" ?$B'+(B)
- ("W" ?$B'8(B)
- ("E" ?$B'5(B)
- ("R" ?$B',(B)
- ("T" ?$B'&(B)
- ("Y" ?$B'/(B)
- ("U" ?$B'$(B)
- ("I" ?$B':(B)
- ("O" ?$B';(B)
- ("P" ?$B')(B)
- ("{" ?$B'7(B)
- ("}" ?$B'<(B)
- ("A" ?$B'6(B)
- ("S" ?$B'=(B)
- ("D" ?$B'#(B)
- ("F" ?$B'!(B)
- ("G" ?$B'1(B)
- ("H" ?$B'2(B)
- ("J" ?$B'0(B)
- ("K" ?$B'-(B)
- ("L" ?$B'%(B)
- (":" ?$B'((B)
- ("\"" ?$B'?(B)
- ("|" ?$B!C(B)
- ("Z" ?$B'A(B)
- ("X" ?$B'9(B)
- ("C" ?$B'3(B)
- ("V" ?$B'.(B)
- ("B" ?$B'*(B)
- ("N" ?$B'4(B)
- ("M" ?$B'>(B)
- ("<" ?$B'"(B)
- (">" ?$B'@(B)
- ("?" ?$B!)(B))
-
-;; Local Variables:
-;; coding: iso-2022-7bit
-;; End:
+ ("!" ?!)
+ ("@" ?@)
+ ("#" ?#)
+ ("$" ?”)
+ ("%" ?:)
+ ("^" ?,)
+ ("&" ?.)
+ ("*" ?*)
+ ("(" ?()
+  (")" ?))
+ ("_" ?_)
+ ("+" ?+)
+ ("~" ?Ё)
+ ("Q" ?Й)
+ ("W" ?Ц)
+ ("E" ?У)
+ ("R" ?К)
+ ("T" ?Е)
+ ("Y" ?Н)
+ ("U" ?Г)
+ ("I" ?Ш)
+ ("O" ?Щ)
+ ("P" ?З)
+ ("{" ?Х)
+ ("}" ?Ъ)
+ ("A" ?Ф)
+ ("S" ?Ы)
+ ("D" ?В)
+ ("F" ?А)
+ ("G" ?П)
+ ("H" ?Р)
+ ("J" ?О)
+ ("K" ?Л)
+ ("L" ?Д)
+ (":" ?Ж)
+ ("\"" ?Э)
+ ("|" ?|)
+ ("Z" ?Я)
+ ("X" ?Ч)
+ ("C" ?С)
+ ("V" ?М)
+ ("B" ?И)
+ ("N" ?Т)
+ ("M" ?Ь)
+ ("<" ?Б)
+ (">" ?Ю)
+ ("?" ??))
 
 ;;; cyril-jis.el ends here
diff --git a/lisp/leim/quail/cyrillic.el b/lisp/leim/quail/cyrillic.el
index 118e750..d004177 100644
--- a/lisp/leim/quail/cyrillic.el
+++ b/lisp/leim/quail/cyrillic.el
@@ -1,6 +1,6 @@
 ;;; cyrillic.el --- Quail package for inputting Cyrillic characters
 
-;; Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/czech.el b/lisp/leim/quail/czech.el
index 6ce1602..305b739 100644
--- a/lisp/leim/quail/czech.el
+++ b/lisp/leim/quail/czech.el
@@ -1,6 +1,6 @@
 ;;; czech.el --- Quail package for inputting Czech -*-coding: utf-8;-*-
 
-;; Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Milan Zamazal <address@hidden>
 ;; Maintainer: Pavel Janík <address@hidden>
diff --git a/lisp/leim/quail/georgian.el b/lisp/leim/quail/georgian.el
index 4fdb4c3..61003b8 100644
--- a/lisp/leim/quail/georgian.el
+++ b/lisp/leim/quail/georgian.el
@@ -1,6 +1,6 @@
 ;;; georgian.el --- Quail package for inputting Georgian characters  
-*-coding: utf-8;-*-
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;; Keywords: i18n
diff --git a/lisp/leim/quail/greek.el b/lisp/leim/quail/greek.el
index e41d225..66a17a2 100644
--- a/lisp/leim/quail/greek.el
+++ b/lisp/leim/quail/greek.el
@@ -1,6 +1,6 @@
 ;;; greek.el --- Quail package for inputting Greek -*-coding: utf-8-*-
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/hangul.el b/lisp/leim/quail/hangul.el
index ba2b320..448f2d7 100644
--- a/lisp/leim/quail/hangul.el
+++ b/lisp/leim/quail/hangul.el
@@ -1,6 +1,6 @@
 ;;; hangul.el --- Korean Hangul input method
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Jihyun Cho <address@hidden>
 ;; Keywords: multilingual, input method, Korean, Hangul
diff --git a/lisp/leim/quail/hanja-jis.el b/lisp/leim/quail/hanja-jis.el
index 79730b8..6f75325 100644
--- a/lisp/leim/quail/hanja-jis.el
+++ b/lisp/leim/quail/hanja-jis.el
@@ -1,4 +1,4 @@
-;;; hanja-jis.el --- Quail package for inputting Korean Hanja (JISX0208)  
-*-coding: iso-2022-7bit;-*-
+;;; hanja-jis.el --- Quail package for inputting Korean Hanja (JISX0208)
 
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
@@ -29,499 +29,499 @@
 (require 'quail)
 
 (quail-define-package
- "korean-hanja-jis" "Korean" "$B4A(B2" t
- "2$(C9z=D(BJIS$B4A;z(B: $B3:aD$(CGO4B(B $B4A;z$(address@hidden(B 
$B1$$(C@;(B $(CGQ1[(B2$(C9z$B<0$(address@hidden(B $B8F=P$(CGO?)(B 
$BA*Z$(B"
+ "korean-hanja-jis" "Korean" "漢2" t
+ "2벌식JIS漢字: 該當하는 漢字의 韻을 한글2벌式으로 呼出하여 選擇"
  nil nil nil nil nil nil t)
 
 (quail-define-rules
- ("rk" "$B1]2>address@hidden'[H[I`]aPcwgWhSkEkhlKlhmF(B")
- ("rkr"        "$B3F3J3L3P3Q3S3U5Q5S9oH9RJS>T=WmXBZ([d]W`Bk4l;r((B")
- ("rks"        
"$B064%4&4)4/43444B4G4H4J4N4V:&:):1?{U!XLYc[8[K[Y[e`CarcCecgek]s*su(B")
- ("rkf"        "$B2p3e3i3k3l7GP"[+brcqf;iypbpv(B")
- ("rka"        
"$B4*4.46484:4;4E4F4U7g848::0QaT,T0VHY"Y~\m]>address@hidden|(B")
- ("rkq"        "$B2!389C9gL(R:b5fpo^(B")
- ("rkd"        
"$B2,3`6/607D9/959>9G9K9P9V9]9_9dFzP6Q,S3U*V>XMY,[:[|aEbee,eZf5i(jvlora(B")
- ("ro" "$B2B2U2p2r2~3'3)3+3,3.313435383;8DP"P$PCQsXAXhYb\4^taNb5k;(B")
- ("ror"        "$B5RS=(B")
- ("rod"        "$B9#99dkf=f>o3(B")
- ("ri" "$B2X(B")
- ("rir"        "$BnS(B")
- ("rj" "$B5n5o5p5q5r5t5w5x<V?x?~P`PbTRZ!Z)address@hidden(gplwn1nSnj(B")
- ("rjs"        "$B4%6R7o7r7z80X4Ykg'iJkim!qZ(B")
- ("rjf"        "$B3i7G7f8pC4KqPu[?[\]ccq(B")
- ("rja"        "$B4;address@hidden(B")
- ("rjq"        "$B5h619e=&Qg(B")
- ("rp" "$B7F7GPuX\br(B")
- ("rur"        "$B2>3J3V3W7b7cPqYH\|g-h#k.ojqnr/rps&(B")
- ("rus"        "$B3_3o7x8#8$8(8*8+8/G{KzLzPWVtWz[G`Fa+d*f0l$s$(B")
- ("ruf"        "address@hidden(B")
- ("rua"        "$B3y7s8,XDY:]>d/heni(B")
- ("ruq"        "$B3fKKXDnw(B")
- ("rud"        
"address@hidden<9E9L:"P7Q?QDQHQmR&R'S+WMX]\{_i`{a9a[b~e%e4e;fVfzh3krmKmtpopts](B")
- ("rP" 
"$B2|3#3&3,5(787<address@hidden:fFOU|address@hidden)[G^da8b#c4d"e;eki)kSl0r!s1(B")
- ("rh" 
"$B6l8E8G8H8I8K8N8O8S8T8V8Z8[8\8]9F9M9Q9b9i9p;)<J?,C!ONPFQYQjRmZ?ZJZ^[W[][^\I\_]xa`b(bPb\cLd2f*f6fxiVjCk8kFkUlKmcn~pQrurzsi(B")
- ("rhr"        "$B6J9p9r9s9tC+H#S-ZO[g\`mXq~(B")
- ("rhs"        "$B:$:%:+:-:.TgVBW}[~^xhBjnrArJs.(B")
- ("rhf"        "$B3j9|\K]qs3(B")
- ("rhd"        "$B6!6&62636u8x8y9&9)95969WPeW0YJ[}\Jd3iOi^i_lop_(B")
- ("rhk"        "$B1;2I2J2L2[2]2a8S8X8YFiTFTnTrXyfxhTixjglvpy(B")
- ("rhkr"       "$B3G3TZ2Z<[v\Zayb_oWp9(B")
- ("rhks"       
"$B4'4142474=4>4C4I4P4Q4S4X4[4\6z?{P%QN]Y^ub9eEeGf%k7oQopsA(B")
- ("rhkf"       "$B3g3hH&I0Qi[XfZ(B")
- ("rhkd"       "$B3H6)688w9-9[9\T]W"Z2[%[&[Z^+bhc~d!e&e-fykToJ(B")
- ("rho"        "$B3]757SS%XyYL[Jjh(B")
- ("rhl"        "$B2q2t2u2x2z2}3!P*PzTUW_XC\G`skK(B")
- ("rhlr"       "$Bg2qE(B")
- ("rhld"       "$B9(9I9O9l^3mDo)(B")
- ("ry" 
"$B3I3P3S3z5j6#6+6,65666:6>8r8s9'9*9;9J9Y9Z;->7R{UHYxZJ\r_$`Db)c#c\fKg1i`m]n[q-qaqb(B")
- ("rn" 
"$B11192$2%2*3C555V5W5X5_5a5d5e5f5l5q6e6f6g6h6i6j6k6m6n6o6p6q7)8{8}9$949=9B9XC!G#H7KUP}QJR"R?RkSRU=UBUdVOV}V~WaW|address@hidden)n9nlplq'qDq\r-szs}(B")
- ("rnr"        "$B5E5F5G6I9m9qSxT"[xdxkqlr(B")
- ("rns"        "$B7/727374[ub0b1c[f:je(B")
- ("rnf"        "$B6~7!7"KYPcRPVA(B")
- ("rnd"        "$B5\5]5gcVm;(B")
- ("rnjs"       "$B4+4,5s7q7t7w7}7~8"R%R0RKT!X+[{\^bGe<ipq"(B")
- ("rnjf"       "$B7!OOP-RP`Um,om(B")
- ("rnp"        "$B4y5"50B|DYQ\R<[z]$]Eb'dOgLkLlnm,q9q?(B")
- ("rnl"        "$B5"address@hidden's}(B")
- ("rnlr"       "$BDOVn(B")
- ("rb" "$B0*1.5,5j6+6e7=7>:"DPTwYdYw\\b#bkcad}eYj_lbm|oaqDr-(B")
- ("rbs"        "$B556Q6]d0nbsKs}(B")
- ("rbf"        "$B5L(B")
- ("rmr"        "$B2D3W6K7`7a7d9nP4QnUqV![yh{n<(B")
- ("rms"        "$B6O6P6R6T6Z6\6`6a:,Xi\]`wbbhAk3ncq<(B")
- ("rmf"        "address@hidden(B")
- ("rma"        "$B6S6W6X6Y6^6_6b8i:#SaZ"jPsX(B")
- ("rmq"        "$B075Z5^5b5h5i5kV)(B")
- ("rmd"        "$B919NOJOKQ>Wqbb(B")
- ("rl" 
"$B0k4k4l4o4p4q4s4t4v4w4z4{4|4}4~5!5$5%5&5'5*5-5/5253585;address@hidden:j:k:l<(B6H)IIL'P4PXQCQpSOSZT-TtV?W1YVZ\Zz[.[9[L[w\H]c]f]k^?aCc2cEe:address@hidden(B")
- ("rlr"        "$B5J(B")
- ("rls"        "$B6[(B")
- ("rlf"        "$B5H5K5MPKYI(B")
- ("rla"        "$B6b(B")
- ("Rlr"        "$B5J(B")
- ("sk" "$BF`FaFqQ5U1XoY.Y<Y=[kdy(B")
- ("skr"        "$BBz(B")
- ("sks"        "$BCHFqZ:_kl_(B")
- ("skf"        "$BFhYT^:(B")
- ("ska"        "$BCKFnFoSGU3n((B")
- ("skq"        "$BG<jU(B")
- ("skd"        "$BG9L<[((B")
- ("so" "$BBQF`FbFwG5G6G=mr(B")
- ("sid"        "$B>nUP(B")
- ("su" "$B=wY<Y=h'(B")
- ("sus"        "$BG/G2bzmY(B")
- ("suf"        "$BYT^:(B")
- ("sua"        "address@hidden,(B")
- ("suq"        "address@hidden:oR(B")
- ("sud"        "$BG+Sf_?`Xfd(B")
- ("sP" "$BG)Zc(B")
- ("sh" "$BEXE[E\G>RsUWVfW8`obug*gBqN(B")
- ("shd"        "$BG;address@hidden/(B")
- ("shk"        "$B<6(B")
- ("shl"        "$BG:G>X=g*q/(B")
- ("sy" "$BE.G"U>Yz\vo?o_r)(B")
- ("sn" "$BfU(B")
- ("sns"        "$BUD(B")
- ("snf"        "$BRefmkD(B")
- ("sb" "$BI3WY`=nf(B")
- ("sbr"        "$BWYjHjI(B")
- ("smd"        "$BG=(B")
- ("sl" "$BE%FtG)G*Wb_>_Pg7(B")
- ("slr"        "$BE.F?(B")
- ("slf"        "$BFtWbZc(B")
- ("sla"        "$BDBWl(B")
- ("ek" "$BB?BgCcTl(B")
- ("eks"        "$B1_C"C0C1C4C6C;C<address@hidden|nBs((B")
- ("ekf"        "$BC#RtU'WeZ%_}`\m}orpZpg(B")
- ("eka"        "$BC4C8C9C?CLF^S7S8T`XkY?]__,_8abb>g<i!k)k}q5(B")
- ("ekq"        "$B7#EkEzF'Quh)(B")
- ("ekd"        "$BE^EbEdEvE|F2F5Q8Vq[c\+^oaDbUc'j0j;j}oFs^(B")
- ("eo" "$B10BPBRBSBTBWB^B_BbBcBeBgFXT2UtVhZ,Z-`^gJi7o>p0(B")
- ("ejr"        "$BFAW\(B")
- ("eh" 
"$B0p?^D)D7EHEIEKELEOEQERESETEUEYE]EaEgEhEiEmEnEpEqEsExE~F(F+F3F:F;R[T&V:Y[Y\YqZ.[7[m\*]%]9^9^mbQcKe6eBeCe{h8h9k/lum%mmokpkqC(B")
- ("ehr"        "$B<3FBFDFEFFFGFHFI`1`9`We{l&qqsb(B")
- ("ehs"        "$B=cFUFWFXFYFZF[F\Z}_wa&n,q+(B")
- ("ehf"        "$BFMF\Rt[S(B")
- ("ehd"        "$B4R6ME_E`ElEoF!F/F0F1F4F6F7F8F9F<Q*\u_.aVdig^gtr<s)sj(B")
- ("en" "$B1%3u?`EMENEZEwF&F,FIP5Y5ceflh:iQjEjFl&nFr((B")
- ("ens"        "$BFVF[F\F_g=n,(B")
- ("emr"        "address@hidden(B")
- ("emd"        "$BEPEtEuEyF#F%F*F-VS\t^naVc$d[d\eX(B")
- ("fk" "$B;IMeMfMgSIXqapaziGn6oUozq`(B")
- ("fkr"        "$B3J3ZMlMmMnMoS>\[_``8`dqQ(B")
- ("fks"        "$BMpMqMsMvP,UO]3_Q_s`%k&oVolsB(B")
- ("fkf"        "address@hidden(B")
- ("fka"        "$BMrMtMuMwQ0U:Z0]4dWeqe|k"k5nN(B")
- ("fkq"        "$B@"O9YG[VgDgEoM(B")
- ("fkd"        "$BBlBmO-O/O1O2O5O:[-`f`gh>j'lplt(B")
- ("fo" "$BPTWR(B")
- ("fod"        "$BNd(B")
- ("fir"        "$BN+N,address@hidden(B")
- ("fid"        "$BL:N+N<N>address@hidden(B")
- ("fu" 
"$B023BEWK{N7N8N9NeNoO$O?Q6R/S:W*[q]-`4`5avbjdze8eFg0gFh-i<iCiZjBoLocqfqk(B")
- ("fur"        "$BNONqNrV'[6]+],]._Ma|c*m`mapNr/(B")
- ("fus"        "$BNgNmNxNyNzN{N}N~O!O"O#SXXxYcZ;\Bf_gHmSo:rY(B")
- ("fuf"        "$BNsNtNuNvQXY`^0(B")
- ("fua"        "$B3yNwN|R=T~ZL_2_R(B")
- ("fuq"        "$BND`Zr'(B")
- ("fud"        "$BNNNaNbNfNgNhNjNkNmNnNpSz]2_:f9fYiYpMryst(B")
- ("fP" "$BK-NcNiNlc9h-nTp1rg(B")
- ("fh" 
"$B02:mH'IyN:O%O&O'O(O)O*O+O4O7R)S$Y}[E_#_3_I_N`$atb:gbgcgdiCmJmboNoOq!qfrisC(B")
- ("fhr"        "$B3Q9w</C+NPO<O=O?[rbqc3m\(B")
- ("fhs"        "address@hidden(B")
- ("fhd"        "$BBlBmN5N6O.O6O8S/T;Tb[0\Y`|dFiDp/(B")
- ("fhl"        "address@hidden(Q4T^Z']*azb}d]f#fPi2iAkQlO(B")
- ("fy" "$BN;address@hidden|["_yegfXhznRoAs>(B")
- ("fyd"        "$BN5N6iD(B")
- ("fn" "$B<HN^N_O,O0O3Q$\l`4`5aqdMe_e`j3jzo;o{qp(B")
- ("fnl"        "$BN^^%(B")
- ("fb" "$BI5LxN-N.N/N0N1N2N\N]N_N`R-ShT^W!ZX\X^%_H`eaneYe`g{nvo9pEq:(B")
- ("fbr"        "$BN&O;R-Y$hz(B")
- ("fbs"        "address@hidden(B")
- ("fbf"        "$B7*N'N(N*XKdE(B")
- ("fbd"        "$BN4VWcc(B")
- ("fmr"        "$BO>P>pU(B")
- ("fma"        "$BQ[W)XnhR(B")
- ("fmd"        "$B0=I)KSN?NGNMVE\AhQi3(B")
- ("fl" 
"$B3=8qA8C,DsKiMxMyMzM{M|M}M~N!N"N#N$N%NRNoP]P^X&Xm_"address@hidden>nZqkr5rEsW(B")
- ("fls"        "$BNUNYNZN[RgX'iBm8m9nC(B")
- ("fla"        "$BNSNTNVNWaepC(B")
- ("flq"        "$B3^N)N3g~(B")
- ("ak" "address@hidden(B")
- ("akr"        "$BGyG|KFKkKlLNUki8(B")
- ("aks"        
"$B17HTHUHZJZK|K}K~L!L"OQRDRXV]VoW>W?Xp^`_TbVe\h_jGktm*mNo8q=r#(B")
- ("akf"        "$BKuKvKwbFcBg}k$p\pi(B")
- ("akd"        "$BK4K:K;K>LQLVX1f&f(gjh+hOj<j=nzr3(B")
- ("ao" "$BGMG^G_G`GaGcGdJrK?KdKeKfKgKhL%Ug`pgugvlNn2pJ(B")
- ("aor"        "$BG|G~I4L.`Sfwl=lBoyq^sN(B")
- ("aod"        "$B0:K(LALTLUQ3]ba0hNsf(B")
- ("aur"        "$BQLQQVm]qf2k,(B")
- ("aus"        "address@hidden(B")
- ("auf"        "$BJNLG(B")
- ("aud"        "$B;.L=L>address@hidden,j&nIsf(B")
- ("aP" "$BjV(B")
- ("ah" 
"$B18243}G|InJgJhJiJkJlK9K?KAKEKFKHKlL0L6L7LNLOLSLWU(ZV`S`pa(b&bHcjdwfNfnhOkuqxr|(B")
- ("ahr"        "$BI$KRKTLZL\Q^[7]teYg|s/(B")
- ("ahf"        "$BKWL^]G]s(B")
- ("ahd"        "$BL4LXQOTm[$[/](_Bb^ga(B")
- ("ay" "$B1,@&address@hidden/ZbZe^]b?eMg{i8(B")
- ("an" 
"$B@&I5IoIpIqIsJjJlK4K?KEKGL3L5L6L7L8L9LPU(V`W'XcXlYEZ[\>bHeYhOj]kX(B")
- ("anr"        "$BKAKOK|L[`Tfn(B")
- ("ans"        "$B2cJ-J8J9JZLHLdLfLgLhPnQfX$XpY_e$(B")
- ("anf"        "$BJ*L^(B")
- ("al" "$B3aFfHxHyH}H~JFL#L$LBLoU;VKW9W=_>_Pdve[i/m?sHsSs`(B")
- ("als"        "$BIRL1LeV1X>XbZa^#eNf+o\sf(B")
- ("alf"        "$BL)L*\ikm(B")
- ("qkr"        "$B9}GmGnGoGqGsGtGuGvGwGzG}JmKPKQP8YsYv\w^p`a`yg.p;qPr0rX(B")
- ("qks"        "$BH<H>address@hidden/amcme+fvj6k'm*(B")
- ("qkf"        "$BH-H.H/H0H1H4KVUVX#Y6Y{^_b"b$cAlmq{r1(B")
- ("qkd"        "$BJoJ|J}K'K,K.K5K7K8K<address@hidden|cmg/gVhpiSkno%qwr7(B")
- ("qo" "$BGPGRGSGUGVGXGZG[G\G]GeGfGrKLT/WQX`YA^\_d`jfujj(B")
- ("qor"        "$B3|GFGlGoGpGrGuI4PQVg[1`aa)cndjr0(B")
- ("qjs"        "$BH(H?HKHMHQHVHYK]ZYZZ\h_/_xc)address@hidden(B")
- ("qjf"        "$BH2H3H5H6f/(B")
- ("qja"        "$BHAHEHFHHHOK^[p^"c{gw(B")
- ("qjq"        "$BK!`k(B")
- ("qur"        "$BI{I}JHJIJJJKQ|Z&]!`za2i0j~m2mdospH(B")
- ("qus"        "$BHPJQJTJUJXJ[MhQ~RFY(Y7ZN]repg&jokfmgn4n5qX(B")
- ("quf"        "$BHcJDJLJMP(Z~sh(B")
- ("qud"        "$BIBIMISJ:J;J<JAJBL_V"Vu[D\V_[c=cme3m~q6qX(B")
- ("qh" "$BD=F>IVIaIcIhJ]JbJcJdJeJnJsJuTHUoUph^jppfse(B")
- ("qhr"        
"$BIzI{I|I}I~J!J"J#J$KMKNKPR6Z=Z>\w]M_Ad9h*hyiui}j`m.mUmVqFrX(B")
- ("qhs"        "$BK\TqlL(B")
- ("qhd"        "$B0)HFIuJpJtJvJwJ{K%K)K*K/address@hidden"_bcsdK(B")
- ("qn" 
"$B3x4L<address@hidden|J#J$JmJsK6P=PZPmP|RuS_T4UUU[Y8YC[T[U[o\T]M^pf)g%gYgxijk>lRlgmUn>n]rjrksOsPse(B")
- ("qnr"        "$BKL(B")
- ("qns"        
"$BBNHRH[J,J.J/J0J1J2J3J4J5J6J7K[K_RfW][C]d]p_9`6a'a=cic|gnlL(B")
- ("qnf"        "$BITJ&J'J(J)PGWJWgYD[,`Ac1q|sd(B")
- ("qnd"        "$BC*J+JxJ~K2TDW:boe^(B")
- ("qmr"        "$BR6(B")
- ("ql" 
"$B7%H[H\H]H^H_HaHbHcHeHfHgHjHkHlHnHpHqHsHtHwHzH{H|I!J(JOP#PlR8SgU&U9U{X`[,\R`Aa]acbNbgc0c>dDdcdue#f1fGg#g$g>hKhoitjkl"address@hidden)pBp[pfqorL(B")
- ("qls"        "$BIFIKILINIOIPIQLFUMZ/]'address@hidden@p~r&(B")
- ("qld"        "$BI9QRQVQ_U2Xaf[qHqU(B")
- ("tk" 
"$B278%:3:6:;:=:>:?:@:p;E;G;H;J;K;L;M;N;U;W;[;`;b;d;e;l;r;t;v;w;{<%<-<K<L<M<N<O<P<R<S<U<X<Y?)?ZFcGAL&L,LcP/PXQPRSSNTzU0UmWP[O[h\L]y^/^V_C_S`:`[aBc+c,codAdBdCe/fSfhgRh5iImfnanmqJqKrBr^sM(B")
- ("tkr"        "$B:o:s:w?tSVZK\N`#oK(B")
- ("tks"        "$B;1;3;5;6;9;:;;;@IGQh[<]haMedlioYo[(B")
- ("tkf"        "$B;&;';5hq(B")
- ("tka"        "$B;0;2?9?yRTWD^zdsexf.glhujN(B")
- ("tkq"        "$B07=BA^Yg]=_'_(address@hidden(B")
- ("tkd"        
"$B7,8~=}=~>&>(>0>2>E>M>X>\>]>^>e>o>uAPASAVA[AjAzA|BlBmErF=FKH"MMRVUCURVyV{XS\k]O`.a3fFjak<ksrh(B")
- ("to" "$B:I<%^/_Sg(lPp{rT(B")
- ("tor"        "$B:I:p:w?'T'XG\ecQi,(B")
- ("tod"        "$B1y>address@hidden@8`Ocy(B")
- ("tid"        "$Bq.(B")
- ("tj" "$B5P:address@hidden@4@>@@@BAMD)L;P0ScTPTfVYY3ZFZGd.e1fTf]fqsUsk(B")
- ("tjr"        
"$B3c<.<M<a<address@hidden@address@hidden@address@hidden@YM<^Hb,hnirj.jinYnq(B")
- ("tjs"        
"address@hidden@address@hidden@address@hidden@address@hidden@address@hidden@~A"A#A%A*A-A/A1A5A6A7C1OKQ"SEUIUvX:^/address@hidden(B")
- ("tjf"        
"$B1L6}7@@address@hidden@address@hidden@eC-FQSwYM\8]u^Xe(e2eJi-jxsv(B")
- ("tja"        "address@hidden(B")
- ("tjq"        "$B=&>D@"@]RYSqXRXwYpfcm:oRq#(B")
- ("tjd"        
"$B>J>address@hidden@address@hidden@address@hidden@;@<@address@hidden)(B")
- ("tp" "$B:P:Y:address@hidden@address@hidden@address@hidden/ih(B")
- ("th" 
"$B037+:i<D=j>$>%>,>.>/><>?>B>C>F>K>P>R>S>dA:AAABAGAIAJALA]A_AcAgA{B}I%R#SbU?XG[`\f][]{^j_O_va4d,dTg[hvi+i?l!lsmvn:n[nyp<ppq[rCrM(B")
- ("thr"        "address@hidden/B0B3V$etkll^(B")
- ("ths"        "$B;AB9B;B=C'(B")
- ("thf"        "$BN(j+(B")
- ("thd"        "$B>>>address@hidden"(B")
- ("thkf"       "$B:~(B")
- ("tho"        "$B:?:U:~;&;/^/_S`tbl(B")
- ("thl"        "$B?h?jTj(B")
- ("tn" 
"$B<i<j<l<m<s<u<w<x<y<z<{<|<}=$=%=(=+=/=2=7=C=I?\?b?c?e?g?k?o?p?q?tA\AiB5C(C/D\JfLyM"N(address@hidden,^l^{_|`Yc.cOdXdoe5e7elf7f{g!g;h%h5hki.j-l(l3n.nHnsnxo5p$p+qrr$(B")
- ("tnr"        "$B=G=H=I=J=L=M=N=OPhUY`GfihChr(B")
- ("tns"        "$B=V=X=Y=[=\=]=^=_=b=c=d=f=gFkWNWv^-d#d$f|h&hsh|kNkYo>s((B")
- ("tnf"        "$B=Q=RN(WuX|[2(B")
- ("tnd"        "$B?r?shE(B")
- ("tnl"        "$BPfPg^C(B")
- ("tmf"        "$BI(`niMi|(B")
- ("tmq"        "$B<>=&=,=1_<jyp.(B")
- ("tmd"        "$B>!>#>5>:>g>h>jANFlGhP+QtR4[Fejj$o~(B")
- ("tl" 
"$B0;3A:|;&;H;O;S;T;\;k;m;n;x;{;~<(<,<E<F@'DsLpRQSASOS]UyU}W#W6WtYy`JfBg(gShahikkl5l9p{(B")
- ("tlr"        "$B6t<0<1>}>~?!?"?#?)?*B)Uf_omHq3(B")
- ("tls"        "$B:address@hidden"UbXFY;Zo_~iglYpur`(B")
- ("tlf"        "$B<:<<<=<BUi\Cj)(B")
- ("tla"        "$B;2?3?4?<?D?R?SRTWZ\;]n_)_Dh~o=(B")
- ("tlq"        "$B=&=:===BDTRARB_'_(a#cgdb(B")
- ("Tkd"        "$BAPRV(B")
- ("Tl" "$B;a(B")
- ("dk" 
"$B0!0"0$2d2e2f2g2j2k2m2n368f;yP3Q;S(U.U4V6[s`Ha^h0jKk(kCn{o<rms!s"(B")
- ("dkr"        "$B0!0-0.0/3Y3Z3\DWOLP3RxTAVVVjX(X3\[hUhVh`k`n?s-sys{(B")
- ("dks"        "$B0B0D0F0H4_4c4f4g4i8APtZg]Vpzr=rnro(B")
- ("dkf"        "$B060D1ZX~Y!]"address@hidden(B")
- ("dka"        "$B0C0E0G1^264`4b4dVIV^h?k^pws_sa(B")
- ("dkq"        "$B0(address@hidden(B")
- ("dkd"        "$B1{6D97Wi]J]vc?pYrs(B")
- ("do" "$B0%0&0'3336373eS1SNS`T<V=[#]7b-bJbYbvc(ghi=oup'pKpOq>(B")
- ("dor"        "$B1U3[LkLqY/YUf~mCoup'(B")
- ("dod"        "$BSm]/f"address@hidden(B")
- ("di" "$B<M<P<Y<c<fG8LiLjLkLlLmLnYh\?s,(B")
- ("dir"        "$B0s<c<eLsLtLvU>Ynd`h`hji;oPs4s~(B")
- ("did"        
"$B>\>m>n>w>y>zMHMLMMMNMSM[M\PSTaUPWyZ7ZfZx\k_!_G_laZagaxc:cUjwl*nVqh(B")
- ("dj" "$B1w5y5z5{8f8lS0S}S~^Kq,qGrNsw(B")
- ("djr"        "$B2/21225?M^\z(B")
- ("djs"        "address@hidden'PpUA_adN(B")
- ("djf"        "$B]"]1(B")
- ("dja"        "$B1b1f264`4d8387Q7RLSnV^Vx^;f,ofqd(B")
- ("djq"        "$B6H(B")
- ("dp" "$BWk]P(B")
- ("du" "$BFrG!M=M>address@hidden'i1ikl%q1(B")
- ("dur"        "$B0W0h1V1X5U<MKrLrLuXdehinl#o`ogp?qcrH(B")
- ("dus"        
"$B0v1c1d1h1i1l1m1o1t8&8'<!A3FPFpG3J%RdSkU+U/WzYPYa\=])^'^2^7^=_]d'gCh/address@hidden'(B")
- ("duf"        "address@hidden(B")
- ("dua"        "address@hidden(B")
- ("duq"        "$B1^MUSq[!pT(B")
- ("dud"        
"$B1D1E1F1G1I1J1K1M1N1O1P1Q1S7J7^RiS[TJU$U%Zu\3\F^s_J`r`}`~ewj>lWn;pD(B")
- ("dP" 
"$B0e1C1H1L1T4"7X7];y<address@hidden)P.PdQ;Q<St[*]u`IbKbOcRfJghi"i#i:iRjcl%l?p?rIsL(B")
- ("dh" 
"$B0-1(1*1w1x1|2(8^8`8a8b8c8d8g8h8mP~S*SKSSTITTT|U<UhWXX(XeZDZm_4_r_z`3`iiej(n+o2rbsg(B")
- ("dhr"        "$B0$206L9vM`(B")
- ("dhs"        "$B292:X2aicSi%i>jrr[r\(B")
- ("dhf"        "$BQ:\Eg,(B")
- ("dhd"        "$B2'MJTYW+a%a1a~c<hcp6s0(B")
- ("dhk"        "$B0#122i3?4$7&RwSyc]hbiwkBkw(B")
- ("dhks"       "$B08404K4P4X4a4e4hOPOROSU6^1_5iol2op(B")
- ("dhkf"       "$B[)(B")
- ("dhkd"       "$B1}2"2&9DUwWH[>]j(B")
- ("dho"        "$B0#3?OARwbdiw(B")
- ("dhl"        "$B0Z307(VLV[`Pbvi'r>(B")
- ("dy" 
"$B1z3Z6F9x>qD8F+LsMEMIMKMRMTMWMXMZQ'TpU-UKULVRVvWTWUY9YjYz\[\v]H_$`"`vcXc_eeh}j4kon-n3qAs8t!t#t$(B")
- ("dyr"        "$B?+C+M]M_MaV;^ieUhljs(B")
- ("dyd"        "$B23B{M&M/M0MCMFMGMOMPMQMVMYP\XJXY\Wa5f`gNill}o0ps(B")
- ("dn" 
"$B0r1&1'1)1*1+2$2%5m6h6r6s6v6w6x6y?uKtL`M$M%M'M+M4M9P2P}R^R_VJ\d]?]XaOb3c;c<d~foi9kpsIsz(B")
- ("dnr"        "$B000jR(TT_4_z(B")
- ("dns"        "$B0w1$1>address@hidden"fQp(pq(B")
- ("dnf"        "$B080S1516]5_q(B")
- ("dnd"        "$B7'M:(B")
- ("dnjs"       "address@hidden;I2QMT$T(U6UcXE^S`)gkiojOkdmWn|ovp((B")
- ("dnjf"       "$B1[7nXz[)denh(B")
- ("dnl"        
"$B010L0N0O0Q0R0S0V0Y0^0_0`0b0c161R4m56OAQ&address@hidden<ivjLm{pjr2(B")
- ("db" 
"$B0T0]0d:y<address@hidden(KnL{L|L}L~M!M"M#M(M)M*M-M.M1M2M3M5M6M7MDPRQASHS|address@hidden"address@hidden|n'nXo+pds[sl(B")
- ("dbr"        "$B0i4!FyS|]Zdx(B")
- ("dbs"        "$B0t0}1<=aUzlVnJ(B")
- ("dbf"        "$Bffrr(B")
- ("dbd"        "$B=?M;e0(B")
- ("dms"        "address@hidden;p,su(B")
- ("dmf"        "$B255?(B")
- ("dma"        "$B0{0|0~1"2;address@hidden;pF(B")
- ("dmq"        "$B5cM,M8X%(B")
- ("dmd"        "address@hidden(B")
- ("dml"        
"$B0M0U0X0a365#57595<5?5A5B5C5DODPaV=VTVXXt]:_q`Hbcc&ePg_nPq>(B")
- ("dl" 
"$B0;0J0K0P0W0[0\1B;\<$<)<*<X?)BBBfCPFRFsFvP1U)UuVaW3W4W^^&`ba-aXfggokHlFlHlIm_mnp0(B")
- ("dlr"        "$B1WMbMcVXW5[;fDkjs2(B")
- ("dls"        "$B0u0v0x0y0z1l?M?N?O?YFRG&G'address@hidden;iNpW(B")
- ("dlf"        "$B0l0m0n0oF|P!PETejRn_o-(B")
- ("dla"        "$B1A?QDBG$G%L-U,WljSjT(B")
- ("dlq"        "$B9~F{F~R]T)rl(B")
- ("dld"        "$B>jP;QtUT(B")
- ("wk" 
"$B040q:4:8:::^:n;F;I;P;Q;R;Z;g;p;q;s;z;|<"<'<+<Q<address@hidden@QDSI&PwQ}RoR~UZWs^h_Ua*aSbDbEdggsh$hti4i5k9lGlZl`r8s:sn(B")
- ("wkr"        "$B:n:r<[<]<^<_<`?]?}SpU"UeZQ[P_Zd+e?ginLs'(B")
- ("wks"        "$B;7;DV#X}\"]L_%b7(B")
- ("wka"        "$B;=;address@hidden>dQjDlQo4(B")
- ("wkq"        "$B;(AYA^C}SrYgd4p7p8(B")
- ("wkd"        
"$B>">)>->1>8>@>O>Q>U>_>c>f>l>s>uATAqArAuB!B"D"D%D2D9F5P?TGTVTcTyT}U#UrVQW2\u\~^J^y`-`/`R`xaog6gGgIg`h7hIi,i6jfl[l\o6rc(B")
- ("wo" "$B:F:H:K:M:R:X:[:\:_:`:b<address@hidden(B")
- ("wod"        "$BA9AdAhAyVDVl`'bUd7d8kZo#(B")
- ("wj" 
"$B093n5O<Q=m=s=t={=|A;address@hidden:]|_L`2aTbicle*f8fTgsiWk:kIl7m0p3sr(B")
- ("wjr"        
"$B2.<Z<address@hidden@address@hidden@address@hidden@XB1C`CdD$D_E&E(E)E*E+E,E-LvR*W/_U`?a{c!d{gii4k6mlmqmx(B")
- ("wjs"        
"$B<address@hidden@address@hidden@address@hidden'A,A0A4B7C.DQE5E6E8E;E>E?EAEBECEDEEG{H*KjMdQ#QrR4RdSsT{UsV\W%X"X}Y%ZBZS]a^!_E`0a/aYaub!c"d%d5d?euf?fHg"lcm7mYm[nonto"oCp4pSp|q4qBs6s7t"(B")
- ("wjf"        
"address@hidden@address@hidden@address@hidden@dCbLERERGRzY#ZqZr^6cffOlkmE(B")
- ("wja"        "$B0>@address@hidden(B")
- ("wjq"        "address@hidden&\7\D]~^XfcrW(B")
- ("wjd"        
"$B0f;*>=>Z>`>p>t>{@,@/@address@hidden@:@EBGCzD.D:DbDdDeDgDhDjDmDnDrDuDvDwDxDzD{E"E#E$FTKoLwMdP'RZVlY]ZW[l^F^[a6aKbMcWf^hGj:mwn&nDnKoFp=pP(B")
- ("wp" 
"$B1-:O:Q:W:]:^=t=|@)@address@hidden@^BhBiBjDiDkDoDpDsDtD}P_Q1Q}Z+Zq_;bDbEbIgAi5lZm3pIpmpnsn(B")
- ("wh" 
"$B3v7+:x;4<D=u><>H>[>rA;A<ADAEAFAHAKA`AaAbAeAfAgAlAtAxB$BdC{C|D$D&D+D,D/D4D7D8D;DUD^D_D`FXGBH%POPYS^SdWIXNXTXjY2Y4Zj[j[t\'\*_6`,bic/cGcZc^cud|e6f-fTfrg]iskGkPl!ldm/oXp:qt(B")
- ("whr"        "$BB-B2dHhwo7(B")
- ("whs"        "$BB:YO(B")
- ("whf"        "address@hidden@`L(B")
- ("whd"        "$B<o<p=!=*=>=D>a>bAnI"P:WOXQ\#\$\b^JdpeTj*l{m'm)oG(B")
- ("whk"        "$B:4:8:A:B:C(B")
- ("whl"        "$B:a(B")
- ("wy" "$Bn[(B")
- ("wn" 
"$B3t:n<g<k<n<r<v<~=#='=.=5=;=K?_AUAvB-B2ChCkClCmCpCqCrCsD4D]I*L+P&PMPvQ2QISUW$ZlaFaGcGdVdZe!eBfthwiakOlam4mTn$oIsG(B")
- ("wnr"        "$B4!C]dx(B")
- ("wns"        "$B1==S=T=W=Y=`=c=eFVH;KpQ.RETSWvX"X6^4_=b/jAm-mu(B")
- ("wnd"        "$B=0=ECfCg(B")
- ("wmr"        "$BB(B1(B")
- ("wmf"        "$B6{(B")
- ("wma"        "$BWc(B")
- ("wmq"        "$B=4=AIxM,\7eI(B")
- ("wmd"        "$B3(9y>I>Z>xA9A=A>A}A~B#D'YN\t__kz(B")
- ("wl" 
"$B4t5@;V;X;Y;];^;_;c;f;h;i;j;o;}<1<A<G?%B~CNCOCRCSCXCYDRDlDqEVG7S!T.TMVcW7Yu[L]ma\c-fMfsgSk:lDlSlflym5mIn/owr?s9(B")
- ("wlr"        "$B?%?&D>SDcFcM(B")
- ("wls"        
"$B?0?6?8?:?>???A?G?J?L?P?T?XC$DADCDDDEE6FxKyPVSQZi]I_~`_a+a;b8bCbSeVgKhmjWlcmGo/(B")
- ("wlf"        "$B<8<;<@<ACaCbE3IHLEPERzSDT9Ve[_fOg4g5lDlkmE(B")
- ("wla"        "$BD?ZPnErq(B")
- ("wlq"        "$B<9=4=8=AeI(B")
- ("wld"        "address@hidden'D(_-(B")
- ("ck" "$B3n:!:5:7:9:<<V<W<ZOMPNSMV+VMY-Ym[3\Lbxd4gsm"n`(B")
- ("ckr"        "$B:q:u:address@hidden'eSm0oXsqsx(B")
- ("cks"        "$B;8;<;>;?;address@hidden&cbdlesl-lUo4oSoTqB(B")
- ("ckf"        "$B;!;";$;%QkY)`\e'(B")
- ("cka"        "$B;2;4;BA2Q(Q)RTTOVPVZXNXOXPXrXs\ackk{k|l)l+q](B")
- ("ckd"        
"$B>'>+>3>4>;>T?zAOARAdAkAsD*D1H+PiQlRRX0XHYoZHZd^E^k^}`KalcYgZm#r.(B")
- ("co" "$B:9:D:L:N:S:V:W:Z<address@hidden(B")
- ("cor"        "$B:p:t:u:v:address@hidden<QFSTY>[Pbyd)dG(B")
- ("cj" "$B:J=h@(address@hidden(B")
- ("cjr"        
"$B;I<address@hidden@address@hidden@TD=QqRhWFZ3^~akinljm$m(m6p"s5(B")
- ("cjs"        
"$B0+6N6z6|;address@hidden@address@hidden@address@hidden@|A$A&A(A)A+C)E7PBPjQdSCV_Z#[a\9^I^Y_Ea$chh(lMlxoqotph(B")
- ("cjf"        "$BDVE/E0E1E2E4FLFmS5V%YZmPnno$oDoEq8(B")
- ("cja"        "address@hidden:E<Q!W[Ww\a\y]~b]dSdUd^d_j9k-k[k~(B")
- ("cjq"        "$B>*>9>vC}D!D-D5E=aHaIaJbLjymLmM(B")
- ("cjd"        "$B;*;,@address@hidden@address@hidden,W-fehGiq(B")
- ("cp" "address@hidden|D~FeFmSFSiSjYZ\<^8^|bIbfh\hxjim<m=n*pLqsqv(B")
- ("ch" 
"$B7-=i>%>6>7>A>G>K>L>S>V>d?]A?ACApD6D8ICQvR#R+V%V9X!X7X^[B\%^W_VcDggkWl:mknLndqzs<ss(B")
- ("chr"        "$B<q>|?$?(?tB%B0SvV$ZKb`badHifk=m1o7qq(B")
- ("chs"        "address@hidden<WVn7(B")
- ("chd"        "$B=>=FAQAZAmAoC~DMF4G,N5N6P:PxR2WOWdX;eAeTfb(B")
- ("chl"        "$B:E:GVCYt\c^/(B")
- ("cn" 
"$B0,1/3b<h<q="=%=)=-=6=9=P?[?d?m?n?u?v?wAFC\CjDFDGDHDIDJGkOISBU7U9VdX/YXYY\6\d^Wa,address@hidden(B")
- ("cnr"        "$B1/<3<4=3=K=LC[C\C^C_C`M.\egXm&(B")
- ("cns"        "$B=UDXrV(B")
- ("cnf"        "$B=P[2sY(B")
- ("cnd"        "$B2-=<=F>WCiCnCoMCQU`>g^j5(B")
- ("cnp"        "$BX,X-X8aahDlT(B")
- ("cnl"        "$B<h<q="address@hidden(B")
- ("cmr"        "$BB&B'B,D=P<X<Z`(B")
- ("cms"        "$Bsp(B")
- ("cma"        "$Boo(B")
- ("cmd"        "$BA=A>AX(B")
- ("cl" 
"$B:7:9;u<#<&>}?"?%CMCQCTCUCVCWCZD'D>FePLRHRNSPTiV5VbVpVz[i_ua7a?awbtcPcze#e>eLfWiPjul8lemOo!p5r5rKrvrwscso(B")
- ("clr"        "$BB'B,D<R,RNVzX<ZE(B")
- ("cls"        "$B?Fk%sp(B")
- ("clf"        "$B<7<?(B")
- ("cla"        "$B5N?/?2?;address@hidden;o*o,ooqT(B")
- ("clq"        "$Bj/(B")
- ("cld"        "$B>NGicJjYqU(B")
- ("cho"        "$B2wTo`V(B")
- ("xk" "$B<XB>BBBCBDBEBFBGBHBIBJBKBLBMCSOMPIS#TXU`YYYe[4\s]}g!m>qLrx(B")
- ("xkr"        "$BBnBoBqBsBtBuBvBwBxByE'EYPkS6Y>[Q_7ner0(B")
- ("xks"        "$BBMC2C3C7C:C>CBCFF]FgW<X_Z:]QjX(B")
- ("xkf"        "$BC%C&(B")
- ("xka"        "$BC5C?b>lE(B")
- ("xkq"        "$BEcEkYr\PpaperW(B")
- ("xkd"        "$BEfErE|F"Vfb;j#(B")
- ("xo" "address@hidden@BABUBVBYB[B]BaBfBgG=KXLaQ<\(cze)ihkHq&qM(B")
- ("xor"        "$BBpBrBtZ$_7(B")
- ("xh" "$BEFEGEQEZEeF$Q=h9(B")
- ("xhs"        "$Bjt(B")
- ("xhd"        "$B23DKDLE{E}HuWxXV(B")
- ("xhl"        "$B?dBOB\B`DHDIDJFXjtpx(B")
- ("xn" "$BEJEjF)F.L{Pye5o+qmr,(B")
- ("xmr"        "$BB_FCXW(B")
- ("vk" "$B?|GCGDGEGGGHGIGJGKGLGNHmHvT3WfZ4[1`(``bncvfRg8hJh]jZllox(B")
- ("vks"        "$B:d:eH=HDHGHNR!]ra"ng(B")
- ("vkf"        "$B;+H,R\[5n\(B")
- ("vo" "$B143-GIGTGWGXG\GbH4HmI#PPUVX#Y6ZT[1]o`cp>(B")
- ("vod"        "$BC*K#K5KDW:WEZU_0b|e^(B")
- ("vir"        "$BX?(B")
- ("vus"        "$BJ?JPJRJSJTJWJXJ\Y(fIgyi~jokfqY(B")
- ("vua"        "$BlJ(B")
- ("vud"        "$BDZI>IMJ?Wh^$bogyhLr9(B")
- ("vP" "$B3AGQGYJ>address@hidden&ZIZMasi0qo(B")
- ("vh" 
"$B1:3s3wGxGzI[I]IrJ^J_J`JaJqJyJzK"K$K&K+K0K=R1R5R7RvS.T5YF[T_F_\aWb.f}gTgzj\jqmynppRq0q}r:rDsR(B")
- ("vhr"        "$BGxGzI}K=_F(B")
- ("vy" "$B<]I6I7I8I:I;I<I=I?QwUEXX]Ke]q(q)q*q_qjqurd(B")
- ("vns"        "$BJ,(B")
- ("vna"        "$BIJcHcI(B")
- ("vnd"        "$BIvIwK-afkel4q$qH(B")
- ("vb" "$BI7(B")
- ("vl" "$BH`HdHhHiHmHoHrllmdox(B")
- ("vlf"        "$B2^HfHgI$I%I+I,I-I.J'J)PGYDdJkvm+s+(B")
- ("vlq"        "$BI/I}K3^"(B")
- ("gk" "$B2<2?2F2O2Y2\2b2l3E<6ROR`V|^Q`leKf!kEl.n"o(rQ(B")
- ("gkr"        "$B2)3X5TDaT[U\U]^A`Bajkbl;s?(B")
- ("gks"        "$B4(address@hidden:(UFUGW{Y*YRZ][e_K`Cb*f'n8qSqlsm(B")
- ("gkf"        "$B323d3e3mR$bRiys\(B")
- ("gka"        "$B4O4Y4^H!MtQbRyS2S?VH]#^>eHh1n8nro|pwq2rRsD(B")
- ("gkq"        "$B389^9gH:RnR}^eb4b5b6hdonr{(B")
- ("gkd"        "$B7e9+91939:9A9R9T9_9`FzP6PDRbWqe}fjobprr*(B")
- ("go" "$B0g2r3#3$3*3/31323:3<:zPsT6TnTxUXW(Xh\4i&j7k;k_n0nOqO(B")
- ("gor"        "$B3/3Kbkk*mJ(B")
- ("god"        "$B0I8v9,9Te.jbr}(B")
- ("gid"        "$B5}6?6A6B8~9aSlq.(B")
- ("gj" "$B135u5vTR[[]A^w(B")
- ("gjs"        "$B7{8%8.YW`[(B")
- ("gjf"        "$B]<iyj8(B")
- ("gja"        "$B8183VUp*qd(B")
- ("gur"        "$B3E3R3W7CTu^)r+(B")
- ("gus"        "$B0<7|8)8+8-82898<8=8>8?9`JGPWRl^-aRbAeQidjJnkp}(B")
- ("guf"        "$B7j7l>iJGLRUSk#pv(B")
- ("gua"        "$B7y(B")
- ("guq"        "$B0A3p6"6(6.64696<KKOFTsV7XDYQ^5`Ed)d:h2nwo}p!(B")
- ("gud"        "$B3>5|7:7;7?7A7U7V7e9UTk_W_X`rfzj%mj(B")
- ("gP" "$B7E7RQBR>TxWBX*b=c4l~nQp^(B")
- ("gh" 
"address@hidden:c;)<JD[QTTdW`Y&Z_Zn\5]]]l^v^w`7`ha!b(b+hYhfiHiKizn=o.q7(B")
- ("ghr"        "$B0?9s9tOGUeZO(B")
- ("ghs"        "$B:':*:+:.:2[~\!^U^g_c`m(B")
- ("ghf"        "$B3K9z9{]Gcts3(B")
- ("ghq"        "$B3f(B")
- ("ghd"        "$B909?9H9cR|]g]wkAobr*(B")
- ("ghk"        "$B2=2P2R2S2V2Z2_2h3q3r7$CtOBOCS;V<aAdqo&(B")
- ("ghkr"       "$B3H3M3N3OZ2Z<ayb_j?p9(B")
- ("ghks"       
"$B4-45494<4?4D4T4]88OKT(TvUaUnXu]D^R^S_eb*bAbbl,l6oBqir%r](B")
- ("ghkf"       "$B1[3h3j;#`Qbwi]l/ohoi(B")
- ("ghkd"       "$B2+677;92989D9SKZQWQ`WSWrX5Zh^T^f_jd;dPfki{n#p&rS(B")
- ("gho"        "$B2h7S`VaA(B")
- ("ghl"        
"$B2q2s2u2v2y2z2{3"3%=ZI0OEPrQER;TUWKXg[X\G^Neig:h"i'i\kKkRmorf(B")
- ("ghlr"       "$B2h3D3MaA(B")
- ("ghld"       "$B2#909U9li*mDo)sT(B")
- ("gy" "$B6G8s8z9;9Z:hP{S,SeSoZCZ|[f^B_^`+qaqb(B")
- ("gn" "$B0r5`8e8t8u8|9!9"PHRcSLSR^A_h`Md<kMmp(B")
- ("gns"        "$B7.7071FkR._m_nhXnU(B")
- ("gnd"        "$Bi*(B")
- ("gnjs"       "$B3~7vCHX:address@hidden,(B")
- ("gnp"        "$BCnRCS<TL_{(B")
- ("gnl"        "$B4x5+51WCY&Zv]`ka(B")
- ("gb" "$B5Y7H7MC\Z8_^iLl<(B")
- ("gbr"        "$BC\(B")
- ("gbf"        "$BWukys;(B")
- ("gbd"        "$B6$6'6;R3Wo^((B")
- ("gmr"        "$B9un^(B")
- ("gms"        "$B6U:/WLWWYWnW(B")
- ("gmf"        "$B5%5IKxV(k?(B")
- ("gma"        "$B6V7g(B")
- ("gmq"        "address@hidden(B")
- ("gmd"        "$B6=Fz(B")
- ("gml"        "$B4n4r4u5)5:5>I1Q%RzS)S`XAXZY&Zk[']8_f_g_t`!`:c6f<nZrF(B")
- ("glf"        "$B5Merk#pvs\(B")
- ("unknown"    
"$B4#<5DNFJFdFuJ=KsL]QeRIRpS&S9SuS{T*T+T8T:T>TBTCTKTNTQTWT\T_UNU~V&V,V-V.V/V0V2V4V8VNW;WjWnWpY0YKY^Z1Zs[=[b[n\)\-\.\/\0\1\O\S\j\n\o\p\q\x]&]6]B]i^<^L^c_&_1`<a:a<a>b<bBbXbmbpbsc%c5cNcdc}d&d1d=dIdLdYdddfdhdte9eaebemenevf$g3g\h4h6hHhMhWhhiFi[ibj,jQj^jmk\lCmZmhmimzn%n}o'oZo]p#p-pXp]p`q;qIqRr;address@hidden(B"))
+ ("rk" "榎仮伽価佳加可嘉嫁家暇架歌珂稼苛茄迦駕街袈个假價呵哥枷柯珈痂笳舸葭訶謌賈跏軻")
+ ("rkr"        "各格殻覚角較閣却脚刻塙卻咯埆恪愨擱桷殼狢覺貉鬥")
+ ("rks"        "斡乾侃刊姦干幹澗看竿簡肝間墾懇艮菅奸慳揀杆柬栞桿狠癇稈繝艱諫鶫齦")
+ ("rkf"        "介喝渇葛褐掲丐曷碣竭羯蝎鞨頡")
+ ("rka"        "勘堪感憾敢柑甘監鑑欠鹸減紺凵坎坩嵌戡撼橄歉淦疳瞰緘蚶轗酣鑒龕")
+ ("rkq"        "押蓋甲合岬匣盖胛閘")
+ ("rkd"        "岡橿強彊慶康控江糠綱腔講鋼降剛虹亢僵啌姜崗慷扛杠棡疆矼絳繦羌薑襁跫鱇")
+ ("ro" "佳箇介解改皆芥開階凱咳慨概蓋鎧個丐个价剴愾懈揩楷漑疥盖觧")
+ ("ror"        "客喀")
+ ("rod"        "坑更粳羹羮鏗")
+ ("ri" "茄")
+ ("rir"        "醵")
+ ("rj" "去居巨拒拠渠距鋸車据裾俥倨墟據擧舉欅炬秬筥苣踞遽醵鉅")
+ ("rjs"        "乾巾件健建鍵愆搴腱虔謇蹇騫")
+ ("rjf"        "渇掲傑乞担桝偈杰桀气竭")
+ ("rja"        "柑倹剣検鹸儉劍劔劒剱檢瞼臉黔")
+ ("rjq"        "笈怯劫拾刧")
+ ("rp" "憩掲偈憇碣")
+ ("rur"        "仮格隔革撃激假挌檄膈茖覡闃骼鬲鴃鵙")
+ ("rus"        "樫鰹堅牽犬絹肩見遣縛繭鑓俔幵悁枅狷甄筧羂譴鵑")
+ ("ruf"        "桔契決潔結訣孟决抉拮挈缺髻")
+ ("rua"        "鎌兼謙慊拑歉箝蒹鉗")
+ ("ruq"        "恰頬慊鋏")
+ ("rud"        "京競卿境鏡驚傾径慶敬景経茎荊警軽頚鯨庚更梗硬耕頃亰竸冂冏剄勁勍哽徑憬檠煢瓊畊痙磬絅經綮耿脛莖謦輕逕竟頸黥")
+ ("rP" "戒械界階季係啓契桂渓稽系継繋計鶏堺届屆彑悸枅溪畍癸禊笄綮繼薊誡谿髻鷄")
+ ("rh" "苦古固姑孤庫故枯袴股菰鈷雇顧鼓稿考膏高拷告皐縞尻叩藁估凅刳呱攷敲杲柧桍栲槁槹沽痼皋睾瞽稾箍罟羔胯蛄蠱觚詁誥賈辜錮靠鴣鵁皷")
+ ("rhr"        "曲告穀酷鵠谷硲哭斛梏槲轂髷")
+ ("rhs"        "困坤昆梱混壼崑悃棍滾菎褌鯀鯤鶤")
+ ("rhf"        "滑骨榾汨鶻")
+ ("rhd"        "供共恐恭空公功孔工控攻貢倥廾拱椌槓箜蚣蛩蛬跫鞏")
+ ("rhk"        "瓜寡科果菓課過袴誇跨鍋堝夥夸戈胯萪蝌裹踝顆")
+ ("rhkr"       "廓郭擴攫椁槨癨矍钁霍")
+ ("rhks"       "冠官寛慣棺款潅管莞観貫関館舘串菅丱冦毋灌盥綸綰罐觀鑵關鸛")
+ ("rhkf"       "括活筈桧刮檜聒")
+ ("rhkd"       "拡匡狂光広鉱砿壙廣擴曠昿框洸礦筐筺絋絖胱誑鑛")
+ ("rho"        "掛卦罫咼戈挂枴褂")
+ ("rhl"        "会塊壊怪恢拐魁乖傀壞恠愧槐瑰詼")
+ ("rhlr"       "膕馘")
+ ("rhld"       "宏紘肱轟浤軣鍠")
+ ("ry" "撹覚較噛糾僑叫喬教橋矯蕎交佼孝巧校絞郊酵鮫招咬嬌攪敲橇澆狡皎磽窖翹膠蛟轎釖餃驕驍")
+ ("rn" 
"臼厩欧殴鴎鈎亀丘久仇救求灸球究旧拒九倶句区狗玖矩躯駆駈駒具粂勾口垢拘構溝購叩韮鳩釦傴冓劬區咎嘔媾嫗寇嶇廐廏怐惧懼扣搆柩枸歐毆毬甌疚瞿窶篝舅舊苟蒟蚯衢裘覯詬謳逑遘邱鉤韭颶馗驅鬮齲龜")
+ ("rnr"        "掬菊鞠局麹国囗國椈鬻鞫跼")
+ ("rns"        "君群軍郡桾皸皹窘羣裙")
+ ("rnf"        "屈掘窟堀倔厥崛")
+ ("rnd"        "宮弓窮穹躬")
+ ("rnjs"       "勧巻挙倦券圏拳捲権劵勸卷圈惓椦權眷綣蜷顴")
+ ("rnjf"       "掘蕨亅厥獗蹶闕")
+ ("rnp"        "机帰軌凧潰几匱椢櫃歸皈簣臾詭跪蹶餽饋")
+ ("rnl"        "帰貴鬼亀喟椢歸皈龜")
+ ("rnlr"       "掴幗")
+ ("rb" "葵窺規糾叫九圭珪頃槻奎揆摎樛癸硅竅糺繆袿赳逵閨馗鬮")
+ ("rbs"        "亀均菌箘鈞麕龜")
+ ("rbf"        "橘")
+ ("rmr"        "可革極劇戟隙克亟剋尅屐棘蕀郤")
+ ("rms"        "僅勤巾斤筋芹謹近根懃槿瑾矜菫覲釿饉")
+ ("rmf"        "契訖")
+ ("rma"        "錦琴禁禽衿襟金檎今噤擒衾黔")
+ ("rmq"        "扱及急汲笈級給岌")
+ ("rmd"        "恒肯亙亘兢恆矜")
+ ("rl" 
"磯企伎器基奇寄岐幾忌旗既期棋棄機気汽畿祈紀記起飢騎妓技欺祇居祁己碁乞崎埼碕示其肌鰭箕亟俟冀剞嗜噐圻竒嵜弃掎旡曁朞杞枳棊榿气氣沂淇畸祺稘綺羈羇耆覊覬譏豈跂饑騏驥鮨麒")
+ ("rlr"        "喫")
+ ("rls"        "緊")
+ ("rlf"        "吉桔詰佶拮")
+ ("rla"        "金")
+ ("Rlr"        "喫")
+ ("sk" "奈那難儺娜懦扨拏拿梛糯")
+ ("skr"        "諾")
+ ("sks"        "暖難攤煖赧")
+ ("skf"        "捺捏涅")
+ ("ska"        "男南楠喃娚遖")
+ ("skq"        "納衲")
+ ("skd"        "嚢娘曩")
+ ("so" "耐奈内匂乃廼能迺")
+ ("sid"        "嬢孃")
+ ("su" "女拏拿茹")
+ ("sus"        "年撚碾輾")
+ ("suf"        "捏涅")
+ ("sua"        "念恬拈棯")
+ ("suq"        "摂捻攝躡鑷")
+ ("sud"        "寧嚀濘獰聹")
+ ("sP" "禰昵")
+ ("sh" "努奴怒脳呶孥帑弩瑙碯腦臑駑")
+ ("shd"        "濃膿農儂")
+ ("shk"        "雫")
+ ("shl"        "悩脳惱腦餒")
+ ("sy" "溺尿嫋撓橈鐃閙鬧")
+ ("sn" "耨")
+ ("sns"        "嫩")
+ ("snf"        "吶肭訥")
+ ("sb" "紐忸狃鈕")
+ ("sbr"        "忸衄衂")
+ ("smd"        "能")
+ ("sl" "泥尼禰祢怩濔瀰膩")
+ ("slr"        "溺匿")
+ ("slf"        "尼怩昵")
+ ("sla"        "賃恁")
+ ("ek" "多大茶夛")
+ ("eks"        "円但丹単担旦短端箪胆蛋鍛団壇断檀段椴敦亶單團彖愽慱斷槫湍猯疸緞葮蜑袒襌褝鄲鶉")
+ ("ekf"        "達咄妲怛撻燵獺逹闥靼韃")
+ ("eka"        "担淡湛耽談曇啖啗壜憺擔毯潭澹痰眈膽蕁覃譚餤")
+ ("ekq"        "沓搭答踏剳荅")
+ ("ekd"        "党唐塘当糖堂撞儻幢档棠溏當瞠礑螳蟷襠鐺黨")
+ ("eo" "碓対岱帯待戴袋貸隊黛代大敦垈對帶擡抬玳臺薹鐓隶")
+ ("ejr"        "徳悳")
+ ("eh" "稲図挑跳堵塗屠徒渡菟賭途都鍍度倒刀島嶋悼桃梼盗淘涛祷到逃陶導萄道叨圖嶌掏掉搗擣朷檮棹櫂盜濤滔睹稻絛綢綯纛荼莵覩跿蹈迯闍韜饕")
+ ("ehr"        "竺涜督禿篤毒独読牘犢獨纛讀髑黷")
+ ("ehs"        "純噸惇敦沌豚遁頓暾燉瓲遯飩")
+ ("ehf"        "突頓咄柮")
+ ("ehd"        "諌桐冬凍東棟董働動同憧洞瞳童胴銅僮橦潼疼粡艟苳鮗鶇鼕")
+ ("en" "吋兜逗斗杜土痘豆頭読亠抖竇肚荳蚪蠹蠧讀酘鬥")
+ ("ens"        "屯遁頓鈍臀遯")
+ ("emr"        "得")
+ ("emd"        "登灯燈等藤謄鐙騰嶝橙滕疼磴籐籘縢")
+ ("fk" "刺羅螺裸喇懶瘰癩蘿邏鑼陏騾")
+ ("fkr"        "格楽洛絡落酪咯樂烙犖珞駱")
+ ("fks"        "乱卵欄蘭亂嬾欒瀾燗爛襴鑾闌鸞")
+ ("fkf"        "剌喇埒埓糲辣")
+ ("fka"        "嵐濫藍覧儖婪攬欖籃繿纜襤覽醂")
+ ("fkq"        "摺蝋拉柆臘臈鑞")
+ ("fkd"        "滝瀧廊朗榔浪狼郎朖琅瑯莨螂跟踉")
+ ("fo" "來徠")
+ ("fod"        "冷")
+ ("fir"        "掠略擽畧")
+ ("fid"        "椋掠亮両梁涼糧良諒量倆兩凉喨粱粮裲跟踉輛輌魎")
+ ("fu" "芦蛎砺麿侶慮旅励麗呂録儷勵唳廬梠櫚犂犁癘礪糲絽綟膂臚茘藜蘆蠣蠡鑢閭驢驪")
+ ("fur"        "力暦歴屶朸櫟檪櫪瀝癧礫轢轣靂鬲")
+ ("fus"        "怜零恋憐漣煉練聯蓮連錬嗹戀揀攣楝聨臠輦鏈鰊")
+ ("fuf"        "列劣烈裂冽捩洌")
+ ("fua"        "鎌廉簾匳奩斂濂瀲")
+ ("fuq"        "猟獵鬣")
+ ("fud"        "領令伶嶺怜玲苓鈴零霊齢囹櫺澪羚聆蛉靈鴒齡")
+ ("fP" "豊例礼隷禮茘醴隸鱧")
+ ("fh" "芦鷺櫨蕗虜魯櫓炉賂路露労牢老勞咾撈枦滷潦濾瀘爐癆盧艪艫舮蘆輅轤鑪鈩顱驢鱸鹵")
+ ("fhr"        "角漉鹿谷緑麓禄録梺碌祿轆")
+ ("fhs"        "論淪")
+ ("fhd"        "滝瀧竜龍弄篭聾哢垰壟朧槞瓏籠蘢隴")
+ ("fhl"        "瀬頼雷塁賂儡壘擂櫑癩磊籟罍耒蕾藾誄賚")
+ ("fy" "了僚寮料療瞭遼寥廖撩暸燎繚聊蓼醪鐐鷯")
+ ("fyd"        "竜龍蘢")
+ ("fn" "屡涙累婁楼漏僂樓犂犁瘻簍縷縲螻褸鏤陋髏")
+ ("fnl"        "涙泪")
+ ("fb" "謬柳劉流溜琉留硫瑠塁累類勠嚠壘廖旒榴泪瀏璢瘤繆縲茆鉚鏐霤餾")
+ ("fbr"        "陸六勠戮蓼")
+ ("fbs"        "倫輪論侖崙崘棆淪綸")
+ ("fbf"        "栗律率葎慄篥")
+ ("fbd"        "隆嶐窿")
+ ("fmr"        "肋仂勒")
+ ("fma"        "凛廩懍菻")
+ ("fmd"        "綾菱睦凌稜陵崚楞蔆薐")
+ ("fl" "浬鯉糎狸提哩利吏履李梨理璃痢裏裡里離厘麗俚俐悧罹漓犂犁竰籬羸莅莉蜊蠡詈貍釐驪魑鯏黐")
+ ("fls"        "燐隣鱗麟吝悋藺躙躪鄰")
+ ("fla"        "林淋琳臨痳霖")
+ ("flq"        "笠立粒苙")
+ ("ak" "罵馬摩磨魔麻嘛媽麼瑪痲碼蟇蟆")
+ ("akr"        "漠莫貌幕膜摸寞藐")
+ ("aks"        "鰻挽晩蛮娩万慢満漫蔓湾卍曼巒幔彎弯懣滿灣瞞縵萬蠻謾蹣輓鏝饅鬘")
+ ("akf"        "抹末沫眛秣茉襪靺韈")
+ ("akd"        "亡忘忙望妄網惘网罔芒茫莽蠎蟒鋩魍")
+ ("ao" "罵媒梅楳煤買売呆某埋妹昧枚毎魅寐瑁苺莓賣邁霾")
+ ("aor"        "莫麦百脈獏脉貊貘陌驀麥")
+ ("aod"        "虻萌盟猛盲儚氓甍萠黽")
+ ("aur"        "冖冪幎汨羃覓")
+ ("aus"        "勉眠免棉綿緬面麺俛冕宀湎眄瞑緜麪")
+ ("auf"        "蔑滅")
+ ("aud"        "皿冥名命明銘鳴暝榠溟瞑茗螟酩黽")
+ ("aP" "袂")
+ ("ah" "姥牡茅莫侮募墓慕暮母帽某冒謀貌鉾膜粍牟矛摸模毛耗姆旄獏瑁瓱皃眸竓糢耄冐莽謨髦鴾")
+ ("ahr"        "匹牧穆木目凩朷沐繆苜鶩")
+ ("ahf"        "没勿歿沒")
+ ("ahd"        "夢蒙冢梦曚朦檬濛矇艨")
+ ("ay" "卯畝猫廟描秒苗錨墓妙杳昴渺眇緲茆藐")
+ ("an" "畝謬撫武舞蕪戊母亡某謀貿務無牟矛霧鵡茂姆巫廡憮懋拇无楙眸繆莽袤誣")
+ ("anr"        "冒墨万黙默冐")
+ ("ans"        "蚊吻文聞娩免問紋門匁們刎悗懣捫紊")
+ ("anf"        "物勿")
+ ("al" "梶謎尾微眉美米味未迷弥媚嵋弭彌濔瀰糜縻薇躾麋靡黴")
+ ("als"        "敏民悶岷愍憫旻泯緡罠閔黽")
+ ("alf"        "密蜜樒謐")
+ ("qkr"        "狛剥博拍泊箔粕舶薄迫爆駁簿撲朴亳搏摶樸溥珀璞膊雹駮魄鰒")
+ ("qks"        "伴半反叛搬斑班畔繁般頒飯盤磐扮返弁拌攀槃潘瘢竝絆胖蟠襷蹣")
+ ("qkf"        "鉢溌発醗髪抜勃孛悖拔撥渤癶發秡跋髮魃")
+ ("qkd"        "倣放方芳訪邦傍坊妨房棒紡肪防匚厖尨幇彭彷旁枋榜滂磅竝膀舫蒡蚌謗錺髣魴")
+ ("qo" "俳拝排杯盃背輩配倍培賠陪白北坏徘憊拜湃焙琲胚裴")
+ ("qor"        "栢覇伯拍柏白舶百佰帛霸珀瓸竡粨魄")
+ ("qjs"        "幡反繁藩煩番蕃翻旛旙樊潘燔礬繙飜膰袢鐇鷭")
+ ("qjf"        "伐罰筏閥罸")
+ ("qja"        "帆氾汎犯範凡梵泛笵范")
+ ("qjq"        "法琺")
+ ("qur"        "副幅僻壁癖碧劈擘檗璧甓薜襞躄辟闢霹")
+ ("qus"        "釆変編辺便弁来辨卞扁抃變汳辮胼褊諞辯邊邉駢")
+ ("quf"        "批閉別瞥丿暼鼈")
+ ("qud"        "病浜瓶丙併兵柄並餅屏并枋榜炳秉竝絣迸餠駢")
+ ("qh" "捗鴇埠普父譜保歩甫補輔菩報宝堡寶寳葆褓鞴黼")
+ ("qhr"        "伏副復幅服福腹複覆僕卜撲匐攴攵樸殕濮箙茯蔔蝠蝮袱蹼輻輹馥鰒")
+ ("qhs"        "本夲賁")
+ ("qhd"        "逢汎封俸奉峰峯捧縫蓬蜂鋒鳳棒泛烽笂篷")
+ ("qn" 
"釜缶蔀専培否不付埠夫婦富冨府扶敷斧浮父符腐膚芙負賦赴阜附撫部伏副復複覆簿報剖仆俘俯傅咐嘸坿孚孵抔拊枹柎桴榑殕溥罘腑艀苻蜉訃賻趺輻郛釡鳧鳬麩麸黼")
+ ("qnr"        "北")
+ ("qns"        "体頒匪分噴墳憤扮焚奮粉糞紛雰奔盆吩忿枌氛汾濆犇瓰畚竕笨芬賁")
+ ("qnf"        "不弗払沸仏佛彿怫拂朏狒祓髴黻")
+ ("qnd"        "棚鮒崩朋鵬堋弸硼繃")
+ ("qmr"        "匐")
+ ("ql" "轡匪卑否妃庇悲扉批斐比泌碑秘緋肥誹費非飛備枇毘琵鼻沸箆丕俾匕嚊妣婢屁憊朏榧狒痞痺睥砒祕秕篦粃糒紕羆翡脾腓臂菲蓖蜚裨譬貔豼賁贔鄙隗霏鞁鞴髀鯡")
+ ("qls"        "鋲彬斌瀕貧賓頻牝嬪擯檳殯濱繽蘋顰鬢")
+ ("qld"        "氷冫冰凭娉憑聘馮騁")
+ ("tk" 
"卸献些唆沙砂詐鎖裟咋仕伺使司史嗣四士師思斯死獅私糸詞賜飼事似寺璽辞舎写射捨赦斜社紗謝蛇邪食笥乍覗巳蓑貰亊俟冩厶嗄奢娑寫徙柤梭槎泗洒渣瀉灑犧獻畭祀祠竢篩簑簔絲耜肆舍莎乕辭釶鉈駟駛鯊鰤麝")
+ ("tkr"        "削朔索数嗽數槊爍鑠")
+ ("tks"        "傘山撒散珊産算酸蒜刪杣汕疝繖跚閂閊")
+ ("tkf"        "殺薩撒蔡")
+ ("tka"        "三参森杉參彡滲糂纔罧芟蔘衫")
+ ("tkq"        "扱渋挿插歃澁澀霎颯")
+ ("tkd"        "桑向傷償商嘗尚床湘祥裳詳象賞上常状双喪爽想相霜像滝瀧湯峠橡箱様雙嫦孀庠廂慯樣殤牀甞翔裃觴謫鱶")
+ ("to" "塞璽洒灑腮賽顋鰓")
+ ("tor"        "塞咋索色嗇愬槭穡薔")
+ ("tod"        "甥省牲生猩笙")
+ ("tid"        "餉")
+ ("tj" "黍犀暑曙庶緒署書薯藷叙序徐恕鋤瑞棲栖西誓逝鼠挑婿舒噬墅壻嶼抒敍敘筮絮耡聟胥黎鼡")
+ ("tjr"        "潟汐射釈錫席惜昔析石碩夕淅皙蓆蜥螫裼釋鉐")
+ ("tjs"        "還蝉仙先宣扇撰洗煽旋線羨腺船選銑鮮善禅繕膳単亘僊單嬋尠愃洒燹癬禪綫譱舩蘚跣霰")
+ ("tjf"        "洩屑契折設説雪舌鱈苫囓挈楔泄渫紲絏緤薛褻齧")
+ ("tja"        "繊閃孅暹歙殲殱笘纖纎蟾譫贍銛")
+ ("tjq"        "拾渉摺摂燮囁慴懾攝聶躡鑷顳")
+ ("tjd"        "省城姓性成星盛聖声誠醒惺晟猩筬聲腥")
+ ("tp" "歳細笹世勢税説洗貰彗洒蛻")
+ ("th" "鯵繰咲篠所召哨宵小少昭梢沼消焼硝笑紹肖鞘塑疏疎素蘇訴遡掃掻巣燥騒蛸疋劭嘯嫂愬梳樔毟泝溯瀟燒甦筱簫艘蔬蕭蘓譟踈逍邵釖銷霄韶騷鮹鰺")
+ ("thr"        "粟束速俗属続屬續謖贖")
+ ("ths"        "餐孫損遜巽")
+ ("thf"        "率蟀")
+ ("thd"        "松訟宋送悚枩淞竦舂蚣誦鎹頌鬆")
+ ("thkf"       "刷")
+ ("tho"        "鎖砕刷殺晒洒灑瑣碎")
+ ("thl"        "粋衰夊")
+ ("tn" 
"守手殊狩首受寿授樹綬需囚収修愁秀繍蒐讐酬獣宿須垂帥水睡遂随瑞髄数捜痩袖竪誰嬬穂薮輸率叟售嗾嗽埀壽嫂岫戍搜收數殳泅洙溲漱燧獸祟穗籔粹綉綏繻羞脩隋膸茱莎蓚藪雖讎豎隨酥銖銹鏥陲隧髓鬚")
+ ("tnr"        "叔夙宿淑縮粛塾熟俶孰倏肅菽蓿")
+ ("tns"        "瞬舜駿循旬楯殉淳盾純巡醇順馴徇恂洵筍笋脣荀蓴蕣詢諄鐓鶉")
+ ("tnf"        "術述率恤戌朮")
+ ("tnd"        "崇嵩菘")
+ ("tnl"        "倅伜淬")
+ ("tmf"        "膝瑟虱蝨")
+ ("tmq"        "湿拾習襲濕褶隰")
+ ("tmd"        "勝升承昇丞乗剰僧縄蝿乘剩甸枡繩蠅陞")
+ ("tl" "飴柿匙殺使始屍市施視詩試侍寺時示蒔偲柴是提矢厮啻嗜嘶尸屎廝弑恃撕猜翅腮舐葹蓍諡豕豺顋")
+ ("tlr"        "喰式識埴飾拭植殖食蝕息寔熄軾餝")
+ ("tls"        "榊伸信娠慎新申神紳臣薪身辛腎訊迅辰矧噺呻哂宸愼抻晨燼蜃贐頤鰰")
+ ("tlf"        "失室悉実實榁蟋")
+ ("tla"        "参審心深芯尋甚參忱椹沁潯瀋蕈鐔")
+ ("tlq"        "拾什十渋辻卅丗澁澀瓧竍籵")
+ ("Tkd"        "双雙")
+ ("Tl" "氏")
+ ("dk" "亜唖阿俄峨我牙芽蛾雅餓涯御児亞兒哦娥婀峩椏猗痾莪衙襾訝錏鐚鴉鵝鵞")
+ ("dkr"        "亜悪握渥岳楽顎鍔鰐亞咢堊嶽幄惡愕樂萼蕚葯諤鄂鶚齷齶")
+ ("dks"        "安按案鞍岸眼贋雁顔諺偐晏殷顏鮟鴈鳫")
+ ("dkf"        "斡按謁戛戞蘗蘖歹訐軋遏閼靄")
+ ("dka"        "庵暗闇厭俺巌癌岩嵒巖菴諳頷黯黶")
+ ("dkq"        "姶圧押鴨哈壓狎")
+ ("dkd"        "央仰昂怏殃泱秧鞅鴦")
+ ("do" "哀愛挨崖涯碍喝啀嗄噫埃崕曖欸皚睚瞹磑礙艾藹阨隘靄靉饐")
+ ("dor"        "液額夜厄扼掖腋軛阨隘")
+ ("dod"        "嚶櫻罌鶯鸚")
+ ("di" "射斜邪若惹埜也冶夜爺耶野揶椰鵺")
+ ("dir"        "鰯若弱約薬躍嫋搦籥葯蒻藥鑰鶸龠")
+ ("did"        "詳壌嬢穣譲醸揚楊様洋羊陽養佯壤孃恙攘昜暘樣漾瀁煬痒瘍癢禳穰襄讓釀驤")
+ ("dj" "於漁禦魚御語唹圄圉淤飫馭鯲齬")
+ ("djr"        "億憶臆疑抑檍")
+ ("djs"        "堰言諺這彦偃嫣焉篶")
+ ("djf"        "蘗蘖")
+ ("dja"        "奄掩俺巌岩験厳儼厂嚴巖广淹罨閹驗")
+ ("djq"        "業")
+ ("dp" "恚殪")
+ ("du" "汝如予余与誉輿預豫歟洳畭絮舁與茹蕷蜍譽餘")
+ ("dur"        "易域疫駅逆射亦役訳懌繹蜴譯閠閾霓驛鯣")
+ ("dus"        "咽宴延沿演煙燕縁鉛研硯次然鳶軟燃淵吮嚥妍娟悁捐掾椽櫞衍涓涎渊烟筵臙莚蜒蠕讌")
+ ("duf"        "咽悦閲説熱吶噎齧")
+ ("dua"        "厭炎焔艶塩染稔冉檐艷苒閻髯魘鯰鹽黶")
+ ("duq"        "厭葉囁曄靨")
+ ("dud"        "営嬰影映栄永泳瑛盈穎頴英詠景迎咏營塋佞侫暎楹榮潁瀛瑩瓔珱纓蠑贏郢霙")
+ ("dP" "医叡曳洩鋭刈詣芸児蕊誉預乂豫倪兒兌囈曵泄猊睨睿穢翳艾蘂蕋藝蚋裔譽貎霓鯢麑")
+ ("dh" "悪烏迂於汚奥襖五伍午呉吾娯悟梧誤傲唔嗚嗷塢墺奧媼寤忤惡懊敖晤澳熬燠牾珸蜈螯遨鏖鰲鼇")
+ ("dhr"        "阿屋玉獄沃")
+ ("dhs"        "温穏慍瘟穩薀蘊褞鰮鰛")
+ ("dhf"        "兀榲膃")
+ ("dhd"        "翁擁壅廱瓮甕癰禺蓊雍鶲")
+ ("dhk"        "娃渦臥蛙瓦窪哇囮窩萵蝸訛譌")
+ ("dhks"       "宛完緩莞関玩翫頑椀碗腕婉浣澣蜿豌關")
+ ("dhkf"       "曰")
+ ("dhkd"       "往旺王皇尢徃枉汪")
+ ("dho"        "娃蛙倭哇矮蝸")
+ ("dhl"        "畏外隈嵬巍猥磑薈鮠")
+ ("dy" "凹楽尭腰擾銚陶約妖揺曜窯耀要謡遥僥夭姚嬲嫐嶢幺徭徼拗搖撓樂橈殀澆燿瑶窈窰繞蕘蟯謠遶邀饒鷂堯遙瑤")
+ ("dyr"        "辱谷慾欲浴峪溽縟蓐褥")
+ ("dyd"        "桶茸勇湧涌傭容庸溶熔用蓉踊俑慂慵榕甬聳舂蛹踴鎔頌")
+ ("dn" "芋右宇羽迂雨欧殴牛区愚虞偶寓遇隅枢又尤佑優友憂祐郵于傴吁吽嵎樞歐毆疣盂禹禺紆肬藕謳麌齲")
+ ("dnr"        "旭郁勗墺澳燠")
+ ("dns"        "員韻云運雲暈殞熕紜耘隕韵")
+ ("dnf"        "宛尉欝蔚鬱熨")
+ ("dnd"        "熊雄")
+ ("dnjs"       "宛員院園怨援猿苑薗遠鴛垣願元原源媛冤圓圜婉寃愿湲爰芫蜿袁諢轅鋺阮隕")
+ ("dnjf"       "越月戉曰粤鉞")
+ ("dnl"        "葦位偉囲委威尉慰為緯胃萎謂違蔚衛危偽倭僞喟囗圍幃渭爲痿縅莠蝟衞逶韋魏")
+ ("db" "惟維遺桜儒柔嬬酉楢肉乳濡鮪愉愈油癒諭輸唯宥幽悠有柚猶猷由裕誘遊幼侑兪喩囿孺帷懦揉揄攸楡渝游瑜瘉糅綏腴臾萸蕕蚰蝓蝣蠕襦覦諛蹂踰逾釉鍮鞣黝鼬")
+ ("dbr"        "育粥肉囿毓鬻")
+ ("dbs"        "允胤閏潤尹贇酳")
+ ("dbf"        "聿鴪")
+ ("dbd"        "戎融絨")
+ ("dms"        "隠恩銀听圻垠慇憖殷犹隱齦")
+ ("dmf"        "乙疑")
+ ("dma"        "飲淫蔭陰音疑吟吽婬崟飮霪")
+ ("dmq"        "泣揖邑悒")
+ ("dmd"        "応疑凝鷹蝿應膺蠅軅軈")
+ ("dml"        "依意椅衣涯毅儀宜擬疑義蟻誼議歪倚崕嶬嶷懿欹熨猗矣礒縊艤醫饐")
+ ("dl" "飴以伊夷易異移餌施爾而耳蛇食詑台弛寅二迩弍姨尓已彝彜怡洟珥甅痍肄苡詒貽貳貮轜邇隶")
+ ("dlr"        "益翌翼嶷弋杙翊謚鷁")
+ ("dls"        "印咽因姻引煙人仁刃靭寅忍認籾仞仭儿刄堙孕廴氤湮烟茵荵蚓靱")
+ ("dlf"        "一壱溢逸日弌佚壹衵釼鎰")
+ ("dla"        "荏壬賃任妊稔姙恁衽袵")
+ ("dlq"        "込廿入叺圦鳰")
+ ("dld"        "剰仍剩孕")
+ ("wk" "梓茨佐左査剤作仔刺姉姿子孜紫諮資雌字慈滋磁自煮者斉積柘髭偖劑呰咨孳恣滓炙瓷疵眥眦粢苴茲蔗藉薺觜貲齎赭鮓鷓齊")
+ ("wkr"        "作昨勺杓灼爵酌酢雀嚼妁寉斫柞炸筰綽芍醋鵲")
+ ("wks"        "桟残孱戔棧殘潺盞")
+ ("wka"        "蚕暫潜湛岑潛濳箴簪蠶賺鏨")
+ ("wkq"        "雑匝挿喋囃插箚襍雜")
+ ("wkd"        "匠奨将庄掌樟章粧蒋醤障丈場杖状壮荘葬装臓蔵帳張腸長撞仗塲墻壯奘奬妝將嶂弉橦檣淙漿爿牆獎璋瘴膓臟臧艢莊萇薔藏裝贓賍鏘鱆")
+ ("wo" "再哉宰才災斎裁載在材財柴斉存滓齋縡纔豺齎齊")
+ ("wod"        "噌槍争鎗崢幀爭瞠箏筝諍錚")
+ ("wj" "姐且杵煮渚藷諸鋤除岨狙樗瀦猪苧著貯低底抵邸屠這箸儲佇咀弖抒杼柢楮沮潴牴疽砠竚紵羝耡苴蛆觝詆豬躇雎齟")
+ ("wjr"        "荻借寂積籍績赤跡蹟賊逐嫡弔吊摘敵滴的笛適鏑躍勣廸炙狄癪磧糴芍藉覿迪迹逖")
+ ("wjs"        
"鴫竣戦栓栴煎箭詮銭前全揃樽佃典填展纏転顛伝殿澱田電縛畑槙淀傳剪甸吮囀奠專巓廛悛戔戰畋旃氈沺濺牋甎痊癜癲磚筌箋篆纒羶翦腆趁躔輾轉鈿銓錢鐫雋靦顫餞饌鷆鷏槇")
+ ("wjf"        "準切拙折窃節絶窒姪凖卩咥截晢晰浙竊耋跌軼")
+ ("wja"        "鮎占漸店点苫粘岾簟霑黏點")
+ ("wjq"        "接蝶慴椄楫楪沾渫聶鰈")
+ ("wjd"        
"井鯖晶証鉦情浄錠征政整正精静打丁町頂亭停偵貞呈定庭廷挺汀碇禎程艇訂鄭釘鼎瀞柾靖淀丼叮幀掟旌梃淨渟甼疔睛穽聢菁蟶逞遉酊酲鐺霆靜")
+ ("wp" "鵜栽済祭際剤諸除制製斉折第醍題堤帝弟悌提梯蹄俤儕劑擠晢濟眥眦睇臍薺齎躋霽齏韲齊")
+ ("wh" 
"竃繰錯惨篠助昭照詔条岨措祖租粗組阻操早曹槽漕燥糟藻遭造鯛兆凋弔彫朝潮眺調跳銚鳥蔦爪吊釣敦蚤肇佻俎嘲噪徂慘慥懆找抓晁條梍棗棹澡爼砠祚稠窕竈笊糶絛罩耡胙艚蜩詛誂譟趙躁鑿雕髞")
+ ("whr"        "足族簇蔟鏃")
+ ("whs"        "尊拵")
+ ("whf"        "拙卒枠卆猝")
+ ("whd"        "種腫宗終従縦鍾鐘綜柊从從慫棕椶樅淙粽縱螽踵蹤踪鑁")
+ ("whk"        "佐左坐座挫")
+ ("whl"        "罪")
+ ("wy" "釖")
+ ("wn" "株作主朱珠酒呪周州洲舟週住祝厨奏走足族宙昼柱注註酎鋳駐調紬肘湊丶侏做儔冑嗾廚晝疇畴稠籌籀紂綢胄蔟蛛誅赱躊輳遒鑄麈")
+ ("wnr"        "粥竹鬻")
+ ("wns"        "噂俊峻竣駿準純遵屯隼鱒儁凖墫恂悛惷浚濬皴蠢蹲逡")
+ ("wnd"        "衆重中仲")
+ ("wmr"        "即賊")
+ ("wmf"        "櫛")
+ ("wma"        "怎")
+ ("wmq"        "輯汁葺揖楫緝")
+ ("wmd"        "絵甑症証蒸噌曾曽増憎贈徴拯橙烝證")
+ ("wl" "岐祇志指支旨枝止祉紙肢脂至誌持識質芝織只知地智池蜘遅漬底抵砥之咫址塒帋弖摯枳沚痣祗耆胝舐觝貭贄趾踟躓輊遲阯鮨鷙")
+ ("wlr"        "織職直喞稙稷")
+ ("wls"        "唇振晋榛疹真秦診進震塵尽陣辰珍鎮陳津填賑侭儘嗔晉殄燼珎甄畛盡眞瞋縉臻蓁袗趁軫鎭")
+ ("wlf"        "叱嫉疾質秩窒迭蛭姪佚咥喞垤帙桎耋膣腟貭跌軼")
+ ("wla"        "朕斟酖鴆")
+ ("wlq"        "執輯集汁緝")
+ ("wld"        "澄徴懲澂")
+ ("ck" "且此叉嵯差瑳車遮借詫侘嗟岔嵳扠搓朿槎磋箚苴蹉釵")
+ ("ckr"        "搾窄錯昔捉濁着著戳縒躇鑿齣齪")
+ ("cks"        "燦纂讃賛餐撰簒攅爨竄粲纉讚贊鏨鑽鑚饌")
+ ("ckf"        "察拶擦札刹扎獺紮")
+ ("cka"        "参惨斬漸僭僣參塹嶄巉慘慙慚懺懴槧站譖譛讒讖驂")
+ ("ckd"        "唱娼廠彰昌菖椙創倉槍窓蒼暢脹畠倡剏厰悵愴搶敞昶淌滄漲猖瘡窗艙蹌鬯")
+ ("co" "差債彩採采砦祭菜柴責莱寨綵蔡豸釵靫")
+ ("cor"        "咋柵窄策冊責措册嘖拆柞磔筴簀")
+ ("cj" "妻処凄狙處悽淒絮萋")
+ ("cjr"        "刺尺隻戚斥脊捗剔呎彳擲滌瘠蜴跖蹐蹠躑陟鶺")
+ ("cjs"        "茜粁串釧蚕千川撰泉浅穿舛薦賎践遷辿天仟倩刋喘巛擅栫楾淺湶濺瓩竏荐賤踐闡阡韆")
+ ("cjf"        "綴哲徹撤轍鉄凸畷啜屮掣輟銕錣鐵鐡餮")
+ ("cja"        "鹸尖添甜僉忝恬槧檐沾瞻簷簽籤籖蟾覘諂譫")
+ ("cjq"        "妾捷畳喋帖牒諜貼疊疉疂睫褶輒輙")
+ ("cjd"        "鯖錆晴清請青庁聴廳廰聽菁蜻")
+ ("cp" "切体替滞逮綴剃締諦逓薙畷啼嚔嚏掣楴涕滯睇砌蒂蔕裼躰軆遞靆體髢")
+ ("ch" "鍬初哨抄招樵焦硝礁肖蕉鞘酢楚礎草超銚秒剿劭勦屮峭悄愀憔杪椒湫炒稍艸誚貂迢醋鈔髫鷦齠")
+ ("chr"        "趣嘱燭触数促属囑屬數矗矚簇蜀觸躅鏃髑")
+ ("chs"        "吋寸村忖邨")
+ ("chd"        "従銃叢惣総聡寵塚憧葱竜龍从偬匆從怱愡總縱聰")
+ ("chl"        "催最崔摧榱洒")
+ ("cn" "穐丑鰍取趣就愁秋臭酋醜出諏推錐錘枢趨雛粗畜抽墜椎槌追鎚萩鷲啾娵婢帚惆掫捶楸樞湫甃皺龝箒簇縋聚芻蒭鄒陬隹鞦騅驟鰌麁")
+ ("cnr"        "丑竺軸蹴祝縮築畜筑蓄逐柚槭舳蹙")
+ ("cns"        "春椿鰆")
+ ("cnf"        "出朮黜")
+ ("cnd"        "沖充銃衝忠虫衷傭冲狆艟蟲")
+ ("cnp"        "悴忰惴瘁萃贅")
+ ("cnl"        "取趣就臭吹炊翠酔脆鷲嘴娶惴揣橇毳瘁翆聚膵萃觜醉驟")
+ ("cmr"        "側則測捗仄惻昃")
+ ("cms"        "齔")
+ ("cma"        "闖")
+ ("cmd"        "曾曽層")
+ ("cl" "嵯差歯治痔埴植織値恥痴稚置致馳徴直薙侈卮厠嗤夂峙巵幟廁梔熾畄畤癡碪穉笞紕緇緻耻蚩褫豸跂輜錙雉魑鯔鴟鵄黹齒")
+ ("clr"        "則測勅飭厠廁惻敕")
+ ("cls"        "親襯齔")
+ ("clf"        "七漆")
+ ("cla"        "砧侵寝浸針湛沈枕寢忱斟椹鍼鍖闖駸")
+ ("clq"        "蟄")
+ ("cld"        "称秤稱袮騁")
+ ("cho"        "快夬獪")
+ ("xk" "蛇他詑唾堕妥惰打柁舵楕陀駄騨池詫佗咤墮它捶揣朶橢沱隋躱駝鴕")
+ ("xkr"        "卓啄托拓沢濯琢託鐸濁擢度倬啅拆柝澤鈬魄")
+ ("xks"        "騨嘆坦歎炭綻誕弾呑灘彈憚攤殫袒")
+ ("xkf"        "奪脱")
+ ("xka"        "探耽眈貪")
+ ("xkq"        "塔搭搨榻鞜鞳鰈")
+ ("xkd"        "宕湯糖蕩帑盪蝪")
+ ("xo" "税太汰怠態泰胎苔逮台大能殆戻兌棣笞紿蛻詒颱駘")
+ ("xor"        "宅択沢擇澤")
+ ("xh" "兎吐菟土套討兔莵")
+ ("xhs"        "褪")
+ ("xhd"        "桶痛通筒統樋恫慟")
+ ("xhl"        "推堆腿退槌追鎚敦褪頽")
+ ("xn" "妬投透闘愉偸綉鍮骰鬪")
+ ("xmr"        "貸特慝")
+ ("vk" "頗巴把播杷波派琶破婆芭罷簸坡怕擺霸爬玻碆笆耙膰菠葩袙跛陂")
+ ("vks"        "坂阪判板版販辧汳瓣鈑")
+ ("vkf"        "捌八叭杁釟")
+ ("vo" "唄貝派敗牌背倍狽抜罷稗佩孛悖拔旆霸沛珮霈")
+ ("vod"        "棚烹傍膨弸彭旁澎磅繃")
+ ("vir"        "愎")
+ ("vus"        "平偏片篇編遍便鞭扁翩苹蝙褊諞騙")
+ ("vua"        "貶")
+ ("vud"        "坪評浜平怦泙硼苹萍鮃")
+ ("vP" "柿廃肺幣弊蔽閉陛吠嬖幤廢敝斃癈薜髀")
+ ("vh" "浦鞄蒲曝爆布怖葡舗鋪圃捕包庖抱泡砲胞褒飽暴勹匍匏咆哺垉抛枹瀑炮疱皰脯舖苞袍襃逋鉋靤餔髱鮑鯆麭")
+ ("vhr"        "曝爆幅暴瀑")
+ ("vy" "杓俵彪標漂瓢票表豹剽嫖慓殍縹飄飃飆驃驫髟鰾")
+ ("vns"        "分")
+ ("vna"        "品稟禀")
+ ("vnd"        "楓風豊瘋諷豐颪馮")
+ ("vb" "彪")
+ ("vl" "彼披疲皮罷被避跛辟陂")
+ ("vlf"        "嘩比泌匹疋弼必畢筆払仏佛拂篳譁蹕鵯")
+ ("vlq"        "逼幅乏泛")
+ ("gk" "下何夏河荷蝦霞賀嚇雫厦呀廈渮瑕緞罅訶谺遐鍜鰕")
+ ("gkr"        "鴬学虐鶴壑學斈涸狢瘧謔貉鷽")
+ ("gks"        "寒汗漢翰閑韓限恨嫺嫻悍扞捍旱桿瀚狠皖罕邯駻骭鼾")
+ ("gkf"        "害割喝轄劼瞎蝎黠")
+ ("gka"        "艦陥含函濫凾咸啣喊嵌檻涵緘莟邯銜陷頷餡鰔鹹")
+ ("gkq"        "蓋閤合蛤呷哈溘盍盖盒葢闔鴿")
+ ("gkd"        "桁巷恒抗杭港航行降項虹亢伉吭恆缸肛閧頏鬨")
+ ("go" "亥解械海蟹劾咳害該骸鮭偕垓夥奚孩廨懈楷薤蠏觧諧邂醢駭")
+ ("gor"        "劾核硅覈輅")
+ ("god"        "杏倖幸行絎裄鵆")
+ ("gid"        "享郷響饗向香嚮餉")
+ ("gj" "嘘虚許墟栩歔滸")
+ ("gjs"        "憲献軒掀獻")
+ ("gjf"        "歇蝎蠍")
+ ("gja"        "険験嶮險驗")
+ ("gur"        "嚇赫革恵奕洫鬩")
+ ("gus"        "絢懸県見賢顕弦玄現絃舷項頁俔呟洵痃眩縣蜆衒鉉顯")
+ ("guf"        "穴血冗頁孟孑襭頡")
+ ("gua"        "嫌")
+ ("guq"        "袷叶侠協峡挟狭脅頬脇夾峽慊挾浹狹筴篋莢鋏陜陝")
+ ("gud"        "馨亨刑兄型形荊蛍桁衡夐炯烱瑩脛螢迥")
+ ("gP" "慧繋兮匸奚彗惠盻禊蹊醯鞋")
+ ("gh" "穫乎呼弧戸湖狐糊胡虎雇互吾瑚護醐好浩号壕濠豪冴皐縞壷冱壺怙戲昊晧楜毫沍滬滸犒琥瓠皋皓葫蒿虍號蝴扈鎬餬")
+ ("ghr"        "或酷鵠惑寉斛")
+ ("ghs"        "婚昏昆混魂棍棔渾溷焜琿")
+ ("ghf"        "核忽惚歿笏鶻")
+ ("ghq"        "恰")
+ ("ghd"        "弘洪紅鴻哄汞泓訌閧鬨")
+ ("ghk"        "化火禍禾花華貨画椛樺靴樗和話啝崋畫糀錵")
+ ("ghkr"       "拡獲確穫擴攫癨矍蠖霍")
+ ("ghks"       "喚患換桓歓環還丸幻亘圜奐宦寰懽歡渙湲煥皖眩矜讙豢鐶驩鬟鰥")
+ ("ghkf"       "越活滑撮猾磆蛞豁闊濶")
+ ("ghkd"       "黄況兄慌晃皇荒幌况凰徨恍惶晄湟滉煌篁簧肓蝗遑隍鰉")
+ ("gho"        "画罫獪畫")
+ ("ghl"        "会回壊廻悔恢懐晦灰准桧賄會囘匯壞徊懷檜槐淮繪膾茴薈蛔詼誨迴鱠")
+ ("ghlr"       "画劃獲畫")
+ ("ghld"       "横弘衡轟薨軣鍠黌")
+ ("gy" "暁佼効校酵肴傚哮嚆囂效曉梟淆烋爻驕驍")
+ ("gn" "芋朽後侯候厚后喉佝吼嗅嘔涸煦猴篌詬逅")
+ ("gns"        "勲薫訓馴勳熏燻葷醺")
+ ("gnd"        "薨")
+ ("gnjs"       "萱喧暖愃暄萓諠讙")
+ ("gnp"        "虫卉喙毀燬")
+ ("gnl"        "揮徽輝彙戲暉麾諱")
+ ("gb" "休携畦畜攜烋虧貅")
+ ("gbr"        "畜")
+ ("gbf"        "恤譎鷸")
+ ("gbd"        "兇凶胸匈恟洶")
+ ("gmr"        "黒釛")
+ ("gms"        "欣痕很忻掀釁")
+ ("gmf"        "汽吃迄屹訖")
+ ("gma"        "欽欠")
+ ("gmq"        "吸歙洽皀翕")
+ ("gmd"        "興虹")
+ ("gml"        "喜嬉希稀戯犠姫僖咥唏噫愾憙戲晞曦欷煕熈熹燹犧禧羲釐鯑")
+ ("glf"        "詰纈襭頡黠")
+ ("unknown"    
"苅宍栂栃凪弐塀俣杢刔夘咒哘唸囎圀圷圸垳垪埔埖埣塰堽墹墸壗壥嬶屓乢妛岫岻岶岼峅峇峺嵶彁怺恷恊抂挧掵擶暃杤桙梹椥椨椪椚椣椡槝樮櫁樌橲樶橸樢檸欟歛汢渕淕溂潸澑犲畉畆畩蘯眤瞶硴碚碵礇禝穃邃笶筅箟篏簓簗籏粐粭粫糘綛縺繧纃緕纐罎膤艝茣莇菷萢蒄蓙蘰蚫蛯蟐袞袰褄諚戝轌辷迚逧逎鍄錻閇閖陦隲靹鞆鞐饂馼駲鮖鮴鯒鯱鰄鰡鱚鵈鵤鵐"))
 
 ;;; hanja-jis.el ends here
diff --git a/lisp/leim/quail/hanja.el b/lisp/leim/quail/hanja.el
index 01843ac..9c6dfc8 100644
--- a/lisp/leim/quail/hanja.el
+++ b/lisp/leim/quail/hanja.el
@@ -1,6 +1,6 @@
 ;;; hanja.el --- Quail-package for Korean Hanja (KSC5601)  -*-coding: utf-8;-*-
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/hanja3.el b/lisp/leim/quail/hanja3.el
index fe82f20..1f829df 100644
--- a/lisp/leim/quail/hanja3.el
+++ b/lisp/leim/quail/hanja3.el
@@ -1,6 +1,6 @@
 ;;; hanja3.el --- Quail-package for Korean Hanja (KSC5601)  -*-coding: 
utf-8;-*-
 
-;; Copyright (C) 1997, 1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Koaunghi Un <address@hidden>
 ;; Keywords: mule, quail, multilingual, input method, Korean, Hanja
diff --git a/lisp/leim/quail/indian.el b/lisp/leim/quail/indian.el
index 69a346b..b6c1b94 100644
--- a/lisp/leim/quail/indian.el
+++ b/lisp/leim/quail/indian.el
@@ -1,6 +1,6 @@
 ;;; indian.el --- Quail packages for inputting Indian
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: KAWABATA, Taichi <address@hidden>
 
diff --git a/lisp/leim/quail/ipa-praat.el b/lisp/leim/quail/ipa-praat.el
index 9a5c24f..74a2dcc 100644
--- a/lisp/leim/quail/ipa-praat.el
+++ b/lisp/leim/quail/ipa-praat.el
@@ -1,6 +1,6 @@
 ;;; ipa-praat.el --- Inputting IPA characters with the conventions of Praat
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Oliver Scholz <address@hidden>
 ;; Keywords: multilingual, input method, IPA
diff --git a/lisp/leim/quail/ipa.el b/lisp/leim/quail/ipa.el
index fd9a05b..3c4c914 100644
--- a/lisp/leim/quail/ipa.el
+++ b/lisp/leim/quail/ipa.el
@@ -1,6 +1,6 @@
 ;;; ipa.el --- Quail package for inputting IPA characters  -*-coding: utf-8;-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/japanese.el b/lisp/leim/quail/japanese.el
index f8735cd..d536b5e 100644
--- a/lisp/leim/quail/japanese.el
+++ b/lisp/leim/quail/japanese.el
@@ -1,6 +1,6 @@
-;;; japanese.el --- Quail package for inputting Japanese  -*-coding: 
iso-2022-7bit;-*-
+;;; japanese.el --- Quail package for inputting Japanese
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -31,7 +31,7 @@
 (require 'kkc)
 
 (defvar quail-japanese-use-double-n nil
-  "If non-nil, use type \"nn\" to insert $B$s(B.")
+  "If non-nil, use type \"nn\" to insert ん.")
 
 ;; Update Quail translation region while considering Japanese bizarre
 ;; translation rules.
@@ -47,14 +47,14 @@
                 (setq quail-current-str (aref quail-current-key 0)
                       control-flag t))
                ((= (aref quail-current-key 0) ?n)
-                (setq quail-current-str ?$B$s(B)
+                (setq quail-current-str ?ん)
                 (if (and quail-japanese-use-double-n
                          (> keylen 0)
                          (= (aref quail-current-key 1) ?n))
                     (setq control-flag t)))
                ((and (> keylen 1)
                      (= (aref quail-current-key 0) (aref quail-current-key 1)))
-                (setq quail-current-str ?$B$C(B))
+                (setq quail-current-str ?っ))
                (t
                 (setq quail-current-str (aref quail-current-key 0))))
          (if (integerp control-flag)
@@ -84,10 +84,10 @@
 (defun quail-japanese-kanji-kkc ()
   (interactive)
   (when (= (char-before (overlay-end quail-conv-overlay)) ?n)
-    ;; The last char is `n'.  We had better convert it to `$B$s(B'
+    ;; The last char is `n'.  We had better convert it to `ん'
     ;; before kana-kanji conversion.
     (goto-char (1- (overlay-end quail-conv-overlay)))
-    (insert ?$B$s(B)
+    (insert ?ん)
     (delete-char 1))
   (let* ((from (copy-marker (overlay-start quail-conv-overlay)))
         (len (- (overlay-end quail-conv-overlay) from)))
@@ -135,113 +135,113 @@
   (throw 'quail-tag nil))
 
 (defvar quail-japanese-transliteration-rules
-  '(( "a" "$B$"(B") ( "i" "$B$$(B") ( "u" "$B$&(B") ( "e" "$B$((B") ( 
"o" "$B$*(B")
-    ("ka" "$B$+(B") ("ki" "$B$-(B") ("ku" "$B$/(B") ("ke" "$B$1(B") 
("ko" "$B$3(B")
-    ("sa" "$B$5(B") ("si" "$B$7(B") ("su" "$B$9(B") ("se" "$B$;(B") 
("so" "$B$=(B")
-    ("ta" "$B$?(B") ("ti" "$B$A(B") ("tu" "$B$D(B") ("te" "$B$F(B") 
("to" "$B$H(B")
-    ("na" "$B$J(B") ("ni" "$B$K(B") ("nu" "$B$L(B") ("ne" "$B$M(B") 
("no" "$B$N(B")
-    ("ha" "$B$O(B") ("hi" "$B$R(B") ("hu" "$B$U(B") ("he" "$B$X(B") 
("ho" "$B$[(B")
-    ("ma" "$B$^(B") ("mi" "$B$_(B") ("mu" "$B$`(B") ("me" "$B$a(B") 
("mo" "$B$b(B")
-    ("ya" "$B$d(B")             ("yu" "$B$f(B")             ("yo" 
"$B$h(B")
-    ("ra" "$B$i(B") ("ri" "$B$j(B") ("ru" "$B$k(B") ("re" "$B$l(B") 
("ro" "$B$m(B")
-    ("la" "$B$i(B") ("li" "$B$j(B") ("lu" "$B$k(B") ("le" "$B$l(B") 
("lo" "$B$m(B")
-    ("wa" "$B$o(B") ("wi" "$B$p(B") ("wu" "$B$&(B") ("we" "$B$q(B") 
("wo" "$B$r(B")
-    ("n'" "$B$s(B")
-    ("ga" "$B$,(B") ("gi" "$B$.(B") ("gu" "$B$0(B") ("ge" "$B$2(B") 
("go" "$B$4(B")
-    ("za" "$B$6(B") ("zi" "$B$8(B") ("zu" "$B$:(B") ("ze" "$B$<(B") 
("zo" "$B$>(B")
-    ("da" "address@hidden(B") ("di" "$B$B(B") ("du" "$B$E(B") ("de" 
"$B$G(B") ("do" "$B$I(B")
-    ("ba" "$B$P(B") ("bi" "$B$S(B") ("bu" "$B$V(B") ("be" "$B$Y(B") 
("bo" "$B$\(B")
-    ("pa" "$B$Q(B") ("pi" "$B$T(B") ("pu" "$B$W(B") ("pe" "$B$Z(B") 
("po" "$B$](B")
-
-    ("kya" ["$B$-$c(B"]) ("kyu" ["$B$-$e(B"]) ("kye" ["$B$-$'(B"]) 
("kyo" ["$B$-$g(B"])
-    ("sya" ["$B$7$c(B"]) ("syu" ["$B$7$e(B"]) ("sye" ["$B$7$'(B"]) 
("syo" ["$B$7$g(B"])
-    ("sha" ["$B$7$c(B"]) ("shu" ["$B$7$e(B"]) ("she" ["$B$7$'(B"]) 
("sho" ["$B$7$g(B"])
-    ("cha" ["$B$A$c(B"]) ("chu" ["$B$A$e(B"]) ("che" ["$B$A$'(B"]) 
("cho" ["$B$A$g(B"])
-    ("tya" ["$B$A$c(B"]) ("tyu" ["$B$A$e(B"]) ("tye" ["$B$A$'(B"]) 
("tyo" ["$B$A$g(B"])
-    ("nya" ["$B$K$c(B"]) ("nyu" ["$B$K$e(B"]) ("nye" ["$B$K$'(B"]) 
("nyo" ["$B$K$g(B"])
-    ("hya" ["$B$R$c(B"]) ("hyu" ["$B$R$e(B"]) ("hye" ["$B$R$'(B"]) 
("hyo" ["$B$R$g(B"])
-    ("mya" ["$B$_$c(B"]) ("myu" ["$B$_$e(B"]) ("mye" ["$B$_$'(B"]) 
("myo" ["$B$_$g(B"])
-    ("rya" ["$B$j$c(B"]) ("ryu" ["$B$j$e(B"]) ("rye" ["$B$j$'(B"]) 
("ryo" ["$B$j$g(B"])
-    ("lya" ["$B$j$c(B"]) ("lyu" ["$B$j$e(B"]) ("lye" ["$B$j$'(B"]) 
("lyo" ["$B$j$g(B"])
-    ("gya" ["$B$.$c(B"]) ("gyu" ["$B$.$e(B"]) ("gye" ["$B$.$'(B"]) 
("gyo" ["$B$.$g(B"])
-    ("zya" ["$B$8$c(B"]) ("zyu" ["$B$8$e(B"]) ("zye" ["$B$8$'(B"]) 
("zyo" ["$B$8$g(B"])
-    ("jya" ["$B$8$c(B"]) ("jyu" ["$B$8$e(B"]) ("jye" ["$B$8$'(B"]) 
("jyo" ["$B$8$g(B"])
-    ( "ja" ["$B$8$c(B"]) ( "ju" ["$B$8$e(B"]) ( "je" ["$B$8$'(B"]) ( 
"jo" ["$B$8$g(B"])
-    ("bya" ["$B$S$c(B"]) ("byu" ["$B$S$e(B"]) ("bye" ["$B$S$'(B"]) 
("byo" ["$B$S$g(B"])
-    ("pya" ["$B$T$c(B"]) ("pyu" ["$B$T$e(B"]) ("pye" ["$B$T$'(B"]) 
("pyo" ["$B$T$g(B"])
-
-    ("kwa" ["$B$/$n(B"]) ("kwi" ["$B$/$#(B"]) ("kwe" ["$B$/$'(B"]) 
("kwo" ["$B$/$)(B"])
-    ("tsa" ["$B$D$!(B"]) ("tsi" ["$B$D$#(B"]) ("tse" ["$B$D$'(B"]) 
("tso" ["$B$D$)(B"])
-    ( "fa" ["$B$U$!(B"]) ( "fi" ["$B$U$#(B"]) ( "fe" ["$B$U$'(B"]) ( 
"fo" ["$B$U$)(B"])
-    ("gwa" ["$B$0$n(B"]) ("gwi" ["$B$0$#(B"]) ("gwe" ["$B$0$'(B"]) 
("gwo" ["$B$0$)(B"])
-
-    ("dyi" ["$B$G$#(B"]) ("dyu" ["$B$I$%(B"]) ("dye" ["$B$G$'(B"]) 
("dyo" ["$B$I$)(B"])
-    ("xwi" ["$B$&$#(B"])                  ("xwe" ["$B$&$'(B"]) ("xwo" 
["$B$&$)(B"])
-
-    ("shi" "$B$7(B") ("tyi" ["$B$F$#(B"]) ("chi" "$B$A(B") ("tsu" 
"$B$D(B") ("ji" "$B$8(B")
-    ("fu"  "$B$U(B")
-    ("ye" ["$B$$$'(B"])
-
-    ("va" ["$B%t$!(B"]) ("vi" ["$B%t$#(B"]) ("vu" "$B%t(B") ("ve" 
["$B%t$'(B"]) ("vo" ["$B%t$)(B"])
-
-    ("xa"  "$B$!(B") ("xi"  "$B$#(B") ("xu"  "$B$%(B") ("xe"  
"$B$'(B") ("xo"  "$B$)(B")
-    ("xtu" "$B$C(B") ("xya" "$B$c(B") ("xyu" "$B$e(B") ("xyo" 
"$B$g(B") ("xwa" "$B$n(B")
-    ("xka" "$B%u(B") ("xke" "$B%v(B")
-
-    ("1" "$B#1(B") ("2" "$B#2(B") ("3" "$B#3(B") ("4" "$B#4(B") ("5" 
"$B#5(B")
-    ("6" "$B#6(B") ("7" "$B#7(B") ("8" "$B#8(B") ("9" "$B#9(B") ("0" 
"$B#0(B")
-
-    ("!" "$B!*(B") ("@" "$B!w(B") ("#" "$B!t(B") ("$" "$B!p(B") ("%" 
"$B!s(B")
-    ("^" "$B!0(B") ("&" "$B!u(B") ("*" "$B!v(B") ("(" "$B!J(B") (")" 
"$B!K(B")
-    ("-" "$B!<(B") ("=" "$B!a(B") ("`" "$B!.(B") ("\\" "$B!o(B") ("|" 
"$B!C(B")
-    ("_" "$B!2(B") ("+" "$B!\(B") ("~" "$B!1(B") ("[" "$B!V(B") ("]" 
"$B!W(B")
-    ("{" "$B!P(B") ("}" "$B!Q(B") (":" "$B!'(B") (";" "$B!((B") ("\""  
"$B!I(B")
-    ("'" "$B!G(B") ("." "$B!#(B") ("," "$B!"(B") ("<" "$B!c(B") (">" 
"$B!d(B")
-    ("?" "$B!)(B") ("/" "$B!?(B")
-
-    ("z1" "$B!{(B") ("z!" "$B!|(B")
-    ("z2" "$B"&(B") ("z@" "$B"'(B")
-    ("z3" "$B"$(B") ("z#" "$B"%(B")
-    ("z4" "$B""(B") ("z$" "$B"#(B")
-    ("z5" "$B!~(B") ("z%" "$B"!(B")
-    ("z6" "$B!y(B") ("z^" "$B!z(B")
-    ("z7" "$B!}(B") ("z&" "$B!r(B")
-    ("z8" "$B!q(B") ("z*" "$B!_(B")
-    ("z9" "$B!i(B") ("z(" "$B!Z(B")
-    ("z0" "$B!j(B") ("z)" "$B![(B")
-    ("z-" "$B!A(B") ("z_" "$B!h(B")
-    ("z=" "$B!b(B") ("z+" "$B!^(B")
-    ("z\\" "address@hidden(B") ("z|" "$B!B(B")
-    ("z`" "$B!-(B") ("z~" "$B!/(B")
-
-    ("zq" "$B!T(B") ("zQ" "$B!R(B")
-    ("zw" "$B!U(B") ("zW" "$B!S(B")
-    ("zr" "$B!9(B") ("zR" "$B!8(B")
-    ("zt" "$B!:(B") ("zT" "$B!x(B")
-    ("zp" "$B")(B") ("zP" "$B",(B")
-    ("z[" "$B!X(B") ("z{" "$B!L(B")
-    ("z]" "$B!Y(B") ("z}" "$B!M(B")
-
-    ("zs" "$B!3(B") ("zS" "$B!4(B")
-    ("zd" "$B!5(B") ("zD" "$B!6(B")
-    ("zf" "$B!7(B") ("zF" "$B"*(B")
-    ("zg" "$B!>(B") ("zG" "$B!=(B")
-    ("zh" "$B"+(B")
-    ("zj" "$B"-(B")
-    ("zk" "$B",(B")
-    ("zl" "$B"*(B")
-    ("z;" "$B!+(B") ("z:" "$B!,(B")
-    ("z'" "$B!F(B") ("z\"" "$B!H(B")
+  '(( "a" "あ") ( "i" "い") ( "u" "う") ( "e" "え") ( "o" "お")
+    ("ka" "か") ("ki" "き") ("ku" "く") ("ke" "け") ("ko" "こ")
+    ("sa" "さ") ("si" "し") ("su" "す") ("se" "せ") ("so" "そ")
+    ("ta" "た") ("ti" "ち") ("tu" "つ") ("te" "て") ("to" "と")
+    ("na" "な") ("ni" "に") ("nu" "ぬ") ("ne" "ね") ("no" "の")
+    ("ha" "は") ("hi" "ひ") ("hu" "ふ") ("he" "へ") ("ho" "ほ")
+    ("ma" "ま") ("mi" "み") ("mu" "む") ("me" "め") ("mo" "も")
+    ("ya" "や")             ("yu" "ゆ")             ("yo" "よ")
+    ("ra" "ら") ("ri" "り") ("ru" "る") ("re" "れ") ("ro" "ろ")
+    ("la" "ら") ("li" "り") ("lu" "る") ("le" "れ") ("lo" "ろ")
+    ("wa" "わ") ("wi" "ゐ") ("wu" "う") ("we" "ゑ") ("wo" "を")
+    ("n'" "ん")
+    ("ga" "が") ("gi" "ぎ") ("gu" "ぐ") ("ge" "げ") ("go" "ご")
+    ("za" "ざ") ("zi" "じ") ("zu" "ず") ("ze" "ぜ") ("zo" "ぞ")
+    ("da" "だ") ("di" "ぢ") ("du" "づ") ("de" "で") ("do" "ど")
+    ("ba" "ば") ("bi" "び") ("bu" "ぶ") ("be" "べ") ("bo" "ぼ")
+    ("pa" "ぱ") ("pi" "ぴ") ("pu" "ぷ") ("pe" "ぺ") ("po" "ぽ")
+
+    ("kya" ["きゃ"]) ("kyu" ["きゅ"]) ("kye" ["きぇ"]) ("kyo" ["きょ"])
+    ("sya" ["しゃ"]) ("syu" ["しゅ"]) ("sye" ["しぇ"]) ("syo" ["しょ"])
+    ("sha" ["しゃ"]) ("shu" ["しゅ"]) ("she" ["しぇ"]) ("sho" ["しょ"])
+    ("cha" ["ちゃ"]) ("chu" ["ちゅ"]) ("che" ["ちぇ"]) ("cho" ["ちょ"])
+    ("tya" ["ちゃ"]) ("tyu" ["ちゅ"]) ("tye" ["ちぇ"]) ("tyo" ["ちょ"])
+    ("nya" ["にゃ"]) ("nyu" ["にゅ"]) ("nye" ["にぇ"]) ("nyo" ["にょ"])
+    ("hya" ["ひゃ"]) ("hyu" ["ひゅ"]) ("hye" ["ひぇ"]) ("hyo" ["ひょ"])
+    ("mya" ["みゃ"]) ("myu" ["みゅ"]) ("mye" ["みぇ"]) ("myo" ["みょ"])
+    ("rya" ["りゃ"]) ("ryu" ["りゅ"]) ("rye" ["りぇ"]) ("ryo" ["りょ"])
+    ("lya" ["りゃ"]) ("lyu" ["りゅ"]) ("lye" ["りぇ"]) ("lyo" ["りょ"])
+    ("gya" ["ぎゃ"]) ("gyu" ["ぎゅ"]) ("gye" ["ぎぇ"]) ("gyo" ["ぎょ"])
+    ("zya" ["じゃ"]) ("zyu" ["じゅ"]) ("zye" ["じぇ"]) ("zyo" ["じょ"])
+    ("jya" ["じゃ"]) ("jyu" ["じゅ"]) ("jye" ["じぇ"]) ("jyo" ["じょ"])
+    ( "ja" ["じゃ"]) ( "ju" ["じゅ"]) ( "je" ["じぇ"]) ( "jo" ["じょ"])
+    ("bya" ["びゃ"]) ("byu" ["びゅ"]) ("bye" ["びぇ"]) ("byo" ["びょ"])
+    ("pya" ["ぴゃ"]) ("pyu" ["ぴゅ"]) ("pye" ["ぴぇ"]) ("pyo" ["ぴょ"])
+
+    ("kwa" ["くゎ"]) ("kwi" ["くぃ"]) ("kwe" ["くぇ"]) ("kwo" ["くぉ"])
+    ("tsa" ["つぁ"]) ("tsi" ["つぃ"]) ("tse" ["つぇ"]) ("tso" ["つぉ"])
+    ( "fa" ["ふぁ"]) ( "fi" ["ふぃ"]) ( "fe" ["ふぇ"]) ( "fo" ["ふぉ"])
+    ("gwa" ["ぐゎ"]) ("gwi" ["ぐぃ"]) ("gwe" ["ぐぇ"]) ("gwo" ["ぐぉ"])
+
+    ("dyi" ["でぃ"]) ("dyu" ["どぅ"]) ("dye" ["でぇ"]) ("dyo" ["どぉ"])
+    ("xwi" ["うぃ"])                  ("xwe" ["うぇ"]) ("xwo" ["うぉ"])
+
+    ("shi" "し") ("tyi" ["てぃ"]) ("chi" "ち") ("tsu" "つ") ("ji" "じ")
+    ("fu"  "ふ")
+    ("ye" ["いぇ"])
+
+    ("va" ["ヴぁ"]) ("vi" ["ヴぃ"]) ("vu" "ヴ") ("ve" ["ヴぇ"]) ("vo" ["ヴぉ"])
+
+    ("xa"  "ぁ") ("xi"  "ぃ") ("xu"  "ぅ") ("xe"  "ぇ") ("xo"  "ぉ")
+    ("xtu" "っ") ("xya" "ゃ") ("xyu" "ゅ") ("xyo" "ょ") ("xwa" "ゎ")
+    ("xka" "ヵ") ("xke" "ヶ")
+
+    ("1" "1") ("2" "2") ("3" "3") ("4" "4") ("5" "5")
+    ("6" "6") ("7" "7") ("8" "8") ("9" "9") ("0" "0")
+
+    ("!" "!") ("@" "@") ("#" "#") ("$" "$") ("%" "%")
+    ("^" "^") ("&" "&") ("*" "*") ("(" "(") (")" ")")
+    ("-" "ー") ("=" "=") ("`" "`") ("\\" "¥") ("|" "|")
+    ("_" "_") ("+" "+") ("~" " ̄") ("[" "「") ("]" "」")
+    ("{" "{") ("}" "}") (":" ":") (";" ";") ("\""  "”")
+    ("'" "’") ("." "。") ("," "、") ("<" "<") (">" ">")
+    ("?" "?") ("/" "/")
+
+    ("z1" "○") ("z!" "●")
+    ("z2" "▽") ("z@" "▼")
+    ("z3" "△") ("z#" "▲")
+    ("z4" "□") ("z$" "■")
+    ("z5" "◇") ("z%" "◆")
+    ("z6" "☆") ("z^" "★")
+    ("z7" "◎") ("z&" "£")
+    ("z8" "¢") ("z*" "×")
+    ("z9" "♂") ("z(" "【")
+    ("z0" "♀") ("z)" "】")
+    ("z-" "〜") ("z_" "∴")
+    ("z=" "≠") ("z+" "±")
+    ("z\\" "\") ("z|" "‖")
+    ("z`" "´") ("z~" "¨")
+
+    ("zq" "《") ("zQ" "〈")
+    ("zw" "》") ("zW" "〉")
+    ("zr" "々") ("zR" "仝")
+    ("zt" "〆") ("zT" "§")
+    ("zp" "〒") ("zP" "↑")
+    ("z[" "『") ("z{" "〔")
+    ("z]" "』") ("z}" "〕")
+
+    ("zs" "ヽ") ("zS" "ヾ")
+    ("zd" "ゝ") ("zD" "ゞ")
+    ("zf" "〃") ("zF" "→")
+    ("zg" "‐") ("zG" "—")
+    ("zh" "←")
+    ("zj" "↓")
+    ("zk" "↑")
+    ("zl" "→")
+    ("z;" "゛") ("z:" "゜")
+    ("z'" "‘") ("z\"" "“")
 
     ("zx" [":-"]) ("zX" [":-)"])
-    ("zc" "$B!;(B") ("zC" "$B!n(B")
-    ("zv" "$B"((B") ("zV" "$B!`(B")
-    ("zb" "$B!k(B") ("zB" "$B"+(B")
-    ("zn" "$B!l(B") ("zN" "$B"-(B")
-    ("zm" "$B!m(B") ("zM" "$B".(B")
-    ("z," "$B!E(B") ("z<" "$B!e(B")
-    ("z." "$B!D(B") ("z>" "$B!f(B")
-    ("z/" "$B!&(B") ("z?" "$B!g(B")
+    ("zc" "〇") ("zC" "℃")
+    ("zv" "※") ("zV" "÷")
+    ("zb" "°") ("zB" "←")
+    ("zn" "′") ("zN" "↓")
+    ("zm" "″") ("zM" "〓")
+    ("z," "‥") ("z<" "≦")
+    ("z." "…") ("z>" "≧")
+    ("z/" "・") ("z?" "∞")
 
     ("\\\\" quail-japanese-self-insert-and-switch-to-alpha)
     ("{{" quail-japanese-self-insert-and-switch-to-alpha)
@@ -252,81 +252,81 @@
     ))
 
 
-;; $B%m!<%^;zF~NO5Z$S2>L>4A;zJQ49$K$h$kF|K\8lF~NO%a%=%C%I(B
+;; ローマ字入力及び仮名漢字変換による日本語入力メソッド
 ;;
-;; $B$3$NF~NO%a%=%C%I$G$NF|K\8l$NF~NO$OFs$D$N%9%F!<%8!V%m!<%^;z2>L>JQ49!W(B
-;; $B$H!V2>L>4A;zJQ49!W$+$i$J$k!#:G=i$O%m!<%^;z2>L>JQ49$N%9%F!<%8$G!"%9(B
-;; $B%Z!<%9%-!<$r2!$9$3$H$K$h$j!"<!$N%9%F!<%8!V2>L>4A;zJQ49!W$X?J$`!#(B
+;; この入力メソッドでの日本語の入力は二つのステージ「ローマ字仮名変換」
+;; と「仮名漢字変換」からなる。最初はローマ字仮名変換のステージで、ス
+;; ペースキーを押すことにより、次のステージ「仮名漢字変換」へ進む。
 ;;
-;; $B!V%m!<%^;z2>L>JQ49!W(B
+;; 「ローマ字仮名変換」
 ;;
-;; $BJ?2>L>$O>.J8;z%-!<address@hidden"3g8LN`$OBP1~(B
-;; $B$9$k1Q;z%-!<$rBG$D$3$H$K$h$jF~NO!#$=$NB>$N%7%s%\%k$O(B `z' 
$B$KB3$1$F2?(B
-;; $B$l$+$N%-!<$rBG$D$3$H$K$h$jF~NO!#2<$KA4$F$N2DG=$J%-!<%7!<%1%s%9%j%9(B
-;; $B%H%"%C%W$5$l$F$$$k!#F~NO$5$l$?J8;z$O2<@~$G<($5$l$k!#(B
+;; 平仮名は小文字キー(列)を打つことにより入力。句読点、括弧類は対応
+;; する英字キーを打つことにより入力。その他のシンボルは `z' に続けて何
+;; れかのキーを打つことにより入力。下に全ての可能なキーシーケンスリス
+;; トアップされている。入力された文字は下線で示される。
 ;;
-;; $B$5$i$K0J2<$N%-!<$GFCJL$J=hM}$r9T$&!#(B
+;; さらに以下のキーで特別な処理を行う。
 ;;
-;; K   $BJ?2>L>$rJR2>L>$K!"$"$k$$$OJR2>L>$rJ?2>L>$KJQ49(B
-;; qq  $B$3$NF~NO%a%=%C%I$H(B `japanese-ascii' address@hidden(B
-;; qz  `japanese-zenkaku' $BF~NO%a%=%C%I$K%7%U%H(B
-;;     qh $B$HBG$F$P85$KLa$k(B
-;; RET $B8=:_$NF~NOJ8;zNs$r3NDj(B
-;; SPC $B2>L>4A;zJQ49$K?J$`(B
+;; K   平仮名を片仮名に、あるいは片仮名を平仮名に変換
+;; qq  この入力メソッドと `japanese-ascii' 入力メソッドをトグル切替
+;; qz  `japanese-zenkaku' 入力メソッドにシフト
+;;     qh と打てば元に戻る
+;; RET 現在の入力文字列を確定
+;; SPC 仮名漢字変換に進む
 ;;
-;; `japanese-ascii' $BF~NO%a%=%C%I$O(B ASCII 
$BJ8;z$rF~NO$9$k$N$K;H$&!#$3$l(B
-;; $B$OF~NO%a%=%C%I$r%*%U$K$9$k$N$H$[$H$s$IF1$8$G$"$k!#0[$J$k$N$O(B qq 
$B$H(B
-;; $BBG$D$3$H$K$h$j!"(B`japanese' address@hidden"$k!#(B
+;; `japanese-ascii' 入力メソッドは ASCII 文字を入力するのに使う。これ
+;; は入力メソッドをオフにするのとほとんど同じである。異なるのは qq と
+;; 打つことにより、`japanese' 入力メソッドに戻れる点である。
 ;;
-;; `japanese-zenkaku' $BF~NO%a%=%C%I$OA43Q1Q?t;z$rF~NO$9$k$N$K;H$&!#(B
+;; `japanese-zenkaku' 入力メソッドは全角英数字を入力するのに使う。
 ;;
-;; $B!V%m!<%^;z2>L>JQ49!W%9%F!<%8$G$N%-!<%7!<%1%s%9$N%j%9%H$O:G8e$KIU$1(B
-;; $B$F$"$k!#(B
+;; 「ローマ字仮名変換」ステージでのキーシーケンスのリストは最後に付け
+;; てある。
 ;;
-;; $B!V2>L>4A;zJQ49!W(B
+;; 「仮名漢字変換」
 ;;
-;; $B$3$N%9%F!<%8$G$O!"A0%9%F!<%8$GF~NO$5$l$?J8;zNs$r2>L>4A;zJQ49$9$k!#(B
-;; $BJQ49$5$l$?J8;zNs$O!"address@hidden>I=<(!K$H;D$j$NF~NO!J2<@~I=<(!K$K(B
-;; $BJ,address@hidden<$N%3%^%s%I$,;H$($k!#(B
+;; このステージでは、前ステージで入力された文字列を仮名漢字変換する。
+;; 変換された文字列は、注目文節(反転表示)と残りの入力(下線表示)に
+;; 分けられる。注目文節に対しては以下のコマンドが使える。
 ;;
 ;; SPC, C-n    kkc-next
-;;     $B<!$NJQ498uJd$rI=<((B
-;;     kkc-show-conversion-list-count $B0J>eB3$1$FBG$F$P!"JQ498uJd%j%9(B
-;;     $B%H$r%(%3!<%(%j%"$KI=<((B
+;;     次の変換候補を表示
+;;     kkc-show-conversion-list-count 以上続けて打てば、変換候補リス
+;;     トをエコーエリアに表示
 ;; C-p         kkc-prev
-;;     $BA0$NJQ498uJd$rI=<((B
-;;     kkc-show-conversion-list-count $B0J>eB3$1$FBG$F$P!"JQ498uJd%j%9(B
-;;     $B%H$r%(%3!<%(%j%"$KI=<((B
+;;     前の変換候補を表示
+;;     kkc-show-conversion-list-count 以上続けて打てば、変換候補リス
+;;     トをエコーエリアに表示
 ;; l           kkc-show-conversion-list-or-next-group
-;;     $B:G9b#1#08D$^$G$NJQ498uJd$r%(%3!<%(%j%"$KI=<(!#(B
-;;     $BB3$1$FBG$?$l$l$P!"<!$N#1#08uJd$rI=<(!#(B
+;;     最高10個までの変換候補をエコーエリアに表示。
+;;     続けて打たれれば、次の10候補を表示。
 ;; L           kkc-show-conversion-list-or-prev-group
-;;     $B:G9b#1#08D$^$G$NJQ498uJd$r%(%3!<%(%j%"$KI=<(!#(B
-;;     $BB3$1$FBG$?$l$l$P!"A0$N#1#08uJd$rI=<(!#(B
+;;     最高10個までの変換候補をエコーエリアに表示。
+;;     続けて打たれれば、前の10候補を表示。
 ;; 0..9                kkc-select-from-list
-;;     $BBG$?$l$??t;z$NJQ498uJd$rA*Br(B
+;;     打たれた数字の変換候補を選択
 ;; H           kkc-hiragana
-;;     address@hidden>L>$KJQ49(B
+;;     注目文節を平仮名に変換
 ;; K           kkc-katakana
-;;     address@hidden>L>$KJQ49(B
+;;     注目文節を片仮名に変換
 ;; C-o         kkc-longer
-;;     address@hidden;z?-$P$9(B
+;;     注目文節を後ろに一文字伸ばす
 ;; C-i         kkc-shorter
-;;     address@hidden;z=L$a$k(B
+;;     注目文節を後ろから一文字縮める
 ;; C-f         kkc-next-phrase
-;;     
address@hidden;$k!#$b$7;D$j$NF~NO$,address@hidden"$l$P!":address@hidden(B
-;;     $BA*Br$7!"address@hidden"$=$N:G=i$NJQ498uJd$rI=<($9$k!#(B
+;;     注目文節を確定させる。もし残りの入力がまだあれば、最初の文節を
+;;     選択し、それを注目文節とし、その最初の変換候補を表示する。
 ;; DEL, C-c    kkc-cancel
-;;     $B2>L>4A;zJQ49$r%-%c%s%;%k$7!"%m!<%^;z2>L>JQ49$N%9%F!<%8$KLa$k!#(B
+;;     仮名漢字変換をキャンセルし、ローマ字仮名変換のステージに戻る。
 ;; return              kkc-terminate
-;;     address@hidden;$k!#(B
+;;     全文節を確定させる。
 ;; C-SPC, C-@  kkc-first-char-only
-;;     $B:G=i$NJ8;z$r3NDj$5$;!";D$j$O:o=|$9$k!#(B
+;;     最初の文字を確定させ、残りは削除する。
 ;; C-h         kkc-help
-;;     $B$3$l$i$N%-!<%P%$%s%I$N%j%9%H$rI=<($9$k!#$"(B
+;;     これらのキーバインドのリストを表示する。あ
 
 (quail-define-package
- "japanese" "Japanese" "A$B$"(B"
+ "japanese" "Japanese" "Aあ"
  nil
  "Japanese input method by Roman transliteration and Kana-Kanji conversion.
 
@@ -433,7 +433,7 @@ Type \"qq\" to go back to previous input method."
 (quail-define-rules ("qq" quail-japanese-switch-package))
 
 (quail-define-package
- "japanese-zenkaku" "Japanese" "$B#A(B"
+ "japanese-zenkaku" "Japanese" "A"
  nil
  "Japanese zenkaku alpha numeric character input method.
 ---- Special key bindings ----
@@ -445,30 +445,30 @@ qh:       shift to the input method `japanese',
 
 (quail-define-rules
 
-(" " "$B!!(B") ("!" "$B!*(B") ("\"" "$B!m(B") ("#" "$B!t(B")
-("$" "$B!p(B") ("%" "$B!s(B") ("&" "$B!u(B") ("'" "$B!l(B")
-("(" "$B!J(B") (")" "$B!K(B") ("*" "$B!v(B") ("+" "$B!\(B")
-("," "$B!$(B") ("-" "$B!](B") ("." "$B!%(B") ("/" "$B!?(B")
-("0" "$B#0(B") ("1" "$B#1(B") ("2" "$B#2(B") ("3" "$B#3(B")
-("4" "$B#4(B") ("5" "$B#5(B") ("6" "$B#6(B") ("7" "$B#7(B")
-("8" "$B#8(B") ("9" "$B#9(B") (":" "$B!'(B") (";" "$B!((B")
-("<" "$B!c(B") ("=" "$B!a(B") (">" "$B!d(B") ("?" "$B!)(B")
-("@" "$B!w(B") ("A" "$B#A(B") ("B" "$B#B(B") ("C" "$B#C(B")
-("D" "$B#D(B") ("E" "$B#E(B") ("F" "$B#F(B") ("G" "$B#G(B")
-("H" "$B#H(B") ("I" "$B#I(B") ("J" "$B#J(B") ("K" "$B#K(B")
-("L" "$B#L(B") ("M" "$B#M(B") ("N" "$B#N(B") ("O" "$B#O(B")
-("P" "$B#P(B") ("Q" "$B#Q(B") ("R" "$B#R(B") ("S" "$B#S(B")
-("T" "$B#T(B") ("U" "$B#U(B") ("V" "$B#V(B") ("W" "$B#W(B")
-("X" "$B#X(B") ("Y" "$B#Y(B") ("Z" "$B#Z(B") ("[" "$B!N(B")
-("\\" "$B!o(B") ("]" "$B!O(B") ("^" "$B!0(B") ("_" "$B!2(B")
-("`" "$B!F(B") ("a" "$B#a(B") ("b" "$B#b(B") ("c" "$B#c(B")
-("d" "$B#d(B") ("e" "$B#e(B") ("f" "$B#f(B") ("g" "$B#g(B")
-("h" "$B#h(B") ("i" "$B#i(B") ("j" "$B#j(B") ("k" "$B#k(B")
-("l" "$B#l(B") ("m" "$B#m(B") ("n" "$B#n(B") ("o" "$B#o(B")
-("p" "$B#p(B") ("q" "$B#q(B") ("r" "$B#r(B") ("s" "$B#s(B")
-("t" "$B#t(B") ("u" "$B#u(B") ("v" "$B#v(B") ("w" "$B#w(B")
-("x" "$B#x(B") ("y" "$B#y(B") ("z" "$B#z(B") ("{" "$B!P(B")
-("|" "$B!C(B") ("}" "$B!Q(B") ("~" "$B!A(B")
+(" " " ") ("!" "!") ("\"" "″") ("#" "#")
+("$" "$") ("%" "%") ("&" "&") ("'" "′")
+("(" "(") (")" ")") ("*" "*") ("+" "+")
+("," ",") ("-" "−") ("." ".") ("/" "/")
+("0" "0") ("1" "1") ("2" "2") ("3" "3")
+("4" "4") ("5" "5") ("6" "6") ("7" "7")
+("8" "8") ("9" "9") (":" ":") (";" ";")
+("<" "<") ("=" "=") (">" ">") ("?" "?")
+("@" "@") ("A" "A") ("B" "B") ("C" "C")
+("D" "D") ("E" "E") ("F" "F") ("G" "G")
+("H" "H") ("I" "I") ("J" "J") ("K" "K")
+("L" "L") ("M" "M") ("N" "N") ("O" "O")
+("P" "P") ("Q" "Q") ("R" "R") ("S" "S")
+("T" "T") ("U" "U") ("V" "V") ("W" "W")
+("X" "X") ("Y" "Y") ("Z" "Z") ("[" "[")
+("\\" "¥") ("]" "]") ("^" "^") ("_" "_")
+("`" "‘") ("a" "a") ("b" "b") ("c" "c")
+("d" "d") ("e" "e") ("f" "f") ("g" "g")
+("h" "h") ("i" "i") ("j" "j") ("k" "k")
+("l" "l") ("m" "m") ("n" "n") ("o" "o")
+("p" "p") ("q" "q") ("r" "r") ("s" "s")
+("t" "t") ("u" "u") ("v" "v") ("w" "w")
+("x" "x") ("y" "y") ("z" "z") ("{" "{")
+("|" "|") ("}" "}") ("~" "〜")
 
 ("qq" quail-japanese-switch-package)
 ("qh" quail-japanese-switch-package)
@@ -485,7 +485,7 @@ qh: shift to the input method `japanese',
 
 (quail-define-package
  "japanese-hankaku-kana"
- "Japanese" "(I1(B"
+ "Japanese" "ア"
  nil
  "Japanese hankaku katakana input method by Roman transliteration.
 ---- Special key bindings ----
@@ -514,7 +514,7 @@ qq: toggle between this input method and the input method 
`japanese-ascii'.
                   trans)))
 
 (quail-define-package
- "japanese-hiragana" "Japanese" "$B$"(B"
+ "japanese-hiragana" "Japanese" "あ"
  nil
  "Japanese hiragana input method by Roman transliteration."
  nil t t nil nil nil nil nil
@@ -535,7 +535,7 @@ qq: toggle between this input method and the input method 
`japanese-ascii'.
   control-flag)
 
 (quail-define-package
- "japanese-katakana" "Japanese" "$B%"(B"
+ "japanese-katakana" "Japanese" "ア"
  nil
  "Japanese katakana input method by Roman transliteration."
  nil t t nil nil nil nil nil
diff --git a/lisp/leim/quail/latin-alt.el b/lisp/leim/quail/latin-alt.el
index 5044fb2..6237636 100644
--- a/lisp/leim/quail/latin-alt.el
+++ b/lisp/leim/quail/latin-alt.el
@@ -1,6 +1,6 @@
 ;;; latin-alt.el --- Quail package for inputting various European characters 
-*-coding: utf-8;-*-
 
-;; Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
 ;;   2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/latin-ltx.el b/lisp/leim/quail/latin-ltx.el
index cef76f6..754f662 100644
--- a/lisp/leim/quail/latin-ltx.el
+++ b/lisp/leim/quail/latin-ltx.el
@@ -1,6 +1,6 @@
 ;;; latin-ltx.el --- Quail package for TeX-style input -*-coding: utf-8;-*-
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
 ;;   2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/latin-post.el b/lisp/leim/quail/latin-post.el
index 8b0253f..589978f 100644
--- a/lisp/leim/quail/latin-post.el
+++ b/lisp/leim/quail/latin-post.el
@@ -1,6 +1,6 @@
 ;;; latin-post.el --- Quail packages for inputting various European characters 
 -*-coding: utf-8;-*-
 
-;; Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/latin-pre.el b/lisp/leim/quail/latin-pre.el
index 9d343e7..bcf81f4 100644
--- a/lisp/leim/quail/latin-pre.el
+++ b/lisp/leim/quail/latin-pre.el
@@ -1,6 +1,6 @@
 ;;; latin-pre.el --- Quail packages for inputting various European characters  
-*-coding: utf-8;-*-
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -320,7 +320,7 @@ Key translation rules are:
 
     effect   | prefix | examples
  ------------+--------+------------------
-    tilde    |   ~    | ~a -> ă
+    breve    |   ~    | ~a -> ă
   circumflex |   ^    | ^a -> â, ^i -> î
    cedilla   |   ,    | ,s -> ş, ,t -> ţ
    ~         |   ~    | ~~ -> ~
@@ -342,11 +342,11 @@ Key translation rules are:
 
     effect   | prefix | examples
  ------------+--------+------------------
-    tilde    |   \"    | \"a -> â
-  circumflex |   \\='    | \\='a -> â, \\='i -> î
-   cedilla   |   \\='    | \\='s -> ş, \\='t -> ţ
-   \\='         |   \\='    | \\='\\=' -> \\='
-   \"         |   \"    | \"\" -> \"
+    breve    |   \\='    | \\='a -> ă
+ circumflex  |  \" \\='   | \"a -> â  \\='i -> î
+   cedilla   |   \\='    | \\='s -> ş  \\='t -> ţ
+      \\='      |   \\='    | \\='\\=' -> \\='
+      \"      |   \"    | \"\" -> \"
 " nil t nil nil nil nil nil nil nil nil t)
 
 (quail-define-rules
@@ -606,7 +606,7 @@ Key translation rules are:
   circumflex |   ^    | ^a -> â
   diaeresis  |   \"    | \"a -> ä   \"\" -> ¨
    cedilla   |   ~    | ~c -> ç   ~s -> ş   ~~ -> ¸
-  dot above  |   / .  | /g -> ġ   .o -> ġ
+  dot above  |   / .  | /g -> ġ   .g -> ġ
     misc     | \" ~ /  | \"s -> ß   ~g -> ğ   ~u -> ŭ   /h -> ħ   /i -> ı
    symbol    |   ~    | ~\\=` -> ˘   /# -> £   /$ -> ¤   // -> °
 " nil t nil nil nil nil nil nil nil nil t)
@@ -1089,15 +1089,15 @@ of characters from a single Latin-N charset.
 
     effect   | prefix | examples
  ------------+--------+----------
-    acute    |   \\='    | \\='a -> á, \\='\\=' -> ´
+    acute    |   \\='    | \\='a -> á  \\='\\=' -> ´
     grave    |   \\=`    | \\=`a -> à
   circumflex |   ^    | ^a -> â
   diaeresis  |   \"    | \"a -> ä  \"\" -> ¨
     tilde    |   ~    | ~a -> ã
-   cedilla   |   ~    | ~c -> ç
+   cedilla   |  , ~   | ,c -> ç  ~c -> ç
+    caron    |   ~    | ~c -> č  ~g -> ğ
     breve    |   ~    | ~a -> ă
-    caron    |   ~    | ~c -> č
-  dot above  | ~ / .  | ~o -> ġ   /o -> ġ   .o -> ġ
+  dot above  |   / .  | /g -> ġ   .g -> ġ
     misc     | \" ~ /  | \"s -> ß  ~d -> ð  ~t -> þ  /a -> å  /e -> æ  /o -> ø
    symbol    |   ~    | ~> -> »  ~< -> «  ~! -> ¡  ~? -> ¿  ~~ -> ¸
    symbol    |  _ /   | _o -> º  _a -> ª  // -> °  /\\ -> ×  _y -> ¥
@@ -1252,7 +1252,10 @@ of characters from a single Latin-N charset.
  ("~>" ?\»)
  ("~?" ?¿)
  ("~A" ?Ã)
+ ("~A" ?Ă)
  ("~C" ?Ç)
+ ("~C" ?Č)
+ (",C" ?Ç)
  ("~D" ?Ð)
  ("~G" ?Ğ)
  ("~N" ?Ñ)
@@ -1265,13 +1268,15 @@ of characters from a single Latin-N charset.
  ("~Z" ?Ž)
  ("~`" ?˘)
  ("~a" ?ã)
+ ("~a" ?ă)
  ("~c" ?ç)
+ ("~c" ?č)
+ (",c" ?ç)
  ("~d" ?ð)
  ("~e" ?€)
  ("~g" ?ğ)
  ("~n" ?ñ)
  ("~o" ?õ)
- ("~o" ?ġ)
  ("~p" ?¶)
  ("~s" ?§)
  ("~s" ?ş)
diff --git a/lisp/leim/quail/lrt.el b/lisp/leim/quail/lrt.el
index 69e8fd6..e8f856f 100644
--- a/lisp/leim/quail/lrt.el
+++ b/lisp/leim/quail/lrt.el
@@ -1,6 +1,6 @@
 ;;; lrt.el --- Quail package for inputting Lao characters by LRT method  
-*-coding: utf-8;-*-
 
-;; Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/persian.el b/lisp/leim/quail/persian.el
index c2c73a7..77da3ea 100644
--- a/lisp/leim/quail/persian.el
+++ b/lisp/leim/quail/persian.el
@@ -1,6 +1,6 @@
 ;;; persian.el  --- Quail package for inputting Persian/Farsi keyboard -*- 
coding: utf-8;-*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Mohsen BANAN <address@hidden>
 ;; X-URL: http://mohsen.1.banan.byname.net/contact
diff --git a/lisp/leim/quail/programmer-dvorak.el 
b/lisp/leim/quail/programmer-dvorak.el
index f36b71a..a8012ca 100644
--- a/lisp/leim/quail/programmer-dvorak.el
+++ b/lisp/leim/quail/programmer-dvorak.el
@@ -1,6 +1,6 @@
 ;;; programmer-dvorak.el --- Quail package for the programmer Dvorak layout
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Joakim Jalap <address@hidden>
 
diff --git a/lisp/leim/quail/py-punct.el b/lisp/leim/quail/py-punct.el
index a53f2c0..eed70a8 100644
--- a/lisp/leim/quail/py-punct.el
+++ b/lisp/leim/quail/py-punct.el
@@ -1,6 +1,6 @@
-;;; py-punct.el --- Quail packages for Chinese (pinyin + extra symbols)  
-*-coding: iso-2022-7bit;-*-
+;;; py-punct.el --- Quail packages for Chinese (pinyin + extra symbols)
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -35,16 +35,16 @@
 (load "quail/Punct")
 
 (quail-define-package
- "chinese-py-punct" "Chinese-GB" "$AF47{(B"
+ "chinese-py-punct" "Chinese-GB" "拼符"
  t
- "$A::WVJdHk(B $AF4Rt7=08(B and `v' for $A1j5c7{:EJdHk(B
+ "汉字输入 拼音方案 and `v' for 标点符号输入
 
 This is the combination of the input methods `chinese-py' and `chinese-punct'.
 You can enter normal Chinese characters by the same way as `chinese-py'.
 And, you can enter symbols by typing `v' followed by any key sequences
 defined in `chinese-punct'.
 
-For instance, typing `v' and `%' insert `$A#%(B'.
+For instance, typing `v' and `%' insert `%'.
 ")
 
 (setcar (nthcdr 2 quail-current-package)
@@ -55,9 +55,9 @@ For instance, typing `v' and `%' insert `$A#%(B'.
 (load "quail/TONEPY")
 
 (quail-define-package
- "chinese-tonepy-punct" "Chinese-GB" "$AF47{(B"
+ "chinese-tonepy-punct" "Chinese-GB" "拼符"
  t
- "$A::WVJdHk(B $A4x5wF4Rt7=08(B and `v' for $A1j5c7{:EJdHk(B
+ "汉字输入 带调拼音方案 and `v' for 标点符号输入
 
 This is the combination of the input methods `chinese-tonepy' and
 `chinese-punct'.
@@ -66,7 +66,7 @@ You can enter normal Chinese characters by the same way as
 `chinese-tonepy'.  And, you can enter symbols by typing `v' followed
 by any key sequences defined in `chinese-punct'.
 
-For instance, typing `v' and `%' insert `$A#%(B'.
+For instance, typing `v' and `%' insert `%'.
 ")
 
 (setcar (nthcdr 2 quail-current-package)
diff --git a/lisp/leim/quail/pypunct-b5.el b/lisp/leim/quail/pypunct-b5.el
index ef58631..45597a4 100644
--- a/lisp/leim/quail/pypunct-b5.el
+++ b/lisp/leim/quail/pypunct-b5.el
@@ -1,4 +1,4 @@
-;;; pypunct-b5.el --- Quail packages for Chinese (pinyin + extra symbols) 
-*-coding: iso-2022-7bit;-*-
+;;; pypunct-b5.el --- Quail packages for Chinese (pinyin + extra symbols)
 
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
@@ -34,9 +34,9 @@
 (load "quail/Punct-b5")
 
 (quail-define-package
- "chinese-py-punct-b5" "Chinese-BIG5" "$(03<>K(B"
+ "chinese-py-punct-b5" "Chinese-BIG5" "拼符"
  t
- "$(0&d'GTT&,!J3<5x!K(B and `v' for $(0O:X5>KHATT&,(B
+ "中文輸入【拼音】 and `v' for 標點符號輸入
 
 This is the combination of the input method `chinese-py-b5' and
 `chinese-punct-b5'.
@@ -45,7 +45,7 @@ You can enter normal Chinese characters by the same way as 
`chinese-py-b5'.
 And, you can enter symbols by typing `v' followed by any key sequences
 defined in `chinese-punct-b5'.
 
-For instance, typing `v' and `%' insert `$(0"h(B'.
+For instance, typing `v' and `%' insert `%'.
 ")
 
 (setcar (nthcdr 2 quail-current-package)
diff --git a/lisp/leim/quail/rfc1345.el b/lisp/leim/quail/rfc1345.el
index 081180a..da1a453 100644
--- a/lisp/leim/quail/rfc1345.el
+++ b/lisp/leim/quail/rfc1345.el
@@ -1,6 +1,6 @@
 ;;; rfc1345.el --- Quail method for RFC 1345 mnemonics -*- coding: utf-8 -*-
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;; Keywords: i18n
diff --git a/lisp/leim/quail/sami.el b/lisp/leim/quail/sami.el
new file mode 100644
index 0000000..d4cf4ec
--- /dev/null
+++ b/lisp/leim/quail/sami.el
@@ -0,0 +1,755 @@
+;;; sami.el --- Quail package for inputting Sámi  -*-coding: utf-8;-*-
+
+;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
+
+;; Author: Wojciech S. Gac <address@hidden>
+;; Maintainer: Wojciech S. Gac <address@hidden>>
+;; Keywords: i18n, multilingual, input method, Sámi
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This file implements the following input methods for the Sámi
+;; language
+;; - norwegian-sami-prefix
+;; - bergsland-hasselbrink-sami-prefix
+;; - southern-sami-prefix
+;; - ume-sami-prefix
+;; - northern-sami-prefix
+;; - inari-sami-prefix
+;; - skolt-sami-prefix
+;; - kildin-sami-prefix
+
+;;; Code
+
+(require 'quail)
+
+(quail-define-package
+ "norwegian-sami-prefix" "Sámi" "/NSoS" nil
+ "Norwegian Southern Sámi input method
+
+Alphabet (parenthesized letters are used in foreign names):
+А а    B b     (C c)   D d     E e     F f     G g     H h
+I i    (Ï ï)   J j     K k     L l     M m     N n     O o
+P p    (Q q)   R r     S s     T t     U u     V v     (W w)
+(X x)  Y y     (Z z)   Æ æ     Ø ø     Å å
+"
+ nil t nil nil nil nil nil nil nil nil t)
+
+(quail-define-rules
+ ("А" ?А)
+ ("а" ?а)
+ ("B" ?B)
+ ("b" ?b)
+ ("C" ?C)
+ ("c" ?c)
+ ("D" ?D)
+ ("d" ?d)
+ ("E" ?E)
+ ("e" ?e)
+ ("F" ?F)
+ ("f" ?f)
+ ("G" ?G)
+ ("g" ?g)
+ ("H" ?H)
+ ("h" ?h)
+ ("I" ?I)
+ ("i" ?i)
+ (":I" ?Ï)
+ (":i" ?ï)
+ ("J" ?J)
+ ("j" ?j)
+ ("K" ?K)
+ ("k" ?k)
+ ("L" ?L)
+ ("l" ?l)
+ ("M" ?M)
+ ("m" ?m)
+ ("N" ?N)
+ ("n" ?n)
+ ("O" ?O)
+ ("o" ?o)
+ ("P" ?P)
+ ("p" ?p)
+ ("Q" ?Q)
+ ("q" ?q)
+ ("R" ?R)
+ ("r" ?r)
+ ("S" ?S)
+ ("s" ?s)
+ ("T" ?T)
+ ("t" ?t)
+ ("U" ?U)
+ ("u" ?u)
+ ("V" ?V)
+ ("v" ?v)
+ ("W" ?W)
+ ("w" ?w)
+ ("X" ?X)
+ ("x" ?x)
+ ("Y" ?Y)
+ ("y" ?y)
+ ("Z" ?Z)
+ ("z" ?z)
+ ("AE" ?Æ)
+ ("ae" ?æ)
+ ("/O" ?Ø)
+ ("/o" ?ø)
+ ("/A" ?Å)
+ ("/a" ?å))
+
+(quail-define-package
+ "bergsland-hasselbrink-sami-prefix" "Sámi" "/BHS" nil
+ "Bergsland-Hasselbrink Southern Sámi input method
+
+Alphabet:
+А а    Â â     Á á     B b     C c     Č č     D d     Đ đ
+E e    F f     G g     H h     I i     Î î     J j     K k
+L l    M m     N n     Ŋ ŋ     O o     P p     R r     S s
+Š š    T t     U u     V v     Y y     Z z     Ž ž     Ä ä
+Æ æ    Ö ö     Å å     '
+"
+ nil t nil nil nil nil nil nil nil nil t)
+
+(quail-define-rules
+ ("А" ?А)
+ ("а" ?а)
+ ("^A" ?Â)
+ ("^a" ?â)
+ ("'A" ?Á)
+ ("'a" ?á)
+ ("B" ?B)
+ ("b" ?b)
+ ("C" ?C)
+ ("c" ?c)
+ ("^C" ?Č)
+ ("^c" ?č)
+ ("D" ?D)
+ ("d" ?d)
+ ("-D" ?Đ)
+ ("-d" ?đ)
+ ("E" ?E)
+ ("e" ?e)
+ ("F" ?F)
+ ("f" ?f)
+ ("G" ?G)
+ ("g" ?g)
+ ("H" ?H)
+ ("h" ?h)
+ ("I" ?I)
+ ("i" ?i)
+ ("^I" ?Î)
+ ("^i" ?î)
+ ("J" ?J)
+ ("j" ?j)
+ ("K" ?K)
+ ("k" ?k)
+ ("L" ?L)
+ ("l" ?l)
+ ("M" ?M)
+ ("m" ?m)
+ ("N" ?N)
+ ("n" ?n)
+ ("/N" ?Ŋ)
+ ("/n" ?ŋ)
+ ("O" ?O)
+ ("o" ?o)
+ ("P" ?P)
+ ("p" ?p)
+ ("R" ?R)
+ ("r" ?r)
+ ("S" ?S)
+ ("s" ?s)
+ ("^S" ?Š)
+ ("^s" ?š)
+ ("T" ?T)
+ ("t" ?t)
+ ("U" ?U)
+ ("u" ?u)
+ ("V" ?V)
+ ("v" ?v)
+ ("Y" ?Y)
+ ("y" ?y)
+ ("Z" ?Z)
+ ("z" ?z)
+ ("^Z" ?Ž)
+ ("^z" ?ž)
+ (":A" ?Ä)
+ (":a" ?ä)
+ ("AE" ?Æ)
+ ("ae" ?æ)
+ (":O" ?Ö)
+ (":o" ?ö)
+ ("/A" ?Å)
+ ("/a" ?å))
+
+(quail-define-package
+ "southern-sami-prefix" "Sámi" "/SoS" nil
+ "Contemporary Southern Sámi input method
+
+Alphabet (parenthesized letters are used in foreign names):
+А а    B b     (C c)   D d     E e     F f     G g     H h
+I i    (Ï ï)   J j     K k     L l     M m     N n     O o
+P p    (Q q)   R r     S s     T t     U u     V v     (W w)
+(X x)  Y y     (Z z)   Ä ä     Ö ö     Å å
+"
+ nil t nil nil nil nil nil nil nil nil t)
+
+(quail-define-rules
+ ("А" ?А)
+ ("а" ?а)
+ ("B" ?B)
+ ("b" ?b)
+ ("C" ?C)
+ ("c" ?c)
+ ("D" ?D)
+ ("d" ?d)
+ ("E" ?E)
+ ("e" ?e)
+ ("F" ?F)
+ ("f" ?f)
+ ("G" ?G)
+ ("g" ?g)
+ ("H" ?H)
+ ("h" ?h)
+ ("I" ?I)
+ ("i" ?i)
+ (":I" ?Ï)
+ (":i" ?ï)
+ ("J" ?J)
+ ("j" ?j)
+ ("K" ?K)
+ ("k" ?k)
+ ("L" ?L)
+ ("l" ?l)
+ ("M" ?M)
+ ("m" ?m)
+ ("N" ?N)
+ ("n" ?n)
+ ("O" ?O)
+ ("o" ?o)
+ ("P" ?P)
+ ("p" ?p)
+ ("Q" ?Q)
+ ("q" ?q)
+ ("R" ?R)
+ ("r" ?r)
+ ("S" ?S)
+ ("s" ?s)
+ ("T" ?T)
+ ("t" ?t)
+ ("U" ?U)
+ ("u" ?u)
+ ("V" ?V)
+ ("v" ?v)
+ ("W" ?W)
+ ("w" ?w)
+ ("X" ?X)
+ ("x" ?x)
+ ("Y" ?Y)
+ ("y" ?y)
+ ("Z" ?Z)
+ ("z" ?z)
+ (":A" ?Ä)
+ (":a" ?ä)
+ (":O" ?Ö)
+ (":o" ?ö)
+ ("/A" ?Å)
+ ("/a" ?å))
+
+(quail-define-package
+ "ume-sami-prefix" "Sámi" "/UmS" nil
+ "Ume Sámi input method
+
+Alphabet:
+А а    Á á     B b     D d     Đ đ     E e     F f     G g
+H h    I i     Ï ï     J j     K k     L l     M m     N n
+Ŋ ŋ    O o     P p     R r     S s     T t     Ŧ ŧ     U u
+Ü ü    V v     Y y     Å å     Ä ä     Ö ö
+"
+ nil t nil nil nil nil nil nil nil nil t)
+
+(quail-define-rules
+ ("А" ?А)
+ ("а" ?а)
+ ("'A" ?Á)
+ ("'a" ?á)
+ ("B" ?B)
+ ("b" ?b)
+ ("D" ?D)
+ ("d" ?d)
+ ("-D" ?Đ)
+ ("-d" ?đ)
+ ("E" ?E)
+ ("e" ?e)
+ ("F" ?F)
+ ("f" ?f)
+ ("G" ?G)
+ ("g" ?g)
+ ("H" ?H)
+ ("h" ?h)
+ ("I" ?I)
+ ("i" ?i)
+ (":I" ?Ï)
+ (":i" ?ï)
+ ("J" ?J)
+ ("j" ?j)
+ ("K" ?K)
+ ("k" ?k)
+ ("L" ?L)
+ ("l" ?l)
+ ("M" ?M)
+ ("m" ?m)
+ ("N" ?N)
+ ("n" ?n)
+ ("/N" ?Ŋ)
+ ("/n" ?ŋ)
+ ("O" ?O)
+ ("o" ?o)
+ ("P" ?P)
+ ("p" ?p)
+ ("R" ?R)
+ ("r" ?r)
+ ("S" ?S)
+ ("s" ?s)
+ ("T" ?T)
+ ("t" ?t)
+ ("-T" ?Ŧ)
+ ("-t" ?ŧ)
+ ("U" ?U)
+ ("u" ?u)
+ (":U" ?Ü)
+ (":u" ?ü)
+ ("V" ?V)
+ ("v" ?v)
+ ("Y" ?Y)
+ ("y" ?y)
+ ("/A" ?Å)
+ ("/a" ?å)
+ (":A" ?Ä)
+ (":a" ?ä)
+ (":O" ?Ö)
+ (":o" ?ö)
+ )
+
+(quail-define-package
+ "northern-sami-prefix" "Sámi" "/NoS" nil
+ "Northern Sámi input method
+
+Alphabet:
+А а    Á á     B b     C c     Č č     D d     Đ đ     E e
+F f    G g     H h     I i     J j     K k     L l     M m
+N n    Ŋ ŋ     O o     P p     R r     S s     Š š     T t
+Ŧ ŧ    U u     V v     Z z     Ž ž
+"
+ nil t nil nil nil nil nil nil nil nil t)
+
+(quail-define-rules
+ ("А" ?А)
+ ("а" ?а)
+ ("'A" ?Á)
+ ("'a" ?á)
+ ("B" ?B)
+ ("b" ?b)
+ ("C" ?C)
+ ("c" ?c)
+ ("^C" ?Č)
+ ("^c" ?č)
+ ("D" ?D)
+ ("d" ?d)
+ ("-D" ?Đ)
+ ("-d" ?đ)
+ ("E" ?E)
+ ("e" ?e)
+ ("F" ?F)
+ ("f" ?f)
+ ("G" ?G)
+ ("g" ?g)
+ ("H" ?H)
+ ("h" ?h)
+ ("I" ?I)
+ ("i" ?i)
+ ("J" ?J)
+ ("j" ?j)
+ ("K" ?K)
+ ("k" ?k)
+ ("L" ?L)
+ ("l" ?l)
+ ("M" ?M)
+ ("m" ?m)
+ ("N" ?N)
+ ("n" ?n)
+ ("/N" ?Ŋ)
+ ("/n" ?ŋ)
+ ("O" ?O)
+ ("o" ?o)
+ ("P" ?P)
+ ("p" ?p)
+ ("R" ?R)
+ ("r" ?r)
+ ("S" ?S)
+ ("s" ?s)
+ ("^S" ?Š)
+ ("^s" ?š)
+ ("T" ?T)
+ ("t" ?t)
+ ("-T" ?Ŧ)
+ ("-t" ?ŧ)
+ ("U" ?U)
+ ("u" ?u)
+ ("V" ?V)
+ ("v" ?v)
+ ("Z" ?Z)
+ ("z" ?z)
+ ("^Z" ?Ž)
+ ("^z" ?ž)
+ )
+
+(quail-define-package
+ "inari-sami-prefix" "Sámi" "/InS" nil
+ "Inari Sámi input method
+
+Alphabet (parenthesized letters are used in foreign names only):
+А а    Â â     B b     C c     Č č     D d     Đ đ     E e
+F f    G g     H h     I i     J j     K k     L l     M m
+N n    O o     P p     (Q q)   R r     S s     Š š     T t
+U u    V v     (W w)   (X x)   Y y     Z z     Ž ž     Ä ä
+Á á    Å å     Ö ö
+"
+ nil t nil nil nil nil nil nil nil nil t)
+
+(quail-define-rules
+ ("А" ?А)
+ ("а" ?а)
+ ("^A" ?Â)
+ ("^a" ?â)
+ ("B" ?B)
+ ("b" ?b)
+ ("C" ?C)
+ ("c" ?c)
+ ("^C" ?Č)
+ ("^c" ?č)
+ ("D" ?D)
+ ("d" ?d)
+ ("-D" ?Đ)
+ ("-d" ?đ)
+ ("E" ?E)
+ ("e" ?e)
+ ("F" ?F)
+ ("f" ?f)
+ ("G" ?G)
+ ("g" ?g)
+ ("H" ?H)
+ ("h" ?h)
+ ("I" ?I)
+ ("i" ?i)
+ ("J" ?J)
+ ("j" ?j)
+ ("K" ?K)
+ ("k" ?k)
+ ("L" ?L)
+ ("l" ?l)
+ ("M" ?M)
+ ("m" ?m)
+ ("N" ?N)
+ ("n" ?n)
+ ("O" ?O)
+ ("o" ?o)
+ ("P" ?P)
+ ("p" ?p)
+ ("Q" ?Q)
+ ("q" ?q)
+ ("R" ?R)
+ ("r" ?r)
+ ("S" ?S)
+ ("s" ?s)
+ ("^S" ?Š)
+ ("^s" ?š)
+ ("T" ?T)
+ ("t" ?t)
+ ("U" ?U)
+ ("u" ?u)
+ ("V" ?V)
+ ("v" ?v)
+ ("W" ?W)
+ ("w" ?w)
+ ("X" ?X)
+ ("x" ?x)
+ ("Y" ?Y)
+ ("y" ?y)
+ ("Z" ?Z)
+ ("z" ?z)
+ ("^Z" ?Ž)
+ ("^z" ?ž)
+ (":A" ?Ä)
+ (":a" ?ä)
+ ("'A" ?Á)
+ ("'a" ?á)
+ ("/A" ?Å)
+ ("/a" ?å)
+ (":O" ?Ö)
+ (":o" ?ö))
+
+(quail-define-package
+ "skolt-sami-prefix" "Sámi" "/SkS" nil
+ "Skolt Sámi input method
+
+Alphabet (parenthesized letters are used in foreign names only):
+А а    Â â     B b     C c     Č č     Ʒ ʒ     Ǯ ǯ     D d
+Đ đ    E e     F f     G g     Ǧ ǧ     Ǥ ǥ     H h     I i
+J j    K k     Ǩ ǩ     L l     M m     N n     Ŋ ŋ     O o
+Õ õ    P p     (Q q)   R r     S s     Š š     T t     U u
+V v    (W w)   (X x)   (Y y)   Z z     Ž ž     Å å     Ä ä
+(Ö ö)  ʹ
+"
+ nil t nil nil nil nil nil nil nil nil t)
+
+(quail-define-rules
+ ("A" ?А)
+ ("a" ?а)
+ ("^A" ?Â)
+ ("^a" ?â)
+ ("B" ?B)
+ ("b" ?b)
+ ("C" ?C)
+ ("c" ?c)
+ ("^C" ?Č)
+ ("^c" ?č)
+ ("/X" ?Ʒ)
+ ("/x" ?ʒ)
+ ("^X" ?Ǯ)
+ ("^x" ?ǯ)
+ ("D" ?D)
+ ("d" ?d)
+ ("-D" ?Đ)
+ ("-d" ?đ)
+ ("E" ?E)
+ ("e" ?e)
+ ("F" ?F)
+ ("f" ?f)
+ ("G" ?G)
+ ("g" ?g)
+ ("^G" ?Ǧ)
+ ("^g" ?ǧ)
+ ("-G" ?Ǥ)
+ ("-g" ?ǥ)
+ ("H" ?H)
+ ("h" ?h)
+ ("I" ?I)
+ ("i" ?i)
+ ("J" ?J)
+ ("j" ?j)
+ ("K" ?K)
+ ("k" ?k)
+ ("^K" ?Ǩ)
+ ("^k" ?ǩ)
+ ("L" ?L)
+ ("l" ?l)
+ ("M" ?M)
+ ("m" ?m)
+ ("N" ?N)
+ ("n" ?n)
+ ("/N" ?Ŋ)
+ ("/n" ?ŋ)
+ ("O" ?O)
+ ("o" ?o)
+ ("~O" ?Õ)
+ ("~o" ?õ)
+ ("P" ?P)
+ ("p" ?p)
+ ("Q" ?Q)
+ ("q" ?q)
+ ("R" ?R)
+ ("r" ?r)
+ ("S" ?S)
+ ("s" ?s)
+ ("^S" ?Š)
+ ("^s" ?š)
+ ("T" ?T)
+ ("t" ?t)
+ ("U" ?U)
+ ("u" ?u)
+ ("V" ?V)
+ ("v" ?v)
+ ("W" ?W)
+ ("w" ?w)
+ ("X" ?X)
+ ("x" ?x)
+ ("Y" ?Y)
+ ("y" ?y)
+ ("Z" ?Z)
+ ("z" ?z)
+ ("^Z" ?Ž)
+ ("^z" ?ž)
+ ("/A" ?Å)
+ ("/a" ?å)
+ (":A" ?Ä)
+ (":a" ?ä)
+ (":O" ?Ö)
+ (":o" ?ö))
+
+(quail-define-package
+ "kildin-sami-prefix" "Sámi" "/KiS" nil
+ "Kildin Sámi input method
+
+Alphabet (parenthesized letters are used in foreign names only):
+А а    А̄ а̄   Ӓ ӓ     Б б     В в     Г г     Д д     Е е     Е̄ е̄
+Ё ё    Ё̄ ё̄   Ж ж     З з     Һ һ     (')     И и     Ӣ ӣ     Й й
+Ј ј    (Ҋ ҋ)   К к     Л л     Ӆ ӆ     М м     Ӎ ӎ     Н н     Ӊ ӊ
+Ӈ ӈ    О о     О̄ о̄   П п     Р р     Ҏ ҏ     С с     Т т     У у
+Ӯ ӯ    Ф ф     Х х     Ц ц     Ч ч     Ш ш     Щ щ     Ъ ъ     Ы ы
+Ь ь    Ҍ ҍ     Э э     Э̄ э̄   Ӭ ӭ     Ю ю     Ю̄ ю̄   Я я     Я̄ я̄
+")
+
+(quail-define-rules
+ ("1" ?1)
+ ("2" ?2)
+ ("3" ?3)
+ ("4" ?4)
+ ("5" ?5)
+ ("6" ?6)
+ ("7" ?7)
+ ("8" ?8)
+ ("9" ?9)
+ ("0" ?0)
+ ("-" ?-)
+ ("=" ?ч)
+ ("`" ?ю)
+ ("-`" ["ю̄"])
+ ("q" ?я)
+ ("-q" ["я̄"])
+ ("w" ?в)
+ ("e" ?е)
+ ("-e" ["е̄"])
+ ("-@" ["ё̄"])
+ ("r" ?р)
+ ("-r" ?ҏ)
+ ("t" ?т)
+ ("y" ?ы)
+ ("u" ?у)
+ ("-u" ?ӯ)
+ ("i" ?и)
+ ("o" ?о)
+ ("-o" ["о̄"])
+ ("p" ?п)
+ ("[" ?ш)
+ ("]" ?щ)
+ ("a" ?а)
+ ("-a" ["а̄"])
+ (":a" ?ӓ)
+ ("s" ?с)
+ ("d" ?д)
+ ("f" ?ф)
+ ("g" ?г)
+ ("h" ?х)
+ ("/h" ?һ)
+ ("j" ?й)
+ ("-j" ["ӣ"])
+ ("'j" ?ҋ)
+ ("/j" ?ј)
+ ("k" ?к)
+ ("l" ?л)
+ ("'l" ?ӆ)
+ (";" ?\;)
+ ("'" ?')
+ ("\\" ?э)
+ ("-\\" ["э̄"])
+ (":\\" ?ӭ)
+ ("z" ?з)
+ ("x" ?ь)
+ ("-x" ?ҍ)
+ ("c" ?ц)
+ ("v" ?ж)
+ ("b" ?б)
+ ("n" ?н)
+ ("'n" ?ӊ)
+ (",n" ?ӈ)
+ ("m" ?м)
+ ("'m" ?ӎ)
+ ("," ?,)
+ ("." ?.)
+ ("/" ?/)
+
+ ("!" ?!)
+ ("@" ?ё)
+ ("#" ?ъ)
+ ("$" ?Ё)
+ ("%" ?%)
+ ("^" ?^)
+ ("&" ?&)
+ ("*" ?*)
+ ("(" ?\()
+ (")" ?\))
+ ("_" ?_)
+ ("+" ?Ч)
+ ("~" ?Ю)
+ ("-~" ["Ю̄"])
+ ("Q" ?Я)
+ ("-Q" ["Я̄"])
+ ("W" ?В)
+ ("E" ?Е)
+ ("-E" ["Е̄"])
+ ("-$" ["Ё̄"])
+ ("R" ?Р)
+ ("-R" ?Ҏ)
+ ("T" ?Т)
+ ("Y" ?Ы)
+ ("U" ?У)
+ ("-U" ["Ӯ"])
+ ("I" ?И)
+ ("O" ?О)
+ ("-O" ["О̄"])
+ ("P" ?П)
+ ("{" ?Ш)
+ ("}" ?Щ)
+ ("A" ?А)
+ ("-A" ["А̄"])
+ (":A" ?Ӓ)
+ ("S" ?С)
+ ("D" ?Д)
+ ("F" ?Ф)
+ ("G" ?Г)
+ ("H" ?Х)
+ ("/H" ?Һ)
+ ("J" ?Й)
+ ("-J" ["Ӣ"])
+ ("'J" ?Ҋ)
+ ("/J" ?Ј)
+ ("K" ?К)
+ ("L" ?Л)
+ ("'L" ?Ӆ)
+ (":" ?:)
+ ("\"" ?\")
+ ("|" ?Э)
+ ("-|" ["Э̄"])
+ (":|" ?Ӭ)
+ ("Z" ?З)
+ ("X" ?Ь)
+ ("-X" ?Ҍ)
+ ("C" ?Ц)
+ ("V" ?Ж)
+ ("B" ?Б)
+ ("N" ?Н)
+ ("'N" ?Ӊ)
+ (",N" ?Ӈ)
+ ("M" ?М)
+ ("'M" ?Ӎ)
+ ("<" ?<)
+ (">" ?>)
+ ("?" ??))
+
+;;; sami.el ends here
diff --git a/lisp/leim/quail/sgml-input.el b/lisp/leim/quail/sgml-input.el
index f39ac92..f94e7ad 100644
--- a/lisp/leim/quail/sgml-input.el
+++ b/lisp/leim/quail/sgml-input.el
@@ -1,6 +1,6 @@
 ;;; sgml-input.el --- Quail method for Unicode entered as SGML entities -*- 
coding: utf-8 -*-
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;; Keywords: i18n
diff --git a/lisp/leim/quail/sisheng.el b/lisp/leim/quail/sisheng.el
index 9ed9579..571ed54 100644
--- a/lisp/leim/quail/sisheng.el
+++ b/lisp/leim/quail/sisheng.el
@@ -1,6 +1,6 @@
 ;;; sisheng.el --- sisheng input method for Chinese pinyin transliteration
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Werner LEMBERG <address@hidden>
 
diff --git a/lisp/leim/quail/slovak.el b/lisp/leim/quail/slovak.el
index 48964dc..cf07790 100644
--- a/lisp/leim/quail/slovak.el
+++ b/lisp/leim/quail/slovak.el
@@ -1,6 +1,6 @@
 ;;; slovak.el --- Quail package for inputting Slovak  -*-coding: utf-8;-*-
 
-;; Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Authors: Tibor Šimko <address@hidden>
 ;;     Milan Zamazal <address@hidden>
diff --git a/lisp/leim/quail/symbol-ksc.el b/lisp/leim/quail/symbol-ksc.el
index 0500d64..4ed5e27 100644
--- a/lisp/leim/quail/symbol-ksc.el
+++ b/lisp/leim/quail/symbol-ksc.el
@@ -1,6 +1,6 @@
 ;;; symbol-ksc.el --- Quail-package for Korean Symbol (KSC5601) -*-coding: 
utf-8;-*-
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/tamil-dvorak.el b/lisp/leim/quail/tamil-dvorak.el
index 8c021b4..b7f3afa 100644
--- a/lisp/leim/quail/tamil-dvorak.el
+++ b/lisp/leim/quail/tamil-dvorak.el
@@ -1,6 +1,6 @@
 ;;; tamil-dvorak.el --- Quail package for Tamil input with Dvorak keyboard
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Shakthi Kannan <address@hidden>
 
diff --git a/lisp/leim/quail/tibetan.el b/lisp/leim/quail/tibetan.el
index 2b9c053..54f95b8 100644
--- a/lisp/leim/quail/tibetan.el
+++ b/lisp/leim/quail/tibetan.el
@@ -1,6 +1,6 @@
 ;;; tibetan.el --- Quail package for inputting Tibetan characters -*-coding: 
utf-8-emacs;-*-
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
 ;;   2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/leim/quail/uni-input.el b/lisp/leim/quail/uni-input.el
index 4014ebc..42499d0 100644
--- a/lisp/leim/quail/uni-input.el
+++ b/lisp/leim/quail/uni-input.el
@@ -1,6 +1,6 @@
 ;;; uni-input.el --- Hex Unicode input method
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
 ;;   Registration Number H14PRO021
diff --git a/lisp/leim/quail/vntelex.el b/lisp/leim/quail/vntelex.el
index 8c73107..78b467d 100644
--- a/lisp/leim/quail/vntelex.el
+++ b/lisp/leim/quail/vntelex.el
@@ -1,6 +1,6 @@
 ;;; vntelex.el --- Quail package for Vietnamese by Telex method
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author:   Werner Lemberg <address@hidden>
 ;; Keywords: multilingual, input method, Vietnamese
diff --git a/lisp/leim/quail/vnvni.el b/lisp/leim/quail/vnvni.el
index 0e98bc1..fc44cea 100644
--- a/lisp/leim/quail/vnvni.el
+++ b/lisp/leim/quail/vnvni.el
@@ -1,6 +1,6 @@
 ;;; vnvni.el --- Quail package for Vietnamese by VNI method
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author:   Werner Lemberg <address@hidden>
 ;;           Nguyen Thai Ngoc Duy <address@hidden>
diff --git a/lisp/leim/quail/welsh.el b/lisp/leim/quail/welsh.el
index fdbfe2b..36bcbeb 100644
--- a/lisp/leim/quail/welsh.el
+++ b/lisp/leim/quail/welsh.el
@@ -1,6 +1,6 @@
 ;;; welsh.el --- Quail package for inputting Welsh characters  -*-coding: 
utf-8;-*-
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;; Keywords: i18n
diff --git a/lisp/linum.el b/lisp/linum.el
index 6e673e5..0b4b008 100644
--- a/lisp/linum.el
+++ b/lisp/linum.el
@@ -1,6 +1,6 @@
 ;;; linum.el --- display line numbers in the left margin -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Markus Triska <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index 566d51a..4e5d8e0 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -1,6 +1,6 @@
 ;;; loadhist.el --- lisp functions for working with feature groups
 
-;; Copyright (C) 1995, 1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <address@hidden>
 ;; Maintainer: address@hidden
@@ -96,7 +96,8 @@ A library name is equivalent to the file name that 
`load-library' would load."
   (let ((provides (file-provides file))
        (dependents nil))
     (dolist (x load-history dependents)
-      (when (file-set-intersect provides (file-requires (car x)))
+      (when (and (stringp (car x))
+                 (file-set-intersect provides (file-requires (car x))))
        (push (car x) dependents)))))
 
 (defun read-feature (prompt &optional loaded-p)
diff --git a/lisp/loadup.el b/lisp/loadup.el
index 5ecfae1..67e8aa7 100644
--- a/lisp/loadup.el
+++ b/lisp/loadup.el
@@ -1,6 +1,6 @@
 ;;; loadup.el --- load up standardly loaded Lisp files for Emacs
 
-;; Copyright (C) 1985-1986, 1992, 1994, 2001-2018 Free Software
+;; Copyright (C) 1985-1986, 1992, 1994, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -26,6 +26,9 @@
 
 ;; This is loaded into a bare Emacs to make a dumpable one.
 
+;; Emacs injects the variable `dump-mode' to tell us how to dump.
+;; We unintern it before allowing user code to run.
+
 ;; If you add a file to be loaded here, keep the following points in mind:
 
 ;; i) If the file is no-byte-compile, explicitly load the .el version.
@@ -54,33 +57,58 @@
 ;; bidi.c needs for its job.
 (setq redisplay--inhibit-bidi t)
 
+(message "dump mode: %s" dump-mode)
+
 ;; Add subdirectories to the load-path for files that might get
-;; autoloaded when bootstrapping.
+;; autoloaded when bootstrapping or running Emacs normally.
 ;; This is because PATH_DUMPLOADSEARCH is just "../lisp".
-(if (or (equal (member "bootstrap" command-line-args) '("bootstrap"))
+(if (or (member dump-mode '("bootstrap" "pbootstrap"))
        ;; FIXME this is irritatingly fragile.
-       (and (stringp (nth 4 command-line-args))
-            (string-match "^unidata-gen\\(\\.elc?\\)?$"
-                          (nth 4 command-line-args)))
-       (member (nth 7 command-line-args) '("unidata-gen-file"
-                                           "unidata-gen-charprop"))
-       (if (fboundp 'dump-emacs)
-           (string-match "src/bootstrap-emacs" (nth 0 command-line-args))
-         t))
-    (let ((dir (car load-path)))
+        (and (stringp (nth 4 command-line-args))
+             (string-match "^unidata-gen\\(\\.elc?\\)?$"
+                           (nth 4 command-line-args)))
+        (member (nth 7 command-line-args) '("unidata-gen-file"
+                                            "unidata-gen-charprop"))
+        (null dump-mode))
+    (progn
+      ;; Find the entry in load-path that contains Emacs elisp and
+      ;; splice some additional directories in there for the benefit
+      ;; of autoload and regular Emacs use.
+      (let ((subdirs '("emacs-lisp"
+                       "progmodes"
+                       "language"
+                       "international"
+                       "textmodes"
+                       "vc"))
+            (iter load-path))
+        (while iter
+          (let ((dir (car iter))
+                (subdirs subdirs)
+                esubdirs esubdir)
+            (while subdirs
+              (setq esubdir (expand-file-name (car subdirs) dir))
+              (setq subdirs (cdr subdirs))
+              (if (file-directory-p esubdir)
+                  (setq esubdirs (cons esubdir esubdirs))
+                (setq subdirs nil esubdirs nil)))
+            (if esubdirs
+                (progn
+                  (setcdr iter (nconc (nreverse esubdirs) (cdr iter)))
+                  (setq iter nil))
+              (setq iter (cdr iter))
+              (if (null iter)
+                  (signal
+                   'error (list
+                           (format-message
+                            "Could not find elisp load-path: searched %S"
+                            load-path))))))))
       ;; We'll probably overflow the pure space.
       (setq purify-flag nil)
       ;; Value of max-lisp-eval-depth when compiling initially.
-      ;; During bootstrapping the byte-compiler is run interpreted when
-      ;; compiling itself, which uses a lot more stack than usual.
-      (setq max-lisp-eval-depth 2200)
-      (setq load-path (list (expand-file-name "." dir)
-                           (expand-file-name "emacs-lisp" dir)
-                           (expand-file-name "progmodes" dir)
-                           (expand-file-name "language" dir)
-                           (expand-file-name "international" dir)
-                           (expand-file-name "textmodes" dir)
-                           (expand-file-name "vc" dir)))))
+      ;; During bootstrapping the byte-compiler is run interpreted
+      ;; when compiling itself, which uses a lot more stack
+      ;; than usual.
+      (setq max-lisp-eval-depth 2200)))
 
 (if (eq t purify-flag)
     ;; Hash consing saved around 11% of pure space in my tests.
@@ -88,10 +116,7 @@
 
 (message "Using load-path %s" load-path)
 
-;; This is a poor man's `last', since we haven't loaded subr.el yet.
-(if (and (fboundp 'dump-emacs)
-         (or (equal (member "bootstrap" command-line-args) '("bootstrap"))
-             (equal (member "dump" command-line-args) '("dump"))))
+(if dump-mode
     (progn
       ;; To reduce the size of dumped Emacs, we avoid making huge char-tables.
       (setq inhibit-load-charset-map t)
@@ -350,15 +375,16 @@ lost after dumping")))
 ;; file primitive.  So the only workable solution to support building
 ;; in non-ASCII directories is to manipulate unibyte strings in the
 ;; current locale's encoding.
-(if (and (member (car (last command-line-args)) '("dump" "bootstrap"))
-         (fboundp 'dump-emacs)
-        (multibyte-string-p default-directory))
+(if (and dump-mode (multibyte-string-p default-directory))
     (error "default-directory must be unibyte when dumping Emacs!"))
 
 ;; Determine which build number to use
 ;; based on the executables that now exist.
-(if (and (equal (last command-line-args) '("dump"))
-         (fboundp 'dump-emacs)
+(if (and (or
+          (and (equal dump-mode "dump")
+               (fboundp 'dump-emacs))
+          (and (equal dump-mode "pdump")
+               (fboundp 'dump-emacs-portable)))
         (not (eq system-type 'ms-dos)))
     (let* ((base (concat "emacs-" emacs-version "."))
           (exelen (if (eq system-type 'windows-nt) -4))
@@ -368,16 +394,18 @@ lost after dumping")))
                                (string-to-number
                                 (substring name (length base) exelen))))
                             files)))
-      (setq emacs-repository-version (condition-case nil 
(emacs-repository-get-version)
-                              (error nil)))
+      (setq emacs-repository-version (ignore-errors 
(emacs-repository-get-version))
+            emacs-repository-branch (ignore-errors 
(emacs-repository-get-branch)))
       ;; A constant, so we shouldn't change it with `setq'.
       (defconst emacs-build-number
        (if versions (1+ (apply 'max versions)) 1))))
 
 
 (message "Finding pointers to doc strings...")
-(if (and (fboundp 'dump-emacs)
-         (equal (last command-line-args) '("dump")))
+(if (and (or (and (fboundp 'dump-emacs)
+                  (equal dump-mode "dump"))
+             (and (fboundp 'dump-emacs-portable)
+                  (equal dump-mode "pdump"))))
     (Snarf-documentation "DOC")
   (condition-case nil
       (Snarf-documentation "DOC")
@@ -446,53 +474,69 @@ lost after dumping")))
 ;; Make sure we will attempt bidi reordering henceforth.
 (setq redisplay--inhibit-bidi nil)
 
-(if (and (fboundp 'dump-emacs)
-         (member (car (last command-line-args)) '("dump" "bootstrap")))
-    (progn
-      ;; Prevent build-time PATH getting stored in the binary.
-      ;; Mainly cosmetic, but helpful for Guix.  (Bug#20330)
-      ;; Do this here, rather than earlier, so that the above code
-      ;; can invoke Git commands and the like.
-      (setq exec-path nil)
-      (message "Dumping under the name emacs")
+(if dump-mode
+    (let ((output (cond ((equal dump-mode "pdump") "emacs.pdmp")
+                        ((equal dump-mode "dump") "emacs")
+                        ((equal dump-mode "bootstrap") "emacs")
+                        ((equal dump-mode "pbootstrap") "bootstrap-emacs.pdmp")
+                        (t (error "unrecognized dump mode %s" dump-mode)))))
+      (message "Dumping under the name %s" output)
       (condition-case ()
-         (delete-file "emacs")
-       (file-error nil))
-      ;; We used to dump under the name xemacs, but that occasionally
-      ;; confused people installing Emacs (they'd install the file
-      ;; under the name `xemacs'), and it's inconsistent with every
-      ;; other GNU program's build process.
-      (dump-emacs "emacs" "temacs")
-      (message "%d pure bytes used" pure-bytes-used)
+          (delete-file output)
+        (file-error nil))
+      ;; On MS-Windows, the current directory is not necessarily the
+      ;; same as invocation-directory.
+      (let (success)
+        (unwind-protect
+             (let ((tmp-dump-mode dump-mode)
+                   (dump-mode nil))
+               (if (member tmp-dump-mode '("pdump" "pbootstrap"))
+                   (dump-emacs-portable (expand-file-name output 
invocation-directory))
+                 (dump-emacs output "temacs")
+                 (message "%d pure bytes used" pure-bytes-used))
+               (setq success t))
+          (unless success
+            (ignore-errors
+              (delete-file output)))))
       ;; Recompute NAME now, so that it isn't set when we dump.
       (if (not (or (eq system-type 'ms-dos)
                    ;; Don't bother adding another name if we're just
                    ;; building bootstrap-emacs.
-                   (equal (last command-line-args) '("bootstrap"))))
-         (let ((name (format "emacs-%s.%d" emacs-version emacs-build-number))
-               (exe (if (eq system-type 'windows-nt) ".exe" "")))
-           (while (string-match "[^-+_.a-zA-Z0-9]+" name)
-             (setq name (concat (downcase (substring name 0 (match-beginning 
0)))
-                                "-"
-                                (substring name (match-end 0)))))
-           (setq name (concat name exe))
-            (message "Adding name %s" name)
-           ;; When this runs on Windows, invocation-directory is not
-           ;; necessarily the current directory.
-           (add-name-to-file (expand-file-name (concat "emacs" exe)
-                                               invocation-directory)
-                             (expand-file-name name invocation-directory)
-                             t)))
+                   (member dump-mode '("pbootstrap" "bootstrap"))))
+          (let ((name (format "emacs-%s.%d" emacs-version emacs-build-number))
+                (exe (if (eq system-type 'windows-nt) ".exe" "")))
+            (while (string-match "[^-+_.a-zA-Z0-9]+" name)
+              (setq name (concat (downcase (substring name 0 (match-beginning 
0)))
+                                 "-"
+                                 (substring name (match-end 0)))))
+            (message "Adding name %s" (concat name exe))
+            ;; When this runs on Windows, invocation-directory is not
+            ;; necessarily the current directory.
+            (add-name-to-file (expand-file-name (concat "emacs" exe)
+                                                invocation-directory)
+                              (expand-file-name (concat name exe)
+                                                invocation-directory)
+                              t)
+            (when (equal dump-mode "pdump")
+              (message "Adding name %s" (concat name ".pdmp"))
+              (add-name-to-file (expand-file-name "emacs.pdmp"
+                                                  invocation-directory)
+                                (expand-file-name (concat name ".pdmp")
+                                                  invocation-directory)
+                                t))))
       (kill-emacs)))
 
-;; For machines with CANNOT_DUMP defined in config.h,
-;; this file must be loaded each time Emacs is run.
+;; This file must be loaded each time Emacs is run from scratch, e.g., temacs.
 ;; So run the startup code now.  First, remove `-l loadup' from args.
 
 (if (and (member (nth 1 command-line-args) '("-l" "--load"))
         (equal (nth 2 command-line-args) "loadup"))
     (setcdr command-line-args (nthcdr 3 command-line-args)))
 
+;; Don't keep `load-file-name' set during the top-level session!
+;; Otherwise, it breaks a lot of code which does things like
+;; (or load-file-name byte-compile-current-file).
+(setq load-file-name nil)
 (eval top-level)
 
 
diff --git a/lisp/locate.el b/lisp/locate.el
index d2e640e..452f746 100644
--- a/lisp/locate.el
+++ b/lisp/locate.el
@@ -1,6 +1,6 @@
-;;; locate.el --- interface to the locate command
+;;; locate.el --- interface to the locate command  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1996, 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Peter Breton <address@hidden>
 ;; Keywords: unix files
@@ -261,7 +261,7 @@ that is, with a prefix arg, you get the default behavior."
         "Run locate (like this): "
         (cons
          (concat (car locate-cmd) "  "
-                 (mapconcat 'identity (cdr locate-cmd) " "))
+                 (mapconcat #'identity (cdr locate-cmd) " "))
          (+ 2 (length (car locate-cmd))))
         nil nil 'locate-history-list))
     (let* ((default (locate-word-at-point))
@@ -313,7 +313,7 @@ then `locate-post-command-hook'."
              (and (not arg) locate-prompt-for-command))))
 
     ;; Find the Locate buffer
-    (save-window-excursion
+    (save-window-excursion              ;FIXME: What window-excursion?
       (set-buffer (get-buffer-create locate-buffer-name))
       (locate-mode)
       (let ((inhibit-read-only t)
@@ -327,7 +327,7 @@ then `locate-post-command-hook'."
 
        (if run-locate-command
            (shell-command search-string locate-buffer-name)
-         (apply 'call-process locate-cmd nil t nil locate-cmd-args))
+         (apply #'call-process locate-cmd nil t nil locate-cmd-args))
 
        (and filter
             (locate-filter-output filter))
@@ -466,8 +466,8 @@ do not work in subdirectories.
   ;; Avoid clobbering this variable
   (make-local-variable 'dired-subdir-alist)
   (setq default-directory   "/"
-       buffer-read-only    t
-       selective-display   t)
+       buffer-read-only    t)
+  (add-to-invisibility-spec '(dired . t))
   (dired-alist-add-1 default-directory (point-min-marker))
   (set (make-local-variable 'dired-directory) "/")
   (set (make-local-variable 'dired-subdir-switches) locate-ls-subdir-switches)
@@ -499,9 +499,9 @@ do not work in subdirectories.
         (progn
           (kill-buffer locate-buffer-name)
           (if locate-current-filter
-              (error "Locate: no match for %s in database using filter %s"
+              (user-error "Locate: no match for %s in database using filter %s"
                      search-string locate-current-filter)
-            (error "Locate: no match for %s in database" search-string))))
+            (user-error "Locate: no match for %s in database" search-string))))
 
     (locate-insert-header search-string)
 
@@ -554,7 +554,7 @@ do not work in subdirectories.
          locate-regexp-match
          (concat locate-regexp-match ":\n"))
 
-    (insert (apply 'format locate-format-string (reverse locate-format-args)))
+    (insert (apply #'format locate-format-string (reverse locate-format-args)))
 
     (save-excursion
       (goto-char (point-min))
diff --git a/lisp/lpr.el b/lisp/lpr.el
index 33b8da8..436f9e3 100644
--- a/lisp/lpr.el
+++ b/lisp/lpr.el
@@ -1,6 +1,6 @@
 ;;; lpr.el --- print Emacs buffer on line printer
 
-;; Copyright (C) 1985, 1988, 1992, 1994, 2001-2018 Free Software
+;; Copyright (C) 1985, 1988, 1992, 1994, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -258,7 +258,7 @@ for further customization of the printer command."
 
 (defun lpr-print-region (start end switches name)
   (let ((buf (current-buffer))
-        (nswitches (lpr-flatten-list
+        (nswitches (flatten-tree
                     (mapcar #'lpr-eval-switch ; Dynamic evaluation
                             switches)))
         (switch-string (if switches
@@ -336,23 +336,7 @@ The characters tab, linefeed, space, return and formfeed 
are not affected."
        ((consp arg) (apply (car arg) (cdr arg)))
        (t nil)))
 
-;; `lpr-flatten-list' is defined here (copied from "message.el" and
-;; enhanced to handle dotted pairs as well) until we can get some
-;; sensible autoloads, or `flatten-list' gets put somewhere decent.
-
-;; (lpr-flatten-list '((a . b) c (d . e) (f g h) i . j))
-;; => (a b c d e f g h i j)
-
-(defun lpr-flatten-list (&rest list)
-  (lpr-flatten-list-1 list))
-
-(defun lpr-flatten-list-1 (list)
-  (cond
-   ((null list) nil)
-   ((consp list)
-    (append (lpr-flatten-list-1 (car list))
-           (lpr-flatten-list-1 (cdr list))))
-   (t (list list))))
+(define-obsolete-function-alias 'lpr-flatten-list #'flatten-tree "27.1")
 
 (provide 'lpr)
 
diff --git a/lisp/ls-lisp.el b/lisp/ls-lisp.el
index 95f3163..1f2c468 100644
--- a/lisp/ls-lisp.el
+++ b/lisp/ls-lisp.el
@@ -1,6 +1,6 @@
 ;;; ls-lisp.el --- emulate insert-directory completely in Emacs Lisp  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1992, 1994, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1994, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Sebastian Kremer <address@hidden>
 ;; Modified by: Francis J. Wright <address@hidden>
@@ -475,9 +475,13 @@ not contain `d', so that a full listing is expected."
                       (ls-lisp-classify-file file fattr)
                     file)
                   fattr (file-attribute-size fattr)
-                                 switches time-index))
-       (message "%s: doesn't exist or is inaccessible" file)
-       (ding) (sit-for 2)))))          ; to show user the message!
+                   switches time-index))
+        ;; Emulate what we do on Posix hosts when we call access-file
+        ;; in insert-directory.
+       (signal 'file-error
+                (list "Reading directory"
+                      "Directory doesn't exist or is inaccessible"
+                      file))))))
 
 (declare-function dired-read-dir-and-switches "dired" (str))
 (declare-function dired-goto-next-file "dired" ())
diff --git a/lisp/macros.el b/lisp/macros.el
index 4078b98..ba6a840 100644
--- a/lisp/macros.el
+++ b/lisp/macros.el
@@ -1,6 +1,6 @@
 ;;; macros.el --- non-primitive commands for keyboard macros -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985-1987, 1992, 1994-1995, 2001-2018 Free Software
+;; Copyright (C) 1985-1987, 1992, 1994-1995, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/mail/binhex.el b/lisp/mail/binhex.el
index fa2ea3d..19fcbaa 100644
--- a/lisp/mail/binhex.el
+++ b/lisp/mail/binhex.el
@@ -1,6 +1,6 @@
 ;;; binhex.el --- decode BinHex-encoded text  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <address@hidden>
 ;; Keywords: binhex news
diff --git a/lisp/mail/blessmail.el b/lisp/mail/blessmail.el
index 62e9873..62094bf 100644
--- a/lisp/mail/blessmail.el
+++ b/lisp/mail/blessmail.el
@@ -1,6 +1,6 @@
 ;;; blessmail.el --- decide whether movemail needs special privileges -*- 
no-byte-compile: t -*-
 
-;; Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: internal
diff --git a/lisp/mail/emacsbug.el b/lisp/mail/emacsbug.el
index 8cacad8..c637e24 100644
--- a/lisp/mail/emacsbug.el
+++ b/lisp/mail/emacsbug.el
@@ -1,6 +1,6 @@
 ;;; emacsbug.el --- command to report Emacs bugs to appropriate mailing list
 
-;; Copyright (C) 1985, 1994, 1997-1998, 2000-2018 Free Software
+;; Copyright (C) 1985, 1994, 1997-1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: K. Shane Hartman
@@ -69,6 +69,7 @@
 (declare-function x-server-vendor "xfns.c" (&optional terminal))
 (declare-function x-server-version "xfns.c" (&optional terminal))
 (declare-function message-sort-headers "message" ())
+(declare-function w32--os-description "w32-fns" ())
 (defvar message-strip-special-text-properties)
 
 (defun report-emacs-bug-can-use-osx-open ()
@@ -307,6 +308,8 @@ usually do not have translators for other languages.\n\n")))
 
     (if (stringp emacs-repository-version)
        (insert "Repository revision: " emacs-repository-version "\n"))
+    (if (stringp emacs-repository-branch)
+       (insert "Repository branch: " emacs-repository-branch "\n"))
     (if (fboundp 'x-server-vendor)
        (condition-case nil
             ;; This is used not only for X11 but also W32 and others.
diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el
index 2b63343..a90d9c4 100644
--- a/lisp/mail/feedmail.el
+++ b/lisp/mail/feedmail.el
@@ -561,7 +561,7 @@ but common in some proprietary systems."
 ;; maybe some distant mail system needs it.  Really, though, if you
 ;; want a sender line in your mail, just put one in there and don't
 ;; wait for feedmail to do it for you.  (Yes, I know all about
-;; RFC-822 and RFC-1123, but are you *really* one of those cases
+;; RFC-822-or-later and RFC-1123, but are you *really* one of those cases
 ;; they're talking about?  I doubt it.)
 (defcustom feedmail-sender-line nil
   "If non-nil and the email has no Sender: header, use this value.
@@ -787,7 +787,7 @@ cases the name element of the fiddle-plex is ignored and is 
hardwired
 by feedmail to either \"Date\" or \"Resent-Date\".
 
 If you decide to format your own date field, do us all a favor and know
-what you're doing.  Study the relevant parts of RFC-822 and RFC-1123.
+what you're doing.  Study the relevant parts of RFC-822-or-later and RFC-1123.
 Don't make me come up there!
 
 You should let feedmail generate a Date: for you unless you are sure
@@ -1514,7 +1514,7 @@ function, for example, to archive all of your sent 
messages someplace
 
 
 (defvar feedmail-is-a-resend nil
-  "Non-nil means the message is a Resend (in the RFC-822 sense).
+  "Non-nil means the message is a Resend (in the RFC-822-or-later sense).
 This affects the composition of certain headers.  feedmail sets this
 variable as soon as it starts prepping the message text buffer, so any
 user-supplied functions can rely on it.  Users shouldn't set or change this
@@ -2369,7 +2369,7 @@ mapped to mostly alphanumerics for safety."
 
 (defun feedmail-rfc822-date (arg-time)
   (feedmail-say-debug ">in-> feedmail-rfc822-date %s" arg-time)
-  (let ((time (if arg-time arg-time (current-time)))
+  (let ((time (or arg-time (current-time)))
        (system-time-locale "C"))
     (concat
      (format-time-string "%a, %e %b %Y %T " time)
@@ -2443,7 +2443,7 @@ mapped to mostly alphanumerics for safety."
 
          (let ((case-fold-search t) (addr-regexp))
            (goto-char (point-min))
-           ;; There are some RFC-822 combinations/cases missed here,
+           ;; There are some RFC-822-or-later combinations/cases missed here,
            ;; but probably good enough and what users expect.
            ;;
            ;; Use resent-* stuff only if there is at least one non-empty one.
diff --git a/lisp/mail/flow-fill.el b/lisp/mail/flow-fill.el
index db2a30a..06279d4 100644
--- a/lisp/mail/flow-fill.el
+++ b/lisp/mail/flow-fill.el
@@ -1,6 +1,6 @@
 ;;; flow-fill.el --- interpret RFC2646 "flowed" text  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 ;; Keywords: mail
diff --git a/lisp/mail/footnote.el b/lisp/mail/footnote.el
index f5d280a..81dc11d 100644
--- a/lisp/mail/footnote.el
+++ b/lisp/mail/footnote.el
@@ -1,6 +1,6 @@
 ;;; footnote.el --- footnote support for message mode  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1997, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Steven L Baur <address@hidden> (1997-2011)
 ;;         Boruch Baum <address@hidden> (2017-)
@@ -363,7 +363,9 @@ Use Unicode characters for footnoting."
     ("ק" "ר" "ש" "ת" "תק" "תר" "תש" "תת" "תתק")))
 
 (defconst footnote-hebrew-numeric-regex
-  (concat "[" (apply #'concat (apply #'append footnote-hebrew-numeric)) "']+"))
+  (let ((numchars (string-to-list
+                  (apply #'concat (apply #'append footnote-hebrew-numeric)))))
+    (concat (regexp-opt-charset (cons ?' numchars)) "+")))
 ;; (defconst footnote-hebrew-numeric-regex 
"\\([אבגדהוזחט]'\\)?\\(ת\\)?\\(ת\\)?\\([קרשת]\\)?\\([טיכלמנסעפצ]\\)?\\([אבגדהוזחט]\\)?")
 
 (defun footnote--hebrew-numeric (n)
@@ -457,9 +459,19 @@ Conversion is done based upon the current selected style."
 
 (defun footnote--current-regexp ()
   "Return the regexp of the index of the current style."
-  (concat (nth 2 (or (assq footnote-style footnote-style-alist)
-                    (nth 0 footnote-style-alist)))
-         "*"))
+  (let ((regexp (nth 2 (or (assq footnote-style footnote-style-alist)
+                          (nth 0 footnote-style-alist)))))
+    (concat
+     ;; Hack to avoid repetition of repetition.
+     ;; FIXME: I'm not sure the added * makes sense at all; there is
+     ;; always a single number within the footnote-{start,end}-tag pairs.
+     ;; Worse, the code goes on and adds yet another + later on, in
+     ;; footnote-refresh-footnotes, just in case. That makes even less sense.
+     ;; Likely, both the * and the extra + should go away.
+     (if (string-match "[^\\]\\\\\\{2\\}*[*+?]\\'" regexp)
+        (substring regexp 0 -1)
+       regexp)
+     "*")))
 
 (defun footnote--refresh-footnotes (&optional index-regexp)
   "Redraw all footnotes.
diff --git a/lisp/mail/hashcash.el b/lisp/mail/hashcash.el
index 37b2d94..6068952 100644
--- a/lisp/mail/hashcash.el
+++ b/lisp/mail/hashcash.el
@@ -1,6 +1,6 @@
 ;;; hashcash.el --- Add hashcash payments to email  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003-2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Written by: Paul Foley <address@hidden> (1997-2002)
 ;; Maintainer: address@hidden
@@ -182,8 +182,7 @@ Return immediately.  Call CALLBACK with process and result 
when ready."
        (setq hashcash-process-alist (cons
                                      (cons process (current-buffer))
                                      hashcash-process-alist))
-       (set-process-filter process `(lambda (process output)
-                                      (funcall ,callback process output))))
+       (set-process-filter process callback))
     (funcall callback nil nil)))
 
 (defun hashcash-check-payment (token str val)
@@ -244,8 +243,9 @@ Only start calculation.  Results are inserted when ready."
     (hashcash-generate-payment-async
      (hashcash-payment-to arg)
      (hashcash-payment-required arg)
-     `(lambda (process payment)
-       (hashcash-insert-payment-async-2 ,(current-buffer) process payment)))))
+     (let ((buf (current-buffer)))
+       (lambda (process payment)
+         (hashcash-insert-payment-async-2 buf process payment))))))
 
 (defun hashcash-insert-payment-async-2 (buffer process pay)
   (when (buffer-live-p buffer)
diff --git a/lisp/mail/ietf-drums.el b/lisp/mail/ietf-drums.el
index 0af3221..29752cb 100644
--- a/lisp/mail/ietf-drums.el
+++ b/lisp/mail/ietf-drums.el
@@ -1,6 +1,6 @@
-;;; ietf-drums.el --- Functions for parsing RFC822bis headers  -*- 
lexical-binding:t -*-
+;;; ietf-drums.el --- Functions for parsing RFC 2822 headers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; This file is part of GNU Emacs.
@@ -20,10 +20,10 @@
 
 ;;; Commentary:
 
-;; DRUMS is an IETF Working Group that works (or worked) on the
-;; successor to RFC822, "Standard For The Format Of Arpa Internet Text
-;; Messages".  This library is based on
-;; draft-ietf-drums-msg-fmt-05.txt, released on 1998-08-05.
+;; DRUMS is an IETF Working Group that worked on Internet RFC 2822,
+;; the successor to RFC 822 and the predecessor of RFC 5322.  This
+;; library is based on draft-ietf-drums-msg-fmt-05.txt, released on
+;; 1998-08-05.
 
 ;; Pending a real regression self test suite, Simon Josefsson added
 ;; various self test expressions snipped from bug reports, and their
@@ -294,7 +294,7 @@ a list of address strings."
 
 (defun ietf-drums-parse-date (string)
   "Return an Emacs time spec from STRING."
-  (apply 'encode-time (parse-time-string string)))
+  (encode-time (parse-time-string string)))
 
 (defun ietf-drums-narrow-to-header ()
   "Narrow to the header section in the current buffer."
diff --git a/lisp/mail/mail-extr.el b/lisp/mail/mail-extr.el
index 0175c68..cb57d8e 100644
--- a/lisp/mail/mail-extr.el
+++ b/lisp/mail/mail-extr.el
@@ -1,6 +1,6 @@
-;;; mail-extr.el --- extract full name and address from RFC 822 mail header
+;;; mail-extr.el --- extract full name and address from email header
 
-;; Copyright (C) 1991-1994, 1997, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1991-1994, 1997, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Joe Wells <address@hidden>
@@ -29,15 +29,15 @@
 ;;
 ;;    mail-extract-address-components: (address &optional all)
 ;;
-;;    Given an RFC-822 ADDRESS, extract full name and canonical address.
+;;    Given an RFC-822-or-later ADDRESS, extract name and address.
 ;;    Returns a list of the form (FULL-NAME CANONICAL-ADDRESS).
 ;;    If no name can be extracted, FULL-NAME will be nil.
 ;;    ADDRESS may be a string or a buffer.  If it is a buffer, the visible
 ;;     (narrowed) portion of the buffer will be interpreted as the address.
 ;;     (This feature exists so that the clever caller might be able to avoid
 ;;     consing a string.)
-;;    If ADDRESS contains more than one RFC-822 address, only the first is
-;;     returned.
+;;    If ADDRESS contains more than one RFC-822-or-later address, only
+;;     the first is returned.
 ;;
 ;;    If ALL is non-nil, that means return info about all the addresses
 ;;     that are found in ADDRESS.  The value is a list of elements of
@@ -149,7 +149,7 @@
 ;;     * Handle "null" addresses.  Handle = used for spacing in mailbox
 ;;       name.  Fix bug in handling of ROUTE-ADDR-type addresses that are
 ;;       missing their brackets.  Handle uppercase "JR".  Extract full
-;;       names from X.400 addresses encoded in RFC-822.  Fix bug in
+;;       names from X.400 addresses encoded in RFC-822-or-later.  Fix bug in
 ;;        handling of multiple addresses where first has trailing comment.
 ;;        Handle more kinds of telephone extension lead-ins.
 ;;
@@ -209,7 +209,7 @@
 
 
 (defgroup mail-extr nil
-  "Extract full name and address from RFC 822 mail header."
+  "Extract full name and address from RFC 822 (or later) mail header."
   :prefix "mail-extr-"
   :group 'mail)
 
@@ -288,11 +288,12 @@ by translating things like \"address@hidden" into 
\"address@hidden"."
 (defconst mail-extr-all-letters-but-separators
   (purecopy "][[:alnum:]{|}'~`"))
 
-;; Any character that can occur in a name in an RFC822 address including
-;; the separator (hyphen and possibly period) for multipart names.
+;; Any character that can occur in a name in an RFC 822 (or later)
+;; address including the separator (hyphen and possibly period) for
+;; multipart names.
 ;; #### should . be in here?
 (defconst mail-extr-all-letters
-  (purecopy (concat mail-extr-all-letters-but-separators "---")))
+  (purecopy (concat mail-extr-all-letters-but-separators "-")))
 
 ;; Any character that can start a name.
 ;; Keep this set as minimal as possible.
@@ -304,19 +305,11 @@ by translating things like \"address@hidden" into 
\"address@hidden"."
 
 (defconst mail-extr-leading-garbage "\\W+")
 
-;; (defconst mail-extr-non-name-chars
-;;   (purecopy (concat "^" mail-extr-all-letters ".")))
 ;; (defconst mail-extr-non-begin-name-chars
 ;;   (purecopy (concat "^" mail-extr-first-letters)))
 ;; (defconst mail-extr-non-end-name-chars
 ;;   (purecopy (concat "^" mail-extr-last-letters)))
 
-;; Matches an initial not followed by both a period and a space.
-;; (defconst mail-extr-bad-initials-pattern
-;;   (purecopy
-;;    (format "\\(\\([^%s]\\|\\`\\)[%s]\\)\\(\\.\\([^ ]\\)\\| \\|\\([^%s 
.]\\)\\|\\'\\)"
-;;            mail-extr-all-letters mail-extr-first-letters 
mail-extr-all-letters)))
-
 ;; Matches periods used instead of spaces.  Must not match the period
 ;; following an initial.
 (defconst mail-extr-bad-dot-pattern
@@ -532,7 +525,8 @@ by translating things like \"address@hidden" into 
\"address@hidden"."
     (?.  ".")
     (?\[ ".")
     (?\] ".")
-    ;; % and ! aren't RFC822 characters, but it is convenient to pretend
+    ;; % and ! aren't RFC 822 (or later) characters,
+    ;; but it is convenient to pretend.
     (?%  ".")
     (?!  ".") ;; this needs to be word-constituent when not in .UUCP mode
     )
@@ -652,7 +646,7 @@ Unless NO-REPLACE is true, at each of the positions in 
LIST-SYMBOL
                   (< ch ,beg-symbol))
           ,@(if no-replace
                   nil
-                `((mail-extr-nuke-char-at ch)))
+              '((mail-extr-nuke-char-at ch)))
           (setcar temp nil))
         (setq temp (cdr temp)))
        (setq ,list-symbol (delq nil ,list-symbol))))
@@ -697,7 +691,8 @@ Unless NO-REPLACE is true, at each of the positions in 
LIST-SYMBOL
 
 ;;;###autoload
 (defun mail-extract-address-components (address &optional all)
-  "Given an RFC-822 address ADDRESS, extract full name and canonical address.
+  "Extract full name and canonical address from ADDRESS.
+ADDRESS should be in RFC 822 (or later) format.
 Returns a list of the form (FULL-NAME CANONICAL-ADDRESS).  If no
 name can be extracted, FULL-NAME will be nil.  Also see
 `mail-extr-ignore-single-names' and
@@ -936,10 +931,10 @@ non-display use, you should probably use
          ;; Trim other punctuation lists of items outside < > pair to handle
          ;; stupid MTAs.
          (when <-pos                   ; don't need to check >-pos also
-           ;; handle bozo software that violates RFC 822 by sticking
-           ;; punctuation marks outside of a < > pair
+           ;; Handle bozo software that violates RFC 822 (or later)
+           ;; by sticking punctuation marks outside of a < > pair.
            (mail-extr-nuke-outside-range @-pos <-pos >-pos t)
-           ;; RFC 822 says nothing about these two outside < >, but
+           ;; RFC 822 (or later) says nothing about these two outside < >, but
            ;; remove those positions from the lists to make things
            ;; easier.
            (mail-extr-nuke-outside-range !-pos <-pos >-pos t)
@@ -1325,7 +1320,7 @@ non-display use, you should probably use
                       (narrow-to-region atom-beg atom-end)
                       (cond
 
-                       ;; Handle X.400 addresses encoded in RFC-822.
+                       ;; Handle X.400 addresses encoded in RFC 822 or later.
                        ;; *** Shit!  This has to handle the case where it is
                        ;; *** embedded in a quote too!
                        ;; *** Shit!  The input is being broken up into atoms
diff --git a/lisp/mail/mail-hist.el b/lisp/mail/mail-hist.el
index d5cd06e..9a2fb91 100644
--- a/lisp/mail/mail-hist.el
+++ b/lisp/mail/mail-hist.el
@@ -1,6 +1,6 @@
 ;;; mail-hist.el --- headers and message body history for outgoing mail
 
-;; Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Karl Fogel <address@hidden>
 ;; Created: March, 1994
diff --git a/lisp/mail/mail-parse.el b/lisp/mail/mail-parse.el
index 8883db8..d5da9d4 100644
--- a/lisp/mail/mail-parse.el
+++ b/lisp/mail/mail-parse.el
@@ -1,6 +1,6 @@
 ;;; mail-parse.el --- Interface functions for parsing mail
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/mail-prsvr.el b/lisp/mail/mail-prsvr.el
index d8efef7..1240033 100644
--- a/lisp/mail/mail-prsvr.el
+++ b/lisp/mail/mail-prsvr.el
@@ -1,6 +1,6 @@
 ;;; mail-prsvr.el --- Interface variables for parsing mail
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el
index 463cec0..cbcbdfa 100644
--- a/lisp/mail/mail-utils.el
+++ b/lisp/mail/mail-utils.el
@@ -1,6 +1,6 @@
 ;;; mail-utils.el --- utility functions used both by rmail and rnews
 
-;; Copyright (C) 1985, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: mail, news
@@ -29,7 +29,7 @@
 
 ;;;###autoload
 (defcustom mail-use-rfc822 nil
-  "If non-nil, use a full, hairy RFC822 parser on mail addresses.
+  "If non-nil, use a full, hairy RFC 822 (or later) parser on mail addresses.
 Otherwise, (the default) use a smaller, somewhat faster, and
 often correct parser."
   :type 'boolean
@@ -384,7 +384,7 @@ The buffer should be narrowed to just the header."
         (date (mail-fetch-field "date"))
         ;; A From: header can contain multiple addresses, a "From "
         ;; line must contain only one.  (Bug#7760)
-        ;; See eg RFC 5322, 3.6.2. Originator Fields.
+        ;; See, e.g., RFC 5322, 3.6.2. Originator Fields.
         (end (string-match "[ \t]*[,\n]" from)))
     (format "From %s %s\n" (if end
                               (substring from 0 end)
diff --git a/lisp/mail/mailabbrev.el b/lisp/mail/mailabbrev.el
index e5456d9..d59df88 100644
--- a/lisp/mail/mailabbrev.el
+++ b/lisp/mail/mailabbrev.el
@@ -1,6 +1,6 @@
 ;;; mailabbrev.el --- abbrev-expansion of mail aliases
 
-;; Copyright (C) 1985-1987, 1992-1993, 1996-1997, 2000-2018 Free
+;; Copyright (C) 1985-1987, 1992-1993, 1996-1997, 2000-2019 Free
 ;; Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski <address@hidden; now address@hidden>
diff --git a/lisp/mail/mailalias.el b/lisp/mail/mailalias.el
index 17b4cdf..42896c1 100644
--- a/lisp/mail/mailalias.el
+++ b/lisp/mail/mailalias.el
@@ -1,6 +1,6 @@
 ;;; mailalias.el --- expand and complete mailing address aliases -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1985, 1987, 1995-1997, 2001-2018 Free Software
+;; Copyright (C) 1985, 1987, 1995-1997, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/mail/mailclient.el b/lisp/mail/mailclient.el
index 9678a3a..4d8cda1 100644
--- a/lisp/mail/mailclient.el
+++ b/lisp/mail/mailclient.el
@@ -1,6 +1,6 @@
 ;;; mailclient.el --- mail sending via system's mail client.
 
-;; Copyright (C) 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: David Reitter <address@hidden>
 ;; Keywords: mail
@@ -152,7 +152,7 @@ The mail client is taken to be the handler of mailto URLs."
                  (setq character-coding (downcase character-coding)))
                (concat
                 "mailto:";
-                ;; some of the headers according to RFC822
+                ;; Some of the headers according to RFC 822 (or later).
                 (mailclient-gather-addresses "To"
                                              'drop-first-name)
                 (mailclient-gather-addresses "cc"  )
diff --git a/lisp/mail/mailheader.el b/lisp/mail/mailheader.el
index 349e045..936f53e 100644
--- a/lisp/mail/mailheader.el
+++ b/lisp/mail/mailheader.el
@@ -1,6 +1,6 @@
 ;;; mailheader.el --- mail header parsing, merging, formatting
 
-;; Copyright (C) 1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Erik Naggum <address@hidden>
 ;; Keywords: tools, mail, news
@@ -23,7 +23,7 @@
 
 ;;; Commentary:
 
-;; This package provides an abstraction to RFC822-style messages, used in
+;; This package provides an abstraction of RFC 822 (or later) format, used in
 ;; mail, news, and some other systems.  The simple syntactic rules for such
 ;; headers, such as quoting and line folding, are routinely reimplemented
 ;; in many individual packages.  This package removes the need for this
diff --git a/lisp/mail/metamail.el b/lisp/mail/metamail.el
index 761de64..6f9f189 100644
--- a/lisp/mail/metamail.el
+++ b/lisp/mail/metamail.el
@@ -1,6 +1,6 @@
 ;;; metamail.el --- Metamail interface for GNU Emacs
 
-;; Copyright (C) 1993, 1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Masanobu UMEDA <address@hidden>
 ;; Keywords: mail, news, mime, multimedia
diff --git a/lisp/mail/mspools.el b/lisp/mail/mspools.el
index 2e8765e..9c8e72e 100644
--- a/lisp/mail/mspools.el
+++ b/lisp/mail/mspools.el
@@ -1,6 +1,6 @@
 ;;; mspools.el --- show mail spools waiting to be read
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Stephen Eglen <address@hidden>
 ;; Maintainer: Stephen Eglen <address@hidden>
diff --git a/lisp/mail/qp.el b/lisp/mail/qp.el
index 7353035..5b49741 100644
--- a/lisp/mail/qp.el
+++ b/lisp/mail/qp.el
@@ -1,6 +1,6 @@
 ;;; qp.el --- Quoted-Printable functions
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: mail, extensions
diff --git a/lisp/mail/reporter.el b/lisp/mail/reporter.el
index ddf8935..10db110 100644
--- a/lisp/mail/reporter.el
+++ b/lisp/mail/reporter.el
@@ -1,6 +1,6 @@
 ;;; reporter.el --- customizable bug reporting of lisp programs
 
-;; Copyright (C) 1993-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author:          1993-1998 Barry A. Warsaw
 ;; Maintainer: address@hidden
diff --git a/lisp/mail/rfc2045.el b/lisp/mail/rfc2045.el
index fee0fb5..e677d03 100644
--- a/lisp/mail/rfc2045.el
+++ b/lisp/mail/rfc2045.el
@@ -1,6 +1,6 @@
 ;;; rfc2045.el --- Functions for decoding rfc2045 headers
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/rfc2047.el b/lisp/mail/rfc2047.el
index 282fd38..118ca8a 100644
--- a/lisp/mail/rfc2047.el
+++ b/lisp/mail/rfc2047.el
@@ -1,6 +1,6 @@
 ;;; rfc2047.el --- functions for encoding and decoding rfc2047 messages  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;;     MORIOKA Tomohiko <address@hidden>
@@ -338,7 +338,7 @@ The buffer may be narrowed."
 
 ;; Use this syntax table when parsing into regions that may need
 ;; encoding.  Double quotes are string delimiters, backslash is
-;; character quoting, and all other RFC 2822 special characters are
+;; character quoting, and all other RFC 822 (or later) special characters are
 ;; treated as punctuation so we can use forward-sexp/forward-word to
 ;; skip to the end of regions appropriately.  Nb. ietf-drums does
 ;; things differently.
@@ -366,7 +366,7 @@ The buffer may be narrowed."
 
 (defun rfc2047-encode-region (b e &optional dont-fold)
   "Encode words in region B to E that need encoding.
-By default, the region is treated as containing RFC2822 addresses.
+By default, the region is treated as containing RFC 822 (or later) addresses.
 Dynamically bind `rfc2047-encoding-type' to change that."
   (save-restriction
     (narrow-to-region b e)
@@ -403,7 +403,7 @@ Dynamically bind `rfc2047-encoding-type' to change that."
        (with-syntax-table rfc2047-syntax-table
          (goto-char (point-min))
          (condition-case err           ; in case of unbalanced quotes
-             ;; Look for rfc2822-style: sequences of atoms, quoted
+             ;; Look for RFC 822 (or later) style: sequences of atoms, quoted
              ;; strings, specials, whitespace.  (Specials mustn't be
              ;; encoded.)
              (while (not (eobp))
@@ -1025,7 +1025,7 @@ other than `\"' and `\\' in quoted strings."
              (replace-match " "))
            (setq end (point-max))
            ;; Quote decoded words if there are special characters
-           ;; which might violate RFC2822.
+           ;; which might violate RFC 822 (or later).
            (when (and rfc2047-quote-decoded-words-containing-tspecials
                       (let ((regexp (car (rassq
                                           'address-mime
diff --git a/lisp/mail/rfc2231.el b/lisp/mail/rfc2231.el
index 103af55..0a0983c 100644
--- a/lisp/mail/rfc2231.el
+++ b/lisp/mail/rfc2231.el
@@ -1,6 +1,6 @@
 ;;; rfc2231.el --- Functions for decoding rfc2231 headers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; This file is part of GNU Emacs.
diff --git a/lisp/mail/rfc2368.el b/lisp/mail/rfc2368.el
index e564755..05f27e4 100644
--- a/lisp/mail/rfc2368.el
+++ b/lisp/mail/rfc2368.el
@@ -1,6 +1,6 @@
 ;;; rfc2368.el --- support for rfc2368
 
-;; Copyright (C) 1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Sen Nagata <address@hidden>
 ;; Keywords: mail
diff --git a/lisp/mail/rfc822.el b/lisp/mail/rfc822.el
index dc12f00..a53a77e 100644
--- a/lisp/mail/rfc822.el
+++ b/lisp/mail/rfc822.el
@@ -1,6 +1,6 @@
-;;; rfc822.el --- hairy rfc822 parser for mail and news and suchlike
+;;; rfc822.el --- hairy RFC 822 (or later) parser for mail, news, etc.
 
-;; Copyright (C) 1986-1987, 1990, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1986-1987, 1990, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Richard Mlynarik <address@hidden>
@@ -24,8 +24,8 @@
 
 ;;; Commentary:
 
-;; Support functions for parsing RFC-822 headers, used by mail and news
-;; modes.
+;; Support functions for parsing headers used by mail and news modes.
+;; The header format is specified by Internet RFC 822 and its successors.
 
 ;;; Code:
 
diff --git a/lisp/mail/rmail-spam-filter.el b/lisp/mail/rmail-spam-filter.el
index 99c1a1c..86217e5 100644
--- a/lisp/mail/rmail-spam-filter.el
+++ b/lisp/mail/rmail-spam-filter.el
@@ -1,6 +1,6 @@
 ;;; rmail-spam-filter.el --- spam filter for Rmail, the Emacs mail reader
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 ;; Keywords: email, spam, filter, rmail
 ;; Author: Eli Tziperman <eli AT deas.harvard.edu>
 ;; Package: rmail
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 73a17ee..91291b8 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -1,6 +1,6 @@
 ;;; rmail.el --- main code of "RMAIL" mail reader for Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985-1988, 1993-1998, 2000-2018 Free Software
+;; Copyright (C) 1985-1988, 1993-1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -779,8 +779,8 @@ The first parenthesized expression should match the 
MIME-charset name.")
     (concat
      "From "
 
-     ;; Many things can happen to an RFC 822 mailbox before it is put into
-     ;; a `From' line.  The leading phrase can be stripped, e.g.
+     ;; Many things can happen to an RFC 822 (or later) mailbox before it is
+     ;; put into a `From' line.  The leading phrase can be stripped, e.g.
      ;; `Joe <@w.x:address@hidden>' -> `<@w.x:address@hidden>'.  The <> can be 
stripped, e.g.
      ;; `<@x.y:address@hidden>' -> address@hidden:address@hidden'.  Everything 
starting with a CRLF
      ;; can be removed, e.g.
@@ -1003,8 +1003,8 @@ If `rmail-display-summary' is non-nil, make a summary for 
this RMAIL file."
   "Report that the buffer is not in the mbox file format.
 MSGNUM, if present, indicates the malformed message."
   (if msgnum
-      (error "Message %d is not a valid RFC2822 message" msgnum)
-    (error "Message is not a valid RFC2822 message")))
+      (error "Message %d is not a valid RFC 822 (or later) message" msgnum)
+    (error "Message is not a valid RFC 822 (or later) message")))
 
 (defun rmail-convert-babyl-to-mbox ()
   "Convert the mail file from Babyl version 5 to mbox.
@@ -2072,7 +2072,8 @@ Value is the size of the newly read mail after 
conversion."
                   ;; If we just read the password, most likely it is
                   ;; wrong.  Otherwise, see if there is a specific
                   ;; reason to think that the problem is a wrong passwd.
-                  (if (and (rmail-remote-proto-p proto)
+                  (if (and proto
+                            (rmail-remote-proto-p proto)
                            (or got-password
                                (re-search-forward rmail-remote-password-error
                                                   nil t)))
@@ -2147,9 +2148,9 @@ Call with point at the end of the message."
     (insert "\n")))
 
 (defun rmail-add-mbox-headers ()
-  "Validate the RFC2822 format for the new messages.
+  "Validate the RFC 822 (or later) format for the new messages.
 Point should be at the first new message.
-An error is signaled if the new messages are not RFC2822
+An error is signaled if the new messages are not RFC 822 (or later)
 compliant.
 Unless an Rmail attribute header already exists, add it to the
 new messages.  Return the number of new messages."
@@ -2574,7 +2575,7 @@ the message.  Point is at the beginning of the message."
   (save-excursion
     (setq deleted-head
          (cons (if (and (search-forward (concat rmail-attribute-header ": ") 
message-end t)
-                        (looking-at "?D"))
+                        (looking-at "\\?D"))
                    ?D
                  ?\s) deleted-head))))
 
@@ -3914,9 +3915,9 @@ which is an element of rmail-msgref-vector."
             (setq tem (copy-sequence tem))
             (set-text-properties 0 (length tem) nil tem)
             (setq tem (copy-sequence tem))
-            ;; Use prin1 to fake RFC822 quoting
+            ;; Use prin1 to fake RFC 822 (or later) quoting
             (let ((field (prin1-to-string tem)))
-              ;; Wrap it in parens to make it a comment according to RFC822
+              ;; Wrap it in parens to make it a comment.
               (if date
                   (concat "(" field "'s message of " date ")")
                 (concat "(" field ")"))))))
@@ -3945,7 +3946,7 @@ which is an element of rmail-msgref-vector."
              (if message-id
                  ;; "<address@hidden> (message from Unix Loser on 1-Apr-89)"
                  (concat message-id " (" field ")")
-              ;; Wrap in parens to make it a comment, for RFC822.
+              ;; Wrap in parens to make it a comment.
               (concat "(" field ")")))))
         (t
          ;; If we can't kludge it simply, do it correctly
@@ -4543,6 +4544,9 @@ Argument MIME is non-nil if this is a mime message."
 
     (unless armor-end
       (error "Encryption armor beginning has no matching end"))
+    (setq armor-start (move-marker (make-marker) armor-start))
+    (setq armor-end (move-marker (make-marker) armor-end))
+
     (goto-char armor-start)
 
     ;; Because epa--find-coding-system-for-mime-charset not autoloaded.
@@ -4575,15 +4579,16 @@ Argument MIME is non-nil if this is a mime message."
         (mail-unquote-printable-region armor-start
                                        (- (point-max) after-end))))
 
-    ;; Decrypt it, maybe in place, maybe making new buffer.
-    (epa-decrypt-region
-     armor-start (- (point-max) after-end)
-     ;; Call back this function to prepare the output.
-     (lambda ()
-       (let ((inhibit-read-only t))
-         (delete-region armor-start (- (point-max) after-end))
-         (goto-char armor-start)
-         (current-buffer))))
+    (condition-case nil
+       (epa-decrypt-region
+        armor-start (- (point-max) after-end)
+        ;; Call back this function to prepare the output.
+        (lambda ()
+          (let ((inhibit-read-only t))
+            (delete-region armor-start (- (point-max) after-end))
+            (goto-char armor-start)
+            (current-buffer))))
+      (error nil))
 
     (list armor-start (- (point-max) after-end) mime
           armor-end-regexp
@@ -4619,9 +4624,14 @@ Argument MIME is non-nil if this is a mime message."
       (goto-char (point-min))
       (while (re-search-forward "-----BEGIN PGP MESSAGE-----$" nil t)
        (let ((coding-system-for-read coding-system-for-read)
-             (case-fold-search t))
-
-          (push (rmail-epa-decrypt-1 mime) decrypts)))
+             (case-fold-search t)
+             (armor-start (match-beginning 0)))
+         ;; Don't decrypt an armor that was copied into
+         ;; the message from a message it is a reply to.
+         (or (equal (buffer-substring (line-beginning-position)
+                                      armor-start)
+                    "> ")
+             (push (rmail-epa-decrypt-1 mime) decrypts))))
 
       (when (and decrypts (eq major-mode 'rmail-mode))
         (rmail-add-label "decrypt"))
diff --git a/lisp/mail/rmailedit.el b/lisp/mail/rmailedit.el
index 91aeb41..01d5524 100644
--- a/lisp/mail/rmailedit.el
+++ b/lisp/mail/rmailedit.el
@@ -1,6 +1,6 @@
 ;;; rmailedit.el --- "RMAIL edit mode"  Edit the current message
 
-;; Copyright (C) 1985, 1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: mail
diff --git a/lisp/mail/rmailkwd.el b/lisp/mail/rmailkwd.el
index 2b1533c..9427796 100644
--- a/lisp/mail/rmailkwd.el
+++ b/lisp/mail/rmailkwd.el
@@ -1,6 +1,6 @@
 ;;; rmailkwd.el --- part of the "RMAIL" mail reader for Emacs
 
-;; Copyright (C) 1985, 1988, 1994, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1985, 1988, 1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el
index 71038ca..af52813 100644
--- a/lisp/mail/rmailmm.el
+++ b/lisp/mail/rmailmm.el
@@ -1,6 +1,6 @@
 ;;; rmailmm.el --- MIME decoding and display stuff for RMAIL
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Alexander Pohoyda
 ;;     Alex Schroeder
diff --git a/lisp/mail/rmailmsc.el b/lisp/mail/rmailmsc.el
index c204d84..ba0c2ae 100644
--- a/lisp/mail/rmailmsc.el
+++ b/lisp/mail/rmailmsc.el
@@ -1,6 +1,6 @@
 ;;; rmailmsc.el --- miscellaneous support functions for the RMAIL mail reader
 
-;; Copyright (C) 1985, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: mail
diff --git a/lisp/mail/rmailout.el b/lisp/mail/rmailout.el
index 824b1a5..12d3761 100644
--- a/lisp/mail/rmailout.el
+++ b/lisp/mail/rmailout.el
@@ -1,6 +1,6 @@
 ;;; rmailout.el --- "RMAIL" mail reader for Emacs: output message to a file
 
-;; Copyright (C) 1985, 1987, 1993-1994, 2001-2018 Free Software
+;; Copyright (C) 1985, 1987, 1993-1994, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/mail/rmailsort.el b/lisp/mail/rmailsort.el
index ecd2fd4..4a70103 100644
--- a/lisp/mail/rmailsort.el
+++ b/lisp/mail/rmailsort.el
@@ -1,6 +1,6 @@
 ;;; rmailsort.el --- Rmail: sort messages
 
-;; Copyright (C) 1990, 1993-1994, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1990, 1993-1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Masanobu UMEDA <address@hidden>
diff --git a/lisp/mail/rmailsum.el b/lisp/mail/rmailsum.el
index f8adf77..79a322c 100644
--- a/lisp/mail/rmailsum.el
+++ b/lisp/mail/rmailsum.el
@@ -1,6 +1,6 @@
 ;;; rmailsum.el --- make summary buffers for the mail reader  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985, 1993-1996, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1985, 1993-1996, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/mail/sendmail.el b/lisp/mail/sendmail.el
index 6fc91a3..93b6c90 100644
--- a/lisp/mail/sendmail.el
+++ b/lisp/mail/sendmail.el
@@ -1,6 +1,6 @@
 ;;; sendmail.el --- mail sending commands for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1992-1996, 1998, 2000-2018 Free Software
+;; Copyright (C) 1985-1986, 1992-1996, 1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -150,7 +150,7 @@ Otherwise, let mailer send back a message to report errors."
       'smtpmail-send-it 'sendmail-query-once)
   "Function to call to send the current buffer as mail.
 The headers should be delimited by a line which is
-not a valid RFC822 header or continuation line,
+not a valid RFC 822 (or later) header or continuation line,
 that matches the variable `mail-header-separator'.
 This is used by the default mail-sending commands.  See also
 `message-send-mail-function' for use with the Message package."
@@ -908,7 +908,7 @@ the user from the mailer."
            (ml (when mail-mailing-lists
                 ;; The surrounding regexp assumes the use of
                 ;; `mail-strip-quoted-names' on addresses before matching
-                ;; Cannot deal with full RFC 822 freedom, but that is
+                ;; Cannot deal with full RFC 822 (or later), but that is
                 ;; unlikely to be problematic.
                 (concat "\\(?:[[:space:];,]\\|\\`\\)"
                         (regexp-opt mail-mailing-lists t)
@@ -1044,7 +1044,7 @@ This function does not perform RFC2047 encoding."
                 (fullname-end (point-marker)))
             (goto-char fullname-start)
             ;; Look for a character that cannot appear unquoted
-            ;; according to RFC 822.
+            ;; according to RFC 822 (or later).
             (if (or (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]"
                                        fullname-end 1)
                     quote-fullname)
@@ -1068,8 +1068,7 @@ This function does not perform RFC2047 encoding."
                 (insert "\""))
             (let ((fullname-end (point-marker)))
               (goto-char fullname-start)
-              ;; RFC 822 says \ and nonmatching parentheses
-              ;; must be escaped in comments.
+              ;; \ and nonmatching parentheses must be escaped in comments.
               ;; Escape every instance of ()\ ...
               (while (re-search-forward "[()\\]" fullname-end 1)
                 (replace-match "\\\\\\&" t))
diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el
index 8a1e86b..f31e0b4 100644
--- a/lisp/mail/smtpmail.el
+++ b/lisp/mail/smtpmail.el
@@ -1,6 +1,6 @@
 ;;; smtpmail.el --- simple SMTP protocol (RFC 821) for sending mail  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1995-1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Tomoji Kagatani <address@hidden>
 ;; Maintainer: Simon Josefsson <address@hidden>
@@ -259,7 +259,7 @@ for `smtpmail-try-auth-method'.")
                               (fullname-end (point-marker)))
                           (goto-char fullname-start)
                           ;; Look for a character that cannot appear unquoted
-                          ;; according to RFC 822.
+                          ;; according to RFC 822 or its successors.
                           (if (re-search-forward "[^- !#-'*+/-9=?A-Z^-~]"
                                                  fullname-end 1)
                               (progn
@@ -277,8 +277,9 @@ for `smtpmail-try-auth-method'.")
                           (insert fullname)
                           (let ((fullname-end (point-marker)))
                             (goto-char fullname-start)
-                            ;; RFC 822 says \ and nonmatching parentheses
-                            ;; must be escaped in comments.
+                            ;; RFC 822 and its successors say \ and
+                            ;; nonmatching parentheses must be
+                            ;; escaped in comments.
                             ;; Escape every instance of ()\ ...
                             (while (re-search-forward "[()\\]" fullname-end 1)
                               (replace-match "\\\\\\&" t))
diff --git a/lisp/mail/supercite.el b/lisp/mail/supercite.el
index ce061e2..ad69dca 100644
--- a/lisp/mail/supercite.el
+++ b/lisp/mail/supercite.el
@@ -1,6 +1,6 @@
 ;;; supercite.el --- minor mode for citing mail and news replies
 
-;; Copyright (C) 1993, 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: 1993 Barry A. Warsaw <address@hidden>
 ;; Maintainer: address@hidden
@@ -315,7 +315,7 @@ during the initial citing via `sc-cite-original'."
   :group 'supercite-hooks)
 
 (defcustom sc-mail-warn-if-non-rfc822-p t
-  "Warn if mail headers don't conform to RFC822."
+  "Warn if mail headers don't conform to RFC 822 (or later)."
   :type 'boolean
   :group 'supercite-attr)
 (defcustom sc-mumble ""
@@ -738,10 +738,10 @@ If optional ATTRIBS-P is non-nil, the key/value pair is 
placed in
   nil)
 
 (defun sc-mail-error-in-mail-field ()
-  "Issue warning that mail headers don't conform to RFC 822."
+  "Issue warning that mail headers don't conform to email RFCs."
   (let* ((len (min (length curline) 10))
         (ellipsis (if (< len (length curline)) "..." ""))
-        (msg "Mail header \"%s%s\" doesn't conform to RFC 822. skipping..."))
+        (msg "Mail header \"%s%s\" doesn't conform to RFC 822 (or later). 
skipping..."))
     (message msg (substring curline 0 len) ellipsis))
   (beep)
   (sit-for 2)
diff --git a/lisp/mail/uce.el b/lisp/mail/uce.el
index dfe5c9c..7225cda 100644
--- a/lisp/mail/uce.el
+++ b/lisp/mail/uce.el
@@ -1,6 +1,6 @@
 ;;; uce.el --- facilitate reply to unsolicited commercial email
 
-;; Copyright (C) 1996, 1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: stanislav shalunov <address@hidden>
 ;; Created: 10 Dec 1996
diff --git a/lisp/mail/undigest.el b/lisp/mail/undigest.el
index 8d46be8..bbf3c83 100644
--- a/lisp/mail/undigest.el
+++ b/lisp/mail/undigest.el
@@ -1,6 +1,6 @@
 ;;; undigest.el --- digest-cracking support for the RMAIL mail reader  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1994, 1996, 2001-2018 Free Software
+;; Copyright (C) 1985-1986, 1994, 1996, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/mail/unrmail.el b/lisp/mail/unrmail.el
index a74bcf3..4d9ad67 100644
--- a/lisp/mail/unrmail.el
+++ b/lisp/mail/unrmail.el
@@ -1,6 +1,6 @@
 ;;; unrmail.el --- convert Rmail Babyl files to mbox files
 
-;; Copyright (C) 1992, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: mail
diff --git a/lisp/mail/uudecode.el b/lisp/mail/uudecode.el
index b8f74e3..32e668b 100644
--- a/lisp/mail/uudecode.el
+++ b/lisp/mail/uudecode.el
@@ -1,6 +1,6 @@
 ;;; uudecode.el -- elisp native uudecode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Shenghuo Zhu <address@hidden>
 ;; Keywords: uudecode news
diff --git a/lisp/mail/yenc.el b/lisp/mail/yenc.el
index 25b4ebb..75b62c1 100644
--- a/lisp/mail/yenc.el
+++ b/lisp/mail/yenc.el
@@ -1,6 +1,6 @@
 ;;; yenc.el --- elisp native yenc decoder  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Jesper Harder <address@hidden>
 ;; Keywords: yenc news
diff --git a/lisp/makesum.el b/lisp/makesum.el
index a50f093..10ad78e 100644
--- a/lisp/makesum.el
+++ b/lisp/makesum.el
@@ -1,6 +1,6 @@
 ;;; makesum.el --- generate key binding summary for Emacs
 
-;; Copyright (C) 1985, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: help
diff --git a/lisp/man.el b/lisp/man.el
index 1a6eda1..b1d0fd3 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -1,6 +1,6 @@
 ;;; man.el --- browse UNIX manual pages -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993-1994, 1996-1997, 2001-2018 Free Software
+;; Copyright (C) 1993-1994, 1996-1997, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Barry A. Warsaw <address@hidden>
@@ -318,7 +318,7 @@ This regular expression should start with a `^' character.")
 
 (defvar Man-reference-regexp
   (concat "\\(" Man-name-regexp
-         "\\(‐?\n[ \t]+" Man-name-regexp "\\)*\\)[ \t]*(\\("
+         "\\(\\([-‐]\n\\)?[ \t]+" Man-name-regexp "\\)*\\)[ \t]*(\\("
          Man-section-regexp "\\))")
   "Regular expression describing a reference to another manpage.")
 
@@ -664,7 +664,7 @@ and the `Man-section-translations-alist' variables)."
      ;; "chmod(2V)" case ?
      ((string-match (concat "^" Man-reference-regexp "$") ref)
       (setq name (replace-regexp-in-string "[\n\t ]" "" (match-string 1 ref))
-           section (match-string 3 ref)))
+           section (match-string 4 ref)))
      ;; "2v chmod" case ?
      ((string-match (concat "^\\(" Man-section-regexp
                            "\\) +\\(" Man-name-regexp "\\)$") ref)
@@ -783,11 +783,22 @@ POS defaults to `point'."
       ;;     see this-
       ;;     command-here(1)
       ;; Note: This code gets executed iff our entry is after POS.
-      (when (looking-at "‐?[ \t\r\n]+\\([-a-zA-Z0-9._+:]+\\)([0-9])")
-       (setq word (concat word (match-string-no-properties 1)))
+      (when (looking-at
+             (concat
+              "‐?[ \t\r\n]+\\([-a-zA-Z0-9._+:]+\\)(" Man-section-regexp ")"))
+        (let ((1st-part word))
+          (setq word (concat word (match-string-no-properties 1)))
+          ;; If they use -Tascii, we cannot know whether a hyphen at
+          ;; EOL is or isn't part of the referenced manpage name.
+          ;; Heuristics: if the part of the manpage before the hyphen
+          ;; doesn't include a hyphen, we consider the hyphen to be
+          ;; added by troff, and remove it.
+          (or (not (eq (string-to-char (substring 1st-part -1)) ?-))
+              (string-match-p "-" (substring 1st-part 0 -1))
+              (setq word (replace-regexp-in-string "-" "" word))))
        ;; Make sure the section number gets included by the code below.
        (goto-char (match-end 1)))
-      (when (string-match "[-._]+$" word)
+      (when (string-match "[-._‐]+$" word)
        (setq word (substring word 0 (match-beginning 0))))
       ;; The following was commented out since the preceding code
       ;; should not produce a leading "*" in the first place.
@@ -1146,7 +1157,7 @@ See the variable `Man-notify-method' for the different 
notification behaviors."
   (let ((saved-frame (with-current-buffer man-buffer
                       Man-original-frame)))
     (pcase Man-notify-method
-      (`newframe
+      ('newframe
        ;; Since we run asynchronously, perhaps while Emacs is waiting
        ;; for input, we must not leave a different buffer current.  We
        ;; can't rely on the editor command loop to reselect the
@@ -1157,25 +1168,25 @@ See the variable `Man-notify-method' for the different 
notification behaviors."
            (set-window-dedicated-p (frame-selected-window frame) t)
            (or (display-multi-frame-p frame)
                (select-frame frame)))))
-      (`pushy
+      ('pushy
        (switch-to-buffer man-buffer))
-      (`bully
+      ('bully
        (and (frame-live-p saved-frame)
             (select-frame saved-frame))
        (pop-to-buffer man-buffer)
        (delete-other-windows))
-      (`aggressive
+      ('aggressive
        (and (frame-live-p saved-frame)
             (select-frame saved-frame))
        (pop-to-buffer man-buffer))
-      (`friendly
+      ('friendly
        (and (frame-live-p saved-frame)
             (select-frame saved-frame))
        (display-buffer man-buffer 'not-this-window))
-      (`polite
+      ('polite
        (beep)
        (message "Manual buffer %s is ready" (buffer-name man-buffer)))
-      (`quiet
+      ('quiet
        (message "Manual buffer %s is ready" (buffer-name man-buffer)))
       (_ ;; meek
        (message ""))
@@ -1378,7 +1389,8 @@ manpage command."
 
       (with-current-buffer Man-buffer
        (save-excursion
-         (let ((case-fold-search nil))
+         (let ((case-fold-search nil)
+                (inhibit-read-only t))
            (goto-char (point-min))
            (cond ((or (looking-at "No \\(manual \\)*entry for")
                       (looking-at "[^\n]*: nothing appropriate$"))
diff --git a/lisp/master.el b/lisp/master.el
index 7176897..a054d7f 100644
--- a/lisp/master.el
+++ b/lisp/master.el
@@ -1,6 +1,6 @@
 ;;; master.el --- make a buffer the master over another buffer
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <address@hidden>
 ;; Maintainer: Alex Schroeder <address@hidden>
diff --git a/lisp/mb-depth.el b/lisp/mb-depth.el
index 84c73ca..61673ee 100644
--- a/lisp/mb-depth.el
+++ b/lisp/mb-depth.el
@@ -1,6 +1,6 @@
 ;;; mb-depth.el --- Indicate minibuffer-depth in prompt -*- lexical-binding: t 
-*-
 ;;
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <address@hidden>
 ;; Keywords: convenience
diff --git a/lisp/md4.el b/lisp/md4.el
index 788846a..7091c20 100644
--- a/lisp/md4.el
+++ b/lisp/md4.el
@@ -1,6 +1,6 @@
 ;;; md4.el --- MD4 Message Digest Algorithm. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2001, 2004, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2004, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Taro Kawagishi <address@hidden>
 ;; Keywords: MD4
diff --git a/lisp/menu-bar.el b/lisp/menu-bar.el
index 7f36988..4ff60ed 100644
--- a/lisp/menu-bar.el
+++ b/lisp/menu-bar.el
@@ -1,6 +1,6 @@
 ;;; menu-bar.el --- define a default menu bar
 
-;; Copyright (C) 1993-1995, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Richard M. Stallman
 ;; Maintainer: address@hidden
@@ -277,6 +277,15 @@
 ;; The Edit->Search->Incremental Search menu
 (defvar menu-bar-i-search-menu
   (let ((menu (make-sparse-keymap "Incremental Search")))
+    (bindings--define-key menu [isearch-forward-symbol-at-point]
+      '(menu-item "Forward Symbol at Point..." isearch-forward-symbol-at-point
+        :help "Search forward for a symbol found at point"))
+    (bindings--define-key menu [isearch-forward-symbol]
+      '(menu-item "Forward Symbol..." isearch-forward-symbol
+        :help "Search forward for a symbol as you type it"))
+    (bindings--define-key menu [isearch-forward-word]
+      '(menu-item "Forward Word..." isearch-forward-word
+        :help "Search forward for a word as you type it"))
     (bindings--define-key menu [isearch-backward-regexp]
       '(menu-item "Backward Regexp..." isearch-backward-regexp
         :help "Search backwards for a regular expression as you type it"))
@@ -300,7 +309,7 @@
       menu-bar-separator)
 
     (bindings--define-key menu [tags-continue]
-      '(menu-item "Continue Tags Search" multifile-continue
+      '(menu-item "Continue Tags Search" fileloop-continue
                   :help "Continue last tags search operation"))
     (bindings--define-key menu [tags-srch]
       '(menu-item "Search Tagged Files..." tags-search
@@ -349,7 +358,7 @@
 (defvar menu-bar-replace-menu
   (let ((menu (make-sparse-keymap "Replace")))
     (bindings--define-key menu [tags-repl-continue]
-      '(menu-item "Continue Replace" multifile-continue
+      '(menu-item "Continue Replace" fileloop-continue
                   :help "Continue last tags replace operation"))
     (bindings--define-key menu [tags-repl]
       '(menu-item "Replace in Tagged Files..." tags-query-replace
@@ -423,15 +432,15 @@
   (let ((menu (make-sparse-keymap "Edit")))
 
     (bindings--define-key menu [props]
-      `(menu-item "Text Properties" facemenu-menu))
+      '(menu-item "Text Properties" facemenu-menu))
 
     ;; ns-win.el said: Add spell for platform consistency.
     (if (featurep 'ns)
         (bindings--define-key menu [spell]
-          `(menu-item "Spell" ispell-menu-map)))
+          '(menu-item "Spell" ispell-menu-map)))
 
     (bindings--define-key menu [fill]
-      `(menu-item "Fill" fill-region
+      '(menu-item "Fill" fill-region
                   :enable (and mark-active (not buffer-read-only))
                   :help
                   "Fill text in region to fit between left and right margin"))
@@ -440,7 +449,7 @@
       menu-bar-separator)
 
     (bindings--define-key menu [bookmark]
-      `(menu-item "Bookmarks" menu-bar-bookmark-map))
+      '(menu-item "Bookmarks" menu-bar-bookmark-map))
 
     (bindings--define-key menu [goto]
       `(menu-item "Go To" ,menu-bar-goto-menu))
@@ -2421,7 +2430,7 @@ form ((XOFFSET YOFFSET) WINDOW), or nil.
 If nil, the current mouse position is used, or nil if there is no mouse."
   (pcase position
     ;; nil -> mouse cursor position
-    (`nil
+    ('nil
      (let ((mp (mouse-pixel-position)))
        (list (list (cadr mp) (cddr mp)) (car mp))))
     ;; Value returned from `event-end' or `posn-at-point'.
diff --git a/lisp/mh-e/ChangeLog.1 b/lisp/mh-e/ChangeLog.1
index 1f08c78..c870e59 100644
--- a/lisp/mh-e/ChangeLog.1
+++ b/lisp/mh-e/ChangeLog.1
@@ -11419,7 +11419,7 @@
        (dist): Leave release in current directory.
 
 
-  Copyright (C) 2003-2018 Free Software Foundation, Inc.
+  Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/mh-e/ChangeLog.2 b/lisp/mh-e/ChangeLog.2
index 37bb34d..6d3b8e3 100644
--- a/lisp/mh-e/ChangeLog.2
+++ b/lisp/mh-e/ChangeLog.2
@@ -3673,7 +3673,7 @@
 
 See ChangeLog.1 for earlier changes.
 
-  Copyright (C) 2005-2018 Free Software Foundation, Inc.
+  Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/mh-e/mh-acros.el b/lisp/mh-e/mh-acros.el
index fb8a16b..3bbf509 100644
--- a/lisp/mh-e/mh-acros.el
+++ b/lisp/mh-e/mh-acros.el
@@ -1,6 +1,6 @@
 ;;; mh-acros.el --- macros used in MH-E
 
-;; Copyright (C) 2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Satyaki Das <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
@@ -61,8 +61,8 @@ particular, the expansion of (setf (gethash ...) ...) used
 functions in \"cl\" at run time. This macro recognizes that and
 loads \"cl\" appropriately."
   (if (eq (car (macroexpand '(setf (gethash foo bar) baz))) 'cl-puthash)
-      `(require 'cl)
-    `(eval-when-compile (require 'cl))))
+      '(require 'cl)
+    '(eval-when-compile (require 'cl))))
 
 ;;;###mh-autoload
 (defmacro mh-do-in-gnu-emacs (&rest body)
@@ -128,11 +128,11 @@ XEmacs and versions of GNU Emacs before 21.1 require
 In GNU Emacs if CHECK-TRANSIENT-MARK-MODE-FLAG is non-nil then
 check if variable `transient-mark-mode' is active."
   (cond ((featurep 'xemacs)             ;XEmacs
-         `(and (boundp 'zmacs-regions) zmacs-regions (region-active-p)))
+         '(and (boundp 'zmacs-regions) zmacs-regions (region-active-p)))
         ((not check-transient-mark-mode-flag) ;GNU Emacs
-         `(and (boundp 'mark-active) mark-active))
+         '(and (boundp 'mark-active) mark-active))
         (t                              ;GNU Emacs
-         `(and (boundp 'transient-mark-mode) transient-mark-mode
+         '(and (boundp 'transient-mark-mode) transient-mark-mode
                (boundp 'mark-active) mark-active))))
 
 ;; Shush compiler.
@@ -143,6 +143,8 @@ check if variable `transient-mark-mode' is active."
 
 ;;;###mh-autoload
 (defmacro mh-defstruct (name-spec &rest fields)
+  ;; FIXME: Use `cl-defstruct' instead: shouldn't emit warnings any
+  ;; more nor depend on run-time CL functions.
   "Replacement for `defstruct' from the \"cl\" package.
 The `defstruct' in the \"cl\" library produces compiler warnings,
 and generates code that uses functions present in \"cl\" at
@@ -160,15 +162,17 @@ more details."
          (constructor (or (and (consp name-spec)
                                (cadr (assoc :constructor (cdr name-spec))))
                           (intern (format "make-%s" struct-name))))
-         (field-names (mapcar #'(lambda (x) (if (atom x) x (car x))) fields))
-         (field-init-forms (mapcar #'(lambda (x) (and (consp x) (cadr x)))
-                                   fields))
+         (fields (mapcar (lambda (x)
+                           (if (atom x)
+                               (list x nil)
+                             (list (car x) (cadr x))))
+                         fields))
+         (field-names (mapcar #'car fields))
          (struct (gensym "S"))
          (x (gensym "X"))
          (y (gensym "Y")))
     `(progn
-       (defun* ,constructor (&key ,@(mapcar* #'(lambda (x y) (list x y))
-                                             field-names field-init-forms))
+       (defun* ,constructor (&key ,@fields)
          (list (quote ,struct-name) ,@field-names))
        (defun ,predicate (arg)
          (and (consp arg) (eq (car arg) (quote ,struct-name))))
diff --git a/lisp/mh-e/mh-alias.el b/lisp/mh-e/mh-alias.el
index 257d6b3..c6cdfc4 100644
--- a/lisp/mh-e/mh-alias.el
+++ b/lisp/mh-e/mh-alias.el
@@ -1,6 +1,6 @@
 ;;; mh-alias.el --- MH-E mail alias completion and expansion
 
-;; Copyright (C) 1994-1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Peter S. Galbraith <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
@@ -80,9 +80,7 @@ If ARG is non-nil, set timestamp with the current time."
                        (when (and file (file-exists-p file))
                          (setq stamp (file-attribute-modification-time
                                      (file-attributes file)))
-                         (or (> (car stamp) (car mh-alias-tstamp))
-                             (and (= (car stamp) (car mh-alias-tstamp))
-                                  (> (cadr stamp) (cadr mh-alias-tstamp)))))))
+                        (time-less-p mh-alias-tstamp stamp))))
                     (mh-alias-filenames t)))))))
 
 (defun mh-alias-filenames (arg)
@@ -340,7 +338,7 @@ NO-COMMA-SWAP is non-nil."
     ;; Two words -> first.last
     (downcase
      (format "%s.%s" (match-string 1 string) (match-string 2 string))))
-   ((string-match "^\\([-a-zA-Z0-9._]+\\)@[-a-zA-z0-9_]+\\.+[a-zA-Z0-9]+$"
+   ((string-match "^\\([-a-zA-Z0-9._]+\\)@[-a-zA-Z0-9_]+\\.+[a-zA-Z0-9]+$"
                   string)
     ;; email only -> downcase username
     (downcase (match-string 1 string)))
diff --git a/lisp/mh-e/mh-buffers.el b/lisp/mh-e/mh-buffers.el
index eeb1f7b..3c0c481 100644
--- a/lisp/mh-e/mh-buffers.el
+++ b/lisp/mh-e/mh-buffers.el
@@ -1,6 +1,6 @@
 ;;; mh-buffers.el --- MH-E buffer constants and utilities
 
-;; Copyright (C) 1993, 1995, 1997, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1993, 1995, 1997, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Wohler <address@hidden>
diff --git a/lisp/mh-e/mh-comp.el b/lisp/mh-e/mh-comp.el
index 5c474b4..b96ef74 100644
--- a/lisp/mh-e/mh-comp.el
+++ b/lisp/mh-e/mh-comp.el
@@ -1,6 +1,6 @@
 ;;; mh-comp.el --- MH-E functions for composing and sending messages
 
-;; Copyright (C) 1993, 1995, 1997, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1993, 1995, 1997, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Wohler <address@hidden>
@@ -612,7 +612,7 @@ See also `mh-compose-forward-as-mime-flag',
               (goto-char (mh-mail-header-end))
               (while
                   (re-search-forward
-                   "^#forw \\[\\([^]]+\\)\\] \\(+\\S-+\\) \\(.*\\)$"
+                   "^#forw \\[\\([^]]+\\)\\] \\(\\+\\S-+\\) \\(.*\\)$"
                    (point-max) t)
                 (let ((description (if (equal (match-string 1)
                                               "forwarded messages")
diff --git a/lisp/mh-e/mh-compat.el b/lisp/mh-e/mh-compat.el
index ffeb693..eb173df 100644
--- a/lisp/mh-e/mh-compat.el
+++ b/lisp/mh-e/mh-compat.el
@@ -1,6 +1,6 @@
 ;;; mh-compat.el --- make MH-E compatible with various versions of Emacs
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index 4515144..bc09764 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -1,6 +1,6 @@
 ;;; mh-e.el --- GNU Emacs interface to the MH mail system
 
-;; Copyright (C) 1985-1988, 1990, 1992-1995, 1997, 1999-2018 Free
+;; Copyright (C) 1985-1988, 1990, 1992-1995, 1997, 1999-2019 Free
 ;; Software Foundation, Inc.
 
 ;; Author: Bill Wohler <address@hidden>
@@ -1029,12 +1029,13 @@ windows in the frame are removed."
   (when delete-other-windows-flag
     (delete-other-windows)))
 
-;; FIXME: Maybe out of date?  --xfq
 (if (boundp 'customize-package-emacs-version-alist)
     (add-to-list 'customize-package-emacs-version-alist
                  '(MH-E ("6.0" . "22.1") ("6.1" . "22.1") ("7.0" . "22.1")
                         ("7.1" . "22.1") ("7.2" . "22.1") ("7.3" . "22.1")
-                        ("7.4" . "22.1") ("8.0" . "22.1"))))
+                        ("7.4" . "22.1") ("8.0" . "22.1") ("8.1" . "23.1")
+                        ("8.2" . "23.1") ("8.3" . "24.1") ("8.4" . "24.4")
+                        ("8.5" . "24.4") ("8.6" . "24.4"))))
 
 
 
@@ -2419,14 +2420,14 @@ of citations entirely, choose \"None\"."
   :package-version '(MH-E . "8.0"))
 
 ;; These entries have been intentionally excluded by the developers.
-;;  "Comments:"                         ; RFC 2822 - show this one
+;;  "Comments:"                         ; RFC 822 (or later) - show this one
 ;;  "Fax:"                              ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
 ;;  "Mail-System-Version:"              ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
 ;;  "Mailer:"                           ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
 ;;  "Organization:"                     ;
 ;;  "Phone:"                            ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
 ;;  "Reply-By:"                         ; RFC 2156
-;;  "Reply-To:"                         ; RFC 2822
+;;  "Reply-To:"                         ; RFC 822 (or later)
 ;;  "Sender:"                           ;
 ;;  "User-Agent:"                       ; Similar to X-Mailer, so display it.
 ;;  "X-Mailer:"                         ;
@@ -2487,9 +2488,9 @@ of citations entirely, choose \"None\"."
     "From "                             ; sendmail
     "Generate-Delivery-Report:"         ; RFC 2156
     "Importance:"                       ; RFC 2156, 2421
-    "In-Reply-To:"                      ; RFC 2822
+    "In-Reply-To:"                      ; RFC 822 (or later)
     "Incomplete-Copy:"                  ; RFC 2156
-    "Keywords:"                         ; RFC 2822
+    "Keywords:"                         ; RFC 822 (or later)
     "Language:"                         ; RFC 2156
     "Lines:"                            ; RFC 1036
     "List-"                             ; RFC 2369, 2919
@@ -2499,7 +2500,7 @@ of citations entirely, choose \"None\"."
     "Mail-Reply-To:"                    ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Mailing-List:"                     ; Egroups/yahoogroups mailing list 
manager
     "Message-Content:"                  ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
-    "Message-Id:"                       ; RFC 822
+    "Message-ID:"                       ; RFC 822 (or later)
     "Message-Type:"                     ; RFC 2156
     "Mime-Version"                      ; RFC 2045
     "Msgid:"
@@ -2530,14 +2531,14 @@ of citations entirely, choose \"None\"."
     "Priority:"                         ; RFC 2156
     "Read-Receipt-To:"                  ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Received-SPF:"                     ; Gmail
-    "Received:"                         ; RFC 822
-    "References:"                       ; RFC 2822
+    "Received:"                         ; RFC 822 (or later)
+    "References:"                       ; RFC 822 (or later)
     "Registered-Mail-Reply-Requested-By:"       ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Remailed-"                         ; MH
     "Replaces:"                         ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Replied:"                          ; MH
-    "Resent-"                           ; RFC 2822
-    "Return-Path:"                      ; RFC 822
+    "Resent-"                           ; RFC 822 (or later)
+    "Return-Path:"                      ; RFC 822 (or later)
     "Return-Receipt-Requested:"         ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Return-Receipt-To:"                ; 
http://people.dsv.su.se/~jpalme/ietf/mail-headers/
     "Seal-Send-Time:"
diff --git a/lisp/mh-e/mh-folder.el b/lisp/mh-e/mh-folder.el
index 82e28e8..caf4071 100644
--- a/lisp/mh-e/mh-folder.el
+++ b/lisp/mh-e/mh-folder.el
@@ -1,6 +1,6 @@
 ;;; mh-folder.el --- MH-Folder mode
 
-;; Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
@@ -519,7 +519,7 @@ font-lock is done highlighting.")
 (defmacro mh-remove-xemacs-horizontal-scrollbar ()
   "Get rid of the horizontal scrollbar that XEmacs insists on putting in."
   (when (featurep 'xemacs)
-    `(if (and (featurep 'scrollbar)
+    '(if (and (featurep 'scrollbar)
               (fboundp 'set-specifier))
          (set-specifier horizontal-scrollbar-visible-p nil
                         (cons (current-buffer) nil)))))
diff --git a/lisp/mh-e/mh-funcs.el b/lisp/mh-e/mh-funcs.el
index 3574f8c..da7c87e 100644
--- a/lisp/mh-e/mh-funcs.el
+++ b/lisp/mh-e/mh-funcs.el
@@ -1,6 +1,6 @@
 ;;; mh-funcs.el --- MH-E functions not everyone will use right away
 
-;; Copyright (C) 1993, 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
diff --git a/lisp/mh-e/mh-gnus.el b/lisp/mh-e/mh-gnus.el
index 3d20289..61d531f 100644
--- a/lisp/mh-e/mh-gnus.el
+++ b/lisp/mh-e/mh-gnus.el
@@ -1,6 +1,6 @@
 ;;; mh-gnus.el --- make MH-E compatible with various versions of Gnus
 
-;; Copyright (C) 2003-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Satyaki Das <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
diff --git a/lisp/mh-e/mh-identity.el b/lisp/mh-e/mh-identity.el
index a1eb22f..1d929e8 100644
--- a/lisp/mh-e/mh-identity.el
+++ b/lisp/mh-e/mh-identity.el
@@ -1,6 +1,6 @@
 ;;; mh-identity.el --- multiple identify support for MH-E
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Peter S. Galbraith <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
diff --git a/lisp/mh-e/mh-inc.el b/lisp/mh-e/mh-inc.el
index 34efe13..21034bc 100644
--- a/lisp/mh-e/mh-inc.el
+++ b/lisp/mh-e/mh-inc.el
@@ -1,6 +1,6 @@
 ;;; mh-inc.el --- MH-E "inc" and separate mail spool handling
 
-;; Copyright (C) 2003-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Peter S. Galbraith <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
diff --git a/lisp/mh-e/mh-junk.el b/lisp/mh-e/mh-junk.el
index 0a50e02..db80f90 100644
--- a/lisp/mh-e/mh-junk.el
+++ b/lisp/mh-e/mh-junk.el
@@ -1,6 +1,6 @@
 ;;; mh-junk.el --- MH-E interface to anti-spam measures
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Satyaki Das <address@hidden>,
 ;;         Bill Wohler <address@hidden>
diff --git a/lisp/mh-e/mh-letter.el b/lisp/mh-e/mh-letter.el
index 71a4623..4fc31ed 100644
--- a/lisp/mh-e/mh-letter.el
+++ b/lisp/mh-e/mh-letter.el
@@ -1,6 +1,6 @@
 ;;; mh-letter.el --- MH-Letter mode
 
-;; Copyright (C) 1993, 1995, 1997, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1993, 1995, 1997, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Wohler <address@hidden>
diff --git a/lisp/mh-e/mh-limit.el b/lisp/mh-e/mh-limit.el
index a04bc90..27dda79 100644
--- a/lisp/mh-e/mh-limit.el
+++ b/lisp/mh-e/mh-limit.el
@@ -1,6 +1,6 @@
 ;;; mh-limit.el --- MH-E display limits
 
-;; Copyright (C) 2001-2003, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2003, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Peter S. Galbraith <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el
index e2c682a..9901548 100644
--- a/lisp/mh-e/mh-mime.el
+++ b/lisp/mh-e/mh-mime.el
@@ -1,6 +1,6 @@
 ;;; mh-mime.el --- MH-E MIME support
 
-;; Copyright (C) 1993, 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
@@ -75,7 +75,7 @@
 ;;;###mh-autoload
 (defmacro mh-buffer-data ()
   "Convenience macro to get the MIME data structures of the current buffer."
-  `(gethash (current-buffer) mh-globals-hash))
+  '(gethash (current-buffer) mh-globals-hash))
 
 ;; Structure to keep track of MIME handles on a per buffer basis.
 (mh-defstruct (mh-buffer-data (:conc-name mh-mime-)
diff --git a/lisp/mh-e/mh-print.el b/lisp/mh-e/mh-print.el
index c6df05e..033c1cb 100644
--- a/lisp/mh-e/mh-print.el
+++ b/lisp/mh-e/mh-print.el
@@ -1,6 +1,6 @@
 ;;; mh-print.el --- MH-E printing support
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Jeffrey C Honig <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
diff --git a/lisp/mh-e/mh-scan.el b/lisp/mh-e/mh-scan.el
index f3ad7c6..cd689d6 100644
--- a/lisp/mh-e/mh-scan.el
+++ b/lisp/mh-e/mh-scan.el
@@ -1,6 +1,6 @@
 ;;; mh-scan.el --- MH-E scan line constants and utilities
 
-;; Copyright (C) 1993, 1995, 1997, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1993, 1995, 1997, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Wohler <address@hidden>
diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el
index 8b8ba96..c017bae 100644
--- a/lisp/mh-e/mh-search.el
+++ b/lisp/mh-e/mh-search.el
@@ -1,6 +1,6 @@
 ;;; mh-search  ---  MH-Search mode
 
-;; Copyright (C) 1993, 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Indexed search by Satyaki Das <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
@@ -495,16 +495,16 @@ group of results."
     (let ((point (point)))
       (forward-line (if backward-flag 0 1))
       (cond ((if backward-flag
-                 (re-search-backward "^+" (point-min) t)
-               (re-search-forward "^+" (point-max) t))
+                 (re-search-backward "^\\+" (point-min) t)
+               (re-search-forward "^\\+" (point-max) t))
              (beginning-of-line))
             ((and (if backward-flag
                       (goto-char (point-max))
                     (goto-char (point-min)))
                   nil))
             ((if backward-flag
-                 (re-search-backward "^+" (point-min) t)
-               (re-search-forward "^+" (point-max) t))
+                 (re-search-backward "^\\+" (point-min) t)
+               (re-search-forward "^\\+" (point-max) t))
              (beginning-of-line))
             (t (goto-char point))))))
 
@@ -1429,7 +1429,7 @@ being the list of messages originally from that folder."
         (setq which-func-mode t))
     (let ((alist ()))
       (goto-char (point-min))
-      (while (re-search-forward "^+" nil t)
+      (while (re-search-forward "^\\+" nil t)
         (save-excursion
           (beginning-of-line)
           (push (cons (buffer-substring-no-properties
diff --git a/lisp/mh-e/mh-seq.el b/lisp/mh-e/mh-seq.el
index eeec984..f7d7c62 100644
--- a/lisp/mh-e/mh-seq.el
+++ b/lisp/mh-e/mh-seq.el
@@ -1,6 +1,6 @@
 ;;; mh-seq.el --- MH-E sequences support
 
-;; Copyright (C) 1993, 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
diff --git a/lisp/mh-e/mh-show.el b/lisp/mh-e/mh-show.el
index dae8de0..7dad81d 100644
--- a/lisp/mh-e/mh-show.el
+++ b/lisp/mh-e/mh-show.el
@@ -1,6 +1,6 @@
 ;;; mh-show.el --- MH-Show mode
 
-;; Copyright (C) 1993, 1995, 1997, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1993, 1995, 1997, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Wohler <address@hidden>
@@ -375,8 +375,8 @@ still visible.\n")
            (cond ((not normal-exit)
                   (set-window-configuration config))
                  ,(if dont-return
-                      `(t (setq mh-previous-window-config config))
-                    `((and (get-buffer cur-buffer-name)
+                      '(t (setq mh-previous-window-config config))
+                    '((and (get-buffer cur-buffer-name)
                            (window-live-p (get-buffer-window
                                            (get-buffer cur-buffer-name))))
                       (pop-to-buffer (get-buffer cur-buffer-name) nil)))))))))
diff --git a/lisp/mh-e/mh-speed.el b/lisp/mh-e/mh-speed.el
index d636118..3e89d1b 100644
--- a/lisp/mh-e/mh-speed.el
+++ b/lisp/mh-e/mh-speed.el
@@ -1,6 +1,6 @@
 ;;; mh-speed.el --- MH-E speedbar support
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Satyaki Das <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
@@ -163,7 +163,7 @@ The optional arguments from speedbar are IGNORED."
              (speedbar-change-expand-button-char ?-)
              (add-text-properties
               (mh-line-beginning-position) (1+ (line-beginning-position))
-              `(mh-expanded t)))))))
+              '(mh-expanded t)))))))
 
 (defun mh-speed-view (&rest ignored)
   "Visits the selected folder just as if you had used 
\\<mh-folder-mode-map>\\[mh-visit-folder].
@@ -199,7 +199,7 @@ created."
                       (1+ (mh-line-beginning-position))))
     (add-text-properties
      (mh-line-beginning-position) (1+ (line-beginning-position))
-     `(mh-folder nil mh-expanded nil mh-children-p t mh-level 0))
+     '(mh-folder nil mh-expanded nil mh-children-p t mh-level 0))
     (mh-speed-stealth-update t)
     (when (> mh-speed-update-interval 0)
       (mh-speed-flists nil))))
@@ -568,7 +568,7 @@ The function invalidates the latest ancestor that is 
present."
         (mh-speedbar-change-expand-button-char ?+)
         (add-text-properties
          (mh-line-beginning-position) (1+ (mh-line-beginning-position))
-         `(mh-children-p t)))
+         '(mh-children-p t)))
       (when (get-text-property (mh-line-beginning-position) 'mh-expanded)
         (mh-speed-toggle))
       (setq mh-speed-refresh-flag t))))
diff --git a/lisp/mh-e/mh-thread.el b/lisp/mh-e/mh-thread.el
index ff8e660..0fc560b 100644
--- a/lisp/mh-e/mh-thread.el
+++ b/lisp/mh-e/mh-thread.el
@@ -1,6 +1,6 @@
 ;;; mh-thread.el --- MH-E threading support
 
-;; Copyright (C) 2002-2004, 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2004, 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Satyaki Das <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
diff --git a/lisp/mh-e/mh-tool-bar.el b/lisp/mh-e/mh-tool-bar.el
index 3214487..41610b2 100644
--- a/lisp/mh-e/mh-tool-bar.el
+++ b/lisp/mh-e/mh-tool-bar.el
@@ -1,6 +1,6 @@
 ;;; mh-tool-bar.el --- MH-E tool bar support
 
-;; Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Satyaki Das <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
diff --git a/lisp/mh-e/mh-utils.el b/lisp/mh-e/mh-utils.el
index 7bda0a6..cad6278 100644
--- a/lisp/mh-e/mh-utils.el
+++ b/lisp/mh-e/mh-utils.el
@@ -1,6 +1,6 @@
 ;;; mh-utils.el --- MH-E general utilities
 
-;; Copyright (C) 1993, 1995, 1997, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1993, 1995, 1997, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Wohler <address@hidden>
@@ -888,7 +888,7 @@ in this situation."
 ;;;###mh-autoload
 (defun mh-header-field-beginning ()
   "Move to the beginning of the current header field.
-Handles RFC 822 continuation lines."
+Handle RFC 822 (or later) continuation lines."
   (beginning-of-line)
   (while (looking-at "^[ \t]")
     (forward-line -1)))
@@ -896,7 +896,7 @@ Handles RFC 822 continuation lines."
 ;;;###mh-autoload
 (defun mh-header-field-end ()
   "Move to the end of the current header field.
-Handles RFC 822 continuation lines."
+Handle RFC 822 (or later) continuation lines."
   (forward-line 1)
   (while (looking-at "^[ \t]")
     (forward-line 1))
diff --git a/lisp/mh-e/mh-xface.el b/lisp/mh-e/mh-xface.el
index 52e453d..ddb001a 100644
--- a/lisp/mh-e/mh-xface.el
+++ b/lisp/mh-e/mh-xface.el
@@ -1,6 +1,6 @@
 ;;; mh-xface.el --- MH-E X-Face and Face header field display
 
-;; Copyright (C) 2002-2003, 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2003, 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <address@hidden>
 ;; Maintainer: Bill Wohler <address@hidden>
@@ -197,7 +197,7 @@ The directories are searched for in the order they appear 
in the list.")
                         (mh-funcall-if-exists ietf-drums-parse-address
                                               from-field))))
            (host (and from
-                      (string-match "\\([^+]*\\)\\(+.*\\)address@hidden(.*\\)" 
from)
+                      (string-match 
"\\([^+]*\\)\\(\\+.*\\)address@hidden(.*\\)" from)
                       (downcase (match-string 3 from))))
            (user (and host (downcase (match-string 1 from))))
            (canonical-address (format "address@hidden" user host))
diff --git a/lisp/midnight.el b/lisp/midnight.el
index 82994c5..86c1e21 100644
--- a/lisp/midnight.el
+++ b/lisp/midnight.el
@@ -1,6 +1,6 @@
 ;;; midnight.el --- run something every midnight, e.g., kill old buffers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Sam Steingold <address@hidden>
 ;; Maintainer: Sam Steingold <address@hidden>
@@ -64,7 +64,7 @@ the time when it is run.")
 
 (defcustom clean-buffer-list-delay-general 3
   "The number of days before any buffer becomes eligible for autokilling.
-The autokilling is done by `clean-buffer-list' when is it in `midnight-hook'.
+The autokilling is done by `clean-buffer-list' when it is in `midnight-hook'.
 Currently displayed and/or modified (unsaved) buffers, as well as buffers
 matching `clean-buffer-list-kill-never-buffer-names' and
 `clean-buffer-list-kill-never-regexps' are excluded."
@@ -81,7 +81,7 @@ displayed more than this many seconds ago."
   "List of regexps saying which buffers will be killed at midnight.
 If buffer name matches a regexp in the list and the buffer was not displayed
 in the last `clean-buffer-list-delay-special' seconds, it is killed by
-`clean-buffer-list' when is it in `midnight-hook'.
+`clean-buffer-list' when it is in `midnight-hook'.
 If a member of the list is a cons, its `car' is the regexp and its `cdr' is
 the number of seconds to use instead of `clean-buffer-list-delay-special'.
 See also `clean-buffer-list-kill-buffer-names',
@@ -101,7 +101,7 @@ if the buffer should be killed by `clean-buffer-list'."
   "List of strings saying which buffers will be killed at midnight.
 Buffers with names in this list, which were not displayed in the last
 `clean-buffer-list-delay-special' seconds, are killed by `clean-buffer-list'
-when is it in `midnight-hook'.
+when it is in `midnight-hook'.
 If a member of the list is a cons, its `car' is the name and its `cdr' is
 the number of seconds to use instead of `clean-buffer-list-delay-special'.
 See also `clean-buffer-list-kill-regexps',
diff --git a/lisp/minibuf-eldef.el b/lisp/minibuf-eldef.el
index a81e663..7fd08ab 100644
--- a/lisp/minibuf-eldef.el
+++ b/lisp/minibuf-eldef.el
@@ -1,6 +1,6 @@
 ;;; minibuf-eldef.el --- Only show defaults in prompts when applicable  -*- 
lexical-binding: t -*-
 ;;
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <address@hidden>
 ;; Keywords: convenience
diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el
index a7e6a87..dbd24df 100644
--- a/lisp/minibuffer.el
+++ b/lisp/minibuffer.el
@@ -1,6 +1,6 @@
 ;;; minibuffer.el --- Minibuffer completion functions -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Package: emacs
@@ -174,10 +174,14 @@ ACTION can be one of nil, t or `lambda'."
 
 (defun completion-table-dynamic (fun &optional switch-buffer)
   "Use function FUN as a dynamic completion table.
-FUN is called with one argument, the string for which completion is required,
-and it should return an alist containing all the intended possible completions.
-This alist may be a full list of possible completions so that FUN can ignore
-the value of its argument.
+FUN is called with one argument, the string for which completion is requested,
+and it should return a completion table containing all the intended possible
+completions.
+This table is allowed to include elements that do not actually match the
+string: they will be automatically filtered out.
+The completion table returned by FUN can use any of the usual formats of
+completion tables such as lists, alists, and hash-tables.
+
 If SWITCH-BUFFER is non-nil and completion is performed in the
 minibuffer, FUN will be called in the buffer from which the minibuffer
 was entered.
@@ -185,6 +189,8 @@ was entered.
 The result of the `completion-table-dynamic' form is a function
 that can be used as the COLLECTION argument to `try-completion' and
 `all-completions'.  See Info node `(elisp)Programmed Completion'.
+The completion table returned by `completion-table-dynamic' has empty
+metadata and trivial boundaries.
 
 See also the related function `completion-table-with-cache'."
   (lambda (string pred action)
@@ -263,7 +269,7 @@ the form (concat S2 S)."
                     (+ beg (- (length s1) (length s2))))
               . ,(and (eq (car-safe res) 'boundaries) (cddr res)))))
          ((stringp res)
-          (if (string-prefix-p s2 string completion-ignore-case)
+          (if (string-prefix-p s2 res completion-ignore-case)
               (concat s1 (substring res (length s2)))))
          ((eq action t)
           (let ((bounds (completion-boundaries str table pred "")))
@@ -676,9 +682,9 @@ for use at QPOS."
 ;; (defmacro complete-in-turn (a b) `(completion-table-in-turn ,a ,b))
 ;; (defmacro dynamic-completion-table (fun) `(completion-table-dynamic ,fun))
 (define-obsolete-function-alias
-  'complete-in-turn 'completion-table-in-turn "23.1")
+  'complete-in-turn #'completion-table-in-turn "23.1")
 (define-obsolete-function-alias
-  'dynamic-completion-table 'completion-table-dynamic "23.1")
+  'dynamic-completion-table #'completion-table-dynamic "23.1")
 
 ;;; Minibuffer completion
 
@@ -696,7 +702,7 @@ If ARGS are provided, then pass MESSAGE through 
`format-message'."
   (if (not (minibufferp (current-buffer)))
       (progn
         (if args
-            (apply 'message message args)
+            (apply #'message message args)
           (message "%s" message))
         (prog1 (sit-for (or minibuffer-message-timeout 1000000))
           (message nil)))
@@ -788,6 +794,11 @@ Additionally the user can use the char \"*\" as a glob 
pattern.")
 I.e. when completing \"foo_bar\" (where _ is the position of point),
 it will consider all completions candidates matching the glob
 pattern \"*foo*bar*\".")
+    (flex
+     completion-flex-try-completion completion-flex-all-completions
+     "Completion of an in-order subset of characters.
+When completing \"foo\" the glob \"*f*o*o*\" is used, so that
+\"foo\" can complete to \"frodo\".")
     (initials
      completion-initials-try-completion completion-initials-all-completions
      "Completion of acronyms and initialisms.
@@ -835,7 +846,7 @@ styles for specific categories, such as files, buffers, 
etc."
 (defvar completion-category-defaults
   '((buffer (styles . (basic substring)))
     (unicode-name (styles . (basic substring)))
-    (project-file (styles . (basic substring)))
+    (project-file (styles . (substring)))
     (info-menu (styles . (basic substring))))
   "Default settings for specific completion categories.
 Each entry has the shape (CATEGORY . ALIST) where ALIST is
@@ -1003,7 +1014,7 @@ completion candidates than this number."
 
 (defvar-local completion-all-sorted-completions nil)
 (defvar-local completion--all-sorted-completions-location nil)
-(defvar completion-cycling nil)
+(defvar completion-cycling nil)      ;Function that takes down the cycling map.
 
 (defvar completion-fail-discreetly nil
   "If non-nil, stay quiet when there  is no match.")
@@ -1035,7 +1046,7 @@ when the buffer's text is already an exact match."
   (let* ((string (buffer-substring beg end))
          (md (completion--field-metadata beg))
          (comp (funcall (or try-completion-function
-                            'completion-try-completion)
+                            #'completion-try-completion)
                         string
                         minibuffer-completion-table
                         minibuffer-completion-predicate
@@ -1128,7 +1139,7 @@ when the buffer's text is already an exact match."
              ;; Show the completion table, if requested.
              ((not exact)
              (if (pcase completion-auto-help
-                    (`lazy (eq this-command last-command))
+                    ('lazy (eq this-command last-command))
                     (_ completion-auto-help))
                   (minibuffer-completion-help beg end)
                 (completion--message "Next char not unique")))
@@ -1188,7 +1199,7 @@ scroll the window of possible completions."
 
 (defun completion--cache-all-sorted-completions (beg end comps)
   (add-hook 'after-change-functions
-            'completion--flush-all-sorted-completions nil t)
+            #'completion--flush-all-sorted-completions nil t)
   (setq completion--all-sorted-completions-location
         (cons (copy-marker beg) (copy-marker end)))
   (setq completion-all-sorted-completions comps))
@@ -1198,8 +1209,10 @@ scroll the window of possible completions."
                (or (> start (cdr completion--all-sorted-completions-location))
                    (< end (car completion--all-sorted-completions-location))))
     (remove-hook 'after-change-functions
-                 'completion--flush-all-sorted-completions t)
-    (setq completion-cycling nil)
+                 #'completion--flush-all-sorted-completions t)
+    ;; Remove the transient map if applicable.
+    (when completion-cycling
+      (funcall (prog1 completion-cycling (setq completion-cycling nil))))
     (setq completion-all-sorted-completions nil)))
 
 (defun completion--metadata (string base md-at-point table pred)
@@ -1239,15 +1252,23 @@ scroll the window of possible completions."
           (setq all (delete-dups all))
           (setq last (last all))
 
-          (setq all (if sort-fun (funcall sort-fun all)
-                      ;; Prefer shorter completions, by default.
-                      (sort all (lambda (c1 c2) (< (length c1) (length c2))))))
-          ;; Prefer recently used completions.
-          (when (minibufferp)
-            (let ((hist (symbol-value minibuffer-history-variable)))
-              (setq all (sort all (lambda (c1 c2)
-                                    (> (length (member c1 hist))
-                                       (length (member c2 hist))))))))
+          (cond
+           (sort-fun
+            (setq all (funcall sort-fun all)))
+           (t
+            ;; Prefer shorter completions, by default.
+            (setq all (sort all (lambda (c1 c2) (< (length c1) (length c2)))))
+            (if (minibufferp)
+                ;; Prefer recently used completions and put the default, if
+                ;; it exists, on top.
+                (let ((hist (symbol-value minibuffer-history-variable)))
+                  (setq all
+                        (sort all
+                              (lambda (c1 c2)
+                                (cond ((equal c1 minibuffer-default) t)
+                                      ((equal c2 minibuffer-default) nil)
+                                      (t (> (length (member c1 hist))
+                                            (length (member c2 hist))))))))))))
           ;; Cache the result.  This is not just for speed, but also so that
           ;; repeated calls to minibuffer-force-complete can cycle through
           ;; all possibilities.
@@ -1257,16 +1278,23 @@ scroll the window of possible completions."
 (defun minibuffer-force-complete-and-exit ()
   "Complete the minibuffer with first of the matches and exit."
   (interactive)
-  (minibuffer-force-complete)
+  ;; If `completion-cycling' is t, then surely a
+  ;; `minibuffer-force-complete' has already executed.  This is not
+  ;; just for speed: the extra rotation caused by the second
+  ;; unnecessary call would mess up the final result value
+  ;; (bug#34116).
+  (unless completion-cycling
+    (minibuffer-force-complete nil nil 'dont-cycle))
   (completion--complete-and-exit
    (minibuffer-prompt-end) (point-max) #'exit-minibuffer
    ;; If the previous completion completed to an element which fails
    ;; test-completion, then we shouldn't exit, but that should be rare.
    (lambda () (minibuffer-message "Incomplete"))))
 
-(defun minibuffer-force-complete (&optional start end)
+(defun minibuffer-force-complete (&optional start end dont-cycle)
   "Complete the minibuffer to an exact match.
-Repeated uses step through the possible completions."
+Repeated uses step through the possible completions.
+DONT-CYCLE tells the function not to setup cycling."
   (interactive)
   (setq minibuffer-scroll-window nil)
   ;; FIXME: Need to deal with the extra-size issue here as well.
@@ -1279,7 +1307,7 @@ Repeated uses step through the possible completions."
          (base (+ start (or (cdr (last all)) 0))))
     (cond
      ((not (consp all))
-        (completion--message
+      (completion--message
        (if all "No more completions" "No completions")))
      ((not (consp (cdr all)))
       (let ((done (equal (car all) (buffer-substring-no-properties base end))))
@@ -1290,33 +1318,34 @@ Repeated uses step through the possible completions."
       (completion--replace base end (car all))
       (setq end (+ base (length (car all))))
       (completion--done (buffer-substring-no-properties start (point)) 'sole)
-      ;; Set cycling after modifying the buffer since the flush hook resets it.
-      (setq completion-cycling t)
       (setq this-command 'completion-at-point) ;For completion-in-region.
-      ;; If completing file names, (car all) may be a directory, so we'd now
-      ;; have a new set of possible completions and might want to reset
-      ;; completion-all-sorted-completions to nil, but we prefer not to,
-      ;; so that repeated calls minibuffer-force-complete still cycle
-      ;; through the previous possible completions.
-      (let ((last (last all)))
-        (setcdr last (cons (car all) (cdr last)))
-        (completion--cache-all-sorted-completions start end (cdr all)))
-      ;; Make sure repeated uses cycle, even though completion--done might
-      ;; have added a space or something that moved us outside of the field.
-      ;; (bug#12221).
-      (let* ((table minibuffer-completion-table)
-             (pred minibuffer-completion-predicate)
-             (extra-prop completion-extra-properties)
-             (cmd
-              (lambda () "Cycle through the possible completions."
-                (interactive)
-                (let ((completion-extra-properties extra-prop))
-                  (completion-in-region start (point) table pred)))))
-        (set-transient-map
-         (let ((map (make-sparse-keymap)))
-           (define-key map [remap completion-at-point] cmd)
-           (define-key map (vector last-command-event) cmd)
-           map)))))))
+      ;; Set cycling after modifying the buffer since the flush hook resets it.
+      (unless dont-cycle
+        ;; If completing file names, (car all) may be a directory, so we'd now
+        ;; have a new set of possible completions and might want to reset
+        ;; completion-all-sorted-completions to nil, but we prefer not to,
+        ;; so that repeated calls minibuffer-force-complete still cycle
+        ;; through the previous possible completions.
+        (let ((last (last all)))
+          (setcdr last (cons (car all) (cdr last)))
+          (completion--cache-all-sorted-completions start end (cdr all)))
+        ;; Make sure repeated uses cycle, even though completion--done might
+        ;; have added a space or something that moved us outside of the field.
+        ;; (bug#12221).
+        (let* ((table minibuffer-completion-table)
+               (pred minibuffer-completion-predicate)
+               (extra-prop completion-extra-properties)
+               (cmd
+                (lambda () "Cycle through the possible completions."
+                  (interactive)
+                  (let ((completion-extra-properties extra-prop))
+                    (completion-in-region start (point) table pred)))))
+          (setq completion-cycling
+                (set-transient-map
+                 (let ((map (make-sparse-keymap)))
+                   (define-key map [remap completion-at-point] cmd)
+                   (define-key map (vector last-command-event) cmd)
+                   map)))))))))
 
 (defvar minibuffer-confirm-exit-commands
   '(completion-at-point minibuffer-complete
@@ -1534,7 +1563,7 @@ horizontally in alphabetical order, rather than down the 
screen."
 Uses columns to keep the listing readable but compact.
 It also eliminates runs of equal strings."
   (when (consp strings)
-    (let* ((length (apply 'max
+    (let* ((length (apply #'max
                          (mapcar (lambda (s)
                                    (if (consp s)
                                        (+ (string-width (car s))
@@ -2095,9 +2124,9 @@ a completion function or god knows what else.")
   ;; like comint-completion-at-point or mh-letter-completion-at-point, which
   ;; could be sometimes safe and sometimes misbehaving (and sometimes neither).
   (if (pcase which
-        (`all t)
-        (`safe (member fun completion--capf-safe-funs))
-        (`optimist (not (member fun completion--capf-misbehave-funs))))
+        ('all t)
+        ('safe (member fun completion--capf-safe-funs))
+        ('optimist (not (member fun completion--capf-misbehave-funs))))
       (let ((res (funcall fun)))
         (cond
          ((and (consp res) (not (functionp res)))
@@ -2268,7 +2297,7 @@ Useful to give the user default values that won't be 
substituted."
   (if (and (not (file-name-quoted-p filename))
            (file-name-absolute-p filename)
            (string-match-p (if (memq system-type '(windows-nt ms-dos))
-                               "[/\\\\]~" "/~")
+                               "[/\\]~" "/~")
                            (file-local-name filename)))
       (file-name-quote filename)
     (minibuffer--double-dollars filename)))
@@ -2282,7 +2311,7 @@ Useful to give the user default values that won't be 
substituted."
   ;; We can't reuse env--substitute-vars-regexp because we need to match only
   ;; potentially-unfinished envvars at end of string.
   (concat "\\(?:^\\|[^$]\\(?:\\$\\$\\)*\\)"
-          "$\\([[:alnum:]_]*\\|{\\([^}]*\\)\\)\\'"))
+          "\\$\\([[:alnum:]_]*\\|{\\([^}]*\\)\\)\\'"))
 
 (defun completion--embedded-envvar-table (string _pred action)
   "Completion table for envvars embedded in a string.
@@ -2323,7 +2352,7 @@ same as `substitute-in-file-name'."
                      (match-beginning 0)))))))
        (t
         (if (eq (aref string (1- beg)) ?{)
-            (setq table (apply-partially 'completion-table-with-terminator
+            (setq table (apply-partially #'completion-table-with-terminator
                                          "}" table)))
         ;; Even if file-name completion is case-insensitive, we want
         ;; envvar completion to be case-sensitive.
@@ -2457,7 +2486,7 @@ except that it passes the file name through 
`substitute-in-file-name'.")
                             #'completion--file-name-table)
   "Internal subroutine for `read-file-name'.  Do not call this.")
 
-(defvar read-file-name-function 'read-file-name-default
+(defvar read-file-name-function #'read-file-name-default
   "The function called by `read-file-name' to do its work.
 It should accept the same arguments as `read-file-name'.")
 
@@ -2732,8 +2761,8 @@ See `read-file-name' for the meaning of the arguments."
 BUFFER nil or omitted means use the current buffer.
 Like `internal-complete-buffer', but removes BUFFER from the completion list."
   (let ((except (if (stringp buffer) buffer (buffer-name buffer))))
-    (apply-partially 'completion-table-with-predicate
-                    'internal-complete-buffer
+    (apply-partially #'completion-table-with-predicate
+                    #'internal-complete-buffer
                     (lambda (name)
                       (not (equal (if (consp name) (car name) name) except)))
                     nil)))
@@ -2955,9 +2984,9 @@ or a symbol, see `completion-pcm--merge-completions'."
          (setq p (cdr p)))
         (`(star ,(pred symbolp) . ,rest) (setq p `(star . ,rest)))
         (`(,(pred symbolp) star . ,rest) (setq p `(star . ,rest)))
-        (`(point ,(or `any `any-delim) . ,rest) (setq p `(point . ,rest)))
-        (`(,(or `any `any-delim) point . ,rest) (setq p `(point . ,rest)))
-        (`(any ,(or `any `any-delim) . ,rest) (setq p `(any . ,rest)))
+        (`(point ,(or 'any 'any-delim) . ,rest) (setq p `(point . ,rest)))
+        (`(,(or 'any 'any-delim) point . ,rest) (setq p `(point . ,rest)))
+        (`(any ,(or 'any 'any-delim) . ,rest) (setq p `(any . ,rest)))
         (`(,(pred symbolp)) (setq p nil)) ;Implicit terminating `any'.
         (_ (push (pop p) n))))
     (nreverse n)))
@@ -3023,6 +3052,17 @@ PATTERN is as returned by 
`completion-pcm--string->pattern'."
            (when (string-match-p regex c) (push c poss)))
          (nreverse poss))))))
 
+(defvar flex-score-match-tightness 100
+  "Controls how the `flex' completion style scores its matches.
+
+Value is a positive number.  Values smaller than one make the
+scoring formula value matches scattered along the string, while
+values greater than one make the formula value tighter matches.
+I.e \"foo\" matches both strings \"barbazfoo\" and \"fabrobazo\",
+which are of equal length, but only a value greater than one will
+score the former (which has one \"hole\") higher than the
+latter (which has two).")
+
 (defun completion-pcm--hilit-commonality (pattern completions)
   (when completions
     (let* ((re (completion-pcm--pattern->regex pattern 'group))
@@ -3037,20 +3077,67 @@ PATTERN is as returned by 
`completion-pcm--string->pattern'."
          (let* ((pos (if point-idx (match-beginning point-idx) (match-end 0)))
                 (md (match-data))
                 (start (pop md))
-                (end (pop md)))
+                (end (pop md))
+                (len (length str))
+                ;; To understand how this works, consider these bad
+                ;; ascii(tm) diagrams showing how the pattern \"foo\"
+                ;; flex-matches \"fabrobazo" and
+                ;; \"barfoobaz\":
+
+                ;;      f abr o baz o
+                ;;      + --- + --- +
+
+                ;;      bar foo baz
+                ;;      --- +++ ---
+
+                ;; Where + indicates parts where the pattern matched,
+                ;; - where it didn't match.  The score is a number
+                ;; bound by ]0..1]: the higher the better and only a
+                ;; perfect match (pattern equals string) will have
+                ;; score 1.  The formula takes the form of a quotient.
+                ;; For the numerator, we use the number of +, i.e. the
+                ;; length of the pattern.  For the denominator, it
+                ;; sums (1+ (/ (grouplen - 1)
+                ;; flex-score-match-tightness)) across all groups of
+                ;; -, sums one to that total, and then multiples by
+                ;; the length of the string.
+                (score-numerator 0)
+                (score-denominator 0)
+                (last-b 0)
+                (update-score
+                 (lambda (a b)
+                   "Update score variables given match range (A B)."
+                   (setq
+                    score-numerator   (+ score-numerator (- b a)))
+                   (unless (= a last-b)
+                     (setq
+                      score-denominator (+ score-denominator
+                                           1
+                                           (/ (- a last-b 1)
+                                              flex-score-match-tightness
+                                              1.0))))
+                   (setq
+                    last-b              b))))
+           (funcall update-score start start)
            (while md
+             (funcall update-score start (car md))
              (put-text-property start (pop md)
                                 'font-lock-face 'completions-common-part
                                 str)
              (setq start (pop md)))
+           (funcall update-score len len)
            (put-text-property start end
                               'font-lock-face 'completions-common-part
                               str)
            (if (> (length str) pos)
                (put-text-property pos (1+ pos)
-                                 'font-lock-face 'completions-first-difference
-                                 str)))
-        str)
+                                  'font-lock-face 'completions-first-difference
+                                  str))
+           (unless (zerop (length str))
+             (put-text-property
+              0 1 'completion-score
+              (/ score-numerator (* len (1+ score-denominator)) 1.0) str)))
+         str)
        completions))))
 
 (defun completion-pcm--find-all-completions (string table pred point
@@ -3331,7 +3418,12 @@ the same set of elements."
 ;;; Substring completion
 ;; Mostly derived from the code of `basic' completion.
 
-(defun completion-substring--all-completions (string table pred point)
+(defun completion-substring--all-completions
+    (string table pred point &optional transform-pattern-fn)
+  "Match the presumed substring STRING to the entries in TABLE.
+Respect PRED and POINT.  The pattern used is a PCM-style
+substring pattern, but it be massaged by TRANSFORM-PATTERN-FN, if
+that is non-nil."
   (let* ((beforepoint (substring string 0 point))
          (afterpoint (substring string point))
          (bounds (completion-boundaries beforepoint table pred afterpoint))
@@ -3342,6 +3434,9 @@ the same set of elements."
          (pattern (if (not (stringp (car basic-pattern)))
                       basic-pattern
                     (cons 'prefix basic-pattern)))
+         (pattern (if transform-pattern-fn
+                      (funcall transform-pattern-fn pattern)
+                    pattern))
          (all (completion-pcm--all-completions prefix pattern table pred)))
     (list all pattern prefix suffix (car bounds))))
 
@@ -3361,6 +3456,52 @@ the same set of elements."
       (nconc (completion-pcm--hilit-commonality pattern all)
              (length prefix)))))
 
+;;; "flex" completion, also known as flx/fuzzy/scatter completion
+;; Completes "foo" to "frodo" and "farfromsober"
+
+(defun completion-flex--make-flex-pattern (pattern)
+  "Convert PCM-style PATTERN into PCM-style flex pattern.
+
+This turns
+    (prefix \"foo\" point)
+into
+    (prefix \"f\" any \"o\" any \"o\" any point)
+which is at the core of flex logic.  The extra
+'any' is optimized away later on."
+  (mapcan (lambda (elem)
+            (if (stringp elem)
+                (mapcan (lambda (char)
+                          (list (string char) 'any))
+                        elem)
+              (list elem)))
+          pattern))
+
+(defun completion-flex-try-completion (string table pred point)
+  "Try to flex-complete STRING in TABLE given PRED and POINT."
+  (pcase-let ((`(,all ,pattern ,prefix ,suffix ,_carbounds)
+               (completion-substring--all-completions
+                string table pred point
+                #'completion-flex--make-flex-pattern)))
+    (if minibuffer-completing-file-name
+        (setq all (completion-pcm--filename-try-filter all)))
+    ;; Try some "merging", meaning add as much as possible to the
+    ;; user's pattern without losing any possible matches in `all'.
+    ;; i.e this will augment "cfi" to "config" if all candidates
+    ;; contain the substring "config".  FIXME: this still won't
+    ;; augment "foo" to "froo" when matching "frodo" and
+    ;; "farfromsober".
+    (completion-pcm--merge-try pattern all prefix suffix)))
+
+(defun completion-flex-all-completions (string table pred point)
+  "Get flex-completions of STRING in TABLE, given PRED and POINT."
+  (pcase-let ((`(,all ,pattern ,prefix ,_suffix ,_carbounds)
+               (completion-substring--all-completions
+                string table pred point
+                #'completion-flex--make-flex-pattern)))
+    (when all
+      (nconc (completion-pcm--hilit-commonality pattern all)
+             (length prefix)))))
+
 ;; Initials completion
 ;; Complete /ums to /usr/monnier/src or lch to list-command-history.
 
@@ -3403,7 +3544,7 @@ the same set of elements."
     (when newstr
       (completion-pcm-try-completion newstr table pred (length newstr)))))
 
-(defvar completing-read-function 'completing-read-default
+(defvar completing-read-function #'completing-read-default
   "The function called by `completing-read' to do its work.
 It should accept the same arguments as `completing-read'.")
 
diff --git a/lisp/misc.el b/lisp/misc.el
index f1d5eea..4cf6cad 100644
--- a/lisp/misc.el
+++ b/lisp/misc.el
@@ -1,6 +1,6 @@
 ;;; misc.el --- some nonstandard editing and utility commands for Emacs
 
-;; Copyright (C) 1989, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: convenience
diff --git a/lisp/misearch.el b/lisp/misearch.el
index 1ad08fe..ae0ba45 100644
--- a/lisp/misearch.el
+++ b/lisp/misearch.el
@@ -1,6 +1,6 @@
 ;;; misearch.el --- isearch extensions for multi-buffer search
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Juri Linkov <address@hidden>
 ;; Keywords: matching
diff --git a/lisp/mouse-copy.el b/lisp/mouse-copy.el
index fa1cac3..c3df17b 100644
--- a/lisp/mouse-copy.el
+++ b/lisp/mouse-copy.el
@@ -1,6 +1,6 @@
 ;;; mouse-copy.el --- one-click text copy and move
 
-;; Copyright (C) 1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: John Heidemann <address@hidden>
 ;; Keywords: mouse
diff --git a/lisp/mouse-drag.el b/lisp/mouse-drag.el
index 805cfe4..55de2a4 100644
--- a/lisp/mouse-drag.el
+++ b/lisp/mouse-drag.el
@@ -1,6 +1,6 @@
 ;;; mouse-drag.el --- use mouse-2 to do a new style of scrolling
 
-;; Copyright (C) 1996-1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: John Heidemann <address@hidden>
 ;; Keywords: mouse
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 7efe751..835eaa3 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1,6 +1,6 @@
 ;;; mouse.el --- window system-independent mouse support  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 1993-1995, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 1999-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: hardware, mouse
@@ -98,7 +98,7 @@ point at the click position."
 
 (defun mouse--down-1-maybe-follows-link (&optional _prompt)
   (when mouse-1-click-follows-link
-    (setq mouse--last-down (cons (car-safe last-input-event) (float-time))))
+    (setq mouse--last-down (cons (car-safe last-input-event) (current-time))))
   nil)
 
 (defun mouse--click-1-maybe-follows-link (&optional _prompt)
@@ -110,8 +110,10 @@ Expects to be bound to `(double-)mouse-1' in 
`key-translation-map'."
          ('double (eq 'double-mouse-1 (car-safe last-input-event)))
          (_ (and (eq 'mouse-1 (car-safe last-input-event))
                  (or (not (numberp mouse-1-click-follows-link))
-                     (funcall (if (< mouse-1-click-follows-link 0) #'> #'<)
-                              (- (float-time) (cdr mouse--last-down))
+                    (funcall (if (< mouse-1-click-follows-link 0)
+                                 (lambda (a b) (time-less-p b a))
+                               #'time-less-p)
+                             (time-since (cdr mouse--last-down))
                               (/ (abs mouse-1-click-follows-link) 1000.0))))))
        (eq (car mouse--last-down)
            (event-convert-list (list 'down (car-safe last-input-event))))
@@ -171,7 +173,10 @@ items `Turn Off' and `Help'."
                 (mouse-menu-non-singleton menu)
               (if (fboundp mm-fun)      ; bug#20201
                   `(keymap
-                    ,indicator
+                    ,(format "%s - %s" indicator
+                            (capitalize
+                             (replace-regexp-in-string
+                              "-" " " (format "%S" minor-mode))))
                     (turn-off menu-item "Turn off minor mode" ,mm-fun)
                     (help menu-item "Help for minor mode"
                           (lambda () (interactive)
@@ -1111,6 +1116,10 @@ its value is returned."
   (if (consp pos)
       (let ((w (posn-window pos)) (pt (posn-point pos))
            (str (posn-string pos)))
+        ;; FIXME: When STR has a `category' property and there's another
+        ;; `category' property at PT, we should probably disregard the
+        ;; `category' property at PT while doing the (get-char-property
+        ;; pt property w)!
        (or (and str
                 (get-text-property (cdr str) property (car str)))
             ;; Mouse clicks in the fringe come with a position in
diff --git a/lisp/mpc.el b/lisp/mpc.el
index 81bb5ac..8e557ed 100644
--- a/lisp/mpc.el
+++ b/lisp/mpc.el
@@ -1,6 +1,6 @@
 ;;; mpc.el --- A client for the Music Player Daemon   -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: multimedia
@@ -1017,7 +1017,7 @@ If PLAYLIST is t or nil or missing, use the main 
playlist."
                (text
                 (if (eq info 'self) (symbol-name tag)
                   (pcase tag
-                    ((or `Time `Duration)
+                    ((or 'Time 'Duration)
                      (let ((time (cdr (or (assq 'time info) (assq 'Time 
info)))))
                        (setq pred (list nil)) ;Just assume it's never eq.
                        (when time
@@ -1025,7 +1025,7 @@ If PLAYLIST is t or nil or missing, use the main 
playlist."
                                                     (string-match ":" time))
                                                (substring time (match-end 0))
                                              time)))))
-                    (`Cover
+                    ('Cover
                      (let ((dir (file-name-directory (cdr (assq 'file info)))))
                        ;; (debug)
                        (push `(equal ',dir (file-name-directory (cdr (assq 
'file info)))) pred)
@@ -2555,7 +2555,6 @@ If stopped, start playback."
 (defvar mpc--faster-toggle-forward nil)
 (defvar mpc--faster-acceleration 0.5)
 (defun mpc--faster-toggle (speedup step)
-  (setq speedup (float speedup))
   (if mpc--faster-toggle-timer
       (mpc--faster-stop)
     (mpc-status-refresh) (mpc-proc-sync)
@@ -2582,7 +2581,7 @@ If stopped, start playback."
                    (setq songtime (string-to-number
                                    (cdr (assq 'time mpc-status))))
                    (setq songduration (mpc--songduration))
-                   (setq oldtime (float-time)))
+                  (setq oldtime (current-time)))
                   ((and (>= songtime songduration) mpc--faster-toggle-forward)
                    ;; Skip to the beginning of the next song.
                    (if (not (equal (cdr (assq 'state mpc-status)) "play"))
@@ -2601,14 +2600,16 @@ If stopped, start playback."
                        (lambda ()
                          (setq songid (cdr (assq 'songid mpc-status)))
                          (setq songtime (setq songduration 
(mpc--songduration)))
-                         (setq oldtime (float-time))
+                        (setq oldtime (current-time))
                          (mpc-proc-cmd (list "seekid" songid songtime)))))))
                   (t
                    (setq speedup (+ speedup mpc--faster-acceleration))
                    (let ((newstep
-                          (truncate (* speedup (- (float-time) oldtime)))))
+                         (truncate
+                          (* speedup
+                             (float-time (time-since oldtime))))))
                      (if (<= newstep 1) (setq newstep 1))
-                     (setq oldtime (+ oldtime (/ newstep speedup)))
+                    (setq oldtime (time-add oldtime (/ newstep speedup)))
                      (if (not mpc--faster-toggle-forward)
                          (setq newstep (- newstep)))
                      (setq songtime (min songduration (+ songtime newstep)))
diff --git a/lisp/msb.el b/lisp/msb.el
index 91d83d2..7a1a338 100644
--- a/lisp/msb.el
+++ b/lisp/msb.el
@@ -1,6 +1,6 @@
 ;;; msb.el --- customizable buffer-selection with multiple menus
 
-;; Copyright (C) 1993-1995, 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Lindberg <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/mwheel.el b/lisp/mwheel.el
index 876659f..23f491d 100644
--- a/lisp/mwheel.el
+++ b/lisp/mwheel.el
@@ -1,6 +1,6 @@
 ;;; mwheel.el --- Wheel mouse support
 
-;; Copyright (C) 1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2019 Free Software Foundation, Inc.
 ;; Maintainer: William M. Perry <address@hidden>
 ;; Keywords: mouse
 ;; Package: emacs
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 1aa7944..5af9ea7 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -1,6 +1,6 @@
 ;;; ange-ftp.el --- transparent FTP support for GNU Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1989-1996, 1998, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1989-1996, 1998, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Andy Norman (address@hidden)
@@ -2679,7 +2679,7 @@ The main reason for this alist is to deal with file 
versions in VMS.")
 
 (defmacro ange-ftp-parse-filename ()
   ;;Extract the filename from the current line of a dired-like listing.
-  `(save-match-data
+  '(save-match-data
      (let ((eol (progn (end-of-line) (point))))
        (beginning-of-line)
        (if (re-search-forward directory-listing-before-filename-regexp eol t)
@@ -2728,7 +2728,7 @@ The main reason for this alist is to deal with file 
versions in VMS.")
            ;; seem to believe in the F-switch
            (if (or (and symlink (string-match "@\\'" file))
                    (and directory (string-match "/\\'" file))
-                   (and executable (string-match "*\\'" file))
+                   (and executable (string-match "\\*\\'" file))
                    (and socket (string-match "=\\'" file)))
                (setq file (substring file 0 -1)))))
       (puthash file (or symlink directory) tbl)
@@ -2761,7 +2761,7 @@ match subdirectories as well.")
 (defmacro ange-ftp-dl-parser ()
   ;; Parse the current buffer, which is assumed to be a descriptive
   ;; listing, and return a hashtable.
-  `(let ((tbl (make-hash-table :test 'equal)))
+  '(let ((tbl (make-hash-table :test 'equal)))
      (while (not (eobp))
        (puthash
         (buffer-substring (point)
@@ -4277,7 +4277,7 @@ NEWNAME should be the name to give the new compressed or 
uncompressed file.")
                               nil
                               t
                               nil
-                              "-c"
+                              shell-command-switch
                               (format "compress -f -c < %s > %s" tmp1 tmp2))
          (and ange-ftp-process-verbose
               (ange-ftp-message "Compressing %s...done" abbr))
@@ -4313,7 +4313,7 @@ NEWNAME should be the name to give the new compressed or 
uncompressed file.")
                               nil
                               t
                               nil
-                              "-c"
+                              shell-command-switch
                               (format "uncompress -c < %s > %s" tmp1 tmp2))
          (and ange-ftp-process-verbose
               (ange-ftp-message "Uncompressing %s...done" abbr))
@@ -4441,10 +4441,11 @@ NEWNAME should be the name to give the new compressed 
or uncompressed file.")
 
 ;; We can handle process-file in a restricted way (just for chown).
 ;; Nothing possible for `start-file-process'.
+(put 'exec-path 'ange-ftp 'ignore)
+(put 'make-process 'ange-ftp 'ignore)
 (put 'process-file 'ange-ftp 'ange-ftp-process-file)
 (put 'start-file-process 'ange-ftp 'ignore)
 (put 'shell-command 'ange-ftp 'ange-ftp-shell-command)
-(put 'exec-path 'ange-ftp 'ignore)
 
 ;;; Define ways of getting at unmodified Emacs primitives,
 ;;; turning off our handler.
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index bf179c8..aa31e25 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -1,6 +1,6 @@
 ;;; browse-url.el --- pass a URL to a WWW browser
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Denis Howe <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/net/dbus.el b/lisp/net/dbus.el
index 4397817..3820cd4 100644
--- a/lisp/net/dbus.el
+++ b/lisp/net/dbus.el
@@ -1,6 +1,6 @@
 ;;; dbus.el --- Elisp bindings for D-Bus. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 ;; Keywords: comm, hardware
diff --git a/lisp/net/dig.el b/lisp/net/dig.el
index 1cd79ce..ad47982 100644
--- a/lisp/net/dig.el
+++ b/lisp/net/dig.el
@@ -1,6 +1,6 @@
 ;;; dig.el --- Domain Name System dig interface
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 ;; Keywords: DNS BIND dig comm
diff --git a/lisp/net/dns.el b/lisp/net/dns.el
index b3b430d..4fa8705 100644
--- a/lisp/net/dns.el
+++ b/lisp/net/dns.el
@@ -1,6 +1,6 @@
 ;;; dns.el --- Domain Name Service lookups
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: network comm
@@ -432,8 +432,9 @@ If REVERSEP, look up an IP address."
                       tcp-p))
           (while (and (zerop (buffer-size))
                       (> times 0))
-            (sit-for (/ step 1000.0))
-            (accept-process-output process 0 step)
+           (let ((step-sec (/ step 1000.0)))
+             (sit-for step-sec)
+             (accept-process-output process step-sec))
             (setq times (- times step)))
           (condition-case nil
               (delete-process process)
diff --git a/lisp/net/eudc-bob.el b/lisp/net/eudc-bob.el
index f63e807..59a4637 100644
--- a/lisp/net/eudc-bob.el
+++ b/lisp/net/eudc-bob.el
@@ -1,6 +1,6 @@
 ;;; eudc-bob.el --- Binary Objects Support for EUDC
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <address@hidden>
 ;;         Pavel Janík <address@hidden>
diff --git a/lisp/net/eudc-export.el b/lisp/net/eudc-export.el
index f97fd7e..a520eca 100644
--- a/lisp/net/eudc-export.el
+++ b/lisp/net/eudc-export.el
@@ -1,6 +1,6 @@
 ;;; eudc-export.el --- functions to export EUDC query results
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <address@hidden>
 ;;         Pavel Janík <address@hidden>
diff --git a/lisp/net/eudc-hotlist.el b/lisp/net/eudc-hotlist.el
index 0762445..19788ba 100644
--- a/lisp/net/eudc-hotlist.el
+++ b/lisp/net/eudc-hotlist.el
@@ -1,6 +1,6 @@
 ;;; eudc-hotlist.el --- hotlist management for EUDC
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <address@hidden>
 ;;         Pavel Janík <address@hidden>
diff --git a/lisp/net/eudc-vars.el b/lisp/net/eudc-vars.el
index e947146..8111629 100644
--- a/lisp/net/eudc-vars.el
+++ b/lisp/net/eudc-vars.el
@@ -1,6 +1,6 @@
 ;;; eudc-vars.el --- Emacs Unified Directory Client
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <address@hidden>
 ;;         Pavel Janík <address@hidden>
diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el
index a28fa6a..3c9c01d 100644
--- a/lisp/net/eudc.el
+++ b/lisp/net/eudc.el
@@ -1,6 +1,6 @@
 ;;; eudc.el --- Emacs Unified Directory Client  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <address@hidden>
 ;;         Pavel Janík <address@hidden>
diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el
index ac4814a..f91d0af 100644
--- a/lisp/net/eudcb-bbdb.el
+++ b/lisp/net/eudcb-bbdb.el
@@ -1,6 +1,6 @@
 ;;; eudcb-bbdb.el --- Emacs Unified Directory Client - BBDB Backend
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <address@hidden>
 ;;         Pavel Janík <address@hidden>
diff --git a/lisp/net/eudcb-ldap.el b/lisp/net/eudcb-ldap.el
index f339f9e..7514d1a 100644
--- a/lisp/net/eudcb-ldap.el
+++ b/lisp/net/eudcb-ldap.el
@@ -1,6 +1,6 @@
 ;;; eudcb-ldap.el --- Emacs Unified Directory Client - LDAP Backend
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <address@hidden>
 ;;         Pavel Janík <address@hidden>
diff --git a/lisp/net/eudcb-mab.el b/lisp/net/eudcb-mab.el
index a69c77b..0202b17 100644
--- a/lisp/net/eudcb-mab.el
+++ b/lisp/net/eudcb-mab.el
@@ -1,6 +1,6 @@
 ;;; eudcb-mab.el --- Emacs Unified Directory Client - AddressBook backend
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 ;; Maintainer: Thomas Fitzsimmons <address@hidden>
@@ -61,8 +61,7 @@ RETURN-ATTRS is a list of attributes to return, defaulting to
       (goto-char (point-min))
       (when (or (eobp) (time-less-p eudc-buffer-time modified))
        (erase-buffer)
-       (call-process (executable-find "contacts") nil t nil
-                     "-H" "-l" "-f" fmt-string)
+       (call-process "contacts" nil t nil "-H" "-l" "-f" fmt-string)
        (setq eudc-buffer-time modified))
       (goto-char (point-min))
       (while (not (eobp))
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 64cc1a5..3e93345 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1,6 +1,6 @@
 ;;; eww.el --- Emacs Web Wowser  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: html
@@ -247,21 +247,29 @@ This list can be customized via `eww-suggest-uris'."
     (nreverse uris)))
 
 ;;;###autoload
-(defun eww (url)
+(defun eww (url &optional arg)
   "Fetch URL and render the page.
 If the input doesn't look like an URL or a domain name, the
-word(s) will be searched for via `eww-search-prefix'."
+word(s) will be searched for via `eww-search-prefix'.
+
+If called with a prefix ARG, use a new buffer instead of reusing
+the default EWW buffer."
   (interactive
    (let* ((uris (eww-suggested-uris))
          (prompt (concat "Enter URL or keywords"
                          (if uris (format " (default %s)" (car uris)) "")
                          ": ")))
-     (list (read-string prompt nil 'eww-prompt-history uris))))
+     (list (read-string prompt nil 'eww-prompt-history uris)
+           (prefix-numeric-value current-prefix-arg))))
   (setq url (eww--dwim-expand-url url))
   (pop-to-buffer-same-window
-   (if (eq major-mode 'eww-mode)
-       (current-buffer)
-     (get-buffer-create "*eww*")))
+   (cond
+    ((eq arg 4)
+     (generate-new-buffer "*eww*"))
+    ((eq major-mode 'eww-mode)
+     (current-buffer))
+    (t
+     (get-buffer-create "*eww*"))))
   (eww-setup-buffer)
   ;; Check whether the domain only uses "Highly Restricted" Unicode
   ;; IDNA characters.  If not, transform to punycode to indicate that
@@ -462,10 +470,10 @@ Currently this means either text/html or 
application/xhtml+xml."
                (condition-case nil
                    (decode-coding-region (point) (point-max) encode)
                  (coding-system-error nil))
-                (save-excursion
-                  ;; Remove CRLF before parsing.
-                  (while (re-search-forward "\r$" nil t)
-                    (replace-match "" t t)))
+               (save-excursion
+                 ;; Remove CRLF and replace NUL with &#0; before parsing.
+                 (while (re-search-forward "\\(\r$\\)\\|\0" nil t)
+                   (replace-match (if (match-beginning 1) "" "&#0;") t t)))
                (libxml-parse-html-region (point) (point-max))))))
        (source (and (null document)
                     (buffer-substring (point) (point-max)))))
@@ -1531,10 +1539,12 @@ Differences in #targets are ignored."
   (kill-new (plist-get eww-data :url)))
 
 (defun eww-download ()
-  "Download URL under point to `eww-download-directory'."
+  "Download URL to `eww-download-directory'.
+Use link at point if there is one, else the current page's URL."
   (interactive)
   (access-file eww-download-directory "Download failed")
-  (let ((url (get-text-property (point) 'shr-url)))
+  (let ((url (or (get-text-property (point) 'shr-url)
+                 (eww-current-url))))
     (if (not url)
         (message "No URL under point")
       (url-retrieve url 'eww-download-callback (list url)))))
@@ -1542,7 +1552,7 @@ Differences in #targets are ignored."
 (defun eww-download-callback (status url)
   (unless (plist-get status :error)
     (let* ((obj (url-generic-parse-url url))
-           (path (car (url-path-and-query obj)))
+           (path (directory-file-name (car (url-path-and-query obj))))
            (file (eww-make-unique-file-name
                   (eww-decode-url-file-name (file-name-nondirectory path))
                   eww-download-directory)))
diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el
index 315932b..61480f3 100644
--- a/lisp/net/gnutls.el
+++ b/lisp/net/gnutls.el
@@ -1,6 +1,6 @@
 ;;; gnutls.el --- Support SSL/TLS connections through GnuTLS
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Ted Zlatanov <address@hidden>
 ;; Keywords: comm, tls, ssl, encryption
@@ -38,6 +38,9 @@
 (require 'cl-lib)
 (require 'puny)
 
+(declare-function network-stream-certificate "network-stream"
+                  (host service parameters))
+
 (defgroup gnutls nil
   "Emacs interface to the GnuTLS library."
   :version "24.1"
@@ -138,7 +141,7 @@ node `(emacs) Network Security'."
                  (integer :tag "Number of bits" 512))
   :group 'gnutls)
 
-(defun open-gnutls-stream (name buffer host service &optional nowait)
+(defun open-gnutls-stream (name buffer host service &optional parameters)
   "Open a SSL/TLS connection for a service to a host.
 Returns a subprocess-object to represent the connection.
 Input and output work as for subprocesses; `delete-process' closes it.
@@ -149,12 +152,15 @@ BUFFER is the buffer (or `buffer-name') to associate with 
the process.
  a filter function to handle the output.
  BUFFER may be also nil, meaning that this process is not associated
  with any buffer
-Third arg is name of the host to connect to, or its IP address.
-Fourth arg SERVICE is name of the service desired, or an integer
+Third arg HOST is the name of the host to connect to, or its IP address.
+Fourth arg SERVICE is the name of the service desired, or an integer
 specifying a port number to connect to.
-Fifth arg NOWAIT (which is optional) means that the socket should
-be opened asynchronously.  The connection process will be
-returned to the caller before TLS negotiation has happened.
+Fifth arg PARAMETERS is an optional list of keyword/value pairs.
+Only :client-certificate and :nowait keywords are recognized, and
+have the same meaning as for `open-network-stream'.
+For historical reasons PARAMETERS can also be a symbol, which is
+interpreted the same as passing a list containing :nowait and the
+value of that symbol.
 
 Usage example:
 
@@ -168,19 +174,33 @@ This is a very simple wrapper around `gnutls-negotiate'.  
See its
 documentation for the specific parameters you can use to open a
 GnuTLS connection, including specifying the credential type,
 trust and key files, and priority string."
-  (let ((process (open-network-stream
-                  name buffer host service
-                  :nowait nowait
-                  :tls-parameters
-                  (and nowait
-                       (cons 'gnutls-x509pki
-                             (gnutls-boot-parameters
-                              :type 'gnutls-x509pki
-                              :hostname (puny-encode-domain host)))))))
+  (let* ((parameters
+          (cond ((symbolp parameters)
+                 (list :nowait parameters))
+                ((not (cl-evenp (length parameters)))
+                 (error "Malformed keyword list"))
+                ((consp parameters)
+                 parameters)
+                (t
+                 (error "Unknown parameter type"))))
+         (cert (network-stream-certificate host service parameters))
+         (keylist (and cert (list cert)))
+         (nowait (plist-get parameters :nowait))
+         (process (open-network-stream
+                   name buffer host service
+                   :nowait nowait
+                   :tls-parameters
+                   (and nowait
+                        (cons 'gnutls-x509pki
+                              (gnutls-boot-parameters
+                               :type 'gnutls-x509pki
+                               :keylist keylist
+                               :hostname (puny-encode-domain host)))))))
     (if nowait
         process
       (gnutls-negotiate :process process
                         :type 'gnutls-x509pki
+                        :keylist keylist
                         :hostname (puny-encode-domain host)))))
 
 (define-error 'gnutls-error "GnuTLS error")
diff --git a/lisp/net/goto-addr.el b/lisp/net/goto-addr.el
index db59df3..c25d787 100644
--- a/lisp/net/goto-addr.el
+++ b/lisp/net/goto-addr.el
@@ -1,6 +1,6 @@
 ;;; goto-addr.el --- click to browse URL or to send to e-mail address
 
-;; Copyright (C) 1995, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Ding <address@hidden>
 ;; Maintainer: address@hidden
@@ -98,7 +98,7 @@ A value of t means there is no limit--fontify regardless of 
the size."
 
 (defvar goto-address-mail-regexp
   ;; Actually pretty much any char could appear in the username part.  -stef
-  "address@hidden([-a-zA-z0-9_]+\\.\\)+[a-zA-Z0-9]+"
+  "address@hidden([-a-zA-Z0-9_]+\\.\\)+[a-zA-Z0-9]+"
   "A regular expression probably matching an e-mail address.")
 
 (defvar goto-address-url-regexp
@@ -246,7 +246,7 @@ there, then load the URL at or before point."
   "Find e-mail address around or before point.
 Then search backwards to beginning of line for the start of an e-mail
 address.  If no e-mail address found, return nil."
-  (re-search-backward "address@hidden" (line-beginning-position) 'lim)
+  (re-search-backward "address@hidden" (line-beginning-position) 'lim)
   (if (or (looking-at goto-address-mail-regexp)        ; already at start
          (and (re-search-forward goto-address-mail-regexp
                                  (line-end-position) 'lim)
diff --git a/lisp/net/hmac-def.el b/lisp/net/hmac-def.el
index f493d2d..44db0bb 100644
--- a/lisp/net/hmac-def.el
+++ b/lisp/net/hmac-def.el
@@ -1,6 +1,6 @@
 ;;; hmac-def.el --- A macro for defining HMAC functions.
 
-;; Copyright (C) 1999, 2001, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Shuhei KOBAYASHI <address@hidden>
 ;; Keywords: HMAC, RFC2104
@@ -73,7 +73,7 @@ If BIT is non-nil, truncate output to specified bits."
             ,(if (and bit (< (/ bit 8) L))
                  `(substring key-xor-opad 0 ,(/ bit 8))
                ;; return a copy of `key-xor-opad'.
-               `(concat key-xor-opad)))
+               '(concat key-xor-opad)))
         ;; cleanup.
         (fillarray key-xor-ipad 0)
         (fillarray key-xor-opad 0)))))
diff --git a/lisp/net/hmac-md5.el b/lisp/net/hmac-md5.el
index f5d12be..647139f 100644
--- a/lisp/net/hmac-md5.el
+++ b/lisp/net/hmac-md5.el
@@ -1,6 +1,6 @@
 ;;; hmac-md5.el --- Compute HMAC-MD5.
 
-;; Copyright (C) 1999, 2001, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Shuhei KOBAYASHI <address@hidden>
 ;; Keywords: HMAC, RFC2104, HMAC-MD5, MD5, KEYED-MD5, CRAM-MD5
diff --git a/lisp/net/imap.el b/lisp/net/imap.el
index 042b0f9..9f43c57 100644
--- a/lisp/net/imap.el
+++ b/lisp/net/imap.el
@@ -1,6 +1,6 @@
 ;;; imap.el --- imap library  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 ;; Keywords: mail
@@ -1918,18 +1918,14 @@ on failure."
          (unless (< len 10)
            (setq imap-have-messaged t)
            (message "imap read: %dk" len))
-         (accept-process-output imap-process
-                                (truncate imap-read-timeout)
-                                (truncate (* (- imap-read-timeout
-                                                (truncate imap-read-timeout))
-                                             1000)))))
+         (accept-process-output imap-process imap-read-timeout)))
       ;; A process can die _before_ we have processed everything it
       ;; has to say.  Moreover, this can happen in between the call to
       ;; accept-process-output and the call to process-status in an
       ;; iteration of the loop above.
       (when (and (null imap-continuation)
                 (< imap-reached-tag tag))
-       (accept-process-output imap-process 0 0))
+       (accept-process-output imap-process 0))
       (when imap-have-messaged
        (message ""))
       (and (memq (process-status imap-process) '(open run))
@@ -2076,23 +2072,23 @@ Return nil if no complete line has arrived."
 ;;                      addr-host ")"
 ;;
 ;;   addr-adl        = nstring
-;;                       ; Holds route from [RFC-822] route-addr if
+;;                       ; Holds route from [RFC-822 (or later)] route-addr if
 ;;                       ; non-nil
 ;;
 ;;   addr-host       = nstring
-;;                       ; nil indicates [RFC-822] group syntax.
-;;                       ; Otherwise, holds [RFC-822] domain name
+;;                       ; nil indicates [RFC-822 (or later)] group syntax.
+;;                       ; Otherwise, holds [RFC-822 (or later)] domain name
 ;;
 ;;   addr-mailbox    = nstring
-;;                       ; nil indicates end of [RFC-822] group; if
+;;                       ; nil indicates end of [RFC-822 (or later)] group; if
 ;;                       ; non-nil and addr-host is nil, holds
-;;                       ; [RFC-822] group name.
-;;                       ; Otherwise, holds [RFC-822] local-part
-;;                       ; after removing [RFC-822] quoting
+;;                       ; [RFC-822 (or later)] group name.
+;;                       ; Otherwise, holds [RFC-822 (or later)] local-part
+;;                       ; after removing [RFC-822 (or later)] quoting
 ;;
 ;;   addr-name       = nstring
-;;                       ; If non-nil, holds phrase from [RFC-822]
-;;                       ; mailbox after removing [RFC-822] quoting
+;;                       ; If non-nil, holds phrase from [RFC-822 (or later)]
+;;                       ; mailbox after removing [RFC-822 (or later)] quoting
 ;;
 
 (defsubst imap-parse-address ()
diff --git a/lisp/net/ldap.el b/lisp/net/ldap.el
index 7b47a54..75fc7d6 100644
--- a/lisp/net/ldap.el
+++ b/lisp/net/ldap.el
@@ -1,6 +1,6 @@
 ;;; ldap.el --- client interface to LDAP for Emacs
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <address@hidden>
 ;; Maintainer: address@hidden
@@ -646,8 +646,9 @@ an alist of attribute/value pairs."
               (not (equal "" sizelimit)))
          (setq arglist (nconc arglist (list (format "-z%s" sizelimit)))))
       (if passwd
-         (let* ((process-connection-type nil)
-                (proc-args (append arglist ldap-ldapsearch-args
+         ;; Leave process-connection-type at its default value.  See
+         ;; discussion in Bug#33050.
+         (let* ((proc-args (append arglist ldap-ldapsearch-args
                                    filter))
                 (proc (apply #'start-process "ldapsearch" buf
                              ldap-ldapsearch-prog
diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
index a8ade01..eb4312e 100644
--- a/lisp/net/mailcap.el
+++ b/lisp/net/mailcap.el
@@ -1,6 +1,6 @@
 ;;; mailcap.el --- MIME media types configuration -*- lexical-binding: t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: William M. Perry <address@hidden>
 ;;     Lars Magne Ingebrigtsen <address@hidden>
diff --git a/lisp/net/mairix.el b/lisp/net/mairix.el
index ade263a..0741566 100644
--- a/lisp/net/mairix.el
+++ b/lisp/net/mairix.el
@@ -1,6 +1,6 @@
 ;;; mairix.el --- Mairix interface for Emacs
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: David Engster <address@hidden>
 ;; Keywords: mail searching
diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el
index c9e8080..e61d889 100644
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -1,6 +1,6 @@
 ;;; net-utils.el --- network functions
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author:  Peter Breton <address@hidden>
 ;; Created: Sun Mar 16 1997
diff --git a/lisp/net/netrc.el b/lisp/net/netrc.el
index 7b974eb..93152f4 100644
--- a/lisp/net/netrc.el
+++ b/lisp/net/netrc.el
@@ -1,5 +1,5 @@
 ;;; netrc.el --- .netrc parsing functionality
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: news
diff --git a/lisp/net/network-stream.el b/lisp/net/network-stream.el
index a0589e2..2b3292b 100644
--- a/lisp/net/network-stream.el
+++ b/lisp/net/network-stream.el
@@ -1,6 +1,6 @@
 ;;; network-stream.el --- open network processes, possibly with encryption -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: network
@@ -48,6 +48,7 @@
 
 (declare-function starttls-available-p "starttls" ())
 (declare-function starttls-negotiate "starttls" (process))
+(declare-function starttls-open-stream "starttls" (name buffer host port))
 
 (autoload 'gnutls-negotiate "gnutls")
 (autoload 'open-gnutls-stream "gnutls")
@@ -196,7 +197,7 @@ gnutls-boot (as returned by `gnutls-boot-parameters')."
          (car result))))))
 
 (defun network-stream-certificate (host service parameters)
-  (let ((spec (plist-get :client-certificate parameters)))
+  (let ((spec (plist-get parameters :client-certificate)))
     (cond
      ((listp spec)
       ;; Either nil or a list with a key/certificate pair.
@@ -375,7 +376,7 @@ gnutls-boot (as returned by `gnutls-boot-parameters')."
        (goto-char start)
        (while (and (memq (process-status stream) '(open run))
                    (not (re-search-forward end-of-command nil t)))
-         (accept-process-output stream 0 50)
+         (accept-process-output stream 0.05)
          (goto-char start))
        ;; Return the data we got back, or nil if the process died.
        (unless (= start (point))
@@ -389,7 +390,7 @@ gnutls-boot (as returned by `gnutls-boot-parameters')."
           (stream
             (if (gnutls-available-p)
                 (open-gnutls-stream name buffer host service
-                                    (plist-get parameters :nowait))
+                                    parameters)
               (require 'tls)
               (open-tls-stream name buffer host service)))
           (eoc (plist-get parameters :end-of-command)))
diff --git a/lisp/net/newst-backend.el b/lisp/net/newst-backend.el
index b6fbdfb..9925a04 100644
--- a/lisp/net/newst-backend.el
+++ b/lisp/net/newst-backend.el
@@ -1,6 +1,6 @@
 ;;; newst-backend.el --- Retrieval backend for newsticker  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <address@hidden>
 ;; Filename:    newst-backend.el
@@ -170,7 +170,7 @@ These were mostly extracted from the Radio Community Server 
at
 http://subhonker6.userland.com/rcsPublic/rssHotlist.
 
 You may add other entries in `newsticker-url-list'."
-  :type `(set ,@(mapcar `newsticker--splicer
+  :type `(set ,@(mapcar #'newsticker--splicer
                         newsticker--raw-url-list-defaults))
   :set 'newsticker--set-customvar-retrieval
   :group 'newsticker-retrieval)
@@ -1691,8 +1691,8 @@ Examples:
     nil))
 
 (defun newsticker--decode-rfc822-date (rfc822-string)
-  "Return RFC822-STRING in format like `decode-time'.
-Converts from RFC822 to Emacs representation.
+  "Convert RFC822-STRING to a Lisp timestamp.
+RFC822-STRING should use RFC 822 (or later) format.
 Examples:
 Sat, 07 September 2002 00:00:01 +0100
 Sat, 07 September 2002 00:00:01 MET
@@ -1802,7 +1802,7 @@ download it from URL first."
              (time-less-p nil
                           (time-add (file-attribute-modification-time
                                     (file-attributes image-name))
-                                    (seconds-to-time 86400))))
+                                   86400)))
         (newsticker--debug-msg "%s: Getting image for %s skipped"
                                (format-time-string "%A, %H:%M")
                                feed-name)
@@ -1995,8 +1995,7 @@ older than TIME."
          (mapc
           (lambda (item)
             (when (eq (newsticker--age item) old-age)
-              (let ((exp-time (time-add (newsticker--time item)
-                                        (seconds-to-time time))))
+             (let ((exp-time (time-add (newsticker--time item) time)))
                 (when (time-less-p exp-time nil)
                   (newsticker--debug-msg
                    "Item `%s' from %s has expired on %s"
@@ -2171,22 +2170,8 @@ well."
                  (throw 'result nil))
                 ((eq age2 'obsolete)
                  (throw 'result t)))))
-    (let* ((time1 (newsticker--time item1))
-           (time2 (newsticker--time item2)))
-      (cond ((< (nth 0 time1) (nth 0 time2))
-             nil)
-            ((> (nth 0 time1) (nth 0 time2))
-             t)
-            ((< (nth 1 time1) (nth 1 time2))
-             nil)
-            ((> (nth 1 time1) (nth 1 time2))
-             t)
-            ((< (or (nth 2 time1) 0) (or (nth 2 time2) 0))
-             nil)
-            ((> (or (nth 2 time1) 0) (or (nth 2 time2) 0))
-             t)
-            (t
-             nil)))))
+    (time-less-p (newsticker--time item2)
+                (newsticker--time item1))))
 
 (defun newsticker--cache-item-compare-by-title (item1 item2)
   "Compare ITEM1 and ITEM2 by comparing their titles."
diff --git a/lisp/net/newst-plainview.el b/lisp/net/newst-plainview.el
index 889404e..4f5c729 100644
--- a/lisp/net/newst-plainview.el
+++ b/lisp/net/newst-plainview.el
@@ -1,6 +1,6 @@
 ;;; newst-plainview.el --- Single buffer frontend for newsticker.
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <address@hidden>
 ;; Filename:    newst-plainview.el
diff --git a/lisp/net/newst-reader.el b/lisp/net/newst-reader.el
index 98d9262..4b1d68a 100644
--- a/lisp/net/newst-reader.el
+++ b/lisp/net/newst-reader.el
@@ -1,6 +1,6 @@
 ;;; newst-reader.el --- Generic RSS reader functions.
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <address@hidden>
 ;; Filename:    newst-reader.el
diff --git a/lisp/net/newst-ticker.el b/lisp/net/newst-ticker.el
index 16318ec..fab0b73 100644
--- a/lisp/net/newst-ticker.el
+++ b/lisp/net/newst-ticker.el
@@ -1,6 +1,6 @@
 ;; newst-ticker.el --- mode line ticker for newsticker.
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <address@hidden>
 ;; Filename:    newst-ticker.el
diff --git a/lisp/net/newst-treeview.el b/lisp/net/newst-treeview.el
index 59a5729..ece728a 100644
--- a/lisp/net/newst-treeview.el
+++ b/lisp/net/newst-treeview.el
@@ -1,6 +1,6 @@
 ;;; newst-treeview.el --- Treeview frontend for newsticker.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <address@hidden>
 ;; Filename:    newst-treeview.el
diff --git a/lisp/net/newsticker.el b/lisp/net/newsticker.el
index b5c0b0e..e1f4c8f 100644
--- a/lisp/net/newsticker.el
+++ b/lisp/net/newsticker.el
@@ -1,6 +1,6 @@
 ;;; newsticker.el --- A Newsticker for Emacs. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <address@hidden>
 ;; Filename:    newsticker.el
diff --git a/lisp/net/nsm.el b/lisp/net/nsm.el
index e857e64..6a312e2 100644
--- a/lisp/net/nsm.el
+++ b/lisp/net/nsm.el
@@ -1,6 +1,6 @@
 ;;; nsm.el --- Network Security Manager
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: encryption, security, network
diff --git a/lisp/net/ntlm.el b/lisp/net/ntlm.el
index 142c375..88c5619 100644
--- a/lisp/net/ntlm.el
+++ b/lisp/net/ntlm.el
@@ -1,6 +1,6 @@
 ;;; ntlm.el --- NTLM (NT LanManager) authentication support  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2001, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Taro Kawagishi <address@hidden>
 ;; Maintainer: Thomas Fitzsimmons <address@hidden>
diff --git a/lisp/net/pop3.el b/lisp/net/pop3.el
index 2a6807e..599e230 100644
--- a/lisp/net/pop3.el
+++ b/lisp/net/pop3.el
@@ -1,6 +1,6 @@
 ;;; pop3.el --- Post Office Protocol (RFC 1460) interface  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Richard L. Pieri <address@hidden>
 ;; Maintainer: address@hidden
@@ -165,12 +165,7 @@ Used for APOP authentication.")
       "How long pop3 should wait between checking for the end of output.
 Shorter values mean quicker response, but are more CPU intensive.")
     (defun pop3-accept-process-output (process)
-      (accept-process-output
-       process
-       (truncate pop3-read-timeout)
-       (truncate (* (- pop3-read-timeout
-                      (truncate pop3-read-timeout))
-                   1000))))))
+      (accept-process-output process pop3-read-timeout))))
 
 (defvar pop3-uidl)
 ;; List of UIDLs of existing messages at present in the server:
@@ -185,8 +180,8 @@ Shorter values mean quicker response, but are more CPU 
intensive.")
 ;;  ("SERVER_B" ("USER_B1" "UIDL1" TIMESTAMP1 "UIDL2" TIMESTAMP2...)
 ;;              ("USER_B2" "UIDL1" TIMESTAMP1 "UIDL2" TIMESTAMP2...)
 ;;              ...))
-;; Where TIMESTAMP is the most significant two digits of an Emacs time,
-;; i.e. the return value of `current-time'.
+;; Where TIMESTAMP is an Emacs time value (HI LO) representing the
+;; number of seconds (+ (ash HI 16) LO).
 
 ;;;###autoload
 (defun pop3-movemail (file)
@@ -385,7 +380,9 @@ Use streaming commands."
 (defun pop3-uidl-dele (process)
   "Delete messages according to `pop3-leave-mail-on-server'.
 Return non-nil if it is necessary to update the local UIDL file."
-  (let* ((ctime (current-time))
+  (let* ((ctime (encode-time nil 'list))
+        (age-limit (and (numberp pop3-leave-mail-on-server)
+                        (* 86400 pop3-leave-mail-on-server)))
         (srvr (assoc pop3-mailhost pop3-uidl-saved))
         (saved (assoc pop3-maildrop (cdr srvr)))
         i uidl mod new tstamp dele)
@@ -402,17 +399,13 @@ Return non-nil if it is necessary to update the local 
UIDL file."
           (setq new (mapcan (lambda (elt) (list elt ctime)) pop3-uidl))))
     (when new (setq mod t))
     ;; List expirable messages and delete them from the data to be saved.
-    (setq ctime (when (numberp pop3-leave-mail-on-server)
-                 (/ (+ (* (car ctime) 65536.0) (cadr ctime)) 86400))
-         i (1- (length saved)))
+    (setq i (1- (length saved)))
     (while (> i 0)
       (if (member (setq uidl (nth (1- i) saved)) pop3-uidl)
          (progn
            (setq tstamp (nth i saved))
-           (if (and ctime
-                    (> (- ctime (/ (+ (* (car tstamp) 65536.0) (cadr tstamp))
-                                   86400))
-                       pop3-leave-mail-on-server))
+           (if (and age-limit
+                    (time-less-p age-limit (time-subtract ctime tstamp)))
                ;; Mails to delete.
                (progn
                  (setq mod t)
@@ -592,7 +585,7 @@ Return the response string if optional second argument is 
non-nil."
       (goto-char pop3-read-point)
       (if (looking-at "-ERR")
          (error "%s" (buffer-substring (point) (- match-end 2)))
-       (if (not (looking-at "+OK"))
+       (if (not (looking-at "\\+OK"))
            (progn (setq pop3-read-point match-end) nil)
          (setq pop3-read-point match-end)
          (if return
@@ -691,14 +684,14 @@ If NOW, use that time instead."
   "Send USER information to POP3 server."
   (pop3-send-command process (format "USER %s" user))
   (let ((response (pop3-read-response process t)))
-    (if (not (and response (string-match "+OK" response)))
+    (if (not (and response (string-match "\\+OK" response)))
        (error "USER %s not valid" user))))
 
 (defun pop3-pass (process)
   "Send authentication information to the server."
   (pop3-send-command process (format "PASS %s" pop3-password))
   (let ((response (pop3-read-response process t)))
-    (if (not (and response (string-match "+OK" response)))
+    (if (not (and response (string-match "\\+OK" response)))
        (pop3-quit process))))
 
 (defun pop3-apop (process user)
@@ -711,7 +704,7 @@ If NOW, use that time instead."
        (let ((hash (md5 (concat pop3-timestamp pass) nil nil 'binary)))
          (pop3-send-command process (format "APOP %s %s" user hash))
          (let ((response (pop3-read-response process t)))
-           (if (not (and response (string-match "+OK" response)))
+           (if (not (and response (string-match "\\+OK" response)))
                (pop3-quit process)))))
     ))
 
diff --git a/lisp/net/puny.el b/lisp/net/puny.el
index efa11cf..23c7af8 100644
--- a/lisp/net/puny.el
+++ b/lisp/net/puny.el
@@ -1,6 +1,6 @@
 ;;; puny.el --- translate non-ASCII domain names to ASCII
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: mail, net
diff --git a/lisp/net/quickurl.el b/lisp/net/quickurl.el
index a5ba26b..3f7e9d1 100644
--- a/lisp/net/quickurl.el
+++ b/lisp/net/quickurl.el
@@ -1,6 +1,6 @@
 ;;; quickurl.el --- insert a URL based on text at point in buffer
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Pearson <address@hidden>
 ;; Maintainer: Dave Pearson <address@hidden>
@@ -504,15 +504,15 @@ TYPE dictates what will be inserted, options are:
         (with-current-buffer quickurl-list-last-buffer
           (insert
            (pcase type
-             (`url         (funcall quickurl-format-function url))
-             (`naked-url   (quickurl-url-url url))
-             (`with-lookup (format "%s <URL:%s>"
+             ('url         (funcall quickurl-format-function url))
+             ('naked-url   (quickurl-url-url url))
+             ('with-lookup (format "%s <URL:%s>"
                                    (quickurl-url-keyword url)
                                    (quickurl-url-url url)))
-             (`with-desc   (format "%S <URL:%s>"
+             ('with-desc   (format "%S <URL:%s>"
                                    (quickurl-url-description url)
                                    (quickurl-url-url url)))
-             (`lookup      (quickurl-url-keyword url)))))
+             ('lookup      (quickurl-url-keyword url)))))
       (error "No URL details on that line"))
     url))
 
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index fe9c71a..b1a6c1c 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -1,6 +1,6 @@
 ;;; rcirc.el --- default, simple IRC client          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Ryan Yeske <address@hidden>
 ;; Maintainers: Ryan Yeske <address@hidden>,
@@ -168,6 +168,14 @@ underneath each nick."
                 (string :tag "Prefix text"))
   :group 'rcirc)
 
+(defcustom rcirc-url-max-length nil
+  "Maximum number of characters in displayed URLs.
+If nil, no maximum is applied."
+  :version "27.1"
+  :type '(choice (const :tag "No maximum" nil)
+                 (integer :tag "Number of characters"))
+  :group 'rcirc)
+
 (defvar rcirc-ignore-buffer-activity-flag nil
   "If non-nil, ignore activity in this buffer.")
 (make-variable-buffer-local 'rcirc-ignore-buffer-activity-flag)
@@ -662,8 +670,9 @@ last ping."
 
 (defun rcirc-handler-ctcp-KEEPALIVE (process _target _sender message)
   (with-rcirc-process-buffer process
-    (setq header-line-format (format "%f" (- (float-time)
-                                            (string-to-number message))))))
+    (setq header-line-format
+         (format "%f" (float-time
+                       (time-since (string-to-number message)))))))
 
 (defvar rcirc-debug-buffer "*rcirc debug*")
 (defvar rcirc-debug-flag nil
@@ -715,8 +724,8 @@ When 0, do not auto-reconnect."
                  (< 0 rcirc-reconnect-delay))
         (let ((now (current-time)))
           (when (or (null rcirc-last-connect-time)
-                    (< rcirc-reconnect-delay
-                       (float-time (time-subtract now 
rcirc-last-connect-time))))
+                   (time-less-p rcirc-reconnect-delay
+                                (time-subtract now rcirc-last-connect-time)))
             (setq rcirc-last-connect-time now)
             (rcirc-cmd-reconnect nil))))
       (run-hook-with-args 'rcirc-sentinel-functions process sentinel))))
@@ -751,12 +760,12 @@ Function is called with PROCESS, COMMAND, SENDER, ARGS 
and LINE.")
   (with-rcirc-process-buffer process
     (setq rcirc-last-server-message-time (current-time))
     (setq rcirc-process-output (concat rcirc-process-output output))
-    (when (= (aref rcirc-process-output
-                   (1- (length rcirc-process-output))) ?\n)
-      (mapc (lambda (line)
-              (rcirc-process-server-response process line))
-            (split-string rcirc-process-output "[\n\r]" t))
-      (setq rcirc-process-output nil))))
+    (when (= ?\n (aref rcirc-process-output
+                       (1- (length rcirc-process-output))))
+      (let ((lines (split-string rcirc-process-output "[\n\r]" t)))
+        (setq rcirc-process-output nil)
+        (dolist (line lines)
+          (rcirc-process-server-response process line))))))
 
 (defun rcirc-reschedule-timeout (process)
   (with-rcirc-process-buffer process
@@ -2056,9 +2065,7 @@ activity.  Only run if the buffer is not visible and
 (defvar rcirc-visible-buffers nil)
 (defun rcirc-window-configuration-change ()
   (unless (minibuffer-window-active-p (minibuffer-window))
-    ;; delay this until command has finished to make sure window is
-    ;; actually visible before clearing activity
-    (add-hook 'post-command-hook 'rcirc-window-configuration-change-1)))
+    (rcirc-window-configuration-change-1)))
 
 (defun rcirc-window-configuration-change-1 ()
   ;; clear activity and overlay arrows
@@ -2082,9 +2089,7 @@ activity.  Only run if the buffer is not visible and
                            rcirc-activity)))
     ;; update the mode-line string
     (unless (equal old-activity rcirc-activity)
-      (rcirc-update-activity-string)))
-
-  (remove-hook 'post-command-hook 'rcirc-window-configuration-change-1))
+      (rcirc-update-activity-string))))
 
 
 ;;; buffer name abbreviation
@@ -2485,24 +2490,26 @@ If ARG is given, opens the URL in a new browser window."
        (rcirc-record-activity (current-buffer) 'nick)))))
 
 (defun rcirc-markup-urls (_sender _response)
-  (while (and rcirc-url-regexp ;; nil means disable URL catching
+  (while (and rcirc-url-regexp ; nil means disable URL catching.
               (re-search-forward rcirc-url-regexp nil t))
     (let* ((start (match-beginning 0))
-           (end (match-end 0))
-           (url (match-string-no-properties 0))
-           (link-text (buffer-substring-no-properties start end)))
+           (url   (buffer-substring-no-properties start (point))))
+      (when rcirc-url-max-length
+        ;; Replace match with truncated URL.
+        (delete-region start (point))
+        (insert (url-truncate-url-for-viewing url rcirc-url-max-length)))
       ;; Add a button for the URL.  Note that we use `make-text-button',
       ;; rather than `make-button', as text-buttons are much faster in
       ;; large buffers.
-      (make-text-button start end
+      (make-text-button start (point)
                        'face 'rcirc-url
                        'follow-link t
                        'rcirc-url url
                        'action (lambda (button)
                                  (browse-url (button-get button 'rcirc-url))))
-      ;; record the url if it is not already the latest stored url
-      (when (not (string= link-text (caar rcirc-urls)))
-        (push (cons link-text start) rcirc-urls)))))
+      ;; Record the URL if it is not already the latest stored URL.
+      (unless (string= url (caar rcirc-urls))
+        (push (cons url start) rcirc-urls)))))
 
 (defun rcirc-markup-keywords (sender response)
   (when (and (string= response "PRIVMSG")
@@ -2788,7 +2795,7 @@ the only argument."
   (let* ((nick (nth 1 args))
          (idle-secs (string-to-number (nth 2 args)))
          (idle-string (format-seconds "%yy %dd %hh %mm %z%ss" idle-secs))
-         (signon-time (seconds-to-time (string-to-number (nth 3 args))))
+        (signon-time (string-to-number (nth 3 args)))
          (signon-string (format-time-string "%c" signon-time))
          (message (format "%s idle for %s, signed on %s"
                           nick idle-string signon-string)))
@@ -2809,8 +2816,7 @@ Not in rfc1459.txt"
     (with-current-buffer buffer
       (let ((setter (nth 2 args))
            (time (current-time-string
-                  (seconds-to-time
-                   (string-to-number (cl-cadddr args))))))
+                  (string-to-number (cl-cadddr args)))))
        (rcirc-print process sender "TOPIC" (cadr args)
                     (format "%s (%s on %s)" rcirc-topic setter time))))))
 
diff --git a/lisp/net/rfc2104.el b/lisp/net/rfc2104.el
index 57bca2e..68c35aa 100644
--- a/lisp/net/rfc2104.el
+++ b/lisp/net/rfc2104.el
@@ -1,6 +1,6 @@
 ;;; rfc2104.el --- RFC2104 Hashed Message Authentication Codes  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 ;; Keywords: mail
diff --git a/lisp/net/rlogin.el b/lisp/net/rlogin.el
index 015e04f..bf6f535 100644
--- a/lisp/net/rlogin.el
+++ b/lisp/net/rlogin.el
@@ -1,6 +1,6 @@
 ;;; rlogin.el --- remote login interface  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-1995, 1997-1998, 2001-2018 Free Software
+;; Copyright (C) 1992-1995, 1997-1998, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Noah Friedman
diff --git a/lisp/net/sasl-cram.el b/lisp/net/sasl-cram.el
index d5d8ddf..a4d80c9 100644
--- a/lisp/net/sasl-cram.el
+++ b/lisp/net/sasl-cram.el
@@ -1,6 +1,6 @@
 ;;; sasl-cram.el --- CRAM-MD5 module for the SASL client framework
 
-;; Copyright (C) 2000, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;;     Kenichi OKADA <address@hidden>
diff --git a/lisp/net/sasl-digest.el b/lisp/net/sasl-digest.el
index e127ee5..28b5886 100644
--- a/lisp/net/sasl-digest.el
+++ b/lisp/net/sasl-digest.el
@@ -1,6 +1,6 @@
 ;;; sasl-digest.el --- DIGEST-MD5 module for the SASL client framework
 
-;; Copyright (C) 2000, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;;     Kenichi OKADA <address@hidden>
diff --git a/lisp/net/sasl-ntlm.el b/lisp/net/sasl-ntlm.el
index c9e5eed..4a142af 100644
--- a/lisp/net/sasl-ntlm.el
+++ b/lisp/net/sasl-ntlm.el
@@ -1,6 +1,6 @@
 ;;; sasl-ntlm.el --- NTLM (NT Lan Manager) module for the SASL client framework
 
-;; Copyright (C) 2000, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Taro Kawagishi <address@hidden>
 ;; Keywords: SASL, NTLM
diff --git a/lisp/net/sasl-scram-rfc.el b/lisp/net/sasl-scram-rfc.el
index e524b59..f4d33a6 100644
--- a/lisp/net/sasl-scram-rfc.el
+++ b/lisp/net/sasl-scram-rfc.el
@@ -1,6 +1,6 @@
 ;;; sasl-scram-rfc.el --- SCRAM-SHA-1 module for the SASL client framework  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Magnus Henoch <address@hidden>
 ;; Package: sasl
diff --git a/lisp/net/sasl.el b/lisp/net/sasl.el
index ca0b66b..492f657 100644
--- a/lisp/net/sasl.el
+++ b/lisp/net/sasl.el
@@ -1,6 +1,6 @@
 ;;; sasl.el --- SASL client framework
 
-;; Copyright (C) 2000, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Keywords: SASL
diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el
index ca75d95..5d294ce 100644
--- a/lisp/net/secrets.el
+++ b/lisp/net/secrets.el
@@ -1,6 +1,6 @@
 ;;; secrets.el --- Client interface to gnome-keyring and kwallet. -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 ;; Keywords: comm password passphrase
diff --git a/lisp/net/shr-color.el b/lisp/net/shr-color.el
index 6303141..2d6cf68 100644
--- a/lisp/net/shr-color.el
+++ b/lisp/net/shr-color.el
@@ -1,6 +1,6 @@
 ;;; shr-color.el --- Simple HTML Renderer color management  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Julien Danjou <address@hidden>
 ;; Keywords: html
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 7ef1e18..2f628e1 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -1,6 +1,6 @@
 ;;; shr.el --- Simple HTML Renderer -*- lexical-binding: t -*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: html
@@ -1755,7 +1755,14 @@ The preference is a float determined from 
`shr-prefer-media-type'."
 
 (defun shr-tag-ol (dom)
   (shr-ensure-paragraph)
-  (let ((shr-list-mode 1))
+  (let* ((attrs (dom-attributes dom))
+         (start-attr (alist-get 'start attrs))
+         ;; Start at 1 if there is no start attribute
+         ;; or if start can't be parsed as an integer.
+         (start-index (condition-case _
+                          (cl-parse-integer start-attr)
+                        (t 1)))
+         (shr-list-mode start-index))
     (shr-generic dom))
   (shr-ensure-paragraph))
 
diff --git a/lisp/net/sieve-manage.el b/lisp/net/sieve-manage.el
index 8c70ae0..72731b8 100644
--- a/lisp/net/sieve-manage.el
+++ b/lisp/net/sieve-manage.el
@@ -1,6 +1,6 @@
 ;;; sieve-manage.el --- Implementation of the managesieve protocol in elisp  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 ;;         Albert Krewinkel <address@hidden>
diff --git a/lisp/net/sieve-mode.el b/lisp/net/sieve-mode.el
index b9f424f..adab010 100644
--- a/lisp/net/sieve-mode.el
+++ b/lisp/net/sieve-mode.el
@@ -1,6 +1,6 @@
 ;;; sieve-mode.el --- Sieve code editing commands for Emacs
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 
diff --git a/lisp/net/sieve.el b/lisp/net/sieve.el
index ef7bb5c..d237c1e 100644
--- a/lisp/net/sieve.el
+++ b/lisp/net/sieve.el
@@ -1,6 +1,6 @@
 ;;; sieve.el --- Utilities to manage sieve scripts
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 
diff --git a/lisp/net/snmp-mode.el b/lisp/net/snmp-mode.el
index cb3b176..45b8b70 100644
--- a/lisp/net/snmp-mode.el
+++ b/lisp/net/snmp-mode.el
@@ -1,6 +1,6 @@
 ;;; snmp-mode.el --- SNMP & SNMPv2 MIB major mode
 
-;; Copyright (C) 1995, 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Paul D. Smith <address@hidden>
 ;; Keywords: data
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el
index 7c40966..1632ee1 100644
--- a/lisp/net/soap-client.el
+++ b/lisp/net/soap-client.el
@@ -1,6 +1,6 @@
 ;;; soap-client.el --- Access SOAP web services       -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Alexandru Harsanyi <address@hidden>
 ;; Author: Thomas Fitzsimmons <address@hidden>
@@ -629,7 +629,7 @@ disallows them."
              (<= time-zone-minute 59))
       (error "Invalid or unsupported time: %s" date-time-string))
     ;; Return a value in a format similar to that returned by decode-time, and
-    ;; suitable for (apply 'encode-time ...).
+    ;; suitable for (apply #'encode-time ...).
     (list second minute hour day month year second-fraction datatype
           (if has-time-zone
               (* (rng-xsd-time-to-seconds
diff --git a/lisp/net/soap-inspect.el b/lisp/net/soap-inspect.el
index 252b1f3..17b6675 100644
--- a/lisp/net/soap-inspect.el
+++ b/lisp/net/soap-inspect.el
@@ -1,6 +1,6 @@
 ;;; soap-inspect.el --- Interactive WSDL inspector    -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Alexandru Harsanyi <address@hidden>
 ;; Created: October 2010
diff --git a/lisp/net/socks.el b/lisp/net/socks.el
index 5ee6eea..6356707 100644
--- a/lisp/net/socks.el
+++ b/lisp/net/socks.el
@@ -1,6 +1,6 @@
 ;;; socks.el --- A Socks v5 Client for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1996-2000, 2002, 2007-2018 Free Software Foundation,
+;; Copyright (C) 1996-2000, 2002, 2007-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: William M. Perry <address@hidden>
diff --git a/lisp/net/telnet.el b/lisp/net/telnet.el
index 93a4e7e..cf3634f 100644
--- a/lisp/net/telnet.el
+++ b/lisp/net/telnet.el
@@ -1,6 +1,6 @@
 ;;; telnet.el --- run a telnet session from within an Emacs buffer
 
-;; Copyright (C) 1985, 1988, 1992, 1994, 2001-2018 Free Software
+;; Copyright (C) 1985, 1988, 1992, 1994, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: William F. Schelter
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 36374f8..6896042 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1,6 +1,6 @@
 ;;; tramp-adb.el --- Functions for calling Android Debug Bridge from Tramp  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Jürgen Hötzel <address@hidden>
 ;; Keywords: comm, processes
@@ -35,14 +35,12 @@
 
 (require 'tramp)
 
-;;;###tramp-autoload
 (defcustom tramp-adb-program "adb"
   "Name of the Android Debug Bridge program."
   :group 'tramp
   :version "24.4"
   :type 'string)
 
-;;;###tramp-autoload
 (defcustom tramp-adb-connect-if-not-connected nil
   "Try to run `adb connect' if provided device is not connected currently.
 It is used for TCP/IP devices."
@@ -54,7 +52,6 @@ It is used for TCP/IP devices."
 (defconst tramp-adb-method "adb"
   "When this method name is used, forward all calls to Android Debug Bridge.")
 
-;;;###tramp-autoload
 (defcustom tramp-adb-prompt
   
"^\\(?:[[:digit:]]*|?\\)?\\(?:[[:alnum:]\e;address@hidden:alnum:]]*[^#\\$]*\\)?[#\\$][[:space:]]"
   "Regexp used as prompt in almquist shell."
@@ -78,22 +75,20 @@ It is used for TCP/IP devices."
   "Regexp for ls output.")
 
 ;;;###tramp-autoload
-(add-to-list 'tramp-methods
-            `(,tramp-adb-method
-              (tramp-tmpdir "/data/local/tmp")
-               (tramp-default-port 5555)))
+(tramp--with-startup
+ (add-to-list 'tramp-methods
+             `(,tramp-adb-method
+               (tramp-tmpdir            "/data/local/tmp")
+                (tramp-default-port      5555)))
 
-;;;###tramp-autoload
-(add-to-list 'tramp-default-host-alist `(,tramp-adb-method nil ""))
+ (add-to-list 'tramp-default-host-alist `(,tramp-adb-method nil ""))
 
-;;;###tramp-autoload
-(eval-after-load 'tramp
-  '(tramp-set-completion-function
-    tramp-adb-method '((tramp-adb-parse-device-names ""))))
+ (tramp-set-completion-function
+  tramp-adb-method '((tramp-adb-parse-device-names ""))))
 
 ;;;###tramp-autoload
 (defconst tramp-adb-file-name-handler-alist
-  '((access-file . ignore)
+  '((access-file . tramp-handle-access-file)
     (add-name-to-file . tramp-handle-add-name-to-file)
     ;; `byte-compiler-base-file-name' performed by default handler.
     ;; `copy-directory' performed by default handler.
@@ -108,7 +103,7 @@ It is used for TCP/IP devices."
     (dired-compress-file . ignore)
     (dired-uncache . tramp-handle-dired-uncache)
     (exec-path . tramp-adb-handle-exec-path)
-    (expand-file-name . tramp-adb-handle-expand-file-name)
+    (expand-file-name . tramp-handle-expand-file-name)
     (file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
     (file-acl . ignore)
     (file-attributes . tramp-adb-handle-file-attributes)
@@ -141,7 +136,6 @@ It is used for TCP/IP devices."
     (file-truename . tramp-adb-handle-file-truename)
     (file-writable-p . tramp-adb-handle-file-writable-p)
     (find-backup-file-name . tramp-handle-find-backup-file-name)
-    ;; `find-file-noselect' performed by default handler.
     ;; `get-file-buffer' performed by default handler.
     (insert-directory . tramp-handle-insert-directory)
     (insert-file-contents . tramp-handle-insert-file-contents)
@@ -150,6 +144,7 @@ It is used for TCP/IP devices."
     (make-directory . tramp-adb-handle-make-directory)
     (make-directory-internal . ignore)
     (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
+    (make-process . tramp-adb-handle-make-process)
     (make-symbolic-link . tramp-handle-make-symbolic-link)
     (process-file . tramp-adb-handle-process-file)
     (rename-file . tramp-adb-handle-rename-file)
@@ -158,10 +153,11 @@ It is used for TCP/IP devices."
     (set-file-selinux-context . ignore)
     (set-file-times . tramp-adb-handle-set-file-times)
     (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
-    (shell-command . tramp-adb-handle-shell-command)
-    (start-file-process . tramp-adb-handle-start-file-process)
+    (shell-command . tramp-handle-shell-command)
+    (start-file-process . tramp-handle-start-file-process)
     (substitute-in-file-name . tramp-handle-substitute-in-file-name)
     (temporary-file-directory . tramp-handle-temporary-file-directory)
+    (tramp-set-file-uid-gid . ignore)
     (unhandled-file-name-directory . ignore)
     (vc-registered . ignore)
     (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
@@ -173,8 +169,9 @@ It is used for TCP/IP devices."
 ;;;###tramp-autoload
 (defsubst tramp-adb-file-name-p (filename)
   "Check if it's a filename for ADB."
-  (let ((v (tramp-dissect-file-name filename)))
-    (string= (tramp-file-name-method v) tramp-adb-method)))
+  (and (tramp-tramp-file-p filename)
+       (string= (tramp-file-name-method (tramp-dissect-file-name filename))
+               tramp-adb-method)))
 
 ;;;###tramp-autoload
 (defun tramp-adb-file-name-handler (operation &rest args)
@@ -187,66 +184,21 @@ pass to the OPERATION."
       (tramp-run-real-handler operation args))))
 
 ;;;###tramp-autoload
-(tramp-register-foreign-file-name-handler
- 'tramp-adb-file-name-p 'tramp-adb-file-name-handler)
+(tramp--with-startup
+ (tramp-register-foreign-file-name-handler
+  #'tramp-adb-file-name-p #'tramp-adb-file-name-handler))
 
 ;;;###tramp-autoload
 (defun tramp-adb-parse-device-names (_ignore)
   "Return a list of (nil host) tuples allowed to access."
-  (with-timeout (10)
-    (with-temp-buffer
-      ;; `call-process' does not react on timer under MS Windows.
-      ;; That's why we use `start-process'.
-      ;; We don't know yet whether we need a user or host name for the
-      ;; connection vector.  We assume we don't, it will be OK in most
-      ;; of the cases.  Otherwise, there might be an additional trace
-      ;; buffer, which doesn't hurt.
-      (let ((p (start-process
-               tramp-adb-program (current-buffer) tramp-adb-program "devices"))
-           (v (make-tramp-file-name :method tramp-adb-method))
-           result)
-       (tramp-message v 6 "%s" (mapconcat 'identity (process-command p) " "))
-       (process-put p 'adjust-window-size-function 'ignore)
-       (set-process-query-on-exit-flag p nil)
-       (while (process-live-p p)
-         (accept-process-output p 0.1))
-       (accept-process-output p 0.1)
-       (tramp-message v 6 "\n%s" (buffer-string))
-       (goto-char (point-min))
-       (while (search-forward-regexp "^\\(\\S-+\\)[[:space:]]+device$" nil t)
-         (push (list nil (match-string 1)) result))
-
-       ;; Replace ":" by "#".
-       (mapc
-        (lambda (elt)
-          (setcar
-           (cdr elt)
-           (replace-regexp-in-string
-            ":" tramp-prefix-port-format (car (cdr elt)))))
-        result)
-       result))))
-
-(defun tramp-adb-handle-expand-file-name (name &optional dir)
-  "Like `expand-file-name' for Tramp files."
-  ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
-  (setq dir (or dir default-directory "/"))
-  ;; Unless NAME is absolute, concat DIR and NAME.
-  (unless (file-name-absolute-p name)
-    (setq name (concat (file-name-as-directory dir) name)))
-  ;; If NAME is not a Tramp file, run the real handler.
-  (if (not (tramp-tramp-file-p name))
-      (tramp-run-real-handler 'expand-file-name (list name nil))
-    ;; Dissect NAME.
-    (with-parsed-tramp-file-name name nil
-      (unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
-       (setq localname (concat "/" localname)))
-      ;; Do normal `expand-file-name' (this does "/./" and "/../").
-      ;; `default-directory' is bound, because on Windows there would
-      ;; be problems with UNC shares or Cygwin mounts.
-      (let ((default-directory (tramp-compat-temporary-file-directory)))
-       (tramp-make-tramp-file-name
-        v (tramp-drop-volume-letter
-           (tramp-run-real-handler 'expand-file-name (list localname))))))))
+  (delq nil
+       (mapcar
+        (lambda (line)
+          (when (string-match "^\\(\\S-+\\)[[:space:]]+device$" line)
+            ;; Replace ":" by "#".
+            `(nil ,(replace-regexp-in-string
+                    ":" tramp-prefix-port-format (match-string 1 line)))))
+        (tramp-process-lines nil tramp-adb-program "devices"))))
 
 (defun tramp-adb-handle-file-system-info (filename)
   "Like `file-system-info' for Tramp files."
@@ -259,10 +211,11 @@ pass to the OPERATION."
        (goto-char (point-min))
        (forward-line)
        (when (looking-at
-              (concat "[[:space:]]*[^[:space:]]+"
-                      "[[:space:]]+\\([[:digit:]]+\\)"
-                      "[[:space:]]+\\([[:digit:]]+\\)"
-                      "[[:space:]]+\\([[:digit:]]+\\)"))
+              (eval-when-compile
+                (concat "[[:space:]]*[^[:space:]]+"
+                        "[[:space:]]+\\([[:digit:]]+\\)"
+                        "[[:space:]]+\\([[:digit:]]+\\)"
+                        "[[:space:]]+\\([[:digit:]]+\\)")))
          ;; The values are given as 1k numbers, so we must change
          ;; them to number of bytes.
          (list (* 1024 (string-to-number (match-string 1)))
@@ -279,7 +232,7 @@ pass to the OPERATION."
    ;; Preserve trailing "/".
   (funcall
    (if (string-equal (file-name-nondirectory filename) "")
-       'file-name-as-directory 'identity)
+       #'file-name-as-directory #'identity)
    (with-parsed-tramp-file-name (expand-file-name filename) nil
      (tramp-make-tramp-file-name
       v
@@ -304,14 +257,14 @@ pass to the OPERATION."
              (setq thisstep (pop steps))
              (tramp-message
               v 5 "Check %s"
-              (mapconcat 'identity
+              (mapconcat #'identity
                          (append '("") (reverse result) (list thisstep))
                          "/"))
              (setq symlink-target
                    (tramp-compat-file-attribute-type
                     (file-attributes
                      (tramp-make-tramp-file-name
-                      v (mapconcat 'identity
+                      v (mapconcat #'identity
                                    (append
                                     '("") (reverse result) (list thisstep))
                                    "/")))))
@@ -349,7 +302,7 @@ pass to the OPERATION."
            ;; Combine list to form string.
            (setq result
                  (if result
-                     (mapconcat 'identity (cons "" result) "/")
+                     (mapconcat #'identity (cons "" result) "/")
                    "/"))
            (when (and is-dir (or (string= "" result)
                                  (not (string= (substring result -1) "/"))))
@@ -462,7 +415,7 @@ pass to the OPERATION."
                     (sort result (lambda (x y) (string< (car x) (car y))))))
             (delq nil
                   (mapcar (lambda (x)
-                            (if (or (not match) (string-match match (car x)))
+                            (if (or (not match) (string-match-p match (car x)))
                                 x))
                           result)))))))))
 
@@ -491,15 +444,15 @@ pass to the OPERATION."
   "Almquist shell can't handle multiple arguments.
 Convert (\"-al\") to (\"-a\" \"-l\").  Remove arguments like \"--dired\"."
   (split-string
-   (apply 'concat
+   (apply #'concat
          (mapcar (lambda (s)
                    (replace-regexp-in-string
-                    "\\(.\\)"  " -\\1" (replace-regexp-in-string "^-" "" s)))
+                    "\\(.\\)" " -\\1" (replace-regexp-in-string "^-" "" s)))
                  ;; FIXME: Warning about removed switches (long and non-dash).
                  (delq nil
                        (mapcar
                         (lambda (s)
-                          (and (not (string-match "\\(^--\\|^[^-]\\)" s)) s))
+                          (and (not (string-match-p "\\(^--\\|^[^-]\\)" s)) s))
                         switches))))))
 
 (defun tramp-adb-sh-fix-ls-output (&optional sort-by-time)
@@ -514,7 +467,7 @@ Emacs dired can't find files."
         
"[[:space:]]\\([[:space:]][0-9]\\{4\\}-[0-9][0-9]-[0-9][0-9][[:space:]]\\)" nil 
t)
       (replace-match "0\\1" "\\1" nil)
       ;; Insert missing "/".
-      (when (looking-at "[0-9][0-9]:[0-9][0-9][[:space:]]+$")
+      (when (looking-at-p "[0-9][0-9]:[0-9][0-9][[:space:]]+$")
        (end-of-line)
        (insert "/")))
     ;; Sort entries.
@@ -523,10 +476,10 @@ Emacs dired can't find files."
            (sort
             lines
             (if sort-by-time
-                'tramp-adb-ls-output-time-less-p
-              'tramp-adb-ls-output-name-less-p))))
+                #'tramp-adb-ls-output-time-less-p
+              #'tramp-adb-ls-output-name-less-p))))
       (delete-region (point-min) (point-max))
-      (insert "  " (mapconcat 'identity sorted-lines "\n  ")))
+      (insert "  " (mapconcat #'identity sorted-lines "\n  ")))
     ;; Add final newline.
     (goto-char (point-max))
     (unless (bolp) (insert "\n"))))
@@ -535,9 +488,9 @@ Emacs dired can't find files."
   "Sort \"ls\" output by time, descending."
   (let (time-a time-b)
     (string-match tramp-adb-ls-date-regexp a)
-    (setq time-a (apply 'encode-time (parse-time-string (match-string 0 a))))
+    (setq time-a (apply #'encode-time (parse-time-string (match-string 0 a))))
     (string-match tramp-adb-ls-date-regexp b)
-    (setq time-b (apply 'encode-time (parse-time-string (match-string 0 b))))
+    (setq time-b (apply #'encode-time (parse-time-string (match-string 0 b))))
     (time-less-p time-b time-a)))
 
 (defun tramp-adb-ls-output-name-less-p (a b)
@@ -594,28 +547,27 @@ Emacs dired can't find files."
    filename
    (with-parsed-tramp-file-name (expand-file-name directory) nil
      (with-tramp-file-property v localname "file-name-all-completions"
-       (save-match-data
-        (tramp-adb-send-command
-         v (format "%s -a %s"
-                   (tramp-adb-get-ls-command v)
-                   (tramp-shell-quote-argument localname)))
-        (mapcar
-         (lambda (f)
-           (if (file-directory-p (expand-file-name f directory))
-               (file-name-as-directory f)
-             f))
-         (with-current-buffer (tramp-get-buffer v)
-           (delete-dups
-            (append
-             ;; In older Android versions, "." and ".." are not
-             ;; included.  In newer versions (toybox, since Android
-             ;; 6) they are.  We fix this by `delete-dups'.
-             '("." "..")
-             (delq
-              nil
-              (mapcar
-               (lambda (l) (and (not (string-match  "^[[:space:]]*$" l)) l))
-               (split-string (buffer-string) "\n"))))))))))))
+       (tramp-adb-send-command
+       v (format "%s -a %s"
+                 (tramp-adb-get-ls-command v)
+                 (tramp-shell-quote-argument localname)))
+       (mapcar
+       (lambda (f)
+         (if (file-directory-p (expand-file-name f directory))
+             (file-name-as-directory f)
+           f))
+       (with-current-buffer (tramp-get-buffer v)
+         (delete-dups
+          (append
+           ;; In older Android versions, "." and ".." are not
+           ;; included.  In newer versions (toybox, since Android 6)
+           ;; they are.  We fix this by `delete-dups'.
+           '("." "..")
+           (delq
+            nil
+            (mapcar
+             (lambda (l) (and (not (string-match-p "^[[:space:]]*$" l)) l))
+             (split-string (buffer-string) "\n")))))))))))
 
 (defun tramp-adb-handle-file-local-copy (filename)
   "Like `file-local-copy' for Tramp files."
@@ -634,13 +586,11 @@ Emacs dired can't find files."
          (ignore-errors (delete-file tmpfile))
          (tramp-error
           v 'file-error "Cannot make local copy of file `%s'" filename))
-       (set-file-modes
-        tmpfile
-        (logior (or (file-modes filename) 0) (string-to-number "0400" 8))))
+       (set-file-modes tmpfile (logior (or (file-modes filename) 0) #o0400)))
       tmpfile)))
 
 (defun tramp-adb-handle-file-writable-p (filename)
-  "Like `tramp-sh-handle-file-writable-p'.
+  "Like `file-writable-p' for Tramp files.
 But handle the case, if the \"test\" command is not available."
   (with-parsed-tramp-file-name filename nil
     (with-tramp-file-property v localname "file-writable-p"
@@ -682,11 +632,9 @@ But handle the case, if the \"test\" command is not 
available."
           (tmpfile (tramp-compat-make-temp-file filename)))
       (when (and append (file-exists-p filename))
        (copy-file filename tmpfile 'ok)
-       (set-file-modes
-        tmpfile
-        (logior (or (file-modes tmpfile) 0) (string-to-number "0600" 8))))
+       (set-file-modes tmpfile (logior (or (file-modes tmpfile) 0) #o0600)))
       (tramp-run-real-handler
-       'write-region (list start end tmpfile append 'no-message lockname))
+       #'write-region (list start end tmpfile append 'no-message lockname))
       (with-tramp-progress-reporter
         v 3 (format-message
              "Moving tmp file `%s' to `%s'" tmpfile filename)
@@ -729,12 +677,22 @@ But handle the case, if the \"test\" command is not 
available."
                        (tramp-compat-time-equal-p time tramp-time-doesnt-exist)
                        (tramp-compat-time-equal-p time tramp-time-dont-know))
                    (current-time)
-                 time)))
+                 time))
+         (quoted-name (tramp-shell-quote-argument localname)))
+      ;; Older versions of toybox 'touch' mishandle nanoseconds and/or
+      ;; trailing "Z", so fall back on plain seconds if nanoseconds+Z
+      ;; fails.  Also, fall back on old POSIX 'touch -t' if 'touch -d'
+      ;; (introduced in POSIX.1-2008) fails.
       (tramp-adb-send-command-and-check
-       ;; Use shell arithmetic because of Emacs integer size limit.
-       v (format "touch -t $(( %d * 65536 + %d )) %s"
-                (car time) (cadr time)
-                (tramp-shell-quote-argument localname))))))
+       v (format (concat "touch -d %s %s 2>/dev/null || "
+                        "touch -d %s %s 2>/dev/null || "
+                        "touch -t %s %s")
+                (format-time-string "%Y-%m-%dT%H:%M:%S.%NZ" time t)
+                quoted-name
+                (format-time-string "%Y-%m-%dT%H:%M:%S" time t)
+                quoted-name
+                (format-time-string "%Y%m%d%H%M.%S" time t)
+                quoted-name)))))
 
 (defun tramp-adb-handle-copy-file
   (filename newname &optional ok-if-already-exists keep-date
@@ -754,8 +712,8 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
            v 0 (format "Copying %s to %s" filename newname)
 
          (if (and t1 t2 (tramp-equal-remote filename newname))
-             (let ((l1 (file-remote-p filename 'localname))
-                   (l2 (file-remote-p newname 'localname)))
+             (let ((l1 (tramp-compat-file-local-name filename))
+                   (l2 (tramp-compat-file-local-name newname)))
                (when (and (not ok-if-already-exists)
                           (file-exists-p newname))
                  (tramp-error v 'file-already-exists newname))
@@ -835,8 +793,8 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
          (if (and t1 t2
                   (tramp-equal-remote filename newname)
                   (not (file-directory-p filename)))
-             (let ((l1 (file-remote-p filename 'localname))
-                   (l2 (file-remote-p newname 'localname)))
+             (let ((l1 (tramp-compat-file-local-name filename))
+                   (l2 (tramp-compat-file-local-name newname)))
                (when (and (not ok-if-already-exists)
                           (file-exists-p newname))
                  (tramp-error v 'file-already-exists newname))
@@ -869,7 +827,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
   (with-parsed-tramp-file-name default-directory nil
     (let (command input tmpinput stderr tmpstderr outbuf ret)
       ;; Compute command.
-      (setq command (mapconcat 'tramp-shell-quote-argument
+      (setq command (mapconcat #'tramp-shell-quote-argument
                               (cons program args) " "))
       ;; Determine input.
       (if (null infile)
@@ -964,160 +922,127 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
          (keyboard-quit)
        ret))))
 
-(defun tramp-adb-handle-shell-command
-  (command &optional output-buffer error-buffer)
-  "Like `shell-command' for Tramp files."
-  (let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command))
-        ;; We cannot use `shell-file-name' and `shell-command-switch',
-        ;; they are variables of the local host.
-        (args (list "sh" "-c" (substring command 0 asynchronous)))
-        current-buffer-p
-        (output-buffer
-         (cond
-          ((bufferp output-buffer) output-buffer)
-          ((stringp output-buffer) (get-buffer-create output-buffer))
-          (output-buffer
-           (setq current-buffer-p t)
-           (current-buffer))
-          (t (get-buffer-create
-              (if asynchronous
-                  "*Async Shell Command*"
-                "*Shell Command Output*")))))
-        (error-buffer
-         (cond
-          ((bufferp error-buffer) error-buffer)
-          ((stringp error-buffer) (get-buffer-create error-buffer))))
-        (buffer
-         (if (and (not asynchronous) error-buffer)
-             (with-parsed-tramp-file-name default-directory nil
-               (list output-buffer (tramp-make-tramp-temp-file v)))
-           output-buffer))
-        (p (get-buffer-process output-buffer)))
-
-    ;; Check whether there is another process running.  Tramp does not
-    ;; support 2 (asynchronous) processes in parallel.
-    (when p
-      (if (yes-or-no-p "A command is running.  Kill it? ")
-         (ignore-errors (kill-process p))
-       (tramp-user-error p "Shell command in progress")))
-
-    (if current-buffer-p
-       (progn
-         (barf-if-buffer-read-only)
-         (push-mark nil t))
-      (with-current-buffer output-buffer
-       (setq buffer-read-only nil)
-       (erase-buffer)))
-
-    (if (and (not current-buffer-p) (integerp asynchronous))
-       (prog1
-           ;; Run the process.
-           (apply 'start-file-process "*Async Shell*" buffer args)
-         ;; Display output.
-         (pop-to-buffer output-buffer)
-         (setq mode-line-process '(":%s"))
-         (shell-mode))
-
-      (prog1
-         ;; Run the process.
-         (apply 'process-file (car args) nil buffer nil (cdr args))
-       ;; Insert error messages if they were separated.
-       (when (listp buffer)
-         (with-current-buffer error-buffer
-           (insert-file-contents (cadr buffer)))
-         (delete-file (cadr buffer)))
-       (if current-buffer-p
-           ;; This is like exchange-point-and-mark, but doesn't
-           ;; activate the mark.  It is cleaner to avoid activation,
-           ;; even though the command loop would deactivate the mark
-           ;; because we inserted text.
-           (goto-char (prog1 (mark t)
-                        (set-marker (mark-marker) (point)
-                                    (current-buffer))))
-         ;; There's some output, display it.
-         (when (with-current-buffer output-buffer (> (point-max) (point-min)))
-           (display-message-or-buffer output-buffer)))))))
-
 ;; We use BUFFER also as connection buffer during setup.  Because of
 ;; this, its original contents must be saved, and restored once
 ;; connection has been setup.
-(defun tramp-adb-handle-start-file-process (name buffer program &rest args)
-  "Like `start-file-process' for Tramp files."
-  (with-parsed-tramp-file-name default-directory nil
-    ;; When PROGRAM is nil, we should provide a tty.  This is not
-    ;; possible here.
-    (unless (stringp program)
-      (tramp-error v 'file-error "PROGRAM must be a string"))
-
-    (let* ((buffer
-           (if buffer
-               (get-buffer-create buffer)
-             ;; BUFFER can be nil.  We use a temporary buffer.
-             (generate-new-buffer tramp-temp-buffer-name)))
-          (command
-           (format "cd %s; %s"
-                   (tramp-shell-quote-argument localname)
-                   (mapconcat 'tramp-shell-quote-argument
-                              (cons program args) " ")))
-          (tramp-process-connection-type
-           (or (null program) tramp-process-connection-type))
-          (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
-          (name1 name)
-          (i 0)
-          ;; We do not want to run timers.
-          timer-list timer-idle-list)
-
-      (while (get-process name1)
-       ;; NAME must be unique as process name.
-       (setq i (1+ i)
-             name1 (format "%s<%d>" name i)))
-      (setq name name1)
-      ;; Set the new process properties.
-      (tramp-set-connection-property v "process-name" name)
-      (tramp-set-connection-property v "process-buffer" buffer)
-
-      (with-current-buffer (tramp-get-connection-buffer v)
-       (unwind-protect
-           ;; We catch this event.  Otherwise, `start-process' could
-           ;; be called on the local host.
-           (save-excursion
-             (save-restriction
-               ;; Activate narrowing in order to save BUFFER
-               ;; contents.  Clear also the modification time;
-               ;; otherwise we might be interrupted by
-               ;; `verify-visited-file-modtime'.
-               (let ((buffer-undo-list t)
-                     (buffer-read-only nil)
-                     (mark (point)))
-                 (clear-visited-file-modtime)
-                 (narrow-to-region (point-max) (point-max))
-                 ;; We call `tramp-adb-maybe-open-connection', in
-                 ;; order to cleanup the prompt afterwards.
-                 (tramp-adb-maybe-open-connection v)
-                 (widen)
-                 (delete-region mark (point))
-                 (narrow-to-region (point-max) (point-max))
-                 ;; Send the command.
-                 (let ((tramp-adb-prompt (regexp-quote command)))
-                   (tramp-adb-send-command v command))
-                 (let ((p (tramp-get-connection-process v)))
-                   ;; Set query flag and process marker for this
-                   ;; process.  We ignore errors, because the process
-                   ;; could have finished already.
-                   (ignore-errors
-                     (set-process-query-on-exit-flag p t)
-                     (set-marker (process-mark p) (point)))
-                   ;; Return process.
-                   p))))
-
-         ;; Save exit.
-         (if (string-match tramp-temp-buffer-name (buffer-name))
-             (ignore-errors
-               (set-process-buffer (tramp-get-connection-process v) nil)
-               (kill-buffer (current-buffer)))
-           (set-buffer-modified-p bmp))
-         (tramp-flush-connection-property v "process-name")
-         (tramp-flush-connection-property v "process-buffer"))))))
+(defun tramp-adb-handle-make-process (&rest args)
+  "Like `make-process' for Tramp files."
+  (when args
+    (with-parsed-tramp-file-name (expand-file-name default-directory) nil
+      (let ((name (plist-get args :name))
+           (buffer (plist-get args :buffer))
+           (command (plist-get args :command))
+           (coding (plist-get args :coding))
+           (noquery (plist-get args :noquery))
+           (stop (plist-get args :stop))
+           (connection-type (plist-get args :connection-type))
+           (filter (plist-get args :filter))
+           (sentinel (plist-get args :sentinel))
+           (stderr (plist-get args :stderr)))
+       (unless (stringp name)
+         (signal 'wrong-type-argument (list #'stringp name)))
+       (unless (or (null buffer) (bufferp buffer) (stringp buffer))
+         (signal 'wrong-type-argument (list #'stringp buffer)))
+       (unless (consp command)
+         (signal 'wrong-type-argument (list #'consp command)))
+       (unless (or (null coding)
+                   (and (symbolp coding) (memq coding coding-system-list))
+                   (and (consp coding)
+                        (memq (car coding) coding-system-list)
+                        (memq (cdr coding) coding-system-list)))
+         (signal 'wrong-type-argument (list #'symbolp coding)))
+       (unless (or (null connection-type) (memq connection-type '(pipe pty)))
+         (signal 'wrong-type-argument (list #'symbolp connection-type)))
+       (unless (or (null filter) (functionp filter))
+         (signal 'wrong-type-argument (list #'functionp filter)))
+       (unless (or (null sentinel) (functionp sentinel))
+         (signal 'wrong-type-argument (list #'functionp sentinel)))
+       (unless (or (null stderr) (bufferp stderr) (stringp stderr))
+         (signal 'wrong-type-argument (list #'stringp stderr)))
+
+       (let* ((buffer
+               (if buffer
+                   (get-buffer-create buffer)
+                 ;; BUFFER can be nil.  We use a temporary buffer.
+                 (generate-new-buffer tramp-temp-buffer-name)))
+              (program (car command))
+              (args (cdr command))
+              (command
+               (format "cd %s; %s"
+                       (tramp-shell-quote-argument localname)
+                       (mapconcat #'tramp-shell-quote-argument
+                                  (cons program args) " ")))
+              (tramp-process-connection-type
+               (or (null program) tramp-process-connection-type))
+              (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
+              (name1 name)
+              (i 0)
+              ;; We do not want to run timers.
+              timer-list timer-idle-list)
+
+         (while (get-process name1)
+           ;; NAME must be unique as process name.
+           (setq i (1+ i)
+                 name1 (format "%s<%d>" name i)))
+         (setq name name1)
+         ;; Set the new process properties.
+         (tramp-set-connection-property v "process-name" name)
+         (tramp-set-connection-property v "process-buffer" buffer)
+
+         (with-current-buffer (tramp-get-connection-buffer v)
+           (unwind-protect
+               ;; We catch this event.  Otherwise, `make-process'
+               ;; could be called on the local host.
+               (save-excursion
+                 (save-restriction
+                   ;; Activate narrowing in order to save BUFFER
+                   ;; contents.  Clear also the modification time;
+                   ;; otherwise we might be interrupted by
+                   ;; `verify-visited-file-modtime'.
+                   (let ((buffer-undo-list t)
+                         (inhibit-read-only t)
+                         (mark (point)))
+                     (clear-visited-file-modtime)
+                     (narrow-to-region (point-max) (point-max))
+                     ;; We call `tramp-adb-maybe-open-connection', in
+                     ;; order to cleanup the prompt afterwards.
+                     (tramp-adb-maybe-open-connection v)
+                     (widen)
+                     (delete-region mark (point-max))
+                     (narrow-to-region (point-max) (point-max))
+                     ;; Send the command.
+                     (let* ((p (tramp-get-connection-process v))
+                            (prompt
+                             (tramp-get-connection-property p "prompt" nil)))
+                       (tramp-set-connection-property
+                        p "prompt" (regexp-quote command))
+                       (tramp-adb-send-command v command)
+                       (tramp-set-connection-property p "prompt" prompt)
+                       ;; Stop process if indicated.
+                       (when stop
+                         (stop-process p))
+                       ;; Set sentinel and filter.
+                       (when sentinel
+                         (set-process-sentinel p sentinel))
+                       (when filter
+                         (set-process-filter p filter))
+                       ;; Set query flag and process marker for this
+                       ;; process.  We ignore errors, because the
+                       ;; process could have finished already.
+                       (ignore-errors
+                         (set-process-query-on-exit-flag p (null noquery))
+                         (set-marker (process-mark p) (point)))
+                       ;; Return process.
+                       p))))
+
+             ;; Save exit.
+             (if (string-match-p tramp-temp-buffer-name (buffer-name))
+                 (ignore-errors
+                   (set-process-buffer (tramp-get-connection-process v) nil)
+                   (kill-buffer (current-buffer)))
+               (set-buffer-modified-p bmp))
+             (tramp-flush-connection-property v "process-name")
+             (tramp-flush-connection-property v "process-buffer"))))))))
 
 (defun tramp-adb-handle-exec-path ()
   "Like `exec-path' for Tramp files."
@@ -1132,7 +1057,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
          (read (current-buffer)))
        ":" 'omit)))
    ;; The equivalent to `exec-directory'.
-   `(,(file-remote-p default-directory 'localname))))
+   `(,(tramp-compat-file-local-name default-directory))))
 
 (defun tramp-adb-get-device (vec)
   "Return full host name from VEC to be used in shell execution.
@@ -1145,7 +1070,7 @@ E.g. a host name \"192.168.1.1#5555\" returns 
\"192.168.1.1:5555\"
   (with-tramp-connection-property (tramp-get-connection-process vec) "device"
     (let* ((host (tramp-file-name-host vec))
           (port (tramp-file-name-port-or-default vec))
-          (devices (mapcar 'cadr (tramp-adb-parse-device-names nil))))
+          (devices (mapcar #'cadr (tramp-adb-parse-device-names nil))))
       (replace-regexp-in-string
        tramp-prefix-port-format ":"
        (cond ((member host devices) host)
@@ -1182,7 +1107,7 @@ E.g. a host name \"192.168.1.1#5555\" returns 
\"192.168.1.1:5555\"
     (prog1
        (unless
            (zerop
-            (apply 'tramp-call-process vec tramp-adb-program nil t nil args))
+            (apply #'tramp-call-process vec tramp-adb-program nil t nil args))
          (buffer-string))
       (tramp-message vec 6 "%s" (buffer-string)))))
 
@@ -1199,12 +1124,14 @@ This happens for Android >= 4.0."
   (tramp-adb-maybe-open-connection vec)
   (tramp-message vec 6 "%s" command)
   (tramp-send-string vec command)
-  ;; fixme: Race condition
+  ;; FIXME: Race condition.
   (tramp-adb-wait-for-output (tramp-get-connection-process vec))
   (with-current-buffer (tramp-get-connection-buffer vec)
     (save-excursion
       (goto-char (point-min))
-      ;; We can't use stty to disable echo of command.
+      ;; We can't use stty to disable echo of command.  stty is said
+      ;; to be added to toybox 0.7.6.  busybox shall have it, but this
+      ;; isn't used any longer for Android.
       (delete-matching-lines (regexp-quote command))
       ;; When the local machine is W32, there are still trailing ^M.
       ;; There must be a better solution by setting the correct coding
@@ -1230,51 +1157,43 @@ the exit status is not equal 0, and t otherwise."
     (skip-chars-forward "^ ")
     (prog1
        (zerop (read (current-buffer)))
-      (let (buffer-read-only)
+      (let ((inhibit-read-only t))
        (delete-region (match-beginning 0) (point-max))))))
 
 (defun tramp-adb-barf-unless-okay (vec command fmt &rest args)
   "Run COMMAND, check exit status, throw error if exit status not okay.
 FMT and ARGS are passed to `error'."
   (unless (tramp-adb-send-command-and-check vec command)
-    (apply 'tramp-error vec 'file-error fmt args)))
+    (apply #'tramp-error vec 'file-error fmt args)))
 
 (defun tramp-adb-wait-for-output (proc &optional timeout)
   "Wait for output from remote command."
   (unless (buffer-live-p (process-buffer proc))
     (delete-process proc)
     (tramp-error proc 'file-error "Process `%s' not available, try again" 
proc))
-  (with-current-buffer (process-buffer proc)
-    (if (tramp-wait-for-regexp
-        proc timeout
-        (tramp-get-connection-property proc "prompt" tramp-adb-prompt))
-       (let (buffer-read-only)
-         (goto-char (point-min))
-         ;; ADB terminal sends "^H" sequences.
-         (when (re-search-forward "<\b+" (point-at-eol) t)
-           (forward-line 1)
-           (delete-region (point-min) (point)))
-         ;; Delete the prompt.
-         (goto-char (point-min))
-         (when (re-search-forward
-               (tramp-get-connection-property proc "prompt" tramp-adb-prompt)
-               (point-at-eol) t)
-           (forward-line 1)
-           (delete-region (point-min) (point)))
-         (goto-char (point-max))
-         (re-search-backward
-          (tramp-get-connection-property proc "prompt" tramp-adb-prompt) nil t)
-         (delete-region (point) (point-max)))
-      (if timeout
+  (let ((prompt (tramp-get-connection-property proc "prompt" 
tramp-adb-prompt)))
+    (with-current-buffer (process-buffer proc)
+      (if (tramp-wait-for-regexp proc timeout prompt)
+         (let ((inhibit-read-only t))
+           (goto-char (point-min))
+           ;; ADB terminal sends "^H" sequences.
+           (when (re-search-forward "<\b+" (point-at-eol) t)
+             (forward-line 1)
+             (delete-region (point-min) (point)))
+           ;; Delete the prompt.
+            (goto-char (point-min))
+            (when (re-search-forward prompt (point-at-eol) t)
+              (forward-line 1)
+              (delete-region (point-min) (point)))
+           (goto-char (point-max))
+           (re-search-backward prompt nil t)
+           (delete-region (point) (point-max)))
+       (if timeout
+           (tramp-error
+            proc 'file-error
+            "[[Remote prompt `%s' not found in %d secs]]" prompt timeout)
          (tramp-error
-          proc 'file-error
-          "[[Remote adb prompt `%s' not found in %d secs]]"
-          (tramp-get-connection-property proc "prompt" tramp-adb-prompt)
-          timeout)
-       (tramp-error
-        proc 'file-error
-        "[[Remote prompt `%s' not found]]"
-        (tramp-get-connection-property proc "prompt" tramp-adb-prompt))))))
+          proc 'file-error "[[Remote prompt `%s' not found]]" prompt))))))
 
 (defun tramp-adb-maybe-open-connection (vec)
   "Maybe open a connection VEC.
@@ -1293,6 +1212,14 @@ connection if a previous connection has died for some 
reason."
       (tramp-error vec 'file-error "Cannot switch to user `%s'" user))
 
     (unless (process-live-p p)
+      ;; During completion, don't reopen a new connection.  We check
+      ;; this for the process related to `tramp-buffer-name';
+      ;; otherwise `start-file-process' wouldn't run ever when
+      ;; `non-essential' is non-nil.
+      (when (and (tramp-completion-mode-p)
+                (null (get-process (tramp-buffer-name vec))))
+       (throw 'non-essential 'non-essential))
+
       (save-match-data
        (when (and p (processp p)) (delete-process p))
        (if (zerop (length device))
@@ -1305,18 +1232,21 @@ connection if a previous connection has died for some 
reason."
                         (list "shell")))
                 (p (let ((default-directory
                            (tramp-compat-temporary-file-directory)))
-                     (apply 'start-process (tramp-get-connection-name vec) buf
+                     (apply #'start-process (tramp-get-connection-name vec) buf
                             tramp-adb-program args)))
                 (prompt (md5 (concat (prin1-to-string process-environment)
                                      (current-time-string)))))
            (tramp-message
-            vec 6 "%s" (mapconcat 'identity (process-command p) " "))
-           ;; Wait for initial prompt.
+            vec 6 "%s" (mapconcat #'identity (process-command p) " "))
+           ;; Wait for initial prompt.  On some devices, it needs an
+           ;; initial RET, in order to get it.
+            (sleep-for 0.1)
+           (tramp-send-string vec tramp-rsh-end-of-line)
            (tramp-adb-wait-for-output p 30)
            (unless (process-live-p p)
-             (tramp-error  vec 'file-error "Terminated!"))
+             (tramp-error vec 'file-error "Terminated!"))
            (process-put p 'vector vec)
-           (process-put p 'adjust-window-size-function 'ignore)
+           (process-put p 'adjust-window-size-function #'ignore)
            (set-process-query-on-exit-flag p nil)
 
            ;; Change prompt.
@@ -1364,6 +1294,25 @@ connection if a previous connection has died for some 
reason."
            ;; Mark it as connected.
            (tramp-set-connection-property p "connected" t)))))))
 
+;; Default settings for connection-local variables.
+(defconst tramp-adb-connection-local-default-profile
+  '((shell-file-name . "/system/bin/sh")
+    (shell-command-switch . "-c"))
+  "Default connection-local variables for remote adb connections.")
+
+;; `connection-local-set-profile-variables' and
+;; `connection-local-set-profiles' exists since Emacs 26.1.
+(eval-after-load "shell"
+  '(progn
+     (tramp-compat-funcall
+      'connection-local-set-profile-variables
+      'tramp-adb-connection-local-default-profile
+      tramp-adb-connection-local-default-profile)
+     (tramp-compat-funcall
+      'connection-local-set-profiles
+      `(:application tramp :protocol ,tramp-adb-method)
+      'tramp-adb-connection-local-default-profile)))
+
 (add-hook 'tramp-unload-hook
          (lambda ()
            (unload-feature 'tramp-adb 'force)))
diff --git a/lisp/net/tramp-archive.el b/lisp/net/tramp-archive.el
index bb87a83..9e131b1 100644
--- a/lisp/net/tramp-archive.el
+++ b/lisp/net/tramp-archive.el
@@ -1,6 +1,6 @@
 ;;; tramp-archive.el --- Tramp archive manager  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 ;; Keywords: comm, processes
@@ -108,7 +108,10 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl-lib))
-(require 'tramp-gvfs)
+;; Sometimes, compilation fails with "Variable binding depth exceeds
+;; max-specpdl-size".
+(eval-and-compile
+  (let ((max-specpdl-size (* 2 max-specpdl-size))) (require 'tramp-gvfs)))
 
 (autoload 'dired-uncache "dired")
 (autoload 'url-tramp-convert-url-to-tramp "url-tramp")
@@ -174,7 +177,7 @@ It must be supported by libarchive(3).")
 ;;;###autoload
 (progn (defmacro tramp-archive-autoload-file-name-regexp ()
   "Regular expression matching archive file names."
-  `(concat
+  '(concat
     "\\`" "\\(" ".+" "\\."
       ;; Default suffixes ...
       (regexp-opt tramp-archive-suffixes)
@@ -198,15 +201,15 @@ It must be supported by libarchive(3).")
 (defconst tramp-archive-all-gvfs-methods
   (cons tramp-archive-method
        (let ((values (cdr (cadr (get 'tramp-gvfs-methods 'custom-type)))))
-         (setq values (mapcar 'last values)
-               values (mapcar 'car values))))
+         (setq values (mapcar #'last values)
+               values (mapcar #'car values))))
   "List of all methods `tramp-gvfs-methods' offers.")
 
 
 ;; New handlers should be added here.
 ;;;###tramp-autoload
 (defconst tramp-archive-file-name-handler-alist
-  '((access-file . ignore)
+  '((access-file . tramp-archive-handle-access-file)
     (add-name-to-file . tramp-archive-handle-not-implemented)
     ;; `byte-compiler-base-file-name' performed by default handler.
     ;; `copy-directory' performed by default handler.
@@ -253,7 +256,6 @@ It must be supported by libarchive(3).")
     (file-truename . tramp-archive-handle-file-truename)
     (file-writable-p . ignore)
     (find-backup-file-name . ignore)
-    ;; `find-file-noselect' performed by default handler.
     ;; `get-file-buffer' performed by default handler.
     (insert-directory . tramp-archive-handle-insert-directory)
     (insert-file-contents . tramp-archive-handle-insert-file-contents)
@@ -262,6 +264,7 @@ It must be supported by libarchive(3).")
     (make-directory . tramp-archive-handle-not-implemented)
     (make-directory-internal . tramp-archive-handle-not-implemented)
     (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
+    (make-process . ignore)
     (make-symbolic-link . tramp-archive-handle-not-implemented)
     (process-file . ignore)
     (rename-file . tramp-archive-handle-not-implemented)
@@ -274,6 +277,7 @@ It must be supported by libarchive(3).")
     (start-file-process . tramp-archive-handle-not-implemented)
     ;; `substitute-in-file-name' performed by default handler.
     (temporary-file-directory . tramp-archive-handle-temporary-file-directory)
+    ;; `tramp-set-file-uid-gid' performed by default handler.
     (unhandled-file-name-directory . ignore)
     (vc-registered . ignore)
     (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
@@ -283,8 +287,9 @@ Operations not mentioned here will be handled by the 
default Emacs primitives.")
 
 (defsubst tramp-archive-file-name-for-operation (operation &rest args)
   "Like `tramp-file-name-for-operation', but for archive file name syntax."
-  (cl-letf (((symbol-function 'tramp-tramp-file-p) 'tramp-archive-file-name-p))
-    (apply 'tramp-file-name-for-operation operation args)))
+  (cl-letf (((symbol-function #'tramp-tramp-file-p)
+            #'tramp-archive-file-name-p))
+    (apply #'tramp-file-name-for-operation operation args)))
 
 (defun tramp-archive-run-real-handler (operation args)
   "Invoke normal file name handler for OPERATION.
@@ -309,14 +314,14 @@ pass to the OPERATION."
           (tramp-register-file-name-handlers)
           (tramp-archive-run-real-handler operation args))
 
-      (let* ((filename (apply 'tramp-archive-file-name-for-operation
+      (let* ((filename (apply #'tramp-archive-file-name-for-operation
                              operation args))
             (archive (tramp-archive-file-name-archive filename)))
 
         ;; The file archive could be a directory, see Bug#30293.
         (if (and archive
                 (tramp-archive-run-real-handler
-                  'file-directory-p (list archive)))
+                  #'file-directory-p (list archive)))
             (tramp-archive-run-real-handler operation args)
           ;; Now run the handler.
           (let ((tramp-methods (cons `(,tramp-archive-method) tramp-methods))
@@ -325,7 +330,7 @@ pass to the OPERATION."
                (tramp-unknown-id-integer (user-uid))
                (tramp-unknown-id-string (user-login-name))
                (fn (assoc operation tramp-archive-file-name-handler-alist)))
-           (when (eq (cdr fn) 'tramp-archive-handle-not-implemented)
+           (when (eq (cdr fn) #'tramp-archive-handle-not-implemented)
              (setq args (cons operation args)))
            (if fn
                (save-match-data (apply (cdr fn) args))
@@ -333,7 +338,7 @@ pass to the OPERATION."
 
 ;;;###autoload
 (defalias
-  'tramp-archive-autoload-file-name-handler 'tramp-autoload-file-name-handler)
+  'tramp-archive-autoload-file-name-handler #'tramp-autoload-file-name-handler)
 
 ;;;###autoload
 (progn (defun tramp-register-archive-file-name-handler ()
@@ -341,17 +346,17 @@ pass to the OPERATION."
   (when tramp-archive-enabled
     (add-to-list 'file-name-handler-alist
                 (cons (tramp-archive-autoload-file-name-regexp)
-                      'tramp-archive-autoload-file-name-handler))
+                      #'tramp-archive-autoload-file-name-handler))
     (put 'tramp-archive-autoload-file-name-handler 'safe-magic t))))
 
 ;;;###autoload
 (progn
-  (add-hook 'after-init-hook 'tramp-register-archive-file-name-handler)
+  (add-hook 'after-init-hook #'tramp-register-archive-file-name-handler)
   (add-hook
    'tramp-archive-unload-hook
    (lambda ()
      (remove-hook
-      'after-init-hook 'tramp-register-archive-file-name-handler))))
+      'after-init-hook #'tramp-register-archive-file-name-handler))))
 
 ;; In older Emacsen (prior 27.1), the autoload above does not exist.
 ;; So we call it again; it doesn't hurt.
@@ -359,19 +364,19 @@ pass to the OPERATION."
 
 ;; Mark `operations' the handler is responsible for.
 (put 'tramp-archive-file-name-handler 'operations
-     (mapcar 'car tramp-archive-file-name-handler-alist))
+     (mapcar #'car tramp-archive-file-name-handler-alist))
 
 ;; `tramp-archive-file-name-handler' must be placed before `url-file-handler'.
 (when url-handler-mode (tramp-register-file-name-handlers))
 
 (eval-after-load 'url-handler
-  (progn
-    (add-hook 'url-handler-mode-hook 'tramp-register-file-name-handlers)
-    (add-hook
-     'tramp-archive-unload-hook
-     (lambda ()
-       (remove-hook
-       'url-handler-mode-hook 'tramp-register-file-name-handlers)))))
+  '(progn
+     (add-hook 'url-handler-mode-hook #'tramp-register-file-name-handlers)
+     (add-hook
+      'tramp-archive-unload-hook
+      (lambda ()
+       (remove-hook
+        'url-handler-mode-hook #'tramp-register-file-name-handlers)))))
 
 
 ;; File name conversions.
@@ -379,6 +384,7 @@ pass to the OPERATION."
 (defun tramp-archive-file-name-p (name)
   "Return t if NAME is a string with archive file name syntax."
   (and (stringp name)
+       ;; We cannot use `string-match-p', the matches are used.
        (string-match tramp-archive-file-name-regexp name)
        t))
 
@@ -431,8 +437,9 @@ name is kept in slot `hop'"
        ;; http://...
        ((and url-handler-mode
             tramp-compat-use-url-tramp-p
-             (string-match url-handler-regexp archive)
-            (string-match "https?" (url-type (url-generic-parse-url archive))))
+             (string-match-p url-handler-regexp archive)
+            (string-match-p
+             "https?" (url-type (url-generic-parse-url archive))))
        (let* ((url-tramp-protocols
                (cons
                 (url-type (url-generic-parse-url archive))
@@ -449,9 +456,9 @@ name is kept in slot `hop'"
 
        ;; Anything else.  Here we call `file-local-copy', which we
        ;; have avoided so far.
-       (t (let* ((inhibit-file-name-operation 'file-local-copy)
+       (t (let* ((inhibit-file-name-operation #'file-local-copy)
                 (inhibit-file-name-handlers
-                 (cons 'jka-compr-handler inhibit-file-name-handlers))
+                 (cons #'jka-compr-handler inhibit-file-name-handlers))
                 (copy (file-local-copy archive)))
            (setf (tramp-file-name-host vec) (tramp-archive-gvfs-host copy))
            (puthash archive (cons vec copy) tramp-archive-hash))))
@@ -461,7 +468,6 @@ name is kept in slot `hop'"
       (setf (tramp-file-name-localname vec) localname)
       vec)))
 
-;;;###tramp-autoload
 (defun tramp-archive-cleanup-hash ()
   "Remove local copies of archives, used by GVFS."
   (maphash
@@ -476,11 +482,14 @@ name is kept in slot `hop'"
    tramp-archive-hash)
   (clrhash tramp-archive-hash))
 
-(add-hook 'kill-emacs-hook 'tramp-archive-cleanup-hash)
+(add-hook 'tramp-cleanup-all-connections-hook #'tramp-archive-cleanup-hash)
+(add-hook 'kill-emacs-hook #'tramp-archive-cleanup-hash)
 (add-hook 'tramp-archive-unload-hook
          (lambda ()
+           (remove-hook 'tramp-cleanup-all-connections-hook
+                        #'tramp-archive-cleanup-hash)
            (remove-hook 'kill-emacs-hook
-                        'tramp-archive-cleanup-hash)))
+                        #'tramp-archive-cleanup-hash)))
 
 (defsubst tramp-file-name-archive (vec)
   "Extract the archive file name from VEC.
@@ -525,6 +534,10 @@ offered."
 
 ;; File name primitives.
 
+(defun tramp-archive-handle-access-file (filename string)
+  "Like `access-file' for Tramp files."
+  (access-file (tramp-archive-gvfs-file-name filename) string))
+
 (defun tramp-archive-handle-copy-file
   (filename newname &optional ok-if-already-exists keep-date
    preserve-uid-gid preserve-extended-attributes)
@@ -626,7 +639,7 @@ offered."
   "Generic handler for operations not implemented for file archives."
   (let ((v (ignore-errors
             (tramp-archive-dissect-file-name
-             (apply 'tramp-archive-file-name-for-operation operation args)))))
+             (apply #'tramp-archive-file-name-for-operation operation args)))))
     (tramp-message v 10 "%s" (cons operation args))
     (tramp-error
      v 'file-error
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index ebb4254..3d3b14e 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -1,6 +1,6 @@
 ;;; tramp-cache.el --- file information caching for Tramp  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2000, 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000, 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pittman <address@hidden>
 ;;         Michael Albinus <address@hidden>
@@ -28,7 +28,7 @@
 ;; An implementation of information caching for remote files.
 
 ;; Each connection, identified by a `tramp-file-name' structure or by
-;; a process, has a unique cache. We distinguish 3 kind of caches,
+;; a process, has a unique cache. We distinguish 4 kind of caches,
 ;; depending on the key:
 ;;
 ;; - localname is NIL.  This are reusable properties.  Examples:
@@ -49,6 +49,17 @@
 ;;   an open connection.  Examples: "scripts" keeps shell script
 ;;   definitions already sent to the remote shell, "last-cmd-time" is
 ;;   the time stamp a command has been sent to the remote process.
+;;
+;; - The key is nil.  This are temporary properties related to the
+;;   local machine.  Examples: "parse-passwd" and "parse-group" keep
+;;   the results of parsing "/etc/passwd" and "/etc/group",
+;;   "{uid,gid}-{integer,string}" are the local uid and gid, and
+;;   "locale" is the used shell locale.
+
+;; Some properties are handled special:
+;;
+;; - "process-name", "process-buffer" and "first-password-request" are
+;;   not saved in the file `tramp-persistency-file-name'.
 
 ;;; Code:
 
@@ -58,7 +69,7 @@
 ;;; -- Cache --
 
 ;;;###tramp-autoload
-(defvar tramp-cache-data (make-hash-table :test 'equal)
+(defvar tramp-cache-data (make-hash-table :test #'equal)
   "Hash table for remote files properties.")
 
 ;;;###tramp-autoload
@@ -75,7 +86,6 @@ details see the info pages."
                       (choice :tag "        Property" string)
                       (choice :tag "           Value" sexp))))
 
-;;;###tramp-autoload
 (defcustom tramp-persistency-file-name
   (expand-file-name (locate-user-emacs-file "tramp"))
   "File which keeps connection history for Tramp connections."
@@ -91,10 +101,10 @@ If it doesn't exist yet, it is created and initialized with
 matching entries of `tramp-connection-properties'."
   (or (gethash key tramp-cache-data)
       (let ((hash
-            (puthash key (make-hash-table :test 'equal) tramp-cache-data)))
+            (puthash key (make-hash-table :test #'equal) tramp-cache-data)))
        (when (tramp-file-name-p key)
          (dolist (elt tramp-connection-properties)
-           (when (string-match
+           (when (string-match-p
                   (or (nth 0 elt) "")
                   (tramp-make-tramp-file-name key 'noloc 'nohop))
              (tramp-set-connection-property key (nth 1 elt) (nth 2 elt)))))
@@ -108,7 +118,7 @@ Returns DEFAULT if not set."
   (setq file (tramp-compat-file-name-unquote file)
        key (copy-tramp-file-name key))
   (setf (tramp-file-name-localname key)
-       (tramp-run-real-handler 'directory-file-name (list file))
+       (tramp-run-real-handler #'directory-file-name (list file))
        (tramp-file-name-hop key) nil)
   (let* ((hash (tramp-get-hash-table key))
         (value (when (hash-table-p hash) (gethash property hash))))
@@ -118,8 +128,14 @@ Returns DEFAULT if not set."
        (and (consp value)
             (or (null remote-file-name-inhibit-cache)
                 (and (integerp remote-file-name-inhibit-cache)
-                     (<= (tramp-time-diff (current-time) (car value))
-                         remote-file-name-inhibit-cache))
+                     (time-less-p
+                      ;; `current-time' can be nil once we get rid of Emacs 24.
+                      (current-time)
+                      (time-add
+                       (car value)
+                      ;; `seconds-to-time' can be removed once we get
+                      ;; rid of Emacs 24.
+                       (seconds-to-time remote-file-name-inhibit-cache))))
                 (and (consp remote-file-name-inhibit-cache)
                      (time-less-p
                       remote-file-name-inhibit-cache (car value)))))
@@ -145,7 +161,7 @@ Returns VALUE."
   (setq file (tramp-compat-file-name-unquote file)
        key (copy-tramp-file-name key))
   (setf (tramp-file-name-localname key)
-       (tramp-run-real-handler 'directory-file-name (list file))
+       (tramp-run-real-handler #'directory-file-name (list file))
        (tramp-file-name-hop key) nil)
   (let ((hash (tramp-get-hash-table key)))
     ;; We put the timestamp there.
@@ -168,7 +184,7 @@ Returns VALUE."
   (setq file (tramp-compat-file-name-unquote file)
        key (copy-tramp-file-name key))
   (setf (tramp-file-name-localname key)
-       (tramp-run-real-handler 'directory-file-name (list file))
+       (tramp-run-real-handler #'directory-file-name (list file))
        (tramp-file-name-hop key) nil)
   (remhash property (tramp-get-hash-table key))
   (tramp-message key 8 "%s %s" file property)
@@ -180,7 +196,7 @@ Returns VALUE."
 (defun tramp-flush-file-properties (key file)
   "Remove all properties of FILE in the cache context of KEY."
   (let* ((file (tramp-run-real-handler
-               'directory-file-name (list file)))
+               #'directory-file-name (list file)))
         (truename (tramp-get-file-property key file "file-truename" nil)))
     ;; Unify localname.  Remove hop from `tramp-file-name' structure.
     (setq file (tramp-compat-file-name-unquote file)
@@ -200,15 +216,15 @@ Returns VALUE."
 Remove also properties of all files in subdirectories."
   (setq directory (tramp-compat-file-name-unquote directory))
   (let* ((directory (tramp-run-real-handler
-                   'directory-file-name (list directory)))
+                   #'directory-file-name (list directory)))
         (truename (tramp-get-file-property key directory "file-truename" nil)))
     (tramp-message key 8 "%s" directory)
     (maphash
      (lambda (key _value)
        (when (and (tramp-file-name-p key)
                  (stringp (tramp-file-name-localname key))
-                 (string-match (regexp-quote directory)
-                               (tramp-file-name-localname key)))
+                 (string-match-p (regexp-quote directory)
+                                 (tramp-file-name-localname key)))
         (remhash key tramp-cache-data)))
      tramp-cache-data)
     ;; Remove file properties of symlinks.
@@ -226,7 +242,7 @@ Remove also properties of all files in subdirectories."
 This is suppressed for temporary buffers."
   (save-match-data
     (unless (or (null (buffer-name))
-               (string-match "^\\( \\|\\*\\)" (buffer-name)))
+               (string-match-p "^\\( \\|\\*\\)" (buffer-name)))
       (let ((bfn (if (stringp (buffer-file-name))
                     (buffer-file-name)
                   default-directory))
@@ -235,17 +251,17 @@ This is suppressed for temporary buffers."
          (with-parsed-tramp-file-name bfn nil
            (tramp-flush-file-properties v localname)))))))
 
-(add-hook 'before-revert-hook 'tramp-flush-file-function)
-(add-hook 'eshell-pre-command-hook 'tramp-flush-file-function)
-(add-hook 'kill-buffer-hook 'tramp-flush-file-function)
+(add-hook 'before-revert-hook #'tramp-flush-file-function)
+(add-hook 'eshell-pre-command-hook #'tramp-flush-file-function)
+(add-hook 'kill-buffer-hook #'tramp-flush-file-function)
 (add-hook 'tramp-cache-unload-hook
          (lambda ()
            (remove-hook 'before-revert-hook
-                        'tramp-flush-file-function)
+                        #'tramp-flush-file-function)
            (remove-hook 'eshell-pre-command-hook
-                        'tramp-flush-file-function)
+                        #'tramp-flush-file-function)
            (remove-hook 'kill-buffer-hook
-                        'tramp-flush-file-function)))
+                        #'tramp-flush-file-function)))
 
 ;;; -- Properties --
 
@@ -353,7 +369,7 @@ used to cache connection properties of the local machine."
         (when (tramp-file-name-p key)
           ;; (dolist
           ;;     (slot
-          ;;   (mapcar 'car (cdr (cl-struct-slot-info 'tramp-file-name))))
+          ;;   (mapcar #'car (cdr (cl-struct-slot-info 'tramp-file-name))))
           ;;   (when (stringp (cl-struct-slot-value 'tramp-file-name slot key))
           ;;     (setf (cl-struct-slot-value 'tramp-file-name slot key)
           ;;        (substring-no-properties
@@ -441,11 +457,11 @@ used to cache connection properties of the local machine."
             (pp (read (format "(%s)" (tramp-cache-print cache)))))))))))
 
 (unless noninteractive
-  (add-hook 'kill-emacs-hook 'tramp-dump-connection-properties))
+  (add-hook 'kill-emacs-hook #'tramp-dump-connection-properties))
 (add-hook 'tramp-cache-unload-hook
          (lambda ()
            (remove-hook 'kill-emacs-hook
-                        'tramp-dump-connection-properties)))
+                        #'tramp-dump-connection-properties)))
 
 ;;;###tramp-autoload
 (defun tramp-parse-connection-properties (method)
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index b05f475..f1e1d82 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -1,6 +1,6 @@
 ;;; tramp-cmds.el --- Interactive commands for Tramp  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 ;; Keywords: comm, processes
@@ -55,9 +55,9 @@ SYNTAX can be one of the symbols `default' (default),
   "Return a list of all Tramp connection buffers."
   (append
    (all-completions
-    "*tramp" (mapcar 'list (mapcar 'buffer-name (buffer-list))))
+    "*tramp" (mapcar #'list (mapcar #'buffer-name (buffer-list))))
    (all-completions
-    "*debug tramp" (mapcar 'list (mapcar 'buffer-name (buffer-list))))))
+    "*debug tramp" (mapcar #'list (mapcar #'buffer-name (buffer-list))))))
 
 (defun tramp-list-remote-buffers ()
   "Return a list of all buffers with remote default-directory."
@@ -69,6 +69,11 @@ SYNTAX can be one of the symbols `default' (default),
     (buffer-list))))
 
 ;;;###tramp-autoload
+(defvar tramp-cleanup-connection-hook nil
+  "List of functions to be called after Tramp connection is cleaned up.
+Each function is called with the current vector as argument.")
+
+;;;###tramp-autoload
 (defun tramp-cleanup-connection (vec &optional keep-debug keep-password)
   "Flush all connection related objects.
 This includes password cache, file cache, connection cache,
@@ -80,7 +85,7 @@ When called interactively, a Tramp connection has to be 
selected."
    ;; Return nil when there is no Tramp connection.
    (list
     (let ((connections
-          (mapcar 'tramp-make-tramp-file-name (tramp-list-connections)))
+          (mapcar #'tramp-make-tramp-file-name (tramp-list-connections)))
          name)
 
       (when connections
@@ -99,9 +104,8 @@ When called interactively, a Tramp connection has to be 
selected."
     (unless keep-password (tramp-clear-passwd vec))
 
     ;; Cleanup `tramp-current-connection'.  Otherwise, we would be
-    ;; suppressed in the test suite.  We use `keep-password' as
-    ;; indicator; it is not worth to add a new argument.
-    (when keep-password (setq tramp-current-connection nil))
+    ;; suppressed.
+    (setq tramp-current-connection nil)
 
     ;; Flush file cache.
     (tramp-flush-directory-properties vec "")
@@ -118,7 +122,10 @@ When called interactively, a Tramp connection has to be 
selected."
                   (unless keep-debug
                     (get-buffer (tramp-debug-buffer-name vec)))
                   (tramp-get-connection-property vec "process-buffer" nil)))
-      (when (bufferp buf) (kill-buffer buf)))))
+      (when (bufferp buf) (kill-buffer buf)))
+
+    ;; The end.
+    (run-hook-with-args 'tramp-cleanup-connection-hook vec)))
 
 ;;;###tramp-autoload
 (defun tramp-cleanup-this-connection ()
@@ -129,6 +136,10 @@ When called interactively, a Tramp connection has to be 
selected."
        (tramp-dissect-file-name default-directory 'noexpand))))
 
 ;;;###tramp-autoload
+(defvar tramp-cleanup-all-connections-hook nil
+  "List of functions to be called after all Tramp connections are cleaned up.")
+
+;;;###tramp-autoload
 (defun tramp-cleanup-all-connections ()
   "Flush all Tramp internal objects.
 This includes password cache, file cache, connection cache, buffers."
@@ -143,13 +154,25 @@ This includes password cache, file cache, connection 
cache, buffers."
   ;; Flush file and connection cache.
   (clrhash tramp-cache-data)
 
-  ;; Cleanup local copies of archives.
-  (when (bound-and-true-p tramp-archive-enabled)
-    (tramp-archive-cleanup-hash))
+  ;; Remove ad-hoc proxies.
+  (let ((proxies tramp-default-proxies-alist))
+    (while proxies
+      (if (ignore-errors
+           (get-text-property 0 'tramp-ad-hoc (nth 2 (car proxies))))
+         (setq tramp-default-proxies-alist
+               (delete (car proxies) tramp-default-proxies-alist)
+               proxies tramp-default-proxies-alist)
+       (setq proxies (cdr proxies)))))
+    (when (and tramp-default-proxies-alist tramp-save-ad-hoc-proxies)
+      (customize-save-variable
+       'tramp-default-proxies-alist tramp-default-proxies-alist))
 
   ;; Remove buffers.
   (dolist (name (tramp-list-tramp-buffers))
-    (when (bufferp (get-buffer name)) (kill-buffer name))))
+    (when (bufferp (get-buffer name)) (kill-buffer name)))
+
+  ;; The end.
+  (run-hooks 'tramp-cleanup-all-connections-hook))
 
 ;;;###tramp-autoload
 (defun tramp-cleanup-all-buffers ()
@@ -185,14 +208,15 @@ This includes password cache, file cache, connection 
cache, buffers."
          ;; In rare cases, it could contain the password.  So we make it nil.
          tramp-password-save-function)
       (reporter-submit-bug-report
-       tramp-bug-report-address                ; to-address
-       (format "tramp (%s)" tramp-version) ; package name and version
+       tramp-bug-report-address          ; to-address
+       (format "tramp (%s %s/%s)" ; package name and version
+              tramp-version tramp-repository-branch tramp-repository-version)
        (sort
        (delq nil (mapcar
          (lambda (x)
            (and x (boundp x) (cons x 'tramp-reporter-dump-variable)))
          (append
-          (mapcar 'intern (all-completions "tramp-" obarray 'boundp))
+          (mapcar #'intern (all-completions "tramp-" obarray #'boundp))
           ;; Non-tramp variables of interest.
           '(shell-prompt-pattern
             backup-by-copying
@@ -247,7 +271,7 @@ buffer in your bug report.
        (set varsym (read (format "(%s)" (tramp-cache-print val))))
       ;; There are non-7bit characters to be masked.
       (when (and (stringp val)
-                (string-match
+                (string-match-p
                  (concat "[^" (bound-and-true-p mm-7bit-chars) "]") val))
        (with-current-buffer reporter-eval-buffer
          (set
@@ -263,10 +287,11 @@ buffer in your bug report.
       ;; Remove string quotation.
       (forward-line -1)
       (when (looking-at
-            (concat "\\(^.*\\)" "\""                       ;; \1 "
-                    "\\((base64-decode-string \\)" "\\\\"  ;; \2 \
-                    "\\(\".*\\)" "\\\\"                    ;; \3 \
-                    "\\(\")\\)" "\"$"))                    ;; \4 "
+            (eval-when-compile
+              (concat "\\(^.*\\)" "\""                       ;; \1 "
+                      "\\((base64-decode-string \\)" "\\\\"  ;; \2 \
+                      "\\(\".*\\)" "\\\\"                    ;; \3 \
+                      "\\(\")\\)" "\"$")))                   ;; \4 "
        (replace-match "\\1\\2\\3\\4")
        (beginning-of-line)
        (insert " ;; Variable encoded due to non-printable characters.\n"))
@@ -291,7 +316,7 @@ buffer in your bug report.
           (delq nil
                 (mapcar
                  (lambda (b)
-                    (when (string-match "\\*tramp/" (buffer-name b)) b))
+                    (when (string-match-p "\\*tramp/" (buffer-name b)) b))
                  (buffer-list))))
     (let ((reporter-eval-buffer buffer)
          (elbuf (get-buffer-create " *tmp-reporter-buffer*")))
@@ -305,11 +330,11 @@ buffer in your bug report.
             (sort
              (append
               (mapcar
-               'intern
+               #'intern
                (all-completions "tramp-" (buffer-local-variables buffer)))
               ;; Non-tramp variables of interest.
               '(connection-local-variables-alist default-directory))
-             'string<))
+             #'string<))
            (reporter-dump-variable varsym elbuf))
        (lisp-indent-line)
        (insert ")\n"))
@@ -319,7 +344,7 @@ buffer in your bug report.
   (insert "\nload-path shadows:\n==================\n")
   (ignore-errors
     (mapc
-     (lambda (x) (when (string-match "tramp" x) (insert x "\n")))
+     (lambda (x) (when (string-match-p "tramp" x) (insert x "\n")))
      (split-string (list-load-path-shadows t) "\n")))
 
   ;; Append buffers only when we are in message mode.
@@ -387,7 +412,7 @@ please ensure that the buffers are attached to your 
email.\n\n"))
          (kill-buffer nil)
          (throw 'dont-send nil))))))
 
-(defalias 'tramp-submit-bug 'tramp-bug)
+(defalias 'tramp-submit-bug #'tramp-bug)
 
 (add-hook 'tramp-unload-hook
          (lambda () (unload-feature 'tramp-cmds 'force)))
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 15b5a49..e3d0343 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -1,6 +1,6 @@
 ;;; tramp-compat.el --- Tramp compatibility functions  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 ;; Keywords: comm, processes
@@ -45,8 +45,6 @@
 (require 'timer)
 (require 'ucs-normalize)
 
-(require 'tramp-loaddefs)
-
 ;; For not existing functions, obsolete functions, or functions with a
 ;; changed argument list, there are compiler warnings.  We want to
 ;; avoid them in cases we know what we do.
@@ -75,7 +73,7 @@ Add the extension of F, if existing."
 ;; `temporary-file-directory' as function is introduced with Emacs 26.1.
 (defalias 'tramp-compat-temporary-file-directory-function
   (if (fboundp 'temporary-file-directory)
-      'temporary-file-directory
+      #'temporary-file-directory
     'tramp-handle-temporary-file-directory))
 
 (defun tramp-compat-process-running-p (process-name)
@@ -97,19 +95,19 @@ Add the extension of F, if existing."
                          ;; The returned command name could be truncated
                          ;; to 15 characters.  Therefore, we cannot check
                          ;; for `string-equal'.
-                         (and comm (string-match
+                         (and comm (string-match-p
                                     (concat "^" (regexp-quote comm))
                                     process-name))))
              (setq result t)))))))))
 
 ;; `default-toplevel-value' has been declared in Emacs 24.4.
 (unless (fboundp 'default-toplevel-value)
-  (defalias 'default-toplevel-value 'symbol-value))
+  (defalias 'default-toplevel-value #'symbol-value))
 
 ;; `file-attribute-*' are introduced in Emacs 25.1.
 
 (if (fboundp 'file-attribute-type)
-    (defalias 'tramp-compat-file-attribute-type 'file-attribute-type)
+    (defalias 'tramp-compat-file-attribute-type #'file-attribute-type)
   (defsubst tramp-compat-file-attribute-type (attributes)
     "The type field in ATTRIBUTES returned by `file-attributes'.
 The value is either t for directory, string (name linked to) for
@@ -118,13 +116,13 @@ symbolic link, or nil."
 
 (if (fboundp 'file-attribute-link-number)
     (defalias 'tramp-compat-file-attribute-link-number
-      'file-attribute-link-number)
+      #'file-attribute-link-number)
   (defsubst tramp-compat-file-attribute-link-number (attributes)
     "Return the number of links in ATTRIBUTES returned by `file-attributes'."
     (nth 1 attributes)))
 
 (if (fboundp 'file-attribute-user-id)
-    (defalias 'tramp-compat-file-attribute-user-id 'file-attribute-user-id)
+    (defalias 'tramp-compat-file-attribute-user-id #'file-attribute-user-id)
   (defsubst tramp-compat-file-attribute-user-id (attributes)
     "The UID field in ATTRIBUTES returned by `file-attributes'.
 This is either a string or a number.  If a string value cannot be
@@ -133,7 +131,7 @@ returned."
     (nth 2 attributes)))
 
 (if (fboundp 'file-attribute-group-id)
-    (defalias 'tramp-compat-file-attribute-group-id 'file-attribute-group-id)
+    (defalias 'tramp-compat-file-attribute-group-id #'file-attribute-group-id)
   (defsubst tramp-compat-file-attribute-group-id (attributes)
     "The GID field in ATTRIBUTES returned by `file-attributes'.
 This is either a string or a number.  If a string value cannot be
@@ -143,7 +141,7 @@ returned."
 
 (if (fboundp 'file-attribute-modification-time)
     (defalias 'tramp-compat-file-attribute-modification-time
-      'file-attribute-modification-time)
+      #'file-attribute-modification-time)
   (defsubst tramp-compat-file-attribute-modification-time (attributes)
     "The modification time in ATTRIBUTES returned by `file-attributes'.
 This is the time of the last change to the file's contents, and
@@ -151,7 +149,7 @@ is a Lisp timestamp in the style of `current-time'."
     (nth 5 attributes)))
 
 (if (fboundp 'file-attribute-size)
-    (defalias 'tramp-compat-file-attribute-size 'file-attribute-size)
+    (defalias 'tramp-compat-file-attribute-size #'file-attribute-size)
   (defsubst tramp-compat-file-attribute-size (attributes)
     "The size (in bytes) in ATTRIBUTES returned by `file-attributes'.
 If the size is too large for a fixnum, this is a bignum in Emacs 27
@@ -159,7 +157,7 @@ and later, and is a float in Emacs 26 and earlier."
     (nth 7 attributes)))
 
 (if (fboundp 'file-attribute-modes)
-    (defalias 'tramp-compat-file-attribute-modes 'file-attribute-modes)
+    (defalias 'tramp-compat-file-attribute-modes #'file-attribute-modes)
   (defsubst tramp-compat-file-attribute-modes (attributes)
     "The file modes in ATTRIBUTES returned by `file-attributes'.
 This is a string of ten letters or dashes as in ls -l."
@@ -167,11 +165,11 @@ This is a string of ten letters or dashes as in ls -l."
 
 ;; `format-message' is new in Emacs 25.1.
 (unless (fboundp 'format-message)
-  (defalias 'format-message 'format))
+  (defalias 'format-message #'format))
 
 ;; `directory-name-p' is new in Emacs 25.1.
 (if (fboundp 'directory-name-p)
-    (defalias 'tramp-compat-directory-name-p 'directory-name-p)
+    (defalias 'tramp-compat-directory-name-p #'directory-name-p)
   (defsubst tramp-compat-directory-name-p (name)
     "Return non-nil if NAME ends with a directory separator character."
     (let ((len (length name))
@@ -187,44 +185,50 @@ This is a string of ten letters or dashes as in ls -l."
   (if (get 'file-missing 'error-conditions) 'file-missing 'file-error)
   "The error symbol for the `file-missing' error.")
 
-;; `file-name-quoted-p', `file-name-quote' and `file-name-unquote' are
-;; introduced in Emacs 26.
+;; `file-local-name', `file-name-quoted-p', `file-name-quote' and
+;; `file-name-unquote' are introduced in Emacs 26.
 (eval-and-compile
+  (if (fboundp 'file-local-name)
+      (defalias 'tramp-compat-file-local-name #'file-local-name)
+    (defsubst tramp-compat-file-local-name (name)
+      "Return the local name component of NAME.
+It returns a file name which can be used directly as argument of
+`process-file', `start-file-process', or `shell-command'."
+      (or (file-remote-p name 'localname) name)))
+
   (if (fboundp 'file-name-quoted-p)
-      (defalias 'tramp-compat-file-name-quoted-p 'file-name-quoted-p)
+      (defalias 'tramp-compat-file-name-quoted-p #'file-name-quoted-p)
     (defsubst tramp-compat-file-name-quoted-p (name)
       "Whether NAME is quoted with prefix \"/:\".
 If NAME is a remote file name, check the local part of NAME."
-      (string-match "^/:" (or (file-remote-p name 'localname) name))))
+      (string-prefix-p "/:" (tramp-compat-file-local-name name))))
 
   (if (fboundp 'file-name-quote)
-      (defalias 'tramp-compat-file-name-quote 'file-name-quote)
+      (defalias 'tramp-compat-file-name-quote #'file-name-quote)
     (defsubst tramp-compat-file-name-quote (name)
       "Add the quotation prefix \"/:\" to file NAME.
 If NAME is a remote file name, the local part of NAME is quoted."
       (if (tramp-compat-file-name-quoted-p name)
          name
        (concat
-        (file-remote-p name) "/:" (or (file-remote-p name 'localname) name)))))
+        (file-remote-p name) "/:" (tramp-compat-file-local-name name)))))
 
   (if (fboundp 'file-name-unquote)
-      (defalias 'tramp-compat-file-name-unquote 'file-name-unquote)
+      (defalias 'tramp-compat-file-name-unquote #'file-name-unquote)
     (defsubst tramp-compat-file-name-unquote (name)
       "Remove quotation prefix \"/:\" from file NAME.
 If NAME is a remote file name, the local part of NAME is unquoted."
-      (save-match-data
-       (let ((localname (or (file-remote-p name 'localname) name)))
-         (when (tramp-compat-file-name-quoted-p localname)
-           (setq
-            localname
-            (replace-match
-             (if (= (length localname) 2) "/" "") nil t localname)))
-         (concat (file-remote-p name) localname))))))
+      (let ((localname (tramp-compat-file-local-name name)))
+       (when (tramp-compat-file-name-quoted-p localname)
+         (setq
+          localname (if (= (length localname) 2) "/" (substring localname 2))))
+       (concat (file-remote-p name) localname)))))
 
 ;; `tramp-syntax' has changed its meaning in Emacs 26.  We still
 ;; support old settings.
 (defsubst tramp-compat-tramp-syntax ()
   "Return proper value of `tramp-syntax'."
+  (defvar tramp-syntax)
   (cond ((eq tramp-syntax 'ftp) 'default)
        ((eq tramp-syntax 'sep) 'separate)
        (t tramp-syntax)))
@@ -232,8 +236,8 @@ If NAME is a remote file name, the local part of NAME is 
unquoted."
 ;; `cl-struct-slot-info' has been introduced with Emacs 25.
 (defmacro tramp-compat-tramp-file-name-slots ()
   (if (fboundp 'cl-struct-slot-info)
-      `(cdr (mapcar 'car (cl-struct-slot-info 'tramp-file-name)))
-    `(cdr (mapcar 'car (get 'tramp-file-name 'cl-struct-slots)))))
+      '(cdr (mapcar #'car (cl-struct-slot-info 'tramp-file-name)))
+    '(cdr (mapcar #'car (get 'tramp-file-name 'cl-struct-slots)))))
 
 ;; The signature of `tramp-make-tramp-file-name' has been changed.
 ;; Therefore, we cannot us `url-tramp-convert-url-to-tramp' prior
@@ -244,7 +248,7 @@ If NAME is a remote file name, the local part of NAME is 
unquoted."
 ;; `exec-path' is new in Emacs 27.1.
 (eval-and-compile
   (if (fboundp 'exec-path)
-      (defalias 'tramp-compat-exec-path 'exec-path)
+      (defalias 'tramp-compat-exec-path #'exec-path)
     (defun tramp-compat-exec-path ()
       "List of directories to search programs to run in remote subprocesses."
       (let ((handler (find-file-name-handler default-directory 'exec-path)))
@@ -254,12 +258,27 @@ If NAME is a remote file name, the local part of NAME is 
unquoted."
 
 ;; `time-equal-p' has appeared in Emacs 27.1.
 (if (fboundp 'time-equal-p)
-    (defalias 'tramp-compat-time-equal-p 'time-equal-p)
+    (defalias 'tramp-compat-time-equal-p #'time-equal-p)
   (defsubst tramp-compat-time-equal-p (t1 t2)
     "Return non-nil if time value T1 is equal to time value T2.
 A nil value for either argument stands for the current time."
     (equal (or t1 (current-time)) (or t2 (current-time)))))
 
+;; `flatten-tree' has appeared in Emacs 27.1.
+(if (fboundp 'flatten-tree)
+    (defalias 'tramp-compat-flatten-tree #'flatten-tree)
+  (defun tramp-compat-flatten-tree (tree)
+    "Take TREE and \"flatten\" it."
+    (let (elems)
+      (setq tree (list tree))
+      (while (let ((elem (pop tree)))
+               (cond ((consp elem)
+                      (setq tree (cons (car elem) (cons (cdr elem) tree))))
+                     (elem
+                      (push elem elems)))
+               tree))
+      (nreverse elems))))
+
 (add-hook 'tramp-unload-hook
          (lambda ()
            (unload-feature 'tramp-loaddefs 'force)
@@ -269,7 +288,7 @@ A nil value for either argument stands for the current 
time."
 
 ;;; TODO:
 
-;; * When we get rid of Emacs 24, replace "(mapconcat 'identity" by
+;; * When we get rid of Emacs 24, replace "(mapconcat #'identity" by
 ;;   "(string-join".
 
 ;;; tramp-compat.el ends here
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el
index 983f168..d1aae22 100644
--- a/lisp/net/tramp-ftp.el
+++ b/lisp/net/tramp-ftp.el
@@ -1,6 +1,6 @@
 ;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 ;; Keywords: comm, processes
@@ -54,10 +54,9 @@ present for backward compatibility."
          (delete a1 (delete a2 file-name-handler-alist)))))
 
 (eval-after-load "ange-ftp"
-  '(when (functionp 'tramp-disable-ange-ftp)
-     (tramp-disable-ange-ftp)))
+  '(tramp-disable-ange-ftp))
 
-;;;###autoload
+;;;###tramp-autoload
 (defun tramp-ftp-enable-ange-ftp ()
   "Reenable Ange-FTP, when Tramp is unloaded."
   ;; The following code is commented out in Ange-FTP.
@@ -86,7 +85,7 @@ present for backward compatibility."
                         ange-ftp-completion-hook-function)
                       file-name-handler-alist)))))
 
-(add-hook 'tramp-ftp-unload-hook 'tramp-ftp-enable-ange-ftp)
+(add-hook 'tramp-ftp-unload-hook #'tramp-ftp-enable-ange-ftp)
 
 ;; Define FTP method ...
 ;;;###tramp-autoload
@@ -95,22 +94,19 @@ present for backward compatibility."
 
 ;; ... and add it to the method list.
 ;;;###tramp-autoload
-(add-to-list 'tramp-methods (cons tramp-ftp-method nil))
+(tramp--with-startup
+ (add-to-list 'tramp-methods (cons tramp-ftp-method nil))
 
-;; Add some defaults for `tramp-default-method-alist'.
-;;;###tramp-autoload
-(add-to-list 'tramp-default-method-alist
-            (list "\\`ftp\\." nil tramp-ftp-method))
-;;;###tramp-autoload
-(add-to-list 'tramp-default-method-alist
-            (list nil "\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method))
+ ;; Add some defaults for `tramp-default-method-alist'.
+ (add-to-list 'tramp-default-method-alist
+             (list "\\`ftp\\." nil tramp-ftp-method))
+ (add-to-list 'tramp-default-method-alist
+             (list nil "\\`\\(anonymous\\|ftp\\)\\'" tramp-ftp-method))
 
-;; Add completion function for FTP method.
-;;;###tramp-autoload
-(eval-after-load 'tramp
-  '(tramp-set-completion-function
-     tramp-ftp-method
-     '((tramp-parse-netrc "~/.netrc"))))
+ ;; Add completion function for FTP method.
+ (tramp-set-completion-function
+  tramp-ftp-method
+  '((tramp-parse-netrc "~/.netrc"))))
 
 ;;;###tramp-autoload
 (defun tramp-ftp-file-name-handler (operation &rest args)
@@ -142,7 +138,7 @@ pass to the OPERATION."
        ;; because this returns another user but the one declared in
        ;; "~/.netrc".
        ((memq operation '(file-directory-p file-exists-p))
-       (if (apply 'ange-ftp-hook-function operation args)
+       (if (apply #'ange-ftp-hook-function operation args)
            (let ((v (tramp-dissect-file-name (car args) t)))
              (setf (tramp-file-name-method v) tramp-ftp-method)
              (tramp-set-connection-property v "started" t))
@@ -176,19 +172,21 @@ pass to the OPERATION."
                        (and (eq inhibit-file-name-operation operation)
                             inhibit-file-name-handlers)))
                 (inhibit-file-name-operation operation))
-           (apply 'ange-ftp-hook-function operation args)))))))
+           (apply #'ange-ftp-hook-function operation args)))))))
 
 ;; It must be a `defsubst' in order to push the whole code into
 ;; tramp-loaddefs.el.  Otherwise, there would be recursive autoloading.
 ;;;###tramp-autoload
 (defsubst tramp-ftp-file-name-p (filename)
   "Check if it's a filename that should be forwarded to Ange-FTP."
-  (string= (tramp-file-name-method (tramp-dissect-file-name filename))
-          tramp-ftp-method))
+  (and (tramp-tramp-file-p filename)
+       (string= (tramp-file-name-method (tramp-dissect-file-name filename))
+               tramp-ftp-method)))
 
 ;;;###tramp-autoload
-(add-to-list 'tramp-foreign-file-name-handler-alist
-            (cons 'tramp-ftp-file-name-p 'tramp-ftp-file-name-handler))
+(tramp--with-startup
+ (add-to-list 'tramp-foreign-file-name-handler-alist
+             (cons #'tramp-ftp-file-name-p #'tramp-ftp-file-name-handler)))
 
 (add-hook 'tramp-unload-hook
          (lambda ()
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index c150edf..2d8f420 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1,6 +1,6 @@
 ;;; tramp-gvfs.el --- Tramp access functions for GVFS daemon  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 ;; Keywords: comm, processes
@@ -68,7 +68,7 @@
 ;; (message
 ;;  "%s"
 ;;  (mapcar
-;;   'car
+;;   #'car
 ;;   (dbus-call-method
 ;;    :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker
 ;;    tramp-gvfs-interface-mounttracker "ListMountableInfo")))
@@ -147,14 +147,14 @@
 
 ;; Add defaults for `tramp-default-user-alist' and `tramp-default-host-alist'.
 ;;;###tramp-autoload
-(when (string-match "\\(.+\\)@\\(\\(?:gmail\\|googlemail\\)\\.com\\)"
-                   user-mail-address)
-  (add-to-list 'tramp-default-user-alist
-              `("\\`gdrive\\'" nil ,(match-string 1 user-mail-address)))
-  (add-to-list 'tramp-default-host-alist
-              '("\\`gdrive\\'" nil ,(match-string 2 user-mail-address))))
+(tramp--with-startup
+ (when (string-match "\\(.+\\)@\\(\\(?:gmail\\|googlemail\\)\\.com\\)"
+                    user-mail-address)
+   (add-to-list 'tramp-default-user-alist
+               `("\\`gdrive\\'" nil ,(match-string 1 user-mail-address)))
+   (add-to-list 'tramp-default-host-alist
+               '("\\`gdrive\\'" nil ,(match-string 2 user-mail-address)))))
 
-;;;###tramp-autoload
 (defcustom tramp-gvfs-zeroconf-domain "local"
   "Zeroconf domain to be used for discovering services, like host names."
   :group 'tramp
@@ -165,9 +165,10 @@
 ;; completion.
 ;;;###tramp-autoload
 (when (featurep 'dbusbind)
-  (dolist (elt tramp-gvfs-methods)
-    (unless (assoc elt tramp-methods)
-      (add-to-list 'tramp-methods (cons elt nil)))))
+  (tramp--with-startup
+   (dolist (elt tramp-gvfs-methods)
+     (unless (assoc elt tramp-methods)
+       (add-to-list 'tramp-methods (cons elt nil))))))
 
 (defconst tramp-gvfs-path-tramp (concat dbus-path-emacs "/Tramp")
   "The preceding object path for own objects.")
@@ -522,7 +523,7 @@ It has been changed in GVFS 1.14.")
 ;; New handlers should be added here.
 ;;;###tramp-autoload
 (defconst tramp-gvfs-file-name-handler-alist
-  '((access-file . ignore)
+  '((access-file . tramp-handle-access-file)
     (add-name-to-file . tramp-handle-add-name-to-file)
     ;; `byte-compiler-base-file-name' performed by default handler.
     ;; `copy-directory' performed by default handler.
@@ -546,7 +547,7 @@ It has been changed in GVFS 1.14.")
     (file-executable-p . tramp-gvfs-handle-file-executable-p)
     (file-exists-p . tramp-handle-file-exists-p)
     (file-in-directory-p . tramp-handle-file-in-directory-p)
-    (file-local-copy . tramp-gvfs-handle-file-local-copy)
+    (file-local-copy . tramp-handle-file-local-copy)
     (file-modes . tramp-handle-file-modes)
     (file-name-all-completions . tramp-gvfs-handle-file-name-all-completions)
     (file-name-as-directory . tramp-handle-file-name-as-directory)
@@ -567,9 +568,8 @@ It has been changed in GVFS 1.14.")
     (file-symlink-p . tramp-handle-file-symlink-p)
     (file-system-info . tramp-gvfs-handle-file-system-info)
     (file-truename . tramp-handle-file-truename)
-    (file-writable-p . tramp-gvfs-handle-file-writable-p)
+    (file-writable-p . tramp-handle-file-writable-p)
     (find-backup-file-name . tramp-handle-find-backup-file-name)
-    ;; `find-file-noselect' performed by default handler.
     ;; `get-file-buffer' performed by default handler.
     (insert-directory . tramp-handle-insert-directory)
     (insert-file-contents . tramp-handle-insert-file-contents)
@@ -578,6 +578,7 @@ It has been changed in GVFS 1.14.")
     (make-directory . tramp-gvfs-handle-make-directory)
     (make-directory-internal . ignore)
     (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
+    (make-process . ignore)
     (make-symbolic-link . tramp-handle-make-symbolic-link)
     (process-file . ignore)
     (rename-file . tramp-gvfs-handle-rename-file)
@@ -590,10 +591,11 @@ It has been changed in GVFS 1.14.")
     (start-file-process . ignore)
     (substitute-in-file-name . tramp-handle-substitute-in-file-name)
     (temporary-file-directory . tramp-handle-temporary-file-directory)
+    (tramp-set-file-uid-gid . ignore)
     (unhandled-file-name-directory . ignore)
     (vc-registered . ignore)
     (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
-    (write-region . tramp-gvfs-handle-write-region))
+    (write-region . tramp-handle-write-region))
   "Alist of handler functions for Tramp GVFS method.
 Operations not mentioned here will be handled by the default Emacs 
primitives.")
 
@@ -621,8 +623,9 @@ pass to the OPERATION."
 
 ;;;###tramp-autoload
 (when (featurep 'dbusbind)
-  (tramp-register-foreign-file-name-handler
-   'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler))
+  (tramp--with-startup
+   (tramp-register-foreign-file-name-handler
+    #'tramp-gvfs-file-name-p #'tramp-gvfs-file-name-handler)))
 
 
 ;; D-Bus helper function.
@@ -654,7 +657,7 @@ Return nil for null BYTE-ARRAY."
     (cons (tramp-gvfs-stringify-dbus-message (car message))
          (tramp-gvfs-stringify-dbus-message (cdr message))))
    ((consp message)
-    (mapcar 'tramp-gvfs-stringify-dbus-message message))
+    (mapcar #'tramp-gvfs-stringify-dbus-message message))
    ((stringp message)
     (format "%S" message))
    (t message)))
@@ -678,7 +681,7 @@ it is an asynchronous call, with `ignore' as callback 
function.
 The other arguments have the same meaning as with `dbus-call-method'
 or `dbus-call-method-asynchronously'."
   `(let ((func (if ,synchronous
-                  'dbus-call-method 'dbus-call-method-asynchronously))
+                  #'dbus-call-method #'dbus-call-method-asynchronously))
         (args (append (list ,bus ,service ,path ,interface ,method)
                       (if ,synchronous (list ,@args) (list 'ignore ,@args)))))
      (tramp-dbus-function ,vec func args)))
@@ -695,10 +698,10 @@ The call will be traced by Tramp with trace level 6."
   `(when (member
          ,interface
          (tramp-dbus-function
-          ,vec 'dbus-introspect-get-interface-names
+          ,vec #'dbus-introspect-get-interface-names
           (list ,bus ,service ,path)))
      (tramp-dbus-function
-      ,vec 'dbus-get-all-properties (list ,bus ,service ,path ,interface))))
+      ,vec #'dbus-get-all-properties (list ,bus ,service ,path ,interface))))
 
 (put 'with-tramp-dbus-get-all-properties 'lisp-indent-function 1)
 (put 'with-tramp-dbus-get-all-properties 'edebug-form-spec '(form symbolp 
body))
@@ -720,7 +723,7 @@ is no information where to trace the message.")
 (add-hook
  (if (boundp 'dbus-event-error-functions)
      'dbus-event-error-functions 'dbus-event-error-hooks)
- 'tramp-gvfs-dbus-event-error)
+ #'tramp-gvfs-dbus-event-error)
 
 
 ;; File name primitives.
@@ -780,7 +783,7 @@ file names."
              v 0 (format "%s %s to %s" msg-operation filename newname)
            (unless
                (apply
-                'tramp-gvfs-send-command v gvfs-operation
+                #'tramp-gvfs-send-command v gvfs-operation
                 (append
                  (and (eq op 'copy) (or keep-date preserve-uid-gid)
                       '("--preserve"))
@@ -880,12 +883,14 @@ file names."
   "Like `expand-file-name' for Tramp files."
   ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
   (setq dir (or dir default-directory "/"))
+  ;; Handle empty NAME.
+  (when (zerop (length name)) (setq name "."))
   ;; Unless NAME is absolute, concat DIR and NAME.
   (unless (file-name-absolute-p name)
     (setq name (concat (file-name-as-directory dir) name)))
   ;; If NAME is not a Tramp file, run the real handler.
   (if (not (tramp-tramp-file-p name))
-      (tramp-run-real-handler 'expand-file-name (list name nil))
+      (tramp-run-real-handler #'expand-file-name (list name nil))
     ;; Dissect NAME.
     (with-parsed-tramp-file-name name nil
       ;; If there is a default location, expand tilde.
@@ -900,14 +905,14 @@ file names."
               (tramp-get-connection-property v "default-location" "~")
               nil t localname 1)))
       ;; Tilde expansion is not possible.
-      (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname)
+      (when (string-match-p "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname)
        (tramp-error
         v 'file-error
         "Cannot expand tilde in file `%s'" name))
-      (unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
+      (unless (tramp-run-real-handler #'file-name-absolute-p (list localname))
        (setq localname (concat "/" localname)))
       ;; We do not pass "/..".
-      (if (string-match "^\\(afp\\|davs?\\|smb\\)$" method)
+      (if (string-match-p "^\\(afp\\|davs?\\|smb\\)$" method)
          (when (string-match "^/[^/]+\\(/\\.\\./?\\)" localname)
            (setq localname (replace-match "/" t t localname 1)))
        (when (string-match "^/\\.\\./?" localname)
@@ -918,7 +923,7 @@ file names."
       ;; No tilde characters in file name, do normal
       ;; `expand-file-name' (this does "/./" and "/../").
       (tramp-make-tramp-file-name
-       v (tramp-run-real-handler 'expand-file-name (list localname))))))
+       v (tramp-run-real-handler #'expand-file-name (list localname))))))
 
 (defun tramp-gvfs-get-directory-attributes (directory)
   "Return GVFS attributes association list of all files in DIRECTORY."
@@ -932,7 +937,7 @@ file names."
          ;; Send command.
          (tramp-gvfs-send-command
           v "gvfs-ls" "-h" "-n" "-a"
-          (mapconcat 'identity tramp-gvfs-file-attributes ",")
+          (mapconcat #'identity tramp-gvfs-file-attributes ",")
           (tramp-gvfs-url-file-name directory))
          ;; Parse output.
          (with-current-buffer (tramp-get-connection-buffer v)
@@ -998,8 +1003,8 @@ If FILE-SYSTEM is non-nil, return file system attributes."
   (setq filename (directory-file-name (expand-file-name filename)))
   (with-parsed-tramp-file-name filename nil
     (setq localname (tramp-compat-file-name-unquote localname))
-    (if (or (and (string-match "^\\(afp\\|davs?\\|smb\\)$" method)
-                (string-match "^/?\\([^/]+\\)$" localname))
+    (if (or (and (string-match-p "^\\(afp\\|davs?\\|smb\\)$" method)
+                (string-match-p "^/?\\([^/]+\\)$" localname))
            (string-equal localname "/"))
        (tramp-gvfs-get-root-attributes filename)
       (assoc
@@ -1039,7 +1044,8 @@ If FILE-SYSTEM is non-nil, return file system attributes."
              (if (eq id-format 'integer)
                  (string-to-number
                   (or (cdr (assoc "unix::uid" attributes))
-                      (format "%s" tramp-unknown-id-integer)))
+                      (eval-when-compile
+                        (format "%s" tramp-unknown-id-integer))))
                (or (cdr (assoc "owner::user" attributes))
                    (cdr (assoc "unix::uid" attributes))
                    tramp-unknown-id-string)))
@@ -1047,7 +1053,8 @@ If FILE-SYSTEM is non-nil, return file system attributes."
              (if (eq id-format 'integer)
                  (string-to-number
                   (or (cdr (assoc "unix::gid" attributes))
-                      (format "%s" tramp-unknown-id-integer)))
+                      (eval-when-compile
+                        (format "%s" tramp-unknown-id-integer))))
                (or (cdr (assoc "owner::group" attributes))
                    (cdr (assoc "unix::gid" attributes))
                    tramp-unknown-id-string)))
@@ -1131,20 +1138,9 @@ If FILE-SYSTEM is non-nil, return file system 
attributes."
     (with-tramp-file-property v localname "file-executable-p"
       (tramp-check-cached-permissions v ?x))))
 
-(defun tramp-gvfs-handle-file-local-copy (filename)
-  "Like `file-local-copy' for Tramp files."
-  (with-parsed-tramp-file-name filename nil
-    (unless (file-exists-p filename)
-      (tramp-error
-       v tramp-file-missing
-       "Cannot make local copy of non-existing file `%s'" filename))
-    (let ((tmpfile (tramp-compat-make-temp-file filename)))
-      (copy-file filename tmpfile 'ok-if-already-exists 'keep-time)
-      tmpfile)))
-
 (defun tramp-gvfs-handle-file-name-all-completions (filename directory)
   "Like `file-name-all-completions' for Tramp files."
-  (unless (save-match-data (string-match "/" filename))
+  (unless (string-match-p "/" filename)
     (all-completions
      filename
      (with-parsed-tramp-file-name (expand-file-name directory) nil
@@ -1176,23 +1172,23 @@ If FILE-SYSTEM is non-nil, return file system 
attributes."
              '(created changed changes-done-hint moved deleted))
             ((memq 'attribute-change flags) '(attribute-changed))))
           (p (apply
-              'start-process
+              #'start-process
               "gvfs-monitor" (generate-new-buffer " *gvfs-monitor*")
               `("gio" "monitor" ,(tramp-gvfs-url-file-name file-name)))))
       (if (not (processp p))
          (tramp-error
           v 'file-notify-error "Monitoring not supported for `%s'" file-name)
        (tramp-message
-        v 6 "Run `%s', %S" (mapconcat 'identity (process-command p) " ") p)
+        v 6 "Run `%s', %S" (mapconcat #'identity (process-command p) " ") p)
        (process-put p 'vector v)
        (process-put p 'events events)
        (process-put p 'watch-name localname)
-       (process-put p 'adjust-window-size-function 'ignore)
+       (process-put p 'adjust-window-size-function #'ignore)
        (set-process-query-on-exit-flag p nil)
-       (set-process-filter p 'tramp-gvfs-monitor-process-filter)
+       (set-process-filter p #'tramp-gvfs-monitor-process-filter)
        ;; There might be an error if the monitor is not supported.
        ;; Give the filter a chance to read the output.
-       (tramp-accept-process-output p 1)
+       (while (tramp-accept-process-output p 0))
        (unless (process-live-p p)
          (tramp-error
           p 'file-notify-error "Monitoring not supported for `%s'" file-name))
@@ -1217,14 +1213,16 @@ file-notify events."
           string (replace-regexp-in-string
                  "renamed to" "moved" string))
     ;; https://bugs.launchpad.net/bugs/1742946
-    (when (string-match "Monitoring not supported\\|No locations given" string)
+    (when
+       (string-match-p "Monitoring not supported\\|No locations given" string)
       (delete-process proc))
 
     (while (string-match
-           (concat "^.+:"
-                   "[[:space:]]\\(.+\\):"
-                   "[[:space:]]" (regexp-opt tramp-gio-events t)
-                   "\\([[:space:]]\\(.+\\)\\)?$")
+           (eval-when-compile
+             (concat "^.+:"
+                     "[[:space:]]\\(.+\\):"
+                     "[[:space:]]" (regexp-opt tramp-gio-events t)
+                     "\\([[:space:]]\\(.+\\)\\)?$"))
            string)
 
       (let ((file (match-string 1 string))
@@ -1234,11 +1232,11 @@ file-notify events."
        ;; File names are returned as URL paths.  We must convert them.
        (when (string-match ddu file)
          (setq file (replace-match dd nil nil file)))
-       (while (string-match "%\\([0-9A-F]\\{2\\}\\)" file)
+       (while (string-match-p "%\\([0-9A-F]\\{2\\}\\)" file)
          (setq file (url-unhex-string file)))
        (when (string-match ddu (or file1 ""))
          (setq file1 (replace-match dd nil nil file1)))
-       (while (string-match "%\\([0-9A-F]\\{2\\}\\)" (or file1 ""))
+       (while (string-match-p "%\\([0-9A-F]\\{2\\}\\)" (or file1 ""))
          (setq file1 (url-unhex-string file1)))
        ;; Remove watch when file or directory to be watched is deleted.
        (when (and (member action '(moved deleted))
@@ -1277,16 +1275,6 @@ file-notify events."
              (- (string-to-number size) (string-to-number used))
              (string-to-number free))))))
 
-(defun tramp-gvfs-handle-file-writable-p (filename)
-  "Like `file-writable-p' for Tramp files."
-  (with-parsed-tramp-file-name filename nil
-    (with-tramp-file-property v localname "file-writable-p"
-      (if (file-exists-p filename)
-         (tramp-check-cached-permissions v ?w)
-       ;; If file doesn't exist, check if directory is writable.
-       (and (file-directory-p (file-name-directory filename))
-            (file-writable-p (file-name-directory filename)))))))
-
 (defun tramp-gvfs-handle-make-directory (dir &optional parents)
   "Like `make-directory' for Tramp files."
   (setq dir (directory-file-name (expand-file-name dir)))
@@ -1319,49 +1307,7 @@ file-notify events."
        'rename filename newname ok-if-already-exists
        'keep-date 'preserve-uid-gid)
     (tramp-run-real-handler
-     'rename-file (list filename newname ok-if-already-exists))))
-
-(defun tramp-gvfs-handle-write-region
-  (start end filename &optional append visit lockname mustbenew)
-  "Like `write-region' for Tramp files."
-  (setq filename (expand-file-name filename))
-  (with-parsed-tramp-file-name filename nil
-    (when (and mustbenew (file-exists-p filename)
-              (or (eq mustbenew 'excl)
-                  (not
-                   (y-or-n-p
-                    (format "File %s exists; overwrite anyway? " filename)))))
-      (tramp-error v 'file-already-exists filename))
-
-    (let ((tmpfile (tramp-compat-make-temp-file filename)))
-      (when (and append (file-exists-p filename))
-       (copy-file filename tmpfile 'ok))
-      ;; We say `no-message' here because we don't want the visited file
-      ;; modtime data to be clobbered from the temp file.  We call
-      ;; `set-visited-file-modtime' ourselves later on.
-      (tramp-run-real-handler
-       'write-region (list start end tmpfile append 'no-message lockname))
-      (condition-case nil
-         (rename-file tmpfile filename 'ok-if-already-exists)
-       (error
-        (delete-file tmpfile)
-        (tramp-error
-         v 'file-error "Couldn't write region to `%s'" filename))))
-
-    (tramp-flush-file-properties v (file-name-directory localname))
-    (tramp-flush-file-properties v localname)
-
-    ;; Set file modification time.
-    (when (or (eq visit t) (stringp visit))
-      (set-visited-file-modtime
-       (tramp-compat-file-attribute-modification-time
-       (file-attributes filename))))
-
-    ;; The end.
-    (when (and (null noninteractive)
-              (or (eq visit t) (null visit) (stringp visit)))
-      (tramp-message v 0 "Wrote %s" filename))
-    (run-hooks 'tramp-handle-write-region-hook)))
+     #'rename-file (list filename newname ok-if-already-exists))))
 
 
 ;; File name conversions.
@@ -1541,7 +1487,7 @@ file-notify events."
        (when (and (string-equal "dav" method) (string-equal "true" ssl))
          (setq method "davs"))
        (when (and (string-equal "davs" method)
-                  (string-match
+                  (string-match-p
                    tramp-gvfs-nextcloud-default-prefix-regexp prefix))
          (setq method "nextcloud"))
        (when (string-equal "google-drive" method)
@@ -1570,20 +1516,20 @@ file-notify events."
   (dbus-register-signal
    :session nil tramp-gvfs-path-mounttracker
    tramp-gvfs-interface-mounttracker "mounted"
-   'tramp-gvfs-handler-mounted-unmounted)
+   #'tramp-gvfs-handler-mounted-unmounted)
   (dbus-register-signal
    :session nil tramp-gvfs-path-mounttracker
    tramp-gvfs-interface-mounttracker "Mounted"
-   'tramp-gvfs-handler-mounted-unmounted)
+   #'tramp-gvfs-handler-mounted-unmounted)
 
   (dbus-register-signal
    :session nil tramp-gvfs-path-mounttracker
    tramp-gvfs-interface-mounttracker "unmounted"
-   'tramp-gvfs-handler-mounted-unmounted)
+   #'tramp-gvfs-handler-mounted-unmounted)
   (dbus-register-signal
    :session nil tramp-gvfs-path-mounttracker
    tramp-gvfs-interface-mounttracker "Unmounted"
-   'tramp-gvfs-handler-mounted-unmounted))
+   #'tramp-gvfs-handler-mounted-unmounted))
 
 (defun tramp-gvfs-connection-mounted-p (vec)
   "Check, whether the location is already mounted."
@@ -1631,7 +1577,7 @@ file-notify events."
         (when (and (string-equal "dav" method) (string-equal "true" ssl))
           (setq method "davs"))
         (when (and (string-equal "davs" method)
-                   (string-match
+                   (string-match-p
                     tramp-gvfs-nextcloud-default-prefix-regexp prefix))
           (setq method "nextcloud"))
         (when (string-equal "google-drive" method)
@@ -1648,8 +1594,8 @@ file-notify events."
                (string-equal domain (tramp-file-name-domain vec))
                (string-equal host (tramp-file-name-host vec))
                (string-equal port (tramp-file-name-port vec))
-               (string-match (concat "^/" (regexp-quote (or share "")))
-                             (tramp-file-name-unquote-localname vec)))
+               (string-match-p (concat "^/" (regexp-quote (or share "")))
+                               (tramp-file-name-unquote-localname vec)))
           ;; Set mountpoint and location.
           (tramp-set-file-property vec "/" "fuse-mountpoint" fuse-mountpoint)
           (tramp-set-connection-property
@@ -1672,7 +1618,7 @@ file-notify events."
 (defun tramp-gvfs-mount-spec-entry (key value)
   "Construct a mount-spec entry to be used in a mount_spec.
 It was \"a(say)\", but has changed to \"a{sv})\"."
-  (if (string-match "^(aya{sv})" tramp-gvfs-mountlocation-signature)
+  (if (string-match-p "^(aya{sv})" tramp-gvfs-mountlocation-signature)
       (list :dict-entry key
            (list :variant (tramp-gvfs-dbus-string-to-byte-array value)))
     (list :struct key (tramp-gvfs-dbus-string-to-byte-array value))))
@@ -1687,7 +1633,7 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
         (localname (tramp-file-name-unquote-localname vec))
         (share (when (string-match "^/?\\([^/]+\\)" localname)
                  (match-string 1 localname)))
-        (ssl (if (string-match "^davs\\|^nextcloud" method) "true" "false"))
+        (ssl (if (string-match-p "^davs\\|^nextcloud" method) "true" "false"))
         (mount-spec
           `(:array
             ,@(cond
@@ -1695,7 +1641,7 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
                 (list (tramp-gvfs-mount-spec-entry "type" "smb-share")
                       (tramp-gvfs-mount-spec-entry "server" host)
                       (tramp-gvfs-mount-spec-entry "share" share)))
-               ((string-match "^dav\\|^nextcloud" method)
+               ((string-match-p "^dav\\|^nextcloud" method)
                 (list (tramp-gvfs-mount-spec-entry "type" "dav")
                       (tramp-gvfs-mount-spec-entry "host" host)
                       (tramp-gvfs-mount-spec-entry "ssl" ssl)))
@@ -1709,7 +1655,7 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
                ((string-equal "nextcloud" method)
                 (list (tramp-gvfs-mount-spec-entry "type" "owncloud")
                       (tramp-gvfs-mount-spec-entry "host" host)))
-               ((string-match "^http" method)
+               ((string-match-p "^http" method)
                 (list (tramp-gvfs-mount-spec-entry "type" "http")
                       (tramp-gvfs-mount-spec-entry
                       "uri"
@@ -1726,7 +1672,7 @@ It was \"a(say)\", but has changed to \"a{sv})\"."
             ,@(when port
                 (list (tramp-gvfs-mount-spec-entry "port" port)))))
         (mount-pref
-          (if (and (string-match "^dav" method)
+          (if (and (string-match-p "^dav" method)
                    (string-match "^/?[^/]+" localname))
               (match-string 0 localname)
            (tramp-gvfs-get-remote-prefix vec))))
@@ -1816,7 +1762,7 @@ connection if a previous connection has died for some 
reason."
                 (string-equal localname "/"))
        (tramp-error vec 'file-error "Filename must contain an AFP volume"))
 
-      (when (and (string-match method "davs?")
+      (when (and (string-match-p "davs?" method)
                 (string-equal localname "/"))
        (tramp-error vec 'file-error "Filename must contain a WebDAV share"))
 
@@ -1838,26 +1784,26 @@ connection if a previous connection has died for some 
reason."
        (dbus-register-method
         :session dbus-service-emacs object-path
         tramp-gvfs-interface-mountoperation "askPassword"
-        'tramp-gvfs-handler-askpassword)
+        #'tramp-gvfs-handler-askpassword)
        (dbus-register-method
         :session dbus-service-emacs object-path
         tramp-gvfs-interface-mountoperation "AskPassword"
-        'tramp-gvfs-handler-askpassword)
+        #'tramp-gvfs-handler-askpassword)
 
        ;; There could be a callback of "askQuestion" when adding
        ;; fingerprints or checking certificates.
        (dbus-register-method
         :session dbus-service-emacs object-path
         tramp-gvfs-interface-mountoperation "askQuestion"
-        'tramp-gvfs-handler-askquestion)
+        #'tramp-gvfs-handler-askquestion)
        (dbus-register-method
         :session dbus-service-emacs object-path
         tramp-gvfs-interface-mountoperation "AskQuestion"
-        'tramp-gvfs-handler-askquestion)
+        #'tramp-gvfs-handler-askquestion)
 
        ;; The call must be asynchronously, because of the "askPassword"
        ;; or "askQuestion" callbacks.
-       (if (string-match "(so)$" tramp-gvfs-mountlocation-signature)
+       (if (string-match-p "(so)$" tramp-gvfs-mountlocation-signature)
            (with-tramp-dbus-call-method vec nil
              :session tramp-gvfs-service-daemon tramp-gvfs-path-mounttracker
              tramp-gvfs-interface-mounttracker tramp-gvfs-mountlocation
@@ -1903,7 +1849,7 @@ connection if a previous connection has died for some 
reason."
         (tramp-get-connection-process vec) "connected" t))))
 
   ;; In `tramp-check-cached-permissions', the connection properties
-  ;; {uig,gid}-{integer,string} are used.  We set them to proper values.
+  ;; "{uid,gid}-{integer,string}" are used.  We set them to proper values.
   (unless tramp-gvfs-get-remote-uid-gid-in-progress
     (let ((tramp-gvfs-get-remote-uid-gid-in-progress t))
       (tramp-gvfs-get-remote-uid vec 'integer)
@@ -1936,7 +1882,7 @@ is applied, and it returns t if the return code is zero."
     (with-current-buffer (tramp-get-connection-buffer vec)
       (tramp-gvfs-maybe-open-connection vec)
       (erase-buffer)
-      (or (zerop (apply 'tramp-call-process vec command nil t nil args))
+      (or (zerop (apply #'tramp-call-process vec command nil t nil args))
          ;; Remove information about mounted connection.
          (and (tramp-flush-file-properties vec "/") nil)))))
 
@@ -1953,9 +1899,9 @@ VEC is used only for traces."
   (dolist
       (object-path
        (mapcar
-       'car
+       #'car
        (tramp-dbus-function
-        vec 'dbus-get-all-managed-objects
+        vec #'dbus-get-all-managed-objects
         `(:session ,tramp-goa-service ,tramp-goa-path))))
     (let* ((account-properties
            (with-tramp-dbus-get-all-properties vec
@@ -2088,7 +2034,7 @@ This uses \"avahi-browse\" in case D-Bus is not enabled 
in Avahi."
 ;;; TODO:
 
 ;; * (Customizable) unmount when exiting Emacs.  See tramp-archive.el.
-
+;;
 ;; * Host name completion for existing mount points (afp-server,
 ;;   smb-server, google-drive, nextcloud) or via smb-network or network.
 ;;
diff --git a/lisp/net/tramp-integration.el b/lisp/net/tramp-integration.el
new file mode 100644
index 0000000..da168ad
--- /dev/null
+++ b/lisp/net/tramp-integration.el
@@ -0,0 +1,199 @@
+;;; tramp-integration.el --- Tramp integration into other packages  -*- 
lexical-binding:t -*-
+
+;; Copyright (C) 2019 Free Software Foundation, Inc.
+
+;; Author: Michael Albinus <address@hidden>
+;; Keywords: comm, processes
+;; Package: tramp
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This assembles all integration of Tramp with other packages.
+
+;;; Code:
+
+(require 'tramp-compat)
+
+;; Pacify byte-compiler.
+(require 'cl-lib)
+(declare-function tramp-dissect-file-name "tramp")
+(declare-function tramp-file-name-equal-p "tramp")
+(declare-function tramp-tramp-file-p "tramp")
+(declare-function recentf-cleanup "recentf")
+(defvar eshell-path-env)
+(defvar recentf-exclude)
+(defvar tramp-current-connection)
+(defvar tramp-postfix-host-format)
+
+;;; Fontification of `read-file-name':
+
+(defvar tramp-rfn-eshadow-overlay)
+(make-variable-buffer-local 'tramp-rfn-eshadow-overlay)
+
+(defun tramp-rfn-eshadow-setup-minibuffer ()
+  "Set up a minibuffer for `file-name-shadow-mode'.
+Adds another overlay hiding filename parts according to Tramp's
+special handling of `substitute-in-file-name'."
+  (when minibuffer-completing-file-name
+    (setq tramp-rfn-eshadow-overlay
+         (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end)))
+    ;; Copy rfn-eshadow-overlay properties.
+    (let ((props (overlay-properties rfn-eshadow-overlay)))
+      (while props
+        ;; The `field' property prevents correct minibuffer
+        ;; completion; we exclude it.
+        (if (not (eq (car props) 'field))
+            (overlay-put tramp-rfn-eshadow-overlay (pop props) (pop props))
+          (pop props) (pop props))))))
+
+(add-hook 'rfn-eshadow-setup-minibuffer-hook
+         #'tramp-rfn-eshadow-setup-minibuffer)
+(add-hook 'tramp-unload-hook
+         (lambda ()
+           (remove-hook 'rfn-eshadow-setup-minibuffer-hook
+                        #'tramp-rfn-eshadow-setup-minibuffer)))
+
+(defun tramp-rfn-eshadow-update-overlay-regexp ()
+  (format "[^%s/~]*\\(/\\|~\\)" tramp-postfix-host-format))
+
+;; Package rfn-eshadow is preloaded in Emacs, but for some reason,
+;; it only did (defvar rfn-eshadow-overlay) without giving it a global
+;; value, so it was only declared as dynamically-scoped within the
+;; rfn-eshadow.el file.  This is now fixed in Emacs>26.1 but we still need
+;; this defvar here for older releases.
+(defvar rfn-eshadow-overlay)
+
+(defun tramp-rfn-eshadow-update-overlay ()
+  "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input.
+This is intended to be used as a minibuffer `post-command-hook' for
+`file-name-shadow-mode'; the minibuffer should have already
+been set up by `rfn-eshadow-setup-minibuffer'."
+  ;; In remote files name, there is a shadowing just for the local part.
+  (ignore-errors
+    (let ((end (or (overlay-end rfn-eshadow-overlay)
+                  (minibuffer-prompt-end)))
+         ;; We do not want to send any remote command.
+         (non-essential t))
+      (when (tramp-tramp-file-p (buffer-substring end (point-max)))
+       (save-excursion
+         (save-restriction
+           (narrow-to-region
+            (1+ (or (string-match-p
+                     (tramp-rfn-eshadow-update-overlay-regexp)
+                     (buffer-string) end)
+                    end))
+            (point-max))
+           (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
+                 (rfn-eshadow-update-overlay-hook nil)
+                 file-name-handler-alist)
+             (move-overlay rfn-eshadow-overlay (point-max) (point-max))
+             (rfn-eshadow-update-overlay))))))))
+
+(add-hook 'rfn-eshadow-update-overlay-hook
+         #'tramp-rfn-eshadow-update-overlay)
+(add-hook 'tramp-unload-hook
+         (lambda ()
+           (remove-hook 'rfn-eshadow-update-overlay-hook
+                        #'tramp-rfn-eshadow-update-overlay)))
+
+;;; Integration of eshell.el:
+
+;; eshell.el keeps the path in `eshell-path-env'.  We must change it
+;; when `default-directory' points to another host.
+(defun tramp-eshell-directory-change ()
+  "Set `eshell-path-env' to $PATH of the host related to `default-directory'."
+  ;; Remove last element of `(exec-path)', which is `exec-directory'.
+  ;; Use `path-separator' as it does eshell.
+  (setq eshell-path-env
+       (mapconcat
+        #'identity (butlast (tramp-compat-exec-path)) path-separator)))
+
+(eval-after-load "esh-util"
+  '(progn
+     (add-hook 'eshell-mode-hook
+              #'tramp-eshell-directory-change)
+     (add-hook 'eshell-directory-change-hook
+              #'tramp-eshell-directory-change)
+     (add-hook 'tramp-integration-unload-hook
+              (lambda ()
+                (remove-hook 'eshell-mode-hook
+                             #'tramp-eshell-directory-change)
+                (remove-hook 'eshell-directory-change-hook
+                             #'tramp-eshell-directory-change)))))
+
+;;; Integration of recentf.el:
+
+(defun tramp-recentf-exclude-predicate (name)
+  "Predicate to exclude a remote file name from recentf.
+NAME must be equal to `tramp-current-connection'."
+  (when (file-remote-p name)
+    (tramp-file-name-equal-p
+     (tramp-dissect-file-name name) (car tramp-current-connection))))
+
+(defun tramp-recentf-cleanup (vec)
+  "Remove all file names related to VEC from recentf."
+  (when (bound-and-true-p recentf-list)
+    (let ((tramp-current-connection `(,vec))
+         (recentf-exclude '(tramp-recentf-exclude-predicate)))
+      (recentf-cleanup))))
+
+(defun tramp-recentf-cleanup-all ()
+  "Remove all remote file names from recentf."
+  (when (bound-and-true-p recentf-list)
+    (let ((recentf-exclude '(file-remote-p)))
+      (recentf-cleanup))))
+
+(eval-after-load "recentf"
+  '(progn
+     (add-hook 'tramp-cleanup-connection-hook
+              #'tramp-recentf-cleanup)
+     (add-hook 'tramp-cleanup-all-connections-hook
+              #'tramp-recentf-cleanup-all)
+     (add-hook 'tramp-integration-unload-hook
+              (lambda ()
+                (remove-hook 'tramp-cleanup-connection-hook
+                             #'tramp-recentf-cleanup)
+                (remove-hook 'tramp-cleanup-all-connections-hook
+                             #'tramp-recentf-cleanup-all)))))
+
+;;; Default connection-local variables for Tramp:
+
+(defconst tramp-connection-local-default-profile
+  '((shell-file-name . "/bin/sh")
+    (shell-command-switch . "-c"))
+  "Default connection-local variables for remote connections.")
+
+;; `connection-local-set-profile-variables' and
+;; `connection-local-set-profiles' exists since Emacs 26.1.
+(eval-after-load "shell"
+  '(progn
+     (tramp-compat-funcall
+      'connection-local-set-profile-variables
+      'tramp-connection-local-default-profile
+      tramp-connection-local-default-profile)
+     (tramp-compat-funcall
+      'connection-local-set-profiles
+      `(:application tramp)
+      'tramp-connection-local-default-profile)))
+
+(add-hook 'tramp-unload-hook
+         (lambda () (unload-feature 'tramp-integration 'force)))
+
+(provide 'tramp-integration)
+
+;;; tramp-integration.el ends here
diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el
new file mode 100644
index 0000000..0148116
--- /dev/null
+++ b/lisp/net/tramp-rclone.el
@@ -0,0 +1,608 @@
+;;; tramp-rclone.el --- Tramp access functions to cloud storages  -*- 
lexical-binding:t -*-
+
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
+
+;; Author: Michael Albinus <address@hidden>
+;; Keywords: comm, processes
+;; Package: tramp
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; rclone is a command line program to sync files and directories to
+;; and from cloud storages.  Tramp uses its mount utility to access
+;; files and directories there.  The configuration of rclone for
+;; different storage systems is performed outside Tramp, see rclone(1).
+
+;; A remote file under rclone control has the form
+;; "/rclone:<remote>:/path/to/file".  <remote> is the name of a
+;; storage system in rclone's configuration.  Therefore, such a remote
+;; file name does not know of any user or port specification.
+
+;;; Code:
+
+(eval-when-compile (require 'cl-lib))
+(require 'tramp)
+
+;;;###tramp-autoload
+(defconst tramp-rclone-method "rclone"
+  "When this method name is used, forward all calls to rclone mounts.")
+
+(defcustom tramp-rclone-program "rclone"
+  "Name of the rclone program."
+  :group 'tramp
+  :version "27.1"
+  :type 'string)
+
+;;;###tramp-autoload
+(tramp--with-startup
+ (add-to-list 'tramp-methods
+             `(,tramp-rclone-method
+               (tramp-mount-args nil)
+               (tramp-copyto-args nil)
+               (tramp-moveto-args nil)
+               (tramp-about-args ("--full"))))
+
+ (add-to-list 'tramp-default-host-alist `(,tramp-rclone-method nil ""))
+
+ (tramp-set-completion-function
+  tramp-rclone-method '((tramp-rclone-parse-device-names ""))))
+
+
+;; New handlers should be added here.
+;;;###tramp-autoload
+(defconst tramp-rclone-file-name-handler-alist
+  '((access-file . tramp-handle-access-file)
+    (add-name-to-file . tramp-handle-add-name-to-file)
+    ;; `byte-compiler-base-file-name' performed by default handler.
+    ;; `copy-directory' performed by default handler.
+    (copy-file . tramp-rclone-handle-copy-file)
+    (delete-directory . tramp-rclone-handle-delete-directory)
+    (delete-file . tramp-rclone-handle-delete-file)
+    ;; `diff-latest-backup-file' performed by default handler.
+    (directory-file-name . tramp-handle-directory-file-name)
+    (directory-files . tramp-rclone-handle-directory-files)
+    (directory-files-and-attributes
+     . tramp-handle-directory-files-and-attributes)
+    (dired-compress-file . ignore)
+    (dired-uncache . tramp-handle-dired-uncache)
+    (exec-path . ignore)
+    (expand-file-name . tramp-handle-expand-file-name)
+    (file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
+    (file-acl . ignore)
+    (file-attributes . tramp-rclone-handle-file-attributes)
+    (file-directory-p . tramp-handle-file-directory-p)
+    (file-equal-p . tramp-handle-file-equal-p)
+    (file-executable-p . tramp-rclone-handle-file-executable-p)
+    (file-exists-p . tramp-handle-file-exists-p)
+    (file-in-directory-p . tramp-handle-file-in-directory-p)
+    (file-local-copy . tramp-handle-file-local-copy)
+    (file-modes . tramp-handle-file-modes)
+    (file-name-all-completions . tramp-rclone-handle-file-name-all-completions)
+    (file-name-as-directory . tramp-handle-file-name-as-directory)
+    (file-name-case-insensitive-p . tramp-handle-file-name-case-insensitive-p)
+    (file-name-completion . tramp-handle-file-name-completion)
+    (file-name-directory . tramp-handle-file-name-directory)
+    (file-name-nondirectory . tramp-handle-file-name-nondirectory)
+    ;; `file-name-sans-versions' performed by default handler.
+    (file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
+    (file-notify-add-watch . ignore)
+    (file-notify-rm-watch . ignore)
+    (file-notify-valid-p . ignore)
+    (file-ownership-preserved-p . ignore)
+    (file-readable-p . tramp-rclone-handle-file-readable-p)
+    (file-regular-p . tramp-handle-file-regular-p)
+    (file-remote-p . tramp-handle-file-remote-p)
+    (file-selinux-context . tramp-handle-file-selinux-context)
+    (file-symlink-p . tramp-handle-file-symlink-p)
+    (file-system-info . tramp-rclone-handle-file-system-info)
+    (file-truename . tramp-handle-file-truename)
+    (file-writable-p . tramp-handle-file-writable-p)
+    (find-backup-file-name . tramp-handle-find-backup-file-name)
+    ;; `get-file-buffer' performed by default handler.
+    (insert-directory . tramp-handle-insert-directory)
+    (insert-file-contents . tramp-handle-insert-file-contents)
+    (load . tramp-handle-load)
+    (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
+    (make-directory . tramp-rclone-handle-make-directory)
+    (make-directory-internal . ignore)
+    (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
+    (make-process . ignore)
+    (make-symbolic-link . tramp-handle-make-symbolic-link)
+    (process-file . ignore)
+    (rename-file . tramp-rclone-handle-rename-file)
+    (set-file-acl . ignore)
+    (set-file-modes . ignore)
+    (set-file-selinux-context . ignore)
+    (set-file-times . ignore)
+    (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
+    (shell-command . ignore)
+    (start-file-process . ignore)
+    (substitute-in-file-name . tramp-handle-substitute-in-file-name)
+    (temporary-file-directory . tramp-handle-temporary-file-directory)
+    (tramp-set-file-uid-gid . ignore)
+    (unhandled-file-name-directory . ignore)
+    (vc-registered . ignore)
+    (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
+    (write-region . tramp-handle-write-region))
+  "Alist of handler functions for Tramp RCLONE method.
+Operations not mentioned here will be handled by the default Emacs 
primitives.")
+
+;; It must be a `defsubst' in order to push the whole code into
+;; tramp-loaddefs.el.  Otherwise, there would be recursive autoloading.
+;;;###tramp-autoload
+(defsubst tramp-rclone-file-name-p (filename)
+  "Check if it's a filename for rclone."
+  (and (tramp-tramp-file-p filename)
+       (string= (tramp-file-name-method (tramp-dissect-file-name filename))
+               tramp-rclone-method)))
+
+;;;###tramp-autoload
+(defun tramp-rclone-file-name-handler (operation &rest args)
+  "Invoke the rclone handler for OPERATION.
+First arg specifies the OPERATION, second arg is a list of arguments to
+pass to the OPERATION."
+  (let ((fn (assoc operation tramp-rclone-file-name-handler-alist)))
+    (if fn
+       (save-match-data (apply (cdr fn) args))
+      (tramp-run-real-handler operation args))))
+
+;;;###tramp-autoload
+(tramp--with-startup
+ (tramp-register-foreign-file-name-handler
+  #'tramp-rclone-file-name-p #'tramp-rclone-file-name-handler))
+
+;;;###tramp-autoload
+(defun tramp-rclone-parse-device-names (_ignore)
+  "Return a list of (nil host) tuples allowed to access."
+  (with-tramp-connection-property nil "rclone-device-names"
+    (delq nil
+         (mapcar
+          (lambda (line)
+            (when (string-match "^\\(\\S-+\\):$" line)
+              `(nil ,(match-string 1 line))))
+          (tramp-process-lines nil tramp-rclone-program "listremotes")))))
+
+
+;; File name primitives.
+
+(defun tramp-rclone-do-copy-or-rename-file
+  (op filename newname &optional ok-if-already-exists keep-date
+   preserve-uid-gid preserve-extended-attributes)
+  "Copy or rename a remote file.
+OP must be `copy' or `rename' and indicates the operation to perform.
+FILENAME specifies the file to copy or rename, NEWNAME is the name of
+the new file (for copy) or the new name of the file (for rename).
+OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists already.
+KEEP-DATE means to make sure that NEWNAME has the same timestamp
+as FILENAME.  PRESERVE-UID-GID, when non-nil, instructs to keep
+the uid and gid if both files are on the same host.
+PRESERVE-EXTENDED-ATTRIBUTES is ignored.
+
+This function is invoked by `tramp-rclone-handle-copy-file' and
+`tramp-rclone-handle-rename-file'.  It is an error if OP is neither
+of `copy' and `rename'.  FILENAME and NEWNAME must be absolute
+file names."
+  (unless (memq op '(copy rename))
+    (error "Unknown operation `%s', must be `copy' or `rename'" op))
+
+  (setq filename (file-truename filename))
+  (if (file-directory-p filename)
+      (progn
+       (copy-directory filename newname keep-date t)
+       (when (eq op 'rename) (delete-directory filename 'recursive)))
+
+    (let ((t1 (tramp-tramp-file-p filename))
+         (t2 (tramp-tramp-file-p newname))
+         (rclone-operation (if (eq op 'copy) "copyto" "moveto"))
+         (msg-operation (if (eq op 'copy) "Copying" "Renaming")))
+
+      (with-parsed-tramp-file-name (if t1 filename newname) nil
+       (when (and (not ok-if-already-exists) (file-exists-p newname))
+         (tramp-error v 'file-already-exists newname))
+
+       (if (or (and t1 (not (tramp-rclone-file-name-p filename)))
+               (and t2 (not (tramp-rclone-file-name-p newname))))
+
+           ;; We cannot copy or rename directly.
+           (let ((tmpfile (tramp-compat-make-temp-file filename)))
+             (if (eq op 'copy)
+                 (copy-file
+                  filename tmpfile t keep-date preserve-uid-gid
+                  preserve-extended-attributes)
+               (rename-file filename tmpfile t))
+             (rename-file tmpfile newname ok-if-already-exists))
+
+         ;; Direct action.
+         (with-tramp-progress-reporter
+             v 0 (format "%s %s to %s" msg-operation filename newname)
+           (unless (zerop
+                    (tramp-rclone-send-command
+                     v rclone-operation
+                     (tramp-rclone-remote-file-name filename)
+                     (tramp-rclone-remote-file-name newname)))
+             (tramp-error
+              v 'file-error
+              "Error %s `%s' `%s'" msg-operation filename newname)))
+
+         (when (and t1 (eq op 'rename))
+           (with-parsed-tramp-file-name filename v1
+             (tramp-flush-file-properties
+              v1 (file-name-directory v1-localname))
+             (tramp-flush-file-properties v1 v1-localname)
+             (when (tramp-rclone-file-name-p filename)
+               (tramp-rclone-flush-directory-cache v1)
+               ;; The mount point's directory cache might need time
+               ;; to flush.
+               (while (file-exists-p filename)
+                 (tramp-flush-file-properties
+                  v1 (file-name-directory v1-localname))
+                 (tramp-flush-file-properties v1 v1-localname)))))
+
+         (when t2
+           (with-parsed-tramp-file-name newname v2
+             (tramp-flush-file-properties
+              v2 (file-name-directory v2-localname))
+             (tramp-flush-file-properties v2 v2-localname)
+             (when (tramp-rclone-file-name-p newname)
+               (tramp-rclone-flush-directory-cache v2)
+               ;; The mount point's directory cache might need time
+               ;; to flush.
+               (while (not (file-exists-p newname))
+                 (tramp-flush-file-properties
+                  v2 (file-name-directory v2-localname))
+                 (tramp-flush-file-properties v2 v2-localname))))))))))
+
+(defun tramp-rclone-handle-copy-file
+  (filename newname &optional ok-if-already-exists keep-date
+   preserve-uid-gid preserve-extended-attributes)
+  "Like `copy-file' for Tramp files."
+  (setq filename (expand-file-name filename))
+  (setq newname (expand-file-name newname))
+  ;; At least one file a Tramp file?
+  (if (or (tramp-tramp-file-p filename)
+         (tramp-tramp-file-p newname))
+      (tramp-rclone-do-copy-or-rename-file
+       'copy filename newname ok-if-already-exists keep-date
+       preserve-uid-gid preserve-extended-attributes)
+    (tramp-run-real-handler
+     #'copy-file
+     (list filename newname ok-if-already-exists keep-date
+          preserve-uid-gid preserve-extended-attributes))))
+
+(defun tramp-rclone-handle-delete-directory
+    (directory &optional recursive trash)
+  "Like `delete-directory' for Tramp files."
+  (with-parsed-tramp-file-name (expand-file-name directory) nil
+    (delete-directory (tramp-rclone-local-file-name directory) recursive trash)
+    (tramp-flush-file-properties v (file-name-directory localname))
+    (tramp-flush-directory-properties v localname)
+    (tramp-rclone-flush-directory-cache v)))
+
+(defun tramp-rclone-handle-delete-file (filename &optional trash)
+  "Like `delete-file' for Tramp files."
+  (with-parsed-tramp-file-name (expand-file-name filename) nil
+    (delete-file (tramp-rclone-local-file-name filename) trash)
+    (tramp-flush-file-properties v (file-name-directory localname))
+    (tramp-flush-file-properties v localname)
+    (tramp-rclone-flush-directory-cache v)))
+
+(defun tramp-rclone-handle-directory-files
+    (directory &optional full match nosort)
+  "Like `directory-files' for Tramp files."
+  (when (file-directory-p directory)
+    (setq directory (file-name-as-directory (expand-file-name directory)))
+    (with-parsed-tramp-file-name directory nil
+      (let ((result
+            (directory-files
+             (tramp-rclone-local-file-name directory) full match)))
+       ;; Massage the result.
+       (when full
+         (let ((local (concat "^" (regexp-quote (tramp-rclone-mount-point v))))
+               (remote (funcall (if (tramp-compat-file-name-quoted-p directory)
+                                    #'tramp-compat-file-name-quote #'identity)
+                                (file-remote-p directory))))
+           (setq result
+                 (mapcar
+                  (lambda (x) (replace-regexp-in-string local remote x))
+                  result))))
+       ;; Some storage systems do not return "." and "..".
+       (dolist (item '(".." "."))
+         (when (and (string-match-p (or match (regexp-quote item)) item)
+                    (not
+                     (member (if full (setq item (concat directory item)) item)
+                             result)))
+           (setq result (cons item result))))
+       ;; Return result.
+       (if nosort result (sort result #'string<))))))
+
+(defun tramp-rclone-handle-file-attributes (filename &optional id-format)
+  "Like `file-attributes' for Tramp files."
+  (with-parsed-tramp-file-name (expand-file-name filename) nil
+    (with-tramp-file-property
+       v localname (format "file-attributes-%s" id-format)
+      (file-attributes (tramp-rclone-local-file-name filename) id-format))))
+
+(defun tramp-rclone-handle-file-executable-p (filename)
+  "Like `file-executable-p' for Tramp files."
+  (with-parsed-tramp-file-name (expand-file-name filename) nil
+    (with-tramp-file-property v localname "file-executable-p"
+      (file-executable-p (tramp-rclone-local-file-name filename)))))
+
+(defun tramp-rclone-handle-file-name-all-completions (filename directory)
+  "Like `file-name-all-completions' for Tramp files."
+  (all-completions
+   filename
+   (delete-dups
+    (append
+     (file-name-all-completions
+      filename (tramp-rclone-local-file-name directory))
+     ;; Some storage systems do not return "." and "..".
+     (let (result)
+       (dolist (item '(".." ".") result)
+        (when (string-prefix-p filename item)
+          (catch 'match
+            (dolist (elt completion-regexp-list)
+              (unless (string-match-p elt item) (throw 'match nil)))
+            (setq result (cons (concat item "/") result))))))))))
+
+(defun tramp-rclone-handle-file-readable-p (filename)
+  "Like `file-readable-p' for Tramp files."
+  (with-parsed-tramp-file-name (expand-file-name filename) nil
+    (with-tramp-file-property v localname "file-readable-p"
+      (file-readable-p (tramp-rclone-local-file-name filename)))))
+
+(defun tramp-rclone-handle-file-system-info (filename)
+  "Like `file-system-info' for Tramp files."
+  (ignore-errors
+    (unless (file-directory-p filename)
+      (setq filename (file-name-directory filename)))
+    (with-parsed-tramp-file-name (expand-file-name filename) nil
+      (tramp-message v 5 "file system info: %s" localname)
+      (tramp-rclone-send-command v "about" (concat host ":"))
+      (with-current-buffer (tramp-get-connection-buffer v)
+       (let (total used free)
+         (goto-char (point-min))
+         (while (not (eobp))
+           (when (looking-at "Total: [[:space:]]+\\([[:digit:]]+\\)")
+             (setq total (string-to-number (match-string 1))))
+           (when (looking-at "Used: [[:space:]]+\\([[:digit:]]+\\)")
+             (setq used (string-to-number (match-string 1))))
+           (when (looking-at "Free: [[:space:]]+\\([[:digit:]]+\\)")
+             (setq free (string-to-number (match-string 1))))
+           (forward-line))
+         (when used
+           ;; The used number of bytes is not part of the result.  As
+           ;; side effect, we store it as file property.
+           (tramp-set-file-property v localname "used-bytes" used))
+         ;; Result.
+         (when (and total free)
+           (list total free (- total free))))))))
+
+(defun tramp-rclone-handle-insert-directory
+  (filename switches &optional wildcard full-directory-p)
+  "Like `insert-directory' for Tramp files."
+  (insert-directory
+   (tramp-rclone-local-file-name filename) switches wildcard full-directory-p)
+  (goto-char (point-min))
+  (while (search-forward (tramp-rclone-local-file-name filename) nil 'noerror)
+    (replace-match filename)))
+
+(defun tramp-rclone-handle-insert-file-contents
+  (filename &optional visit beg end replace)
+  "Like `insert-file-contents' for Tramp files."
+  (let ((result
+        (insert-file-contents
+         (tramp-rclone-local-file-name filename) visit beg end replace)))
+    (prog1
+       (list (expand-file-name filename) (cadr result))
+      (when visit (setq buffer-file-name filename)))))
+
+(defun tramp-rclone-handle-make-directory (dir &optional parents)
+  "Like `make-directory' for Tramp files."
+  (with-parsed-tramp-file-name (expand-file-name dir) nil
+    (make-directory (tramp-rclone-local-file-name dir) parents)
+    ;; When PARENTS is non-nil, DIR could be a chain of non-existent
+    ;; directories a/b/c/...  Instead of checking, we simply flush the
+    ;; whole file cache.
+    (tramp-flush-file-properties v localname)
+    (tramp-flush-directory-properties
+     v (if parents "/" (file-name-directory localname)))
+    (tramp-rclone-flush-directory-cache v)))
+
+(defun tramp-rclone-handle-rename-file
+  (filename newname &optional ok-if-already-exists)
+  "Like `rename-file' for Tramp files."
+  (setq filename (expand-file-name filename))
+  (setq newname (expand-file-name newname))
+  ;; At least one file a Tramp file?
+  (if (or (tramp-tramp-file-p filename)
+          (tramp-tramp-file-p newname))
+      (tramp-rclone-do-copy-or-rename-file
+       'rename filename newname ok-if-already-exists
+       'keep-date 'preserve-uid-gid)
+    (tramp-run-real-handler
+     #'rename-file (list filename newname ok-if-already-exists))))
+
+
+;; File name conversions.
+
+(defun tramp-rclone-mount-point (vec)
+  "Return local mount point of VEC."
+  (expand-file-name
+   (concat
+    tramp-temp-name-prefix (tramp-file-name-method vec)
+    "." (tramp-file-name-host vec))
+   (tramp-compat-temporary-file-directory)))
+
+(defun tramp-rclone-mounted-p (vec)
+  "Check, whether storage system determined by VEC is mounted."
+  (when (tramp-get-connection-process vec)
+    ;; We cannot use `with-connection-property', because we don't want
+    ;; to cache a nil result.
+    (or (tramp-get-connection-property
+        (tramp-get-connection-process vec) "mounted" nil)
+       (let* ((default-directory temporary-file-directory)
+              (mount (shell-command-to-string "mount -t fuse.rclone")))
+         (tramp-message vec 6 "%s" "mount -t fuse.rclone")
+         (tramp-message vec 6 "\n%s" mount)
+         (tramp-set-connection-property
+          (tramp-get-connection-process vec) "mounted"
+          (when (string-match
+                 (format
+                  "^\\(%s:\\S-*\\)" (regexp-quote (tramp-file-name-host vec)))
+                 mount)
+            (match-string 1 mount)))))))
+
+(defun tramp-rclone-flush-directory-cache (vec)
+  "Flush directory cache of VEC mount."
+  (let ((rclone-pid
+        ;; Identify rclone process.
+        (when (tramp-get-connection-process vec)
+          (with-tramp-connection-property
+              (tramp-get-connection-process vec) "rclone-pid"
+            (catch 'pid
+              (dolist (pid (list-system-processes)) ;; "pidof rclone" ?
+                (and (string-match-p
+                      (regexp-quote
+                       (format "rclone mount %s:" (tramp-file-name-host vec)))
+                      (or (cdr (assoc 'args (process-attributes pid))) ""))
+                     (throw 'pid pid))))))))
+    ;; Send a SIGHUP in order to flush directory cache.
+    (when rclone-pid
+      (tramp-message
+       vec 6 "Send SIGHUP %d: %s"
+       rclone-pid (cdr (assoc 'args (process-attributes rclone-pid))))
+      (signal-process rclone-pid 'SIGHUP))))
+
+(defun tramp-rclone-local-file-name (filename)
+  "Return local mount name of FILENAME."
+  (setq filename (tramp-compat-file-name-unquote (expand-file-name filename)))
+  (with-parsed-tramp-file-name filename nil
+    ;; As long as we call `tramp-rclone-maybe-open-connection' here,
+    ;; we cache the result.
+    (with-tramp-file-property v localname "local-file-name"
+      (tramp-rclone-maybe-open-connection v)
+      (let ((quoted (tramp-compat-file-name-quoted-p localname))
+           (localname (tramp-compat-file-name-unquote localname)))
+       (funcall
+        (if quoted #'tramp-compat-file-name-quote #'identity)
+        (expand-file-name
+         (if (file-name-absolute-p localname)
+             (substring localname 1) localname)
+         (tramp-rclone-mount-point v)))))))
+
+(defun tramp-rclone-remote-file-name (filename)
+  "Return FILENAME as used in the `rclone' command."
+  (setq filename (tramp-compat-file-name-unquote (expand-file-name filename)))
+  (if (tramp-rclone-file-name-p filename)
+      (with-parsed-tramp-file-name filename nil
+       ;; As long as we call `tramp-rclone-maybe-open-connection' here,
+       ;; we cache the result.
+       (with-tramp-file-property v localname "remote-file-name"
+         (tramp-rclone-maybe-open-connection v)
+         ;; TODO: This shall be handled by `expand-file-name'.
+         (setq localname
+               (replace-regexp-in-string "^\\." "" (or localname "")))
+         (format "%s%s" (tramp-rclone-mounted-p v) localname)))
+    ;; It is a local file name.
+    filename))
+
+(defun tramp-rclone-maybe-open-connection (vec)
+  "Maybe open a connection VEC.
+Does not do anything if a connection is already open, but re-opens the
+connection if a previous connection has died for some reason."
+  (let ((host (tramp-file-name-host vec)))
+    (when (rassoc `(,host) (tramp-rclone-parse-device-names nil))
+      (if (zerop (length host))
+         (tramp-error vec 'file-error "Storage %s not connected" host))
+
+      ;; During completion, don't reopen a new connection.  We check
+      ;; this for the process related to `tramp-buffer-name';
+      ;; otherwise `start-file-process' wouldn't run ever when
+      ;; `non-essential' is non-nil.
+      (when (and (tramp-completion-mode-p)
+                (null (get-process (tramp-buffer-name vec))))
+       (throw 'non-essential 'non-essential))
+
+      ;; We need a process bound to the connection buffer.  Therefore,
+      ;; we create a dummy process.  Maybe there is a better solution?
+      (unless (get-buffer-process (tramp-get-connection-buffer vec))
+       (let ((p (make-network-process
+                 :name (tramp-buffer-name vec)
+                 :buffer (tramp-get-connection-buffer vec)
+                 :server t :host 'local :service t :noquery t)))
+         (process-put p 'vector vec)
+         (set-process-query-on-exit-flag p nil)
+
+         ;; Set connection-local variables.
+         (tramp-set-connection-local-variables vec)))
+
+      ;; Create directory.
+      (unless (file-directory-p (tramp-rclone-mount-point vec))
+       (make-directory (tramp-rclone-mount-point vec) 'parents))
+
+      ;; Mount.  This command does not return, so we use 0 as
+      ;; DESTINATION of `tramp-call-process'.
+      (unless (tramp-rclone-mounted-p vec)
+       (apply
+        #'tramp-call-process
+        vec tramp-rclone-program nil 0 nil
+        (delq nil
+              `("mount" ,(concat host ":/")
+                ,(tramp-rclone-mount-point vec)
+                ;; This could be nil.
+                ,(tramp-get-method-parameter vec 'tramp-mount-args))))
+       (while (not (file-exists-p (tramp-make-tramp-file-name vec 'localname)))
+         (tramp-cleanup-connection vec 'keep-debug 'keep-password))
+
+       ;; Mark it as connected.
+       (tramp-set-connection-property
+        (tramp-get-connection-process vec) "connected" t))))
+
+  ;; In `tramp-check-cached-permissions', the connection properties
+  ;; "{uid,gid}-{integer,string}" are used.  We set them to proper values.
+  (with-tramp-connection-property
+      vec "uid-integer" (tramp-get-local-uid 'integer))
+  (with-tramp-connection-property
+      vec "gid-integer" (tramp-get-local-gid 'integer))
+  (with-tramp-connection-property
+      vec "uid-string" (tramp-get-local-uid 'string))
+  (with-tramp-connection-property
+      vec "gid-string" (tramp-get-local-gid 'string)))
+
+(defun tramp-rclone-send-command (vec &rest args)
+  "Send the COMMAND to connection VEC."
+  (with-current-buffer (tramp-get-connection-buffer vec)
+    (erase-buffer)
+    (let ((flags (tramp-get-method-parameter
+                 vec (intern (format "tramp-%s-args" (car args))))))
+      (apply #'tramp-call-process
+            vec tramp-rclone-program nil t nil (append args flags)))))
+
+(add-hook 'tramp-unload-hook
+         (lambda ()
+           (unload-feature 'tramp-rclone 'force)))
+
+(provide 'tramp-rclone)
+
+;;; TODO:
+
+;; * If possible, get rid of "rclone mount".  Maybe it is more
+;;   performant then.
+
+;;; tramp-rclone.el ends here
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 11ee063..edd9af4 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1,6 +1,6 @@
 ;;; tramp-sh.el --- Tramp access functions for (s)sh-like connections  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; (copyright statements below in code to be updated with the above notice)
 
@@ -41,7 +41,6 @@
 (defvar vc-git-program)
 (defvar vc-hg-program)
 
-;;;###tramp-autoload
 (defcustom tramp-inline-compress-start-size 4096
   "The minimum size of compressing where inline transfer.
 When inline transfer, compress transferred data of file
@@ -50,7 +49,6 @@ If it is nil, no compression at all will be applied."
   :group 'tramp
   :type '(choice (const nil) integer))
 
-;;;###tramp-autoload
 (defcustom tramp-copy-size-limit 10240
   "The maximum file size where inline copying is preferred over an \
 out-of-the-band copy.
@@ -67,7 +65,6 @@ files conditionalize this setup based on the TERM environment 
variable."
   :group 'tramp
   :type 'string)
 
-;;;###tramp-autoload
 (defcustom tramp-histfile-override "~/.tramp_history"
   "When invoking a shell, override the HISTFILE with this value.
 When setting to a string, it redirects the shell history to that
@@ -88,7 +85,6 @@ the default storage location, e.g. \"$HOME/.sh_history\"."
 (defconst tramp-display-escape-sequence-regexp "\e[[;0-9]+m"
   "Terminal control escape sequences for display attributes.")
 
-;;;###tramp-autoload
 (defconst tramp-device-escape-sequence-regexp "\e[[0-9]+n"
   "Terminal control escape sequences for device status.")
 
@@ -111,7 +107,6 @@ detected as prompt when being sent on echoing hosts, 
therefore.")
 (defconst tramp-end-of-heredoc (md5 tramp-end-of-output)
   "String used to recognize end of heredoc strings.")
 
-;;;###tramp-autoload
 (defcustom tramp-use-ssh-controlmaster-options t
   "Whether to use `tramp-ssh-controlmaster-options'."
   :group 'tramp
@@ -134,284 +129,262 @@ The string is used in `tramp-methods'.")
 
 ;; Initialize `tramp-methods' with the supported methods.
 ;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("rcp"
-    (tramp-login-program        "rsh")
-    (tramp-login-args           (("%h") ("-l" "%u")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-copy-program         "rcp")
-    (tramp-copy-args            (("-p" "%k") ("-r")))
-    (tramp-copy-keep-date       t)
-    (tramp-copy-recursive       t)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("remcp"
-    (tramp-login-program        "remsh")
-    (tramp-login-args           (("%h") ("-l" "%u")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-copy-program         "rcp")
-    (tramp-copy-args            (("-p" "%k")))
-    (tramp-copy-keep-date       t)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("scp"
-    (tramp-login-program        "ssh")
-    (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
-                                ("-e" "none") ("%h")))
-    (tramp-async-args           (("-q")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-copy-program         "scp")
-    (tramp-copy-args            (("-P" "%p") ("-p" "%k") ("-q") ("-r") ("%c")))
-    (tramp-copy-keep-date       t)
-    (tramp-copy-recursive       t)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("scpx"
-    (tramp-login-program        "ssh")
-    (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
-                                ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh")))
-    (tramp-async-args           (("-q")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-copy-program         "scp")
-    (tramp-copy-args            (("-P" "%p") ("-p" "%k")
-                                ("-q") ("-r") ("%c")))
-    (tramp-copy-keep-date       t)
-    (tramp-copy-recursive       t)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("rsync"
-    (tramp-login-program        "ssh")
-    (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
-                                ("-e" "none") ("%h")))
-    (tramp-async-args           (("-q")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-copy-program         "rsync")
-    (tramp-copy-args            (("-t" "%k") ("-p") ("-r") ("-s") ("-c")))
-    (tramp-copy-env             (("RSYNC_RSH") ("ssh" "%c")))
-    (tramp-copy-keep-date       t)
-    (tramp-copy-keep-tmpfile    t)
-    (tramp-copy-recursive       t)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("rsh"
-    (tramp-login-program        "rsh")
-    (tramp-login-args           (("%h") ("-l" "%u")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("remsh"
-    (tramp-login-program        "remsh")
-    (tramp-login-args           (("%h") ("-l" "%u")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("ssh"
-    (tramp-login-program        "ssh")
-    (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
-                                ("-e" "none") ("%h")))
-    (tramp-async-args           (("-q")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("sshx"
-    (tramp-login-program        "ssh")
-    (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
-                                ("-e" "none") ("-t" "-t") ("%h") ("/bin/sh")))
-    (tramp-async-args           (("-q")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("telnet"
-    (tramp-login-program        "telnet")
-    (tramp-login-args           (("%h") ("%p") ("2>/dev/null")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("nc"
-    (tramp-login-program        "telnet")
-    (tramp-login-args           (("%h") ("%p") ("2>/dev/null")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-copy-program         "nc")
-    ;; We use "-v" for better error tracking.
-    (tramp-copy-args            (("-w" "1") ("-v") ("%h") ("%r")))
-    (tramp-remote-copy-program  "nc")
-    ;; We use "-p" as required for newer busyboxes.  For older
-    ;; busybox/nc versions, the value must be (("-l") ("%r")).  This
-    ;; can be achieved by tweaking `tramp-connection-properties'.
-    (tramp-remote-copy-args     (("-l") ("-p" "%r") ("2>/dev/null")))))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("su"
-    (tramp-login-program        "su")
-    (tramp-login-args           (("-") ("%u")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-connection-timeout   10)))
-;;;###tramp-autoload
-(add-to-list
- 'tramp-methods
- '("sg"
-   (tramp-login-program        "sg")
-   (tramp-login-args           (("-") ("%u")))
-   (tramp-remote-shell         "/bin/sh")
-   (tramp-remote-shell-args    ("-c"))
-   (tramp-connection-timeout   10)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("sudo"
-    (tramp-login-program        "sudo")
-    ;; The password template must be masked.  Otherwise, it could be
-    ;; interpreted as password prompt if the remote host echoes the command.
-    (tramp-login-args           (("-u" "%u") ("-s") ("-H")
-                                ("-p" 
"P\"\"a\"\"s\"\"s\"\"w\"\"o\"\"r\"\"d\"\":")))
-    ;; Local $SHELL could be a nasty one, like zsh or fish.  Let's override it.
-    (tramp-login-env            (("SHELL") ("/bin/sh")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-connection-timeout   10)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("doas"
-    (tramp-login-program        "doas")
-    (tramp-login-args           (("-u" "%u") ("-s")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-connection-timeout   10)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("ksu"
-    (tramp-login-program        "ksu")
-    (tramp-login-args           (("%u") ("-q")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-connection-timeout   10)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("krlogin"
-    (tramp-login-program        "krlogin")
-    (tramp-login-args           (("%h") ("-l" "%u") ("-x")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  `("plink"
-    (tramp-login-program        "plink")
-    (tramp-login-args           (("-l" "%u") ("-P" "%p") ("-ssh") ("-t")
-                                ("%h") ("\"")
-                                (,(format
-                                   "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
-                                   tramp-terminal-type
-                                   tramp-initial-end-of-output))
-                                ("/bin/sh") ("\"")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  `("plinkx"
-    (tramp-login-program        "plink")
-    (tramp-login-args           (("-load") ("%h") ("-t") ("\"")
-                                (,(format
-                                   "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
-                                   tramp-terminal-type
-                                   tramp-initial-end-of-output))
-                                ("/bin/sh") ("\"")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  `("pscp"
-    (tramp-login-program        "plink")
-    (tramp-login-args           (("-l" "%u") ("-P" "%p") ("-ssh") ("-t")
-                                ("%h") ("\"")
-                                (,(format
-                                   "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
-                                   tramp-terminal-type
-                                   tramp-initial-end-of-output))
-                                ("/bin/sh") ("\"")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-copy-program         "pscp")
-    (tramp-copy-args            (("-l" "%u") ("-P" "%p") ("-scp") ("-p" "%k")
-                                ("-q") ("-r")))
-    (tramp-copy-keep-date       t)
-    (tramp-copy-recursive       t)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  `("psftp"
-    (tramp-login-program        "plink")
-    (tramp-login-args           (("-l" "%u") ("-P" "%p") ("-ssh") ("-t")
-                                ("%h") ("\"")
-                                (,(format
-                                   "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
-                                   tramp-terminal-type
-                                   tramp-initial-end-of-output))
-                                ("/bin/sh") ("\"")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-c"))
-    (tramp-copy-program         "pscp")
-    (tramp-copy-args            (("-l" "%u") ("-P" "%p") ("-sftp") ("-p" "%k")
-                                ("-q")))
-    (tramp-copy-keep-date       t)))
-;;;###tramp-autoload
-(add-to-list 'tramp-methods
-  '("fcp"
-    (tramp-login-program        "fsh")
-    (tramp-login-args           (("%h") ("-l" "%u") ("sh" "-i")))
-    (tramp-remote-shell         "/bin/sh")
-    (tramp-remote-shell-login   ("-l"))
-    (tramp-remote-shell-args    ("-i") ("-c"))
-    (tramp-copy-program         "fcp")
-    (tramp-copy-args            (("-p" "%k")))
-    (tramp-copy-keep-date       t)))
-
-;;;###tramp-autoload
-(add-to-list 'tramp-default-method-alist
-            `(,tramp-local-host-regexp "\\`root\\'" "su"))
-
-;;;###tramp-autoload
-(add-to-list 'tramp-default-user-alist
-            `(,(concat "\\`" (regexp-opt '("su" "sudo" "doas" "ksu")) "\\'")
-              nil "root"))
-;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored.
-;; Do not add "plink" based methods, they ask interactively for the user.
-;;;###tramp-autoload
-(add-to-list 'tramp-default-user-alist
-            `(,(concat
-                "\\`"
-                (regexp-opt
-                 '("rcp" "remcp" "rsh" "telnet" "nc" "krlogin" "fcp"))
-                "\\'")
-              nil ,(user-login-name)))
+(tramp--with-startup
+ (add-to-list 'tramp-methods
+              '("rcp"
+                (tramp-login-program        "rsh")
+                (tramp-login-args           (("%h") ("-l" "%u")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))
+                (tramp-copy-program         "rcp")
+                (tramp-copy-args            (("-p" "%k") ("-r")))
+                (tramp-copy-keep-date       t)
+                (tramp-copy-recursive       t)))
+ (add-to-list 'tramp-methods
+              '("remcp"
+                (tramp-login-program        "remsh")
+                (tramp-login-args           (("%h") ("-l" "%u")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))
+                (tramp-copy-program         "rcp")
+                (tramp-copy-args            (("-p" "%k")))
+                (tramp-copy-keep-date       t)))
+ (add-to-list 'tramp-methods
+              '("scp"
+                (tramp-login-program        "ssh")
+                (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
+                                            ("-e" "none") ("%h")))
+                (tramp-async-args           (("-q")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))
+                (tramp-copy-program         "scp")
+                (tramp-copy-args            (("-P" "%p") ("-p" "%k") ("-q") 
("-r") ("%c")))
+                (tramp-copy-keep-date       t)
+                (tramp-copy-recursive       t)))
+ (add-to-list 'tramp-methods
+              '("scpx"
+                (tramp-login-program        "ssh")
+                (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
+                                            ("-e" "none") ("-t" "-t") ("%h") 
("/bin/sh")))
+                (tramp-async-args           (("-q")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))
+                (tramp-copy-program         "scp")
+                (tramp-copy-args            (("-P" "%p") ("-p" "%k")
+                                            ("-q") ("-r") ("%c")))
+                (tramp-copy-keep-date       t)
+                (tramp-copy-recursive       t)))
+ (add-to-list 'tramp-methods
+              '("rsync"
+                (tramp-login-program        "ssh")
+                (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
+                                            ("-e" "none") ("%h")))
+                (tramp-async-args           (("-q")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))
+                (tramp-copy-program         "rsync")
+                (tramp-copy-args            (("-t" "%k") ("-p") ("-r") ("-s") 
("-c")))
+                (tramp-copy-env             (("RSYNC_RSH") ("ssh" "%c")))
+                (tramp-copy-keep-date       t)
+                (tramp-copy-keep-tmpfile    t)
+                (tramp-copy-recursive       t)))
+ (add-to-list 'tramp-methods
+              '("rsh"
+                (tramp-login-program        "rsh")
+                (tramp-login-args           (("%h") ("-l" "%u")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))))
+ (add-to-list 'tramp-methods
+              '("remsh"
+                (tramp-login-program        "remsh")
+                (tramp-login-args           (("%h") ("-l" "%u")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))))
+ (add-to-list 'tramp-methods
+              '("ssh"
+                (tramp-login-program        "ssh")
+                (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
+                                            ("-e" "none") ("%h")))
+                (tramp-async-args           (("-q")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))))
+ (add-to-list 'tramp-methods
+              '("sshx"
+                (tramp-login-program        "ssh")
+                (tramp-login-args           (("-l" "%u") ("-p" "%p") ("%c")
+                                            ("-e" "none") ("-t" "-t") ("%h") 
("/bin/sh")))
+                (tramp-async-args           (("-q")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))))
+ (add-to-list 'tramp-methods
+              '("telnet"
+                (tramp-login-program        "telnet")
+                (tramp-login-args           (("%h") ("%p") ("2>/dev/null")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))))
+ (add-to-list 'tramp-methods
+              '("nc"
+                (tramp-login-program        "telnet")
+                (tramp-login-args           (("%h") ("%p") ("2>/dev/null")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))
+                (tramp-copy-program         "nc")
+                ;; We use "-v" for better error tracking.
+                (tramp-copy-args            (("-w" "1") ("-v") ("%h") ("%r")))
+                (tramp-remote-copy-program  "nc")
+                ;; We use "-p" as required for newer busyboxes.  For older
+                ;; busybox/nc versions, the value must be (("-l") ("%r")).  
This
+                ;; can be achieved by tweaking `tramp-connection-properties'.
+                (tramp-remote-copy-args     (("-l") ("-p" "%r") 
("2>/dev/null")))))
+ (add-to-list 'tramp-methods
+              '("su"
+                (tramp-login-program        "su")
+                (tramp-login-args           (("-") ("%u")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))
+                (tramp-connection-timeout   10)))
+ (add-to-list 'tramp-methods
+              '("sg"
+                (tramp-login-program        "sg")
+                (tramp-login-args           (("-") ("%u")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-args    ("-c"))
+                (tramp-connection-timeout   10)))
+ (add-to-list 'tramp-methods
+              '("sudo"
+                (tramp-login-program        "sudo")
+                ;; The password template must be masked.  Otherwise, it could 
be
+                ;; interpreted as password prompt if the remote host echoes 
the command.
+                (tramp-login-args           (("-u" "%u") ("-s") ("-H")
+                                            ("-p" 
"P\"\"a\"\"s\"\"s\"\"w\"\"o\"\"r\"\"d\"\":")))
+                ;; Local $SHELL could be a nasty one, like zsh or fish.  Let's 
override it.
+                (tramp-login-env            (("SHELL") ("/bin/sh")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))
+                (tramp-connection-timeout   10)
+                (tramp-session-timeout      300)))
+ (add-to-list 'tramp-methods
+              '("doas"
+                (tramp-login-program        "doas")
+                (tramp-login-args           (("-u" "%u") ("-s")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-args    ("-c"))
+                (tramp-connection-timeout   10)
+                (tramp-session-timeout      300)))
+ (add-to-list 'tramp-methods
+              '("ksu"
+                (tramp-login-program        "ksu")
+                (tramp-login-args           (("%u") ("-q")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))
+                (tramp-connection-timeout   10)))
+ (add-to-list 'tramp-methods
+              '("krlogin"
+                (tramp-login-program        "krlogin")
+                (tramp-login-args           (("%h") ("-l" "%u") ("-x")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))))
+ (add-to-list 'tramp-methods
+              `("plink"
+                (tramp-login-program        "plink")
+                (tramp-login-args           (("-l" "%u") ("-P" "%p") ("-ssh") 
("-t")
+                                            ("%h") ("\"")
+                                            (,(format
+                                               "env 'TERM=%s' 
'PROMPT_COMMAND=' 'PS1=%s'"
+                                               tramp-terminal-type
+                                               tramp-initial-end-of-output))
+                                            ("/bin/sh") ("\"")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))))
+ (add-to-list 'tramp-methods
+              `("plinkx"
+                (tramp-login-program        "plink")
+                (tramp-login-args           (("-load") ("%h") ("-t") ("\"")
+                                            (,(format
+                                               "env 'TERM=%s' 
'PROMPT_COMMAND=' 'PS1=%s'"
+                                               tramp-terminal-type
+                                               tramp-initial-end-of-output))
+                                            ("/bin/sh") ("\"")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))))
+ (add-to-list 'tramp-methods
+              `("pscp"
+                (tramp-login-program        "plink")
+                (tramp-login-args           (("-l" "%u") ("-P" "%p") ("-ssh") 
("-t")
+                                            ("%h") ("\"")
+                                            (,(format
+                                               "env 'TERM=%s' 
'PROMPT_COMMAND=' 'PS1=%s'"
+                                               tramp-terminal-type
+                                               tramp-initial-end-of-output))
+                                            ("/bin/sh") ("\"")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))
+                (tramp-copy-program         "pscp")
+                (tramp-copy-args            (("-l" "%u") ("-P" "%p") ("-scp") 
("-p" "%k")
+                                            ("-q") ("-r")))
+                (tramp-copy-keep-date       t)
+                (tramp-copy-recursive       t)))
+ (add-to-list 'tramp-methods
+              `("psftp"
+                (tramp-login-program        "plink")
+                (tramp-login-args           (("-l" "%u") ("-P" "%p") ("-ssh") 
("-t")
+                                            ("%h") ("\"")
+                                            (,(format
+                                               "env 'TERM=%s' 
'PROMPT_COMMAND=' 'PS1=%s'"
+                                               tramp-terminal-type
+                                               tramp-initial-end-of-output))
+                                            ("/bin/sh") ("\"")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-c"))
+                (tramp-copy-program         "pscp")
+                (tramp-copy-args            (("-l" "%u") ("-P" "%p") ("-sftp") 
("-p" "%k")
+                                            ("-q")))
+                (tramp-copy-keep-date       t)))
+ (add-to-list 'tramp-methods
+              '("fcp"
+                (tramp-login-program        "fsh")
+                (tramp-login-args           (("%h") ("-l" "%u") ("sh" "-i")))
+                (tramp-remote-shell         "/bin/sh")
+                (tramp-remote-shell-login   ("-l"))
+                (tramp-remote-shell-args    ("-i") ("-c"))
+                (tramp-copy-program         "fcp")
+                (tramp-copy-args            (("-p" "%k")))
+                (tramp-copy-keep-date       t)))
+
+ (add-to-list 'tramp-default-method-alist
+             `(,tramp-local-host-regexp "\\`root\\'" "su"))
+
+ (add-to-list 'tramp-default-user-alist
+             `(,(concat "\\`" (regexp-opt '("su" "sudo" "doas" "ksu")) "\\'")
+               nil "root"))
+ ;; Do not add "ssh" based methods, otherwise ~/.ssh/config would be ignored.
+ ;; Do not add "plink" based methods, they ask interactively for the user.
+ (add-to-list 'tramp-default-user-alist
+             `(,(concat
+                 "\\`"
+                 (regexp-opt
+                  '("rcp" "remcp" "rsh" "telnet" "nc" "krlogin" "fcp"))
+                 "\\'")
+               nil ,(user-login-name))))
 
 ;;;###tramp-autoload
 (defconst tramp-completion-function-alist-rsh
@@ -459,33 +432,32 @@ The string is used in `tramp-methods'.")
  "Default list of (FUNCTION REGISTRY) pairs to be examined for putty 
sessions.")
 
 ;;;###tramp-autoload
-(eval-after-load 'tramp
-  '(progn
-     (tramp-set-completion-function "rcp" tramp-completion-function-alist-rsh)
-     (tramp-set-completion-function "remcp" 
tramp-completion-function-alist-rsh)
-     (tramp-set-completion-function "scp" tramp-completion-function-alist-ssh)
-     (tramp-set-completion-function "scpx" tramp-completion-function-alist-ssh)
-     (tramp-set-completion-function "rsync" 
tramp-completion-function-alist-ssh)
-     (tramp-set-completion-function "rsh" tramp-completion-function-alist-rsh)
-     (tramp-set-completion-function "remsh" 
tramp-completion-function-alist-rsh)
-     (tramp-set-completion-function "ssh" tramp-completion-function-alist-ssh)
-     (tramp-set-completion-function "sshx" tramp-completion-function-alist-ssh)
-     (tramp-set-completion-function
-      "telnet" tramp-completion-function-alist-telnet)
-     (tramp-set-completion-function "nc" 
tramp-completion-function-alist-telnet)
-     (tramp-set-completion-function "su" tramp-completion-function-alist-su)
-     (tramp-set-completion-function "sudo" tramp-completion-function-alist-su)
-     (tramp-set-completion-function "doas" tramp-completion-function-alist-su)
-     (tramp-set-completion-function "ksu" tramp-completion-function-alist-su)
-     (tramp-set-completion-function "sg" tramp-completion-function-alist-sg)
-     (tramp-set-completion-function
-      "krlogin" tramp-completion-function-alist-rsh)
-     (tramp-set-completion-function "plink" 
tramp-completion-function-alist-ssh)
-     (tramp-set-completion-function
-      "plinkx" tramp-completion-function-alist-putty)
-     (tramp-set-completion-function "pscp" tramp-completion-function-alist-ssh)
-     (tramp-set-completion-function "psftp" 
tramp-completion-function-alist-ssh)
-     (tramp-set-completion-function "fcp" 
tramp-completion-function-alist-ssh)))
+(tramp--with-startup
+ (tramp-set-completion-function "rcp" tramp-completion-function-alist-rsh)
+ (tramp-set-completion-function "remcp" tramp-completion-function-alist-rsh)
+ (tramp-set-completion-function "scp" tramp-completion-function-alist-ssh)
+ (tramp-set-completion-function "scpx" tramp-completion-function-alist-ssh)
+ (tramp-set-completion-function "rsync" tramp-completion-function-alist-ssh)
+ (tramp-set-completion-function "rsh" tramp-completion-function-alist-rsh)
+ (tramp-set-completion-function "remsh" tramp-completion-function-alist-rsh)
+ (tramp-set-completion-function "ssh" tramp-completion-function-alist-ssh)
+ (tramp-set-completion-function "sshx" tramp-completion-function-alist-ssh)
+ (tramp-set-completion-function
+  "telnet" tramp-completion-function-alist-telnet)
+ (tramp-set-completion-function "nc" tramp-completion-function-alist-telnet)
+ (tramp-set-completion-function "su" tramp-completion-function-alist-su)
+ (tramp-set-completion-function "sudo" tramp-completion-function-alist-su)
+ (tramp-set-completion-function "doas" tramp-completion-function-alist-su)
+ (tramp-set-completion-function "ksu" tramp-completion-function-alist-su)
+ (tramp-set-completion-function "sg" tramp-completion-function-alist-sg)
+ (tramp-set-completion-function
+  "krlogin" tramp-completion-function-alist-rsh)
+ (tramp-set-completion-function "plink" tramp-completion-function-alist-ssh)
+ (tramp-set-completion-function
+  "plinkx" tramp-completion-function-alist-putty)
+ (tramp-set-completion-function "pscp" tramp-completion-function-alist-ssh)
+ (tramp-set-completion-function "psftp" tramp-completion-function-alist-ssh)
+ (tramp-set-completion-function "fcp" tramp-completion-function-alist-ssh))
 
 ;; "getconf PATH" yields:
 ;; HP-UX: 
/usr/bin:/usr/ccs/bin:/opt/ansic/bin:/opt/langtools/bin:/opt/fortran/bin
@@ -789,7 +761,7 @@ on the remote host.")
 (defconst tramp-perl-encode
   "%s -e '
 # This script contributed by Juanma Barranquero <address@hidden>.
-# Copyright (C) 2002-2018 Free Software Foundation, Inc.
+# Copyright (C) 2002-2019 Free Software Foundation, Inc.
 use strict;
 
 my %%trans = do {
@@ -827,7 +799,7 @@ This string is passed to `format', so percent characters 
need to be doubled.")
 (defconst tramp-perl-decode
   "%s -e '
 # This script contributed by Juanma Barranquero <address@hidden>.
-# Copyright (C) 2002-2018 Free Software Foundation, Inc.
+# Copyright (C) 2002-2019 Free Software Foundation, Inc.
 use strict;
 
 my %%trans = do {
@@ -944,12 +916,6 @@ od -v -t x1 -A n </dev/null && \
 busybox awk '{}' </dev/null"
   "Test command for checking `tramp-awk-encode' and `tramp-awk-decode'.")
 
-(defconst tramp-stat-marker "/////"
-  "Marker in stat commands for file attributes.")
-
-(defconst tramp-stat-quoted-marker "\\/\\/\\/\\/\\/"
-  "Quoted marker in stat commands for file attributes.")
-
 (defconst tramp-vc-registered-read-file-names
   "echo \"(\"
 while read file; do
@@ -975,7 +941,7 @@ of command line.")
 ;; New handlers should be added here.
 ;;;###tramp-autoload
 (defconst tramp-sh-file-name-handler-alist
-  '(;; `access-file' performed by default handler.
+  '((access-file . tramp-handle-access-file)
     (add-name-to-file . tramp-sh-handle-add-name-to-file)
     ;; `byte-compiler-base-file-name' performed by default handler.
     (copy-directory . tramp-sh-handle-copy-directory)
@@ -1022,7 +988,6 @@ of command line.")
     (file-truename . tramp-sh-handle-file-truename)
     (file-writable-p . tramp-sh-handle-file-writable-p)
     (find-backup-file-name . tramp-handle-find-backup-file-name)
-    ;; `find-file-noselect' performed by default handler.
     ;; `get-file-buffer' performed by default handler.
     (insert-directory . tramp-sh-handle-insert-directory)
     (insert-file-contents . tramp-handle-insert-file-contents)
@@ -1031,6 +996,7 @@ of command line.")
     (make-directory . tramp-sh-handle-make-directory)
     ;; `make-directory-internal' performed by default handler.
     (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
+    (make-process . tramp-sh-handle-make-process)
     (make-symbolic-link . tramp-sh-handle-make-symbolic-link)
     (process-file . tramp-sh-handle-process-file)
     (rename-file . tramp-sh-handle-rename-file)
@@ -1040,9 +1006,10 @@ of command line.")
     (set-file-times . tramp-sh-handle-set-file-times)
     (set-visited-file-modtime . tramp-sh-handle-set-visited-file-modtime)
     (shell-command . tramp-handle-shell-command)
-    (start-file-process . tramp-sh-handle-start-file-process)
+    (start-file-process . tramp-handle-start-file-process)
     (substitute-in-file-name . tramp-handle-substitute-in-file-name)
     (temporary-file-directory . tramp-handle-temporary-file-directory)
+    (tramp-set-file-uid-gid . tramp-sh-handle-set-file-uid-gid)
     (unhandled-file-name-directory . ignore)
     (vc-registered . tramp-sh-handle-vc-registered)
     (verify-visited-file-modtime . tramp-sh-handle-verify-visited-file-modtime)
@@ -1060,7 +1027,7 @@ of the symlink.  If TARGET is a Tramp file, only the 
localname
 component is used as the target of the symlink."
   (if (not (tramp-tramp-file-p (expand-file-name linkname)))
       (tramp-run-real-handler
-       'make-symbolic-link (list target linkname ok-if-already-exists))
+       #'make-symbolic-link (list target linkname ok-if-already-exists))
 
     (with-parsed-tramp-file-name linkname nil
       ;; If TARGET is a Tramp name, use just the localname component.
@@ -1078,7 +1045,7 @@ component is used as the target of the symlink."
 
        (let ((ln (tramp-get-remote-ln v))
              (cwd (tramp-run-real-handler
-                   'file-name-directory (list localname))))
+                   #'file-name-directory (list localname))))
          (unless ln
            (tramp-error
             v 'file-error
@@ -1122,7 +1089,7 @@ component is used as the target of the symlink."
    ;; Preserve trailing "/".
   (funcall
    (if (string-equal (file-name-nondirectory filename) "")
-       'file-name-as-directory 'identity)
+       #'file-name-as-directory #'identity)
    (with-parsed-tramp-file-name (expand-file-name filename) nil
      (tramp-make-tramp-file-name
       v
@@ -1170,7 +1137,7 @@ component is used as the target of the symlink."
                  (setq thisstep (pop steps))
                  (tramp-message
                   v 5 "Check %s"
-                  (mapconcat 'identity
+                  (mapconcat #'identity
                              (append '("") (reverse result) (list thisstep))
                              "/"))
                  (setq symlink-target
@@ -1178,7 +1145,7 @@ component is used as the target of the symlink."
                         (file-attributes
                          (tramp-make-tramp-file-name
                           v
-                          (mapconcat 'identity
+                          (mapconcat #'identity
                                      (append '("")
                                              (reverse result)
                                              (list thisstep))
@@ -1210,7 +1177,7 @@ component is used as the target of the symlink."
                ;; Combine list to form string.
                (setq result
                      (if result
-                         (mapconcat 'identity (cons "" result) "/")
+                         (mapconcat #'identity (cons "" result) "/")
                        "/"))
                (when (string= "" result)
                  (setq result "/")))))
@@ -1256,18 +1223,17 @@ component is used as the target of the symlink."
       (with-parsed-tramp-file-name (expand-file-name filename) nil
        (with-tramp-file-property
            v localname (format "file-attributes-%s" id-format)
-         (save-excursion
-           (tramp-convert-file-attributes
-            v
-            (or
-             (cond
-              ((tramp-get-remote-stat v)
-               (tramp-do-file-attributes-with-stat v localname id-format))
-              ((tramp-get-remote-perl v)
-               (tramp-do-file-attributes-with-perl v localname id-format))
-              (t nil))
-             ;; The scripts could fail, for example with huge file size.
-             (tramp-do-file-attributes-with-ls v localname id-format)))))))))
+         (tramp-convert-file-attributes
+          v
+          (or
+           (cond
+            ((tramp-get-remote-stat v)
+             (tramp-do-file-attributes-with-stat v localname id-format))
+            ((tramp-get-remote-perl v)
+             (tramp-do-file-attributes-with-perl v localname id-format))
+            (t nil))
+           ;; The scripts could fail, for example with huge file size.
+           (tramp-do-file-attributes-with-ls v localname id-format))))))))
 
 (defun tramp-sh--quoting-style-options (vec)
   (or
@@ -1334,7 +1300,7 @@ component is used as the target of the symlink."
           (when symlinkp
             (search-forward "-> ")
             (setq res-symlink-target
-                  (if (looking-at "\"")
+                  (if (looking-at-p "\"")
                       (read (current-buffer))
                     (buffer-substring (point) (point-at-eol)))))
           ;; Return data gathered.
@@ -1382,15 +1348,16 @@ component is used as the target of the symlink."
   (tramp-send-command-and-read
    vec
    (format
-    (concat
-     ;; On Opsware, pdksh (which is the true name of ksh there)
-     ;; doesn't parse correctly the sequence "((".  Therefore, we add
-     ;; a space.  Apostrophes in the stat output are masked as
-     ;; `tramp-stat-marker', in order to make a proper shell escape of
-     ;; them in file names.
-     "( (%s %s || %s -h %s) && (%s -c "
-     "'((%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' "
-     "%s | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g') || echo nil)")
+    (eval-when-compile
+      (concat
+       ;; On Opsware, pdksh (which is the true name of ksh there)
+       ;; doesn't parse correctly the sequence "((".  Therefore, we
+       ;; add a space.  Apostrophes in the stat output are masked as
+       ;; `tramp-stat-marker', in order to make a proper shell escape
+       ;; of them in file names.
+       "( (%s %s || %s -h %s) && (%s -c "
+       "'((%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' "
+       "%s | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g') || echo nil)"))
     (tramp-get-file-exists-command vec)
     (tramp-shell-quote-argument localname)
     (tramp-get-test-command vec)
@@ -1398,9 +1365,11 @@ component is used as the target of the symlink."
     (tramp-get-remote-stat vec)
     tramp-stat-marker tramp-stat-marker
     (if (eq id-format 'integer)
-       "%u" (concat tramp-stat-marker "%U" tramp-stat-marker))
+       "%u"
+      (eval-when-compile (concat tramp-stat-marker "%U" tramp-stat-marker)))
     (if (eq id-format 'integer)
-       "%g" (concat tramp-stat-marker "%G" tramp-stat-marker))
+       "%g"
+      (eval-when-compile (concat tramp-stat-marker "%G" tramp-stat-marker)))
     tramp-stat-marker tramp-stat-marker
     (tramp-shell-quote-argument localname)
     tramp-stat-quoted-marker)))
@@ -1411,7 +1380,7 @@ component is used as the target of the symlink."
     (error "Can't set-visited-file-modtime: buffer `%s' not visiting a file"
           (buffer-name)))
   (if time-list
-      (tramp-run-real-handler 'set-visited-file-modtime (list time-list))
+      (tramp-run-real-handler #'set-visited-file-modtime (list time-list))
     (let ((f (buffer-file-name))
          coding-system-used)
       (with-parsed-tramp-file-name f nil
@@ -1421,7 +1390,7 @@ component is used as the target of the symlink."
                            tramp-time-doesnt-exist)))
          (setq coding-system-used last-coding-system-used)
          (if (not (tramp-compat-time-equal-p modtime tramp-time-dont-know))
-             (tramp-run-real-handler 'set-visited-file-modtime (list modtime))
+             (tramp-run-real-handler #'set-visited-file-modtime (list modtime))
            (progn
              (tramp-send-command
               v
@@ -1513,39 +1482,26 @@ of."
              "")
            (tramp-shell-quote-argument localname)))))))
 
-(defun tramp-set-file-uid-gid (filename &optional uid gid)
-  "Set the ownership for FILENAME.
-If UID and GID are provided, these values are used; otherwise uid
-and gid of the corresponding user is taken.  Both parameters must
-be non-negative integers."
+(defun tramp-sh-handle-set-file-uid-gid (filename &optional uid gid)
+  "Like `tramp-set-file-uid-gid' for Tramp files."
   ;; Modern Unices allow chown only for root.  So we might need
   ;; another implementation, see `dired-do-chown'.  OTOH, it is mostly
   ;; working with su(do)? when it is needed, so it shall succeed in
   ;; the majority of cases.
   ;; Don't modify `last-coding-system-used' by accident.
   (let ((last-coding-system-used last-coding-system-used))
-    (if (tramp-tramp-file-p filename)
-       (with-parsed-tramp-file-name filename nil
-         (if (and (zerop (user-uid)) (tramp-local-host-p v))
-             ;; If we are root on the local host, we can do it directly.
-             (tramp-set-file-uid-gid localname uid gid)
-           (let ((uid (or (and (natnump uid) uid)
-                          (tramp-get-remote-uid v 'integer)))
-                 (gid (or (and (natnump gid) gid)
-                          (tramp-get-remote-gid v 'integer))))
-             (tramp-send-command
-              v (format
-                 "chown %d:%d %s" uid gid
-                 (tramp-shell-quote-argument localname))))))
-
-      ;; We handle also the local part, because there doesn't exist
-      ;; `set-file-uid-gid'.  On W32 "chown" does not work.
-      (unless (memq system-type '(ms-dos windows-nt))
-       (let ((uid (or (and (natnump uid) uid) (tramp-get-local-uid 'integer)))
-             (gid (or (and (natnump gid) gid) (tramp-get-local-gid 'integer))))
-         (tramp-call-process
-          nil "chown" nil nil nil
-          (format "%d:%d" uid gid) (shell-quote-argument filename)))))))
+    (with-parsed-tramp-file-name filename nil
+      (if (and (zerop (user-uid)) (tramp-local-host-p v))
+         ;; If we are root on the local host, we can do it directly.
+         (tramp-set-file-uid-gid localname uid gid)
+       (let ((uid (or (and (natnump uid) uid)
+                      (tramp-get-remote-uid v 'integer)))
+             (gid (or (and (natnump gid) gid)
+                      (tramp-get-remote-gid v 'integer))))
+         (tramp-send-command
+          v (format
+             "chown %d:%d %s" uid gid
+             (tramp-shell-quote-argument localname))))))))
 
 (defun tramp-remote-selinux-p (vec)
   "Check, whether SELINUX is enabled on the remote host."
@@ -1557,8 +1513,9 @@ be non-negative integers."
   (with-parsed-tramp-file-name filename nil
     (with-tramp-file-property v localname "file-selinux-context"
       (let ((context '(nil nil nil nil))
-           (regexp (concat "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\):"
-                           "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\)")))
+           (regexp (eval-when-compile
+                     (concat "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\):"
+                             "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\)"))))
        (when (and (tramp-remote-selinux-p v)
                   (tramp-send-command-and-check
                    v (format
@@ -1662,16 +1619,12 @@ be non-negative integers."
 ;; something smarter about it.
 (defun tramp-sh-handle-file-newer-than-file-p (file1 file2)
   "Like `file-newer-than-file-p' for Tramp files."
-  (cond ((not (file-exists-p file1))
-         nil)
-        ((not (file-exists-p file2))
-         t)
-        ;; We are sure both files exist at this point.
-        (t
-         (save-excursion
-          ;; We try to get the mtime of both files.  If they are not
-          ;; equal to the "dont-know" value, then we subtract the times
-          ;; and obtain the result.
+  (cond ((not (file-exists-p file1)) nil)
+        ((not (file-exists-p file2)) t)
+        (t ;; We are sure both files exist at this point.  We try to
+           ;; get the mtime of both files.  If they are not equal to
+           ;; the "dont-know" value, then we subtract the times and
+           ;; obtain the result.
           (let ((fa1 (file-attributes file1))
                 (fa2 (file-attributes file2)))
             (if (and
@@ -1683,9 +1636,9 @@ be non-negative integers."
                   (tramp-compat-time-equal-p
                    (tramp-compat-file-attribute-modification-time fa2)
                    tramp-time-dont-know)))
-                (> 0 (tramp-time-diff
-                      (tramp-compat-file-attribute-modification-time fa2)
-                      (tramp-compat-file-attribute-modification-time fa1)))
+                (time-less-p
+                 (tramp-compat-file-attribute-modification-time fa2)
+                 (tramp-compat-file-attribute-modification-time fa1))
               ;; If one of them is the dont-know value, then we can
               ;; still try to run a shell command on the remote host.
               ;; However, this only works if both files are Tramp
@@ -1700,7 +1653,7 @@ be non-negative integers."
                    file1 file2)))
               (with-parsed-tramp-file-name file1 nil
                 (tramp-run-test2
-                 (tramp-get-test-nt-command v) file1 file2))))))))
+                 (tramp-get-test-nt-command v) file1 file2)))))))
 
 ;; Functions implemented using the basic functions above.
 
@@ -1757,25 +1710,22 @@ be non-negative integers."
               (with-tramp-file-property
                   v localname
                   (format "directory-files-and-attributes-%s" id-format)
-                (save-excursion
-                  (mapcar
-                   (lambda (x)
-                     (cons (car x)
-                           (tramp-convert-file-attributes v (cdr x))))
-                   (or
-                    (cond
-                     ((tramp-get-remote-stat v)
-                      (tramp-do-directory-files-and-attributes-with-stat
-                       v localname id-format))
-                     ((tramp-get-remote-perl v)
-                      (tramp-do-directory-files-and-attributes-with-perl
-                       v localname id-format))
-                     (t nil)))))))))
+                (mapcar
+                 (lambda (x)
+                   (cons (car x) (tramp-convert-file-attributes v (cdr x))))
+                 (cond
+                  ((tramp-get-remote-stat v)
+                   (tramp-do-directory-files-and-attributes-with-stat
+                    v localname id-format))
+                  ((tramp-get-remote-perl v)
+                   (tramp-do-directory-files-and-attributes-with-perl
+                    v localname id-format))
+                  (t nil)))))))
           result item)
 
       (while temp
        (setq item (pop temp))
-       (when (or (null match) (string-match match (car item)))
+       (when (or (null match) (string-match-p match (car item)))
          (when full
            (setcar item (expand-file-name (car item) directory)))
          (push item result)))
@@ -1809,16 +1759,18 @@ be non-negative integers."
   (tramp-send-command-and-read
    vec
    (format
-    (concat
-     ;; We must care about file names with spaces, or starting with
-     ;; "-"; this would confuse xargs.  "ls -aQ" might be a solution,
-     ;; but it does not work on all remote systems.  Apostrophes in
-     ;; the stat output are masked as `tramp-stat-marker', in order to
-     ;; make a proper shell escape of them in file names.
-     "cd %s && echo \"(\"; (%s %s -a | "
-     "xargs %s -c "
-     "'(%s%%n%s (%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' "
-     "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\"")
+    (eval-when-compile
+      (concat
+       ;; We must care about file names with spaces, or starting with
+       ;; "-"; this would confuse xargs.  "ls -aQ" might be a
+       ;; solution, but it does not work on all remote systems.
+       ;; Apostrophes in the stat output are masked as
+       ;; `tramp-stat-marker', in order to make a proper shell escape
+       ;; of them in file names.
+       "cd %s && echo \"(\"; (%s %s -a | "
+       "xargs %s -c "
+       "'(%s%%n%s (%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)' "
+       "-- 2>/dev/null | sed -e 's/\"/\\\\\"/g' -e 's/%s/\"/g'); echo \")\""))
     (tramp-shell-quote-argument localname)
     (tramp-get-ls-command vec)
     ;; On systems which have no quoting style, file names with special
@@ -1828,9 +1780,11 @@ be non-negative integers."
     tramp-stat-marker tramp-stat-marker
     tramp-stat-marker tramp-stat-marker
     (if (eq id-format 'integer)
-       "%u" (concat tramp-stat-marker "%U" tramp-stat-marker))
+       "%u"
+      (eval-when-compile (concat tramp-stat-marker "%U" tramp-stat-marker)))
     (if (eq id-format 'integer)
-       "%g" (concat tramp-stat-marker "%G" tramp-stat-marker))
+       "%g"
+      (eval-when-compile (concat tramp-stat-marker "%G" tramp-stat-marker)))
     tramp-stat-marker tramp-stat-marker
     tramp-stat-quoted-marker)))
 
@@ -1838,7 +1792,7 @@ be non-negative integers."
 ;; files.
 (defun tramp-sh-handle-file-name-all-completions (filename directory)
   "Like `file-name-all-completions' for Tramp files."
-  (unless (save-match-data (string-match "/" filename))
+  (unless (string-match-p "/" filename)
     (all-completions
      filename
      (with-parsed-tramp-file-name (expand-file-name directory) nil
@@ -1857,12 +1811,13 @@ be non-negative integers."
                  (format "tramp_perl_file_name_all_completions %s"
                          (tramp-shell-quote-argument localname)))
 
-             (format (concat
-                      "(cd %s 2>&1 && %s -a 2>/dev/null"
-                      " | while IFS= read f; do"
-                      " if %s -d \"$f\" 2>/dev/null;"
-                      " then \\echo \"$f/\"; else \\echo \"$f\"; fi; done"
-                      " && \\echo ok) || \\echo fail")
+             (format (eval-when-compile
+                       (concat
+                        "(cd %s 2>&1 && %s -a 2>/dev/null"
+                        " | while IFS= read f; do"
+                        " if %s -d \"$f\" 2>/dev/null;"
+                        " then \\echo \"$f/\"; else \\echo \"$f\"; fi; done"
+                        " && \\echo ok) || \\echo fail"))
                      (tramp-shell-quote-argument localname)
                      (tramp-get-ls-command v)
                      (tramp-get-test-command v))))
@@ -1873,7 +1828,7 @@ be non-negative integers."
 
             ;; Check result code, found in last line of output.
             (forward-line -1)
-            (if (looking-at "^fail$")
+            (if (looking-at-p "^fail$")
                 (progn
                   ;; Grab error message from line before last line
                   ;; (it was put there by `cd 2>&1').
@@ -1886,7 +1841,7 @@ be non-negative integers."
               ;; then it should end in `ok'.  If neither are in the
               ;; buffer something went seriously wrong on the remote
               ;; side.
-              (unless (looking-at "^ok$")
+              (unless (looking-at-p "^ok$")
                 (tramp-error
                  v 'file-error "\
 tramp-sh-handle-file-name-all-completions: internal error accessing `%s': `%s'"
@@ -1977,7 +1932,7 @@ tramp-sh-handle-file-name-all-completions: internal error 
accessing `%s': `%s'"
              (setq newname
                    (expand-file-name
                     (file-name-nondirectory dirname) newname)))
-           (when (not (file-directory-p (file-name-directory newname)))
+           (unless (file-directory-p (file-name-directory newname))
                (make-directory (file-name-directory newname) parents))
            (tramp-do-copy-or-rename-file-out-of-band
             'copy dirname newname keep-date))
@@ -2007,7 +1962,7 @@ tramp-sh-handle-file-name-all-completions: internal error 
accessing `%s': `%s'"
        'rename filename newname ok-if-already-exists
        'keep-time 'preserve-uid-gid)
     (tramp-run-real-handler
-     'rename-file (list filename newname ok-if-already-exists))))
+     #'rename-file (list filename newname ok-if-already-exists))))
 
 (defun tramp-do-copy-or-rename-file
   (op filename newname &optional ok-if-already-exists keep-date
@@ -2042,7 +1997,7 @@ file names."
                   (file-attributes (file-truename filename))))
          ;; `file-extended-attributes' exists since Emacs 24.4.
          (attributes (and preserve-extended-attributes
-                          (apply 'file-extended-attributes (list filename)))))
+                          (apply #'file-extended-attributes (list filename)))))
 
       (with-parsed-tramp-file-name (if t1 filename newname) nil
        (when (and (not ok-if-already-exists) (file-exists-p newname))
@@ -2112,9 +2067,10 @@ file names."
 
          ;; Handle `preserve-extended-attributes'.  We ignore possible
          ;; errors, because ACL strings could be incompatible.
+         ;; `set-file-extended-attributes' exists since Emacs 24.4.
          (when attributes
            (ignore-errors
-             (apply 'set-file-extended-attributes (list newname attributes))))
+             (apply #'set-file-extended-attributes (list newname attributes))))
 
          ;; In case of `rename', we must flush the cache of the source file.
          (when (and t1 (eq op 'rename))
@@ -2190,8 +2146,8 @@ the uid and gid from FILENAME."
                            v 'file-error
                            "Unknown operation `%s', must be `copy' or `rename'"
                            op))))
-            (localname1 (if t1 (file-remote-p filename 'localname) filename))
-            (localname2 (if t2 (file-remote-p newname 'localname) newname))
+            (localname1 (tramp-compat-file-local-name filename))
+            (localname2 (tramp-compat-file-local-name newname))
             (prefix (file-remote-p (if t1 filename newname)))
              cmd-result)
        (when (and (eq op 'copy) (file-directory-p filename))
@@ -2229,8 +2185,7 @@ the uid and gid from FILENAME."
                   (or (eq op 'copy)
                       (zerop
                        (logand
-                        (file-modes (file-name-directory localname1))
-                        (string-to-number "1000" 8))))
+                        (file-modes (file-name-directory localname1)) #o1000)))
                   (file-writable-p (file-name-directory localname2))
                   (or (file-directory-p localname2)
                       (file-writable-p localname2))))
@@ -2239,7 +2194,8 @@ the uid and gid from FILENAME."
                 localname1 localname2 ok-if-already-exists
                 keep-date preserve-uid-gid)
              (tramp-run-real-handler
-              'rename-file (list localname1 localname2 ok-if-already-exists))))
+              #'rename-file
+              (list localname1 localname2 ok-if-already-exists))))
 
           ;; We can do it directly with `tramp-send-command'
           ((and (file-readable-p (concat prefix localname1))
@@ -2274,8 +2230,7 @@ the uid and gid from FILENAME."
                      ;; We must change the ownership as remote user.
                      ;; Since this does not work reliable, we also
                      ;; give read permissions.
-                     (set-file-modes
-                      (concat prefix tmpfile) (string-to-number "0777" 8))
+                     (set-file-modes (concat prefix tmpfile) #o0777)
                      (tramp-set-file-uid-gid
                       (concat prefix tmpfile)
                       (tramp-get-local-uid 'integer)
@@ -2285,11 +2240,11 @@ the uid and gid from FILENAME."
                          (copy-file
                           localname1 tmpfile t keep-date preserve-uid-gid)
                        (tramp-run-real-handler
-                        'rename-file (list localname1 tmpfile t)))
+                        #'rename-file (list localname1 tmpfile t)))
                      ;; We must change the ownership as local user.
                      ;; Since this does not work reliable, we also
                      ;; give read permissions.
-                     (set-file-modes tmpfile (string-to-number "0777" 8))
+                     (set-file-modes tmpfile #o0777)
                      (tramp-set-file-uid-gid
                       tmpfile
                       (tramp-get-remote-uid v 'integer)
@@ -2307,7 +2262,7 @@ the uid and gid from FILENAME."
                       (tramp-get-buffer v)))
                     (t1
                      (tramp-run-real-handler
-                      'rename-file
+                      #'rename-file
                       (list tmpfile localname2 ok-if-already-exists)))))
 
                ;; Save exit.
@@ -2356,8 +2311,8 @@ The method used must be an out-of-band method."
        (setq source (funcall
                      (if (and (file-directory-p filename)
                               (not (file-exists-p newname)))
-                         'file-name-as-directory
-                       'identity)
+                         #'file-name-as-directory
+                       #'identity)
                      (if t1
                          (tramp-make-copy-program-file-name v)
                        (tramp-unquote-shell-quote-argument filename)))
@@ -2411,7 +2366,7 @@ The method used must be an out-of-band method."
               (mapcar
                (lambda (x)
                  (setq x (mapcar (lambda (y) (format-spec y spec)) x))
-                 (unless (member "" x) (mapconcat 'identity x " ")))
+                 (unless (member "" x) (mapconcat #'identity x " ")))
                (tramp-get-method-parameter v 'tramp-copy-env)))
 
              remote-copy-program
@@ -2441,7 +2396,7 @@ The method used must be an out-of-band method."
             "Cannot find remote listener: %s" remote-copy-program))
          (setq remote-copy-program
                (mapconcat
-                'identity
+                #'identity
                 (append
                  (list remote-copy-program) remote-copy-args
                  (list (if t1 (concat "<" source) (concat ">" target)) "&"))
@@ -2487,7 +2442,7 @@ The method used must be an out-of-band method."
                ;; copying of large files can last longer than 60 secs.
                (let* ((command
                        (mapconcat
-                        'identity (append (list copy-program) copy-args)
+                        #'identity (append (list copy-program) copy-args)
                         " "))
                       (p (let ((default-directory
                                  (tramp-compat-temporary-file-directory)))
@@ -2497,7 +2452,7 @@ The method used must be an out-of-band method."
                             command))))
                  (tramp-message orig-vec 6 "%s" command)
                  (process-put p 'vector orig-vec)
-                 (process-put p 'adjust-window-size-function 'ignore)
+                 (process-put p 'adjust-window-size-function #'ignore)
                  (set-process-query-on-exit-flag p nil)
 
                  ;; We must adapt `tramp-local-end-of-line' for
@@ -2544,12 +2499,11 @@ The method used must be an out-of-band method."
     ;; whole cache.
     (tramp-flush-directory-properties
      v (if parents "/" (file-name-directory localname)))
-    (save-excursion
-      (tramp-barf-unless-okay
-       v (format "%s %s"
-                (if parents "mkdir -p" "mkdir")
-                (tramp-shell-quote-argument localname))
-       "Couldn't make directory %s" dir))))
+    (tramp-barf-unless-okay
+     v (format "%s %s"
+              (if parents "mkdir -p" "mkdir")
+              (tramp-shell-quote-argument localname))
+     "Couldn't make directory %s" dir)))
 
 (defun tramp-sh-handle-delete-directory (directory &optional recursive trash)
   "Like `delete-directory' for Tramp files."
@@ -2583,47 +2537,48 @@ The method used must be an out-of-band method."
   ;; Code stolen mainly from dired-aux.el.
   (with-parsed-tramp-file-name file nil
     (tramp-flush-file-properties v localname)
-    (save-excursion
-      (let ((suffixes dired-compress-file-suffixes)
-           suffix)
-       ;; See if any suffix rule matches this file name.
-       (while suffixes
-         (let (case-fold-search)
-           (if (string-match (car (car suffixes)) localname)
-               (setq suffix (car suffixes) suffixes nil))
-           (setq suffixes (cdr suffixes))))
-
-       (cond ((file-symlink-p file)
-              nil)
-             ((and suffix (nth 2 suffix))
-              ;; We found an uncompression rule.
-              (with-tramp-progress-reporter
-                   v 0 (format "Uncompressing %s" file)
-                (when (tramp-send-command-and-check
-                       v (concat (nth 2 suffix) " "
-                                 (tramp-shell-quote-argument localname)))
-                  (dired-remove-file file)
-                  (string-match (car suffix) file)
-                  (concat (substring file 0 (match-beginning 0))))))
-             (t
-              ;; We don't recognize the file as compressed, so compress it.
-              ;; Try gzip.
-              (with-tramp-progress-reporter v 0 (format "Compressing %s" file)
-                (when (tramp-send-command-and-check
-                       v (concat "gzip -f "
-                                 (tramp-shell-quote-argument localname)))
-                  (dired-remove-file file)
-                  (cond ((file-exists-p (concat file ".gz"))
-                         (concat file ".gz"))
-                        ((file-exists-p (concat file ".z"))
-                         (concat file ".z"))
-                        (t nil))))))))))
+    (let ((suffixes dired-compress-file-suffixes)
+         suffix)
+      ;; See if any suffix rule matches this file name.
+      (while suffixes
+       (let (case-fold-search)
+         (if (string-match-p (car (car suffixes)) localname)
+             (setq suffix (car suffixes) suffixes nil))
+         (setq suffixes (cdr suffixes))))
+
+      (cond ((file-symlink-p file) nil)
+           ((and suffix (nth 2 suffix))
+            ;; We found an uncompression rule.
+            (with-tramp-progress-reporter
+                 v 0 (format "Uncompressing %s" file)
+              (when (tramp-send-command-and-check
+                     v (concat (nth 2 suffix) " "
+                               (tramp-shell-quote-argument localname)))
+                (dired-remove-file file)
+                (string-match (car suffix) file)
+                (concat (substring file 0 (match-beginning 0))))))
+           (t
+            ;; We don't recognize the file as compressed, so compress it.
+            ;; Try gzip.
+            (with-tramp-progress-reporter v 0 (format "Compressing %s" file)
+              (when (tramp-send-command-and-check
+                     v (concat "gzip -f "
+                               (tramp-shell-quote-argument localname)))
+                (dired-remove-file file)
+                (cond ((file-exists-p (concat file ".gz"))
+                       (concat file ".gz"))
+                      ((file-exists-p (concat file ".z"))
+                       (concat file ".z"))
+                      (t nil)))))))))
 
 (defun tramp-sh-handle-insert-directory
   (filename switches &optional wildcard full-directory-p)
   "Like `insert-directory' for Tramp files."
   (setq filename (expand-file-name filename))
   (unless switches (setq switches ""))
+  ;; Check, whether directory is accessible.
+  (unless wildcard
+    (access-file filename "Reading directory"))
   (with-parsed-tramp-file-name filename nil
     (if (and (featurep 'ls-lisp)
             (not (symbol-value 'ls-lisp-use-insert-directory-program)))
@@ -2640,12 +2595,12 @@ The method used must be an out-of-band method."
        (setq switches (delete "--dired" switches)))
       (when wildcard
         (setq wildcard (tramp-run-real-handler
-                       'file-name-nondirectory (list localname)))
+                       #'file-name-nondirectory (list localname)))
         (setq localname (tramp-run-real-handler
-                        'file-name-directory (list localname))))
+                        #'file-name-directory (list localname))))
       (unless (or full-directory-p (member "-d" switches))
         (setq switches (append switches '("-d"))))
-      (setq switches (mapconcat 'tramp-shell-quote-argument switches " "))
+      (setq switches (mapconcat #'tramp-shell-quote-argument switches " "))
       (when wildcard
        (setq switches (concat switches " " wildcard)))
       (tramp-message
@@ -2667,10 +2622,10 @@ The method used must be an out-of-band method."
         v
         (format "cd %s" (tramp-shell-quote-argument
                          (tramp-run-real-handler
-                          'file-name-directory (list localname))))
+                          #'file-name-directory (list localname))))
         "Couldn't `cd %s'"
         (tramp-shell-quote-argument
-         (tramp-run-real-handler 'file-name-directory (list localname))))
+         (tramp-run-real-handler #'file-name-directory (list localname))))
        (tramp-send-command
         v
         (format "%s %s %s 2>/dev/null"
@@ -2679,11 +2634,11 @@ The method used must be an out-of-band method."
                 (if (or wildcard
                         (zerop (length
                                 (tramp-run-real-handler
-                                 'file-name-nondirectory (list localname)))))
+                                 #'file-name-nondirectory (list localname)))))
                     ""
                   (tramp-shell-quote-argument
                    (tramp-run-real-handler
-                    'file-name-nondirectory (list localname)))))))
+                    #'file-name-nondirectory (list localname)))))))
 
       (save-restriction
        (let ((beg (point)))
@@ -2697,7 +2652,7 @@ The method used must be an out-of-band method."
 
          ;; Check for "--dired" output.
          (forward-line -2)
-         (when (looking-at "//SUBDIRED//")
+         (when (looking-at-p "//SUBDIRED//")
            (forward-line -1))
          (when (looking-at "//DIRED//\\s-+")
            (let ((databeg (match-end 0))
@@ -2718,7 +2673,7 @@ The method used must be an out-of-band method."
 
          ;; Some busyboxes are reluctant to discard colors.
          (unless
-             (string-match "color" (tramp-get-connection-property v "ls" ""))
+             (string-match-p "color" (tramp-get-connection-property v "ls" ""))
            (goto-char beg)
            (while
                (re-search-forward tramp-display-escape-sequence-regexp nil t)
@@ -2762,15 +2717,17 @@ If the localname part of the given file name starts 
with \"/../\" then
 the result will be a local, non-Tramp, file name."
   ;; If DIR is not given, use `default-directory' or "/".
   (setq dir (or dir default-directory "/"))
+  ;; Handle empty NAME.
+  (when (zerop (length name)) (setq name "."))
   ;; Unless NAME is absolute, concat DIR and NAME.
   (unless (file-name-absolute-p name)
     (setq name (concat (file-name-as-directory dir) name)))
   ;; If connection is not established yet, run the real handler.
   (if (not (tramp-connectable-p name))
-      (tramp-run-real-handler 'expand-file-name (list name nil))
+      (tramp-run-real-handler #'expand-file-name (list name nil))
     ;; Dissect NAME.
     (with-parsed-tramp-file-name name nil
-      (unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
+      (unless (tramp-run-real-handler #'file-name-absolute-p (list localname))
        (setq localname (concat "~/" localname)))
       ;; Tilde expansion if necessary.  This needs a shell which
       ;; groks tilde expansion!  The function `tramp-find-shell' is
@@ -2786,7 +2743,7 @@ the result will be a local, non-Tramp, file name."
          ;; appropriate either, because ssh and companions might
          ;; use a user name from the config file.
          (when (and (string-equal uname "~")
-                    (string-match "\\`su\\(do\\)?\\'" method))
+                    (string-match-p "\\`su\\(do\\)?\\'" method))
            (setq uname (concat uname user)))
          (setq uname
                (with-tramp-connection-property v uname
@@ -2808,7 +2765,7 @@ the result will be a local, non-Tramp, file name."
        (tramp-make-tramp-file-name
         v (tramp-drop-volume-letter
            (tramp-run-real-handler
-            'expand-file-name (list localname))))))))
+            #'expand-file-name (list localname))))))))
 
 ;;; Remote commands:
 
@@ -2824,139 +2781,204 @@ the result will be a local, non-Tramp, file name."
 ;; We use BUFFER also as connection buffer during setup. Because of
 ;; this, its original contents must be saved, and restored once
 ;; connection has been setup.
-(defun tramp-sh-handle-start-file-process (name buffer program &rest args)
-  "Like `start-file-process' for Tramp files."
-  (with-parsed-tramp-file-name (expand-file-name default-directory) nil
-    (let* ((buffer
-           (if buffer
-               (get-buffer-create buffer)
-             ;; BUFFER can be nil.  We use a temporary buffer.
-             (generate-new-buffer tramp-temp-buffer-name)))
-          ;; When PROGRAM matches "*sh", and the first arg is "-c",
-          ;; it might be that the arguments exceed the command line
-          ;; length.  Therefore, we modify the command.
-          (heredoc (and (stringp program)
-                        (string-match "sh$" program)
-                        (string-equal "-c" (car args))
-                        (= (length args) 2)))
-          ;; When PROGRAM is nil, we just provide a tty.
-          (args (if (not heredoc) args
-                  (let ((i 250))
-                    (while (and (< i (length (cadr args)))
-                                (string-match " " (cadr args) i))
-                      (setcdr
-                       args
-                       (list (replace-match " \\\\\n" nil nil (cadr args))))
-                      (setq i (+ i 250))))
-                  (cdr args)))
-          ;; Use a human-friendly prompt, for example for `shell'.
-          ;; We discard hops, if existing, that's why we cannot use
-          ;; `file-remote-p'.
-          (prompt (format "PS1=%s %s"
-                          (tramp-make-tramp-file-name v nil 'nohop)
-                          tramp-initial-end-of-output))
-          ;; We use as environment the difference to toplevel
-          ;; `process-environment'.
-          env uenv
-          (env (dolist (elt (cons prompt process-environment) env)
-                  (or (member elt (default-toplevel-value 
'process-environment))
-                      (if (string-match "=" elt)
-                          (setq env (append env `(,elt)))
-                        (if (tramp-get-env-with-u-option v)
-                            (setq env (append `("-u" ,elt) env))
-                          (setq uenv (cons elt uenv)))))))
-          (command
-           (when (stringp program)
-             (format "cd %s && %s exec %s env %s %s"
-                     (tramp-shell-quote-argument localname)
-                      (if uenv
-                          (format
-                           "unset %s &&"
-                           (mapconcat 'tramp-shell-quote-argument uenv " "))
-                        "")
-                     (if heredoc (format "<<'%s'" tramp-end-of-heredoc) "")
-                     (mapconcat 'tramp-shell-quote-argument env " ")
-                     (if heredoc
-                         (format "%s\n(\n%s\n) </dev/tty\n%s"
-                                 program (car args) tramp-end-of-heredoc)
-                       (mapconcat 'tramp-shell-quote-argument
-                                  (cons program args) " ")))))
-          (tramp-process-connection-type
-           (or (null program) tramp-process-connection-type))
-          (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
-          (name1 name)
-          (i 0)
-          ;; We do not want to raise an error when
-          ;; `start-file-process' has been started several times in
-          ;; `eshell' and friends.
-          tramp-current-connection
-          ;; We do not want to run timers.
-          timer-list timer-idle-list
-          p)
-
-      (while (get-process name1)
-       ;; NAME must be unique as process name.
-       (setq i (1+ i)
-             name1 (format "%s<%d>" name i)))
-      (setq name name1)
-      ;; Set the new process properties.
-      (tramp-set-connection-property v "process-name" name)
-      (tramp-set-connection-property v "process-buffer" buffer)
-
-      (with-current-buffer (tramp-get-connection-buffer v)
-       (unwind-protect
-           ;; We catch this event.  Otherwise, `start-process' could
-           ;; be called on the local host.
-           (save-excursion
-             (save-restriction
-               ;; Activate narrowing in order to save BUFFER
-               ;; contents.  Clear also the modification time;
-               ;; otherwise we might be interrupted by
-               ;; `verify-visited-file-modtime'.
-               (let ((buffer-undo-list t)
-                     (buffer-read-only nil)
-                     (mark (point-max)))
-                 (clear-visited-file-modtime)
-                 (narrow-to-region (point-max) (point-max))
-                 ;; We call `tramp-maybe-open-connection', in order
-                 ;; to cleanup the prompt afterwards.
-                 (catch 'suppress
-                   (tramp-maybe-open-connection v)
-                   (setq p (tramp-get-connection-process v))
-                   ;; Set the pid of the remote shell.  This is
-                   ;; needed when sending signals remotely.
-                   (let ((pid (tramp-send-command-and-read v "echo $$")))
-                     (process-put p 'remote-pid pid)
-                     (tramp-set-connection-property p "remote-pid" pid))
-                   (widen)
-                   (delete-region mark (point-max))
-                   (narrow-to-region (point-max) (point-max))
-                   ;; Now do it.
-                   (if command
-                       ;; Send the command.
-                       (tramp-send-command v command nil t) ; nooutput
-                     ;; Check, whether a pty is associated.
-                     (unless (process-get p 'remote-tty)
-                       (tramp-error
-                        v 'file-error
-                        "pty association is not supported for `%s'" name))))
-                 ;; Set query flag and process marker for this
-                 ;; process.  We ignore errors, because the process
-                 ;; could have finished already.
-                 (ignore-errors
-                   (set-process-query-on-exit-flag p t)
-                   (set-marker (process-mark p) (point)))
-                 ;; Return process.
-                 p)))
+(defun tramp-sh-handle-make-process (&rest args)
+  "Like `make-process' for Tramp files."
+  (when args
+    (with-parsed-tramp-file-name (expand-file-name default-directory) nil
+      (let ((name (plist-get args :name))
+           (buffer (plist-get args :buffer))
+           (command (plist-get args :command))
+           (coding (plist-get args :coding))
+           (noquery (plist-get args :noquery))
+           (stop (plist-get args :stop))
+           (connection-type (plist-get args :connection-type))
+           (filter (plist-get args :filter))
+           (sentinel (plist-get args :sentinel))
+           (stderr (plist-get args :stderr)))
+       (unless (stringp name)
+         (signal 'wrong-type-argument (list #'stringp name)))
+       (unless (or (null buffer) (bufferp buffer) (stringp buffer))
+         (signal 'wrong-type-argument (list #'stringp buffer)))
+       (unless (consp command)
+         (signal 'wrong-type-argument (list #'consp command)))
+       (unless (or (null coding)
+                   (and (symbolp coding) (memq coding coding-system-list))
+                   (and (consp coding)
+                        (memq (car coding) coding-system-list)
+                        (memq (cdr coding) coding-system-list)))
+         (signal 'wrong-type-argument (list #'symbolp coding)))
+       (unless (or (null connection-type) (memq connection-type '(pipe pty)))
+         (signal 'wrong-type-argument (list #'symbolp connection-type)))
+       (unless (or (null filter) (functionp filter))
+         (signal 'wrong-type-argument (list #'functionp filter)))
+       (unless (or (null sentinel) (functionp sentinel))
+         (signal 'wrong-type-argument (list #'functionp sentinel)))
+       (unless (or (null stderr) (bufferp stderr) (stringp stderr))
+         (signal 'wrong-type-argument (list #'stringp stderr)))
+
+       (let* ((buffer
+               (if buffer
+                   (get-buffer-create buffer)
+                 ;; BUFFER can be nil.  We use a temporary buffer.
+                 (generate-new-buffer tramp-temp-buffer-name)))
+              (stderr (and stderr (get-buffer-create stderr)))
+              (tmpstderr (and stderr (tramp-make-tramp-temp-file v)))
+              (program (car command))
+              (args (cdr command))
+              ;; When PROGRAM matches "*sh", and the first arg is
+              ;; "-c", it might be that the arguments exceed the
+              ;; command line length.  Therefore, we modify the
+              ;; command.
+              (heredoc (and (stringp program)
+                            (string-match-p "sh$" program)
+                            (string-equal "-c" (car args))
+                            (= (length args) 2)))
+              ;; When PROGRAM is nil, we just provide a tty.
+              (args (if (not heredoc) args
+                      (let ((i 250))
+                        (while (and (< i (length (cadr args)))
+                                    (string-match " " (cadr args) i))
+                          (setcdr
+                           args
+                           (list
+                            (replace-match " \\\\\n" nil nil (cadr args))))
+                          (setq i (+ i 250))))
+                      (cdr args)))
+              ;; Use a human-friendly prompt, for example for
+              ;; `shell'.  We discard hops, if existing, that's why
+              ;; we cannot use `file-remote-p'.
+              (prompt (format "PS1=%s %s"
+                              (tramp-make-tramp-file-name v nil 'nohop)
+                              tramp-initial-end-of-output))
+              ;; We use as environment the difference to toplevel
+              ;; `process-environment'.
+              env uenv
+              (env (dolist (elt (cons prompt process-environment) env)
+                      (or (member
+                          elt (default-toplevel-value 'process-environment))
+                         (if (string-match-p "=" elt)
+                              (setq env (append env `(,elt)))
+                           (if (tramp-get-env-with-u-option v)
+                               (setq env (append `("-u" ,elt) env))
+                              (setq uenv (cons elt uenv)))))))
+              (command
+               (when (stringp program)
+                 (format "cd %s && %s exec %s %s env %s %s"
+                         (tramp-shell-quote-argument localname)
+                         (if uenv
+                              (format
+                               "unset %s &&"
+                               (mapconcat
+                               #'tramp-shell-quote-argument uenv " "))
+                           "")
+                         (if heredoc (format "<<'%s'" tramp-end-of-heredoc) "")
+                         (if tmpstderr (format "2>'%s'" tmpstderr) "")
+                         (mapconcat #'tramp-shell-quote-argument env " ")
+                         (if heredoc
+                             (format "%s\n(\n%s\n) </dev/tty\n%s"
+                                     program (car args) tramp-end-of-heredoc)
+                           (mapconcat #'tramp-shell-quote-argument
+                                      (cons program args) " ")))))
+              (tramp-process-connection-type
+               (or (null program) tramp-process-connection-type))
+              (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
+              (name1 name)
+              (i 0)
+              ;; We do not want to raise an error when `make-process'
+              ;; has been started several times in `eshell' and
+              ;; friends.
+              tramp-current-connection
+              ;; We do not want to run timers.
+              timer-list timer-idle-list
+              p)
+
+         (while (get-process name1)
+           ;; NAME must be unique as process name.
+           (setq i (1+ i)
+                 name1 (format "%s<%d>" name i)))
+         (setq name name1)
+         ;; Set the new process properties.
+         (tramp-set-connection-property v "process-name" name)
+         (tramp-set-connection-property v "process-buffer" buffer)
 
-         ;; Save exit.
-         (if (string-match tramp-temp-buffer-name (buffer-name))
-             (ignore-errors
-               (set-process-buffer p nil)
-               (kill-buffer (current-buffer)))
-           (set-buffer-modified-p bmp))
-         (tramp-flush-connection-property v "process-name")
-         (tramp-flush-connection-property v "process-buffer"))))))
+         (with-current-buffer (tramp-get-connection-buffer v)
+           (unwind-protect
+               ;; We catch this event.  Otherwise, `make-process' could
+               ;; be called on the local host.
+               (save-excursion
+                 (save-restriction
+                   ;; Activate narrowing in order to save BUFFER
+                   ;; contents.  Clear also the modification time;
+                   ;; otherwise we might be interrupted by
+                   ;; `verify-visited-file-modtime'.
+                   (let ((buffer-undo-list t)
+                         (inhibit-read-only t)
+                         (mark (point-max)))
+                     (clear-visited-file-modtime)
+                     (narrow-to-region (point-max) (point-max))
+                     ;; We call `tramp-maybe-open-connection', in
+                     ;; order to cleanup the prompt afterwards.
+                     (catch 'suppress
+                       (tramp-maybe-open-connection v)
+                       (setq p (tramp-get-connection-process v))
+                       ;; Set the pid of the remote shell.  This is
+                       ;; needed when sending signals remotely.
+                       (let ((pid (tramp-send-command-and-read v "echo $$")))
+                         (process-put p 'remote-pid pid)
+                         (tramp-set-connection-property p "remote-pid" pid))
+                       (widen)
+                       (delete-region mark (point-max))
+                       (narrow-to-region (point-max) (point-max))
+                       ;; Now do it.
+                       (if command
+                           ;; Send the command.
+                           (tramp-send-command v command nil t) ; nooutput
+                         ;; Check, whether a pty is associated.
+                         (unless (process-get p 'remote-tty)
+                           (tramp-error
+                            v 'file-error
+                            "pty association is not supported for `%s'"
+                            name))))
+                     ;; Stop process if indicated.
+                     (when stop
+                       (stop-process p))
+                     ;; Set sentinel and filter.
+                     (when sentinel
+                       (set-process-sentinel p sentinel))
+                     (when filter
+                       (set-process-filter p filter))
+                     ;; Set query flag and process marker for this
+                     ;; process.  We ignore errors, because the
+                     ;; process could have finished already.
+                     (ignore-errors
+                       (set-process-query-on-exit-flag p (null noquery))
+                       (set-marker (process-mark p) (point)))
+                     ;; Provide error buffer.  This shows only
+                     ;; initial error messages; messages arriving
+                     ;; later on shall be inserted by `auto-revert'.
+                     ;; The temporary file will still be existing.
+                     ;; TODO: Write a sentinel, which deletes the
+                     ;; temporary file.
+                     (when tmpstderr
+                       ;; We must flush them here already; otherwise
+                       ;; `insert-file-contents' will fail.
+                       (tramp-flush-connection-property v "process-name")
+                       (tramp-flush-connection-property v "process-buffer")
+                       (with-current-buffer stderr
+                         (insert-file-contents
+                          (tramp-make-tramp-file-name v tmpstderr) 'visit)
+                         (auto-revert-mode)))
+                     ;; Return process.
+                     p)))
+
+             ;; Save exit.
+             (if (string-match-p tramp-temp-buffer-name (buffer-name))
+                 (ignore-errors
+                   (set-process-buffer p nil)
+                   (kill-buffer (current-buffer)))
+               (set-buffer-modified-p bmp))
+             (tramp-flush-connection-property v "process-name")
+             (tramp-flush-connection-property v "process-buffer"))))))))
 
 (defun tramp-sh-handle-process-file
   (program &optional infile destination display &rest args)
@@ -2968,12 +2990,12 @@ the result will be a local, non-Tramp, file name."
   (with-parsed-tramp-file-name default-directory nil
     (let (command env uenv input tmpinput stderr tmpstderr outbuf ret)
       ;; Compute command.
-      (setq command (mapconcat 'tramp-shell-quote-argument
+      (setq command (mapconcat #'tramp-shell-quote-argument
                               (cons program args) " "))
       ;; We use as environment the difference to toplevel 
`process-environment'.
       (dolist (elt process-environment)
         (or (member elt (default-toplevel-value 'process-environment))
-            (if (string-match "=" elt)
+            (if (string-match-p "=" elt)
                 (setq env (append env `(,elt)))
               (if (tramp-get-env-with-u-option v)
                   (setq env (append `("-u" ,elt) env))
@@ -2982,12 +3004,12 @@ the result will be a local, non-Tramp, file name."
        (setq command
              (format
               "env %s %s"
-              (mapconcat 'tramp-shell-quote-argument env " ") command)))
+              (mapconcat #'tramp-shell-quote-argument env " ") command)))
       (when uenv
         (setq command
               (format
                "unset %s && %s"
-               (mapconcat 'tramp-shell-quote-argument uenv " ") command)))
+               (mapconcat #'tramp-shell-quote-argument uenv " ") command)))
       ;; Determine input.
       (if (null infile)
          (setq input "/dev/null")
@@ -3088,7 +3110,7 @@ the result will be a local, non-Tramp, file name."
   (append
    (tramp-get-remote-path (tramp-dissect-file-name default-directory))
    ;; The equivalent to `exec-directory'.
-   `(,(file-remote-p default-directory 'localname))))
+   `(,(tramp-compat-file-local-name default-directory))))
 
 (defun tramp-sh-handle-file-local-copy (filename)
   "Like `file-local-copy' for Tramp files."
@@ -3113,50 +3135,49 @@ the result will be a local, non-Tramp, file name."
 
           ;; Use inline encoding for file transfer.
           (rem-enc
-           (save-excursion
-             (with-tramp-progress-reporter
-              v 3
-              (format-message "Encoding remote file `%s' with `%s'"
-                               filename rem-enc)
-              (tramp-barf-unless-okay
-               v (format rem-enc (tramp-shell-quote-argument localname))
-               "Encoding remote file failed"))
-
-             (with-tramp-progress-reporter
-                 v 3 (format-message "Decoding local file `%s' with `%s'"
-                                     tmpfile loc-dec)
-               (if (functionp loc-dec)
-                   ;; If local decoding is a function, we call it.
-                   ;; We must disable multibyte, because
-                   ;; `uudecode-decode-region' doesn't handle it
-                   ;; correctly.  Unset `file-name-handler-alist'.
-                   ;; Otherwise, epa-file gets confused.
-                   (let (file-name-handler-alist
-                         (coding-system-for-write 'binary))
-                     (with-temp-file tmpfile
-                       (set-buffer-multibyte nil)
-                       (insert-buffer-substring (tramp-get-buffer v))
-                       (funcall loc-dec (point-min) (point-max))))
-
-                 ;; If tramp-decoding-function is not defined for this
-                 ;; method, we invoke tramp-decoding-command instead.
-                 (let ((tmpfile2 (tramp-compat-make-temp-file filename)))
-                   ;; Unset `file-name-handler-alist'.  Otherwise,
-                   ;; epa-file gets confused.
-                   (let (file-name-handler-alist
-                         (coding-system-for-write 'binary))
-                     (with-current-buffer (tramp-get-buffer v)
-                       (write-region
-                        (point-min) (point-max) tmpfile2 nil 'no-message)))
-                   (unwind-protect
-                       (tramp-call-local-coding-command
-                        loc-dec tmpfile2 tmpfile)
-                     (delete-file tmpfile2)))))
-
-             ;; Set proper permissions.
-             (set-file-modes tmpfile (tramp-default-file-modes filename))
-             ;; Set local user ownership.
-             (tramp-set-file-uid-gid tmpfile)))
+           (with-tramp-progress-reporter
+               v 3
+               (format-message
+                "Encoding remote file `%s' with `%s'" filename rem-enc)
+             (tramp-barf-unless-okay
+              v (format rem-enc (tramp-shell-quote-argument localname))
+              "Encoding remote file failed"))
+
+           (with-tramp-progress-reporter
+               v 3 (format-message
+                    "Decoding local file `%s' with `%s'" tmpfile loc-dec)
+             (if (functionp loc-dec)
+                 ;; If local decoding is a function, we call it.  We
+                 ;; must disable multibyte, because
+                 ;; `uudecode-decode-region' doesn't handle it
+                 ;; correctly.  Unset `file-name-handler-alist'.
+                 ;; Otherwise, epa-file gets confused.
+                 (let (file-name-handler-alist
+                       (coding-system-for-write 'binary))
+                   (with-temp-file tmpfile
+                     (set-buffer-multibyte nil)
+                     (insert-buffer-substring (tramp-get-buffer v))
+                     (funcall loc-dec (point-min) (point-max))))
+
+               ;; If tramp-decoding-function is not defined for this
+               ;; method, we invoke tramp-decoding-command instead.
+               (let ((tmpfile2 (tramp-compat-make-temp-file filename)))
+                 ;; Unset `file-name-handler-alist'.  Otherwise,
+                 ;; epa-file gets confused.
+                 (let (file-name-handler-alist
+                       (coding-system-for-write 'binary))
+                   (with-current-buffer (tramp-get-buffer v)
+                     (write-region
+                      (point-min) (point-max) tmpfile2 nil 'no-message)))
+                 (unwind-protect
+                     (tramp-call-local-coding-command
+                      loc-dec tmpfile2 tmpfile)
+                   (delete-file tmpfile2)))))
+
+           ;; Set proper permissions.
+           (set-file-modes tmpfile (tramp-default-file-modes filename))
+           ;; Set local user ownership.
+           (tramp-set-file-uid-gid tmpfile))
 
           ;; Oops, I don't know what to do.
           (t (tramp-error
@@ -3200,7 +3221,8 @@ the result will be a local, non-Tramp, file name."
                      (file-writable-p localname)))))
          ;; Short track: if we are on the local host, we can run directly.
          (tramp-run-real-handler
-          'write-region (list start end localname append 'no-message lockname))
+          #'write-region
+          (list start end localname append 'no-message lockname))
 
        (let* ((modes (save-excursion (tramp-default-file-modes filename)))
               ;; We use this to save the value of
@@ -3236,7 +3258,7 @@ the result will be a local, non-Tramp, file name."
                 (tramp-find-file-name-coding-system-alist filename tmpfile)))
            (condition-case err
                (tramp-run-real-handler
-                'write-region
+                #'write-region
                 (list start end tmpfile append 'no-message lockname))
              ((error quit)
               (setq tramp-temp-buffer-file-name nil)
@@ -3252,9 +3274,7 @@ the result will be a local, non-Tramp, file name."
          ;; handles permissions.
          ;; Ensure that it is still readable.
          (when modes
-           (set-file-modes
-            tmpfile
-            (logior (or modes 0) (string-to-number "0400" 8))))
+           (set-file-modes tmpfile (logior (or modes 0) #o0400)))
 
          ;; This is a bit lengthy due to the different methods
          ;; possible for file transfer.  First, we check whether the
@@ -3322,8 +3342,9 @@ the result will be a local, non-Tramp, file name."
                                        loc-enc tmpfile t))
                          (tramp-error
                           v 'file-error
-                          (concat "Cannot write to `%s', "
-                                  "local encoding command `%s' failed")
+                          (eval-when-compile
+                            (concat "Cannot write to `%s', "
+                                    "local encoding command `%s' failed"))
                           filename loc-enc))))
 
                    ;; Send buffer into remote decoding command which
@@ -3368,8 +3389,9 @@ the result will be a local, non-Tramp, file name."
                             (buffer-string))))
                         (tramp-error
                          v 'file-error
-                         (concat "Couldn't write region to `%s',"
-                                 " decode using `%s' failed")
+                         (eval-when-compile
+                           (concat "Couldn't write region to `%s',"
+                                   " decode using `%s' failed"))
                          filename rem-dec)))))
 
                ;; Save exit.
@@ -3379,8 +3401,9 @@ the result will be a local, non-Tramp, file name."
             (t
              (tramp-error
               v 'file-error
-              (concat "Method `%s' should specify both encoding and "
-                      "decoding command or an scp program")
+              (eval-when-compile
+                (concat "Method `%s' should specify both encoding and "
+                        "decoding command or an scp program"))
               method))))
 
          ;; Make `last-coding-system-used' have the right value.
@@ -3449,7 +3472,7 @@ the result will be a local, non-Tramp, file name."
          ;; Here we collect only file names, which need an operation.
          (tramp-with-demoted-errors
              v "Error in 1st pass of `vc-registered': %s"
-           (tramp-run-real-handler 'vc-registered (list file)))
+           (tramp-run-real-handler #'vc-registered (list file)))
          (tramp-message v 10 "\n%s" tramp-vc-registered-file-names)
 
          ;; Send just one command, in order to fill the cache.
@@ -3472,7 +3495,7 @@ the result will be a local, non-Tramp, file name."
                    (format
                     "tramp_vc_registered_read_file_names <<'%s'\n%s\n%s\n"
                     tramp-end-of-heredoc
-                    (mapconcat 'tramp-shell-quote-argument
+                    (mapconcat #'tramp-shell-quote-argument
                                tramp-vc-registered-file-names
                                "\n")
                     tramp-end-of-heredoc))
@@ -3512,7 +3535,7 @@ the result will be a local, non-Tramp, file name."
          ;; Run.
          (tramp-with-demoted-errors
              v "Error in 2nd pass of `vc-registered': %s"
-           (tramp-run-real-handler 'vc-registered (list file))))))))
+           (tramp-run-real-handler #'vc-registered (list file))))))))
 
 ;;;###tramp-autoload
 (defun tramp-sh-file-name-handler (operation &rest args)
@@ -3525,15 +3548,16 @@ Fall back to normal file name handler if no Tramp 
handler exists."
 
 ;; This must be the last entry, because `identity' always matches.
 ;;;###tramp-autoload
-(tramp-register-foreign-file-name-handler
- 'identity 'tramp-sh-file-name-handler 'append)
+(tramp--with-startup
+ (tramp-register-foreign-file-name-handler
+  #'identity #'tramp-sh-file-name-handler 'append))
 
 (defun tramp-vc-file-name-handler (operation &rest args)
   "Invoke special file name handler, which collects files to be handled."
   (save-match-data
     (let ((filename
           (tramp-replace-environment-variables
-           (apply 'tramp-file-name-for-operation operation args)))
+           (apply #'tramp-file-name-for-operation operation args)))
          (fn (assoc operation tramp-sh-file-name-handler-alist)))
       (with-parsed-tramp-file-name filename nil
        (cond
@@ -3563,15 +3587,17 @@ Fall back to normal file name handler if no Tramp 
handler exists."
       (cond
        ;; "inotifywait".
        ((setq command (tramp-get-remote-inotifywait v))
-       (setq filter 'tramp-sh-inotifywait-process-filter
+       (setq filter #'tramp-sh-inotifywait-process-filter
              events
              (cond
               ((and (memq 'change flags) (memq 'attribute-change flags))
-               (concat "create,modify,move,moved_from,moved_to,move_self,"
-                       "delete,delete_self,attrib,ignored"))
+               (eval-when-compile
+                 (concat "create,modify,move,moved_from,moved_to,move_self,"
+                         "delete,delete_self,attrib,ignored")))
               ((memq 'change flags)
-               (concat "create,modify,move,moved_from,moved_to,move_self,"
-                       "delete,delete_self,ignored"))
+               (eval-when-compile
+                 (concat "create,modify,move,moved_from,moved_to,move_self,"
+                         "delete,delete_self,ignored")))
               ((memq 'attribute-change flags) "attrib,ignored"))
              sequence `(,command "-mq" "-e" ,events ,localname)
              ;; Make events a list of symbols.
@@ -3581,7 +3607,7 @@ Fall back to normal file name handler if no Tramp handler 
exists."
               (split-string events "," 'omit))))
        ;; "gio monitor".
        ((setq command (tramp-get-remote-gio-monitor v))
-       (setq filter 'tramp-sh-gio-monitor-process-filter
+       (setq filter #'tramp-sh-gio-monitor-process-filter
              events
              (cond
               ((and (memq 'change flags) (memq 'attribute-change flags))
@@ -3593,7 +3619,7 @@ Fall back to normal file name handler if no Tramp handler 
exists."
              sequence `(,command "monitor" ,localname)))
        ;; "gvfs-monitor-dir".
        ((setq command (tramp-get-remote-gvfs-monitor-dir v))
-       (setq filter 'tramp-sh-gvfs-monitor-dir-process-filter
+       (setq filter #'tramp-sh-gvfs-monitor-dir-process-filter
              events
              (cond
               ((and (memq 'change flags) (memq 'attribute-change flags))
@@ -3610,7 +3636,7 @@ Fall back to normal file name handler if no Tramp handler 
exists."
           (file-remote-p file-name))))
       ;; Start process.
       (setq p (apply
-              'start-file-process
+              #'start-file-process
               (file-name-nondirectory command)
               (generate-new-buffer
                (format " *%s*" (file-name-nondirectory command)))
@@ -3620,8 +3646,8 @@ Fall back to normal file name handler if no Tramp handler 
exists."
          (tramp-error
           v 'file-notify-error
           "`%s' failed to start on remote host"
-          (mapconcat 'identity sequence " "))
-       (tramp-message v 6 "Run `%s', %S" (mapconcat 'identity sequence " ") p)
+          (mapconcat #'identity sequence " "))
+       (tramp-message v 6 "Run `%s', %S" (mapconcat #'identity sequence " ") p)
        (process-put p 'vector v)
        ;; Needed for process filter.
        (process-put p 'events events)
@@ -3630,7 +3656,7 @@ Fall back to normal file name handler if no Tramp handler 
exists."
        (set-process-filter p filter)
        ;; There might be an error if the monitor is not supported.
        ;; Give the filter a chance to read the output.
-       (tramp-accept-process-output p 1)
+       (while (tramp-accept-process-output p 0))
        (unless (process-live-p p)
          (tramp-error
           p 'file-notify-error "Monitoring not supported for `%s'" file-name))
@@ -3655,14 +3681,19 @@ Fall back to normal file name handler if no Tramp 
handler exists."
           string (replace-regexp-in-string
                  "renamed to" "moved" string))
     ;; https://bugs.launchpad.net/bugs/1742946
-    (when (string-match "Monitoring not supported\\|No locations given" string)
+    (when
+       (string-match-p "Monitoring not supported\\|No locations given" string)
       (delete-process proc))
 
+    ;; Delete empty lines.
+    (setq string (replace-regexp-in-string "\n\n" "\n" string))
+
     (while (string-match
-           (concat "^[^:]+:"
-                   "[[:space:]]\\([^:]+\\):"
-                   "[[:space:]]"  (regexp-opt tramp-gio-events t)
-                   "\\([[:space:]]\\([^:]+\\)\\)?$")
+           (eval-when-compile
+             (concat "^[^:]+:"
+                     "[[:space:]]\\([^:]+\\):"
+                     "[[:space:]]" (regexp-opt tramp-gio-events t)
+                     "\\([[:space:]]\\([^:]+\\)\\)?$"))
            string)
 
       (let* ((file (match-string 1 string))
@@ -3711,11 +3742,12 @@ file-notify events."
                  "ATTRIB CHANGED" "ATTRIBUTE_CHANGED" string))
 
     (while (string-match
-           (concat "^[\n\r]*"
-                   "Directory Monitor Event:[\n\r]+"
-                   "Child = \\([^\n\r]+\\)[\n\r]+"
-                   "\\(Other = \\([^\n\r]+\\)[\n\r]+\\)?"
-                   "Event = \\([^[:blank:]]+\\)[\n\r]+")
+           (eval-when-compile
+             (concat "^[\n\r]*"
+                     "Directory Monitor Event:[\n\r]+"
+                     "Child = \\([^\n\r]+\\)[\n\r]+"
+                     "\\(Other = \\([^\n\r]+\\)[\n\r]+\\)?"
+                     "Event = \\([^[:blank:]]+\\)[\n\r]+"))
            string)
       (let* ((file (match-string 1 string))
             (file1 (match-string 3 string))
@@ -3755,9 +3787,10 @@ file-notify events."
     (dolist (line (split-string string "[\n\r]+" 'omit))
       ;; Check, whether there is a problem.
       (unless (string-match
-              (concat "^[^[:blank:]]+"
-                      "[[:blank:]]+\\([^[:blank:]]+\\)+"
-                      "\\([[:blank:]]+\\([^\n\r]+\\)\\)?")
+              (eval-when-compile
+                (concat "^[^[:blank:]]+"
+                        "[[:blank:]]+\\([^[:blank:]]+\\)+"
+                        "\\([[:blank:]]+\\([^\n\r]+\\)\\)?"))
               line)
        (tramp-error proc 'file-notify-error "%s" line))
 
@@ -3789,21 +3822,26 @@ file-notify events."
        (tramp-message v 5 "file system info: %s" localname)
        (tramp-send-command
         v (format
-           "%s --block-size=1 --output=size,used,avail %s"
+           "%s %s"
            (tramp-get-remote-df v) (tramp-shell-quote-argument localname)))
        (with-current-buffer (tramp-get-connection-buffer v)
          (goto-char (point-min))
          (forward-line)
          (when (looking-at
-                (concat "[[:space:]]*\\([[:digit:]]+\\)"
-                        "[[:space:]]+\\([[:digit:]]+\\)"
-                        "[[:space:]]+\\([[:digit:]]+\\)"))
-           (list (string-to-number (match-string 1))
-                 ;; The second value is the used size.  We need the
-                 ;; free size.
-                 (- (string-to-number (match-string 1))
-                    (string-to-number (match-string 2)))
-                 (string-to-number (match-string 3)))))))))
+                (eval-when-compile
+                  (concat "\\(?:^/[^[:space:]]*[[:space:]]\\)?"
+                          "[[:space:]]*\\([[:digit:]]+\\)"
+                          "[[:space:]]+\\([[:digit:]]+\\)"
+                          "[[:space:]]+\\([[:digit:]]+\\)")))
+           (mapcar
+            (lambda (d)
+              (* d (tramp-get-connection-property v "df-blocksize" 0)))
+            (list (string-to-number (match-string 1))
+                  ;; The second value is the used size.  We need the
+                  ;; free size.
+                  (- (string-to-number (match-string 1))
+                     (string-to-number (match-string 2)))
+                  (string-to-number (match-string 3))))))))))
 
 ;;; Internal Functions:
 
@@ -3822,7 +3860,7 @@ Only send the definition if it has not already been done."
        (setq script (replace-regexp-in-string
                      (make-string 1 ?\t) (make-string 8 ? ) script))
        ;; The script could contain a call of Perl.  This is masked with `%s'.
-       (when (and (string-match "%s" script)
+       (when (and (string-match-p "%s" script)
                   (not (tramp-get-remote-perl vec)))
          (tramp-error vec 'file-error "No Perl available on remote host"))
        (tramp-barf-unless-okay
@@ -3883,12 +3921,12 @@ This function expects to be in the right *tramp* 
buffer."
       ;; 5.11") have problems with this command, we disable the call
       ;; therefore.
       (unless (or ignore-path
-                 (string-match
-                  (regexp-opt '("SunOS 5.10" "SunOS 5.11"))
+                 (string-match-p
+                  (eval-when-compile (regexp-opt '("SunOS 5.10" "SunOS 5.11")))
                   (tramp-get-connection-property vec "uname" "")))
        (tramp-send-command vec (format "which \\%s | wc -w" progname))
        (goto-char (point-min))
-       (if (looking-at "^\\s-*1$")
+       (if (looking-at-p "^\\s-*1$")
            (setq result (concat "\\" progname))))
       (unless result
        (when ignore-tilde
@@ -3902,14 +3940,15 @@ This function expects to be in the right *tramp* 
buffer."
            (setq dirlist (nreverse newdl))))
        (tramp-send-command
         vec
-        (format (concat "while read d; "
-                        "do if test -x $d/%s && test -f $d/%s; "
-                        "then echo tramp_executable $d/%s; "
-                        "break; fi; done <<'%s'\n"
-                        "%s\n%s")
+        (format (eval-when-compile
+                  (concat "while read d; "
+                          "do if test -x $d/%s && test -f $d/%s; "
+                          "then echo tramp_executable $d/%s; "
+                          "break; fi; done <<'%s'\n"
+                          "%s\n%s"))
                 progname progname progname
                 tramp-end-of-heredoc
-                (mapconcat 'identity dirlist "\n")
+                (mapconcat #'identity dirlist "\n")
                 tramp-end-of-heredoc))
        (goto-char (point-max))
        (when (search-backward "tramp_executable " nil t)
@@ -3918,15 +3957,33 @@ This function expects to be in the right *tramp* 
buffer."
          (setq result (buffer-substring (point) (point-at-eol)))))
     result)))
 
+;; On hydra.nixos.org, the $PATH environment variable is too long to
+;; send it.  This is likely not due to PATH_MAX, but PIPE_BUF.  We
+;; check it, and use a temporary file in case of.  See Bug#33781.
 (defun tramp-set-remote-path (vec)
   "Sets the remote environment PATH to existing directories.
 I.e., for each directory in `tramp-remote-path', it is tested
 whether it exists and if so, it is added to the environment
 variable PATH."
-  (tramp-message vec 5 "Setting $PATH environment variable")
-  (tramp-send-command
-   vec (format "PATH=%s; export PATH"
-              (mapconcat 'identity (tramp-get-remote-path vec) ":"))))
+  (let ((command
+        (format "PATH=%s; export PATH"
+                (mapconcat #'identity (tramp-get-remote-path vec) ":")))
+       (pipe-buf
+        (or (with-tramp-connection-property vec "pipe-buf"
+              (tramp-send-command-and-read
+               vec "getconf PIPE_BUF / 2>/dev/null || echo nil" 'noerror))
+            4096))
+       tmpfile)
+    (tramp-message vec 5 "Setting $PATH environment variable")
+    (if (< (length command) pipe-buf)
+       (tramp-send-command vec command)
+      ;; Use a temporary file.
+      (setq tmpfile
+           (tramp-make-tramp-file-name vec (tramp-make-tramp-temp-file vec)))
+      (write-region command nil tmpfile)
+      (tramp-send-command
+       vec (format ". %s" (tramp-compat-file-local-name tmpfile)))
+      (delete-file tmpfile))))
 
 ;; ------------------------------------------------------------
 ;; -- Communication with external shell --
@@ -3995,7 +4052,7 @@ file exists and nonzero exit status otherwise."
          item extra-args)
       (while (and alist (null extra-args))
        (setq item (pop alist))
-       (when (string-match (car item) shell)
+       (when (string-match-p (car item) shell)
          (setq extra-args (cdr item))))
       ;; It is useful to set the prompt in the following command
       ;; because some people have a setting for $PS1 which /bin/sh
@@ -4016,9 +4073,10 @@ file exists and nonzero exit status otherwise."
       ;; initial probes to ensure the remote shell is usable.)
       (tramp-send-command
        vec (format
-           (concat
-            "exec env TERM='%s' INSIDE_EMACS='%s,tramp:%s' "
-            "ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s")
+           (eval-when-compile
+             (concat
+              "exec env TERM='%s' INSIDE_EMACS='%s,tramp:%s' "
+              "ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s"))
             tramp-terminal-type
             emacs-version tramp-version  ; INSIDE_EMACS
             (or (getenv-internal "ENV" tramp-remote-process-environment) "")
@@ -4056,13 +4114,14 @@ file exists and nonzero exit status otherwise."
              ;; CCC: "root" does not exist always, see my QNAP TS-459.
              ;; Which check could we apply instead?
              (tramp-send-command vec "echo ~root" t)
-             (if (or (string-match "^~root$" (buffer-string))
+             (if (or (string-match-p "^~root$" (buffer-string))
                      ;; The default shell (ksh93) of OpenSolaris and
                      ;; Solaris is buggy.  We've got reports for
                      ;; "SunOS 5.10" and "SunOS 5.11" so far.
-                     (string-match (regexp-opt '("SunOS 5.10" "SunOS 5.11"))
-                                   (tramp-get-connection-property
-                                    vec "uname" "")))
+                     (string-match-p
+                      (eval-when-compile
+                        (regexp-opt '("SunOS 5.10" "SunOS 5.11")))
+                      (tramp-get-connection-property vec "uname" "")))
 
                  (or (tramp-find-executable
                       vec "bash" (tramp-get-remote-path vec) t t)
@@ -4073,9 +4132,10 @@ file exists and nonzero exit status otherwise."
                          default-shell
                        (tramp-message
                         vec 2
-                        (concat
-                         "Couldn't find a remote shell which groks tilde "
-                         "expansion, using `%s'")
+                        (eval-when-compile
+                          (concat
+                           "Couldn't find a remote shell which groks tilde "
+                           "expansion, using `%s'"))
                         default-shell)))
 
                default-shell)))
@@ -4100,7 +4160,7 @@ seconds.  If not, it produces an error message with the 
given ERROR-ARGS."
          "\\(%s\\|%s\\)\\'" shell-prompt-pattern tramp-shell-prompt-pattern))
       (error
        (delete-process proc)
-       (apply 'tramp-error-with-buffer
+       (apply #'tramp-error-with-buffer
              (tramp-get-connection-buffer vec) vec 'file-error error-args)))))
 
 (defun tramp-open-connection-setup-interactive-shell (proc vec)
@@ -4121,7 +4181,7 @@ process to set up.  VEC specifies the connection."
     (tramp-send-command vec "echo foo" t)
     (with-current-buffer (process-buffer proc)
       (goto-char (point-min))
-      (when (looking-at "echo foo")
+      (when (looking-at-p "echo foo")
        (tramp-set-connection-property proc "remote-echo" t)
        (tramp-message vec 5 "Remote echo still on. Ok.")
        ;; Make sure backspaces and their echo are enabled and no line
@@ -4160,10 +4220,10 @@ process to set up.  VEC specifies the connection."
       ;; Use MULE to select the right EOL convention for communicating
       ;; with the process.
       (let ((cs (or (and (memq 'utf-8-hfs (coding-system-list))
-                        (string-match "^Darwin" uname)
+                        (string-match-p "^Darwin" uname)
                         (cons 'utf-8-hfs 'utf-8-hfs))
                    (and (memq 'utf-8 (coding-system-list))
-                        (string-match "utf-?8" (tramp-get-remote-locale vec))
+                        (string-match-p "utf-?8" (tramp-get-remote-locale vec))
                         (cons 'utf-8 'utf-8))
                    (process-coding-system proc)
                    (cons 'undecided 'undecided)))
@@ -4173,7 +4233,7 @@ process to set up.  VEC specifies the connection."
              cs-encode (or (cdr cs) 'undecided)
              cs-encode
              (coding-system-change-eol-conversion
-              cs-encode (if (string-match "^Darwin" uname) 'mac 'unix)))
+              cs-encode (if (string-match-p "^Darwin" uname) 'mac 'unix)))
        (tramp-send-command vec "(echo foo ; echo bar)" t)
        (goto-char (point-min))
        (when (search-forward "\r" nil t)
@@ -4197,7 +4257,7 @@ process to set up.  VEC specifies the connection."
        (t
        (tramp-message
         vec 5 "Checking remote host type for `send-process-string' bug")
-       (if (string-match "^FreeBSD" uname) 500 0))))
+       (if (string-match-p "^FreeBSD" uname) 500 0))))
 
     ;; Set remote PATH variable.
     (tramp-set-remote-path vec)
@@ -4220,11 +4280,11 @@ process to set up.  VEC specifies the connection."
     ;; IRIX64 bash expands "!" even when in single quotes.  This
     ;; destroys our shell functions, we must disable it.  See
     ;; 
<http://stackoverflow.com/questions/3291692/irix-bash-shell-expands-expression-in-single-quotes-yet-shouldnt>.
-    (when (string-match "^IRIX64" uname)
+    (when (string-match-p "^IRIX64" uname)
       (tramp-send-command vec "set +H" t))
 
     ;; Disable tab expansion.
-    (if (string-match "BSD\\|Darwin" uname)
+    (if (string-match-p "BSD\\|Darwin" uname)
        (tramp-send-command vec "stty tabs" t)
       (tramp-send-command vec "stty tab0" t))
 
@@ -4250,7 +4310,7 @@ process to set up.  VEC specifies the connection."
                     (append `(,(tramp-get-remote-locale vec))
                             (copy-sequence tramp-remote-process-environment))))
        (setq item (split-string item "=" 'omit))
-       (setcdr item (mapconcat 'identity (cdr item) "="))
+       (setcdr item (mapconcat #'identity (cdr item) "="))
        (if (and (stringp (cdr item)) (not (string-equal (cdr item) "")))
            (push (format "%s %s" (car item) (cdr item)) vars)
          (push (car item) unset)))
@@ -4260,12 +4320,12 @@ process to set up.  VEC specifies the connection."
         (format
          "while read var val; do export $var=\"$val\"; done <<'%s'\n%s\n%s"
          tramp-end-of-heredoc
-         (mapconcat 'identity vars "\n")
+         (mapconcat #'identity vars "\n")
          tramp-end-of-heredoc)
         t))
       (when unset
        (tramp-send-command
-        vec (format "unset %s" (mapconcat 'identity unset " ")) t)))))
+        vec (format "unset %s" (mapconcat #'identity unset " ")) t)))))
 
 ;; Old text from documentation of tramp-methods:
 ;; Using a uuencode/uudecode inline method is discouraged, please use one
@@ -4291,7 +4351,7 @@ Each item is a list that looks like this:
 
 \(FORMAT ENCODING DECODING)
 
-FORMAT is  symbol describing the encoding/decoding format.  It can be
+FORMAT is a symbol describing the encoding/decoding format.  It can be
 `b64' for base64 encoding, `uu' for uu encoding, or `pack' for simple packing.
 
 ENCODING and DECODING can be strings, giving commands, or symbols,
@@ -4371,16 +4431,14 @@ Goes through the list `tramp-local-coding-commands' and
                 vec 5 "Checking local encoding function `%s'" loc-enc)
              (tramp-message
               vec 5 "Checking local encoding command `%s' for sanity" loc-enc)
-             (unless (zerop (tramp-call-local-coding-command
-                             loc-enc nil nil))
+             (unless (zerop (tramp-call-local-coding-command loc-enc nil nil))
                (throw 'wont-work-local nil)))
            (if (not (stringp loc-dec))
                (tramp-message
                 vec 5 "Checking local decoding function `%s'" loc-dec)
              (tramp-message
               vec 5 "Checking local decoding command `%s' for sanity" loc-dec)
-             (unless (zerop (tramp-call-local-coding-command
-                             loc-dec nil nil))
+             (unless (zerop (tramp-call-local-coding-command loc-dec nil nil))
                (throw 'wont-work-local nil)))
            ;; Search for remote coding commands with the same format
            (while (and remote-commands (not found))
@@ -4398,7 +4456,7 @@ Goes through the list `tramp-local-coding-commands' and
                      (throw 'wont-work-remote nil)))
                  ;; Check if remote perl exists when necessary.
                  (when (and (symbolp rem-enc)
-                            (string-match "perl" (symbol-name rem-enc))
+                            (string-match-p "perl" (symbol-name rem-enc))
                             (not (tramp-get-remote-perl vec)))
                    (throw 'wont-work-remote nil))
                  ;; Check if remote encoding and decoding commands can be
@@ -4409,9 +4467,9 @@ Goes through the list `tramp-local-coding-commands' and
                  ;; actually check the output it gives.  And also, when
                  ;; redirecting "mimencode" output to /dev/null, then as root
                  ;; it might change the permissions of /dev/null!
-                 (when (not (stringp rem-enc))
+                 (unless (stringp rem-enc)
                    (let ((name (symbol-name rem-enc)))
-                     (while (string-match (regexp-quote "-") name)
+                     (while (string-match "-" name)
                        (setq name (replace-match "_" nil t name)))
                      (tramp-maybe-send-script vec (symbol-value rem-enc) name)
                      (setq rem-enc name)))
@@ -4422,13 +4480,13 @@ Goes through the list `tramp-local-coding-commands' and
                           vec (format "%s </dev/null" rem-enc) t)
                    (throw 'wont-work-remote nil))
 
-                 (when (not (stringp rem-dec))
+                 (unless (stringp rem-dec)
                    (let ((name (symbol-name rem-dec))
                          (value (symbol-value rem-dec))
                          tmpfile)
-                     (while (string-match (regexp-quote "-") name)
+                     (while (string-match "-" name)
                        (setq name (replace-match "_" nil t name)))
-                     (when (string-match "\\(^\\|[^%]\\)%t" value)
+                     (when (string-match-p "\\(^\\|[^%]\\)%t" value)
                        (setq tmpfile
                              (make-temp-name
                               (expand-file-name
@@ -4438,8 +4496,7 @@ Goes through the list `tramp-local-coding-commands' and
                              (format-spec
                               value
                               (format-spec-make
-                               ?t
-                               (file-remote-p tmpfile 'localname)))))
+                               ?t (tramp-compat-file-local-name tmpfile)))))
                      (tramp-maybe-send-script vec value name)
                      (setq rem-dec name)))
                  (tramp-message
@@ -4451,9 +4508,9 @@ Goes through the list `tramp-local-coding-commands' and
                           t)
                    (throw 'wont-work-remote nil))
 
-                 (with-current-buffer (tramp-get-buffer vec)
+                 (with-current-buffer (tramp-get-connection-buffer vec)
                    (goto-char (point-min))
-                   (unless (looking-at (regexp-quote magic))
+                   (unless (looking-at-p (regexp-quote magic))
                      (throw 'wont-work-remote nil)))
 
                  ;; `rem-enc' and `rem-dec' could be a string meanwhile.
@@ -4483,12 +4540,12 @@ means standard output and thus the current buffer), or 
nil (which
 means discard it)."
   (tramp-call-process
    nil tramp-encoding-shell
-   (when (and input (not (string-match "%s" cmd))) input)
+   (when (and input (not (string-match-p "%s" cmd))) input)
    (if (eq output t) t nil)
    nil
    tramp-encoding-command-switch
    (concat
-    (if (string-match "%s" cmd) (format cmd input) cmd)
+    (if (string-match-p "%s" cmd) (format cmd input) cmd)
     (if (stringp output) (concat " >" output) ""))))
 
 (defconst tramp-inline-compress-commands
@@ -4530,9 +4587,9 @@ Goes through the list `tramp-inline-compress-commands'."
                 ;; the pipe symbol be quoted if they use forward
                 ;; slashes as directory separators.
                 (mapconcat
-                 'shell-quote-argument (split-string compress) " ")
+                 #'shell-quote-argument (split-string compress) " ")
                 (mapconcat
-                 'shell-quote-argument (split-string decompress) " "))
+                 #'shell-quote-argument (split-string decompress) " "))
                nil nil))
            (throw 'next nil))
          (tramp-message
@@ -4564,28 +4621,29 @@ Goes through the list `tramp-inline-compress-commands'."
 
 (defun tramp-compute-multi-hops (vec)
   "Expands VEC according to `tramp-default-proxies-alist'."
-  (let ((target-alist `(,vec))
+  (let ((saved-tdpa tramp-default-proxies-alist)
+       (target-alist `(,vec))
        (hops (or (tramp-file-name-hop vec) ""))
        (item vec)
        choices proxy)
 
     ;; Ad-hoc proxy definitions.
     (dolist (proxy (reverse (split-string hops tramp-postfix-hop-regexp 
'omit)))
-      (let ((user (tramp-file-name-user item))
-           (host (tramp-file-name-host item))
+      (let ((user-domain (tramp-file-name-user-domain item))
+           (host-port (tramp-file-name-host-port item))
            (proxy (concat
                    tramp-prefix-format proxy tramp-postfix-host-format)))
        (tramp-message
         vec 5 "Add proxy (\"%s\" \"%s\" \"%s\")"
-        (and (stringp host) (regexp-quote host))
-        (and (stringp user) (regexp-quote user))
+        (and (stringp host-port) (regexp-quote host-port))
+        (and (stringp user-domain) (regexp-quote user-domain))
         proxy)
        ;; Add the hop.
        (add-to-list
         'tramp-default-proxies-alist
-        (list (and (stringp host) (regexp-quote host))
-              (and (stringp user) (regexp-quote user))
-              proxy))
+        (list (and (stringp host-port) (regexp-quote host-port))
+              (and (stringp user-domain) (regexp-quote user-domain))
+              (propertize proxy 'tramp-ad-hoc t)))
        (setq item (tramp-dissect-file-name proxy))))
     ;; Save the new value.
     (when (and hops tramp-save-ad-hoc-proxies)
@@ -4599,11 +4657,15 @@ Goes through the list `tramp-inline-compress-commands'."
            proxy (eval (nth 2 item)))
       (when (and
             ;; Host.
-            (string-match (or (eval (nth 0 item)) "")
-                          (or (tramp-file-name-host (car target-alist)) ""))
+            (string-match-p
+             (or (eval (nth 0 item)) "")
+             (or (tramp-file-name-host-port (car target-alist))
+                 ""))
             ;; User.
-            (string-match (or (eval (nth 1 item)) "")
-                          (or (tramp-file-name-user (car target-alist)) "")))
+            (string-match-p
+             (or (eval (nth 1 item)) "")
+             (or (tramp-file-name-user-domain (car target-alist))
+                 "")))
        (if (null proxy)
            ;; No more hops needed.
            (setq choices nil)
@@ -4626,9 +4688,9 @@ Goes through the list `tramp-inline-compress-commands'."
       (while (setq item (pop choices))
        (when (or (not (tramp-get-method-parameter item 'tramp-login-program))
                  (tramp-get-method-parameter item 'tramp-copy-program))
-         (tramp-error
-          vec 'file-error
-          "Method `%s' is not supported for multi-hops."
+         (setq tramp-default-proxies-alist saved-tdpa)
+         (tramp-user-error
+          vec "Method `%s' is not supported for multi-hops."
           (tramp-file-name-method item)))))
 
     ;; Some methods ("su", "sg", "sudo", "doas", "ksu") do not use the
@@ -4645,9 +4707,10 @@ Goes through the list `tramp-inline-compress-commands'."
               (member
                '("%h") (tramp-get-method-parameter item 'tramp-login-args))
               ;; The host name must match previous hop.
-              (string-match previous-host host))
+              (string-match-p previous-host host))
+           (setq tramp-default-proxies-alist saved-tdpa)
            (tramp-user-error
-            item "Host name `%s' does not match `%s'" host previous-host))
+            vec "Host name `%s' does not match `%s'" host previous-host))
          (setq previous-host (concat "^" (regexp-quote host) "$")))))
 
     ;; Result.
@@ -4670,7 +4733,7 @@ Goes through the list `tramp-inline-compress-commands'."
        (ignore-errors
          (when (executable-find "ssh")
            (with-tramp-progress-reporter
-               vec 4  "Computing ControlMaster options"
+               vec 4 "Computing ControlMaster options"
              (with-temp-buffer
                (tramp-call-process vec "ssh" nil t nil "-o" "ControlMaster")
                (goto-char (point-min))
@@ -4700,6 +4763,19 @@ Goes through the list `tramp-inline-compress-commands'."
                                  " -o ControlPersist=no")))))))))
       tramp-ssh-controlmaster-options)))
 
+(defun tramp-timeout-session (vec)
+  "Close the connection VEC after a session timeout.
+If there is just some editing, retry it after 5 seconds."
+  (if (and tramp-locked tramp-locker
+          (tramp-file-name-equal-p vec (car tramp-current-connection)))
+      (progn
+       (tramp-message
+        vec 5 "Cannot timeout session, trying it again in %s seconds." 5)
+       (run-at-time 5 nil 'tramp-timeout-session vec))
+    (tramp-message
+     vec 3 "Timeout session %s" (tramp-make-tramp-file-name vec 'localname))
+    (tramp-cleanup-connection vec 'keep-debug)))
+
 (defun tramp-maybe-open-connection (vec)
   "Maybe open a connection VEC.
 Does not do anything if a connection is already open, but re-opens the
@@ -4714,9 +4790,12 @@ connection if a previous connection has died for some 
reason."
     (unless (or (process-live-p p)
                (not (tramp-file-name-equal-p
                      vec (car tramp-current-connection)))
-               (> (tramp-time-diff
-                   (current-time) (cdr tramp-current-connection))
-                  (or tramp-connection-min-time-diff 0)))
+               (time-less-p
+                ;; `current-time' can be removed once we get rid of Emacs 24.
+                (time-since (or (cdr tramp-current-connection) (current-time)))
+                ;; `seconds-to-time' can be removed once we get rid
+                ;; of Emacs 24.
+                (seconds-to-time (or tramp-connection-min-time-diff 0))))
       (throw 'suppress 'suppress))
 
     ;; If too much time has passed since last command was sent, look
@@ -4727,11 +4806,11 @@ connection if a previous connection has died for some 
reason."
     ;; try to send a command from time to time, then look again
     ;; whether the process is really alive.
     (condition-case nil
-       (when (and (> (tramp-time-diff
-                      (current-time)
-                      (tramp-get-connection-property
-                       p "last-cmd-time" '(0 0 0)))
-                     60)
+       ;; `seconds-to-time' can be removed once we get rid of Emacs 24.
+       (when (and (time-less-p (seconds-to-time 60)
+                               (time-since
+                                (tramp-get-connection-property
+                                 p "last-cmd-time" (seconds-to-time 0))))
                   (process-live-p p))
          (tramp-send-command vec "echo are you awake" t t)
          (unless (and (process-live-p p)
@@ -4798,7 +4877,7 @@ connection if a previous connection has died for some 
reason."
                     (p (let ((default-directory
                                (tramp-compat-temporary-file-directory)))
                          (apply
-                          'start-process
+                          #'start-process
                           (tramp-get-connection-name vec)
                           (tramp-get-connection-buffer vec)
                           (if tramp-encoding-command-interactive
@@ -4807,14 +4886,14 @@ connection if a previous connection has died for some 
reason."
                             (list tramp-encoding-shell))))))
 
                ;; Set sentinel and query flag.  Initialize variables.
-               (set-process-sentinel p 'tramp-process-sentinel)
+               (set-process-sentinel p #'tramp-process-sentinel)
                (process-put p 'vector vec)
-               (process-put p 'adjust-window-size-function 'ignore)
+               (process-put p 'adjust-window-size-function #'ignore)
                (set-process-query-on-exit-flag p nil)
                (setq tramp-current-connection (cons vec (current-time)))
 
                (tramp-message
-                vec 6 "%s" (mapconcat 'identity (process-command p) " "))
+                vec 6 "%s" (mapconcat #'identity (process-command p) " "))
 
                ;; Check whether process is alive.
                (tramp-barf-if-no-shell-prompt
@@ -4865,7 +4944,7 @@ connection if a previous connection has died for some 
reason."
 
                    ;; Check, whether there is a restricted shell.
                    (dolist (elt tramp-restricted-shell-hosts-alist)
-                     (when (string-match elt current-host)
+                     (when (string-match-p elt current-host)
                        (setq r-shell t)))
                    (setq current-host l-host)
 
@@ -4876,6 +4955,14 @@ connection if a previous connection has died for some 
reason."
                      :method l-method :user l-user :domain l-domain
                      :host l-host :port l-port))
 
+                   ;; Set session timeout.
+                   (when (tramp-get-method-parameter
+                          hop 'tramp-session-timeout)
+                     (tramp-set-connection-property
+                      p "session-timeout"
+                      (tramp-get-method-parameter
+                       hop 'tramp-session-timeout)))
+
                    ;; Add login environment.
                    (when login-env
                      (setq
@@ -4883,7 +4970,7 @@ connection if a previous connection has died for some 
reason."
                       (mapcar
                        (lambda (x)
                          (setq x (mapcar (lambda (y) (format-spec y spec)) x))
-                         (unless (member "" x) (mapconcat 'identity x " ")))
+                         (unless (member "" x) (mapconcat #'identity x " ")))
                        login-env))
                      (while login-env
                        (setq command
@@ -4912,7 +4999,7 @@ connection if a previous connection has died for some 
reason."
                      (mapconcat
                       (lambda (x)
                         (setq x (mapcar (lambda (y) (format-spec y spec)) x))
-                        (unless (member "" x) (mapconcat 'identity x " ")))
+                        (unless (member "" x) (mapconcat #'identity x " ")))
                       login-args " ")
                      ;; Local shell could be a Windows COMSPEC.  It
                      ;; doesn't know the ";" syntax, but we must exit
@@ -4939,6 +5026,12 @@ connection if a previous connection has died for some 
reason."
                ;; Set connection-local variables.
                (tramp-set-connection-local-variables vec)
 
+               ;; Activate session timeout.
+               (when (tramp-get-connection-property p "session-timeout" nil)
+                 (run-at-time
+                  (tramp-get-connection-property p "session-timeout" nil) nil
+                  'tramp-timeout-session vec))
+
                ;; Make initial shell settings.
                (tramp-open-connection-setup-interactive-shell p vec)
 
@@ -4998,7 +5091,7 @@ function waits for output unless NOOUTPUT is set."
           (regexp1 (format "\\(^\\|\000\\)%s" regexp))
           (found (tramp-wait-for-regexp proc timeout regexp1)))
       (if found
-         (let (buffer-read-only)
+         (let ((inhibit-read-only t))
            ;; A simple-minded busybox has sent " ^H" sequences.
            ;; Delete them.
            (goto-char (point-min))
@@ -5045,7 +5138,7 @@ DONT-SUPPRESS-ERR is non-nil, stderr won't be sent to 
/dev/null."
     (skip-chars-forward "^ ")
     (prog1
        (zerop (read (current-buffer)))
-      (let (buffer-read-only)
+      (let ((inhibit-read-only t))
        (delete-region (match-beginning 0) (point-max))))))
 
 (defun tramp-barf-unless-okay (vec command fmt &rest args)
@@ -5053,7 +5146,7 @@ DONT-SUPPRESS-ERR is non-nil, stderr won't be sent to 
/dev/null."
 Similar to `tramp-send-command-and-check' but accepts two more arguments
 FMT and ARGS which are passed to `error'."
   (or (tramp-send-command-and-check vec command)
-      (apply 'tramp-error vec 'file-error fmt args)))
+      (apply #'tramp-error vec 'file-error fmt args)))
 
 (defun tramp-send-command-and-read (vec command &optional noerror marker)
   "Run COMMAND and return the output, which must be a Lisp expression.
@@ -5061,7 +5154,7 @@ If MARKER is a regexp, read the output after that string.
 In case there is no valid Lisp expression and NOERROR is nil, it
 raises an error."
   (when (if noerror
-           (tramp-send-command-and-check vec command)
+           (ignore-errors (tramp-send-command-and-check vec command))
          (tramp-barf-unless-okay
           vec command "`%s' returns with error" command))
     (with-current-buffer (tramp-get-connection-buffer vec)
@@ -5087,87 +5180,92 @@ raises an error."
                  "`%s' does not return a valid Lisp expression: `%s'"
                  command (buffer-string))))))))
 
+;; FIXME: Move to tramp.el?
+;;;###tramp-autoload
 (defun tramp-convert-file-attributes (vec attr)
   "Convert `file-attributes' ATTR generated by perl script, stat or ls.
 Convert file mode bits to string and set virtual device number.
 Return ATTR."
   (when attr
-    ;; Remove color escape sequences from symlink.
-    (when (stringp (car attr))
-      (while (string-match tramp-display-escape-sequence-regexp (car attr))
-       (setcar attr (replace-match "" nil nil (car attr)))))
-    ;; Convert uid and gid.  Use `tramp-unknown-id-integer' as
-    ;; indication of unusable value.
-    (when (and (numberp (nth 2 attr)) (< (nth 2 attr) 0))
-      (setcar (nthcdr 2 attr) tramp-unknown-id-integer))
-    (when (and (floatp (nth 2 attr))
-               (<= (nth 2 attr) most-positive-fixnum))
-      (setcar (nthcdr 2 attr) (round (nth 2 attr))))
-    (when (and (numberp (nth 3 attr)) (< (nth 3 attr) 0))
-      (setcar (nthcdr 3 attr) tramp-unknown-id-integer))
-    (when (and (floatp (nth 3 attr))
-               (<= (nth 3 attr) most-positive-fixnum))
-      (setcar (nthcdr 3 attr) (round (nth 3 attr))))
-    ;; Convert last access time.
-    (unless (listp (nth 4 attr))
-      (setcar (nthcdr 4 attr) (seconds-to-time (nth 4 attr))))
-    ;; Convert last modification time.
-    (unless (listp (nth 5 attr))
-      (setcar (nthcdr 5 attr) (seconds-to-time (nth 5 attr))))
-    ;; Convert last status change time.
-    (unless (listp (nth 6 attr))
-      (setcar (nthcdr 6 attr) (seconds-to-time (nth 6 attr))))
-    ;; Convert file size.
-    (when (< (nth 7 attr) 0)
-      (setcar (nthcdr 7 attr) -1))
-    (when (and (floatp (nth 7 attr))
-               (<= (nth 7 attr) most-positive-fixnum))
-      (setcar (nthcdr 7 attr) (round (nth 7 attr))))
-    ;; Convert file mode bits to string.
-    (unless (stringp (nth 8 attr))
-      (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr)))
+    (save-match-data
+      ;; Remove color escape sequences from symlink.
       (when (stringp (car attr))
-        (aset (nth 8 attr) 0 ?l)))
-    ;; Convert directory indication bit.
-    (when (string-match "^d" (nth 8 attr))
-      (setcar attr t))
-    ;; Convert symlink from `tramp-do-file-attributes-with-stat'.
-    ;; Decode also multibyte string.
-    (when (consp (car attr))
-      (setcar attr
-             (and (stringp (caar attr))
-                  (string-match ".+ -> .\\(.+\\)." (caar attr))
-                  (decode-coding-string (match-string 1 (caar attr)) 'utf-8))))
-    ;; Set file's gid change bit.
-    (setcar (nthcdr 9 attr)
-            (if (numberp (nth 3 attr))
-                (not (= (nth 3 attr)
-                        (tramp-get-remote-gid vec 'integer)))
-              (not (string-equal
-                    (nth 3 attr)
-                    (tramp-get-remote-gid vec 'string)))))
-    ;; Convert inode.
-    (when (floatp (nth 10 attr))
-      (setcar (nthcdr 10 attr)
-              (condition-case nil
-                  (let ((high (nth 10 attr))
-                        middle low)
-                    (if (<= high most-positive-fixnum)
-                        (floor high)
-                      ;; The low 16 bits.
-                      (setq low (mod high #x10000)
-                            high (/ high #x10000))
+       (while (string-match tramp-display-escape-sequence-regexp (car attr))
+         (setcar attr (replace-match "" nil nil (car attr)))))
+      ;; Convert uid and gid.  Use `tramp-unknown-id-integer' as
+      ;; indication of unusable value.
+      (when (and (numberp (nth 2 attr)) (< (nth 2 attr) 0))
+       (setcar (nthcdr 2 attr) tramp-unknown-id-integer))
+      (when (and (floatp (nth 2 attr))
+                (<= (nth 2 attr) most-positive-fixnum))
+       (setcar (nthcdr 2 attr) (round (nth 2 attr))))
+      (when (and (numberp (nth 3 attr)) (< (nth 3 attr) 0))
+       (setcar (nthcdr 3 attr) tramp-unknown-id-integer))
+      (when (and (floatp (nth 3 attr))
+                (<= (nth 3 attr) most-positive-fixnum))
+       (setcar (nthcdr 3 attr) (round (nth 3 attr))))
+      ;; Convert last access time.
+      (unless (listp (nth 4 attr))
+       (setcar (nthcdr 4 attr) (seconds-to-time (nth 4 attr))))
+      ;; Convert last modification time.
+      (unless (listp (nth 5 attr))
+       (setcar (nthcdr 5 attr) (seconds-to-time (nth 5 attr))))
+      ;; Convert last status change time.
+      (unless (listp (nth 6 attr))
+       (setcar (nthcdr 6 attr) (seconds-to-time (nth 6 attr))))
+      ;; Convert file size.
+      (when (< (nth 7 attr) 0)
+       (setcar (nthcdr 7 attr) -1))
+      (when (and (floatp (nth 7 attr))
+                (<= (nth 7 attr) most-positive-fixnum))
+       (setcar (nthcdr 7 attr) (round (nth 7 attr))))
+      ;; Convert file mode bits to string.
+      (unless (stringp (nth 8 attr))
+       (setcar (nthcdr 8 attr) (tramp-file-mode-from-int (nth 8 attr)))
+       (when (stringp (car attr))
+          (aset (nth 8 attr) 0 ?l)))
+      ;; Convert directory indication bit.
+      (when (string-match-p "^d" (nth 8 attr))
+       (setcar attr t))
+      ;; Convert symlink from `tramp-do-file-attributes-with-stat'.
+      ;; Decode also multibyte string.
+      (when (consp (car attr))
+       (setcar attr
+               (and (stringp (caar attr))
+                    (string-match ".+ -> .\\(.+\\)." (caar attr))
+                    (decode-coding-string
+                     (match-string 1 (caar attr)) 'utf-8))))
+      ;; Set file's gid change bit.
+      (setcar (nthcdr 9 attr)
+              (if (numberp (nth 3 attr))
+                  (not (= (nth 3 attr)
+                          (tramp-get-remote-gid vec 'integer)))
+               (not (string-equal
+                      (nth 3 attr)
+                      (tramp-get-remote-gid vec 'string)))))
+      ;; Convert inode.
+      (when (floatp (nth 10 attr))
+       (setcar (nthcdr 10 attr)
+               (condition-case nil
+                    (let ((high (nth 10 attr))
+                          middle low)
                       (if (<= high most-positive-fixnum)
-                          (cons (floor high) (floor low))
-                        ;; The middle 24 bits.
-                        (setq middle (mod high #x1000000)
-                              high (/ high #x1000000))
-                        (cons (floor high) (cons (floor middle) (floor 
low))))))
-                ;; Inodes can be incredible huge.  We must hide this.
-                (error (tramp-get-inode vec)))))
-    ;; Set virtual device number.
-    (setcar (nthcdr 11 attr)
-            (tramp-get-device vec))
+                          (floor high)
+                       ;; The low 16 bits.
+                       (setq low (mod high #x10000)
+                              high (/ high #x10000))
+                       (if (<= high most-positive-fixnum)
+                            (cons (floor high) (floor low))
+                          ;; The middle 24 bits.
+                          (setq middle (mod high #x1000000)
+                               high (/ high #x1000000))
+                          (cons (floor high)
+                               (cons (floor middle) (floor low))))))
+                  ;; Inodes can be incredible huge.  We must hide this.
+                  (error (tramp-get-inode vec)))))
+      ;; Set virtual device number.
+      (setcar (nthcdr 11 attr)
+              (tramp-get-device vec)))
     attr))
 
 (defun tramp-shell-case-fold (string)
@@ -5187,9 +5285,9 @@ Return ATTR."
        (host (tramp-file-name-host vec))
        (localname
         (directory-file-name (tramp-file-name-unquote-localname vec))))
-    (when (string-match tramp-ipv6-regexp host)
+    (when (string-match-p tramp-ipv6-regexp host)
       (setq host (format "[%s]" host)))
-    (unless (string-match "ftp$" method)
+    (unless (string-match-p "ftp$" method)
       (setq localname (tramp-shell-quote-argument localname)))
     (cond
      ((tramp-get-method-parameter vec 'tramp-remote-copy-program)
@@ -5216,87 +5314,90 @@ Return ATTR."
 (defun tramp-get-remote-path (vec)
   "Compile list of remote directories for $PATH.
 Nonexistent directories are removed from spec."
-  (with-tramp-connection-property
-      ;; When `tramp-own-remote-path' is in `tramp-remote-path', we
-      ;; cache the result for the session only.  Otherwise, the result
-      ;; is cached persistently.
-      (if (memq 'tramp-own-remote-path tramp-remote-path)
-         (tramp-get-connection-process vec)
-       vec)
-      "remote-path"
-    (let* ((remote-path (copy-tree tramp-remote-path))
-          (elt1 (memq 'tramp-default-remote-path remote-path))
-          (elt2 (memq 'tramp-own-remote-path remote-path))
-          (default-remote-path
-            (when elt1
-              (or
-               (tramp-send-command-and-read
-                vec "echo \\\"`getconf PATH 2>/dev/null`\\\"" 'noerror)
-               ;; Default if "getconf" is not available.
-               (progn
-                 (tramp-message
-                  vec 3
-                  "`getconf PATH' not successful, using default value \"%s\"."
-                  "/bin:/usr/bin")
-                 "/bin:/usr/bin"))))
-          (own-remote-path
-           ;; The login shell could return more than just the $PATH
-           ;; string.  So we use `tramp-end-of-heredoc' as marker.
-           (when elt2
-             (or
-              (tramp-send-command-and-read
-               vec
-               (format
-                "%s %s %s 'echo %s \\\"$PATH\\\"'"
-                (tramp-get-method-parameter vec 'tramp-remote-shell)
-                (mapconcat
-                 'identity
-                 (tramp-get-method-parameter vec 'tramp-remote-shell-login)
-                 " ")
-                (mapconcat
-                 'identity
-                 (tramp-get-method-parameter vec 'tramp-remote-shell-args)
-                 " ")
-                (tramp-shell-quote-argument tramp-end-of-heredoc))
-               'noerror (regexp-quote tramp-end-of-heredoc))
-              (progn
-                (tramp-message
-                 vec 2 "Could not retrieve `tramp-own-remote-path'")
-                nil)))))
-
-      ;; Replace place holder `tramp-default-remote-path'.
-      (when elt1
-       (setcdr elt1
-               (append
-                 (split-string (or default-remote-path "") ":" 'omit)
-                (cdr elt1)))
-       (setq remote-path (delq 'tramp-default-remote-path remote-path)))
-
-      ;; Replace place holder `tramp-own-remote-path'.
-      (when elt2
-       (setcdr elt2
-               (append
-                 (split-string (or own-remote-path "") ":" 'omit)
-                (cdr elt2)))
-       (setq remote-path (delq 'tramp-own-remote-path remote-path)))
-
-      ;; Remove double entries.
-      (setq elt1 remote-path)
-      (while (consp elt1)
-       (while (and (car elt1) (setq elt2 (member (car elt1) (cdr elt1))))
-         (setcar elt2 nil))
-       (setq elt1 (cdr elt1)))
-
-      ;; Remove non-existing directories.
-      (delq
-       nil
-       (mapcar
-       (lambda (x)
-         (and
-          (stringp x)
-          (file-directory-p (tramp-make-tramp-file-name vec x 'nohop))
-          x))
-       remote-path)))))
+  (with-current-buffer (tramp-get-connection-buffer vec)
+    ;; Expand connection-local variables.
+    (tramp-set-connection-local-variables vec)
+    (with-tramp-connection-property
+       ;; When `tramp-own-remote-path' is in `tramp-remote-path', we
+       ;; cache the result for the session only.  Otherwise, the
+       ;; result is cached persistently.
+       (if (memq 'tramp-own-remote-path tramp-remote-path)
+           (tramp-get-connection-process vec)
+         vec)
+       "remote-path"
+      (let* ((remote-path (copy-tree tramp-remote-path))
+            (elt1 (memq 'tramp-default-remote-path remote-path))
+            (elt2 (memq 'tramp-own-remote-path remote-path))
+            (default-remote-path
+              (when elt1
+                (or
+                 (tramp-send-command-and-read
+                  vec "echo \\\"`getconf PATH 2>/dev/null`\\\"" 'noerror)
+                 ;; Default if "getconf" is not available.
+                 (progn
+                   (tramp-message
+                    vec 3
+                    "`getconf PATH' not successful, using default value 
\"%s\"."
+                    "/bin:/usr/bin")
+                   "/bin:/usr/bin"))))
+            (own-remote-path
+             ;; The login shell could return more than just the $PATH
+             ;; string.  So we use `tramp-end-of-heredoc' as marker.
+             (when elt2
+               (or
+                (tramp-send-command-and-read
+                 vec
+                 (format
+                  "%s %s %s 'echo %s \\\"$PATH\\\"'"
+                  (tramp-get-method-parameter vec 'tramp-remote-shell)
+                  (mapconcat
+                   #'identity
+                   (tramp-get-method-parameter vec 'tramp-remote-shell-login)
+                   " ")
+                  (mapconcat
+                   #'identity
+                   (tramp-get-method-parameter vec 'tramp-remote-shell-args)
+                   " ")
+                  (tramp-shell-quote-argument tramp-end-of-heredoc))
+                 'noerror (regexp-quote tramp-end-of-heredoc))
+                (progn
+                  (tramp-message
+                   vec 2 "Could not retrieve `tramp-own-remote-path'")
+                  nil)))))
+
+       ;; Replace place holder `tramp-default-remote-path'.
+       (when elt1
+         (setcdr elt1
+                 (append
+                   (split-string (or default-remote-path "") ":" 'omit)
+                  (cdr elt1)))
+         (setq remote-path (delq 'tramp-default-remote-path remote-path)))
+
+       ;; Replace place holder `tramp-own-remote-path'.
+       (when elt2
+         (setcdr elt2
+                 (append
+                   (split-string (or own-remote-path "") ":" 'omit)
+                  (cdr elt2)))
+         (setq remote-path (delq 'tramp-own-remote-path remote-path)))
+
+       ;; Remove double entries.
+       (setq elt1 remote-path)
+       (while (consp elt1)
+         (while (and (car elt1) (setq elt2 (member (car elt1) (cdr elt1))))
+           (setcar elt2 nil))
+         (setq elt1 (cdr elt1)))
+
+       ;; Remove non-existing directories.
+       (delq
+        nil
+        (mapcar
+         (lambda (x)
+           (and
+            (stringp x)
+            (file-directory-p (tramp-make-tramp-file-name vec x 'nohop))
+            x))
+         remote-path))))))
 
 (defun tramp-get-remote-locale (vec)
   "Determine remote locale, supporting UTF8 if possible."
@@ -5307,8 +5408,8 @@ Nonexistent directories are removed from spec."
       (with-current-buffer (tramp-get-connection-buffer vec)
        (while candidates
          (goto-char (point-min))
-         (if (string-match (format "^%s\r?$" (regexp-quote (car candidates)))
-                           (buffer-string))
+         (if (string-match-p (format "^%s\r?$" (regexp-quote (car candidates)))
+                             (buffer-string))
              (setq locale (car candidates)
                    candidates nil)
            (setq candidates (cdr candidates)))))
@@ -5379,7 +5480,7 @@ Nonexistent directories are removed from spec."
        vec (format "( %s / -nt / )" (tramp-get-test-command vec)))
        (with-current-buffer (tramp-get-buffer vec)
         (goto-char (point-min))
-        (when (looking-at (regexp-quote tramp-end-of-output))
+        (when (looking-at-p (regexp-quote tramp-end-of-output))
           (format "%s %%s -nt %%s" (tramp-get-test-command vec)))))
      (progn
        (tramp-send-command
@@ -5441,7 +5542,7 @@ Nonexistent directories are removed from spec."
              tmp (tramp-send-command-and-read
                   vec (format "%s -c '(\"%%N\" %%s)' /" result) 'noerror))
        (unless (and (listp tmp) (stringp (car tmp))
-                    (string-match "^\\(`/'\\|‘/’\\)$" (car tmp))
+                    (string-match-p "^\\(`/'\\|‘/’\\)$" (car tmp))
                     (integerp (cadr tmp)))
          (setq result nil)))
       result)))
@@ -5486,7 +5587,7 @@ This command is returned only if 
`delete-by-moving-to-trash' is non-nil."
           "%s -t %s %s"
           result
           (format-time-string "%Y%m%d%H%M.%S")
-          (file-remote-p tmpfile 'localname))))
+          (tramp-compat-file-local-name tmpfile))))
        (delete-file tmpfile))
       result)))
 
@@ -5494,12 +5595,24 @@ This command is returned only if 
`delete-by-moving-to-trash' is non-nil."
   "Determine remote `df' command."
   (with-tramp-connection-property vec "df"
     (tramp-message vec 5 "Finding a suitable `df' command")
-    (let ((result (tramp-find-executable vec "df" (tramp-get-remote-path 
vec))))
-      (and
-       result
-       (tramp-send-command-and-check
-       vec (format "%s --block-size=1 --output=size,used,avail /" result))
-       result))))
+    (let ((df (tramp-find-executable vec "df" (tramp-get-remote-path vec)))
+         result)
+      (when df
+       (cond
+        ;; coreutils.
+        ((tramp-send-command-and-check
+          vec
+          (format
+           "%s /"
+           (setq result
+                 (format "%s --block-size=1 --output=size,used,avail" df))))
+         (tramp-set-connection-property vec "df-blocksize" 1)
+         result)
+        ;; POSIX.1
+        ((tramp-send-command-and-check
+          vec (format "%s /" (setq result (format "%s -k" df))))
+         (tramp-set-connection-property vec "df-blocksize" 1024)
+         result))))))
 
 (defun tramp-get-remote-gio-monitor (vec)
   "Determine remote `gio-monitor' command."
@@ -5575,7 +5688,7 @@ This command is returned only if 
`delete-by-moving-to-trash' is non-nil."
           (tramp-get-remote-python vec)
           (if (equal id-format 'integer)
               "import os; print (os.getuid())"
-            "import os, pwd; print ('\\\"' + pwd.getpwuid(os.getuid())[0] + 
'\\\"')"))))
+    "import os, pwd; print ('\\\"' + pwd.getpwuid(os.getuid())[0] + 
'\\\"')"))))
 
 (defun tramp-get-remote-uid (vec id-format)
   "The uid of the remote connection VEC, in ID-FORMAT.
@@ -5626,7 +5739,7 @@ ID-FORMAT valid values are `string' and `integer'."
           (tramp-get-remote-python vec)
           (if (equal id-format 'integer)
               "import os; print (os.getgid())"
-            "import os, grp; print ('\\\"' + grp.getgrgid(os.getgid())[0] + 
'\\\"')"))))
+    "import os, grp; print ('\\\"' + grp.getgrgid(os.getgid())[0] + 
'\\\"')"))))
 
 (defun tramp-get-remote-gid (vec id-format)
   "The gid of the remote connection VEC, in ID-FORMAT.
@@ -5692,14 +5805,14 @@ function cell is returned to be applied on a buffer."
             (tramp-find-inline-encoding vec)
             (tramp-get-connection-property
              (tramp-get-connection-process vec) prop nil)))
-         (prop1 (if (string-match "encoding" prop)
+         (prop1 (if (string-match-p "encoding" prop)
                     "inline-compress" "inline-decompress"))
          compress)
       ;; The connection property might have been cached.  So we must
       ;; send the script to the remote side - maybe.
-      (when (and coding (symbolp coding) (string-match "remote" prop))
+      (when (and coding (symbolp coding) (string-match-p "remote" prop))
        (let ((name (symbol-name coding)))
-         (while (string-match (regexp-quote "-") name)
+         (while (string-match "-" name)
            (setq name (replace-match "_" nil t name)))
          (tramp-maybe-send-script vec (symbol-value coding) name)
          (setq coding name)))
@@ -5709,35 +5822,35 @@ function cell is returned to be applied on a buffer."
        ;; Return the value.
        (cond
         ((and compress (symbolp coding))
-         (if (string-match "decompress" prop1)
+         (if (string-match-p "decompress" prop1)
              `(lambda (beg end)
                 (,coding beg end)
                 (let ((coding-system-for-write 'binary)
                       (coding-system-for-read 'binary))
                   (apply
-                   'tramp-call-process-region ',vec (point-min) (point-max)
+                   #'tramp-call-process-region ',vec (point-min) (point-max)
                    (car (split-string ,compress)) t t nil
                    (cdr (split-string ,compress)))))
            `(lambda (beg end)
               (let ((coding-system-for-write 'binary)
                     (coding-system-for-read 'binary))
                 (apply
-                 'tramp-call-process-region ',vec beg end
+                 #'tramp-call-process-region ',vec beg end
                  (car (split-string ,compress)) t t nil
                  (cdr (split-string ,compress))))
               (,coding (point-min) (point-max)))))
         ((symbolp coding)
          coding)
-        ((and compress (string-match "decoding" prop))
+        ((and compress (string-match-p "decoding" prop))
          (format
           ;; Windows shells need the program file name after
           ;; the pipe symbol be quoted if they use forward
           ;; slashes as directory separators.
           (cond
-           ((and (string-match "local" prop)
+           ((and (string-match-p "local" prop)
                  (memq system-type '(windows-nt)))
               "(%s | \"%s\")")
-           ((string-match "local" prop) "(%s | %s)")
+           ((string-match-p "local" prop) "(%s | %s)")
            (t "(%s | %s >%%s)"))
           coding compress))
         (compress
@@ -5745,14 +5858,14 @@ function cell is returned to be applied on a buffer."
           ;; Windows shells need the program file name after
           ;; the pipe symbol be quoted if they use forward
           ;; slashes as directory separators.
-          (if (and (string-match "local" prop)
+          (if (and (string-match-p "local" prop)
                    (memq system-type '(windows-nt)))
               "(%s <%%s | \"%s\")"
             "(%s <%%s | %s)")
           compress coding))
-        ((string-match "decoding" prop)
+        ((string-match-p "decoding" prop)
          (cond
-          ((string-match "local" prop) (format "%s" coding))
+          ((string-match-p "local" prop) (format "%s" coding))
           (t (format "%s >%%s" coding))))
         (t
          (format "%s <%%s" coding)))))))
@@ -5776,10 +5889,6 @@ function cell is returned to be applied on a buffer."
 ;;   gets confused about the file locking status.  Try to find out why
 ;;   the workaround doesn't work.
 ;;
-;; * Allow out-of-band methods as _last_ multi-hop.  Open a connection
-;;   until the last but one hop via `start-file-process'.  Apply it
-;;   also for ftp and smb.
-;;
 ;; * WIBNI if we had a command "trampclient"?  If I was editing in
 ;;   some shell with root privileges, it would be nice if I could
 ;;   just call
@@ -5853,5 +5962,9 @@ function cell is returned to be applied on a buffer."
 ;;   which could immediately be passed on to the remote side, and
 ;;   later on checks the return value of those calls as and when
 ;;   needed.  (Stefan Monnier)
+;;
+;; * Implement detaching/re-attaching remote sessions.  By this, a
+;;   session could be reused after a connection loss.  Use dtach, or
+;;   screen, or tmux, or mosh.
 
 ;;; tramp-sh.el ends here
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index a97b801..6647630 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -1,6 +1,6 @@
 ;;; tramp-smb.el --- Tramp access functions for SMB servers  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 ;; Keywords: comm, processes
@@ -38,45 +38,39 @@
 ;; ... and add it to the method list.
 ;;;###tramp-autoload
 (unless (memq system-type '(cygwin windows-nt))
-  (add-to-list 'tramp-methods
-    `(,tramp-smb-method
-      ;; We define an empty command, because `tramp-smb-call-winexe'
-      ;; opens already the powershell.  Used in `tramp-handle-shell-command'.
-      (tramp-remote-shell "")
-      ;; This is just a guess.  We don't know whether the share "C$"
-      ;; is available for public use, and whether the user has write
-      ;; access.
-      (tramp-tmpdir "/C$/Temp")
-      ;; Another guess.  We might implement a better check later on.
-      (tramp-case-insensitive t))))
+  (tramp--with-startup
+   (add-to-list 'tramp-methods
+                `(,tramp-smb-method
+                  ;; This is just a guess.  We don't know whether the share 
"C$"
+                  ;; is available for public use, and whether the user has 
write
+                  ;; access.
+                  (tramp-tmpdir "/C$/Temp")
+                  ;; Another guess.  We might implement a better check later 
on.
+                  (tramp-case-insensitive t)))))
 
 ;; Add a default for `tramp-default-user-alist'. Rule: For the SMB method,
 ;; the anonymous user is chosen.
 ;;;###tramp-autoload
-(add-to-list 'tramp-default-user-alist
-            `(,(concat "\\`" tramp-smb-method "\\'") nil nil))
+(tramp--with-startup
+ (add-to-list 'tramp-default-user-alist
+             `(,(concat "\\`" tramp-smb-method "\\'") nil nil))
 
-;; Add completion function for SMB method.
-;;;###tramp-autoload
-(eval-after-load 'tramp
-  '(tramp-set-completion-function
-    tramp-smb-method
-    '((tramp-parse-netrc "~/.netrc"))))
+ ;; Add completion function for SMB method.
+ (tramp-set-completion-function
+  tramp-smb-method
+  '((tramp-parse-netrc "~/.netrc"))))
 
-;;;###tramp-autoload
 (defcustom tramp-smb-program "smbclient"
   "Name of SMB client to run."
   :group 'tramp
   :type 'string)
 
-;;;###tramp-autoload
 (defcustom tramp-smb-acl-program "smbcacls"
   "Name of SMB acls to run."
   :group 'tramp
   :type 'string
   :version "24.4")
 
-;;;###tramp-autoload
 (defcustom tramp-smb-conf "/dev/null"
   "Path of the smb.conf file.
 If it is nil, no smb.conf will be added to the `tramp-smb-program'
@@ -102,7 +96,7 @@ call, letting the SMB client use the default one."
 
 (defconst tramp-smb-errors
   (mapconcat
-   'identity
+   #'identity
    `(;; Connection error / timeout / unknown command.
      "Connection\\( to \\S-+\\)? failed"
      "Read from server failed, maybe it closed the connection"
@@ -146,6 +140,7 @@ call, letting the SMB client use the default one."
         "NT_STATUS_NO_LOGON_SERVERS"
         "NT_STATUS_NO_SUCH_FILE"
         "NT_STATUS_NO_SUCH_USER"
+        "NT_STATUS_NOT_A_DIRECTORY"
         "NT_STATUS_OBJECT_NAME_COLLISION"
         "NT_STATUS_OBJECT_NAME_INVALID"
         "NT_STATUS_OBJECT_NAME_NOT_FOUND"
@@ -215,7 +210,7 @@ See `tramp-actions-before-shell' for more info.")
 ;; New handlers should be added here.
 ;;;###tramp-autoload
 (defconst tramp-smb-file-name-handler-alist
-  '(;; `access-file' performed by default handler.
+  '((access-file . tramp-handle-access-file)
     (add-name-to-file . tramp-smb-handle-add-name-to-file)
     ;; `byte-compiler-base-file-name' performed by default handler.
     (copy-directory . tramp-smb-handle-copy-directory)
@@ -262,7 +257,6 @@ See `tramp-actions-before-shell' for more info.")
     (file-truename . tramp-handle-file-truename)
     (file-writable-p . tramp-smb-handle-file-writable-p)
     (find-backup-file-name . tramp-handle-find-backup-file-name)
-    ;; `find-file-noselect' performed by default handler.
     ;; `get-file-buffer' performed by default handler.
     (insert-directory . tramp-smb-handle-insert-directory)
     (insert-file-contents . tramp-handle-insert-file-contents)
@@ -271,6 +265,7 @@ See `tramp-actions-before-shell' for more info.")
     (make-directory . tramp-smb-handle-make-directory)
     (make-directory-internal . tramp-smb-handle-make-directory-internal)
     (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
+    (make-process . ignore)
     (make-symbolic-link . tramp-smb-handle-make-symbolic-link)
     (process-file . tramp-smb-handle-process-file)
     (rename-file . tramp-smb-handle-rename-file)
@@ -283,6 +278,7 @@ See `tramp-actions-before-shell' for more info.")
     (start-file-process . tramp-smb-handle-start-file-process)
     (substitute-in-file-name . tramp-smb-handle-substitute-in-file-name)
     (temporary-file-directory . tramp-handle-temporary-file-directory)
+    (tramp-set-file-uid-gid . ignore)
     (unhandled-file-name-directory . ignore)
     (vc-registered . ignore)
     (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
@@ -291,7 +287,6 @@ See `tramp-actions-before-shell' for more info.")
 Operations not mentioned here will be handled by the default Emacs 
primitives.")
 
 ;; Options for remote processes via winexe.
-;;;###tramp-autoload
 (defcustom tramp-smb-winexe-program "winexe"
   "Name of winexe client to run.
 If it isn't found in the local $PATH, the absolute path of winexe
@@ -300,7 +295,6 @@ shall be given.  This is needed for remote processes."
   :type 'string
   :version "24.3")
 
-;;;###tramp-autoload
 (defcustom tramp-smb-winexe-shell-command "powershell.exe"
   "Shell to be used for processes on remote machines.
 This must be Powershell V2 compatible."
@@ -308,7 +302,6 @@ This must be Powershell V2 compatible."
   :type 'string
   :version "24.3")
 
-;;;###tramp-autoload
 (defcustom tramp-smb-winexe-shell-command-switch "-file -"
   "Command switch used together with `tramp-smb-winexe-shell-command'.
 This can be used to disable echo etc."
@@ -321,8 +314,9 @@ This can be used to disable echo etc."
 ;;;###tramp-autoload
 (defsubst tramp-smb-file-name-p (filename)
   "Check if it's a filename for SMB servers."
-  (string= (tramp-file-name-method (tramp-dissect-file-name filename))
-          tramp-smb-method))
+  (and (tramp-tramp-file-p filename)
+       (string= (tramp-file-name-method (tramp-dissect-file-name filename))
+               tramp-smb-method)))
 
 ;;;###tramp-autoload
 (defun tramp-smb-file-name-handler (operation &rest args)
@@ -336,8 +330,9 @@ pass to the OPERATION."
 
 ;;;###tramp-autoload
 (unless (memq system-type '(cygwin windows-nt))
-  (tramp-register-foreign-file-name-handler
-   'tramp-smb-file-name-p 'tramp-smb-file-name-handler))
+  (tramp--with-startup
+   (tramp-register-foreign-file-name-handler
+    #'tramp-smb-file-name-p #'tramp-smb-file-name-handler)))
 
 ;; File name primitives.
 
@@ -406,7 +401,7 @@ pass to the OPERATION."
   (if copy-contents
       ;; We must do it file-wise.
       (tramp-run-real-handler
-       'copy-directory (list dirname newname keep-date parents copy-contents))
+       #'copy-directory (list dirname newname keep-date parents copy-contents))
 
     (setq dirname (expand-file-name dirname)
          newname (expand-file-name newname))
@@ -512,15 +507,15 @@ pass to the OPERATION."
                    ;; password can be handled.
                    (let* ((default-directory tmpdir)
                           (p (apply
-                              'start-process
+                              #'start-process
                               (tramp-get-connection-name v)
                               (tramp-get-connection-buffer v)
                               tramp-smb-program args)))
 
                      (tramp-message
-                      v 6 "%s" (mapconcat 'identity (process-command p) " "))
+                      v 6 "%s" (mapconcat #'identity (process-command p) " "))
                      (process-put p 'vector v)
-                     (process-put p 'adjust-window-size-function 'ignore)
+                     (process-put p 'adjust-window-size-function #'ignore)
                      (set-process-query-on-exit-flag p nil)
                      (tramp-process-actions p v nil tramp-smb-actions-with-tar)
 
@@ -553,7 +548,7 @@ pass to the OPERATION."
           ;; We must do it file-wise.
           (t
            (tramp-run-real-handler
-            'copy-directory (list dirname newname keep-date parents)))))))))
+            #'copy-directory (list dirname newname keep-date parents)))))))))
 
 (defun tramp-smb-handle-copy-file
   (filename newname &optional ok-if-already-exists keep-date
@@ -671,13 +666,13 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
 (defun tramp-smb-handle-directory-files
   (directory &optional full match nosort)
   "Like `directory-files' for Tramp files."
-  (let ((result (mapcar 'directory-file-name
+  (let ((result (mapcar #'directory-file-name
                        (file-name-all-completions "" directory))))
     ;; Discriminate with regexp.
     (when match
       (setq result
            (delete nil
-                   (mapcar (lambda (x) (when (string-match match x) x))
+                   (mapcar (lambda (x) (when (string-match-p match x) x))
                            result))))
     ;; Append directory.
     (when full
@@ -686,19 +681,21 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
             (lambda (x) (format "%s/%s" directory x))
             result)))
     ;; Sort them if necessary.
-    (unless nosort (setq result (sort result 'string-lessp)))
+    (unless nosort (setq result (sort result #'string-lessp)))
     result))
 
 (defun tramp-smb-handle-expand-file-name (name &optional dir)
   "Like `expand-file-name' for Tramp files."
   ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
   (setq dir (or dir default-directory "/"))
+  ;; Handle empty NAME.
+  (when (zerop (length name)) (setq name "."))
   ;; Unless NAME is absolute, concat DIR and NAME.
   (unless (file-name-absolute-p name)
     (setq name (concat (file-name-as-directory dir) name)))
   ;; If NAME is not a Tramp file, run the real handler.
   (if (not (tramp-tramp-file-p name))
-      (tramp-run-real-handler 'expand-file-name (list name nil))
+      (tramp-run-real-handler #'expand-file-name (list name nil))
     ;; Dissect NAME.
     (with-parsed-tramp-file-name name nil
       ;; Tilde expansion if necessary.  We use the user name as share,
@@ -711,27 +708,27 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
                 (match-string 1 localname))
               nil nil localname)))
       ;; Make the file name absolute.
-      (unless (tramp-run-real-handler 'file-name-absolute-p (list localname))
+      (unless (tramp-run-real-handler #'file-name-absolute-p (list localname))
        (setq localname (concat "/" localname)))
       ;; No tilde characters in file name, do normal
       ;; `expand-file-name' (this does "/./" and "/../").
       (tramp-make-tramp-file-name
-       v (tramp-run-real-handler 'expand-file-name (list localname))))))
+       v (tramp-run-real-handler #'expand-file-name (list localname))))))
 
 (defun tramp-smb-action-get-acl (proc vec)
   "Read ACL data from connection buffer."
   (unless (process-live-p proc)
     ;; Accept pending output.
-    (while (tramp-accept-process-output proc 0.1))
+    (while (tramp-accept-process-output proc))
     (with-current-buffer (tramp-get-connection-buffer vec)
       ;; There might be a hidden password prompt.
       (widen)
       (tramp-message vec 10 "\n%s" (buffer-string))
       (goto-char (point-min))
-      (while (and (not (eobp)) (not (looking-at "^REVISION:")))
+      (while (and (not (eobp)) (not (looking-at-p "^REVISION:")))
        (forward-line)
        (delete-region (point-min) (point)))
-      (while (and (not (eobp)) (looking-at "^.+:.+"))
+      (while (and (not (eobp)) (looking-at-p "^.+:.+"))
        (forward-line))
       (delete-region (point) (point-max))
       (throw 'tramp-action 'ok))))
@@ -773,15 +770,15 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
                  ;; Use an asynchronous process.  By this, password can
                  ;; be handled.
                  (let ((p (apply
-                           'start-process
+                           #'start-process
                            (tramp-get-connection-name v)
                            (tramp-get-connection-buffer v)
                            tramp-smb-acl-program args)))
 
                    (tramp-message
-                    v 6 "%s" (mapconcat 'identity (process-command p) " "))
+                    v 6 "%s" (mapconcat #'identity (process-command p) " "))
                    (process-put p 'vector v)
-                   (process-put p 'adjust-window-size-function 'ignore)
+                   (process-put p 'adjust-window-size-function #'ignore)
                    (set-process-query-on-exit-flag p nil)
                    (tramp-process-actions p v nil tramp-smb-actions-get-acl)
                    (when (> (point-max) (point-min))
@@ -816,7 +813,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
 
            ;; Check result.
            (when entry
-             (list (and (string-match "d" (nth 1 entry))
+             (list (and (string-match-p "d" (nth 1 entry))
                         t)              ;0 file type
                    -1                   ;1 link count
                    uid                  ;2 uid
@@ -933,15 +930,14 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
    filename
    (with-parsed-tramp-file-name (expand-file-name directory) nil
      (with-tramp-file-property v localname "file-name-all-completions"
-       (save-match-data
-        (delete-dups
-         (mapcar
-          (lambda (x)
-            (list
-             (if (string-match "d" (nth 1 x))
-                 (file-name-as-directory (nth 0 x))
-               (nth 0 x))))
-          (tramp-smb-get-file-entries directory))))))))
+       (delete-dups
+       (mapcar
+        (lambda (x)
+          (list
+           (if (string-match-p "d" (nth 1 x))
+               (file-name-as-directory (nth 0 x))
+             (nth 0 x))))
+        (tramp-smb-get-file-entries directory)))))))
 
 (defun tramp-smb-handle-file-system-info (filename)
   "Like `file-system-info' for Tramp files."
@@ -956,9 +952,10 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
          (goto-char (point-min))
          (forward-line)
          (when (looking-at
-                (concat "[[:space:]]*\\([[:digit:]]+\\)"
-                        " blocks of size \\([[:digit:]]+\\)"
-                        "\\. \\([[:digit:]]+\\) blocks available"))
+                (eval-when-compile
+                  (concat "[[:space:]]*\\([[:digit:]]+\\)"
+                          " blocks of size \\([[:digit:]]+\\)"
+                          "\\. \\([[:digit:]]+\\) blocks available")))
            (setq blocksize (string-to-number (match-string 2))
                  total (* blocksize (string-to-number (match-string 1)))
                  avail (* blocksize (string-to-number (match-string 3)))))
@@ -975,7 +972,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
 (defun tramp-smb-handle-file-writable-p (filename)
   "Like `file-writable-p' for Tramp files."
   (if (file-exists-p filename)
-      (string-match
+      (string-match-p
        "w"
        (or (tramp-compat-file-attribute-modes (file-attributes filename)) ""))
     (let ((dir (file-name-directory filename)))
@@ -995,6 +992,9 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
       ;; Called from `dired-add-entry'.
       (setq filename (file-name-as-directory filename))
     (setq filename (directory-file-name filename)))
+  ;; Check, whether directory is accessible.
+  (unless wildcard
+    (access-file filename "Reading directory"))
   (with-parsed-tramp-file-name filename nil
     (with-tramp-progress-reporter v 0 (format "Opening directory %s" filename)
       (save-match-data
@@ -1027,7 +1027,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
                     ;; Check for matching entries.
                     (mapcar
                      (lambda (x)
-                       (when (string-match
+                       (when (string-match-p
                               (format "^%s" base) (nth 0 x))
                          x))
                      entries)
@@ -1039,17 +1039,17 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
                (sort
                 entries
                 (lambda (x y)
-                  (if (string-match "t" switches)
+                  (if (string-match-p "t" switches)
                       ;; Sort by date.
                       (time-less-p (nth 3 y) (nth 3 x))
                     ;; Sort by name.
                     (string-lessp (nth 0 x) (nth 0 y))))))
 
          ;; Handle "-F" switch.
-         (when (string-match "F" switches)
+         (when (string-match-p "F" switches)
            (mapc
             (lambda (x)
-              (when (not (zerop (length (car x))))
+              (unless (zerop (length (car x)))
                 (cond
                  ((char-equal ?d (string-to-char (nth 1 x)))
                   (setcar x (concat (car x) "/")))
@@ -1067,7 +1067,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
          ;; Print entries.
          (mapc
           (lambda (x)
-            (when (not (zerop (length (nth 0 x))))
+            (unless (zerop (length (nth 0 x)))
               (let ((attr
                      (when (tramp-smb-get-stat-capability v)
                        (ignore-errors
@@ -1075,7 +1075,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
                           (expand-file-name
                            (nth 0 x) (file-name-directory filename))
                           'string)))))
-                (when (string-match "l" switches)
+                (when (string-match-p "l" switches)
                   (insert
                    (format
                     "%10s %3d %-8s %-8s %8s %s "
@@ -1089,7 +1089,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
                           ;; Half a year.
                           (time-since (nth 3 x)) (days-to-time 183))
                          "%b %e %R"
-                       "%b %e  %Y")
+                       "%b %e %Y")
                      (nth 3 x))))) ; date
 
                 ;; We mark the file name.  The inserted name could be
@@ -1106,7 +1106,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
                   (put-text-property start (point) 'dired-filename t))
 
                 ;; Insert symlink.
-                (when (and (string-match "l" switches)
+                (when (and (string-match-p "l" switches)
                            (stringp (tramp-compat-file-attribute-type attr)))
                   (insert " -> " (tramp-compat-file-attribute-type attr))))
 
@@ -1121,18 +1121,17 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
   (unless (file-name-absolute-p dir)
     (setq dir (expand-file-name dir default-directory)))
   (with-parsed-tramp-file-name dir nil
-    (save-match-data
-      (let* ((ldir (file-name-directory dir)))
-       ;; Make missing directory parts.
-       (when (and parents
-                  (tramp-smb-get-share v)
-                  (not (file-directory-p ldir)))
-         (make-directory ldir parents))
-       ;; Just do it.
-       (when (file-directory-p ldir)
-         (make-directory-internal dir))
-       (unless (file-directory-p dir)
-         (tramp-error v 'file-error "Couldn't make directory %s" dir))))))
+    (let* ((ldir (file-name-directory dir)))
+      ;; Make missing directory parts.
+      (when (and parents
+                (tramp-smb-get-share v)
+                (not (file-directory-p ldir)))
+       (make-directory ldir parents))
+      ;; Just do it.
+      (when (file-directory-p ldir)
+       (make-directory-internal dir))
+      (unless (file-directory-p dir)
+       (tramp-error v 'file-error "Couldn't make directory %s" dir)))))
 
 (defun tramp-smb-handle-make-directory-internal (directory)
   "Like `make-directory-internal' for Tramp files."
@@ -1140,21 +1139,19 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are 
completely ignored."
   (unless (file-name-absolute-p directory)
     (setq directory (expand-file-name directory default-directory)))
   (with-parsed-tramp-file-name directory nil
-    (save-match-data
-      (let* ((file (tramp-smb-get-localname v)))
-       (when (file-directory-p (file-name-directory directory))
-         (tramp-smb-send-command
-          v
-          (if (tramp-smb-get-cifs-capabilities v)
-              (format "posix_mkdir \"%s\" %o" file (default-file-modes))
-            (format "mkdir \"%s\"" file)))
-         ;; We must also flush the cache of the directory, because
-         ;; `file-attributes' reads the values from there.
-         (tramp-flush-file-properties v (file-name-directory localname))
-         (tramp-flush-file-properties v localname))
-       (unless (file-directory-p directory)
-         (tramp-error
-          v 'file-error "Couldn't make directory %s" directory))))))
+    (let* ((file (tramp-smb-get-localname v)))
+      (when (file-directory-p (file-name-directory directory))
+       (tramp-smb-send-command
+        v
+        (if (tramp-smb-get-cifs-capabilities v)
+            (format "posix_mkdir \"%s\" %o" file (default-file-modes))
+          (format "mkdir \"%s\"" file)))
+       ;; We must also flush the cache of the directory, because
+       ;; `file-attributes' reads the values from there.
+       (tramp-flush-file-properties v (file-name-directory localname))
+       (tramp-flush-file-properties v localname))
+      (unless (file-directory-p directory)
+       (tramp-error v 'file-error "Couldn't make directory %s" directory)))))
 
 (defun tramp-smb-handle-make-symbolic-link
   (target linkname &optional ok-if-already-exists)
@@ -1164,7 +1161,7 @@ of the symlink.  If TARGET is a Tramp file, only the 
localname
 component is used as the target of the symlink."
   (if (not (tramp-tramp-file-p (expand-file-name linkname)))
       (tramp-run-real-handler
-       'make-symbolic-link (list target linkname ok-if-already-exists))
+       #'make-symbolic-link (list target linkname ok-if-already-exists))
 
     (with-parsed-tramp-file-name linkname nil
       ;; If TARGET is a Tramp name, use just the localname component.
@@ -1263,7 +1260,7 @@ component is used as the target of the symlink."
        (setq outbuf (current-buffer))))
 
       ;; Construct command.
-      (setq command (mapconcat 'identity (cons program args) " ")
+      (setq command (mapconcat #'identity (cons program args) " ")
            command (if input
                        (format
                         "get-content %s | & %s"
@@ -1378,10 +1375,10 @@ component is used as the target of the symlink."
        (delete-file filename)))))
 
 (defun tramp-smb-action-set-acl (proc vec)
-  "Read ACL data from connection buffer."
+  "Set ACL data."
   (unless (process-live-p proc)
     ;; Accept pending output.
-    (while (tramp-accept-process-output proc 0.1))
+    (while (tramp-accept-process-output proc))
     (with-current-buffer (tramp-get-connection-buffer vec)
       (tramp-message vec 10 "\n%s" (buffer-string))
       (throw 'tramp-action 'ok))))
@@ -1427,15 +1424,15 @@ component is used as the target of the symlink."
                ;; Use an asynchronous process.  By this, password can
                ;; be handled.
                (let ((p (apply
-                         'start-process
+                         #'start-process
                          (tramp-get-connection-name v)
                          (tramp-get-connection-buffer v)
                          tramp-smb-acl-program args)))
 
                  (tramp-message
-                  v 6 "%s" (mapconcat 'identity (process-command p) " "))
+                  v 6 "%s" (mapconcat #'identity (process-command p) " "))
                  (process-put p 'vector v)
-                 (process-put p 'adjust-window-size-function 'ignore)
+                 (process-put p 'adjust-window-size-function #'ignore)
                  (set-process-query-on-exit-flag p nil)
                  (tramp-process-actions p v nil tramp-smb-actions-set-acl)
                  (goto-char (point-max))
@@ -1477,7 +1474,7 @@ component is used as the target of the symlink."
                (get-buffer-create buffer)
              ;; BUFFER can be nil.  We use a temporary buffer.
              (generate-new-buffer tramp-temp-buffer-name)))
-          (command (mapconcat 'identity (cons program args) " "))
+          (command (mapconcat #'identity (cons program args) " "))
           (bmp (and (buffer-live-p buffer) (buffer-modified-p buffer)))
           (name1 name)
           (i 0)
@@ -1510,7 +1507,7 @@ component is used as the target of the symlink."
 
        ;; Save exit.
        (with-current-buffer (tramp-get-connection-buffer v)
-         (if (string-match tramp-temp-buffer-name (buffer-name))
+         (if (string-match-p tramp-temp-buffer-name (buffer-name))
              (progn
                (set-process-buffer (tramp-get-connection-process v) nil)
                (kill-buffer (current-buffer)))
@@ -1532,7 +1529,7 @@ errors for shares like \"C$/\", which are common in 
Microsoft Windows."
              (concat (file-remote-p filename)
                      (replace-match "\\1" nil nil localname)))))
     (condition-case nil
-       (tramp-run-real-handler 'substitute-in-file-name (list filename))
+       (tramp-run-real-handler #'substitute-in-file-name (list filename))
       (error filename))))
 
 (defun tramp-smb-handle-write-region
@@ -1559,7 +1556,7 @@ errors for shares like \"C$/\", which are common in 
Microsoft Windows."
       ;; modtime data to be clobbered from the temp file.  We call
       ;; `set-visited-file-modtime' ourselves later on.
       (tramp-run-real-handler
-       'write-region (list start end tmpfile append 'no-message lockname))
+       #'write-region (list start end tmpfile append 'no-message lockname))
 
       (with-tramp-progress-reporter
          v 3 (format "Moving tmp file %s to %s" tmpfile filename)
@@ -1621,7 +1618,7 @@ If VEC has no cifs capabilities, exchange \"/\" by 
\"\\\\\"."
 
       ;; A period followed by a space, or trailing periods and spaces,
       ;; are not supported.
-      (when (string-match "\\. \\|\\.$\\| $" localname)
+      (when (string-match-p "\\. \\|\\.$\\| $" localname)
        (tramp-error
         vec 'file-error
         "Invalid file name %s" (tramp-make-tramp-file-name vec localname)))
@@ -1775,7 +1772,7 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
          (cl-return))
 
        ;; weekday.
-       (if (string-match "\\(\\w+\\)$" line)
+       (if (string-match-p "\\(\\w+\\)$" line)
            (setq line (substring line 0 -5))
          (cl-return))
 
@@ -1796,12 +1793,12 @@ Result is the list (LOCALNAME MODE SIZE MTIME)."
        (if (string-match "\\([ACDEHNORrsSTV]+\\)?$" line)
            (setq
             mode (or (match-string 1 line) "")
-            mode (save-match-data (format
+            mode (format
                    "%s%s"
-                   (if (string-match "D" mode) "d" "-")
+                   (if (string-match-p "D" mode) "d" "-")
                    (mapconcat
                     (lambda (_x) "") "    "
-                    (concat "r" (if (string-match "R" mode) "-" "w") "x"))))
+                    (concat "r" (if (string-match-p "R" mode) "-" "w") "x")))
             line (substring line 0 -6))
          (cl-return))
 
@@ -1901,11 +1898,11 @@ If ARGUMENT is non-nil, use it as argument for
     ;; connection timeout.
     (with-current-buffer buf
       (goto-char (point-min))
-      (when (and (> (tramp-time-diff
-                    (current-time)
-                    (tramp-get-connection-property
-                     p "last-cmd-time" '(0 0 0)))
-                   60)
+      ;; `seconds-to-time' can be removed once we get rid of Emacs 24.
+      (when (and (time-less-p (seconds-to-time 60)
+                             (time-since
+                              (tramp-get-connection-property
+                               p "last-cmd-time" (seconds-to-time 0))))
                 (process-live-p p)
                 (re-search-forward tramp-smb-errors nil t))
        (delete-process p)
@@ -1918,6 +1915,14 @@ If ARGUMENT is non-nil, use it as argument for
                      share
                      (tramp-get-connection-property p "smb-share" ""))))
 
+      ;; During completion, don't reopen a new connection.  We
+      ;; check this for the process related to
+      ;; `tramp-buffer-name'; otherwise `start-file-process'
+      ;; wouldn't run ever when `non-essential' is non-nil.
+      (when (and (tramp-completion-mode-p)
+                (null (get-process (tramp-buffer-name vec))))
+       (throw 'non-essential 'non-essential))
+
       (save-match-data
        ;; There might be unread output from checking for share names.
        (when buf (with-current-buffer buf (erase-buffer)))
@@ -1967,9 +1972,9 @@ If ARGUMENT is non-nil, use it as argument for
                               args))))
 
              (tramp-message
-              vec 6 "%s" (mapconcat 'identity (process-command p) " "))
+              vec 6 "%s" (mapconcat #'identity (process-command p) " "))
              (process-put p 'vector vec)
-             (process-put p 'adjust-window-size-function 'ignore)
+             (process-put p 'adjust-window-size-function #'ignore)
              (set-process-query-on-exit-flag p nil)
 
              (condition-case err
@@ -1982,20 +1987,22 @@ If ARGUMENT is non-nil, use it as argument for
                       tramp-smb-actions-without-share))
 
                    ;; Check server version.
-                   (unless argument
-                     (with-current-buffer (tramp-get-connection-buffer vec)
-                       (goto-char (point-min))
-                       (search-forward-regexp tramp-smb-server-version nil t)
-                       (let ((smbserver-version (match-string 0)))
-                         (unless
-                             (string-equal
-                              smbserver-version
-                              (tramp-get-connection-property
-                               vec "smbserver-version" smbserver-version))
-                           (tramp-flush-directory-properties vec "")
-                           (tramp-flush-connection-properties vec))
-                         (tramp-set-connection-property
-                          vec "smbserver-version" smbserver-version))))
+                   ;; FIXME: With recent smbclient versions, this
+                   ;; information isn't printed anymore.
+                   ;; (unless argument
+                   ;;   (with-current-buffer (tramp-get-connection-buffer vec)
+                   ;;  (goto-char (point-min))
+                   ;;  (search-forward-regexp tramp-smb-server-version nil t)
+                   ;;  (let ((smbserver-version (match-string 0)))
+                   ;;    (unless
+                   ;;        (string-equal
+                   ;;         smbserver-version
+                   ;;         (tramp-get-connection-property
+                   ;;          vec "smbserver-version" smbserver-version))
+                   ;;      (tramp-flush-directory-properties vec "")
+                   ;;      (tramp-flush-connection-properties vec))
+                   ;;    (tramp-set-connection-property
+                   ;;     vec "smbserver-version" smbserver-version))))
 
                    ;; Set chunksize to 1.  smbclient reads its input
                    ;; character by character; if we send the string
@@ -2031,51 +2038,27 @@ If ARGUMENT is non-nil, use it as argument for
 ;; We don't use timeouts.  If needed, the caller shall wrap around.
 (defun tramp-smb-wait-for-output (vec)
   "Wait for output from smbclient command.
-Returns nil if an error message has appeared."
+Removes smb prompt.  Returns nil if an error message has appeared."
   (with-current-buffer (tramp-get-connection-buffer vec)
     (let ((p (get-buffer-process (current-buffer)))
-         (found (progn (goto-char (point-min))
-                       (re-search-forward tramp-smb-prompt nil t)))
-         (err   (progn (goto-char (point-min))
-                       (re-search-forward tramp-smb-errors nil t)))
-         buffer-read-only)
-
-      ;; Algorithm: get waiting output.  See if last line contains
-      ;; `tramp-smb-prompt' sentinel or `tramp-smb-errors' strings.
-      ;; If not, wait a bit and again get waiting output.
-      (while (and (not found) (not err) (process-live-p p))
-
-       ;; Accept pending output.
-       (tramp-accept-process-output p 0.1)
-
-       ;; Search for prompt.
-       (goto-char (point-min))
-       (setq found (re-search-forward tramp-smb-prompt nil t))
-
-       ;; Search for errors.
-       (goto-char (point-min))
-       (setq err (re-search-forward tramp-smb-errors nil t)))
-
-      ;; When the process is still alive, read pending output.
-      (while (and (not found) (process-live-p p))
-
-       ;; Accept pending output.
-       (tramp-accept-process-output p 0.1)
-
-       ;; Search for prompt.
-       (goto-char (point-min))
-       (setq found (re-search-forward tramp-smb-prompt nil t)))
+         (inhibit-read-only t))
 
+      ;; Read pending output.
+      (while (not (re-search-forward tramp-smb-prompt nil t))
+       (while (tramp-accept-process-output p 0)
+         (goto-char (point-min))))
       (tramp-message vec 6 "\n%s" (buffer-string))
 
       ;; Remove prompt.
-      (when found
+      (goto-char (point-min))
+      (when (re-search-forward tramp-smb-prompt nil t)
        (goto-char (point-max))
        (re-search-backward tramp-smb-prompt nil t)
        (delete-region (point) (point-max)))
 
       ;; Return value is whether no error message has appeared.
-      (not err))))
+      (goto-char (point-min))
+      (not (re-search-forward tramp-smb-errors nil t)))))
 
 (defun tramp-smb-kill-winexe-function ()
   "Send SIGKILL to the winexe process."
@@ -2086,7 +2069,6 @@ Returns nil if an error message has appeared."
 
 (defun tramp-smb-call-winexe (vec)
   "Apply a remote command, if possible, using `tramp-smb-winexe-program'."
-
   ;; Check for program.
   (unless (executable-find tramp-smb-winexe-program)
     (tramp-error
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
new file mode 100644
index 0000000..0d9e04d
--- /dev/null
+++ b/lisp/net/tramp-sudoedit.el
@@ -0,0 +1,893 @@
+;;; tramp-sudoedit.el --- Functions for accessing under root permissions  -*- 
lexical-binding:t -*-
+
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
+
+;; Author: Michael Albinus <address@hidden>
+;; Keywords: comm, processes
+;; Package: tramp
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; The "sudoedit" Tramp method allows to edit a file as a different
+;; user on the local host.  Contrary to the "sudo" method, all magic
+;; file name functions are implemented by single "sudo ..."  commands.
+;; The purpose is to make editing such a file as secure as possible;
+;; there must be no session running in the Emacs background which
+;; could be attacked from inside Emacs.
+
+;; Consequently, external processes are not implemented.
+
+;;; Code:
+
+(require 'tramp)
+
+;;;###tramp-autoload
+(defconst tramp-sudoedit-method "sudoedit"
+  "When this method name is used, call sudoedit for editing a file.")
+
+;;;###tramp-autoload
+(tramp--with-startup
+ (add-to-list 'tramp-methods
+              `(,tramp-sudoedit-method
+                (tramp-sudo-login (("sudo") ("-u" "%u") ("-S") ("-H")
+                                  ("-p" "Password:") ("--")))))
+
+ (add-to-list 'tramp-default-user-alist '("\\`sudoedit\\'" nil "root"))
+
+ (tramp-set-completion-function
+  tramp-sudoedit-method tramp-completion-function-alist-su))
+
+(defconst tramp-sudoedit-sudo-actions
+  '((tramp-password-prompt-regexp tramp-action-password)
+    (tramp-wrong-passwd-regexp tramp-action-permission-denied)
+    (tramp-process-alive-regexp tramp-sudoedit-action-sudo))
+  "List of pattern/action pairs.
+This list is used for sudo calls.
+
+See `tramp-actions-before-shell' for more info.")
+
+;;;###tramp-autoload
+(defconst tramp-sudoedit-file-name-handler-alist
+  '((access-file . tramp-handle-access-file)
+    (add-name-to-file . tramp-sudoedit-handle-add-name-to-file)
+    (byte-compiler-base-file-name . ignore)
+    ;; `copy-directory' performed by default handler.
+    (copy-file . tramp-sudoedit-handle-copy-file)
+    (delete-directory . tramp-sudoedit-handle-delete-directory)
+    (delete-file . tramp-sudoedit-handle-delete-file)
+    (diff-latest-backup-file . ignore)
+    ;; `directory-file-name' performed by default handler.
+    (directory-files . tramp-handle-directory-files)
+    (directory-files-and-attributes
+     . tramp-handle-directory-files-and-attributes)
+    (dired-compress-file . ignore)
+    (dired-uncache . tramp-handle-dired-uncache)
+    (exec-path . ignore)
+    (expand-file-name . tramp-sudoedit-handle-expand-file-name)
+    (file-accessible-directory-p . tramp-handle-file-accessible-directory-p)
+    (file-acl . tramp-sudoedit-handle-file-acl)
+    (file-attributes . tramp-sudoedit-handle-file-attributes)
+    (file-directory-p . tramp-handle-file-directory-p)
+    (file-equal-p . tramp-handle-file-equal-p)
+    (file-executable-p . tramp-sudoedit-handle-file-executable-p)
+    (file-exists-p . tramp-sudoedit-handle-file-exists-p)
+    (file-in-directory-p . tramp-handle-file-in-directory-p)
+    (file-local-copy . tramp-handle-file-local-copy)
+    (file-modes . tramp-handle-file-modes)
+    (file-name-all-completions
+     . tramp-sudoedit-handle-file-name-all-completions)
+    (file-name-as-directory . tramp-handle-file-name-as-directory)
+    (file-name-case-insensitive-p . tramp-handle-file-name-case-insensitive-p)
+    (file-name-completion . tramp-handle-file-name-completion)
+    (file-name-directory . tramp-handle-file-name-directory)
+    (file-name-nondirectory . tramp-handle-file-name-nondirectory)
+    ;; `file-name-sans-versions' performed by default handler.
+    (file-newer-than-file-p . tramp-handle-file-newer-than-file-p)
+    (file-notify-add-watch . ignore)
+    (file-notify-rm-watch . ignore)
+    (file-notify-valid-p . ignore)
+    (file-ownership-preserved-p . ignore)
+    (file-readable-p . tramp-sudoedit-handle-file-readable-p)
+    (file-regular-p . tramp-handle-file-regular-p)
+    (file-remote-p . tramp-handle-file-remote-p)
+    (file-selinux-context . tramp-sudoedit-handle-file-selinux-context)
+    (file-symlink-p . tramp-handle-file-symlink-p)
+    (file-system-info . tramp-sudoedit-handle-file-system-info)
+    (file-truename . tramp-sudoedit-handle-file-truename)
+    (file-writable-p . tramp-sudoedit-handle-file-writable-p)
+    (find-backup-file-name . tramp-handle-find-backup-file-name)
+    ;; `get-file-buffer' performed by default handler.
+    (insert-directory . tramp-handle-insert-directory)
+    (insert-file-contents . tramp-handle-insert-file-contents)
+    (load . tramp-handle-load)
+    (make-auto-save-file-name . tramp-handle-make-auto-save-file-name)
+    (make-directory . tramp-sudoedit-handle-make-directory)
+    (make-directory-internal . ignore)
+    (make-nearby-temp-file . tramp-handle-make-nearby-temp-file)
+    (make-process . ignore)
+    (make-symbolic-link . tramp-sudoedit-handle-make-symbolic-link)
+    (process-file . ignore)
+    (rename-file . tramp-sudoedit-handle-rename-file)
+    (set-file-acl . tramp-sudoedit-handle-set-file-acl)
+    (set-file-modes . tramp-sudoedit-handle-set-file-modes)
+    (set-file-selinux-context . tramp-sudoedit-handle-set-file-selinux-context)
+    (set-file-times . tramp-sudoedit-handle-set-file-times)
+    (set-visited-file-modtime . tramp-handle-set-visited-file-modtime)
+    (shell-command . ignore)
+    (start-file-process . ignore)
+    (substitute-in-file-name . tramp-handle-substitute-in-file-name)
+    (temporary-file-directory . tramp-handle-temporary-file-directory)
+    (tramp-set-file-uid-gid . tramp-sudoedit-handle-set-file-uid-gid)
+    (unhandled-file-name-directory . ignore)
+    (vc-registered . ignore)
+    (verify-visited-file-modtime . tramp-handle-verify-visited-file-modtime)
+    (write-region . tramp-sudoedit-handle-write-region))
+  "Alist of handler functions for Tramp SUDOEDIT method.")
+
+;; It must be a `defsubst' in order to push the whole code into
+;; tramp-loaddefs.el.  Otherwise, there would be recursive autoloading.
+;;;###tramp-autoload
+(defsubst tramp-sudoedit-file-name-p (filename)
+  "Check if it's a filename for SUDOEDIT."
+  (and (tramp-tramp-file-p filename)
+       (string= (tramp-file-name-method (tramp-dissect-file-name filename))
+               tramp-sudoedit-method)))
+
+;;;###tramp-autoload
+(defun tramp-sudoedit-file-name-handler (operation &rest args)
+  "Invoke the SUDOEDIT handler for OPERATION.
+First arg specifies the OPERATION, second arg is a list of arguments to
+pass to the OPERATION."
+  (let ((fn (assoc operation tramp-sudoedit-file-name-handler-alist)))
+    (if fn
+       (save-match-data (apply (cdr fn) args))
+      (tramp-run-real-handler operation args))))
+
+;;;###tramp-autoload
+(tramp--with-startup
+ (tramp-register-foreign-file-name-handler
+  #'tramp-sudoedit-file-name-p #'tramp-sudoedit-file-name-handler))
+
+
+;; File name primitives.
+
+(defun tramp-sudoedit-handle-add-name-to-file
+  (filename newname &optional ok-if-already-exists)
+  "Like `add-name-to-file' for Tramp files."
+  (unless (tramp-equal-remote filename newname)
+    (with-parsed-tramp-file-name
+       (if (tramp-tramp-file-p filename) filename newname) nil
+      (tramp-error
+       v 'file-error
+       "add-name-to-file: %s"
+       "only implemented for same method, same user, same host")))
+  (with-parsed-tramp-file-name filename v1
+    (with-parsed-tramp-file-name newname v2
+       ;; Do the 'confirm if exists' thing.
+       (when (file-exists-p newname)
+         ;; What to do?
+         (if (or (null ok-if-already-exists) ; not allowed to exist
+                 (and (numberp ok-if-already-exists)
+                      (not (yes-or-no-p
+                            (format
+                             "File %s already exists; make it a link anyway? "
+                             v2-localname)))))
+             (tramp-error v2 'file-already-exists newname)
+           (delete-file newname)))
+       (tramp-flush-file-properties v2 (file-name-directory v2-localname))
+       (tramp-flush-file-properties v2 v2-localname)
+       (unless
+           (tramp-sudoedit-send-command
+            v1 "ln"
+            (tramp-compat-file-name-unquote v1-localname)
+            (tramp-compat-file-name-unquote v2-localname))
+         (tramp-error
+          v1 'file-error
+          "error with add-name-to-file, see buffer `%s' for details"
+          (buffer-name))))))
+
+(defun tramp-sudoedit-do-copy-or-rename-file
+  (op filename newname &optional ok-if-already-exists keep-date
+   preserve-uid-gid preserve-extended-attributes)
+  "Copy or rename a remote file.
+OP must be `copy' or `rename' and indicates the operation to perform.
+FILENAME specifies the file to copy or rename, NEWNAME is the name of
+the new file (for copy) or the new name of the file (for rename).
+OK-IF-ALREADY-EXISTS means don't barf if NEWNAME exists already.
+KEEP-DATE means to make sure that NEWNAME has the same timestamp
+as FILENAME.  PRESERVE-UID-GID, when non-nil, instructs to keep
+the uid and gid if both files are on the same host.
+PRESERVE-EXTENDED-ATTRIBUTES activates selinux and acl commands.
+
+This function is invoked by `tramp-sudoedit-handle-copy-file' and
+`tramp-sudoedit-handle-rename-file'.  It is an error if OP is
+neither of `copy' and `rename'.  FILENAME and NEWNAME must be
+absolute file names."
+  (unless (memq op '(copy rename))
+    (error "Unknown operation `%s', must be `copy' or `rename'" op))
+
+  (setq filename (file-truename filename))
+  (if (file-directory-p filename)
+      (progn
+       (copy-directory filename newname keep-date t)
+       (when (eq op 'rename) (delete-directory filename 'recursive)))
+
+    (let ((t1 (tramp-sudoedit-file-name-p filename))
+         (t2 (tramp-sudoedit-file-name-p newname))
+         (file-times (tramp-compat-file-attribute-modification-time
+                      (file-attributes filename)))
+         (file-modes (tramp-default-file-modes filename))
+         ;; `file-extended-attributes' exists since Emacs 24.4.
+         (attributes (and preserve-extended-attributes
+                          (apply #'file-extended-attributes (list filename))))
+         (sudoedit-operation
+          (cond
+           ((and (eq op 'copy) preserve-uid-gid) '("cp" "-f" "-p"))
+           ((eq op 'copy) '("cp" "-f"))
+           ((eq op 'rename) '("mv" "-f"))))
+         (msg-operation (if (eq op 'copy) "Copying" "Renaming")))
+
+      (with-parsed-tramp-file-name (if t1 filename newname) nil
+       (when (and (not ok-if-already-exists) (file-exists-p newname))
+         (tramp-error v 'file-already-exists newname))
+
+       (if (or (and (file-remote-p filename) (not t1))
+               (and (file-remote-p newname)  (not t2)))
+           ;; We cannot copy or rename directly.
+           (let ((tmpfile (tramp-compat-make-temp-file filename)))
+             (if (eq op 'copy)
+                 (copy-file filename tmpfile t)
+               (rename-file filename tmpfile t))
+             (rename-file tmpfile newname ok-if-already-exists))
+
+         ;; Direct action.
+         (with-tramp-progress-reporter
+             v 0 (format "%s %s to %s" msg-operation filename newname)
+           (unless (tramp-sudoedit-send-command
+                    v sudoedit-operation
+                    (tramp-compat-file-name-unquote
+                     (tramp-compat-file-local-name filename))
+                    (tramp-compat-file-name-unquote
+                     (tramp-compat-file-local-name newname)))
+             (tramp-error
+              v 'file-error
+              "Error %s `%s' `%s'" msg-operation filename newname))))
+
+       ;; When `newname' is local, we must change the ownership to
+       ;; the local user.
+       (unless (file-remote-p newname)
+         (tramp-set-file-uid-gid
+          (concat (file-remote-p filename) newname)
+          (tramp-get-local-uid 'integer)
+          (tramp-get-local-gid 'integer)))
+
+       ;; Set the time and mode. Mask possible errors.
+       (when keep-date
+         (ignore-errors
+           (set-file-times newname file-times)
+           (set-file-modes newname file-modes)))
+
+       ;; Handle `preserve-extended-attributes'.  We ignore possible
+       ;; errors, because ACL strings could be incompatible.
+       ;; `set-file-extended-attributes' exists since Emacs 24.4.
+       (when attributes
+         (ignore-errors
+           (apply #'set-file-extended-attributes (list newname attributes))))
+
+       (when (and t1 (eq op 'rename))
+         (with-parsed-tramp-file-name filename v1
+           (tramp-flush-file-properties
+            v1 (file-name-directory v1-localname))
+           (tramp-flush-file-properties v1 v1-localname)))
+
+       (when t2
+         (with-parsed-tramp-file-name newname v2
+           (tramp-flush-file-properties
+            v2 (file-name-directory v2-localname))
+           (tramp-flush-file-properties v2 v2-localname)))))))
+
+(defun tramp-sudoedit-handle-copy-file
+  (filename newname &optional ok-if-already-exists keep-date
+   preserve-uid-gid preserve-extended-attributes)
+  "Like `copy-file' for Tramp files."
+  (setq filename (expand-file-name filename))
+  (setq newname (expand-file-name newname))
+  ;; At least one file a Tramp file?
+  (if (or (tramp-tramp-file-p filename)
+         (tramp-tramp-file-p newname))
+      (tramp-sudoedit-do-copy-or-rename-file
+       'copy filename newname ok-if-already-exists keep-date
+       preserve-uid-gid preserve-extended-attributes)
+    (tramp-run-real-handler
+     #'copy-file
+     (list filename newname ok-if-already-exists keep-date
+          preserve-uid-gid preserve-extended-attributes))))
+
+(defun tramp-sudoedit-handle-delete-directory
+    (directory &optional recursive trash)
+  "Like `delete-directory' for Tramp files."
+  (setq directory (expand-file-name directory))
+  (with-parsed-tramp-file-name directory nil
+    (tramp-flush-file-properties v (file-name-directory localname))
+    (tramp-flush-directory-properties v localname)
+    (unless
+       (tramp-sudoedit-send-command
+        v (or (and trash "trash")
+              (if recursive '("rm" "-rf") "rmdir"))
+        (tramp-compat-file-name-unquote localname))
+      (tramp-error v 'file-error "Couldn't delete %s" directory))))
+
+(defun tramp-sudoedit-handle-delete-file (filename &optional trash)
+  "Like `delete-file' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (tramp-flush-file-properties v (file-name-directory localname))
+    (tramp-flush-file-properties v localname)
+    (unless
+       (tramp-sudoedit-send-command
+        v (if (and trash delete-by-moving-to-trash) "trash" "rm")
+        (tramp-compat-file-name-unquote localname))
+      ;; Propagate the error.
+      (with-current-buffer (tramp-get-connection-buffer v)
+       (goto-char (point-min))
+       (tramp-error-with-buffer
+        nil v 'file-error "Couldn't delete %s" filename)))))
+
+(defun tramp-sudoedit-handle-expand-file-name (name &optional dir)
+  "Like `expand-file-name' for Tramp files.
+If the localname part of the given file name starts with \"/../\" then
+the result will be a local, non-Tramp, file name."
+  ;; If DIR is not given, use `default-directory' or "/".
+  (setq dir (or dir default-directory "/"))
+  ;; Handle empty NAME.
+  (when (zerop (length name)) (setq name "."))
+  ;; Unless NAME is absolute, concat DIR and NAME.
+  (unless (file-name-absolute-p name)
+    (setq name (concat (file-name-as-directory dir) name)))
+  (with-parsed-tramp-file-name name nil
+    ;; Tilde expansion if necessary.  We cannot accept "~/", because
+    ;; under sudo "~/" is expanded to the local user home directory
+    ;; but to the root home directory.
+    (when (zerop (length localname))
+      (setq localname "~"))
+    (unless (file-name-absolute-p localname)
+      (setq localname (format "~%s/%s" user localname)))
+    (when (string-match "\\`\\(~[^/]*\\)\\(.*\\)\\'" localname)
+      (let ((uname (match-string 1 localname))
+           (fname (match-string 2 localname)))
+       (when (string-equal uname "~")
+         (setq uname (concat uname user)))
+       (setq localname (concat uname fname))))
+    ;; Do normal `expand-file-name' (this does "~user/", "/./" and "/../").
+    (tramp-make-tramp-file-name v (expand-file-name localname))))
+
+(defun tramp-sudoedit-remote-acl-p (vec)
+  "Check, whether ACL is enabled on the remote host."
+  (with-tramp-connection-property (tramp-get-connection-process vec) "acl-p"
+    (zerop (tramp-call-process vec "getfacl" nil nil nil "/"))))
+
+(defun tramp-sudoedit-handle-file-acl (filename)
+  "Like `file-acl' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (with-tramp-file-property v localname "file-acl"
+      (let ((result (and (tramp-sudoedit-remote-acl-p v)
+                        (tramp-sudoedit-send-command-string
+                         v "getfacl" "-acp"
+                         (tramp-compat-file-name-unquote localname)))))
+       ;; The acl string must have a trailing \n, which is not
+       ;; provided by `tramp-sudoedit-send-command-string'.  Add it.
+       (and (stringp result) (concat result "\n"))))))
+
+(defun tramp-sudoedit-handle-file-attributes (filename &optional id-format)
+  "Like `file-attributes' for Tramp files."
+  (unless id-format (setq id-format 'integer))
+  (with-parsed-tramp-file-name (expand-file-name filename) nil
+    (with-tramp-file-property
+       v localname (format "file-attributes-%s" id-format)
+      (tramp-message v 5 "file attributes: %s" localname)
+      (ignore-errors
+       (tramp-convert-file-attributes
+        v
+        (tramp-sudoedit-send-command-and-read
+         v "env" "QUOTING_STYLE=locale" "stat" "-c"
+         (format
+          ;; Apostrophes in the stat output are masked as
+          ;; `tramp-stat-marker', in order to make a proper shell
+          ;; escape of them in file names.
+          "((%s%%N%s) %%h %s %s %%X %%Y %%Z %%s %s%%A%s t %%i -1)"
+          tramp-stat-marker tramp-stat-marker
+          (if (eq id-format 'integer)
+              "%u"
+            (eval-when-compile
+              (concat tramp-stat-marker "%U" tramp-stat-marker)))
+          (if (eq id-format 'integer)
+              "%g"
+            (eval-when-compile
+              (concat tramp-stat-marker "%G" tramp-stat-marker)))
+          tramp-stat-marker tramp-stat-marker)
+         (tramp-compat-file-name-unquote localname)))))))
+
+(defun tramp-sudoedit-handle-file-executable-p (filename)
+  "Like `file-executable-p' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (with-tramp-file-property v localname "file-executable-p"
+      (tramp-sudoedit-send-command
+       v "test" "-x" (tramp-compat-file-name-unquote localname)))))
+
+(defun tramp-sudoedit-handle-file-exists-p (filename)
+  "Like `file-exists-p' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (with-tramp-file-property v localname "file-exists-p"
+      (tramp-sudoedit-send-command
+       v "test" "-e" (tramp-compat-file-name-unquote localname)))))
+
+(defun tramp-sudoedit-handle-file-name-all-completions (filename directory)
+  "Like `file-name-all-completions' for Tramp files."
+  (all-completions
+   filename
+   (with-parsed-tramp-file-name (expand-file-name directory) nil
+     (with-tramp-file-property v localname "file-name-all-completions"
+       (tramp-sudoedit-send-command
+       v "ls" "-a1" "--quoting-style=literal" "--show-control-chars"
+       (if (zerop (length localname))
+           "" (tramp-compat-file-name-unquote localname)))
+       (mapcar
+       (lambda (f)
+         (if (file-directory-p (expand-file-name f directory))
+             (file-name-as-directory f)
+           f))
+       (with-current-buffer (tramp-get-connection-buffer v)
+         (delq
+          nil
+          (mapcar
+           (lambda (l) (and (not (string-match-p "^[[:space:]]*$" l)) l))
+           (split-string (buffer-string) "\n" 'omit)))))))))
+
+(defun tramp-sudoedit-handle-file-readable-p (filename)
+  "Like `file-readable-p' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (with-tramp-file-property v localname "file-readable-p"
+      (tramp-sudoedit-send-command
+       v "test" "-r" (tramp-compat-file-name-unquote localname)))))
+
+(defun tramp-sudoedit-handle-set-file-modes (filename mode)
+  "Like `set-file-modes' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (tramp-flush-file-properties v (file-name-directory localname))
+    (tramp-flush-file-properties v localname)
+    (unless (tramp-sudoedit-send-command
+            v "chmod" (format "%o" mode)
+            (tramp-compat-file-name-unquote localname))
+      (tramp-error
+       v 'file-error "Error while changing file's mode %s" filename))))
+
+(defun tramp-sudoedit-remote-selinux-p (vec)
+  "Check, whether SELINUX is enabled on the remote host."
+  (with-tramp-connection-property (tramp-get-connection-process vec) 
"selinux-p"
+    (zerop (tramp-call-process vec "selinuxenabled"))))
+
+(defun tramp-sudoedit-handle-file-selinux-context (filename)
+  "Like `file-selinux-context' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (with-tramp-file-property v localname "file-selinux-context"
+      (let ((context '(nil nil nil nil))
+           (regexp (eval-when-compile
+                     (concat "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\):"
+                             "\\([a-z0-9_]+\\):" "\\([a-z0-9_]+\\)"))))
+       (when (and (tramp-sudoedit-remote-selinux-p v)
+                  (tramp-sudoedit-send-command
+                   v "ls" "-d" "-Z"
+                   (tramp-compat-file-name-unquote localname)))
+         (with-current-buffer (tramp-get-connection-buffer v)
+           (goto-char (point-min))
+           (when (re-search-forward regexp (point-at-eol) t)
+             (setq context (list (match-string 1) (match-string 2)
+                                 (match-string 3) (match-string 4))))))
+       ;; Return the context.
+       context))))
+
+(defun tramp-sudoedit-handle-file-system-info (filename)
+  "Like `file-system-info' for Tramp files."
+  (ignore-errors
+    (with-parsed-tramp-file-name (expand-file-name filename) nil
+      (tramp-message v 5 "file system info: %s" localname)
+      (when (tramp-sudoedit-send-command
+            v "df" "--block-size=1" "--output=size,used,avail"
+            (tramp-compat-file-name-unquote localname)))
+      (with-current-buffer (tramp-get-connection-buffer v)
+       (goto-char (point-min))
+       (forward-line)
+       (when (looking-at
+              (eval-when-compile
+                (concat "[[:space:]]*\\([[:digit:]]+\\)"
+                        "[[:space:]]+\\([[:digit:]]+\\)"
+                        "[[:space:]]+\\([[:digit:]]+\\)")))
+         (list (string-to-number (match-string 1))
+               ;; The second value is the used size.  We need the
+               ;; free size.
+               (- (string-to-number (match-string 1))
+                  (string-to-number (match-string 2)))
+               (string-to-number (match-string 3))))))))
+
+(defun tramp-sudoedit-handle-set-file-times (filename &optional time)
+  "Like `set-file-times' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (tramp-flush-file-properties v (file-name-directory localname))
+    (tramp-flush-file-properties v localname)
+    (let ((time
+          (if (or (null time)
+                  (tramp-compat-time-equal-p time tramp-time-doesnt-exist)
+                  (tramp-compat-time-equal-p time tramp-time-dont-know))
+              (current-time)
+            time)))
+      (tramp-sudoedit-send-command
+       v "env" "TZ=UTC" "touch" "-t"
+       (format-time-string "%Y%m%d%H%M.%S" time t)
+       (tramp-compat-file-name-unquote localname)))))
+
+(defun tramp-sudoedit-handle-file-truename (filename)
+  "Like `file-truename' for Tramp files."
+   ;; Preserve trailing "/".
+  (funcall
+   (if (string-equal (file-name-nondirectory filename) "")
+       #'file-name-as-directory #'identity)
+   (with-parsed-tramp-file-name (expand-file-name filename) nil
+     (tramp-make-tramp-file-name
+      v
+      (with-tramp-file-property v localname "file-truename"
+       (let ((quoted (tramp-compat-file-name-quoted-p localname))
+             (localname (tramp-compat-file-name-unquote localname))
+             result)
+         (tramp-message v 4 "Finding true name for `%s'" filename)
+         (setq result (tramp-sudoedit-send-command-string
+                       v "readlink" "--canonicalize-missing" localname))
+         ;; Detect cycle.
+         (when (and (file-symlink-p filename)
+                    (string-equal result localname))
+           (tramp-error
+            v 'file-error
+            "Apparent cycle of symbolic links for %s" filename))
+         ;; If the resulting localname looks remote, we must quote it
+         ;; for security reasons.
+         (when (or quoted (file-remote-p result))
+           (let (file-name-handler-alist)
+             (setq result (tramp-compat-file-name-quote result))))
+         (tramp-message v 4 "True name of `%s' is `%s'" localname result)
+         result))
+      'nohop))))
+
+(defun tramp-sudoedit-handle-file-writable-p (filename)
+  "Like `file-writable-p' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (with-tramp-file-property v localname "file-writable-p"
+      (if (file-exists-p filename)
+         (tramp-sudoedit-send-command
+          v "test" "-w" (tramp-compat-file-name-unquote localname))
+       (let ((dir (file-name-directory filename)))
+         (and (file-exists-p dir)
+              (file-writable-p dir)))))))
+
+(defun tramp-sudoedit-handle-make-directory (dir &optional parents)
+  "Like `make-directory' for Tramp files."
+  (setq dir (expand-file-name dir))
+  (with-parsed-tramp-file-name dir nil
+    ;; When PARENTS is non-nil, DIR could be a chain of non-existent
+    ;; directories a/b/c/...  Instead of checking, we simply flush the
+    ;; whole cache.
+    (tramp-flush-directory-properties
+     v (if parents "/" (file-name-directory localname)))
+    (unless (tramp-sudoedit-send-command
+            v (if parents '("mkdir" "-p") "mkdir")
+            (tramp-compat-file-name-unquote localname))
+      (tramp-error v 'file-error "Couldn't make directory %s" dir))))
+
+(defun tramp-sudoedit-handle-make-symbolic-link
+    (target linkname &optional ok-if-already-exists)
+  "Like `make-symbolic-link' for Tramp files.
+If TARGET is a non-Tramp file, it is used verbatim as the target
+of the symlink.  If TARGET is a Tramp file, only the localname
+component is used as the target of the symlink."
+  (if (not (tramp-tramp-file-p (expand-file-name linkname)))
+      (tramp-run-real-handler
+       #'make-symbolic-link (list target linkname ok-if-already-exists))
+
+    (with-parsed-tramp-file-name linkname nil
+      ;; If TARGET is a Tramp name, use just the localname component.
+      (when (and (tramp-tramp-file-p target)
+                (tramp-file-name-equal-p v (tramp-dissect-file-name target)))
+       (setq target
+             (tramp-file-name-localname
+              (tramp-dissect-file-name (expand-file-name target)))))
+
+      ;; If TARGET is still remote, quote it.
+      (if (tramp-tramp-file-p target)
+         (make-symbolic-link
+          (let (file-name-handler-alist) (tramp-compat-file-name-quote target))
+          linkname ok-if-already-exists)
+
+       ;; Do the 'confirm if exists' thing.
+       (when (file-exists-p linkname)
+         ;; What to do?
+         (if (or (null ok-if-already-exists) ; not allowed to exist
+                 (and (numberp ok-if-already-exists)
+                      (not
+                       (yes-or-no-p
+                        (format
+                         "File %s already exists; make it a link anyway? "
+                         localname)))))
+             (tramp-error v 'file-already-exists localname)
+           (delete-file linkname)))
+
+       (tramp-flush-file-properties v (file-name-directory localname))
+       (tramp-flush-file-properties v localname)
+        (tramp-sudoedit-send-command
+        v "ln" "-sf"
+        (tramp-compat-file-name-unquote target)
+        (tramp-compat-file-name-unquote localname))))))
+
+(defun tramp-sudoedit-handle-rename-file
+  (filename newname &optional ok-if-already-exists)
+  "Like `rename-file' for Tramp files."
+  (setq filename (expand-file-name filename))
+  (setq newname (expand-file-name newname))
+  ;; At least one file a Tramp file?
+  (if (or (tramp-tramp-file-p filename)
+          (tramp-tramp-file-p newname))
+      (tramp-sudoedit-do-copy-or-rename-file
+       'rename filename newname ok-if-already-exists
+       'keep-date 'preserve-uid-gid)
+    (tramp-run-real-handler
+     'rename-file (list filename newname ok-if-already-exists))))
+
+(defun tramp-sudoedit-handle-set-file-acl (filename acl-string)
+  "Like `set-file-acl' for Tramp files."
+  (with-parsed-tramp-file-name (expand-file-name filename) nil
+    (when (and (stringp acl-string) (tramp-sudoedit-remote-acl-p v))
+      ;; Massage `acl-string'.
+      (setq acl-string
+           (mapconcat #'identity (split-string acl-string "\n" 'omit) ","))
+      (prog1
+         (tramp-sudoedit-send-command
+          v "setfacl" "-m"
+          acl-string (tramp-compat-file-name-unquote localname))
+       (tramp-flush-file-property v localname "file-acl")))))
+
+(defun tramp-sudoedit-handle-set-file-selinux-context (filename context)
+  "Like `set-file-selinux-context' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (when (and (consp context)
+              (tramp-sudoedit-remote-selinux-p v))
+      (let ((user (and (stringp (nth 0 context)) (nth 0 context)))
+           (role (and (stringp (nth 1 context)) (nth 1 context)))
+           (type (and (stringp (nth 2 context)) (nth 2 context)))
+           (range (and (stringp (nth 3 context)) (nth 3 context))))
+       (when (tramp-sudoedit-send-command
+              v "chcon"
+              (when user (format "--user=%s" user))
+              (when role (format "--role=%s" role))
+              (when type (format "--type=%s" type))
+              (when range (format "--range=%s" range))
+              (tramp-compat-file-name-unquote localname))
+         (if (and user role type range)
+             (tramp-set-file-property
+              v localname "file-selinux-context" context)
+           (tramp-flush-file-property v localname "file-selinux-context"))
+         t)))))
+
+(defun tramp-sudoedit-get-remote-uid (vec id-format)
+  "The uid of the remote connection VEC, in ID-FORMAT.
+ID-FORMAT valid values are `string' and `integer'."
+  (with-tramp-connection-property vec (format "uid-%s" id-format)
+    (if (equal id-format 'integer)
+       (tramp-sudoedit-send-command-and-read vec "id" "-u")
+      (tramp-sudoedit-send-command-string vec "id" "-un"))))
+
+(defun tramp-sudoedit-get-remote-gid (vec id-format)
+  "The gid of the remote connection VEC, in ID-FORMAT.
+ID-FORMAT valid values are `string' and `integer'."
+  (with-tramp-connection-property vec (format "gid-%s" id-format)
+    (if (equal id-format 'integer)
+       (tramp-sudoedit-send-command-and-read vec "id" "-g")
+      (tramp-sudoedit-send-command-string vec "id" "-gn"))))
+
+(defun tramp-sudoedit-handle-set-file-uid-gid (filename &optional uid gid)
+  "Like `tramp-set-file-uid-gid' for Tramp files."
+    (with-parsed-tramp-file-name filename nil
+      (tramp-sudoedit-send-command
+       v "chown"
+       (format "%d:%d"
+              (or uid (tramp-sudoedit-get-remote-uid v 'integer))
+              (or gid (tramp-sudoedit-get-remote-gid v 'integer)))
+       (tramp-compat-file-name-unquote
+       (tramp-compat-file-local-name filename)))))
+
+(defun tramp-sudoedit-handle-write-region
+  (start end filename &optional append visit lockname mustbenew)
+  "Like `write-region' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (let ((uid (or (tramp-compat-file-attribute-user-id
+                   (file-attributes filename 'integer))
+                  (tramp-sudoedit-get-remote-uid v 'integer)))
+         (gid (or (tramp-compat-file-attribute-group-id
+                   (file-attributes filename 'integer))
+                  (tramp-sudoedit-get-remote-gid v 'integer)))
+         (modes (tramp-default-file-modes filename)))
+      (prog1
+         (tramp-handle-write-region
+          start end filename append visit lockname mustbenew)
+
+       ;; Set the ownership and modes.  This is not performed in
+       ;; `tramp-handle-write-region'.
+       (unless (and (= (tramp-compat-file-attribute-user-id
+                        (file-attributes filename 'integer))
+                       uid)
+                     (= (tramp-compat-file-attribute-group-id
+                        (file-attributes filename 'integer))
+                       gid))
+          (tramp-set-file-uid-gid filename uid gid))
+       (set-file-modes filename modes)))))
+
+
+;; Internal functions.
+
+;; Used in `tramp-sudoedit-sudo-actions'.
+(defun tramp-sudoedit-action-sudo (proc vec)
+  "Check, whether a sudo process has finished.
+Remove unneeded output."
+  ;; There might be pending output for the exit status.
+  (unless (process-live-p proc)
+    (while (tramp-accept-process-output proc 0))
+    ;; Delete narrowed region, it would be in the way reading a Lisp form.
+    (goto-char (point-min))
+    (widen)
+    (delete-region (point-min) (point))
+    ;; Delete empty lines.
+    (goto-char (point-min))
+    (while (and (not (eobp)) (= (point) (point-at-eol)))
+      (forward-line))
+    (delete-region (point-min) (point))
+    (tramp-message vec 3 "Process has finished.")
+    (throw 'tramp-action 'ok)))
+
+(defun tramp-sudoedit-maybe-open-connection (vec)
+  "Maybe open a connection VEC.
+Does not do anything if a connection is already open, but re-opens the
+connection if a previous connection has died for some reason."
+  ;; We need a process bound to the connection buffer.  Therefore, we
+  ;; create a dummy process.  Maybe there is a better solution?
+  (unless (tramp-get-connection-process vec)
+
+    ;; During completion, don't reopen a new connection.  We check
+    ;; this for the process related to `tramp-buffer-name'; otherwise
+    ;; `start-file-process' wouldn't run ever when `non-essential' is
+    ;; non-nil.
+    (when (and (tramp-completion-mode-p)
+              (null (get-process (tramp-buffer-name vec))))
+      (throw 'non-essential 'non-essential))
+
+    (let ((p (make-network-process
+             :name (tramp-buffer-name vec)
+             :buffer (tramp-get-connection-buffer vec)
+             :server t :host 'local :service t :noquery t)))
+      (process-put p 'vector vec)
+      (set-process-query-on-exit-flag p nil)
+
+      ;; Set connection-local variables.
+      (tramp-set-connection-local-variables vec)
+
+      ;; Mark it as connected.
+      (tramp-set-connection-property p "connected" t))
+
+    ;; In `tramp-check-cached-permissions', the connection properties
+    ;; "{uid,gid}-{integer,string}" are used.  We set them to proper values.
+    (tramp-sudoedit-get-remote-uid vec 'integer)
+    (tramp-sudoedit-get-remote-gid vec 'integer)
+    (tramp-sudoedit-get-remote-uid vec 'string)
+    (tramp-sudoedit-get-remote-gid vec 'string)))
+
+(defun tramp-sudoedit-send-command (vec &rest args)
+  "Send commands ARGS to connection VEC.
+If an element of ARGS is a list, it will be flattened.  If an
+element of ARGS is nil, it will be deleted.
+Erases temporary buffer before sending the command.  Returns nil
+in case of error, t otherwise."
+  (tramp-sudoedit-maybe-open-connection vec)
+  (with-current-buffer (tramp-get-connection-buffer vec)
+    (erase-buffer)
+    (let* ((login (tramp-get-method-parameter vec 'tramp-sudo-login))
+          (host (or (tramp-file-name-host vec) ""))
+          (user (or (tramp-file-name-user vec) ""))
+          (spec (format-spec-make ?h host ?u user))
+          (args (append
+                 (tramp-compat-flatten-tree
+                  (mapcar
+                   (lambda (x)
+                     (setq x (mapcar (lambda (y) (format-spec y spec)) x))
+                     (unless (member "" x) x))
+                   login))
+                 (tramp-compat-flatten-tree (delq nil args))))
+          (delete-exited-processes t)
+          (process-connection-type tramp-process-connection-type)
+          (p (apply #'start-process
+                    (tramp-get-connection-name vec) (current-buffer) args))
+          ;; We suppress the messages `Waiting for prompts from remote shell'.
+          (tramp-verbose (if (= tramp-verbose 3) 2 tramp-verbose))
+          ;; We do not want to save the password.
+          auth-source-save-behavior)
+      (tramp-message vec 6 "%s" (mapconcat #'identity (process-command p) " "))
+      ;; Avoid process status message in output buffer.
+      (set-process-sentinel p #'ignore)
+      (process-put p 'vector vec)
+      (process-put p 'adjust-window-size-function #'ignore)
+      (set-process-query-on-exit-flag p nil)
+      (tramp-process-actions p vec nil tramp-sudoedit-sudo-actions)
+      (tramp-message vec 6 "%s\n%s" (process-exit-status p) (buffer-string))
+      (prog1
+         (zerop (process-exit-status p))
+       (delete-process p)))))
+
+(defun tramp-sudoedit-send-command-and-read (vec &rest args)
+  "Run command ARGS and return the output, which must be a Lisp expression.
+In case there is no valid Lisp expression, it raises an error."
+  (when (apply #'tramp-sudoedit-send-command vec args)
+    (with-current-buffer (tramp-get-connection-buffer vec)
+      ;; Replace stat marker.
+      (goto-char (point-min))
+      (when (search-forward tramp-stat-marker nil t)
+       (goto-char (point-min))
+       (while (search-forward "\"" nil t)
+         (replace-match "\\\"" nil 'literal))
+       (goto-char (point-min))
+       (while (search-forward tramp-stat-marker nil t)
+         (replace-match "\"")))
+      ;; Read the expression.
+      (tramp-message vec 6 "\n%s" (buffer-string))
+      (goto-char (point-min))
+      (condition-case nil
+         (prog1 (read (current-buffer))
+           ;; Error handling.
+           (when (re-search-forward "\\S-" (point-at-eol) t)
+             (error nil)))
+       (error (tramp-error
+               vec 'file-error
+               "`%s' does not return a valid Lisp expression: `%s'"
+               (car args) (buffer-string)))))))
+
+(defun tramp-sudoedit-send-command-string (vec &rest args)
+  "Run command ARGS and return the output as astring."
+  (when (apply #'tramp-sudoedit-send-command vec args)
+    (with-current-buffer (tramp-get-connection-buffer vec)
+      (tramp-message vec 6 "\n%s" (buffer-string))
+      (goto-char (point-max))
+      ;(delete-blank-lines)
+      (while (looking-back "[ \t\n]+" nil 'greedy)
+       (delete-region (match-beginning 0) (point)))
+      (when (> (point-max) (point-min))
+       (substring-no-properties (buffer-string))))))
+
+(add-hook 'tramp-unload-hook
+         (lambda ()
+           (unload-feature 'tramp-sudoedit 'force)))
+
+(provide 'tramp-sudoedit)
+
+;;; TODO:
+
+;; * Fix *-selinux functions.  Likely, this is due to wrong file
+;;   ownership after `write-region' and/or `copy-file'.
+
+;;; tramp-sudoedit.el ends here
diff --git a/lisp/net/tramp-uu.el b/lisp/net/tramp-uu.el
index 3e08b94..c12a4eb 100644
--- a/lisp/net/tramp-uu.el
+++ b/lisp/net/tramp-uu.el
@@ -1,6 +1,6 @@
 ;;; tramp-uu.el --- uuencode in Lisp  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <address@hidden>
 ;; Maintainer: Michael Albinus <address@hidden>
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 13c3b5f..5b50d39 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1,13 +1,13 @@
 ;;; tramp.el --- Transparent Remote Access, Multiple Protocol  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <address@hidden>
 ;;         Michael Albinus <address@hidden>
 ;; Maintainer: Michael Albinus <address@hidden>
 ;; Keywords: comm, processes
 ;; Package: tramp
-;; Version: 2.4.1-pre
+;; Version: 2.4.2-pre
 ;; Package-Requires: ((emacs "24.1"))
 
 ;; This file is part of GNU Emacs.
@@ -56,12 +56,13 @@
 ;;; Code:
 
 (require 'tramp-compat)
+(require 'tramp-integration)
 (require 'trampver)
 
 ;; Pacify byte-compiler.
 (require 'cl-lib)
+(declare-function netrc-parse "netrc")
 (defvar auto-save-file-name-transforms)
-(defvar eshell-path-env)
 (defvar ls-lisp-use-insert-directory-program)
 (defvar outline-regexp)
 
@@ -74,6 +75,16 @@
   :link '(custom-manual "(tramp)Top")
   :version "22.1")
 
+(eval-and-compile ;; So it's also available in tramp-loaddefs.el!
+  (defvar tramp--startup-hook nil
+    "Forms to be executed at the end of tramp.el.")
+
+  (defmacro tramp--with-startup (&rest body)
+    "Schedule BODY to be executed at the end of tramp.el."
+    `(add-hook 'tramp--startup-hook (lambda () ,@body))))
+
+(require 'tramp-loaddefs)
+
 ;; Maybe we need once a real Tramp mode, with key bindings etc.
 ;;;###autoload
 (defcustom tramp-mode t
@@ -162,12 +173,12 @@ See the variable `tramp-encoding-shell' for more 
information."
   :group 'tramp
   :type '(choice (const nil) string))
 
-;;;###tramp-autoload
 (defvar tramp-methods nil
   "Alist of methods for remote files.
 This is a list of entries of the form (NAME PARAM1 PARAM2 ...).
 Each NAME stands for a remote access method.  Each PARAM is a
 pair of the form (KEY VALUE).  The following KEYs are defined:
+
   * `tramp-remote-shell'
     This specifies the shell to use on the remote host.  This
     MUST be a Bourne-like shell.  It is normally not necessary to
@@ -176,19 +187,23 @@ pair of the form (KEY VALUE).  The following KEYs are 
defined:
     for it.  Also note that \"/bin/sh\" exists on all Unixen,
     this might not be true for the value that you decide to use.
     You Have Been Warned.
+
   * `tramp-remote-shell-login'
     This specifies the arguments to let `tramp-remote-shell' run
     as a login shell.  It defaults to (\"-l\"), but some shells,
     like ksh, require another argument.  See
     `tramp-connection-properties' for a way to overwrite the
     default value.
+
   * `tramp-remote-shell-args'
     For implementation of `shell-command', this specifies the
     arguments to let `tramp-remote-shell' run a single command.
+
   * `tramp-login-program'
     This specifies the name of the program to use for logging in to the
     remote host.  This may be the name of rsh or a workalike program,
     or the name of telnet or a workalike, or the name of su or a workalike.
+
   * `tramp-login-args'
     This specifies the list of arguments to pass to the above
     mentioned program.  Please note that this is a list of list of arguments,
@@ -204,55 +219,88 @@ pair of the form (KEY VALUE).  The following KEYs are 
defined:
     `tramp-make-tramp-temp-file'.  \"%k\" indicates the keep-date
     parameter of a program, if exists.  \"%c\" adds additional
     `tramp-ssh-controlmaster-options' options for the first hop.
+    The existence of `tramp-login-args', combined with the absence of
+    `tramp-copy-args', is an indication that the method is capable of
+     multi-hops.
+
   * `tramp-login-env'
      A list of environment variables and their values, which will
      be set when calling `tramp-login-program'.
+
   * `tramp-async-args'
     When an asynchronous process is started, we know already that
     the connection works.  Therefore, we can pass additional
     parameters to suppress diagnostic messages, in order not to
     tamper the process output.
+
   * `tramp-copy-program'
     This specifies the name of the program to use for remotely copying
     the file; this might be the absolute filename of scp or the name of
     a workalike program.  It is always applied on the local host.
+
   * `tramp-copy-args'
     This specifies the list of parameters to pass to the above mentioned
     program, the hints for `tramp-login-args' also apply here.
+
   * `tramp-copy-env'
      A list of environment variables and their values, which will
      be set when calling `tramp-copy-program'.
+
   * `tramp-remote-copy-program'
     The listener program to be applied on remote side, if needed.
+
   * `tramp-remote-copy-args'
     The list of parameters to pass to the listener program, the hints
     for `tramp-login-args' also apply here.  Additionally, \"%r\" could
     be used here and in `tramp-copy-args'.  It denotes a randomly
     chosen port for the remote listener.
+
   * `tramp-copy-keep-date'
     This specifies whether the copying program when the preserves the
     timestamp of the original file.
+
   * `tramp-copy-keep-tmpfile'
     This specifies whether a temporary local file shall be kept
     for optimization reasons (useful for \"rsync\" methods).
+
   * `tramp-copy-recursive'
     Whether the operation copies directories recursively.
+
   * `tramp-default-port'
     The default port of a method.
+
   * `tramp-tmpdir'
     A directory on the remote host for temporary files.  If not
     specified, \"/tmp\" is taken as default.
+
   * `tramp-connection-timeout'
     This is the maximum time to be spent for establishing a connection.
     In general, the global default value shall be used, but for
     some methods, like \"su\" or \"sudo\", a shorter timeout
     might be desirable.
+
+  * `tramp-session-timeout'
+    How long a Tramp connection keeps open before being disconnected.
+    This is useful for methods like \"su\" or \"sudo\", which
+    shouldn't run an open connection in the background forever.
+
   * `tramp-case-insensitive'
     Whether the remote file system handles file names case insensitive.
     Only a non-nil value counts, the default value nil means to
     perform further checks on the remote host.  See
     `tramp-connection-properties' for a way to overwrite this.
 
+  * `tramp-mount-args'
+  * `tramp-copyto-args'
+  * `tramp-moveto-args'
+  * `tramp-about-args'
+    These parameters, a list of list like `tramp-login-args', are used
+    for the \"rclone\" method, and are appended to the respective
+    \"rclone\" commands.  In general, they shouldn't be changed inside
+    `tramp-methods'; it is recommended to change their values via
+    `tramp-connection-properties'.  Unlike `tramp-login-args' there is
+     no pattern replacement.
+
 What does all this mean?  Well, you should specify `tramp-login-program'
 for all methods; this program is used to log in to the remote site.  Then,
 there are two ways to actually transfer the files between the local and the
@@ -305,7 +353,6 @@ Also see `tramp-default-method-alist'."
   :group 'tramp
   :type 'string)
 
-;;;###tramp-autoload
 (defcustom tramp-default-method-alist nil
   "Default method to use for specific host/user pairs.
 This is an alist of items (HOST USER METHOD).  The first matching item
@@ -335,7 +382,6 @@ This variable is regarded as obsolete, and will be removed 
soon."
   :group 'tramp
   :type '(choice (const nil) string))
 
-;;;###tramp-autoload
 (defcustom tramp-default-user-alist nil
   "Default user to use for specific method/host pairs.
 This is an alist of items (METHOD HOST USER).  The first matching item
@@ -357,7 +403,6 @@ Useful for su and sudo methods mostly."
   :group 'tramp
   :type 'string)
 
-;;;###tramp-autoload
 (defcustom tramp-default-host-alist nil
   "Default host to use for specific method/user pairs.
 This is an alist of items (METHOD USER HOST).  The first matching item
@@ -379,11 +424,17 @@ empty string for the method name."
 This is an alist of items (HOST USER PROXY).  The first matching
 item specifies the proxy to be passed for a file name located on
 a remote target matching address@hidden  HOST and USER are regular
-expressions.  PROXY must be a Tramp filename without a localname
-part.  Method and user name on PROXY are optional, which is
-interpreted with the default values.  PROXY can contain the
-patterns %h and %u, which are replaced by the strings matching
-HOST or USER, respectively.
+expressions, which could also cover a domain (USER%DOMAIN) or
+port (HOST#PORT).  PROXY must be a Tramp filename without a
+localname part.  Method and user name on PROXY are optional,
+which is interpreted with the default values.
+
+PROXY can contain the patterns %h and %u, which are replaced by
+the strings matching HOST or USER (without DOMAIN and PORT parts),
+respectively.
+
+If an entry is added while parsing ad-hoc hop definitions, PROXY
+carries the non-nil text property `tramp-ad-hoc'.
 
 HOST, USER or PROXY could also be Lisp forms, which will be
 evaluated.  The result must be a string or nil, which is
@@ -411,7 +462,6 @@ host runs a registered shell, it shall be added to this 
list, too."
   :group 'tramp
   :type '(repeat (regexp :tag "Host regexp")))
 
-;;;###tramp-autoload
 (defcustom tramp-local-host-regexp
   (concat
    "\\`"
@@ -638,7 +688,6 @@ Useful for \"rsync\" like methods.")
 (make-variable-buffer-local 'tramp-temp-buffer-file-name)
 (put 'tramp-temp-buffer-file-name 'permanent-local t)
 
-;;;###tramp-autoload
 (defcustom tramp-syntax 'default
   "Tramp filename syntax to be used.
 
@@ -657,8 +706,8 @@ Customize.  See also `tramp-change-syntax'."
                 (const :tag "Ange-FTP" simplified)
                 (const :tag "XEmacs" separate))
   :require 'tramp
-  :initialize 'custom-initialize-set
-  :set 'tramp-set-syntax)
+  :initialize #'custom-initialize-default
+  :set #'tramp-set-syntax)
 
 (defun tramp-set-syntax (symbol value)
   "Set SYMBOL to value VALUE.
@@ -666,7 +715,7 @@ Used in user option `tramp-syntax'.  There are further 
variables
 to be set, depending on VALUE."
   ;; Check allowed values.
   (unless (memq value (tramp-syntax-values))
-    (tramp-user-error "Wrong `tramp-syntax' %s" tramp-syntax))
+    (tramp-user-error "Wrong `tramp-syntax' %s" value))
   ;; Cleanup existing buffers.
   (unless (eq (symbol-value symbol) value)
     (tramp-cleanup-all-buffers))
@@ -698,14 +747,15 @@ to be set, depending on VALUE."
 ;; value of `tramp-file-name-regexp'.  Other Tramp syntax variables
 ;; must be initialized as well to proper values.  We do not call
 ;; `custom-set-variable', this would load Tramp via custom.el.
-(eval-after-load 'tramp
-  '(tramp-set-syntax 'tramp-syntax (tramp-compat-tramp-syntax)))
+(tramp--with-startup
+  (tramp-set-syntax 'tramp-syntax (tramp-compat-tramp-syntax)))
 
 (defun tramp-syntax-values ()
   "Return possible values of `tramp-syntax', a list"
   (let ((values (cdr (get 'tramp-syntax 'custom-type))))
-    (setq values (mapcar 'last values)
-         values (mapcar 'car values))))
+    (setq values (mapcar #'last values)
+         values (mapcar #'car values))
+    values))
 
 (defun tramp-lookup-syntax (alist)
   "Look up a syntax string in ALIST according to `tramp-compat-tramp-syntax.'
@@ -722,14 +772,14 @@ Raise an error if `tramp-syntax' is invalid."
 (defun tramp-build-prefix-format ()
   (tramp-lookup-syntax tramp-prefix-format-alist))
 
-(defvar tramp-prefix-format (tramp-build-prefix-format)
+(defvar tramp-prefix-format nil ;Initialized when defining `tramp-syntax'!
   "String matching the very beginning of Tramp file names.
 Used in `tramp-make-tramp-file-name'.")
 
 (defun tramp-build-prefix-regexp ()
   (concat "^" (regexp-quote tramp-prefix-format)))
 
-(defvar tramp-prefix-regexp (tramp-build-prefix-regexp)
+(defvar tramp-prefix-regexp nil ;Initialized when defining `tramp-syntax'!
   "Regexp matching the very beginning of Tramp file names.
 Should always start with \"^\". Derived from `tramp-prefix-format'.")
 
@@ -742,7 +792,7 @@ Should always start with \"^\". Derived from 
`tramp-prefix-format'.")
 (defun tramp-build-method-regexp ()
   (tramp-lookup-syntax tramp-method-regexp-alist))
 
-(defvar tramp-method-regexp (tramp-build-method-regexp)
+(defvar tramp-method-regexp nil ;Initialized when defining `tramp-syntax'!
   "Regexp matching methods identifiers.
 The `ftp' syntax does not support methods.")
 
@@ -755,7 +805,7 @@ The `ftp' syntax does not support methods.")
 (defun tramp-build-postfix-method-format ()
   (tramp-lookup-syntax tramp-postfix-method-format-alist))
 
-(defvar tramp-postfix-method-format (tramp-build-postfix-method-format)
+(defvar tramp-postfix-method-format nil ;Init'd when defining `tramp-syntax'!
   "String matching delimiter between method and user or host names.
 The `ftp' syntax does not support methods.
 Used in `tramp-make-tramp-file-name'.")
@@ -763,18 +813,16 @@ Used in `tramp-make-tramp-file-name'.")
 (defun tramp-build-postfix-method-regexp ()
   (regexp-quote tramp-postfix-method-format))
 
-(defvar tramp-postfix-method-regexp (tramp-build-postfix-method-regexp)
+(defvar tramp-postfix-method-regexp nil ;Init'd when defining `tramp-syntax'!
   "Regexp matching delimiter between method and user or host names.
 Derived from `tramp-postfix-method-format'.")
 
 (defconst tramp-user-regexp "[^/|: \t]+"
   "Regexp matching user names.")
 
-;;;###tramp-autoload
 (defconst tramp-prefix-domain-format "%"
   "String matching delimiter between user and domain names.")
 
-;;;###tramp-autoload
 (defconst tramp-prefix-domain-regexp (regexp-quote tramp-prefix-domain-format)
   "Regexp matching delimiter between user and domain names.
 Derived from `tramp-prefix-domain-format'.")
@@ -808,21 +856,21 @@ Derived from `tramp-postfix-user-format'.")
 (defun tramp-build-prefix-ipv6-format ()
   (tramp-lookup-syntax tramp-prefix-ipv6-format-alist))
 
-(defvar tramp-prefix-ipv6-format (tramp-build-prefix-ipv6-format)
+(defvar tramp-prefix-ipv6-format nil ;Initialized when defining `tramp-syntax'!
   "String matching left hand side of IPv6 addresses.
 Used in `tramp-make-tramp-file-name'.")
 
 (defun tramp-build-prefix-ipv6-regexp ()
   (regexp-quote tramp-prefix-ipv6-format))
 
-(defvar tramp-prefix-ipv6-regexp (tramp-build-prefix-ipv6-regexp)
+(defvar tramp-prefix-ipv6-regexp nil ;Initialized when defining `tramp-syntax'!
   "Regexp matching left hand side of IPv6 addresses.
 Derived from `tramp-prefix-ipv6-format'.")
 
 ;; The following regexp is a bit sloppy.  But it shall serve our
 ;; purposes.  It covers also IPv4 mapped IPv6 addresses, like in
 ;; "::ffff:192.168.0.1".
-(defconst tramp-ipv6-regexp "\\(?:\\(?:[a-zA-Z0-9]+\\)?:\\)+[a-zA-Z0-9.]+"
+(defconst tramp-ipv6-regexp "\\(?:[a-zA-Z0-9]*:\\)+[a-zA-Z0-9.]+"
   "Regexp matching IPv6 addresses.")
 
 (defconst tramp-postfix-ipv6-format-alist
@@ -834,14 +882,14 @@ Derived from `tramp-prefix-ipv6-format'.")
 (defun tramp-build-postfix-ipv6-format ()
   (tramp-lookup-syntax tramp-postfix-ipv6-format-alist))
 
-(defvar tramp-postfix-ipv6-format (tramp-build-postfix-ipv6-format)
+(defvar tramp-postfix-ipv6-format nil ;Initialized when defining 
`tramp-syntax'!
   "String matching right hand side of IPv6 addresses.
 Used in `tramp-make-tramp-file-name'.")
 
 (defun tramp-build-postfix-ipv6-regexp ()
   (regexp-quote tramp-postfix-ipv6-format))
 
-(defvar tramp-postfix-ipv6-regexp (tramp-build-postfix-ipv6-regexp)
+(defvar tramp-postfix-ipv6-regexp nil ;Initialized when defining 
`tramp-syntax'!
   "Regexp matching right hand side of IPv6 addresses.
 Derived from `tramp-postfix-ipv6-format'.")
 
@@ -877,14 +925,14 @@ Derived from `tramp-postfix-hop-format'.")
 (defun tramp-build-postfix-host-format ()
   (tramp-lookup-syntax tramp-postfix-host-format-alist))
 
-(defvar tramp-postfix-host-format (tramp-build-postfix-host-format)
+(defvar tramp-postfix-host-format nil ;Initialized when defining 
`tramp-syntax'!
   "String matching delimiter between host names and localnames.
 Used in `tramp-make-tramp-file-name'.")
 
 (defun tramp-build-postfix-host-regexp ()
   (regexp-quote tramp-postfix-host-format))
 
-(defvar tramp-postfix-host-regexp (tramp-build-postfix-host-regexp)
+(defvar tramp-postfix-host-regexp nil ;Initialized when defining 
`tramp-syntax'!
   "Regexp matching delimiter between host names and localnames.
 Derived from `tramp-postfix-host-format'.")
 
@@ -911,7 +959,7 @@ It is expected, that `tramp-syntax' has the proper value."
           "\\(?:" tramp-prefix-port-regexp  tramp-port-regexp "\\)?" "\\)?"))
 
 (defvar tramp-remote-file-name-spec-regexp
-  (tramp-build-remote-file-name-spec-regexp)
+   nil ;Initialized when defining `tramp-syntax'!
   "Regular expression matching a Tramp file name between prefix and postfix.")
 
 (defun tramp-build-file-name-structure ()
@@ -927,7 +975,7 @@ See `tramp-file-name-structure'."
     "\\(" tramp-localname-regexp "\\)")
    5 6 7 8 1))
 
-(defvar tramp-file-name-structure (tramp-build-file-name-structure)
+(defvar tramp-file-name-structure nil ;Initialized when defining 
`tramp-syntax'!
   "List of six elements (REGEXP METHOD USER HOST FILE HOP), detailing \
 the Tramp file name structure.
 
@@ -1020,7 +1068,7 @@ See `tramp-file-name-structure' for more explanations.")
   (tramp-lookup-syntax tramp-completion-file-name-regexp-alist))
 
 (defvar tramp-completion-file-name-regexp
-  (tramp-build-completion-file-name-regexp)
+   nil ;Initialized when defining `tramp-syntax'!
   "Regular expression matching file names handled by Tramp completion.
 This regexp should match partial Tramp file names only.
 
@@ -1180,7 +1228,6 @@ Operations not mentioned here will be handled by Tramp's 
file
 name handler functions, or the normal Emacs functions.")
 
 ;; Handlers for foreign methods, like FTP or SMB, shall be plugged here.
-;;;###tramp-autoload
 (defvar tramp-foreign-file-name-handler-alist nil
   "Alist of elements (FUNCTION . HANDLER) for foreign methods handled 
specially.
 If (FUNCTION FILENAME) returns non-nil, then all I/O on that file is done by
@@ -1219,6 +1266,7 @@ If nil, return `tramp-default-port'."
   (or (tramp-file-name-port vec)
       (tramp-get-method-parameter vec 'tramp-default-port)))
 
+;; Comparision of file names is performed by `tramp-equal-remote'.
 (defun tramp-file-name-equal-p (vec1 vec2)
   "Check, whether VEC1 and VEC2 denote the same `tramp-file-name'."
   (and (tramp-file-name-p vec1) (tramp-file-name-p vec2)
@@ -1249,7 +1297,6 @@ entry does not exist, return nil."
   "Return unquoted localname component of VEC."
   (tramp-compat-file-name-unquote (tramp-file-name-localname vec)))
 
-;;;###tramp-autoload
 (defun tramp-tramp-file-p (name)
   "Return t if NAME is a string with Tramp file name syntax."
   (and tramp-mode (stringp name)
@@ -1278,8 +1325,8 @@ This is METHOD, if non-nil. Otherwise, do a lookup in
                   lmethod item)
               (while choices
                 (setq item (pop choices))
-                (when (and (string-match (or (nth 0 item) "") (or host ""))
-                           (string-match (or (nth 1 item) "") (or user "")))
+                (when (and (string-match-p (or (nth 0 item) "") (or host ""))
+                           (string-match-p (or (nth 1 item) "") (or user "")))
                   (setq lmethod (nth 2 item))
                   (setq choices nil)))
               lmethod)
@@ -1299,8 +1346,8 @@ This is USER, if non-nil. Otherwise, do a lookup in
                   luser item)
               (while choices
                 (setq item (pop choices))
-                (when (and (string-match (or (nth 0 item) "") (or method ""))
-                           (string-match (or (nth 1 item) "") (or host "")))
+                (when (and (string-match-p (or (nth 0 item) "") (or method ""))
+                           (string-match-p (or (nth 1 item) "") (or host "")))
                   (setq luser (nth 2 item))
                   (setq choices nil)))
               luser)
@@ -1320,8 +1367,8 @@ This is HOST, if non-nil. Otherwise, do a lookup in
                   lhost item)
               (while choices
                 (setq item (pop choices))
-                (when (and (string-match (or (nth 0 item) "") (or method ""))
-                           (string-match (or (nth 1 item) "") (or user "")))
+                (when (and (string-match-p (or (nth 0 item) "") (or method ""))
+                           (string-match-p (or (nth 1 item) "") (or user "")))
                   (setq lhost (nth 2 item))
                   (setq choices nil)))
               lhost)
@@ -1369,7 +1416,7 @@ default values are used."
            (setq v (tramp-dissect-hop-name hop)
                  hop (and hop (tramp-make-tramp-hop-name v))))
          (let ((tramp-default-host
-                (or (and v (not (string-match "%h" (tramp-file-name-host v)))
+                (or (and v (not (string-match-p "%h" (tramp-file-name-host v)))
                          (tramp-file-name-host v))
                     tramp-default-host)))
            (setq method (tramp-find-method method user host)
@@ -1379,19 +1426,36 @@ default values are used."
                  (and hop
                       (format-spec hop (format-spec-make ?h host ?u user))))))
 
-       (make-tramp-file-name
-        :method method :user user :domain domain :host host :port port
-        :localname localname :hop hop)))))
+       ;; Return result.
+       (prog1
+           (setq v (make-tramp-file-name
+                    :method method :user user :domain domain :host host
+                    :port port :localname localname :hop hop))
+         ;; Only some methods from tramp-sh.el do support multi-hops.
+         (when (and
+                hop
+                (or (not (tramp-get-method-parameter v 'tramp-login-program))
+                    (tramp-get-method-parameter v 'tramp-copy-program)))
+           (tramp-user-error
+            v "Method `%s' is not supported for multi-hops." method)))))))
 
 (defun tramp-dissect-hop-name (name &optional nodefault)
   "Return a `tramp-file-name' structure of `hop' part of NAME.
 See `tramp-dissect-file-name' for details."
-  (tramp-dissect-file-name
-   (concat
-    tramp-prefix-format
-    (replace-regexp-in-string
-     (concat tramp-postfix-hop-regexp "$") tramp-postfix-host-format name))
-   nodefault))
+  (let ((v (tramp-dissect-file-name
+           (concat tramp-prefix-format
+                   (replace-regexp-in-string
+                    (concat tramp-postfix-hop-regexp "$")
+                    tramp-postfix-host-format name))
+           nodefault)))
+    ;; Only some methods from tramp-sh.el do support multi-hops.
+    (when (or (not (tramp-get-method-parameter v 'tramp-login-program))
+             (tramp-get-method-parameter v 'tramp-copy-program))
+      (tramp-user-error
+       v "Method `%s' is not supported for multi-hops."
+       (tramp-file-name-method v)))
+    ;; Return result.
+    v))
 
 (defun tramp-buffer-name (vec)
   "A name for the connection buffer VEC."
@@ -1442,7 +1506,7 @@ the form (METHOD USER DOMAIN HOST PORT LOCALNAME 
&optional HOP)."
     ;; Unless `tramp-syntax' is `simplified', we need a method.
     (when (and (not (zerop (length tramp-postfix-method-format)))
               (zerop (length method)))
-      (signal 'wrong-type-argument (list 'stringp method)))
+      (signal 'wrong-type-argument (list #'stringp method)))
     (concat tramp-prefix-format hop
            (unless (zerop (length tramp-postfix-method-format))
              (concat method tramp-postfix-method-format))
@@ -1452,7 +1516,7 @@ the form (METHOD USER DOMAIN HOST PORT LOCALNAME 
&optional HOP)."
            (unless (zerop (length user))
              tramp-postfix-user-format)
            (when host
-             (if (string-match tramp-ipv6-regexp host)
+             (if (string-match-p tramp-ipv6-regexp host)
                  (concat
                   tramp-prefix-ipv6-format host tramp-postfix-ipv6-format)
                host))
@@ -1481,7 +1545,7 @@ necessary only.  This function will be used in file name 
completion."
            (concat user tramp-postfix-user-format))
          (unless (zerop (length host))
            (concat
-            (if (string-match tramp-ipv6-regexp host)
+            (if (string-match-p tramp-ipv6-regexp host)
                 (concat
                  tramp-prefix-ipv6-format host tramp-postfix-ipv6-format)
               host)
@@ -1586,7 +1650,7 @@ The outline level is equal to the verbosity of the Tramp 
message."
       (set (make-local-variable 'outline-regexp) tramp-debug-outline-regexp)
       (set (make-local-variable 'outline-level) 'tramp-debug-outline-level)
       ;; Do not edit the debug buffer.
-      (set-keymap-parent (current-local-map) special-mode-map))
+      (use-local-map special-mode-map))
     (current-buffer)))
 
 (defsubst tramp-debug-message (vec fmt-string &rest arguments)
@@ -1602,10 +1666,13 @@ ARGUMENTS to actually emit the message (if applicable)."
        ";; Emacs: %s Tramp: %s -*- mode: outline; -*-"
        emacs-version tramp-version))
       (when (>= tramp-verbose 10)
-       (insert
-        (format
-         "\n;; Location: %s Git: %s"
-         (locate-library "tramp") (tramp-repository-get-version)))))
+       (let ((tramp-verbose 0))
+         (insert
+          (format
+           "\n;; Location: %s Git: %s/%s"
+           (locate-library "tramp")
+           (or tramp-repository-branch "")
+           (or tramp-repository-version ""))))))
     (unless (bolp)
       (insert "\n"))
     ;; Timestamp.
@@ -1623,22 +1690,23 @@ ARGUMENTS to actually emit the message (if applicable)."
            (setq fn (symbol-name btf))
            (unless
                (and
-                (string-match "^tramp" fn)
+                (string-match-p "^tramp" fn)
                 (not
-                 (string-match
-                  (concat
-                   "^"
-                   (regexp-opt
-                    '("tramp-backtrace"
-                      "tramp-compat-funcall"
-                      "tramp-condition-case-unless-debug"
-                      "tramp-debug-message"
-                      "tramp-error"
-                      "tramp-error-with-buffer"
-                      "tramp-message"
-                      "tramp-user-error")
-                    t)
-                   "$")
+                 (string-match-p
+                  (eval-when-compile
+                    (concat
+                     "^"
+                     (regexp-opt
+                      '("tramp-backtrace"
+                        "tramp-compat-funcall"
+                        "tramp-condition-case-unless-debug"
+                        "tramp-debug-message"
+                        "tramp-error"
+                        "tramp-error-with-buffer"
+                        "tramp-message"
+                        "tramp-user-error")
+                      t)
+                     "$"))
                   fn)))
              (setq fn nil)))
          (setq btn (1+ btn))))
@@ -1676,39 +1744,37 @@ control string and the remaining ARGUMENTS to actually 
emit the message (if
 applicable)."
   (ignore-errors
     (when (<= level tramp-verbose)
-      ;; Match data must be preserved!
-      (save-match-data
-       ;; Display only when there is a minimum level.
-       (when (and tramp-message-show-message (<= level 3))
-         (apply 'message
-                (concat
-                 (cond
-                  ((= level 0) "")
-                  ((= level 1) "")
-                  ((= level 2) "Warning: ")
-                  (t           "Tramp: "))
-                 fmt-string)
-                arguments))
-       ;; Log only when there is a minimum level.
-       (when (>= tramp-verbose 4)
-         (let ((tramp-verbose 0))
-           ;; Append connection buffer for error messages.
-           (when (= level 1)
-             (with-current-buffer
-                 (if (processp vec-or-proc)
-                     (process-buffer vec-or-proc)
-                   (tramp-get-connection-buffer vec-or-proc))
-               (setq fmt-string (concat fmt-string "\n%s")
-                     arguments (append arguments (list (buffer-string))))))
-           ;; Translate proc to vec.
-           (when (processp vec-or-proc)
-             (setq vec-or-proc (process-get vec-or-proc 'vector))))
-         ;; Do it.
-         (when (tramp-file-name-p vec-or-proc)
-           (apply 'tramp-debug-message
-                  vec-or-proc
-                  (concat (format "(%d) # " level) fmt-string)
-                  arguments)))))))
+      ;; Display only when there is a minimum level.
+      (when (and tramp-message-show-message (<= level 3))
+       (apply #'message
+              (concat
+               (cond
+                ((= level 0) "")
+                ((= level 1) "")
+                ((= level 2) "Warning: ")
+                (t           "Tramp: "))
+               fmt-string)
+              arguments))
+      ;; Log only when there is a minimum level.
+      (when (>= tramp-verbose 4)
+       (let ((tramp-verbose 0))
+         ;; Append connection buffer for error messages.
+         (when (= level 1)
+           (with-current-buffer
+               (if (processp vec-or-proc)
+                   (process-buffer vec-or-proc)
+                 (tramp-get-connection-buffer vec-or-proc))
+             (setq fmt-string (concat fmt-string "\n%s")
+                   arguments (append arguments (list (buffer-string))))))
+         ;; Translate proc to vec.
+         (when (processp vec-or-proc)
+           (setq vec-or-proc (process-get vec-or-proc 'vector))))
+       ;; Do it.
+       (when (tramp-file-name-p vec-or-proc)
+         (apply #'tramp-debug-message
+                vec-or-proc
+                (concat (format "(%d) # " level) fmt-string)
+                arguments))))))
 
 (defsubst tramp-backtrace (&optional vec-or-proc)
   "Dump a backtrace into the debug buffer.
@@ -1756,7 +1822,7 @@ an input event arrives.  The other arguments are passed 
to `tramp-error'."
                    (and buf (with-current-buffer buf
                               (tramp-dissect-file-name default-directory))))))
       (unwind-protect
-         (apply 'tramp-error vec-or-proc signal fmt-string arguments)
+         (apply #'tramp-error vec-or-proc signal fmt-string arguments)
        ;; Save exit.
        (when (and buf
                   tramp-message-show-message
@@ -1768,7 +1834,7 @@ an input event arrives.  The other arguments are passed 
to `tramp-error'."
          (let ((enable-recursive-minibuffers t))
            ;; `tramp-error' does not show messages.  So we must do it
            ;; ourselves.
-           (apply 'message fmt-string arguments)
+           (apply #'message fmt-string arguments)
            ;; Show buffer.
            (pop-to-buffer buf)
            (discard-input)
@@ -1782,7 +1848,7 @@ an input event arrives.  The other arguments are passed 
to `tramp-error'."
   "Signal a pilot error."
   (unwind-protect
       (apply
-       'tramp-error vec-or-proc
+       #'tramp-error vec-or-proc
        ;; `user-error' has appeared in Emacs 24.3.
        (if (fboundp 'user-error) 'user-error 'error) fmt-string arguments)
     ;; Save exit.
@@ -1794,7 +1860,7 @@ an input event arrives.  The other arguments are passed 
to `tramp-error'."
               (current-message))
       (let ((enable-recursive-minibuffers t))
        ;; `tramp-error' does not show messages.  So we must do it ourselves.
-       (apply 'message fmt-string arguments)
+       (apply #'message fmt-string arguments)
        (discard-input)
        (sit-for 30)
        ;; Reset timestamp.  It would be wrong after waiting for a while.
@@ -1852,7 +1918,7 @@ If VAR is nil, then we bind `v' to the structure and 
`method', `user',
   "Report progress of an operation for Tramp."
   (let* ((parameters (cdr reporter))
         (message (aref parameters 3)))
-    (when (string-match message (or (current-message) ""))
+    (when (string-match-p message (or (current-message) ""))
       (progress-reporter-update reporter value))))
 
 (defmacro with-tramp-progress-reporter (vec level message &rest body)
@@ -1925,7 +1991,7 @@ letter into the file name.  This function removes it."
   (save-match-data
     (funcall
      (if (tramp-compat-file-name-quoted-p name)
-        'tramp-compat-file-name-quote 'identity)
+        #'tramp-compat-file-name-quote #'identity)
      (let ((name (tramp-compat-file-name-unquote name)))
        (if (string-match "\\`[a-zA-Z]:/" name)
           (replace-match "/" nil t name)
@@ -1933,7 +1999,6 @@ letter into the file name.  This function removes it."
 
 ;;; Config Manipulation Functions:
 
-;;;###tramp-autoload
 (defun tramp-set-completion-function (method function-list)
   "Sets the list of completion functions for METHOD.
 FUNCTION-LIST is a list of entries of the form (FUNCTION FILE).
@@ -1947,7 +2012,6 @@ Example:
      \"ssh\"
      \\='((tramp-parse-sconfig \"/etc/ssh_config\")
        (tramp-parse-sconfig \"~/.ssh/config\")))"
-
   (let ((r function-list)
        (v function-list))
     (setq tramp-completion-function-alist
@@ -1962,13 +2026,13 @@ Example:
       (unless (and (functionp (nth 0 (car v)))
                   (cond
                    ;; Windows registry.
-                   ((string-match "^HKEY_CURRENT_USER" (nth 1 (car v)))
+                   ((string-match-p "^HKEY_CURRENT_USER" (nth 1 (car v)))
                     (and (memq system-type '(cygwin windows-nt))
                          (zerop
                           (tramp-call-process
                            v "reg" nil nil nil "query" (nth 1 (car v))))))
                    ;; Zeroconf service type.
-                   ((string-match
+                   ((string-match-p
                      "^_[[:alpha:]]+\\._[[:alpha:]]+$" (nth 1 (car v))))
                    ;; Configuration file.
                    (t (file-exists-p (nth 1 (car v))))))
@@ -1992,77 +2056,6 @@ For definition of that list see 
`tramp-set-completion-function'."
    ;; The method related defaults.
    (cdr (assoc method tramp-completion-function-alist))))
 
-;;; Fontification of `read-file-name':
-
-(defvar tramp-rfn-eshadow-overlay)
-(make-variable-buffer-local 'tramp-rfn-eshadow-overlay)
-
-(defun tramp-rfn-eshadow-setup-minibuffer ()
-  "Set up a minibuffer for `file-name-shadow-mode'.
-Adds another overlay hiding filename parts according to Tramp's
-special handling of `substitute-in-file-name'."
-  (when minibuffer-completing-file-name
-    (setq tramp-rfn-eshadow-overlay
-         (make-overlay (minibuffer-prompt-end) (minibuffer-prompt-end)))
-    ;; Copy rfn-eshadow-overlay properties.
-    (let ((props (overlay-properties rfn-eshadow-overlay)))
-      (while props
-       ;; The `field' property prevents correct minibuffer
-       ;; completion; we exclude it.
-       (if (not (eq (car props) 'field))
-            (overlay-put tramp-rfn-eshadow-overlay (pop props) (pop props))
-         (pop props) (pop props))))))
-
-(add-hook 'rfn-eshadow-setup-minibuffer-hook
-         'tramp-rfn-eshadow-setup-minibuffer)
-(add-hook 'tramp-unload-hook
-         (lambda ()
-           (remove-hook 'rfn-eshadow-setup-minibuffer-hook
-                        'tramp-rfn-eshadow-setup-minibuffer)))
-
-(defun tramp-rfn-eshadow-update-overlay-regexp ()
-  (format "[^%s/~]*\\(/\\|~\\)" tramp-postfix-host-format))
-
-;; Package rfn-eshadow is preloaded in Emacs, but for some reason,
-;; it only did (defvar rfn-eshadow-overlay) without giving it a global
-;; value, so it was only declared as dynamically-scoped within the
-;; rfn-eshadow.el file.  This is now fixed in Emacs>26.1 but we still need
-;; this defvar here for older releases.
-(defvar rfn-eshadow-overlay)
-
-(defun tramp-rfn-eshadow-update-overlay ()
-  "Update `rfn-eshadow-overlay' to cover shadowed part of minibuffer input.
-This is intended to be used as a minibuffer `post-command-hook' for
-`file-name-shadow-mode'; the minibuffer should have already
-been set up by `rfn-eshadow-setup-minibuffer'."
-  ;; In remote files name, there is a shadowing just for the local part.
-  (ignore-errors
-    (let ((end (or (overlay-end rfn-eshadow-overlay)
-                  (minibuffer-prompt-end)))
-         ;; We do not want to send any remote command.
-         (non-essential t))
-      (when (tramp-tramp-file-p (buffer-substring end (point-max)))
-       (save-excursion
-         (save-restriction
-           (narrow-to-region
-            (1+ (or (string-match
-                     (tramp-rfn-eshadow-update-overlay-regexp)
-                     (buffer-string) end)
-                    end))
-            (point-max))
-           (let ((rfn-eshadow-overlay tramp-rfn-eshadow-overlay)
-                 (rfn-eshadow-update-overlay-hook nil)
-                 file-name-handler-alist)
-             (move-overlay rfn-eshadow-overlay (point-max) (point-max))
-             (rfn-eshadow-update-overlay))))))))
-
-(add-hook 'rfn-eshadow-update-overlay-hook
-         'tramp-rfn-eshadow-update-overlay)
-(add-hook 'tramp-unload-hook
-         (lambda ()
-           (remove-hook 'rfn-eshadow-update-overlay-hook
-                        'tramp-rfn-eshadow-update-overlay)))
-
 ;; Inodes don't exist for some file systems.  Therefore we must
 ;; generate virtual ones.  Used in `find-buffer-visiting'.  The method
 ;; applied might be not so efficient (Ange-FTP uses hashes). But
@@ -2084,7 +2077,7 @@ been set up by `rfn-eshadow-setup-minibuffer'."
 If the file modes of FILENAME cannot be determined, return the
 value of `default-file-modes', without execute permissions."
   (or (file-modes filename)
-      (logand (default-file-modes) (string-to-number "0666" 8))))
+      (logand (default-file-modes) #o0666)))
 
 (defun tramp-replace-environment-variables (filename)
  "Replace environment variables in FILENAME.
@@ -2094,7 +2087,7 @@ Return the string with the replaced variables."
        (tramp-compat-funcall 'substitute-env-vars filename 'only-defined))
      ;; We need an own implementation.
      (save-match-data
-       (let ((idx (string-match "$\\(\\w+\\)" filename)))
+       (let ((idx (string-match "\\$\\(\\w+\\)" filename)))
         ;; `$' is coded as `$$'.
         (when (and idx
                    (or (zerop idx) (not (eq ?$ (aref filename (1- idx)))))
@@ -2113,7 +2106,7 @@ expression, which matches more than the file name suffix, 
the
 coding system might not be determined.  This function repairs it."
   (let (result)
     (dolist (elt file-coding-system-alist (nreverse result))
-      (when (and (consp elt) (string-match (car elt) filename))
+      (when (and (consp elt) (string-match-p (car elt) filename))
        ;; We found a matching entry in `file-coding-system-alist'.
        ;; So we add a similar entry, but with the temporary file name
        ;; as regexp.
@@ -2161,7 +2154,7 @@ ARGS are the arguments OPERATION has been called with."
              file-ownership-preserved-p file-readable-p
              file-regular-p file-remote-p file-selinux-context
              file-symlink-p file-truename file-writable-p
-             find-backup-file-name find-file-noselect get-file-buffer
+             find-backup-file-name get-file-buffer
              insert-directory insert-file-contents load
              make-directory make-directory-internal set-file-acl
              set-file-modes set-file-selinux-context set-file-times
@@ -2170,7 +2163,9 @@ ARGS are the arguments OPERATION has been called with."
              ;; Emacs 26+ only.
              file-name-case-insensitive-p
              ;; Emacs 27+ only.
-             file-system-info))
+             file-system-info
+             ;; Tramp internal magic file name function.
+             tramp-set-file-uid-gid))
     (if (file-name-absolute-p (nth 0 args))
        (nth 0 args)
       default-directory))
@@ -2185,18 +2180,16 @@ ARGS are the arguments OPERATION has been called with."
              ;; file name to be checked.  Handled properly in
              ;; `tramp-handle-*-make-symbolic-link'.
              file-newer-than-file-p make-symbolic-link rename-file))
-    (save-match-data
-      (cond
-       ((tramp-tramp-file-p (nth 0 args)) (nth 0 args))
-       ((tramp-tramp-file-p (nth 1 args)) (nth 1 args))
-       (t default-directory))))
+    (cond
+     ((tramp-tramp-file-p (nth 0 args)) (nth 0 args))
+     ((tramp-tramp-file-p (nth 1 args)) (nth 1 args))
+     (t default-directory)))
    ;; FILE DIRECTORY resp FILE1 FILE2.
    ((eq operation 'expand-file-name)
-    (save-match-data
-      (cond
-       ((file-name-absolute-p (nth 0 args)) (nth 0 args))
-       ((tramp-tramp-file-p (nth 1 args)) (nth 1 args))
-       (t default-directory))))
+    (cond
+     ((file-name-absolute-p (nth 0 args)) (nth 0 args))
+     ((tramp-tramp-file-p (nth 1 args)) (nth 1 args))
+     (t default-directory)))
    ;; START END FILE.
    ((eq operation 'write-region)
     (if (file-name-absolute-p (nth 2 args))
@@ -2214,7 +2207,7 @@ ARGS are the arguments OPERATION has been called with."
              ;; Emacs 26+ only.
              make-nearby-temp-file temporary-file-directory
              ;; Emacs 27+ only.
-             exec-path))
+             exec-path make-process))
     default-directory)
    ;; PROC.
    ((member operation
@@ -2246,6 +2239,7 @@ ARGS are the arguments OPERATION has been called with."
 (defmacro tramp-condition-case-unless-debug
   (var bodyform &rest handlers)
   "Like `condition-case-unless-debug' but `tramp-debug-on-error'."
+  (declare (debug condition-case) (indent 2))
   `(let ((debug-on-error tramp-debug-on-error))
      (condition-case-unless-debug ,var ,bodyform ,@handlers)))
 
@@ -2280,7 +2274,7 @@ preventing reentrant calls of Tramp.")
 (defun tramp-file-name-handler (operation &rest args)
   "Invoke Tramp file name handler.
 Falls back to normal file name handler if no Tramp file name handler exists."
-  (let ((filename (apply 'tramp-file-name-for-operation operation args)))
+  (let ((filename (apply #'tramp-file-name-for-operation operation args)))
     (if (tramp-tramp-file-p filename)
        (save-match-data
           (setq filename (tramp-replace-environment-variables filename))
@@ -2425,19 +2419,19 @@ remote file names."
           "^%s$"
           (regexp-opt
            (mapcar
-            'file-name-sans-extension
+            #'file-name-sans-extension
             (directory-files dir nil "^tramp.+\\.elc?$"))
            'paren))))
     (mapatoms
      (lambda (atom)
        (when (and (functionp atom)
                  (autoloadp (symbol-function atom))
-                 (string-match files-regexp (cadr (symbol-function atom))))
+                 (string-match-p files-regexp (cadr (symbol-function atom))))
         (ignore-errors
           (setf (cadr (symbol-function atom))
                 (expand-file-name (cadr (symbol-function atom)) dir))))))))
 
-(eval-after-load 'tramp (tramp-use-absolute-autoload-file-names))
+(tramp--with-startup (tramp-use-absolute-autoload-file-names))
 
 (defun tramp-register-file-name-handlers ()
   "Add Tramp file name handlers to `file-name-handler-alist'."
@@ -2450,21 +2444,21 @@ remote file names."
   ;; `tramp-archive-file-name-handler', this shall be done by the
   ;; respective foreign handlers.
   (add-to-list 'file-name-handler-alist
-              (cons tramp-file-name-regexp 'tramp-file-name-handler))
+              (cons tramp-file-name-regexp #'tramp-file-name-handler))
   (put 'tramp-file-name-handler 'safe-magic t)
 
   (add-to-list 'file-name-handler-alist
               (cons tramp-completion-file-name-regexp
-                    'tramp-completion-file-name-handler))
+                    #'tramp-completion-file-name-handler))
   (put 'tramp-completion-file-name-handler 'safe-magic t)
   ;; Mark `operations' the handler is responsible for.
   (put 'tramp-completion-file-name-handler 'operations
-       (mapcar 'car tramp-completion-file-name-handler-alist))
+       (mapcar #'car tramp-completion-file-name-handler-alist))
 
   (when (bound-and-true-p tramp-archive-enabled)
     (add-to-list 'file-name-handler-alist
                 (cons tramp-archive-file-name-regexp
-                      'tramp-archive-file-name-handler))
+                      #'tramp-archive-file-name-handler))
     (put 'tramp-archive-file-name-handler 'safe-magic t))
 
   ;; If jka-compr or epa-file are already loaded, move them to the
@@ -2475,10 +2469,9 @@ remote file names."
        (setq file-name-handler-alist
              (cons entry (delete entry file-name-handler-alist)))))))
 
-(eval-after-load 'tramp (tramp-register-file-name-handlers))
+(tramp--with-startup (tramp-register-file-name-handlers))
 
-;;;###tramp-autoload
-(progn (defun tramp-register-foreign-file-name-handler
+(defun tramp-register-foreign-file-name-handler
     (func handler &optional append)
   "Register (FUNC . HANDLER) in `tramp-foreign-file-name-handler-alist'.
 FUNC is the function, which determines whether HANDLER is to be called.
@@ -2492,8 +2485,8 @@ Add operations defined in `HANDLER-alist' to 
`tramp-file-name-handler'."
         (append
          (get 'tramp-file-name-handler 'operations)
          (mapcar
-          'car
-          (symbol-value (intern (concat (symbol-name handler) "-alist")))))))))
+          #'car
+          (symbol-value (intern (concat (symbol-name handler) "-alist"))))))))
 
 (defun tramp-exists-file-name-handler (operation &rest args)
   "Check, whether OPERATION runs a file name handler."
@@ -2523,7 +2516,7 @@ Add operations defined in `HANDLER-alist' to 
`tramp-file-name-handler'."
               (string-prefix-p "tramp-" (symbol-name (cdr fnh))))
       (setq file-name-handler-alist (delq fnh file-name-handler-alist))))))
 
-(add-hook 'tramp-unload-hook 'tramp-unload-file-name-handlers)
+(add-hook 'tramp-unload-hook #'tramp-unload-file-name-handlers)
 
 ;;; File name handler functions for completion mode:
 
@@ -2557,7 +2550,6 @@ not in completion mode."
 ;; completions.
 (defun tramp-completion-handle-file-name-all-completions (filename directory)
   "Like `file-name-all-completions' for partial Tramp files."
-
   (let ((fullname
         (tramp-drop-volume-letter (expand-file-name filename directory)))
        hop result result1)
@@ -2629,7 +2621,7 @@ not in completion mode."
   "Like `file-name-completion' for Tramp files."
   (try-completion
    filename
-   (mapcar 'list (file-name-all-completions filename directory))
+   (mapcar #'list (file-name-all-completions filename directory))
    (when (and predicate
              (tramp-connectable-p (expand-file-name filename directory)))
      (lambda (x) (funcall predicate (expand-file-name (car x) directory))))))
@@ -2654,7 +2646,6 @@ not in completion mode."
 (defun tramp-completion-dissect-file-name (name)
   "Returns a list of `tramp-file-name' structures.
 They are collected by `tramp-completion-dissect-file-name1'."
-
   (let* ((x-nil "\\|\\(\\)")
         (tramp-completion-ipv6-regexp
          (format
@@ -2729,7 +2720,6 @@ They are collected by 
`tramp-completion-dissect-file-name1'."
   "Returns a `tramp-file-name' structure matching STRUCTURE.
 The structure consists of remote method, remote user,
 remote host and localname (filename on remote host)."
-
   (save-match-data
     (when (string-match (nth 0 structure) name)
       (make-tramp-file-name
@@ -2747,9 +2737,9 @@ remote host and localname (filename on remote host)."
   (mapcar
    (lambda (method)
      (and method
-         (string-match (concat "^" (regexp-quote partial-method)) method)
+         (string-match-p (concat "^" (regexp-quote partial-method)) method)
          (tramp-completion-make-tramp-file-name method nil nil nil)))
-   (mapcar 'car tramp-methods)))
+   (mapcar #'car tramp-methods)))
 
 ;; Compares partial user and host names with possible completions.
 (defun tramp-get-completion-user-host
@@ -2760,7 +2750,7 @@ PARTIAL-USER must match USER, PARTIAL-HOST must match 
HOST."
 
    ((and partial-user partial-host)
     (if        (and host
-            (string-match (concat "^" (regexp-quote partial-host)) host)
+            (string-match-p (concat "^" (regexp-quote partial-host)) host)
             (string-equal partial-user (or user partial-user)))
        (setq user partial-user)
       (setq user nil
@@ -2769,13 +2759,15 @@ PARTIAL-USER must match USER, PARTIAL-HOST must match 
HOST."
    (partial-user
     (setq host nil)
     (unless
-       (and user (string-match (concat "^" (regexp-quote partial-user)) user))
+       (and user
+            (string-match-p (concat "^" (regexp-quote partial-user)) user))
       (setq user nil)))
 
    (partial-host
     (setq user nil)
     (unless
-       (and host (string-match (concat "^" (regexp-quote partial-host)) host))
+       (and host
+            (string-match-p (concat "^" (regexp-quote partial-host)) host))
       (setq host nil)))
 
    (t (setq user nil
@@ -2805,7 +2797,8 @@ for all methods.  Resulting data are derived from default 
settings."
   (and tramp-completion-use-auth-sources
        (mapcar
        (lambda (x) `(,(plist-get x :user) ,(plist-get x :host)))
-       (auth-source-search :port method :max most-positive-fixnum))))
+       (auth-source-search
+        :port method :require '(:port) :max most-positive-fixnum))))
 
 ;; Generic function.
 (defun tramp-parse-group (regexp match-level skip-regexp)
@@ -2832,11 +2825,10 @@ User is always nil."
        (goto-char (point-min))
         (cl-loop while (not (eobp)) collect (funcall function))))))
 
-;;;###tramp-autoload
 (defun tramp-parse-rhosts (filename)
   "Return a list of (user host) tuples allowed to access.
 Either user or host may be nil."
-  (tramp-parse-file filename 'tramp-parse-rhosts-group))
+  (tramp-parse-file filename #'tramp-parse-rhosts-group))
 
 (defun tramp-parse-rhosts-group ()
    "Return a (user host) tuple allowed to access.
@@ -2851,28 +2843,28 @@ Either user or host may be nil."
      (forward-line 1)
      result))
 
-;;;###tramp-autoload
 (defun tramp-parse-shosts (filename)
   "Return a list of (user host) tuples allowed to access.
 User is always nil."
-  (tramp-parse-file filename 'tramp-parse-shosts-group))
+  (tramp-parse-file filename #'tramp-parse-shosts-group))
 
 (defun tramp-parse-shosts-group ()
    "Return a (user host) tuple allowed to access.
 User is always nil."
    (tramp-parse-group (concat "^\\(" tramp-host-regexp "\\)") 1 ","))
 
-;;;###tramp-autoload
 (defun tramp-parse-sconfig (filename)
   "Return a list of (user host) tuples allowed to access.
 User is always nil."
-  (tramp-parse-file filename 'tramp-parse-sconfig-group))
+  (tramp-parse-file filename #'tramp-parse-sconfig-group))
 
 (defun tramp-parse-sconfig-group ()
    "Return a (user host) tuple allowed to access.
 User is always nil."
    (tramp-parse-group
-    (concat "^[ \t]*Host[ \t]+" "\\(" tramp-host-regexp "\\)") 1 ","))
+    (concat "\\(?:^[ \t]*Host\\)" "\\|" "\\(?:^.+\\)"
+           "\\|" "\\(" tramp-host-regexp "\\)")
+    1 "[ \t]+"))
 
 ;; Generic function.
 (defun tramp-parse-shostkeys-sknownhosts (dirname regexp)
@@ -2887,14 +2879,12 @@ User is always nil."
      when (and (not (string-match "^\\.\\.?$" f)) (string-match regexp f))
      collect (list nil (match-string 1 f)))))
 
-;;;###tramp-autoload
 (defun tramp-parse-shostkeys (dirname)
   "Return a list of (user host) tuples allowed to access.
 User is always nil."
   (tramp-parse-shostkeys-sknownhosts
    dirname (concat "^key_[0-9]+_\\(" tramp-host-regexp "\\)\\.pub$")))
 
-;;;###tramp-autoload
 (defun tramp-parse-sknownhosts (dirname)
   "Return a list of (user host) tuples allowed to access.
 User is always nil."
@@ -2902,11 +2892,10 @@ User is always nil."
    dirname
    (concat "^\\(" tramp-host-regexp "\\)\\.ssh-\\(dss\\|rsa\\)\\.pub$")))
 
-;;;###tramp-autoload
 (defun tramp-parse-hosts (filename)
   "Return a list of (user host) tuples allowed to access.
 User is always nil."
-  (tramp-parse-file filename 'tramp-parse-hosts-group))
+  (tramp-parse-file filename #'tramp-parse-hosts-group))
 
 (defun tramp-parse-hosts-group ()
    "Return a (user host) tuple allowed to access.
@@ -2914,7 +2903,6 @@ User is always nil."
    (tramp-parse-group
     (concat "^\\(" tramp-ipv6-regexp "\\|" tramp-host-regexp "\\)") 1 " \t"))
 
-;;;###tramp-autoload
 (defun tramp-parse-passwd (filename)
   "Return a list of (user host) tuples allowed to access.
 Host is always \"localhost\"."
@@ -2925,7 +2913,7 @@ Host is always \"localhost\"."
            (goto-char (point-min))
            (cl-loop while (not (eobp)) collect
                     (tramp-parse-etc-group-group))))
-      (tramp-parse-file filename 'tramp-parse-passwd-group))))
+      (tramp-parse-file filename #'tramp-parse-passwd-group))))
 
 (defun tramp-parse-passwd-group ()
    "Return a (user host) tuple allowed to access.
@@ -2937,7 +2925,6 @@ Host is always \"localhost\"."
      (forward-line 1)
      result))
 
-;;;###tramp-autoload
 (defun tramp-parse-etc-group (filename)
   "Return a list of (group host) tuples allowed to access.
 Host is always \"localhost\"."
@@ -2948,7 +2935,7 @@ Host is always \"localhost\"."
            (goto-char (point-min))
            (cl-loop while (not (eobp)) collect
                     (tramp-parse-etc-group-group))))
-      (tramp-parse-file filename 'tramp-parse-etc-group-group))))
+      (tramp-parse-file filename #'tramp-parse-etc-group-group))))
 
 (defun tramp-parse-etc-group-group ()
    "Return a (group host) tuple allowed to access.
@@ -2960,26 +2947,16 @@ Host is always \"localhost\"."
      (forward-line 1)
      result))
 
-;;;###tramp-autoload
 (defun tramp-parse-netrc (filename)
   "Return a list of (user host) tuples allowed to access.
 User may be nil."
-  (tramp-parse-file filename 'tramp-parse-netrc-group))
-
-(defun tramp-parse-netrc-group ()
-   "Return a (user host) tuple allowed to access.
-User may be nil."
-   (let ((result)
-        (regexp
-         (concat
-          "^[ \t]*machine[ \t]+" "\\(" tramp-host-regexp "\\)"
-          "\\([ \t]+login[ \t]+" "\\(" tramp-user-regexp "\\)" "\\)?")))
-     (when (re-search-forward regexp (point-at-eol) t)
-       (setq result (list (match-string 3) (match-string 1))))
-     (forward-line 1)
-     result))
+  (require 'netrc)
+  (mapcar
+   (lambda (item)
+     (and (assoc "machine" item)
+         `(,(cdr (assoc "login" item)) ,(cdr (assoc "machine" item)))))
+   (netrc-parse filename)))
 
-;;;###tramp-autoload
 (defun tramp-parse-putty (registry-or-dirname)
   "Return a list of (user host) tuples allowed to access.
 User is always nil."
@@ -3013,6 +2990,13 @@ User is always nil."
 (defvar tramp-handle-write-region-hook nil
   "Normal hook to be run at the end of `tramp-*-handle-write-region'.")
 
+(defun tramp-handle-access-file (filename string)
+  "Like `access-file' for Tramp files."
+  (unless (file-readable-p filename)
+    (tramp-error
+     (tramp-dissect-file-name filename) tramp-file-missing
+     "%s: No such file or directory %s" string filename)))
+
 (defun tramp-handle-add-name-to-file
   (filename newname &optional ok-if-already-exists)
   "Like `add-name-to-file' for Tramp files."
@@ -3061,10 +3045,10 @@ User is always nil."
 
       (while temp
        (setq item (directory-file-name (pop temp)))
-       (when (or (null match) (string-match match item))
+       (when (or (null match) (string-match-p match item))
          (push (if full (concat directory item) item)
                result)))
-      (if nosort result (sort result 'string<)))))
+      (if nosort result (sort result #'string<)))))
 
 (defun tramp-handle-directory-files-and-attributes
   (directory &optional full match nosort id-format)
@@ -3081,6 +3065,30 @@ User is always nil."
       (if (file-directory-p dir) dir (file-name-directory dir)) nil
     (tramp-flush-directory-properties v localname)))
 
+(defun tramp-handle-expand-file-name (name &optional dir)
+  "Like `expand-file-name' for Tramp files."
+  ;; If DIR is not given, use DEFAULT-DIRECTORY or "/".
+  (setq dir (or dir default-directory "/"))
+  ;; Handle empty NAME.
+  (when (zerop (length name)) (setq name "."))
+  ;; Unless NAME is absolute, concat DIR and NAME.
+  (unless (file-name-absolute-p name)
+    (setq name (concat (file-name-as-directory dir) name)))
+  ;; If NAME is not a Tramp file, run the real handler.
+  (if (not (tramp-tramp-file-p name))
+      (tramp-run-real-handler #'expand-file-name (list name nil))
+    ;; Dissect NAME.
+    (with-parsed-tramp-file-name name nil
+      (unless (tramp-run-real-handler #'file-name-absolute-p (list localname))
+       (setq localname (concat "/" localname)))
+      ;; Do normal `expand-file-name' (this does "/./" and "/../").
+      ;; `default-directory' is bound, because on Windows there would
+      ;; be problems with UNC shares or Cygwin mounts.
+      (let ((default-directory (tramp-compat-temporary-file-directory)))
+       (tramp-make-tramp-file-name
+        v (tramp-drop-volume-letter
+           (tramp-run-real-handler #'expand-file-name (list localname))))))))
+
 (defun tramp-handle-file-accessible-directory-p (filename)
   "Like `file-accessible-directory-p' for Tramp files."
   (and (file-directory-p filename)
@@ -3100,7 +3108,7 @@ User is always nil."
   (when (string-equal
         (file-remote-p (expand-file-name filename1))
         (file-remote-p (expand-file-name filename2)))
-    (tramp-run-real-handler 'file-equal-p (list filename1 filename2))))
+    (tramp-run-real-handler #'file-equal-p (list filename1 filename2))))
 
 (defun tramp-handle-file-exists-p (filename)
   "Like `file-exists-p' for Tramp files."
@@ -3114,7 +3122,18 @@ User is always nil."
   (when (string-equal
         (file-remote-p (expand-file-name filename))
         (file-remote-p (expand-file-name directory)))
-    (tramp-run-real-handler 'file-in-directory-p (list filename directory))))
+    (tramp-run-real-handler #'file-in-directory-p (list filename directory))))
+
+(defun tramp-handle-file-local-copy (filename)
+  "Like `file-local-copy' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (unless (file-exists-p filename)
+      (tramp-error
+       v tramp-file-missing
+       "Cannot make local copy of non-existing file `%s'" filename))
+    (let ((tmpfile (tramp-compat-make-temp-file filename)))
+      (copy-file filename tmpfile 'ok-if-already-exists 'keep-time)
+      tmpfile)))
 
 (defun tramp-handle-file-modes (filename)
   "Like `file-modes' for Tramp files."
@@ -3135,7 +3154,7 @@ User is always nil."
      v (or (and (zerop (length (tramp-file-name-localname v)))
                (not (tramp-connectable-p file)))
           (tramp-run-real-handler
-           'file-name-as-directory
+           #'file-name-as-directory
            (list (tramp-file-name-localname v)))))))
 
 (defun tramp-handle-file-name-case-insensitive-p (filename)
@@ -3163,8 +3182,8 @@ User is always nil."
                  ;; Check, whether we find an existing file with
                  ;; lower case letters.  This avoids us to create a
                  ;; temporary file.
-                 (while (and (string-match
-                              "[a-z]" (file-remote-p candidate 'localname))
+                 (while (and (string-match-p
+                              "[a-z]" (tramp-compat-file-local-name candidate))
                              (not (file-exists-p candidate)))
                    (setq candidate
                          (directory-file-name
@@ -3174,8 +3193,8 @@ User is always nil."
                  ;; to Emacs 26+ like `file-name-case-insensitive-p',
                  ;; so there is no compatibility problem calling it.
                  (unless
-                     (string-match
-                      "[a-z]" (file-remote-p candidate 'localname))
+                     (string-match-p
+                      "[a-z]" (tramp-compat-file-local-name candidate))
                    (setq tmpfile
                          (let ((default-directory
                                  (file-name-directory filename)))
@@ -3188,7 +3207,7 @@ User is always nil."
                      (file-exists-p
                       (concat
                        (file-remote-p candidate)
-                       (upcase (file-remote-p candidate 'localname))))
+                       (upcase (tramp-compat-file-local-name candidate))))
                    ;; Cleanup.
                    (when tmpfile (delete-file tmpfile)))))))))))
 
@@ -3200,11 +3219,11 @@ User is always nil."
      (try-completion
       filename (file-name-all-completions filename directory)
       (lambda (x)
-       (when (funcall (or predicate 'identity) (expand-file-name x directory))
+       (when (funcall (or predicate #'identity) (expand-file-name x directory))
          (not
           (and
            completion-ignored-extensions
-           (string-match
+           (string-match-p
             (concat (regexp-opt completion-ignored-extensions 'paren) "$") x)
            ;; We remember the hit.
            (push x hits-ignored-extensions))))))
@@ -3221,13 +3240,13 @@ User is always nil."
     ;; nil, mark also the localname part of `v' as nil.
     (tramp-make-tramp-file-name
      v (or (tramp-run-real-handler
-           'file-name-directory (list (tramp-file-name-localname v)))
+           #'file-name-directory (list (tramp-file-name-localname v)))
           'noloc))))
 
 (defun tramp-handle-file-name-nondirectory (file)
   "Like `file-name-nondirectory' but aware of Tramp files."
   (with-parsed-tramp-file-name file nil
-    (tramp-run-real-handler 'file-name-nondirectory (list localname))))
+    (tramp-run-real-handler #'file-name-nondirectory (list localname))))
 
 (defun tramp-handle-file-newer-than-file-p (file1 file2)
   "Like `file-newer-than-file-p' for Tramp files."
@@ -3284,7 +3303,7 @@ User is always nil."
   ;; Preserve trailing "/".
   (funcall
    (if (string-equal (file-name-nondirectory filename) "")
-       'file-name-as-directory 'identity)
+       #'file-name-as-directory #'identity)
    (let ((result (expand-file-name filename))
         (numchase 0)
         ;; Don't make the following value larger than necessary.
@@ -3294,31 +3313,44 @@ User is always nil."
         (numchase-limit 20)
         symlink-target)
      (with-parsed-tramp-file-name result v1
-       (with-tramp-file-property v1 v1-localname "file-truename"
-        (while (and (setq symlink-target (file-symlink-p result))
-                    (< numchase numchase-limit))
-          (setq numchase (1+ numchase)
-                result
-                (with-parsed-tramp-file-name (expand-file-name result) v2
-                  (tramp-make-tramp-file-name
-                   v2
-                   (funcall
-                    (if (tramp-compat-file-name-quoted-p v2-localname)
-                        'tramp-compat-file-name-quote 'identity)
-
-                    (if (stringp symlink-target)
-                        (if (file-remote-p symlink-target)
-                            (let (file-name-handler-alist)
-                              (tramp-compat-file-name-quote symlink-target))
-                          (expand-file-name
-                           symlink-target (file-name-directory v2-localname)))
-                      v2-localname))
-                   'nohop)))
-          (when (>= numchase numchase-limit)
-            (tramp-error
-             v1 'file-error
-             "Maximum number (%d) of symlinks exceeded" numchase-limit)))
-        (directory-file-name result))))))
+       ;; We cache only the localname.
+       (tramp-make-tramp-file-name
+       v1
+       (with-tramp-file-property v1 v1-localname "file-truename"
+         (while (and (setq symlink-target (file-symlink-p result))
+                     (< numchase numchase-limit))
+           (setq numchase (1+ numchase)
+                 result
+                 (with-parsed-tramp-file-name (expand-file-name result) v2
+                   (tramp-make-tramp-file-name
+                    v2
+                    (funcall
+                     (if (tramp-compat-file-name-quoted-p v2-localname)
+                         #'tramp-compat-file-name-quote #'identity)
+
+                     (if (stringp symlink-target)
+                         (if (file-remote-p symlink-target)
+                             (let (file-name-handler-alist)
+                               (tramp-compat-file-name-quote symlink-target))
+                           (expand-file-name
+                            symlink-target (file-name-directory v2-localname)))
+                       v2-localname))
+                    'nohop)))
+           (when (>= numchase numchase-limit)
+             (tramp-error
+              v1 'file-error
+              "Maximum number (%d) of symlinks exceeded" numchase-limit)))
+         (tramp-compat-file-local-name (directory-file-name result))))))))
+
+(defun tramp-handle-file-writable-p (filename)
+  "Like `file-writable-p' for Tramp files."
+  (with-parsed-tramp-file-name filename nil
+    (with-tramp-file-property v localname "file-writable-p"
+      (if (file-exists-p filename)
+         (tramp-check-cached-permissions v ?w)
+       ;; If file doesn't exist, check if directory is writable.
+       (and (file-directory-p (file-name-directory filename))
+            (file-writable-p (file-name-directory filename)))))))
 
 (defun tramp-handle-find-backup-file-name (filename)
   "Like `find-backup-file-name' for Tramp files."
@@ -3336,7 +3368,7 @@ User is always nil."
                     (cdr x))))
                tramp-backup-directory-alist)
             backup-directory-alist)))
-      (tramp-run-real-handler 'find-backup-file-name (list filename)))))
+      (tramp-run-real-handler #'find-backup-file-name (list filename)))))
 
 (defun tramp-handle-insert-directory
   (filename switches &optional wildcard full-directory-p)
@@ -3346,16 +3378,19 @@ User is always nil."
   (when (and (zerop (length (file-name-nondirectory filename)))
             (not full-directory-p))
     (setq switches (concat switches "F")))
+  ;; Check, whether directory is accessible.
+  (unless wildcard
+    (access-file filename "Reading directory"))
   (with-parsed-tramp-file-name (expand-file-name filename) nil
     (with-tramp-progress-reporter v 0 (format "Opening directory %s" filename)
       (require 'ls-lisp)
       (let (ls-lisp-use-insert-directory-program start)
        (tramp-run-real-handler
-        'insert-directory
+        #'insert-directory
         (list filename switches wildcard full-directory-p))
        ;; `ls-lisp' always returns full listings.  We must remove
        ;; superfluous parts.
-       (unless (string-match "l" switches)
+       (unless (string-match-p "l" switches)
          (save-excursion
            (goto-char (point-min))
            (while (setq start
@@ -3365,7 +3400,7 @@ User is always nil."
               start
               (or (text-property-any start (point-at-eol) 'dired-filename t)
                   (point-at-eol)))
-             (if (=  (point-at-bol) (point-at-eol))
+             (if (= (point-at-bol) (point-at-eol))
                  ;; Empty line.
                  (delete-region (point) (progn (forward-line) (point)))
                (forward-line)))))))))
@@ -3393,7 +3428,7 @@ User is always nil."
                      ;; run directly.
                      (setq result
                            (tramp-run-real-handler
-                            'insert-file-contents
+                            #'insert-file-contents
                             (list localname visit beg end replace)))
 
                    ;; When we shall insert only a part of the file, we
@@ -3447,7 +3482,7 @@ User is always nil."
                    ;; When the file is not readable for the owner, it
                    ;; cannot be inserted, even if it is readable for the
                    ;; group or for everybody.
-                   (set-file-modes local-copy (string-to-number "0600" 8))
+                   (set-file-modes local-copy #o0600)
 
                    (when (and (null remote-copy)
                               (tramp-get-method-parameter
@@ -3499,14 +3534,13 @@ User is always nil."
       ;; The first condition is always true for absolute file names.
       ;; Included for safety's sake.
       (unless (or (file-name-directory file)
-                 (string-match "\\.elc?\\'" file))
+                 (string-match-p "\\.elc?\\'" file))
        (tramp-error
         v 'file-error
         "File `%s' does not include a `.el' or `.elc' suffix" file)))
-    (unless noerror
-      (when (not (file-exists-p file))
-       (tramp-error
-        v tramp-file-missing "Cannot load nonexistent file `%s'" file)))
+    (unless (or noerror (file-exists-p file))
+      (tramp-error
+       v tramp-file-missing "Cannot load nonexistent file `%s'" file))
     (if (not (file-exists-p file))
        nil
       (let ((tramp-message-show-message (not nomessage)))
@@ -3529,23 +3563,13 @@ support symbolic links."
     ;; This is needed prior Emacs 26.1, where TARGET has also be
     ;; checked for a file name handler.
     (tramp-run-real-handler
-     'make-symbolic-link (list target linkname ok-if-already-exists))))
+     #'make-symbolic-link (list target linkname ok-if-already-exists))))
 
 (defun tramp-handle-shell-command
   (command &optional output-buffer error-buffer)
   "Like `shell-command' for Tramp files."
-  (let* ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command))
-        ;; We cannot use `shell-file-name' and `shell-command-switch',
-        ;; they are variables of the local host.
-        (args (append
-               (cons
-                (tramp-get-method-parameter
-                 (tramp-dissect-file-name default-directory)
-                 'tramp-remote-shell)
-                (tramp-get-method-parameter
-                 (tramp-dissect-file-name default-directory)
-                 'tramp-remote-shell-args))
-               (list (substring command 0 asynchronous))))
+  (let* ((asynchronous (string-match-p "[ \t]*&[ \t]*\\'" command))
+        (command (substring command 0 asynchronous))
         current-buffer-p
         (output-buffer
          (cond
@@ -3562,19 +3586,48 @@ support symbolic links."
          (cond
           ((bufferp error-buffer) error-buffer)
           ((stringp error-buffer) (get-buffer-create error-buffer))))
-        (buffer
-         (if (and (not asynchronous) error-buffer)
-             (with-parsed-tramp-file-name default-directory nil
-               (list output-buffer (tramp-make-tramp-temp-file v)))
-           output-buffer))
-        (p (get-buffer-process output-buffer)))
-
-    ;; Check whether there is another process running.  Tramp does not
-    ;; support 2 (asynchronous) processes in parallel.
+        (bname (buffer-name output-buffer))
+        (p (get-buffer-process output-buffer))
+        buffer)
+
+    ;; The following code is taken from `shell-command', slightly
+    ;; adapted.  Shouldn't it be factored out?
     (when p
-      (if (yes-or-no-p "A command is running.  Kill it? ")
-         (ignore-errors (kill-process p))
-       (tramp-user-error p "Shell command in progress")))
+      (cond
+       ((eq async-shell-command-buffer 'confirm-kill-process)
+       ;; If will kill a process, query first.
+       (if (yes-or-no-p
+            "A command is running in the default buffer.  Kill it? ")
+           (kill-process p)
+         (tramp-user-error p "Shell command in progress")))
+       ((eq async-shell-command-buffer 'confirm-new-buffer)
+       ;; If will create a new buffer, query first.
+       (if (yes-or-no-p
+            "A command is running in the default buffer.  Use a new buffer? ")
+            (setq output-buffer (generate-new-buffer bname))
+         (tramp-user-error p "Shell command in progress")))
+       ((eq async-shell-command-buffer 'new-buffer)
+       ;; It will create a new buffer.
+        (setq output-buffer (generate-new-buffer bname)))
+       ((eq async-shell-command-buffer 'confirm-rename-buffer)
+       ;; If will rename the buffer, query first.
+       (if (yes-or-no-p
+            "A command is running in the default buffer.  Rename it? ")
+           (progn
+             (with-current-buffer output-buffer
+               (rename-uniquely))
+              (setq output-buffer (get-buffer-create bname)))
+         (tramp-user-error p "Shell command in progress")))
+       ((eq async-shell-command-buffer 'rename-buffer)
+       ;; It will rename the buffer.
+       (with-current-buffer output-buffer
+         (rename-uniquely))
+        (setq output-buffer (get-buffer-create bname)))))
+
+    (setq buffer (if (and (not asynchronous) error-buffer)
+                    (with-parsed-tramp-file-name default-directory nil
+                      (list output-buffer (tramp-make-tramp-temp-file v)))
+                  output-buffer))
 
     (if current-buffer-p
        (progn
@@ -3587,18 +3640,19 @@ support symbolic links."
     (if (and (not current-buffer-p) (integerp asynchronous))
        (prog1
            ;; Run the process.
-           (setq p (apply 'start-file-process "*Async Shell*" buffer args))
+           (setq p (start-file-process-shell-command
+                    (buffer-name output-buffer) buffer command))
          ;; Display output.
          (with-current-buffer output-buffer
            (display-buffer output-buffer '(nil (allow-no-window . t)))
            (setq mode-line-process '(":%s"))
            (shell-mode)
-           (set-process-sentinel p 'shell-command-sentinel)
-           (set-process-filter p 'comint-output-filter)))
+           (set-process-sentinel p #'shell-command-sentinel)
+           (set-process-filter p #'comint-output-filter)))
 
       (prog1
          ;; Run the process.
-         (apply 'process-file (car args) nil buffer nil (cdr args))
+         (process-file-shell-command command nil buffer nil)
        ;; Insert error messages if they were separated.
        (when (listp buffer)
          (with-current-buffer error-buffer
@@ -3616,6 +3670,17 @@ support symbolic links."
          (when (with-current-buffer output-buffer (> (point-max) (point-min)))
            (display-message-or-buffer output-buffer)))))))
 
+(defun tramp-handle-start-file-process (name buffer program &rest args)
+  "Like `start-file-process' for Tramp files."
+  ;; `make-process' knows the `:file-error' argument since Emacs 27.1.
+  (tramp-file-name-handler
+   'make-process
+   :name name
+   :buffer buffer
+   :command (and program (cons program args))
+   :noquery nil
+   :file-handler t))
+
 (defun tramp-handle-substitute-in-file-name (filename)
   "Like `substitute-in-file-name' for Tramp files.
 \"//\" and \"/~\" substitute only in the local filename part."
@@ -3642,12 +3707,18 @@ support symbolic links."
                           ;; We must disable cygwin-mount file name
                           ;; handlers and alike.
                           (tramp-run-real-handler
-                           'substitute-in-file-name (list localname))))))))
+                           #'substitute-in-file-name (list localname))))))))
       ;; "/m:h:~" does not work for completion.  We use "/m:h:~/".
       (if (and (stringp localname) (string-equal "~" localname))
          (concat filename "/")
        filename))))
 
+(defconst tramp-time-dont-know '(0 0 0 1000)
+  "An invalid time value, used as \"Don’t know\" value.")
+
+(defconst tramp-time-doesnt-exist '(-1 65535)
+  "An invalid time value, used as \"Doesn’t exist\" value.")
+
 (defun tramp-handle-set-visited-file-modtime (&optional time-list)
   "Like `set-visited-file-modtime' for Tramp files."
   (unless (buffer-file-name)
@@ -3660,7 +3731,7 @@ support symbolic links."
                 (file-attributes (buffer-file-name)))
                tramp-time-doesnt-exist))))
   (unless (tramp-compat-time-equal-p time-list tramp-time-dont-know)
-    (tramp-run-real-handler 'set-visited-file-modtime (list time-list))))
+    (tramp-run-real-handler #'set-visited-file-modtime (list time-list))))
 
 (defun tramp-handle-verify-visited-file-modtime (&optional buf)
   "Like `verify-visited-file-modtime' for Tramp files.
@@ -3694,6 +3765,55 @@ of."
           ;; only if that agrees with the buffer's record.
           (t (tramp-compat-time-equal-p mt tramp-time-doesnt-exist))))))))
 
+(defun tramp-handle-write-region
+  (start end filename &optional append visit lockname mustbenew)
+  "Like `write-region' for Tramp files."
+  (setq filename (expand-file-name filename))
+  (with-parsed-tramp-file-name filename nil
+    (when (and mustbenew (file-exists-p filename)
+              (or (eq mustbenew 'excl)
+                  (not
+                   (y-or-n-p
+                    (format "File %s exists; overwrite anyway? " filename)))))
+      (tramp-error v 'file-already-exists filename))
+
+    (let ((tmpfile (tramp-compat-make-temp-file filename)))
+      (when (and append (file-exists-p filename))
+       (copy-file filename tmpfile 'ok))
+      ;; We say `no-message' here because we don't want the visited file
+      ;; modtime data to be clobbered from the temp file.  We call
+      ;; `set-visited-file-modtime' ourselves later on.
+      (tramp-run-real-handler
+       #'write-region (list start end tmpfile append 'no-message lockname))
+      (condition-case nil
+         (rename-file tmpfile filename 'ok-if-already-exists)
+       (error
+        (delete-file tmpfile)
+        (tramp-error
+         v 'file-error "Couldn't write region to `%s'" filename))))
+
+    (tramp-flush-file-properties v (file-name-directory localname))
+    (tramp-flush-file-properties v localname)
+
+    ;; Set file modification time.
+    (when (or (eq visit t) (stringp visit))
+      (set-visited-file-modtime
+       (tramp-compat-file-attribute-modification-time
+       (file-attributes filename))))
+
+    ;; The end.
+    (when (and (null noninteractive)
+              (or (eq visit t) (null visit) (stringp visit)))
+      (tramp-message v 0 "Wrote %s" filename))
+    (run-hooks 'tramp-handle-write-region-hook)))
+
+;; This is used in tramp-sh.el and tramp-sudoedit.el.
+(defconst tramp-stat-marker "/////"
+  "Marker in stat commands for file attributes.")
+
+(defconst tramp-stat-quoted-marker "\\/\\/\\/\\/\\/"
+  "Quoted marker in stat commands for file attributes.")
+
 ;; This is used in tramp-gvfs.el and tramp-sh.el.
 (defconst tramp-gio-events
   '("attribute-changed" "changed" "changes-done-hint"
@@ -3744,7 +3864,8 @@ of."
     (with-current-buffer (tramp-get-connection-buffer vec)
       (tramp-message vec 6 "\n%s" (buffer-string)))
     (tramp-message vec 3 "Sending login name `%s'" user)
-    (tramp-send-string vec (concat user tramp-local-end-of-line))))
+    (tramp-send-string vec (concat user tramp-local-end-of-line)))
+  t)
 
 (defun tramp-action-password (proc vec)
   "Query the user for a password."
@@ -3764,7 +3885,8 @@ of."
       (process-send-string
        proc (concat (tramp-read-passwd proc) tramp-local-end-of-line))
       ;; Hide password prompt.
-      (narrow-to-region (point-max) (point-max)))))
+      (narrow-to-region (point-max) (point-max))))
+  t)
 
 (defun tramp-action-succeed (_proc _vec)
   "Signal success in finding shell prompt."
@@ -3781,13 +3903,14 @@ Send \"yes\" to remote process on confirmation, abort 
otherwise.
 See also `tramp-action-yn'."
   (save-window-excursion
     (let ((enable-recursive-minibuffers t))
-      (save-match-data (pop-to-buffer (tramp-get-connection-buffer vec)))
+      (pop-to-buffer (tramp-get-connection-buffer vec))
       (unless (yes-or-no-p (match-string 0))
        (kill-process proc)
        (throw 'tramp-action 'permission-denied))
       (with-current-buffer (tramp-get-connection-buffer vec)
        (tramp-message vec 6 "\n%s" (buffer-string)))
-      (tramp-send-string vec (concat "yes" tramp-local-end-of-line)))))
+      (tramp-send-string vec (concat "yes" tramp-local-end-of-line))))
+  t)
 
 (defun tramp-action-yn (proc vec)
   "Ask the user for confirmation using `y-or-n-p'.
@@ -3795,13 +3918,14 @@ Send \"y\" to remote process on confirmation, abort 
otherwise.
 See also `tramp-action-yesno'."
   (save-window-excursion
     (let ((enable-recursive-minibuffers t))
-      (save-match-data (pop-to-buffer (tramp-get-connection-buffer vec)))
+      (pop-to-buffer (tramp-get-connection-buffer vec))
       (unless (y-or-n-p (match-string 0))
        (kill-process proc)
        (throw 'tramp-action 'permission-denied))
       (with-current-buffer (tramp-get-connection-buffer vec)
        (tramp-message vec 6 "\n%s" (buffer-string)))
-      (tramp-send-string vec (concat "y" tramp-local-end-of-line)))))
+      (tramp-send-string vec (concat "y" tramp-local-end-of-line))))
+  t)
 
 (defun tramp-action-terminal (_proc vec)
   "Tell the remote host which terminal type to use.
@@ -3809,7 +3933,8 @@ The terminal type can be configured with 
`tramp-terminal-type'."
   (tramp-message vec 5 "Setting `%s' as terminal type." tramp-terminal-type)
   (with-current-buffer (tramp-get-connection-buffer vec)
     (tramp-message vec 6 "\n%s" (buffer-string)))
-  (tramp-send-string vec (concat tramp-terminal-type tramp-local-end-of-line)))
+  (tramp-send-string vec (concat tramp-terminal-type tramp-local-end-of-line))
+  t)
 
 (defun tramp-action-process-alive (proc _vec)
   "Check, whether a process has finished."
@@ -3819,14 +3944,14 @@ The terminal type can be configured with 
`tramp-terminal-type'."
 (defun tramp-action-out-of-band (proc vec)
   "Check, whether an out-of-band copy has finished."
   ;; There might be pending output for the exit status.
-  (tramp-accept-process-output proc 0.1)
+  (while (tramp-accept-process-output proc 0))
   (cond ((and (not (process-live-p proc))
              (zerop (process-exit-status proc)))
         (tramp-message vec 3 "Process has finished.")
         (throw 'tramp-action 'ok))
        ((or (and (memq (process-status proc) '(stop exit))
                  (not (zerop (process-exit-status proc))))
-            (memq (process-status proc) '(signal)))
+            (eq (process-status proc) 'signal))
         ;; `scp' could have copied correctly, but set modes could have failed.
         ;; This can be ignored.
         (with-current-buffer (process-buffer proc)
@@ -3843,13 +3968,14 @@ The terminal type can be configured with 
`tramp-terminal-type'."
 ;;; Functions for processing the actions:
 
 (defun tramp-process-one-action (proc vec actions)
-  "Wait for output from the shell and perform one action."
+  "Wait for output from the shell and perform one action.
+See `tramp-process-actions' for the format of ACTIONS."
   (let ((case-fold-search t)
        found todo item pattern action)
     (while (not found)
       ;; Reread output once all actions have been performed.
       ;; Obviously, the output was not complete.
-      (tramp-accept-process-output proc 1)
+      (while (tramp-accept-process-output proc 0))
       (setq todo actions)
       (while todo
        (setq item (pop todo))
@@ -3866,7 +3992,27 @@ The terminal type can be configured with 
`tramp-terminal-type'."
   "Perform ACTIONS until success or TIMEOUT.
 PROC and VEC indicate the remote connection to be used.  POS, if
 set, is the starting point of the region to be deleted in the
-connection buffer."
+connection buffer.
+
+ACTIONS is a list of (PATTERN ACTION).  The PATTERN should be a
+symbol, a variable.  The value of this variable gives the regular
+expression to search for.  Note that the regexp must match at the
+end of the buffer, \"\\'\" is implicitly appended to it.
+
+The ACTION should also be a symbol, but a function.  When the
+corresponding PATTERN matches, the ACTION function is called.
+
+An ACTION function has two arguments (PROC VEC).  If it returns
+nil, nothing has been done, and the next action shall be called.
+A non-nil return value indicates that the process output has been
+consumed, and new output shall be retrieved, before starting to
+process all ACTIONs, again.  The same happens after calling the
+last ACTION.
+
+If an action determines, that all processing has been done (e.g.,
+because the shell prompt has been detected), it shall throw a
+result.  The symbol `ok' means that all ACTIONs have been
+performed successfully.  Any other value means an error."
   ;; Enable `auth-source', unless "emacs -Q" has been called.  We must
   ;; use the "password-vector" property in case we have several hops.
   (tramp-set-connection-property
@@ -3905,9 +4051,10 @@ connection buffer."
              (tramp-get-connection-buffer vec)))
            ((eq exit 'process-died)
              (substitute-command-keys
-              (concat
-               "Tramp failed to connect.  If this happens repeatedly, try\n"
-               "    `\\[tramp-cleanup-this-connection]'")))
+             (eval-when-compile
+               (concat
+                "Tramp failed to connect.  If this happens repeatedly, try\n"
+                "    `\\[tramp-cleanup-this-connection]'"))))
            ((eq exit 'timeout)
             (format-message
              "Timeout reached, see buffer `%s' for details"
@@ -3915,28 +4062,36 @@ connection buffer."
            (t "Login failed")))))
       (when (numberp pos)
        (with-current-buffer (tramp-get-connection-buffer vec)
-         (let (buffer-read-only) (delete-region pos (point))))))))
+         (let ((inhibit-read-only t)) (delete-region pos (point))))))))
 
 ;;; Utility functions:
 
-(defun tramp-accept-process-output (proc timeout)
+(defun tramp-accept-process-output (proc &optional timeout)
   "Like `accept-process-output' for Tramp processes.
 This is needed in order to hide `last-coding-system-used', which is set
 for process communication also."
   (with-current-buffer (process-buffer proc)
-    (let (buffer-read-only last-coding-system-used
+    (let ((inhibit-read-only t)
+         last-coding-system-used
          ;; We do not want to run timers.
-         timer-list timer-idle-list)
-      ;; Under Windows XP, `accept-process-output' doesn't return
-      ;; sometimes.  So we add an additional timeout.  JUST-THIS-ONE
-      ;; is set due to Bug#12145.  It is an integer, in order to avoid
-      ;; running timers as well.
+         (tl timer-list)
+          (stimers (with-timeout-suspend))
+         timer-list timer-idle-list
+         result)
+      ;; Enable our progress reporter.
+      (dolist (timer tl)
+       (if (eq (timer--function timer) #'tramp-progress-reporter-update)
+            (push timer timer-list)))
+      ;; JUST-THIS-ONE is set due to Bug#12145.
       (tramp-message
-       proc 10 "%s %s %s\n%s"
-       proc (process-status proc)
-       (with-timeout (timeout)
-        (accept-process-output proc timeout nil 0))
-       (buffer-string)))))
+       proc 10 "%s %s %s %s\n%s"
+       proc timeout (process-status proc)
+       (with-local-quit
+        (setq result (accept-process-output proc timeout nil t)))
+       (buffer-string))
+      ;; Reenable the timers.
+      (with-timeout-unsuspend stimers)
+      result)))
 
 (defun tramp-check-for-regexp (proc regexp)
   "Check, whether REGEXP is contained in process buffer of PROC.
@@ -3984,20 +4139,20 @@ nil."
       (cond (timeout
             (with-timeout (timeout)
               (while (not found)
-                (tramp-accept-process-output proc 1)
+                (tramp-accept-process-output proc)
                 (unless (process-live-p proc)
                   (tramp-error-with-buffer
                    nil proc 'file-error "Process has died"))
                 (setq found (tramp-check-for-regexp proc regexp)))))
            (t
             (while (not found)
-              (tramp-accept-process-output proc 1)
+              (tramp-accept-process-output proc)
               (unless (process-live-p proc)
                 (tramp-error-with-buffer
                  nil proc 'file-error "Process has died"))
               (setq found (tramp-check-for-regexp proc regexp)))))
       (tramp-message proc 6 "\n%s" (buffer-string))
-      (when (not found)
+      (unless found
        (if timeout
            (tramp-error
             proc 'file-error "[[Regexp `%s' not found in %d secs]]"
@@ -4025,11 +4180,11 @@ the remote host use line-endings as defined in the 
variable
     (with-current-buffer (tramp-get-connection-buffer vec)
       ;; Clean up the buffer.  We cannot call `erase-buffer' because
       ;; narrowing might be in effect.
-      (let (buffer-read-only) (delete-region (point-min) (point-max)))
+      (let ((inhibit-read-only t)) (delete-region (point-min) (point-max)))
       ;; Replace "\n" by `tramp-rsh-end-of-line'.
       (setq string
            (mapconcat
-            'identity (split-string string "\n") tramp-rsh-end-of-line))
+            #'identity (split-string string "\n") tramp-rsh-end-of-line))
       (unless (or (string= string "")
                  (string-equal (substring string -1) tramp-rsh-end-of-line))
        (setq string (concat string tramp-rsh-end-of-line)))
@@ -4058,6 +4213,7 @@ If it doesn't exist, generate a new one."
   (with-tramp-connection-property (tramp-get-connection-process vec) "device"
     (cons -1 (setq tramp-devices (1+ tramp-devices)))))
 
+;; Comparision of vectors is performed by `tramp-file-name-equal-p'.
 (defun tramp-equal-remote (file1 file2)
   "Check, whether the remote parts of FILE1 and FILE2 are identical.
 The check depends on method, user and host name of the files.  If
@@ -4067,7 +4223,7 @@ account.
 
 Example:
 
-  (tramp-equal-remote \"/ssh::/etc\" \"/<your host name>:/home\")
+  (tramp-equal-remote \"/ssh::/etc\" \"/-:<your host name>:/home\")
 
 would yield t.  On the other hand, the following check results in nil:
 
@@ -4076,7 +4232,6 @@ would yield t.  On the other hand, the following check 
results in nil:
        (tramp-tramp-file-p file2)
        (string-equal (file-remote-p file1) (file-remote-p file2))))
 
-;;;###tramp-autoload
 (defun tramp-mode-string-to-int (mode-string)
   "Converts a ten-letter `drwxrwxrwx'-style mode string into mode bits."
   (let* (case-fold-search
@@ -4090,53 +4245,52 @@ would yield t.  On the other hand, the following check 
results in nil:
          (other-read (aref mode-chars 7))
          (other-write (aref mode-chars 8))
          (other-execute-or-sticky (aref mode-chars 9)))
-    (save-match-data
-      (logior
-       (cond
-       ((char-equal owner-read ?r) (string-to-number "00400" 8))
-       ((char-equal owner-read ?-) 0)
-       (t (error "Second char `%c' must be one of `r-'" owner-read)))
-       (cond
-       ((char-equal owner-write ?w) (string-to-number "00200" 8))
-       ((char-equal owner-write ?-) 0)
-       (t (error "Third char `%c' must be one of `w-'" owner-write)))
-       (cond
-       ((char-equal owner-execute-or-setid ?x) (string-to-number "00100" 8))
-       ((char-equal owner-execute-or-setid ?S) (string-to-number "04000" 8))
-       ((char-equal owner-execute-or-setid ?s) (string-to-number "04100" 8))
-       ((char-equal owner-execute-or-setid ?-) 0)
-       (t (error "Fourth char `%c' must be one of `xsS-'"
-                 owner-execute-or-setid)))
-       (cond
-       ((char-equal group-read ?r) (string-to-number "00040" 8))
-       ((char-equal group-read ?-) 0)
-       (t (error "Fifth char `%c' must be one of `r-'" group-read)))
-       (cond
-       ((char-equal group-write ?w) (string-to-number "00020" 8))
-       ((char-equal group-write ?-) 0)
-       (t (error "Sixth char `%c' must be one of `w-'" group-write)))
-       (cond
-       ((char-equal group-execute-or-setid ?x) (string-to-number "00010" 8))
-       ((char-equal group-execute-or-setid ?S) (string-to-number "02000" 8))
-       ((char-equal group-execute-or-setid ?s) (string-to-number "02010" 8))
-       ((char-equal group-execute-or-setid ?-) 0)
-       (t (error "Seventh char `%c' must be one of `xsS-'"
-                 group-execute-or-setid)))
-       (cond
-       ((char-equal other-read ?r) (string-to-number "00004" 8))
-       ((char-equal other-read ?-) 0)
-       (t (error "Eighth char `%c' must be one of `r-'" other-read)))
-       (cond
-       ((char-equal other-write ?w) (string-to-number "00002" 8))
-       ((char-equal other-write ?-) 0)
-       (t (error "Ninth char `%c' must be one of `w-'" other-write)))
-       (cond
-       ((char-equal other-execute-or-sticky ?x) (string-to-number "00001" 8))
-       ((char-equal other-execute-or-sticky ?T) (string-to-number "01000" 8))
-       ((char-equal other-execute-or-sticky ?t) (string-to-number "01001" 8))
-       ((char-equal other-execute-or-sticky ?-) 0)
-       (t (error "Tenth char `%c' must be one of `xtT-'"
-                 other-execute-or-sticky)))))))
+    (logior
+     (cond
+      ((char-equal owner-read ?r) #o0400)
+      ((char-equal owner-read ?-) 0)
+      (t (error "Second char `%c' must be one of `r-'" owner-read)))
+     (cond
+      ((char-equal owner-write ?w) #o0200)
+      ((char-equal owner-write ?-) 0)
+      (t (error "Third char `%c' must be one of `w-'" owner-write)))
+     (cond
+      ((char-equal owner-execute-or-setid ?x) #o0100)
+      ((char-equal owner-execute-or-setid ?S) #o4000)
+      ((char-equal owner-execute-or-setid ?s) #o4100)
+      ((char-equal owner-execute-or-setid ?-) 0)
+      (t (error "Fourth char `%c' must be one of `xsS-'"
+               owner-execute-or-setid)))
+     (cond
+      ((char-equal group-read ?r) #o0040)
+      ((char-equal group-read ?-) 0)
+      (t (error "Fifth char `%c' must be one of `r-'" group-read)))
+     (cond
+      ((char-equal group-write ?w) #o0020)
+      ((char-equal group-write ?-) 0)
+      (t (error "Sixth char `%c' must be one of `w-'" group-write)))
+     (cond
+      ((char-equal group-execute-or-setid ?x) #o0010)
+      ((char-equal group-execute-or-setid ?S) #o2000)
+      ((char-equal group-execute-or-setid ?s) #o2010)
+      ((char-equal group-execute-or-setid ?-) 0)
+      (t (error "Seventh char `%c' must be one of `xsS-'"
+               group-execute-or-setid)))
+     (cond
+      ((char-equal other-read ?r) #o0004)
+      ((char-equal other-read ?-) 0)
+      (t (error "Eighth char `%c' must be one of `r-'" other-read)))
+     (cond
+      ((char-equal other-write ?w) #o0002)
+      ((char-equal other-write ?-) 0)
+      (t (error "Ninth char `%c' must be one of `w-'" other-write)))
+     (cond
+      ((char-equal other-execute-or-sticky ?x) #o0001)
+      ((char-equal other-execute-or-sticky ?T) #o1000)
+      ((char-equal other-execute-or-sticky ?t) #o1001)
+      ((char-equal other-execute-or-sticky ?-) 0)
+      (t (error "Tenth char `%c' must be one of `xtT-'"
+               other-execute-or-sticky))))))
 
 (defconst tramp-file-mode-type-map
   '((0  . "-")  ; Normal file (SVID-v2 and XPG2)
@@ -4157,7 +4311,6 @@ would yield t.  On the other hand, the following check 
results in nil:
   "A list of file types returned from the `stat' system call.
 This is used to map a mode number to a permission string.")
 
-;;;###tramp-autoload
 (defun tramp-file-mode-from-int (mode)
   "Turn an integer representing a file mode into an ls(1)-like string."
   (let ((type  (cdr
@@ -4185,20 +4338,53 @@ This is used internally by `tramp-file-mode-from-int'."
                (and suid (upcase suid-text)) ; suid, !execute
                (and x "x") "-"))))     ; !suid
 
-;;;###tramp-autoload
+;; This is a Tramp internal function.  A general `set-file-uid-gid'
+;; outside Tramp is not needed, I believe.
+(defun tramp-set-file-uid-gid (filename &optional uid gid)
+  "Set the ownership for FILENAME.
+If UID and GID are provided, these values are used; otherwise uid
+and gid of the corresponding remote or local user is taken,
+depending whether FILENAME is remote or local.  Both parameters
+must be non-negative integers.
+The setgid bit of the upper directory is respected.
+If FILENAME is remote, a file name handler is called."
+  (let* ((dir (file-name-directory filename))
+        (modes (file-modes dir)))
+    (when (and modes (not (zerop (logand modes #o2000))))
+      (setq gid (tramp-compat-file-attribute-group-id (file-attributes dir)))))
+
+  (let ((handler (find-file-name-handler filename 'tramp-set-file-uid-gid)))
+    (if handler
+       (funcall handler #'tramp-set-file-uid-gid filename uid gid)
+      ;; On W32 "chown" does not work.
+      (unless (memq system-type '(ms-dos windows-nt))
+       (let ((uid (or (and (natnump uid) uid) (tramp-get-local-uid 'integer)))
+             (gid (or (and (natnump gid) gid) (tramp-get-local-gid 'integer))))
+         (tramp-call-process
+          nil "chown" nil nil nil
+          (format "%d:%d" uid gid) (shell-quote-argument filename)))))))
+
 (defun tramp-get-local-uid (id-format)
   "The uid of the local user, in ID-FORMAT.
 ID-FORMAT valid values are `string' and `integer'."
-  (if (equal id-format 'integer) (user-uid) (user-login-name)))
+  ;; We use key nil for local connection properties.
+  (with-tramp-connection-property nil (format "uid-%s" id-format)
+    (if (equal id-format 'integer) (user-uid) (user-login-name))))
 
-;;;###tramp-autoload
 (defun tramp-get-local-gid (id-format)
   "The gid of the local user, in ID-FORMAT.
 ID-FORMAT valid values are `string' and `integer'."
-  ;; `group-gid' has been introduced with Emacs 24.4.
-  (if (and (fboundp 'group-gid) (equal id-format 'integer))
-      (tramp-compat-funcall 'group-gid)
-    (tramp-compat-file-attribute-group-id (file-attributes "~/" id-format))))
+  ;; We use key nil for local connection properties.
+  (with-tramp-connection-property nil (format "gid-%s" id-format)
+    (cond
+     ;; `group-gid' has been introduced with Emacs 24.4.
+     ((and (fboundp 'group-gid) (equal id-format 'integer))
+      (tramp-compat-funcall 'group-gid))
+     ;; `group-name' has been introduced with Emacs 27.1.
+     ((and (fboundp 'group-name) (equal id-format 'string))
+      (tramp-compat-funcall 'group-name (tramp-compat-funcall 'group-gid)))
+     ((tramp-compat-file-attribute-group-id
+       (file-attributes "~/" id-format))))))
 
 (defun tramp-get-local-locale (&optional vec)
   "Determine locale, supporting UTF8 if possible.
@@ -4213,8 +4399,9 @@ VEC is used for tracing."
                                  nil "locale" nil t nil "-a"))))
          (while candidates
            (goto-char (point-min))
-           (if (string-match (format "^%s\r?$" (regexp-quote (car candidates)))
-                             (buffer-string))
+           (if (string-match-p
+                (format "^%s\r?$" (regexp-quote (car candidates)))
+                (buffer-string))
                (setq locale (car candidates)
                      candidates nil)
              (setq candidates (cdr candidates))))))
@@ -4222,7 +4409,6 @@ VEC is used for tracing."
       (when vec (tramp-message vec 7 "locale %s" (or locale "C")))
       (or locale "C"))))
 
-;;;###tramp-autoload
 (defun tramp-check-cached-permissions (vec access)
   "Check `file-attributes' caches for VEC.
 Return t if according to the cache access type ACCESS is known to
@@ -4283,7 +4469,6 @@ be granted."
                        (tramp-compat-file-attribute-group-id
                         file-attr))))))))))))
 
-;;;###tramp-autoload
 (defun tramp-local-host-p (vec)
   "Return t if this points to the local host, nil otherwise.
 This handles also chrooted environments, which are not regarded as local."
@@ -4291,7 +4476,7 @@ This handles also chrooted environments, which are not 
regarded as local."
        (port (tramp-file-name-port vec)))
     (and
      (stringp tramp-local-host-regexp) (stringp host)
-     (string-match tramp-local-host-regexp host)
+     (string-match-p tramp-local-host-regexp host)
      ;; A port is an indication for an ssh tunnel or alike.
      (null port)
      ;; The method shall be applied to one of the shell file name
@@ -4315,11 +4500,10 @@ This handles also chrooted environments, which are not 
regarded as local."
           (tramp-make-tramp-file-name
            vec (or (tramp-get-method-parameter vec 'tramp-tmpdir) "/tmp"))))
       (or (and (file-directory-p dir) (file-writable-p dir)
-              (file-remote-p dir 'localname))
+              (tramp-compat-file-local-name dir))
          (tramp-error vec 'file-error "Directory %s not accessible" dir))
       dir)))
 
-;;;###tramp-autoload
 (defun tramp-make-tramp-temp-file (vec)
   "Create a temporary file on the remote host identified by VEC.
 Return the local name of the temporary file."
@@ -4336,7 +4520,7 @@ Return the local name of the temporary file."
          (setq result nil)
        ;; This creates the file by side effect.
        (set-file-times result)
-       (set-file-modes result (string-to-number "0700" 8))))
+       (set-file-modes result #o0700)))
 
     ;; Return the local part.
     (with-parsed-tramp-file-name result nil localname)))
@@ -4346,11 +4530,11 @@ Return the local name of the temporary file."
   (when (stringp tramp-temp-buffer-file-name)
     (ignore-errors (delete-file tramp-temp-buffer-file-name))))
 
-(add-hook 'kill-buffer-hook 'tramp-delete-temp-file-function)
+(add-hook 'kill-buffer-hook #'tramp-delete-temp-file-function)
 (add-hook 'tramp-unload-hook
          (lambda ()
            (remove-hook 'kill-buffer-hook
-                        'tramp-delete-temp-file-function)))
+                        #'tramp-delete-temp-file-function)))
 
 (defun tramp-handle-make-auto-save-file-name ()
   "Like `make-auto-save-file-name' for Tramp files.
@@ -4386,7 +4570,7 @@ this file, if that variable is non-nil."
             (tramp-compat-file-name-unquote (buffer-file-name)))
            tramp-auto-save-directory))))
     ;; Run plain `make-auto-save-file-name'.
-    (tramp-run-real-handler 'make-auto-save-file-name nil)))
+    (tramp-run-real-handler #'make-auto-save-file-name nil)))
 
 (defun tramp-subst-strs-in-string (alist string)
   "Replace all occurrences of the string FROM with TO in STRING.
@@ -4425,17 +4609,18 @@ ALIST is of the form ((FROM . TO) ...)."
 It always returns a return code.  The Lisp error raised when
 PROGRAM is nil is trapped also, returning 1.  Furthermore, traces
 are written with verbosity of 6."
-  (let ((default-directory  (tramp-compat-temporary-file-directory))
+  (let ((default-directory (tramp-compat-temporary-file-directory))
        (destination (if (eq destination t) (current-buffer) destination))
+       (vec (or vec (car tramp-current-connection)))
        output error result)
     (tramp-message
      vec 6 "`%s %s' %s %s"
-     program (mapconcat 'identity args " ") infile destination)
+     program (mapconcat #'identity args " ") infile destination)
     (condition-case err
        (with-temp-buffer
          (setq result
                (apply
-                'call-process program infile (or destination t) display args))
+                #'call-process program infile (or destination t) display args))
          ;; `result' could also be an error string.
          (when (stringp result)
            (setq error result
@@ -4457,17 +4642,17 @@ are written with verbosity of 6."
 It always returns a return code.  The Lisp error raised when
 PROGRAM is nil is trapped also, returning 1.  Furthermore, traces
 are written with verbosity of 6."
-  (let ((default-directory  (tramp-compat-temporary-file-directory))
+  (let ((default-directory (tramp-compat-temporary-file-directory))
        (buffer (if (eq buffer t) (current-buffer) buffer))
        result)
     (tramp-message
      vec 6 "`%s %s' %s %s %s %s"
-     program (mapconcat 'identity args " ") start end delete buffer)
+     program (mapconcat #'identity args " ") start end delete buffer)
     (condition-case err
        (progn
          (setq result
                (apply
-                'call-process-region
+                #'call-process-region
                 start end program delete buffer display args))
          ;; `result' could also be an error string.
          (when (stringp result)
@@ -4481,7 +4666,25 @@ are written with verbosity of 6."
        (tramp-message vec 6 "%d\n%s" result (error-message-string err))))
     result))
 
-;;;###tramp-autoload
+(defun tramp-process-lines
+  (vec program &rest args)
+  "Calls `process-lines' on the local host.
+If an error occurs, it returns nil.  Traces are written with
+verbosity of 6."
+  (let ((default-directory (tramp-compat-temporary-file-directory))
+       (vec (or vec (car tramp-current-connection)))
+       result)
+    (if args
+       (tramp-message vec 6 "%s %s" program (mapconcat #'identity args " "))
+      (tramp-message vec 6 "%s" program))
+    (setq result
+         (condition-case err
+             (apply #'process-lines program args)
+           (error
+            (tramp-error vec (car err) (cdr err)))))
+    (tramp-message vec 6 "%s" result)
+    result))
+
 (defun tramp-read-passwd (proc &optional prompt)
   "Read a password from user (compat function).
 Consults the auth-source package.
@@ -4554,7 +4757,6 @@ Invokes `password-read' if available, `read-passwd' else."
       ;; Reenable the timers.
       (with-timeout-unsuspend stimers))))
 
-;;;###tramp-autoload
 (defun tramp-clear-passwd (vec)
   "Clear password cache for connection related to VEC."
   (let ((method (tramp-file-name-method vec))
@@ -4569,15 +4771,6 @@ Invokes `password-read' if available, `read-passwd' 
else."
        :host ,host-port :port ,method))
     (password-cache-remove (tramp-make-tramp-file-name vec 'noloc 'nohop))))
 
-;;;###tramp-autoload
-(defconst tramp-time-dont-know '(0 0 0 1000)
-  "An invalid time value, used as \"Don’t know\" value.")
-
-;;;###tramp-autoload
-(defconst tramp-time-doesnt-exist '(-1 65535)
-  "An invalid time value, used as \"Doesn’t exist\" value.")
-
-;;;###tramp-autoload
 (defun tramp-time-diff (t1 t2)
   "Return the difference between the two times, in seconds.
 T1 and T2 are time values (as returned by `current-time' for example)."
@@ -4608,7 +4801,6 @@ T1 and T2 are time values (as returned by `current-time' 
for example)."
 ;;
 ;; Thanks to Mario DeWeerd for the hint that it is sufficient for this
 ;; function to work with Bourne-like shells.
-;;;###tramp-autoload
 (defun tramp-shell-quote-argument (s)
   "Similar to `shell-quote-argument', but groks newlines.
 Only works for Bourne-like shells."
@@ -4640,7 +4832,7 @@ Only works for Bourne-like shells."
        pid)
     ;; If it's a Tramp process, send the INT signal remotely.
     (when (and (processp proc) (setq pid (process-get proc 'remote-pid)))
-      (if (not  (process-live-p proc))
+      (if (not (process-live-p proc))
          (tramp-error proc 'error "Process %s is not active" proc)
        (tramp-message proc 5 "Interrupt process %s with pid %s" proc pid)
        ;; This is for tramp-sh.el.  Other backends do not support this (yet).
@@ -4651,44 +4843,17 @@ Only works for Bourne-like shells."
        ;; Wait, until the process has disappeared.  If it doesn't,
        ;; fall back to the default implementation.
        (with-timeout (1 (ignore))
-         (while (process-live-p proc)
-           ;; We cannot run `tramp-accept-process-output', it blocks timers.
-           (accept-process-output proc 0.1))
+         (while (tramp-accept-process-output proc))
          ;; Report success.
          proc)))))
 
 ;; `interrupt-process-functions' exists since Emacs 26.1.
 (when (boundp 'interrupt-process-functions)
-  (add-hook 'interrupt-process-functions 'tramp-interrupt-process)
+  (add-hook 'interrupt-process-functions #'tramp-interrupt-process)
   (add-hook
    'tramp-unload-hook
    (lambda ()
-     (remove-hook 'interrupt-process-functions 'tramp-interrupt-process))))
-
-;;; Integration of eshell.el:
-
-;; eshell.el keeps the path in `eshell-path-env'.  We must change it
-;; when `default-directory' points to another host.
-(defun tramp-eshell-directory-change ()
-  "Set `eshell-path-env' to $PATH of the host related to `default-directory'."
-  ;; Remove last element of `(exec-path)', which is `exec-directory'.
-  ;; Use `path-separator' as it does eshell.
-  (setq eshell-path-env
-       (mapconcat
-        'identity (butlast (tramp-compat-exec-path)) path-separator)))
-
-(eval-after-load "esh-util"
-  '(progn
-     (add-hook 'eshell-mode-hook
-              'tramp-eshell-directory-change)
-     (add-hook 'eshell-directory-change-hook
-              'tramp-eshell-directory-change)
-     (add-hook 'tramp-unload-hook
-              (lambda ()
-                (remove-hook 'eshell-mode-hook
-                             'tramp-eshell-directory-change)
-                (remove-hook 'eshell-directory-change-hook
-                             'tramp-eshell-directory-change)))))
+     (remove-hook 'interrupt-process-functions #'tramp-interrupt-process))))
 
 ;; Checklist for `tramp-unload-hook'
 ;; - Unload all `tramp-*' packages
@@ -4700,13 +4865,16 @@ Only works for Bourne-like shells."
 (defun tramp-unload-tramp ()
   "Discard Tramp from loading remote files."
   (interactive)
-  ;; ange-ftp settings must be enabled.
+  ;; ange-ftp settings must be re-enabled.
   (tramp-compat-funcall 'tramp-ftp-enable-ange-ftp)
   ;; Maybe it's not loaded yet.
   (ignore-errors (unload-feature 'tramp 'force)))
 
 (provide 'tramp)
 
+(run-hooks 'tramp--startup-hook)
+(setq tramp--startup-hook nil)
+
 ;;; TODO:
 ;;
 ;; * Avoid screen blanking when hitting `g' in dired.  (Eli Tziperman)
@@ -4729,6 +4897,12 @@ Only works for Bourne-like shells."
 ;;   and friends, for most of the handlers this is the major
 ;;   difference between the different backends.  Other handlers but
 ;;   *-process-file would profit from this as well.
+;;
+;; * Get rid of `shell-command'.  In its primary implementation, it
+;;   uses `process-file-shell-command' and
+;;   `start-file-process-shell-command', which is sufficient due to
+;;   connection-local `shell-file-name'.
+
 
 ;;; tramp.el ends here
 
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index de76788..83d34c0 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -1,7 +1,7 @@
 ;;; trampver.el --- Transparent Remote Access, Multiple Protocol  -*- 
lexical-binding:t -*-
 ;;; lisp/trampver.el.  Generated from trampver.el.in by configure.
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Kai Großjohann <address@hidden>
 ;; Maintainer: Michael Albinus <address@hidden>
@@ -31,33 +31,49 @@
 ;; aclocal.m4; should be changed only there.
 
 ;;;###tramp-autoload
-(defconst tramp-version "2.4.1-pre"
+(defconst tramp-version "2.4.2-pre"
   "This version of Tramp.")
 
 ;;;###tramp-autoload
 (defconst tramp-bug-report-address "address@hidden"
   "Email address to send bug reports to.")
 
-(defun tramp-repository-get-version ()
-  "Try to return as a string the repository revision of the Tramp sources."
-  (let ((dir (locate-dominating-file (locate-library "tramp") ".git")))
-    (when dir
-      (with-temp-buffer
-       (let ((default-directory (file-name-as-directory dir)))
-         (and (zerop
-               (ignore-errors
-                 (call-process "git" nil '(t nil) nil "rev-parse" "HEAD")))
-              (not (zerop (buffer-size)))
-              (replace-regexp-in-string "\n" "" (buffer-string))))))))
+(defconst tramp-repository-branch
+  (ignore-errors
+    ;; Suppress message from `emacs-repository-get-branch'.  We must
+    ;; also handle out-of-tree builds.
+    (let ((inhibit-message t)
+         (dir (or (locate-dominating-file (locate-library "tramp") ".git")
+                  source-directory)))
+      ;; `emacs-repository-get-branch' has been introduced with Emacs 27.1.
+      (with-no-warnings
+       (and (stringp dir) (file-directory-p dir)
+            (emacs-repository-get-branch dir)))))
+  "The repository branch of the Tramp sources.")
+
+(defconst tramp-repository-version
+  (ignore-errors
+    ;; Suppress message from `emacs-repository-get-version'.  We must
+    ;; also handle out-of-tree builds.
+    (let ((inhibit-message t)
+         (dir (or (locate-dominating-file (locate-library "tramp") ".git")
+                  source-directory)))
+      (and (stringp dir) (file-directory-p dir)
+          (emacs-repository-get-version dir))))
+  "The repository revision of the Tramp sources.")
 
 ;; Check for Emacs version.
 (let ((x   (if (not (string-lessp emacs-version "24.1"))
       "ok"
-    (format "Tramp 2.4.1-pre is not fit for %s"
+    (format "Tramp 2.4.2-pre is not fit for %s"
             (replace-regexp-in-string "\n" "" (emacs-version))))))
   (unless (string-equal "ok" x) (error "%s" x)))
 
-;; Tramp versions integrated into Emacs.
+;; Tramp versions integrated into Emacs.  If a user option declares a
+;; `:package-version' which doesn't belong to an integrated Tramp
+;; version, it must be added here as well (see `tramp-syntax', for
+;; example).  This can be checked by something like
+;; (customize-changed "26.1")
 (add-to-list
  'customize-package-emacs-version-alist
  '(Tramp ("2.0.55" . "22.1") ("2.0.57" . "22.2") ("2.0.58-pre" . "22.3")
@@ -67,7 +83,7 @@
         ("2.2.9-24.4" . "24.4") ("2.2.11-24.5" . "24.5")
         ("2.2.13.25.1" . "25.1") ("2.2.13.25.2" . "25.2")
         ("2.2.13.25.2" . "25.3")
-        ("2.3.3.26.1" . "26.1") ("2.3.5.26.2" . "26.2")))
+         ("2.3.3" . "26.1") ("2.3.3.26.1" . "26.1") ("2.3.5.26.2" . "26.2")))
 
 (add-hook 'tramp-unload-hook
          (lambda ()
diff --git a/lisp/net/webjump.el b/lisp/net/webjump.el
index da6e597..e297b9d 100644
--- a/lisp/net/webjump.el
+++ b/lisp/net/webjump.el
@@ -1,6 +1,6 @@
 ;;; webjump.el --- programmable Web hotlist
 
-;; Copyright (C) 1996-1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author:    Neil W. Van Dyke <address@hidden>
 ;; Created:   09-Aug-1996
@@ -342,7 +342,7 @@ Please submit bug reports and other feedback to the author, 
Neil W. Van Dyke
   (mapconcat (lambda (c)
                (let ((s (char-to-string c)))
                  (cond ((string= s " ") "+")
-                       ((string-match "[a-zA-Z_.-/]" s) s)
+                      ((string-match "[a-zA-Z_./~-]" s) s)
                        (t (upcase (format "%%%02x" c))))))
              (encode-coding-string str 'utf-8)
              ""))
diff --git a/lisp/net/zeroconf.el b/lisp/net/zeroconf.el
index 0a3f277..36643a8 100644
--- a/lisp/net/zeroconf.el
+++ b/lisp/net/zeroconf.el
@@ -1,6 +1,6 @@
 ;;; zeroconf.el --- Service browser using Avahi.  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 ;; Keywords: comm, hardware
@@ -528,22 +528,27 @@ DOMAIN is nil, the local domain is used."
             zeroconf-avahi-current-domain
             zeroconf-avahi-flags-unspec))))
 
+(defvar zeroconf-service-type-browser-handler-running nil
+  "Prevent infinite recursion in `zeroconf-service-type-browser-handler'.")
+
 (defun zeroconf-service-type-browser-handler (&rest val)
   "Registered service type browser handler at the Avahi daemon."
-  (when zeroconf-debug
-    (message "zeroconf-service-type-browser-handler: %s %S"
-            (dbus-event-member-name last-input-event) val))
-  (cond
-   ((string-equal (dbus-event-member-name last-input-event) "ItemNew")
-    ;; Parameters: (interface protocol type domain flags)
-    ;; Register a service browser.
-    (let ((object-path (zeroconf-register-service-browser (nth 2 val))))
-      ;; Register the signals.
-      (dolist (member '("ItemNew" "ItemRemove" "Failure"))
-       (dbus-register-signal
-        :system zeroconf-service-avahi object-path
-        zeroconf-interface-avahi-service-browser member
-        'zeroconf-service-browser-handler))))))
+  (unless zeroconf-service-type-browser-handler-running
+    (let ((zeroconf-service-type-browser-handler-running t))
+      (when zeroconf-debug
+        (message "zeroconf-service-type-browser-handler: %s %S"
+                (dbus-event-member-name last-input-event) val))
+      (cond
+       ((string-equal (dbus-event-member-name last-input-event) "ItemNew")
+        ;; Parameters: (interface protocol type domain flags)
+        ;; Register a service browser.
+        (let ((object-path (zeroconf-register-service-browser (nth 2 val))))
+          ;; Register the signals.
+          (dolist (member '("ItemNew" "ItemRemove" "Failure"))
+           (dbus-register-signal
+            :system zeroconf-service-avahi object-path
+            zeroconf-interface-avahi-service-browser member
+            'zeroconf-service-browser-handler))))))))
 
 (defun zeroconf-register-service-browser (type)
   "Register a service browser at the Avahi daemon."
diff --git a/lisp/newcomment.el b/lisp/newcomment.el
index cd72266..bb371c5 100644
--- a/lisp/newcomment.el
+++ b/lisp/newcomment.el
@@ -1,6 +1,6 @@
 ;;; newcomment.el --- (un)comment regions of buffers -*- lexical-binding: t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: code extracted from Emacs-20's simple.el
 ;; Maintainer: Stefan Monnier <address@hidden>
diff --git a/lisp/notifications.el b/lisp/notifications.el
index e19e0ee..1d250e2 100644
--- a/lisp/notifications.el
+++ b/lisp/notifications.el
@@ -1,6 +1,6 @@
 ;;; notifications.el --- Client interface to desktop notifications.
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Julien Danjou <address@hidden>
 ;; Keywords: comm desktop notifications
@@ -232,8 +232,8 @@ of another `notifications-notify' call."
        (add-to-list 'hints `(:dict-entry
                              "urgency"
                              (:variant :byte ,(pcase urgency
-                                                (`low 0)
-                                                (`critical 2)
+                                                ('low 0)
+                                                ('critical 2)
                                                 (_ 1)))) t))
       (when category
        (add-to-list 'hints `(:dict-entry
diff --git a/lisp/novice.el b/lisp/novice.el
index aaad4fa..3da4e25 100644
--- a/lisp/novice.el
+++ b/lisp/novice.el
@@ -1,6 +1,6 @@
 ;;; novice.el --- handling of disabled commands ("novice mode") for Emacs
 
-;; Copyright (C) 1985-1987, 1994, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1985-1987, 1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/nxml/nxml-enc.el b/lisp/nxml/nxml-enc.el
index 596dbe7..cf8bacc 100644
--- a/lisp/nxml/nxml-enc.el
+++ b/lisp/nxml/nxml-enc.el
@@ -1,6 +1,6 @@
 ;;; nxml-enc.el --- XML encoding auto-detection  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/nxml-maint.el b/lisp/nxml/nxml-maint.el
index daa7fd5..2956efb 100644
--- a/lisp/nxml/nxml-maint.el
+++ b/lisp/nxml/nxml-maint.el
@@ -1,6 +1,6 @@
 ;;; nxml-maint.el --- commands for maintainers of nxml-*.el  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
@@ -34,10 +34,10 @@
   (let (lst head)
     (with-current-buffer (find-file-noselect file)
       (goto-char (point-min))
-      (while (re-search-forward "^ *\\([a-FA-F0-9]\\{2\\}\\)[ \t]+" nil t)
+      (while (re-search-forward "^ *\\([a-fA-F0-9]\\{2\\}\\)[ \t]+" nil t)
        (let ((row (match-string 1))
              (eol (line-end-position)))
-         (while (re-search-forward 
"\\([a-FA-F0-9]\\{2\\}\\)-\\([a-FA-F0-9]\\{2\\}\\)\\|\\([a-FA-F0-9]\\{2\\}\\)" 
eol t)
+         (while (re-search-forward 
"\\([a-fA-F0-9]\\{2\\}\\)-\\([a-fA-F0-9]\\{2\\}\\)\\|\\([a-fA-F0-9]\\{2\\}\\)" 
eol t)
            (setq lst
                  (cons (if (match-beginning 3)
                            (concat "#x" row (match-string 3))
diff --git a/lisp/nxml/nxml-mode.el b/lisp/nxml/nxml-mode.el
index e2b51bc..6f80912 100644
--- a/lisp/nxml/nxml-mode.el
+++ b/lisp/nxml/nxml-mode.el
@@ -1,6 +1,6 @@
 ;;; nxml-mode.el --- a new XML mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003-2004, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/nxml-ns.el b/lisp/nxml/nxml-ns.el
index 141ce12..c07ae7f 100644
--- a/lisp/nxml/nxml-ns.el
+++ b/lisp/nxml/nxml-ns.el
@@ -1,6 +1,6 @@
 ;;; nxml-ns.el --- XML namespace processing  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/nxml-outln.el b/lisp/nxml/nxml-outln.el
index 5bb930f..f62535c 100644
--- a/lisp/nxml/nxml-outln.el
+++ b/lisp/nxml/nxml-outln.el
@@ -1,6 +1,6 @@
 ;;; nxml-outln.el --- outline support for nXML mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2004, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/nxml-parse.el b/lisp/nxml/nxml-parse.el
index 7b8c691..507b6bd 100644
--- a/lisp/nxml/nxml-parse.el
+++ b/lisp/nxml/nxml-parse.el
@@ -1,6 +1,6 @@
 ;;; nxml-parse.el --- XML parser, sharing infrastructure with nxml-mode  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/nxml-rap.el b/lisp/nxml/nxml-rap.el
index 2578492..2bd758b 100644
--- a/lisp/nxml/nxml-rap.el
+++ b/lisp/nxml/nxml-rap.el
@@ -1,6 +1,6 @@
 ;;; nxml-rap.el --- low-level support for random access parsing for nXML mode  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 2003-2004, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2004, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/nxml-util.el b/lisp/nxml/nxml-util.el
index 03e0f47..988945d 100644
--- a/lisp/nxml/nxml-util.el
+++ b/lisp/nxml/nxml-util.el
@@ -1,6 +1,6 @@
 ;;; nxml-util.el --- utility functions for nxml-*.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/rng-cmpct.el b/lisp/nxml/rng-cmpct.el
index a433dbb..d36f9d9 100644
--- a/lisp/nxml/rng-cmpct.el
+++ b/lisp/nxml/rng-cmpct.el
@@ -1,6 +1,6 @@
 ;;; rng-cmpct.el --- parsing of RELAX NG Compact Syntax schemas  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-dt.el b/lisp/nxml/rng-dt.el
index 10aad72..414ed95 100644
--- a/lisp/nxml/rng-dt.el
+++ b/lisp/nxml/rng-dt.el
@@ -1,6 +1,6 @@
 ;;; rng-dt.el --- datatype library interface for RELAX NG  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-loc.el b/lisp/nxml/rng-loc.el
index 75d9831..db4f6e4 100644
--- a/lisp/nxml/rng-loc.el
+++ b/lisp/nxml/rng-loc.el
@@ -1,6 +1,6 @@
 ;;; rng-loc.el --- Locate the schema to use for validation  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-maint.el b/lisp/nxml/rng-maint.el
index 2b7d9cc..56fbf12 100644
--- a/lisp/nxml/rng-maint.el
+++ b/lisp/nxml/rng-maint.el
@@ -1,6 +1,6 @@
 ;;; rng-maint.el --- commands for RELAX NG maintainers  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
@@ -228,8 +228,7 @@
   (let* ((start (current-time))
         (val (apply function args)))
     (message "%s ran in %g seconds"
-            function
-            (float-time (time-subtract nil start)))
+            function (float-time (time-since start)))
     val))
 
 (defun rng-time-tokenize-buffer ()
diff --git a/lisp/nxml/rng-match.el b/lisp/nxml/rng-match.el
index d427af9..dcddb53 100644
--- a/lisp/nxml/rng-match.el
+++ b/lisp/nxml/rng-match.el
@@ -1,6 +1,6 @@
 ;;; rng-match.el --- matching of RELAX NG patterns against XML events  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-nxml.el b/lisp/nxml/rng-nxml.el
index 1b3a5bb..05b5931 100644
--- a/lisp/nxml/rng-nxml.el
+++ b/lisp/nxml/rng-nxml.el
@@ -1,6 +1,6 @@
 ;;; rng-nxml.el --- make nxml-mode take advantage of rng-validate-mode  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
@@ -160,7 +160,7 @@ Validation will be enabled if `rng-nxml-auto-validate-flag' 
is non-nil."
       (and rng-collecting-text (rng-flush-text))
       (let ((target-names (rng-match-possible-start-tag-names)))
         `(,(1+ lt-pos)
-          ,(save-excursion (skip-chars-forward "[[:alnum:]_.-:]") (point))
+          ,(save-excursion (skip-chars-forward "-[:alnum:]_.:") (point))
           ,(apply-partially #'rng-complete-qname-function
                             target-names nil extra-strings)
           :exit-function
@@ -207,7 +207,7 @@ Validation will be enabled if `rng-nxml-auto-validate-flag' 
is non-nil."
                              (cdar rng-open-elements))
                    (cdar rng-open-elements))))
              `(,(+ (match-beginning 0) 2)
-               ,(save-excursion (skip-chars-forward "[[:alnum:]_.-:]") (point))
+               ,(save-excursion (skip-chars-forward "-[:alnum:]_.:") (point))
                ,(list start-tag-name)   ;Sole completion candidate.
                :exit-function
                ,(lambda (_completion status)
@@ -247,7 +247,7 @@ Validation will be enabled if `rng-nxml-auto-validate-flag' 
is non-nil."
                              "xmlns"))
                          rng-undeclared-prefixes)))
              `(,attribute-start
-               ,(save-excursion (skip-chars-forward "[[:alnum:]_.-:]") (point))
+               ,(save-excursion (skip-chars-forward "-[:alnum:]_.:") (point))
                ,(apply-partially #'rng-complete-qname-function
                                  target-names t extra-strings)
                :exit-function
diff --git a/lisp/nxml/rng-parse.el b/lisp/nxml/rng-parse.el
index 060af60..7a720bc 100644
--- a/lisp/nxml/rng-parse.el
+++ b/lisp/nxml/rng-parse.el
@@ -1,6 +1,6 @@
 ;;; rng-parse.el --- parse an XML file and validate it against a schema  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-pttrn.el b/lisp/nxml/rng-pttrn.el
index fea8584..1b28f5c 100644
--- a/lisp/nxml/rng-pttrn.el
+++ b/lisp/nxml/rng-pttrn.el
@@ -1,6 +1,6 @@
 ;;; rng-pttrn.el --- RELAX NG patterns  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-uri.el b/lisp/nxml/rng-uri.el
index ae7902e..798475b 100644
--- a/lisp/nxml/rng-uri.el
+++ b/lisp/nxml/rng-uri.el
@@ -1,6 +1,6 @@
 ;;; rng-uri.el --- URI parsing and manipulation  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
@@ -30,9 +30,10 @@ Multibyte characters are left as is.  Use 
`rng-uri-escape-multibyte' to
 escape them using %HH."
   (setq f (expand-file-name f))
   (let ((url
-        (replace-regexp-in-string "[\000-\032\177<>#%\"{}|\\^[]`%?;]"
-                                  'rng-percent-encode
-                                  f)))
+        ;; FIXME. Explain why the pattern doesn't also have "!$&'()*+,/:@=".
+        ;; See Internet RFC 3986 section 2.2.
+        (replace-regexp-in-string "[]\0-\s\"#%;<>?[\\^`{|}\177]"
+                                  'rng-percent-encode f)))
     (concat "file:"
            (if (and (> (length url) 0)
                     (= (aref url 0) ?/))
@@ -42,7 +43,7 @@ escape them using %HH."
 
 (defun rng-uri-escape-multibyte (uri)
   "Escape multibyte characters in URI."
-  (replace-regexp-in-string "[:nonascii:]"
+  (replace-regexp-in-string "[[:nonascii:]]"
                            'rng-percent-encode
                            (encode-coding-string uri 'utf-8)))
 
diff --git a/lisp/nxml/rng-util.el b/lisp/nxml/rng-util.el
index d8a939c..36399f6 100644
--- a/lisp/nxml/rng-util.el
+++ b/lisp/nxml/rng-util.el
@@ -1,6 +1,6 @@
 ;;; rng-util.el --- utility functions for RELAX NG library
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-valid.el b/lisp/nxml/rng-valid.el
index 92998c0..6c1ca51 100644
--- a/lisp/nxml/rng-valid.el
+++ b/lisp/nxml/rng-valid.el
@@ -1,6 +1,6 @@
 ;;; rng-valid.el --- real-time validation of XML using RELAX NG  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
diff --git a/lisp/nxml/rng-xsd.el b/lisp/nxml/rng-xsd.el
index ea4f54c..f308b04 100644
--- a/lisp/nxml/rng-xsd.el
+++ b/lisp/nxml/rng-xsd.el
@@ -1,6 +1,6 @@
 ;;; rng-xsd.el --- W3C XML Schema datatypes library for RELAX NG  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, RelaxNG
@@ -360,7 +360,7 @@ trailing digits.  For example, -0021.0430 would be 
represented by [-1
       n)))
 
 (defun rng-xsd-convert-any-uri (string)
-  (and (string-match "\\`\\(?:[^%]\\|%[0-9a-fA-F][0-9a-fA-F]\\)?*\\'" string)
+  (and (string-match "\\`\\(?:[^%]\\|%[0-9a-fA-F][0-9a-fA-F]\\)*\\'" string)
        (string-match "\\`[^#]*\\(?:#[^#]*\\)?\\'" string)
        (string-match 
"\\`\\(?:[a-zA-Z][-+.A-Za-z0-9]*:.+\\|[^:]*\\(?:[#/?].*\\)?\\)\\'" string)
        string))
diff --git a/lisp/nxml/xmltok.el b/lisp/nxml/xmltok.el
index c4559e3..afa33e0 100644
--- a/lisp/nxml/xmltok.el
+++ b/lisp/nxml/xmltok.el
@@ -1,6 +1,6 @@
 ;;; xmltok.el --- XML tokenization  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML
diff --git a/lisp/nxml/xsd-regexp.el b/lisp/nxml/xsd-regexp.el
index 54f56dd..7ae169c 100644
--- a/lisp/nxml/xsd-regexp.el
+++ b/lisp/nxml/xsd-regexp.el
@@ -1,6 +1,6 @@
 ;;; xsd-regexp.el --- translate W3C XML Schema regexps to Emacs regexps  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: James Clark
 ;; Keywords: wp, hypermedia, languages, XML, regexp
diff --git a/lisp/obarray.el b/lisp/obarray.el
index 90a7965..c83d5d4 100644
--- a/lisp/obarray.el
+++ b/lisp/obarray.el
@@ -1,6 +1,6 @@
 ;;; obarray.el --- obarray functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: obarray functions
diff --git a/lisp/obsolete/abbrevlist.el b/lisp/obsolete/abbrevlist.el
index 0455346..e2bf14f 100644
--- a/lisp/obsolete/abbrevlist.el
+++ b/lisp/obsolete/abbrevlist.el
@@ -1,6 +1,6 @@
 ;;; abbrevlist.el --- list one abbrev table alphabetically ordered
 
-;; Copyright (C) 1986, 1992, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1986, 1992, 2001-2019 Free Software Foundation, Inc.
 ;; Suggested by a previous version by Gildea.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/obsolete/assoc.el b/lisp/obsolete/assoc.el
index 66cf677..926e605 100644
--- a/lisp/obsolete/assoc.el
+++ b/lisp/obsolete/assoc.el
@@ -1,6 +1,6 @@
 ;;; assoc.el --- insert/delete functions on association lists  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Barry A. Warsaw <address@hidden>
 ;; Keywords: extensions
diff --git a/lisp/obsolete/bruce.el b/lisp/obsolete/bruce.el
index 0102031..fba54c1 100644
--- a/lisp/obsolete/bruce.el
+++ b/lisp/obsolete/bruce.el
@@ -1,7 +1,7 @@
 ;;; bruce.el --- bruce phrase utility for overloading the Communications
 ;;; Decency Act snoops, if any.
 
-;; Copyright (C) 1988, 1993, 1997, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1988, 1993, 1997, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/obsolete/cc-compat.el b/lisp/obsolete/cc-compat.el
index dc6e769..bbacd12 100644
--- a/lisp/obsolete/cc-compat.el
+++ b/lisp/obsolete/cc-compat.el
@@ -1,6 +1,6 @@
 ;;; cc-compat.el --- cc-mode compatibility with c-mode.el confusion
 
-;; Copyright (C) 1985, 1987, 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2019 Free Software Foundation, Inc.
 
 ;; Authors:    1998- Martin Stjernholm
 ;;            1994-1999 Barry A. Warsaw
diff --git a/lisp/obsolete/cl-compat.el b/lisp/obsolete/cl-compat.el
index 0bb08ff..b273582 100644
--- a/lisp/obsolete/cl-compat.el
+++ b/lisp/obsolete/cl-compat.el
@@ -1,6 +1,6 @@
 ;;; cl-compat.el --- Common Lisp extensions for GNU Emacs Lisp (compatibility)
 
-;; Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <address@hidden>
 ;; Version: 2.02
diff --git a/lisp/obsolete/complete.el b/lisp/obsolete/complete.el
index f5e4328..8021b22 100644
--- a/lisp/obsolete/complete.el
+++ b/lisp/obsolete/complete.el
@@ -1,6 +1,6 @@
 ;;; complete.el --- partial completion mechanism plus other goodies
 
-;; Copyright (C) 1990-1993, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1993, 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Gillespie <address@hidden>
 ;; Keywords: abbrev convenience
diff --git a/lisp/obsolete/crisp.el b/lisp/obsolete/crisp.el
index 4bd555a..832820b 100644
--- a/lisp/obsolete/crisp.el
+++ b/lisp/obsolete/crisp.el
@@ -1,6 +1,6 @@
 ;;; crisp.el --- CRiSP/Brief Emacs emulator
 
-;; Copyright (C) 1997-1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Gary D. Foster <address@hidden>
 ;; Keywords: emulations brief crisp
@@ -376,10 +376,6 @@ normal CRiSP binding) and when it is nil M-x will run
 ;;;###autoload
 (defalias 'brief-mode 'crisp-mode)
 
-;; Interaction with other packages.
-(put 'crisp-home 'CUA 'move)
-(put 'crisp-end  'CUA 'move)
-
 (run-hooks 'crisp-load-hook)
 (provide 'crisp)
 
diff --git a/lisp/obsolete/cust-print.el b/lisp/obsolete/cust-print.el
index 354c2f4..849d665 100644
--- a/lisp/obsolete/cust-print.el
+++ b/lisp/obsolete/cust-print.el
@@ -1,6 +1,6 @@
 ;;; cust-print.el --- handles print-level and print-circle
 
-;; Copyright (C) 1992, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Daniel LaLiberte <address@hidden>
 ;; Adapted-By: ESR
diff --git a/lisp/obsolete/erc-hecomplete.el b/lisp/obsolete/erc-hecomplete.el
index 0714ecc..43df67d 100644
--- a/lisp/obsolete/erc-hecomplete.el
+++ b/lisp/obsolete/erc-hecomplete.el
@@ -1,6 +1,6 @@
 ;;; erc-hecomplete.el --- Provides Nick name completion for ERC
 
-;; Copyright (C) 2001-2002, 2004, 2006-2018 Free Software Foundation,
+;; Copyright (C) 2001-2002, 2004, 2006-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Alex Schroeder <address@hidden>
diff --git a/lisp/obsolete/eudcb-ph.el b/lisp/obsolete/eudcb-ph.el
index c1dc8ca..20f8f4a 100644
--- a/lisp/obsolete/eudcb-ph.el
+++ b/lisp/obsolete/eudcb-ph.el
@@ -1,6 +1,6 @@
 ;;; eudcb-ph.el --- Emacs Unified Directory Client - CCSO PH/QI Backend
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Oscar Figueiredo <address@hidden>
 ;;         Pavel Janík <address@hidden>
diff --git a/lisp/obsolete/fast-lock.el b/lisp/obsolete/fast-lock.el
index 21db321..5180d45 100644
--- a/lisp/obsolete/fast-lock.el
+++ b/lisp/obsolete/fast-lock.el
@@ -1,6 +1,6 @@
 ;;; fast-lock.el --- automagic text properties caching for fast Font Lock mode
 
-;; Copyright (C) 1994-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Marshall <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/obsolete/gs.el b/lisp/obsolete/gs.el
index 236ef88..cfdc9dc 100644
--- a/lisp/obsolete/gs.el
+++ b/lisp/obsolete/gs.el
@@ -1,6 +1,6 @@
 ;;; gs.el --- interface to Ghostscript
 
-;; Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: internal
diff --git a/lisp/obsolete/gulp.el b/lisp/obsolete/gulp.el
index 81bdac6..bdb3406 100644
--- a/lisp/obsolete/gulp.el
+++ b/lisp/obsolete/gulp.el
@@ -1,6 +1,6 @@
 ;;; gulp.el --- ask for updates for Lisp packages
 
-;; Copyright (C) 1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Sam Shteingold <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/obsolete/html2text.el b/lisp/obsolete/html2text.el
index 3d97c90..efc69e8 100644
--- a/lisp/obsolete/html2text.el
+++ b/lisp/obsolete/html2text.el
@@ -1,6 +1,6 @@
 ;;; html2text.el --- a simple html to plain text converter -*- coding: utf-8 
-*-
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Joakim Hove <address@hidden>
 ;; Obsolete-since: 26.1
diff --git a/lisp/obsolete/iswitchb.el b/lisp/obsolete/iswitchb.el
index 6192368..5b0df1e 100644
--- a/lisp/obsolete/iswitchb.el
+++ b/lisp/obsolete/iswitchb.el
@@ -1,6 +1,6 @@
 ;;; iswitchb.el --- switch between buffers using substrings
 
-;; Copyright (C) 1996-1997, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Stephen Eglen <address@hidden>
 ;; Maintainer: Stephen Eglen <address@hidden>
diff --git a/lisp/obsolete/landmark.el b/lisp/obsolete/landmark.el
index effea95..c4af4c3 100644
--- a/lisp/obsolete/landmark.el
+++ b/lisp/obsolete/landmark.el
@@ -1,8 +1,8 @@
 ;;; landmark.el --- Neural-network robot that learns landmarks  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1996-1997, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2000-2019 Free Software Foundation, Inc.
 
-;; Author: Terrence Brannon (was: <address@hidden>)
+;; Author: Terrence Brannon <address@hidden>
 ;; Created: December 16, 1996 - first release to usenet
 ;; Keywords: games, neural network, adaptive search, chemotaxis
 ;; Version: 1.0
@@ -36,7 +36,7 @@
 ;; the smell of the tree increases, then the weights in the robot's
 ;; brain are adjusted to encourage this odor-driven behavior in the
 ;; future. If the smell of the tree decreases, the robots weights are
-;; adjusted to discourage a correct move.
+;; adjusted to discourage that odor-driven behavior.
 
 ;; In laymen's terms, the search space is initially flat. The point
 ;; of training is to "turn up the edges of the search space" so that
@@ -53,6 +53,13 @@
 ;; a single move, one moves east,west and south, then both east and
 ;; west will be improved when they shouldn't
 
+;; The source code was developed as part of a course on Brain Theory
+;; and Neural Networks at the University of Southern California. The
+;; original problem description and solution appeared in 1981 in the
+;; paper "Landmark Learning: An Illustration of Associative
+;; Search" authored by Andrew G. Barto and Richard S. Sutton and
+;; published to Biological Cybernetics.
+
 ;; Many thanks to Yuri Pryadkin <address@hidden> for this
 ;; concise problem description.
 
diff --git a/lisp/obsolete/lazy-lock.el b/lisp/obsolete/lazy-lock.el
index 54dc799..44f8528 100644
--- a/lisp/obsolete/lazy-lock.el
+++ b/lisp/obsolete/lazy-lock.el
@@ -1,6 +1,6 @@
 ;;; lazy-lock.el --- lazy demand-driven fontification for fast Font Lock mode
 
-;; Copyright (C) 1994-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Marshall <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/obsolete/ledit.el b/lisp/obsolete/ledit.el
index e09c1c3..6383a42 100644
--- a/lisp/obsolete/ledit.el
+++ b/lisp/obsolete/ledit.el
@@ -1,6 +1,6 @@
 ;;; ledit.el --- Emacs side of ledit interface
 
-;; Copyright (C) 1985, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: languages
diff --git a/lisp/obsolete/levents.el b/lisp/obsolete/levents.el
index 48afe75..714b3fb 100644
--- a/lisp/obsolete/levents.el
+++ b/lisp/obsolete/levents.el
@@ -1,6 +1,6 @@
 ;;; levents.el --- emulate the Lucid event data type and associated functions
 
-;; Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: emulations
diff --git a/lisp/obsolete/lmenu.el b/lisp/obsolete/lmenu.el
index 25a9837..31fcc18 100644
--- a/lisp/obsolete/lmenu.el
+++ b/lisp/obsolete/lmenu.el
@@ -1,6 +1,6 @@
 ;;; lmenu.el --- emulate Lucid's menubar support
 
-;; Copyright (C) 1992-1994, 1997, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1992-1994, 1997, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Keywords: emulations obsolete
diff --git a/lisp/obsolete/longlines.el b/lisp/obsolete/longlines.el
index d07f7bf..2ef5324 100644
--- a/lisp/obsolete/longlines.el
+++ b/lisp/obsolete/longlines.el
@@ -1,6 +1,6 @@
 ;;; longlines.el --- automatically wrap long lines   -*- coding:utf-8 -*-
 
-;; Copyright (C) 2000-2001, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2001, 2004-2019 Free Software Foundation, Inc.
 
 ;; Authors:    Kai Grossjohann <address@hidden>
 ;;             Alex Schroeder <address@hidden>
diff --git a/lisp/obsolete/lucid.el b/lisp/obsolete/lucid.el
index c248cd6..d1b702e 100644
--- a/lisp/obsolete/lucid.el
+++ b/lisp/obsolete/lucid.el
@@ -1,6 +1,6 @@
 ;;; lucid.el --- emulate some Lucid Emacs functions
 
-;; Copyright (C) 1993, 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: emulations
diff --git a/lisp/obsolete/messcompat.el b/lisp/obsolete/messcompat.el
index 67dd2da..28e37a6 100644
--- a/lisp/obsolete/messcompat.el
+++ b/lisp/obsolete/messcompat.el
@@ -1,6 +1,6 @@
 ;;; messcompat.el --- making message mode compatible with mail mode
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: mail, news
diff --git a/lisp/obsolete/mouse-sel.el b/lisp/obsolete/mouse-sel.el
index f54bcf0..b8dd9e6 100644
--- a/lisp/obsolete/mouse-sel.el
+++ b/lisp/obsolete/mouse-sel.el
@@ -1,6 +1,6 @@
 ;;; mouse-sel.el --- multi-click selection support
 
-;; Copyright (C) 1993-1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Mike Williams <address@hidden>
 ;; Keywords: mouse
diff --git a/lisp/obsolete/old-emacs-lock.el b/lisp/obsolete/old-emacs-lock.el
index a747c54..d940f1b 100644
--- a/lisp/obsolete/old-emacs-lock.el
+++ b/lisp/obsolete/old-emacs-lock.el
@@ -1,6 +1,6 @@
 ;;; emacs-lock.el --- prevents you from exiting Emacs if a buffer is locked
 
-;; Copyright (C) 1994, 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Tom Wurgler <address@hidden>
 ;; Created: 12/8/94
diff --git a/lisp/obsolete/old-whitespace.el b/lisp/obsolete/old-whitespace.el
index 0c9fc32..c8daa57 100644
--- a/lisp/obsolete/old-whitespace.el
+++ b/lisp/obsolete/old-whitespace.el
@@ -1,6 +1,6 @@
 ;;; whitespace.el --- warn about and clean bogus whitespaces in the file
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Rajesh Vaidheeswarran <address@hidden>
 ;; Keywords: convenience
diff --git a/lisp/obsolete/otodo-mode.el b/lisp/obsolete/otodo-mode.el
index 90334e1..7e9cc23 100644
--- a/lisp/obsolete/otodo-mode.el
+++ b/lisp/obsolete/otodo-mode.el
@@ -1,6 +1,6 @@
 ;;; todo-mode.el --- major mode for editing TODO list files
 
-;; Copyright (C) 1997, 1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Oliver Seidel <address@hidden>
 ;; Maintainer: Stephen Berman <address@hidden>
diff --git a/lisp/obsolete/pc-mode.el b/lisp/obsolete/pc-mode.el
index 3fdf9c3..6d1a456 100644
--- a/lisp/obsolete/pc-mode.el
+++ b/lisp/obsolete/pc-mode.el
@@ -1,6 +1,6 @@
 ;;; pc-mode.el --- emulate certain key bindings used on PCs
 
-;; Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: emulations
diff --git a/lisp/obsolete/pc-select.el b/lisp/obsolete/pc-select.el
index 0d41b88..e636862 100644
--- a/lisp/obsolete/pc-select.el
+++ b/lisp/obsolete/pc-select.el
@@ -2,7 +2,7 @@
 ;;;                 (or MAC GUI or MS-windoze (bah)) look-and-feel
 ;;;                 including key bindings.
 
-;; Copyright (C) 1995-1997, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1997, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Staats <address@hidden>
 ;; Keywords: convenience emulations
diff --git a/lisp/obsolete/pgg-def.el b/lisp/obsolete/pgg-def.el
index a128a8a..853045d 100644
--- a/lisp/obsolete/pgg-def.el
+++ b/lisp/obsolete/pgg-def.el
@@ -1,6 +1,6 @@
 ;;; pgg-def.el --- functions/macros for defining PGG functions
 
-;; Copyright (C) 1999, 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Created: 1999/11/02
diff --git a/lisp/obsolete/pgg-gpg.el b/lisp/obsolete/pgg-gpg.el
index 3b89072..6a901fb 100644
--- a/lisp/obsolete/pgg-gpg.el
+++ b/lisp/obsolete/pgg-gpg.el
@@ -1,6 +1,6 @@
 ;;; pgg-gpg.el --- GnuPG support for PGG.
 
-;; Copyright (C) 1999-2000, 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Symmetric encryption and gpg-agent support added by:
diff --git a/lisp/obsolete/pgg-parse.el b/lisp/obsolete/pgg-parse.el
index a747024..cdff9ac 100644
--- a/lisp/obsolete/pgg-parse.el
+++ b/lisp/obsolete/pgg-parse.el
@@ -1,6 +1,6 @@
 ;;; pgg-parse.el --- OpenPGP packet parsing
 
-;; Copyright (C) 1999, 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Created: 1999/10/28
@@ -123,10 +123,10 @@
         0))
 
 (defmacro pgg-byte-after (&optional pos)
-  `(pgg-char-int (char-after ,(or pos `(point)))))
+  `(pgg-char-int (char-after ,(or pos '(point)))))
 
 (defmacro pgg-read-byte ()
-  `(pgg-char-int (char-after (prog1 (point) (forward-char)))))
+  '(pgg-char-int (char-after (prog1 (point) (forward-char)))))
 
 (defmacro pgg-read-bytes-string (nbytes)
   `(buffer-substring
diff --git a/lisp/obsolete/pgg-pgp.el b/lisp/obsolete/pgg-pgp.el
index ae75377..9e9a38d 100644
--- a/lisp/obsolete/pgg-pgp.el
+++ b/lisp/obsolete/pgg-pgp.el
@@ -1,6 +1,6 @@
 ;;; pgg-pgp.el --- PGP 2.* and 6.* support for PGG.
 
-;; Copyright (C) 1999-2000, 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Created: 1999/11/02
diff --git a/lisp/obsolete/pgg-pgp5.el b/lisp/obsolete/pgg-pgp5.el
index af82055..8119943 100644
--- a/lisp/obsolete/pgg-pgp5.el
+++ b/lisp/obsolete/pgg-pgp5.el
@@ -1,6 +1,6 @@
 ;;; pgg-pgp5.el --- PGP 5.* support for PGG.
 
-;; Copyright (C) 1999-2000, 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Created: 1999/11/02
diff --git a/lisp/obsolete/pgg.el b/lisp/obsolete/pgg.el
index fd35f7d..18b63fc 100644
--- a/lisp/obsolete/pgg.el
+++ b/lisp/obsolete/pgg.el
@@ -1,6 +1,6 @@
 ;;; pgg.el --- glue for the various PGP implementations.
 
-;; Copyright (C) 1999-2000, 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Symmetric encryption added by: Sascha Wilde <address@hidden>
@@ -572,7 +572,7 @@ within the region."
   (with-current-buffer (get-buffer-create pgg-output-buffer)
     (buffer-disable-undo)
     (erase-buffer)
-    (let ((proto (if (string-match "^[a-zA-Z\\+\\.\\\\-]+:" keyserver)
+    (let ((proto (if (string-match "^[a-zA-Z\\+.-]+:" keyserver)
                     (substring keyserver 0 (1- (match-end 0))))))
       (save-excursion
        (funcall pgg-insert-url-function
diff --git a/lisp/obsolete/rcompile.el b/lisp/obsolete/rcompile.el
index 6e7e37f..dfa8009 100644
--- a/lisp/obsolete/rcompile.el
+++ b/lisp/obsolete/rcompile.el
@@ -1,6 +1,6 @@
 ;;; rcompile.el --- run a compilation on a remote machine
 
-;; Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Alon Albert <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/obsolete/s-region.el b/lisp/obsolete/s-region.el
index 8487920..d86b7d7 100644
--- a/lisp/obsolete/s-region.el
+++ b/lisp/obsolete/s-region.el
@@ -1,6 +1,6 @@
 ;;; s-region.el --- set region using shift key
 
-;; Copyright (C) 1994-1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Morten Welinder <address@hidden>
 ;; Keywords: terminals
diff --git a/lisp/obsolete/sregex.el b/lisp/obsolete/sregex.el
index 1099b87..884cd3e 100644
--- a/lisp/obsolete/sregex.el
+++ b/lisp/obsolete/sregex.el
@@ -1,6 +1,6 @@
 ;;; sregex.el --- symbolic regular expressions
 
-;; Copyright (C) 1997-1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Bob Glickstein <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/obsolete/starttls.el b/lisp/obsolete/starttls.el
index 0dc2663..e0a0968 100644
--- a/lisp/obsolete/starttls.el
+++ b/lisp/obsolete/starttls.el
@@ -1,6 +1,6 @@
 ;;; starttls.el --- STARTTLS functions
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Author: Simon Josefsson <address@hidden>
@@ -217,7 +217,7 @@ handshake, or nil on failure."
                                                starttls-success nil t))
                                 (setq done-bad (re-search-forward
                                                 starttls-failure nil t))))))
-           (accept-process-output process 1 100)
+           (accept-process-output process 1.1)
            (sit-for 0.1))
          (setq info (buffer-substring-no-properties old-max (point-max)))
          (delete-region old-max (point-max))
@@ -251,7 +251,7 @@ handshake, or nil on failure."
                  (goto-char old-max)
                  (not (setq done (re-search-forward
                                   starttls-connect nil t)))))
-      (accept-process-output process 0 100)
+      (accept-process-output process 0.1)
       (sit-for 0.1))
     (if done
        (with-current-buffer buffer
diff --git a/lisp/obsolete/sup-mouse.el b/lisp/obsolete/sup-mouse.el
index 5c10c02..6bd4278 100644
--- a/lisp/obsolete/sup-mouse.el
+++ b/lisp/obsolete/sup-mouse.el
@@ -1,6 +1,6 @@
 ;;; sup-mouse.el --- supdup mouse support for lisp machines
 
-;; Copyright (C) 1985-1986, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Wolfgang Rupprecht
 ;; Maintainer: address@hidden
diff --git a/lisp/obsolete/terminal.el b/lisp/obsolete/terminal.el
index 1c4f134..ce6f230 100644
--- a/lisp/obsolete/terminal.el
+++ b/lisp/obsolete/terminal.el
@@ -1,6 +1,6 @@
 ;;; terminal.el --- terminal emulator for GNU Emacs
 
-;; Copyright (C) 1986-1989, 1993-1994, 2001-2018 Free Software
+;; Copyright (C) 1986-1989, 1993-1994, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Richard Mlynarik <address@hidden>
diff --git a/lisp/obsolete/tls.el b/lisp/obsolete/tls.el
index fb7c20c..d17ddad 100644
--- a/lisp/obsolete/tls.el
+++ b/lisp/obsolete/tls.el
@@ -1,6 +1,6 @@
 ;;; tls.el --- TLS/SSL support via wrapper around GnuTLS
 
-;; Copyright (C) 1996-1999, 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 ;; Keywords: comm, tls, gnutls, ssl
diff --git a/lisp/obsolete/tpu-edt.el b/lisp/obsolete/tpu-edt.el
index c047381..8db1c4f 100644
--- a/lisp/obsolete/tpu-edt.el
+++ b/lisp/obsolete/tpu-edt.el
@@ -1,6 +1,6 @@
 ;;; tpu-edt.el --- Emacs emulating TPU emulating EDT
 
-;; Copyright (C) 1993-1995, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Rob Riepel <address@hidden>
 ;; Maintainer: Rob Riepel <address@hidden>
diff --git a/lisp/obsolete/tpu-extras.el b/lisp/obsolete/tpu-extras.el
index 21006ff..f19a67d 100644
--- a/lisp/obsolete/tpu-extras.el
+++ b/lisp/obsolete/tpu-extras.el
@@ -1,6 +1,6 @@
 ;;; tpu-extras.el --- scroll margins and free cursor mode for TPU-edt
 
-;; Copyright (C) 1993-1995, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Rob Riepel <address@hidden>
 ;; Maintainer: Rob Riepel <address@hidden>
diff --git a/lisp/obsolete/tpu-mapper.el b/lisp/obsolete/tpu-mapper.el
index 4cc2404..60e0e49 100644
--- a/lisp/obsolete/tpu-mapper.el
+++ b/lisp/obsolete/tpu-mapper.el
@@ -1,6 +1,6 @@
 ;;; tpu-mapper.el --- create a TPU-edt X-windows keymap file
 
-;; Copyright (C) 1993-1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Rob Riepel <address@hidden>
 ;; Maintainer: Rob Riepel <address@hidden>
diff --git a/lisp/obsolete/vc-arch.el b/lisp/obsolete/vc-arch.el
index e4c52d5..9252891 100644
--- a/lisp/obsolete/vc-arch.el
+++ b/lisp/obsolete/vc-arch.el
@@ -1,6 +1,6 @@
 ;;; vc-arch.el --- VC backend for the Arch version-control system  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  Stefan Monnier <address@hidden>
@@ -397,8 +397,8 @@ CALLBACK expects (ENTRIES &optional MORE-TO-COME); see
          (setq rev (replace-match (cdr rule) t nil rev))))
     (format "Arch%c%s"
            (pcase (vc-state file)
-             ((or `up-to-date `needs-update) ?-)
-             (`added ?@)
+             ((or 'up-to-date 'needs-update) ?-)
+             ('added ?@)
              (_ ?:))
            rev)))
 
diff --git a/lisp/obsolete/vip.el b/lisp/obsolete/vip.el
index 1d1eccb..bc4b900 100644
--- a/lisp/obsolete/vip.el
+++ b/lisp/obsolete/vip.el
@@ -1,6 +1,6 @@
 ;;; vip.el --- a VI Package for GNU Emacs
 
-;; Copyright (C) 1986-1988, 1992-1993, 1998, 2001-2018 Free Software
+;; Copyright (C) 1986-1988, 1992-1993, 1998, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Masahiko Sato <address@hidden>
@@ -2187,19 +2187,19 @@ a token has type \(command, address, end-mark\) and 
value."
          ((looking-at "%")
           (forward-char 1)
           (setq ex-token-type "whole"))
-         ((looking-at "+")
-          (cond ((or (looking-at "+[-+]") (looking-at "+[\n|]"))
+         ((looking-at "\\+")
+          (cond ((looking-at "\\+[-+\n|]")
                  (forward-char 1)
                  (insert "1")
                  (backward-char 1)
                  (setq ex-token-type "plus"))
-                ((looking-at "+[0-9]")
+                ((looking-at "\\+[0-9]")
                  (forward-char 1)
                  (setq ex-token-type "plus"))
                 (t
                  (error "Badly formed address"))))
          ((looking-at "-")
-          (cond ((or (looking-at "-[-+]") (looking-at "-[\n|]"))
+          (cond ((looking-at "-[-+\n|]")
                  (forward-char 1)
                  (insert "1")
                  (backward-char 1)
@@ -2216,7 +2216,7 @@ a token has type \(command, address, end-mark\) and 
value."
             (while (and (not (eolp)) cont)
               ;;(re-search-forward "[^/]*/")
               (re-search-forward "[^/]*\\(/\\|\n\\)")
-              (if (not (vip-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\/"))
+              (if (not (vip-looking-back "[^\\]\\(\\\\\\\\\\)*\\\\/"))
                   (setq cont nil))))
           (backward-char 1)
           (setq ex-token (buffer-substring (point) (mark)))
@@ -2229,7 +2229,7 @@ a token has type \(command, address, end-mark\) and 
value."
             (while (and (not (eolp)) cont)
               ;;(re-search-forward "[^\\?]*\\?")
               (re-search-forward "[^\\?]*\\(\\?\\|\n\\)")
-              (if (not (vip-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\\\?"))
+              (if (not (vip-looking-back "[^\\]\\(\\\\\\\\\\)*\\\\\\?"))
                   (setq cont nil))
               (backward-char 1)
               (if (not (looking-at "\n")) (forward-char 1))))
@@ -2325,7 +2325,7 @@ a token has type \(command, address, end-mark\) and 
value."
            (while (and (not (eolp)) cont)
              (re-search-forward "[^/]*\\(/\\|\n\\)")
              ;;(re-search-forward "[^/]*/")
-             (if (not (vip-looking-back "[^\\\\]\\(\\\\\\\\\\)*\\\\/"))
+             (if (not (vip-looking-back "[^\\]\\(\\\\\\\\\\)*\\\\/"))
                  (setq cont nil))))
          (setq ex-token
                (if (= (mark) (point)) ""
@@ -2520,7 +2520,7 @@ a token has type \(command, address, end-mark\) and 
value."
                ex-variant t)
          (forward-char 2)
          (skip-chars-forward " \t")))
-    (if (looking-at "+")
+    (if (looking-at "\\+")
        (progn
          (forward-char 1)
          (set-mark (point))
diff --git a/lisp/obsolete/ws-mode.el b/lisp/obsolete/ws-mode.el
index 9c09692..05dca95 100644
--- a/lisp/obsolete/ws-mode.el
+++ b/lisp/obsolete/ws-mode.el
@@ -1,6 +1,6 @@
 ;;; ws-mode.el --- WordStar emulation mode for GNU Emacs
 
-;; Copyright (C) 1991, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Juergen Nickelsen <address@hidden>
 ;; Version: 0.7
diff --git a/lisp/obsolete/xesam.el b/lisp/obsolete/xesam.el
index 3e91b2c..16da6d9 100644
--- a/lisp/obsolete/xesam.el
+++ b/lisp/obsolete/xesam.el
@@ -1,6 +1,6 @@
 ;;; xesam.el --- Xesam interface to search engines.
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 ;; Keywords: tools, hypermedia
@@ -410,18 +410,18 @@ If there is no registered search engine at all, the 
function returns nil."
        ;; Hopefully, this will change later.
        (setq hit-fields
              (pcase (intern vendor-id)
-               (`Beagle
+               ('Beagle
                 '("xesam:mimeType" "xesam:url"))
-               (`Strigi
+               ('Strigi
                 '("xesam:author" "xesam:cc" "xesam:charset"
                   "xesam:contentType" "xesam:fileExtension"
                   "xesam:id" "xesam:lineCount" "xesam:links"
                   "xesam:mimeType" "xesam:name" "xesam:size"
                   "xesam:sourceModified" "xesam:subject" "xesam:to"
                   "xesam:url"))
-               (`TrackerXesamSession
+               ('TrackerXesamSession
                 '("xesam:relevancyRating" "xesam:url"))
-               (`Debbugs
+               ('Debbugs
                 '("xesam:keyword" "xesam:owner" "xesam:title"
                   "xesam:url" "xesam:sourceModified" "xesam:mimeType"
                   "debbugs:key"))
@@ -622,8 +622,7 @@ Return propertized STRING."
        (or (widget-get widget :tag) "")
        (format-time-string
         "%d %B %Y, %T"
-        (seconds-to-time
-         (string-to-number (widget-get widget :xesam:sourceModified)))))))
+        (string-to-number (widget-get widget :xesam:sourceModified))))))
 
     ;; Second line: :value.
     (widget-put widget :value (widget-get widget :xesam:url))
diff --git a/lisp/obsolete/yow.el b/lisp/obsolete/yow.el
index 70d2c5d..5cbb2ef 100644
--- a/lisp/obsolete/yow.el
+++ b/lisp/obsolete/yow.el
@@ -1,6 +1,6 @@
 ;;; yow.el --- quote random zippyisms
 
-;; Copyright (C) 1993-1995, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 2000-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Richard Mlynarik
diff --git a/lisp/org/ChangeLog.1 b/lisp/org/ChangeLog.1
index ee1c6f6..2bb1586 100644
--- a/lisp/org/ChangeLog.1
+++ b/lisp/org/ChangeLog.1
@@ -32833,7 +32833,7 @@
 ;; add-log-time-zone-rule: t
 ;; End:
 
-       Copyright (C) 2008-2018 Free Software Foundation, Inc.
+       Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lisp/org/ob-C.el b/lisp/org/ob-C.el
index ff5be34..36d7998 100644
--- a/lisp/org/ob-C.el
+++ b/lisp/org/ob-C.el
@@ -1,6 +1,6 @@
 ;;; ob-C.el --- Babel Functions for C and Similar Languages -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;;      Thierry Banel
diff --git a/lisp/org/ob-J.el b/lisp/org/ob-J.el
index 8781221..b9125df 100644
--- a/lisp/org/ob-J.el
+++ b/lisp/org/ob-J.el
@@ -1,6 +1,6 @@
 ;;; ob-J.el --- Babel Functions for J                -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Oleh Krehel
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-R.el b/lisp/org/ob-R.el
index d7e936e..9e738a8 100644
--- a/lisp/org/ob-R.el
+++ b/lisp/org/ob-R.el
@@ -1,6 +1,6 @@
 ;;; ob-R.el --- Babel Functions for R                -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;;     Dan Davison
diff --git a/lisp/org/ob-abc.el b/lisp/org/ob-abc.el
index 75881cc..43ee1d9 100644
--- a/lisp/org/ob-abc.el
+++ b/lisp/org/ob-abc.el
@@ -1,6 +1,6 @@
 ;;; ob-abc.el --- Org Babel Functions for ABC -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: William Waites
 ;; Keywords: literate programming, music
@@ -47,7 +47,7 @@
             (value (cdr pair)))
         (setq body
               (replace-regexp-in-string
-               (concat "\$" (regexp-quote name))
+               (concat "\\$" (regexp-quote name))
                (if (stringp value) value (format "%S" value))
                body))))
      vars)
@@ -59,7 +59,7 @@
   (message "executing Abc source code block")
   (let* ((cmdline (cdr (assq :cmdline params)))
         (out-file (let ((file (cdr (assq :file params))))
-                    (if file (replace-regexp-in-string "\.pdf$" ".ps" file)
+                    (if file (replace-regexp-in-string "\\.pdf$" ".ps" file)
                       (error "abc code block requires :file header 
argument"))))
         (in-file (org-babel-temp-file "abc-"))
         (render (concat "abcm2ps" " " cmdline
diff --git a/lisp/org/ob-asymptote.el b/lisp/org/ob-asymptote.el
index 84e2364..667d3e1 100644
--- a/lisp/org/ob-asymptote.el
+++ b/lisp/org/ob-asymptote.el
@@ -1,6 +1,6 @@
 ;;; ob-asymptote.el --- Babel Functions for Asymptote -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-awk.el b/lisp/org/ob-awk.el
index 1ee4552..4c0dbbc 100644
--- a/lisp/org/ob-awk.el
+++ b/lisp/org/ob-awk.el
@@ -1,6 +1,6 @@
 ;;; ob-awk.el --- Babel Functions for Awk            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-calc.el b/lisp/org/ob-calc.el
index 387cba2..6ee93cd 100644
--- a/lisp/org/ob-calc.el
+++ b/lisp/org/ob-calc.el
@@ -1,6 +1,6 @@
 ;;; ob-calc.el --- Babel Functions for Calc          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-clojure.el b/lisp/org/ob-clojure.el
index 890f60a..14c014a 100644
--- a/lisp/org/ob-clojure.el
+++ b/lisp/org/ob-clojure.el
@@ -1,6 +1,6 @@
 ;;; ob-clojure.el --- Babel Functions for Clojure    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Joel Boehland, Eric Schulte, Oleh Krehel, Frederick Giasson
 ;;
diff --git a/lisp/org/ob-comint.el b/lisp/org/ob-comint.el
index e9c6f93..e27c1f8 100644
--- a/lisp/org/ob-comint.el
+++ b/lisp/org/ob-comint.el
@@ -1,6 +1,6 @@
 ;;; ob-comint.el --- Babel Functions for Interaction with Comint Buffers -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research, comint
diff --git a/lisp/org/ob-coq.el b/lisp/org/ob-coq.el
index 875c794..26682c1 100644
--- a/lisp/org/ob-coq.el
+++ b/lisp/org/ob-coq.el
@@ -1,6 +1,6 @@
 ;;; ob-coq.el --- Babel Functions for Coq            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el
index a5449fe..b6c54a9 100644
--- a/lisp/org/ob-core.el
+++ b/lisp/org/ob-core.el
@@ -1,6 +1,6 @@
 ;;; ob-core.el --- Working with Code Blocks          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;;     Dan Davison
@@ -2955,7 +2955,7 @@ If the table is trivial, then return it as a scalar."
 (defun org-babel-string-read (cell)
   "Strip nested \"s from around strings."
   (org-babel-read (or (and (stringp cell)
-                           (string-match "\\\"\\(.+\\)\\\"" cell)
+                           (string-match "\"\\(.+\\)\"" cell)
                            (match-string 1 cell))
                       cell) t))
 
diff --git a/lisp/org/ob-css.el b/lisp/org/ob-css.el
index 8cabf2b..ce663b2 100644
--- a/lisp/org/ob-css.el
+++ b/lisp/org/ob-css.el
@@ -1,6 +1,6 @@
 ;;; ob-css.el --- Babel Functions for CSS            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-ditaa.el b/lisp/org/ob-ditaa.el
index 9507630..c8a5e01 100644
--- a/lisp/org/ob-ditaa.el
+++ b/lisp/org/ob-ditaa.el
@@ -1,6 +1,6 @@
 ;;; ob-ditaa.el --- Babel Functions for ditaa        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-dot.el b/lisp/org/ob-dot.el
index 31e0a4f..35bc893 100644
--- a/lisp/org/ob-dot.el
+++ b/lisp/org/ob-dot.el
@@ -1,6 +1,6 @@
 ;;; ob-dot.el --- Babel Functions for dot            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-ebnf.el b/lisp/org/ob-ebnf.el
index 8c7c541..5ed9319 100644
--- a/lisp/org/ob-ebnf.el
+++ b/lisp/org/ob-ebnf.el
@@ -1,6 +1,6 @@
 ;;; ob-ebnf.el --- Babel Functions for EBNF          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Gauland
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-emacs-lisp.el b/lisp/org/ob-emacs-lisp.el
index 8ea2ec1..c9f6c49 100644
--- a/lisp/org/ob-emacs-lisp.el
+++ b/lisp/org/ob-emacs-lisp.el
@@ -1,6 +1,6 @@
 ;;; ob-emacs-lisp.el --- Babel Functions for Emacs-lisp Code -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-eval.el b/lisp/org/ob-eval.el
index f8cb285..8d5b7ed 100644
--- a/lisp/org/ob-eval.el
+++ b/lisp/org/ob-eval.el
@@ -1,6 +1,6 @@
 ;;; ob-eval.el --- Babel Functions for External Code Evaluation -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research, comint
diff --git a/lisp/org/ob-exp.el b/lisp/org/ob-exp.el
index 264dc0e..bf57964 100644
--- a/lisp/org/ob-exp.el
+++ b/lisp/org/ob-exp.el
@@ -1,6 +1,6 @@
 ;;; ob-exp.el --- Exportation of Babel Source Blocks -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;;     Dan Davison
diff --git a/lisp/org/ob-forth.el b/lisp/org/ob-forth.el
index efd5759..88ed964 100644
--- a/lisp/org/ob-forth.el
+++ b/lisp/org/ob-forth.el
@@ -1,6 +1,6 @@
 ;;; ob-forth.el --- Babel Functions for Forth        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research, forth
@@ -53,7 +53,7 @@ This function is called by `org-babel-execute-src-block'"
 (defun org-babel-forth-session-execute (body params)
   (require 'forth-mode)
   (let ((proc (forth-proc))
-       (rx " \\(\n:\\|compiled\n\\\|ok\n\\)")
+       (rx " \\(\n:\\|compiled\n\\|ok\n\\)")
        (result-start))
     (with-current-buffer (process-buffer (forth-proc))
       (mapcar (lambda (line)
diff --git a/lisp/org/ob-fortran.el b/lisp/org/ob-fortran.el
index 49e960f..579fb31 100644
--- a/lisp/org/ob-fortran.el
+++ b/lisp/org/ob-fortran.el
@@ -1,6 +1,6 @@
 ;;; ob-fortran.el --- Babel Functions for Fortran    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Authors: Sergey Litvinov
 ;;       Eric Schulte
diff --git a/lisp/org/ob-gnuplot.el b/lisp/org/ob-gnuplot.el
index b2f4913..5ff6756 100644
--- a/lisp/org/ob-gnuplot.el
+++ b/lisp/org/ob-gnuplot.el
@@ -1,6 +1,6 @@
 ;;; ob-gnuplot.el --- Babel Functions for Gnuplot    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-groovy.el b/lisp/org/ob-groovy.el
index 565b097..fe3a072 100644
--- a/lisp/org/ob-groovy.el
+++ b/lisp/org/ob-groovy.el
@@ -1,6 +1,6 @@
 ;;; ob-groovy.el --- Babel Functions for Groovy      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Miro Bezjak
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-haskell.el b/lisp/org/ob-haskell.el
index e607ee0..3c0a102 100644
--- a/lisp/org/ob-haskell.el
+++ b/lisp/org/ob-haskell.el
@@ -1,6 +1,6 @@
 ;;; ob-haskell.el --- Babel Functions for Haskell    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-hledger.el b/lisp/org/ob-hledger.el
index 727fb1f..4fb1f69 100644
--- a/lisp/org/ob-hledger.el
+++ b/lisp/org/ob-hledger.el
@@ -1,6 +1,6 @@
 ;;  ob-hledger.el --- Babel Functions for hledger      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Michael
 ;; Keywords: literate programming, reproducible research, plain text accounting
diff --git a/lisp/org/ob-io.el b/lisp/org/ob-io.el
index 4f407cc..b0d5b51 100644
--- a/lisp/org/ob-io.el
+++ b/lisp/org/ob-io.el
@@ -1,6 +1,6 @@
 ;;; ob-io.el --- Babel Functions for Io              -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Andrzej Lichnerowicz
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-java.el b/lisp/org/ob-java.el
index d6301bf..b055f85 100644
--- a/lisp/org/ob-java.el
+++ b/lisp/org/ob-java.el
@@ -1,6 +1,6 @@
 ;;; ob-java.el --- Babel Functions for Java          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-js.el b/lisp/org/ob-js.el
index 38c8c39..233aa58 100644
--- a/lisp/org/ob-js.el
+++ b/lisp/org/ob-js.el
@@ -1,6 +1,6 @@
 ;;; ob-js.el --- Babel Functions for Javascript      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research, js
diff --git a/lisp/org/ob-keys.el b/lisp/org/ob-keys.el
index fc96df4..627648d 100644
--- a/lisp/org/ob-keys.el
+++ b/lisp/org/ob-keys.el
@@ -1,6 +1,6 @@
 ;;; ob-keys.el --- Key Bindings for Babel            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-latex.el b/lisp/org/ob-latex.el
index 6a963e5..219b11c 100644
--- a/lisp/org/ob-latex.el
+++ b/lisp/org/ob-latex.el
@@ -1,6 +1,6 @@
 ;;; ob-latex.el --- Babel Functions for LaTeX        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-ledger.el b/lisp/org/ob-ledger.el
index 2a13314..5659929 100644
--- a/lisp/org/ob-ledger.el
+++ b/lisp/org/ob-ledger.el
@@ -1,6 +1,6 @@
 ;;; ob-ledger.el --- Babel Functions for Ledger      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric S Fraga
 ;; Keywords: literate programming, reproducible research, accounting
diff --git a/lisp/org/ob-lilypond.el b/lisp/org/ob-lilypond.el
index 3d3cc07..25e5dbc 100644
--- a/lisp/org/ob-lilypond.el
+++ b/lisp/org/ob-lilypond.el
@@ -1,6 +1,6 @@
 ;;; ob-lilypond.el --- Babel Functions for Lilypond  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Martyn Jago
 ;; Keywords: babel language, literate programming
diff --git a/lisp/org/ob-lisp.el b/lisp/org/ob-lisp.el
index b846138..6fef0da 100644
--- a/lisp/org/ob-lisp.el
+++ b/lisp/org/ob-lisp.el
@@ -1,6 +1,6 @@
 ;;; ob-lisp.el --- Babel Functions for Common Lisp   -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Authors: Joel Boehland
 ;;      Eric Schulte
diff --git a/lisp/org/ob-lob.el b/lisp/org/ob-lob.el
index 6af6bf0..4197f2d 100644
--- a/lisp/org/ob-lob.el
+++ b/lisp/org/ob-lob.el
@@ -1,6 +1,6 @@
 ;;; ob-lob.el --- Functions Supporting the Library of Babel -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;;      Dan Davison
diff --git a/lisp/org/ob-lua.el b/lisp/org/ob-lua.el
index 6ae72c7..6f77941 100644
--- a/lisp/org/ob-lua.el
+++ b/lisp/org/ob-lua.el
@@ -1,6 +1,6 @@
 ;;; ob-lua.el --- Org Babel functions for Lua evaluation -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2014, 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2016-2019 Free Software Foundation, Inc.
 
 ;; Authors: Dieter Schoen
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-makefile.el b/lisp/org/ob-makefile.el
index 4687037..938d17b 100644
--- a/lisp/org/ob-makefile.el
+++ b/lisp/org/ob-makefile.el
@@ -1,6 +1,6 @@
 ;;; ob-makefile.el --- Babel Functions for Makefile  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;;        Thomas S. Dye
diff --git a/lisp/org/ob-matlab.el b/lisp/org/ob-matlab.el
index 5baac77..4ad188a 100644
--- a/lisp/org/ob-matlab.el
+++ b/lisp/org/ob-matlab.el
@@ -1,6 +1,6 @@
 ;;; ob-matlab.el --- Babel support for Matlab        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Dan Davison
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-maxima.el b/lisp/org/ob-maxima.el
index b42a4b8..c8f3a61 100644
--- a/lisp/org/ob-maxima.el
+++ b/lisp/org/ob-maxima.el
@@ -1,6 +1,6 @@
 ;;; ob-maxima.el --- Babel Functions for Maxima      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric S Fraga
 ;;     Eric Schulte
diff --git a/lisp/org/ob-mscgen.el b/lisp/org/ob-mscgen.el
index b2c2443..86fcc28 100644
--- a/lisp/org/ob-mscgen.el
+++ b/lisp/org/ob-mscgen.el
@@ -1,6 +1,6 @@
 ;;; ob-msc.el --- Babel Functions for Mscgen         -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Juan Pechiar
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-ocaml.el b/lisp/org/ob-ocaml.el
index 90926b5..e8f801b 100644
--- a/lisp/org/ob-ocaml.el
+++ b/lisp/org/ob-ocaml.el
@@ -1,6 +1,6 @@
 ;;; ob-ocaml.el --- Babel Functions for Ocaml        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-octave.el b/lisp/org/ob-octave.el
index c7339cf..28c7ad2 100644
--- a/lisp/org/ob-octave.el
+++ b/lisp/org/ob-octave.el
@@ -1,6 +1,6 @@
 ;;; ob-octave.el --- Babel Functions for Octave and Matlab -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Dan Davison
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-org.el b/lisp/org/ob-org.el
index 7a495fa..def2509 100644
--- a/lisp/org/ob-org.el
+++ b/lisp/org/ob-org.el
@@ -1,6 +1,6 @@
 ;;; ob-org.el --- Babel Functions for Org Code Blocks -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-perl.el b/lisp/org/ob-perl.el
index 85806fd..810271f 100644
--- a/lisp/org/ob-perl.el
+++ b/lisp/org/ob-perl.el
@@ -1,6 +1,6 @@
 ;;; ob-perl.el --- Babel Functions for Perl          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Authors: Dan Davison
 ;;      Eric Schulte
diff --git a/lisp/org/ob-picolisp.el b/lisp/org/ob-picolisp.el
index cc2c8a8..c0f0125 100644
--- a/lisp/org/ob-picolisp.el
+++ b/lisp/org/ob-picolisp.el
@@ -1,6 +1,6 @@
 ;;; ob-picolisp.el --- Babel Functions for Picolisp  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Authors: Thorsten Jolitz
 ;;      Eric Schulte
diff --git a/lisp/org/ob-plantuml.el b/lisp/org/ob-plantuml.el
index 9a9313e..91229a2 100644
--- a/lisp/org/ob-plantuml.el
+++ b/lisp/org/ob-plantuml.el
@@ -1,6 +1,6 @@
 ;;; ob-plantuml.el --- Babel Functions for Plantuml  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Zhang Weize
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-processing.el b/lisp/org/ob-processing.el
index 1a88930..97ab88c 100644
--- a/lisp/org/ob-processing.el
+++ b/lisp/org/ob-processing.el
@@ -1,6 +1,6 @@
 ;;; ob-processing.el --- Babel functions for processing -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Jarmo Hurri (adapted from ob-asymptote.el written by Eric Schulte)
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-python.el b/lisp/org/ob-python.el
index 9f1234b..546e35a 100644
--- a/lisp/org/ob-python.el
+++ b/lisp/org/ob-python.el
@@ -1,6 +1,6 @@
 ;;; ob-python.el --- Babel Functions for Python      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;;      Dan Davison
diff --git a/lisp/org/ob-ref.el b/lisp/org/ob-ref.el
index 3efa17f..2198a84 100644
--- a/lisp/org/ob-ref.el
+++ b/lisp/org/ob-ref.el
@@ -1,6 +1,6 @@
 ;;; ob-ref.el --- Babel Functions for Referencing External Data -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;;      Dan Davison
diff --git a/lisp/org/ob-ruby.el b/lisp/org/ob-ruby.el
index 7686ac4..e0e1765 100644
--- a/lisp/org/ob-ruby.el
+++ b/lisp/org/ob-ruby.el
@@ -1,6 +1,6 @@
 ;;; ob-ruby.el --- Babel Functions for Ruby          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-sass.el b/lisp/org/ob-sass.el
index af55d76..b19314c 100644
--- a/lisp/org/ob-sass.el
+++ b/lisp/org/ob-sass.el
@@ -1,6 +1,6 @@
 ;;; ob-sass.el --- Babel Functions for the Sass CSS generation language -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-scheme.el b/lisp/org/ob-scheme.el
index 0efe5f3..798cf4e 100644
--- a/lisp/org/ob-scheme.el
+++ b/lisp/org/ob-scheme.el
@@ -1,6 +1,6 @@
 ;;; ob-scheme.el --- Babel Functions for Scheme      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;;         Michael Gauland
diff --git a/lisp/org/ob-screen.el b/lisp/org/ob-screen.el
index fb7c8e2..a3d7984 100644
--- a/lisp/org/ob-screen.el
+++ b/lisp/org/ob-screen.el
@@ -1,6 +1,6 @@
 ;;; ob-screen.el --- Babel Support for Interactive Terminal -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Benjamin Andresen
 ;; Keywords: literate programming, interactive shell
diff --git a/lisp/org/ob-sed.el b/lisp/org/ob-sed.el
index b2c80f8..33751b8 100644
--- a/lisp/org/ob-sed.el
+++ b/lisp/org/ob-sed.el
@@ -1,6 +1,6 @@
 ;;; ob-sed.el --- Babel Functions for Sed Scripts    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Bjarte Johansen
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-shell.el b/lisp/org/ob-shell.el
index 362dfd5..8e080c6 100644
--- a/lisp/org/ob-shell.el
+++ b/lisp/org/ob-shell.el
@@ -1,6 +1,6 @@
 ;;; ob-shell.el --- Babel Functions for Shell Evaluation -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-shen.el b/lisp/org/ob-shen.el
index d81e7d6..af3bd2b 100644
--- a/lisp/org/ob-shen.el
+++ b/lisp/org/ob-shen.el
@@ -1,6 +1,6 @@
 ;;; ob-shen.el --- Babel Functions for Shen          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research, shen
diff --git a/lisp/org/ob-sql.el b/lisp/org/ob-sql.el
index 959ede3..17447b4 100644
--- a/lisp/org/ob-sql.el
+++ b/lisp/org/ob-sql.el
@@ -1,6 +1,6 @@
 ;;; ob-sql.el --- Babel Functions for SQL            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-sqlite.el b/lisp/org/ob-sqlite.el
index 42528a3..04bf4fe 100644
--- a/lisp/org/ob-sqlite.el
+++ b/lisp/org/ob-sqlite.el
@@ -1,6 +1,6 @@
 ;;; ob-sqlite.el --- Babel Functions for SQLite Databases -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-stan.el b/lisp/org/ob-stan.el
index ffc2681..47b871d 100644
--- a/lisp/org/ob-stan.el
+++ b/lisp/org/ob-stan.el
@@ -1,6 +1,6 @@
 ;;; ob-stan.el --- Babel Functions for Stan          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Kyle Meyer
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-table.el b/lisp/org/ob-table.el
index f6a5c88..93a8165 100644
--- a/lisp/org/ob-table.el
+++ b/lisp/org/ob-table.el
@@ -1,6 +1,6 @@
 ;;; ob-table.el --- Support for Calling Babel Functions from Tables -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-tangle.el b/lisp/org/ob-tangle.el
index 48eddb7..3c16200 100644
--- a/lisp/org/ob-tangle.el
+++ b/lisp/org/ob-tangle.el
@@ -1,6 +1,6 @@
 ;;; ob-tangle.el --- Extract Source Code From Org Files -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob-vala.el b/lisp/org/ob-vala.el
index 96c37e3..5d14002 100644
--- a/lisp/org/ob-vala.el
+++ b/lisp/org/ob-vala.el
@@ -1,6 +1,6 @@
 ;;; ob-vala.el --- Babel functions for Vala evaluation -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Christian Garbs <address@hidden>
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/ob.el b/lisp/org/ob.el
index 35f65ff..86d6928 100644
--- a/lisp/org/ob.el
+++ b/lisp/org/ob.el
@@ -1,6 +1,6 @@
 ;;; ob.el --- Working with Code Blocks in Org        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Authors: Eric Schulte
 ;; Keywords: literate programming, reproducible research
diff --git a/lisp/org/org-agenda.el b/lisp/org/org-agenda.el
index 98e89eb..23ee8d7 100644
--- a/lisp/org/org-agenda.el
+++ b/lisp/org/org-agenda.el
@@ -1,6 +1,6 @@
 ;;; org-agenda.el --- Dynamic task and appointment lists for Org
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -2882,13 +2882,12 @@ Pressing `<' twice means to restrict to the current 
subtree or region
             (let* ((m (org-agenda-get-any-marker))
                    (note (and m (org-entry-get m "THEFLAGGINGNOTE"))))
               (when note
-                (message (concat
-                          "FLAGGING-NOTE ([?] for more info): "
-                          (org-add-props
-                              (replace-regexp-in-string
-                               "\\\\n" "//"
-                               (copy-sequence note))
-                              nil 'face 'org-warning)))))))
+                (message "FLAGGING-NOTE ([?] for more info): %s"
+                         (org-add-props
+                          (replace-regexp-in-string
+                           "\\\\n" "//"
+                           (copy-sequence note))
+                          nil 'face 'org-warning))))))
         t t))
        ((equal org-keys "#") (call-interactively 
'org-agenda-list-stuck-projects))
        ((equal org-keys "/") (call-interactively 'org-occur-in-agenda-files))
@@ -5491,8 +5490,8 @@ displayed in agenda view."
            (substring
             (format-time-string
              (car org-time-stamp-formats)
-             (apply #'encode-time      ; DATE bound by calendar
-                    (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
+             (encode-time      ; DATE bound by calendar
+              0 0 0 (nth 1 date) (car date) (nth 2 date)))
             1 11))
           "\\|\\(<[0-9]+-[0-9]+-[0-9]+[^>\n]+?\\+[0-9]+[hdwmy]>\\)"
           "\\|\\(<%%\\(([^>\n]+)\\)>\\)"))
@@ -5742,8 +5741,8 @@ then those holidays will be skipped."
                   (substring
                    (format-time-string
                     (car org-time-stamp-formats)
-                    (apply 'encode-time  ; DATE bound by calendar
-                           (list 0 0 0 (nth 1 date) (car date) (nth 2 date))))
+                    (encode-time  ; DATE bound by calendar
+                     0 0 0 (nth 1 date) (car date) (nth 2 date)))
                    1 11))))
         (org-agenda-search-headline-for-time nil)
         marker hdmarker priority category level tags closedp
@@ -5860,21 +5859,19 @@ See also the user option 
`org-agenda-clock-consistency-checks'."
              (throw 'next t))
            (setq ts (match-string 1)
                  te (match-string 3)
-                 ts (float-time
-                     (apply #'encode-time (org-parse-time-string ts)))
-                 te (float-time
-                     (apply #'encode-time (org-parse-time-string te)))
+                 ts (float-time (org-time-string-to-time ts))
+                 te (float-time (org-time-string-to-time te))
                  dt (- te ts))))
        (cond
         ((> dt (* 60 maxtime))
          ;; a very long clocking chunk
          (setq issue (format "Clocking interval is very long: %s"
-                             (org-duration-from-minutes (floor (/ dt 60.))))
+                             (org-duration-from-minutes (floor dt 60)))
                face (or (plist-get pl :long-face) face)))
         ((< dt (* 60 mintime))
          ;; a very short clocking chunk
          (setq issue (format "Clocking interval is very short: %s"
-                             (org-duration-from-minutes (floor (/ dt 60.))))
+                             (org-duration-from-minutes (floor dt 60)))
                face (or (plist-get pl :short-face) face)))
         ((and (> tlend 0) (< ts tlend))
          ;; Two clock entries are overlapping
@@ -5914,8 +5911,8 @@ See also the user option 
`org-agenda-clock-consistency-checks'."
        (throw 'exit t))
     ;; We have a shorter gap.
     ;; Now we have to get the minute of the day when these times are
-    (let* ((t1dec (decode-time (seconds-to-time t1)))
-          (t2dec (decode-time (seconds-to-time t2)))
+    (let* ((t1dec (decode-time t1))
+          (t2dec (decode-time t2))
           ;; compute the minute on the day
           (min1 (+ (nth 1 t1dec) (* 60 (nth 2 t1dec))))
           (min2 (+ (nth 1 t2dec) (* 60 (nth 2 t2dec)))))
@@ -9448,7 +9445,7 @@ the resulting entry will not be shown.  When TEXT is 
empty, switch to
     (goto-char (point-min))
     (cond
      ((eq type 'anniversary)
-      (or (re-search-forward "^*[ \t]+Anniversaries" nil t)
+      (or (re-search-forward "^\\*[ \t]+Anniversaries" nil t)
          (progn
            (or (org-at-heading-p t)
                (progn
@@ -10159,8 +10156,7 @@ to override `appt-message-warning-time'."
          ;; Do not use `org-today' here because appt only takes
          ;; time and without date as argument, so it may pass wrong
          ;; information otherwise
-         (today (org-date-to-gregorian
-                 (time-to-days (current-time))))
+        (today (org-date-to-gregorian (time-to-days nil)))
          (org-agenda-restrict nil)
          (files (org-agenda-files 'unrestricted)) entries file
          (org-agenda-buffer nil))
diff --git a/lisp/org/org-archive.el b/lisp/org/org-archive.el
index e020ec2..dc0dfa4 100644
--- a/lisp/org/org-archive.el
+++ b/lisp/org/org-archive.el
@@ -1,6 +1,6 @@
 ;;; org-archive.el --- Archiving for Org             -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-attach.el b/lisp/org/org-attach.el
index 203e71e..f430cd5 100644
--- a/lisp/org/org-attach.el
+++ b/lisp/org/org-attach.el
@@ -1,6 +1,6 @@
 ;;; org-attach.el --- Manage file attachments to Org tasks -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 ;; Keywords: org data task
diff --git a/lisp/org/org-bbdb.el b/lisp/org/org-bbdb.el
index 5d36379..2c4f126 100644
--- a/lisp/org/org-bbdb.el
+++ b/lisp/org/org-bbdb.el
@@ -1,6 +1,6 @@
 ;;; org-bbdb.el --- Support for links to BBDB entries -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Authors: Carsten Dominik <carsten at orgmode dot org>
 ;;       Thomas Baumann <thomas dot baumann at ch dot tum dot de>
diff --git a/lisp/org/org-bibtex.el b/lisp/org/org-bibtex.el
index 9dab0b4..218112c 100644
--- a/lisp/org/org-bibtex.el
+++ b/lisp/org/org-bibtex.el
@@ -1,6 +1,6 @@
 ;;; org-bibtex.el --- Org links to BibTeX entries    -*- lexical-binding: t; 
-*-
 ;;
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 ;;
 ;; Authors: Bastien Guerry <address@hidden>
 ;;       Carsten Dominik <carsten dot dominik at gmail dot com>
diff --git a/lisp/org/org-capture.el b/lisp/org/org-capture.el
index 3de386c..dbba33b 100644
--- a/lisp/org/org-capture.el
+++ b/lisp/org/org-capture.el
@@ -1,6 +1,6 @@
 ;;; org-capture.el --- Fast note taking in Org       -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -1000,8 +1000,7 @@ Store them in the capture property list."
                   (equal current-prefix-arg 1))
               ;; Prompt for date.
               (let ((prompt-time (org-read-date
-                                  nil t nil "Date for tree entry:"
-                                  (current-time))))
+                                  nil t nil "Date for tree entry:" nil)))
                 (org-capture-put
                  :default-time
                  (cond ((and (or (not (boundp 'org-time-was-given))
@@ -1009,9 +1008,8 @@ Store them in the capture property list."
                              (not (= (time-to-days prompt-time) (org-today))))
                         ;; Use 00:00 when no time is given for another
                         ;; date than today?
-                        (apply #'encode-time
-                               (append '(0 0 0)
-                                       (cl-cdddr (decode-time prompt-time)))))
+                        (apply #'encode-time 0 0 0
+                               (cl-cdddr (decode-time prompt-time))))
                        ((string-match "\\([^ ]+\\)--?[^ ]+[ ]+\\(.*\\)"
                                       org-read-date-final-answer)
                         ;; Replace any time range by its start.
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 9be0d5b..62c7cd9 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -1,6 +1,6 @@
 ;;; org-clock.el --- The time clocking code for Org mode -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -723,8 +723,8 @@ menu\nmouse-2 will jump to task"))
 The time returned includes the time spent on this task in
 previous clocking intervals."
   (let ((currently-clocked-time
-        (floor (- (float-time)
-                  (float-time org-clock-start-time)) 60)))
+        (floor (encode-time (time-since org-clock-start-time) 'integer)
+               60)))
     (+ currently-clocked-time (or org-clock-total-time 0))))
 
 (defun org-clock-modify-effort-estimate (&optional value)
@@ -932,7 +932,7 @@ If necessary, clock-out of the currently active clock."
        (unless (org-is-active-clock clock)
          (org-clock-clock-in clock t))))
 
-     ((not (time-less-p resolve-to (current-time)))
+     ((not (time-less-p resolve-to nil))
       (error "RESOLVE-TO must refer to a time in the past"))
 
      (t
@@ -1033,8 +1033,8 @@ to be CLOCKED OUT."))))
                                   nil 45)))
                (and (not (memq char-pressed '(?i ?q))) char-pressed)))))
         (default
-          (floor (/ (float-time
-                     (time-subtract (current-time) last-valid)) 60)))
+          (floor (encode-time (time-since last-valid) 'integer)
+                 60))
         (keep
          (and (memq ch '(?k ?K))
               (read-number "Keep how many minutes? " default)))
@@ -1042,8 +1042,9 @@ to be CLOCKED OUT."))))
          (and (memq ch '(?g ?G))
               (read-number "Got back how many minutes ago? " default)))
         (subtractp (memq ch '(?s ?S)))
-        (barely-started-p (< (- (float-time last-valid)
-                                (float-time (cdr clock))) 45))
+        (barely-started-p (time-less-p
+                           (time-subtract last-valid (cdr clock))
+                           45))
         (start-over (and subtractp barely-started-p)))
     (cond
      ((memq ch '(?j ?J))
@@ -1069,10 +1070,9 @@ to be CLOCKED OUT."))))
                   (and gotback (= gotback default)))
               'now)
              (keep
-              (time-add last-valid (seconds-to-time (* 60 keep))))
+              (time-add last-valid (* 60 keep)))
              (gotback
-              (time-subtract (current-time)
-                             (seconds-to-time (* 60 gotback))))
+              (time-since (* 60 gotback)))
              (t
               (error "Unexpected, please report this as a bug")))
        (and gotback last-valid)
@@ -1102,8 +1102,8 @@ If `only-dangling-p' is non-nil, only ask to resolve 
dangling
                        (lambda (clock)
                          (format
                           "Dangling clock started %d mins ago"
-                          (floor (- (float-time)
-                                    (float-time (cdr clock)))
+                          (floor (encode-time (time-since (cdr clock))
+                                              'integer)
                                  60)))))
                   (or last-valid
                       (cdr clock)))))))))))
@@ -1154,8 +1154,7 @@ so long."
             org-clock-marker (marker-buffer org-clock-marker))
     (let* ((org-clock-user-idle-seconds (org-user-idle-seconds))
           (org-clock-user-idle-start
-           (time-subtract (current-time)
-                          (seconds-to-time org-clock-user-idle-seconds)))
+           (time-since org-clock-user-idle-seconds))
           (org-clock-resolving-clocks-due-to-idleness t))
       (if (> org-clock-user-idle-seconds (* 60 org-clock-idle-time))
          (org-clock-resolve
@@ -1164,9 +1163,8 @@ so long."
           (lambda (_)
             (format "Clocked in & idle for %.1f mins"
                     (/ (float-time
-                        (time-subtract (current-time)
-                                       org-clock-user-idle-start))
-                       60.0)))
+                        (time-since org-clock-user-idle-start))
+                       60)))
           org-clock-user-idle-start)))))
 
 (defvar org-clock-current-task nil "Task currently clocked in.")
@@ -1293,8 +1291,7 @@ the default behavior."
           (setq ts (concat "[" (match-string 1) "]"))
           (goto-char (match-end 1))
           (setq org-clock-start-time
-                (apply 'encode-time
-                       (org-parse-time-string (match-string 1))))
+                (org-time-string-to-time (match-string 1)))
           (setq org-clock-effort (org-entry-get (point) org-effort-property))
           (setq org-clock-total-time (org-clock-sum-current-item
                                       (org-clock-get-sum-start))))
@@ -1324,9 +1321,11 @@ the default behavior."
                          (y-or-n-p
                           (format
                            "You stopped another clock %d mins ago; start this 
one from then? "
-                           (/ (- (float-time
-                                  (org-current-time org-clock-rounding-minutes 
t))
-                                 (float-time leftover))
+                           (/ (encode-time
+                               (time-subtract
+                                (org-current-time org-clock-rounding-minutes t)
+                                leftover)
+                               'integer)
                               60)))
                          leftover)
                     start-time
@@ -1431,7 +1430,7 @@ The time is always returned as UTC."
             (day (nth 3 dt)))
        (if (< hour org-extend-today-until) (setf (nth 3 dt) (1- day)))
        (setf (nth 2 dt) org-extend-today-until)
-       (apply #'encode-time (append (list 0 0) (nthcdr 2 dt)))))
+       (apply #'encode-time 0 0 (nthcdr 2 dt))))
      ((or (equal cmt "all")
          (and (or (not cmt) (equal cmt "auto"))
               (not lr)))
@@ -1577,21 +1576,19 @@ to, overriding the existing value of 
`org-clock-out-switch-to-state'."
          (delete-region (point) (point-at-eol))
          (insert "--")
          (setq te (org-insert-time-stamp (or at-time now) 'with-hm 'inactive))
-         (setq s (- (float-time
-                     (apply #'encode-time (org-parse-time-string te)))
-                    (float-time
-                     (apply #'encode-time (org-parse-time-string ts))))
-               h (floor (/ s 3600))
-               s (- s (* 3600 h))
-               m (floor (/ s 60))
-               s (- s (* 60 s)))
+         (setq s (encode-time (time-subtract
+                               (org-time-string-to-time te)
+                               (org-time-string-to-time ts))
+                              'integer)
+               h (floor s 3600)
+               m (floor (mod s 3600) 60))
          (insert " => " (format "%2d:%02d" h m))
          (move-marker org-clock-marker nil)
          (move-marker org-clock-hd-marker nil)
          ;; Possibly remove zero time clocks.  However, do not add
          ;; a note associated to the CLOCK line in this case.
          (cond ((and org-clock-out-remove-zero-time-clocks
-                     (= (+ h m) 0))
+                     (= 0 h m))
                 (setq remove t)
                 (delete-region (line-beginning-position)
                                (line-beginning-position 2)))
@@ -1625,9 +1622,10 @@ to, overriding the existing value of 
`org-clock-out-switch-to-state'."
                                                "\\>"))))
                  (org-todo org-clock-out-switch-to-state))))))
          (force-mode-line-update)
-         (message (concat "Clock stopped at %s after "
-                          (org-duration-from-minutes (+ (* 60 h) m)) "%s")
-                  te (if remove " => LINE REMOVED" ""))
+         (message (if remove
+                      "Clock stopped at %s after %s => LINE REMOVED"
+                    "Clock stopped at %s after %s")
+                  te (org-duration-from-minutes (+ (* 60 h) m)))
          (run-hooks 'org-clock-out-hook)
          (unless (org-clocking-p)
            (setq org-clock-current-task nil)))))))
@@ -1813,15 +1811,15 @@ PROPNAME lets you set a custom text property instead of 
:org-clock-minutes."
          ((match-end 2)
           ;; Two time stamps.
           (let* ((ts (float-time
-                      (apply #'encode-time
-                             (save-match-data
-                               (org-parse-time-string (match-string 2))))))
+                      (encode-time
+                       (save-match-data
+                         (org-parse-time-string (match-string 2))))))
                  (te (float-time
-                      (apply #'encode-time
-                             (org-parse-time-string (match-string 3)))))
+                      (encode-time
+                       (org-parse-time-string (match-string 3)))))
                  (dt (- (if tend (min te tend) te)
                         (if tstart (max ts tstart) ts))))
-            (when (> dt 0) (cl-incf t1 (floor (/ dt 60))))))
+            (when (> dt 0) (cl-incf t1 (floor dt 60)))))
          ((match-end 4)
           ;; A naked time.
           (setq t1 (+ t1 (string-to-number (match-string 5))
@@ -1835,8 +1833,9 @@ PROPNAME lets you set a custom text property instead of 
:org-clock-minutes."
                      tend
                      (>= (float-time org-clock-start-time) tstart)
                      (<= (float-time org-clock-start-time) tend))
-            (let ((time (floor (- (float-time)
-                                  (float-time org-clock-start-time))
+            (let ((time (floor (encode-time
+                                (time-since org-clock-start-time)
+                                'integer)
                                60)))
               (setq t1 (+ t1 time))))
           (let* ((headline-forced
@@ -1927,13 +1926,14 @@ Use `\\[org-clock-remove-overlays]' to remove the 
subtree times."
                    nil 'local))))
     (let* ((h (/ org-clock-file-total-minutes 60))
           (m (- org-clock-file-total-minutes (* 60 h))))
-      (message (concat (format "Total file time%s: "
-                              (cond (todayp " for today")
-                                    (customp " (custom)")
-                                    (t "")))
-                      (org-duration-from-minutes
-                       org-clock-file-total-minutes)
-                      " (%d hours and %d minutes)")
+      (message (cond
+               (todayp
+                "Total file time for today: %s (%d hours and %d minutes)")
+               (customp
+                "Total file time (custom): %s (%d hours and %d minutes)")
+               (t
+                "Total file time: %s (%d hours and %d minutes)"))
+              (org-duration-from-minutes org-clock-file-total-minutes)
               h m))))
 
 (defvar-local org-clock-overlays nil)
@@ -2704,24 +2704,24 @@ LEVEL is an integer.  Indent by two spaces per level 
above 1."
       (pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute ts)))
        (setq ts (float-time (encode-time 0 0 0 day month year)))))
      (ts
-      (setq ts (float-time (apply #'encode-time (org-parse-time-string ts))))))
+      (setq ts (float-time (org-time-string-to-time ts)))))
     (cond
      ((numberp te)
       ;; Likewise for te.
       (pcase-let ((`(,month ,day ,year) (calendar-gregorian-from-absolute te)))
        (setq te (float-time (encode-time 0 0 0 day month year)))))
      (te
-      (setq te (float-time (apply #'encode-time (org-parse-time-string te))))))
+      (setq te (float-time (org-time-string-to-time te)))))
     (setq tsb
          (if (eq step0 'week)
-             (let ((dow (nth 6 (decode-time (seconds-to-time ts)))))
+             (let ((dow (nth 6 (decode-time ts))))
                (if (<= dow ws) ts
                  (- ts (* 86400 (- dow ws)))))
            ts))
     (while (< tsb te)
       (unless (bolp) (insert "\n"))
-      (let ((start-time (seconds-to-time (max tsb ts))))
-       (cl-incf tsb (let ((dow (nth 6 (decode-time (seconds-to-time tsb)))))
+      (let ((start-time (max tsb ts)))
+       (cl-incf tsb (let ((dow (nth 6 (decode-time tsb))))
                       (if (or (eq step0 'day)
                               (= dow ws))
                           step
@@ -2741,7 +2741,7 @@ LEVEL is an integer.  Indent by two spaces per level 
above 1."
                  :tstart (format-time-string (org-time-stamp-format t t)
                                              start-time)
                  :tend (format-time-string (org-time-stamp-format t t)
-                                           (seconds-to-time (min te tsb))))))))
+                                           (min te tsb)))))))
          (re-search-forward "^[ \t]*#\\+END:")
          (when (and stepskip0 (equal step-time 0))
            ;; Remove the empty table
@@ -2882,18 +2882,16 @@ Otherwise, return nil."
                     (<= org-clock-marker (point-at-eol)))
            ;; The clock is running here
            (setq org-clock-start-time
-                 (apply 'encode-time
-                        (org-parse-time-string (match-string 1))))
+                 (org-time-string-to-time (match-string 1)))
            (org-clock-update-mode-line)))
         (t
          (and (match-end 4) (delete-region (match-beginning 4) (match-end 4)))
          (end-of-line 1)
          (setq ts (match-string 1)
                te (match-string 3))
-         (setq s (- (float-time
-                     (apply #'encode-time (org-parse-time-string te)))
-                    (float-time
-                     (apply #'encode-time (org-parse-time-string ts))))
+         (setq s (float-time
+                  (time-subtract (org-time-string-to-time te)
+                                 (org-time-string-to-time ts)))
                neg (< s 0)
                s (abs s)
                h (floor (/ s 3600))
diff --git a/lisp/org/org-colview.el b/lisp/org/org-colview.el
index cb5c091..799cc60 100644
--- a/lisp/org/org-colview.el
+++ b/lisp/org/org-colview.el
@@ -1,6 +1,6 @@
 ;;; org-colview.el --- Column View in Org            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -540,7 +540,7 @@ Where possible, use the standard interface for changing 
this line."
         (eol (line-end-position))
         (pom (or (get-text-property bol 'org-hd-marker) (point)))
         (key (or key (get-char-property (point) 'org-columns-key)))
-        (org-columns--time (float-time (current-time)))
+        (org-columns--time (float-time))
         (action
          (pcase key
            ("CLOCKSUM"
@@ -719,7 +719,7 @@ around it."
       (setq time-after (copy-sequence time))
       (setf (nth 3 time-before) (1- (nth 3 time)))
       (setf (nth 3 time-after) (1+ (nth 3 time)))
-      (mapcar (lambda (x) (format-time-string fmt (apply 'encode-time x)))
+      (mapcar (lambda (x) (format-time-string fmt (encode-time x)))
              (list time-before time time-after)))))
 
 (defun org-columns-open-link (&optional arg)
@@ -790,7 +790,7 @@ When COLUMNS-FMT-STRING is non-nil, use it as the column 
format."
   (org-columns-goto-top-level)
   ;; Initialize `org-columns-current-fmt' and
   ;; `org-columns-current-fmt-compiled'.
-  (let ((org-columns--time (float-time (current-time))))
+  (let ((org-columns--time (float-time)))
     (org-columns-get-format columns-fmt-string)
     (unless org-columns-inhibit-recalculation (org-columns-compute-all))
     (save-excursion
@@ -1070,7 +1070,7 @@ as a canonical duration, i.e., using units defined in
   (cond
    ((string-match-p org-ts-regexp s)
     (/ (- org-columns--time
-         (float-time (apply #'encode-time (org-parse-time-string s))))
+         (float-time (org-time-string-to-time s)))
        60))
    ((org-duration-p s) (org-duration-to-minutes s t)) ;skip user units
    (t (user-error "Invalid age: %S" s))))
@@ -1494,7 +1494,7 @@ PARAMS is a property list of parameters:
   (if (markerp org-columns-begin-marker)
       (move-marker org-columns-begin-marker (point))
     (setq org-columns-begin-marker (point-marker)))
-  (let* ((org-columns--time (float-time (current-time)))
+  (let* ((org-columns--time (float-time))
         (fmt
          (cond
           ((bound-and-true-p org-agenda-overriding-columns-format))
diff --git a/lisp/org/org-compat.el b/lisp/org/org-compat.el
index 1fd408d..062bb4c 100644
--- a/lisp/org/org-compat.el
+++ b/lisp/org/org-compat.el
@@ -1,6 +1,6 @@
 ;;; org-compat.el --- Compatibility Code for Older Emacsen -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-crypt.el b/lisp/org/org-crypt.el
index 31850a4..9cd76c9 100644
--- a/lisp/org/org-crypt.el
+++ b/lisp/org/org-crypt.el
@@ -1,5 +1,5 @@
 ;;; org-crypt.el --- Public Key Encryption for Org Entries -*- 
lexical-binding: t; -*-
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Emacs Lisp Archive Entry
 ;; Filename: org-crypt.el
diff --git a/lisp/org/org-ctags.el b/lisp/org/org-ctags.el
index 4898174..111be37 100644
--- a/lisp/org/org-ctags.el
+++ b/lisp/org/org-ctags.el
@@ -1,6 +1,6 @@
 ;;; org-ctags.el - Integrate Emacs "tags" Facility with Org -*- 
lexical-binding: t; -*-
 ;;
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Paul Sexton <address@hidden>
 
diff --git a/lisp/org/org-datetree.el b/lisp/org/org-datetree.el
index d00bad2..b4797de 100644
--- a/lisp/org/org-datetree.el
+++ b/lisp/org/org-datetree.el
@@ -1,6 +1,6 @@
 ;;; org-datetree.el --- Create date entries in a tree -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -138,15 +138,16 @@ will be built under the headline at point."
        "^\\*+[ \t]+%d-%02d-\\([0123][0-9]\\) \\w+$"
        year month day))))
 
-(defun org-datetree--find-create (regex year &optional month day insert)
-  "Find the datetree matched by REGEX for YEAR, MONTH, or DAY.
-REGEX is passed to `format' with YEAR, MONTH, and DAY as
+(defun org-datetree--find-create
+    (regex-template year &optional month day insert)
+  "Find the datetree matched by REGEX-TEMPLATE for YEAR, MONTH, or DAY.
+REGEX-TEMPLATE is passed to `format' with YEAR, MONTH, and DAY as
 arguments.  Match group 1 is compared against the specified date
 component.  If INSERT is non-nil and there is no match then it is
 inserted into the buffer."
   (when (or month day)
     (org-narrow-to-subtree))
-  (let ((re (format regex year month day))
+  (let ((re (format regex-template year month day))
        match)
     (goto-char (point-min))
     (while (and (setq match (re-search-forward re nil t))
diff --git a/lisp/org/org-docview.el b/lisp/org/org-docview.el
index a467212..7e1287f 100644
--- a/lisp/org/org-docview.el
+++ b/lisp/org/org-docview.el
@@ -1,6 +1,6 @@
 ;;; org-docview.el --- Support for links to doc-view-mode buffers -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Jan Böcker <jan.boecker at jboecker dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-duration.el b/lisp/org/org-duration.el
index 1c962ba..770c72f 100644
--- a/lisp/org/org-duration.el
+++ b/lisp/org/org-duration.el
@@ -1,6 +1,6 @@
 ;;; org-duration.el --- Library handling durations   -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <address@hidden>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -317,11 +317,10 @@ When optional argument CANONICAL is non-nil, ignore
 Raise an error if expected format is unknown."
   (pcase (or fmt org-duration-format)
     (`h:mm
-     (let ((minutes (floor minutes)))
-       (format "%d:%02d" (/ minutes 60) (mod minutes 60))))
+     (format "%d:%02d" (/ minutes 60) (mod minutes 60)))
     (`h:mm:ss
      (let* ((whole-minutes (floor minutes))
-           (seconds (floor (* 60 (- minutes whole-minutes)))))
+           (seconds (mod (* 60 minutes) 60)))
        (format "%s:%02d"
               (org-duration-from-minutes whole-minutes 'h:mm)
               seconds)))
@@ -402,9 +401,7 @@ Raise an error if expected format is unknown."
              (pcase-let* ((`(,unit . ,required?) units)
                           (modifier (org-duration--modifier unit canonical)))
                (cond ((<= modifier minutes)
-                      (let ((value (if (integerp modifier)
-                                       (/ (floor minutes) modifier)
-                                     (floor (/ minutes modifier)))))
+                      (let ((value (floor minutes modifier)))
                         (cl-decf minutes (* value modifier))
                         (format " %d%s" value unit)))
                      (required? (concat " 0" unit))
diff --git a/lisp/org/org-element.el b/lisp/org/org-element.el
index b8f1467..04e2fda 100644
--- a/lisp/org/org-element.el
+++ b/lisp/org/org-element.el
@@ -1,6 +1,6 @@
 ;;; org-element.el --- Parser for Org Syntax         -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -2119,7 +2119,7 @@ containing `:key', `:value', `:begin', `:end', 
`:post-blank' and
     ;; this corner case.
     (let ((begin (or (car affiliated) (point)))
          (post-affiliated (point))
-         (key (progn (looking-at "[ \t]*#\\+\\(\\S-+*\\):")
+         (key (progn (looking-at "[ \t]*#\\+\\(\\S-*\\):")
                      (upcase (match-string-no-properties 1))))
          (value (org-trim (buffer-substring-no-properties
                            (match-end 0) (point-at-eol))))
@@ -4765,13 +4765,13 @@ you want to help debugging the issue.")
 (defvar org-element-cache-sync-idle-time 0.6
   "Length, in seconds, of idle time before syncing cache.")
 
-(defvar org-element-cache-sync-duration (seconds-to-time 0.04)
+(defvar org-element-cache-sync-duration 0.04
   "Maximum duration, as a time value, for a cache synchronization.
 If the synchronization is not over after this delay, the process
 pauses and resumes after `org-element-cache-sync-break'
 seconds.")
 
-(defvar org-element-cache-sync-break (seconds-to-time 0.3)
+(defvar org-element-cache-sync-break 0.3
   "Duration, as a time value, of the pause between synchronizations.
 See `org-element-cache-sync-duration' for more information.")
 
@@ -5066,7 +5066,7 @@ Assume ELEMENT belongs to cache and that a cache is 
active."
 TIME-LIMIT is a time value or nil."
   (and time-limit
        (or (input-pending-p)
-          (time-less-p time-limit (current-time)))))
+          (time-less-p time-limit nil))))
 
 (defsubst org-element--cache-shift-positions (element offset &optional props)
   "Shift ELEMENT properties relative to buffer positions by OFFSET.
@@ -5120,8 +5120,7 @@ updated before current modification are actually 
submitted."
             (and next (aref next 0))
             threshold
             (and (not threshold)
-                 (time-add (current-time)
-                           org-element-cache-sync-duration))
+                 (time-add nil org-element-cache-sync-duration))
             future-change)
            ;; Request processed.  Merge current and next offsets and
            ;; transfer ending position.
diff --git a/lisp/org/org-entities.el b/lisp/org/org-entities.el
index e291b52..66837f3 100644
--- a/lisp/org/org-entities.el
+++ b/lisp/org/org-entities.el
@@ -1,6 +1,6 @@
 ;;; org-entities.el --- Support for Special Entities -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>,
 ;;         Ulf Stegemann <ulf at zeitform dot de>
diff --git a/lisp/org/org-eshell.el b/lisp/org/org-eshell.el
index 8a2e8af..bb27d92 100644
--- a/lisp/org/org-eshell.el
+++ b/lisp/org/org-eshell.el
@@ -1,6 +1,6 @@
 ;;; org-eshell.el - Support for Links to Working Directories in Eshell -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Konrad Hinsen <konrad.hinsen AT fastmail.net>
 
diff --git a/lisp/org/org-eww.el b/lisp/org/org-eww.el
index 1b6112a..4988237 100644
--- a/lisp/org/org-eww.el
+++ b/lisp/org/org-eww.el
@@ -1,6 +1,6 @@
 ;;; org-eww.el --- Store url and kill from Eww mode for Org  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Marco Wahl <marcowahlsoft>a<gmailcom>
 ;; Keywords: link, eww
diff --git a/lisp/org/org-faces.el b/lisp/org/org-faces.el
index 750ada1..7ab5736 100644
--- a/lisp/org/org-faces.el
+++ b/lisp/org/org-faces.el
@@ -1,6 +1,6 @@
 ;;; org-faces.el --- Face definitions -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-feed.el b/lisp/org/org-feed.el
index fde19e6..b2dc4f3 100644
--- a/lisp/org/org-feed.el
+++ b/lisp/org/org-feed.el
@@ -1,6 +1,6 @@
 ;;; org-feed.el --- Add RSS feed items to Org files  -*- lexical-binding: t; 
-*-
 ;;
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-footnote.el b/lisp/org/org-footnote.el
index 5d472bd..f896318 100644
--- a/lisp/org/org-footnote.el
+++ b/lisp/org/org-footnote.el
@@ -1,6 +1,6 @@
 ;;; org-footnote.el --- Footnote support in Org      -*- lexical-binding: t; 
-*-
 ;;
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-gnus.el b/lisp/org/org-gnus.el
index a53b343..2cb2766 100644
--- a/lisp/org/org-gnus.el
+++ b/lisp/org/org-gnus.el
@@ -1,6 +1,6 @@
 ;;; org-gnus.el --- Support for Links to Gnus Groups and Messages -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;;         Tassilo Horn <tassilo at member dot fsf dot org>
diff --git a/lisp/org/org-habit.el b/lisp/org/org-habit.el
index 375714e..6234d02 100644
--- a/lisp/org/org-habit.el
+++ b/lisp/org/org-habit.el
@@ -1,6 +1,6 @@
 ;;; org-habit.el --- The habit tracking code for Org -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <johnw at gnu dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -288,7 +288,7 @@ Habits are assigned colors on the following basis:
         (deadline (if scheduled-days
                       (+ scheduled-days (- d-repeat s-repeat))
                     (org-habit-deadline habit)))
-        (m-days (or now-days (time-to-days (current-time)))))
+        (m-days (or now-days (time-to-days nil))))
     (cond
      ((< m-days scheduled)
       '(org-habit-clear-face . org-habit-clear-future-face))
@@ -406,8 +406,7 @@ current time."
   "Insert consistency graph for any habitual tasks."
   (let ((inhibit-read-only t)
        (buffer-invisibility-spec '(org-link))
-       (moment (time-subtract (current-time)
-                              (list 0 (* 3600 org-extend-today-until) 0))))
+       (moment (time-since (* 3600 org-extend-today-until))))
     (save-excursion
       (goto-char (if line (point-at-bol) (point-min)))
       (while (not (eobp))
diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el
index ad9b7d1..6a9d729 100644
--- a/lisp/org/org-id.el
+++ b/lisp/org/org-id.el
@@ -1,6 +1,6 @@
 ;;; org-id.el --- Global identifiers for Org entries -*- lexical-binding: t; 
-*-
 ;;
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -160,9 +160,9 @@ to have no space characters in them."
 (defcustom org-id-include-domain nil
   "Non-nil means add the domain name to new IDs.
 This ensures global uniqueness of IDs, and is also suggested by
-RFC 2445 in combination with RFC 822.  This is only relevant if
-`org-id-method' is `org'.  When uuidgen is used, the domain will never
-be added.
+the relevant RFCs.  This is relevant only if `org-id-method' is
+`org'.  When uuidgen is used, the domain will never be added.
+
 The default is to not use this because we have no really good way to get
 the true domain, and Org entries will normally not be shared with enough
 people to make this necessary."
diff --git a/lisp/org/org-indent.el b/lisp/org/org-indent.el
index bf4e998..97cf878 100644
--- a/lisp/org/org-indent.el
+++ b/lisp/org/org-indent.el
@@ -1,6 +1,6 @@
 ;;; org-indent.el --- Dynamic indentation for Org    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -332,7 +332,7 @@ stopped."
      (let* ((case-fold-search t)
            (limited-re (org-get-limited-outline-regexp))
            (level (or (org-current-level) 0))
-           (time-limit (and delay (time-add (current-time) delay))))
+           (time-limit (and delay (time-add nil delay))))
        ;; For each line, set `line-prefix' and `wrap-prefix'
        ;; properties depending on the type of line (headline, inline
        ;; task, item or other).
@@ -345,7 +345,7 @@ stopped."
           ;; In asynchronous mode, take a break of
           ;; `org-indent-agent-resume-delay' every DELAY to avoid
           ;; blocking any other idle timer or process output.
-          ((and delay (time-less-p time-limit (current-time)))
+          ((and delay (time-less-p time-limit nil))
            (setq org-indent-agent-resume-timer
                  (run-with-idle-timer
                   (time-add (current-idle-time) org-indent-agent-resume-delay)
diff --git a/lisp/org/org-info.el b/lisp/org/org-info.el
index 6dde36c..bfbe42c 100644
--- a/lisp/org/org-info.el
+++ b/lisp/org/org-info.el
@@ -1,6 +1,6 @@
 ;;; org-info.el --- Support for Links to Info Nodes -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-inlinetask.el b/lisp/org/org-inlinetask.el
index 08fc268..82372e5 100644
--- a/lisp/org/org-inlinetask.el
+++ b/lisp/org/org-inlinetask.el
@@ -1,6 +1,6 @@
 ;;; org-inlinetask.el --- Tasks Independent of Outline Hierarchy -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-irc.el b/lisp/org/org-irc.el
index 8901956..97f093e 100644
--- a/lisp/org/org-irc.el
+++ b/lisp/org/org-irc.el
@@ -1,6 +1,6 @@
 ;;; org-irc.el --- Store Links to IRC Sessions -*- lexical-binding: t; -*-
 ;;
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Philip Jackson <address@hidden>
 ;; Keywords: erc, irc, link, org
diff --git a/lisp/org/org-lint.el b/lisp/org/org-lint.el
index 9fcb17a..f915335 100644
--- a/lisp/org/org-lint.el
+++ b/lisp/org/org-lint.el
@@ -1,6 +1,6 @@
 ;;; org-lint.el --- Linting for Org documents        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <address@hidden>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-list.el b/lisp/org/org-list.el
index 1f51809..22692d2 100644
--- a/lisp/org/org-list.el
+++ b/lisp/org/org-list.el
@@ -1,6 +1,6 @@
 ;;; org-list.el --- Plain lists for Org              -*- lexical-binding: t; 
-*-
 ;;
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;;        Bastien Guerry <address@hidden>
@@ -236,7 +236,7 @@ into
 
 (defcustom org-plain-list-ordered-item-terminator t
   "The character that makes a line with leading number an ordered list item.
-Valid values are ?. and ?\).  To get both terminators, use t.
+Valid values are ?. and ?\\).  To get both terminators, use t.
 
 This variable needs to be set before org.el is loaded.  If you
 need to make a change while Emacs is running, use the customize
@@ -2678,7 +2678,7 @@ Return t if successful."
                (error "Cannot outdent beyond margin")
              ;; Change bullet if necessary.
              (when (and (= (+ top-ind offset) 0)
-                        (string-match "*"
+                        (string-match "\\*"
                                       (org-list-get-bullet beg struct)))
                (org-list-set-bullet beg struct
                                     (org-list-bullet-string "-")))
diff --git a/lisp/org/org-macro.el b/lisp/org/org-macro.el
index e50b2f9..a151e1e 100644
--- a/lisp/org/org-macro.el
+++ b/lisp/org/org-macro.el
@@ -1,6 +1,6 @@
 ;;; org-macro.el --- Macro Replacement Code for Org  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <address@hidden>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -313,7 +313,7 @@ Return a list of arguments, as strings.  This is the 
opposite of
                                  (buffer-substring
                                   (point) (line-end-position)))))
                       (when (cl-some #'identity time)
-                        (setq date (apply #'encode-time time))))))))
+                        (setq date (encode-time time))))))))
              (let ((proc (get-buffer-process buf)))
                (while (and proc (accept-process-output proc .5 nil t)))))
          (kill-buffer buf))
diff --git a/lisp/org/org-macs.el b/lisp/org/org-macs.el
index 5836336..3c76824 100644
--- a/lisp/org/org-macs.el
+++ b/lisp/org/org-macs.el
@@ -1,6 +1,6 @@
 ;;; org-macs.el --- Top-level Definitions for Org -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-mhe.el b/lisp/org/org-mhe.el
index e74a9ee..a37c41a 100644
--- a/lisp/org/org-mhe.el
+++ b/lisp/org/org-mhe.el
@@ -1,6 +1,6 @@
 ;;; org-mhe.el --- Support for Links to MH-E Messages -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Thomas Baumann <thomas dot baumann at ch dot tum dot de>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -142,7 +142,7 @@ So if you use sequences, it will now work."
   "Return the name of the message folder in an index folder buffer."
   (save-excursion
     (mh-index-previous-folder)
-    (if (re-search-forward "^\\(+.*\\)$" nil t)
+    (if (re-search-forward "^\\(\\+.*\\)$" nil t)
        (message "%s" (match-string 1)))))
 
 (defun org-mhe-get-message-folder ()
diff --git a/lisp/org/org-mobile.el b/lisp/org/org-mobile.el
index cbf169f..8b4e895 100644
--- a/lisp/org/org-mobile.el
+++ b/lisp/org/org-mobile.el
@@ -1,5 +1,5 @@
 ;;; org-mobile.el --- Code for Asymmetric Sync With a Mobile Device -*- 
lexical-binding: t; -*-
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -845,11 +845,11 @@ If BEG and END are given, only do this in that region."
            (cl-incf cnt-error)
            (throw 'next t))
          (move-marker bos-marker (point))
-         (if (re-search-forward "^** Old value[ \t]*$" eos t)
+         (if (re-search-forward "^\\** Old value[ \t]*$" eos t)
              (setq old (buffer-substring
                         (1+ (match-end 0))
                         (progn (outline-next-heading) (point)))))
-         (if (re-search-forward "^** New value[ \t]*$" eos t)
+         (if (re-search-forward "^\\** New value[ \t]*$" eos t)
              (setq new (buffer-substring
                         (1+ (match-end 0))
                         (progn (outline-next-heading)
diff --git a/lisp/org/org-mouse.el b/lisp/org/org-mouse.el
index 5a10b59..a3dcb77 100644
--- a/lisp/org/org-mouse.el
+++ b/lisp/org/org-mouse.el
@@ -1,6 +1,6 @@
 ;;; org-mouse.el --- Better mouse support for Org -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Piotr Zielinski <piotr dot zielinski at gmail dot com>
 ;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
@@ -643,7 +643,7 @@ This means, between the beginning of line and the point."
         ,@(org-mouse-list-options-menu (mapcar 'car org-startup-options)
                                        'org-mode-restart))))
      ((or (eolp)
-         (and (looking-at "\\(  \\|\t\\)\\(+:[0-9a-zA-Z_:]+\\)?\\(  
\\|\t\\)+$")
+         (and (looking-at "\\(  \\|\t\\)\\(\\+:[0-9a-zA-Z_:]+\\)?\\(  
\\|\t\\)+$")
               (looking-back "  \\|\t" (- (point) 2)
                             (line-beginning-position))))
       (org-mouse-popup-global-menu))
diff --git a/lisp/org/org-pcomplete.el b/lisp/org/org-pcomplete.el
index a9b909d..cf272de 100644
--- a/lisp/org/org-pcomplete.el
+++ b/lisp/org/org-pcomplete.el
@@ -1,6 +1,6 @@
 ;;; org-pcomplete.el --- In-buffer Completion Code -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;;         John Wiegley <johnw at gnu dot org>
@@ -49,10 +49,10 @@
   "Examine the thing at point and let the caller know what it is.
 The return value is a string naming the thing at point."
   (let ((beg1 (save-excursion
-               (skip-chars-backward "[:alnum:]-_@")
+               (skip-chars-backward "-[:alnum:]_@")
                (point)))
        (beg (save-excursion
-              (skip-chars-backward "a-zA-Z0-9-_:$")
+              (skip-chars-backward "-a-zA-Z0-9_:$")
               (point)))
        (line-to-here (buffer-substring (point-at-bol) (point))))
     (cond
@@ -82,7 +82,7 @@ The return value is a string naming the thing at point."
           (not (equal (char-after (point-at-bol)) ?*))
           (save-excursion
             (move-beginning-of-line 1)
-            (skip-chars-backward "[ \t\n]")
+            (skip-chars-backward " \t\n")
             ;; org-drawer-regexp matches a whole line but while
             ;; looking-back, we just ignore trailing whitespaces
             (or (looking-back (substring org-drawer-regexp 0 -1)
diff --git a/lisp/org/org-plot.el b/lisp/org/org-plot.el
index ebd7af4..a5635e3 100644
--- a/lisp/org/org-plot.el
+++ b/lisp/org/org-plot.el
@@ -1,6 +1,6 @@
 ;;; org-plot.el --- Support for Plotting from Org -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Eric Schulte <schulte dot eric at gmail dot com>
 ;; Keywords: tables, plotting
@@ -336,7 +336,7 @@ line directly before or after the table."
                    (insert "\n")
                    (insert-file-contents (plist-get params :script))
                    (goto-char (point-min))
-                   (while (re-search-forward "$datafile" nil t)
+                   (while (re-search-forward "\\$datafile" nil t)
                      (replace-match data-file nil nil)))
          (insert (org-plot/gnuplot-script data-file num-cols params)))
        ;; Graph table.
diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el
index 33957ee..016105e 100644
--- a/lisp/org/org-protocol.el
+++ b/lisp/org/org-protocol.el
@@ -1,6 +1,6 @@
 ;;; org-protocol.el --- Intercept Calls from Emacsclient to Trigger Custom 
Actions -*- lexical-binding: t; -*-
 ;;
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 ;;
 ;; Authors: Bastien Guerry <address@hidden>
 ;;       Daniel M German <dmg AT uvic DOT org>
@@ -331,7 +331,7 @@ returned list."
         (len 0)
         dir
         ret)
-    (when (string-match 
"^\\(.*\\)\\(org-protocol:/+[a-zA-z0-9][-_a-zA-z0-9]*:/+\\)\\(.*\\)" trigger)
+    (when (string-match 
"^\\(.*\\)\\(org-protocol:/+[a-zA-Z0-9][-_a-zA-Z0-9]*:/+\\)\\(.*\\)" trigger)
       (setq dir (match-string 1 trigger))
       (setq len (length dir))
       (setcar l (concat dir (match-string 3 trigger))))
@@ -349,17 +349,20 @@ returned list."
          ret)
       l)))
 
-(defun org-protocol-flatten (list)
-  "Transform LIST into a flat list.
+(defalias 'org-protocol-flatten
+  (if (fboundp 'flatten-tree) 'flatten-tree
+    (lambda (list)
+      "Transform LIST into a flat list.
 
 Greedy handlers might receive a list like this from emacsclient:
 \((\"/dir/org-protocol:/greedy:/~/path1\" (23 . 12)) (\"/dir/param\"))
 where \"/dir/\" is the absolute path to emacsclients working directory.
 This function transforms it into a flat list."
-  (if (null list) ()
-    (if (listp list)
-       (append (org-protocol-flatten (car list)) (org-protocol-flatten (cdr 
list)))
-      (list list))))
+      (if list
+         (if (consp list)
+             (append (org-protocol-flatten (car list))
+                     (org-protocol-flatten (cdr list)))
+           (list list))))))
 
 (defun org-protocol-parse-parameters (info &optional new-style default-order)
   "Return a property list of parameters from INFO.
diff --git a/lisp/org/org-rmail.el b/lisp/org/org-rmail.el
index d50fd64..c3d941e 100644
--- a/lisp/org/org-rmail.el
+++ b/lisp/org/org-rmail.el
@@ -1,6 +1,6 @@
 ;;; org-rmail.el --- Support for Links to Rmail Messages -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org-src.el b/lisp/org/org-src.el
index 829354c..d8f2cef 100644
--- a/lisp/org/org-src.el
+++ b/lisp/org/org-src.el
@@ -1,6 +1,6 @@
 ;;; org-src.el --- Source code examples in Org       -*- lexical-binding: t; 
-*-
 ;;
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;;        Bastien Guerry <address@hidden>
diff --git a/lisp/org/org-table.el b/lisp/org/org-table.el
index dcf7430..b6e864f 100644
--- a/lisp/org/org-table.el
+++ b/lisp/org/org-table.el
@@ -1,6 +1,6 @@
 ;;; org-table.el --- The Table Editor for Org        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -1182,7 +1182,7 @@ to a number.  In the case of a timestamp, increment by 
days."
                              (- (org-time-string-to-absolute txt)
                                 (org-time-string-to-absolute txt-up)))
                             ((string-match org-ts-regexp3 txt) 1)
-                            ((string-match 
"\\([-+]\\)?\\(?:[0-9]+\\)?\\(?:\.[0-9]+\\)?" txt-up)
+                            ((string-match 
"\\([-+]\\)?[0-9]*\\(?:\\.[0-9]+\\)?" txt-up)
                              (- (string-to-number txt)
                                 (string-to-number (match-string 0 txt-up))))
                             (t 1)))
@@ -2175,8 +2175,8 @@ If NLAST is a number, only the NLAST fields will actually 
be summed."
             (sres (if (= org-timecnt 0)
                       (number-to-string res)
                     (setq diff (* 3600 res)
-                          h (floor (/ diff 3600)) diff (mod diff 3600)
-                          m (floor (/ diff 60)) diff (mod diff 60)
+                          h (floor diff 3600) diff (mod diff 3600)
+                          m (floor diff 60) diff (mod diff 60)
                           s diff)
                     (format "%.0f:%02.0f:%02.0f" h m s))))
        (kill-new sres)
@@ -2307,7 +2307,7 @@ LOCATION instead."
              "\n"))))
 
 (defsubst org-table-formula-make-cmp-string (a)
-  (when (string-match "\\`$[<>]" a)
+  (when (string-match "\\`\\$[<>]" a)
     (let ((arrow (string-to-char (substring a 1))))
       ;; Fake a high number to make sure this is sorted at the end.
       (setq a (org-table-formula-handle-first/last-rc a))
@@ -2355,7 +2355,7 @@ LOCATION is a buffer position, consider the formulas 
there."
                       (cond
                        ((not (match-end 2)) m)
                        ;; Is it a column reference?
-                       ((string-match-p "\\`$\\([0-9]+\\|[<>]+\\)\\'" m) m)
+                       ((string-match-p "\\`\\$\\([0-9]+\\|[<>]+\\)\\'" m) m)
                        ;; Since named columns are not possible in
                        ;; LHS, assume this is a named field.
                        (t (match-string 2 string)))))
@@ -2909,8 +2909,8 @@ location of point."
                     (format-time-string
                      (org-time-stamp-format
                       (string-match-p "[0-9]\\{1,2\\}:[0-9]\\{2\\}" ts))
-                     (apply #'encode-time
-                            (save-match-data (org-parse-time-string ts))))))
+                     (encode-time
+                      (save-match-data (org-parse-time-string ts))))))
                 form t t))
 
          (setq ev (if (and duration (string-match 
"^[0-9]+:[0-9]+\\(?::[0-9]+\\)?$" form))
@@ -3216,7 +3216,7 @@ known that the table will be realigned a little later 
anyway."
                    (cond
                     ((string-match "address@hidden" old-lhs)
                      (user-error "Can't assign to hline relative reference"))
-                    ((string-match "\\`$[<>]" old-lhs)
+                    ((string-match "\\`\\$[<>]" old-lhs)
                      (let ((new (org-table-formula-handle-first/last-rc
                                  old-lhs)))
                        (when (assoc new eqlist)
@@ -3639,7 +3639,8 @@ Parameters get priority."
       (setq startline (org-current-line))
       (dolist (entry eql)
        (let* ((type (cond
-                     ((string-match "\\`$\\([0-9]+\\|[<>]+\\)\\'" (car entry))
+                     ((string-match "\\`\\$\\([0-9]+\\|[<>]+\\)\\'"
+                                    (car entry))
                       'column)
                      ((equal (string-to-char (car entry)) ?@) 'field)
                      (t 'named)))
diff --git a/lisp/org/org-timer.el b/lisp/org/org-timer.el
index d840944..6529a8b0 100644
--- a/lisp/org/org-timer.el
+++ b/lisp/org/org-timer.el
@@ -1,6 +1,6 @@
 ;;; org-timer.el --- Timer code for Org mode         -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -139,12 +139,7 @@ the region 0:00:00."
                   (format "Restart timer with offset [%s]: " def)))
          (unless (string-match "\\S-" s) (setq s def))
          (setq delta (org-timer-hms-to-secs (org-timer-fix-incomplete s)))))
-       (setq org-timer-start-time
-             (seconds-to-time
-              ;; Pass `current-time' result to `float-time' (instead
-              ;; of calling without arguments) so that only
-              ;; `current-time' has to be overridden in tests.
-              (- (float-time (current-time)) delta))))
+       (setq org-timer-start-time (time-since delta)))
       (setq org-timer-pause-time nil)
       (org-timer-set-mode-line 'on)
       (message "Timer start time set to %s, current value is %s"
@@ -167,14 +162,9 @@ With prefix arg STOP, stop it entirely."
            (setq org-timer-countdown-timer
                  (org-timer--run-countdown-timer
                   new-secs org-timer-countdown-timer-title))
-           (setq org-timer-start-time
-                 (time-add (current-time) (seconds-to-time new-secs))))
+           (setq org-timer-start-time (time-add nil new-secs)))
        (setq org-timer-start-time
-             ;; Pass `current-time' result to `float-time' (instead
-             ;; of calling without arguments) so that only
-             ;; `current-time' has to be overridden in tests.
-             (seconds-to-time (- (float-time (current-time))
-                                 (- pause-secs start-secs)))))
+             (time-since (- pause-secs start-secs))))
       (setq org-timer-pause-time nil)
       (org-timer-set-mode-line 'on)
       (run-hooks 'org-timer-continue-hook)
@@ -233,14 +223,9 @@ it in the buffer."
           (abs (floor (org-timer-seconds))))))
 
 (defun org-timer-seconds ()
-  ;; Pass `current-time' result to `float-time' (instead of calling
-  ;; without arguments) so that only `current-time' has to be
-  ;; overridden in tests.
-  (if org-timer-countdown-timer
-      (- (float-time org-timer-start-time)
-        (float-time (or org-timer-pause-time (current-time))))
-    (- (float-time (or org-timer-pause-time (current-time)))
-       (float-time org-timer-start-time))))
+  (let ((s (float-time (time-subtract org-timer-pause-time
+                                     org-timer-start-time))))
+    (if org-timer-countdown-timer (- s) s)))
 
 ;;;###autoload
 (defun org-timer-change-times-in-region (beg end delta)
@@ -400,7 +385,7 @@ VALUE can be `on', `off', or `paused'."
       (message "No timer set")
     (let* ((rtime (decode-time
                   (time-subtract (timer--time org-timer-countdown-timer)
-                                 (current-time))))
+                                 nil)))
           (rsecs (nth 0 rtime))
           (rmins (nth 1 rtime)))
       (message "%d minute(s) %d seconds left before next time out"
@@ -463,8 +448,7 @@ using three `C-u' prefix arguments."
                (org-timer--run-countdown-timer
                 secs org-timer-countdown-timer-title))
          (run-hooks 'org-timer-set-hook)
-         (setq org-timer-start-time
-               (time-add (current-time) (seconds-to-time secs)))
+         (setq org-timer-start-time (time-add nil secs))
          (setq org-timer-pause-time nil)
          (org-timer-set-mode-line 'on))))))
 
diff --git a/lisp/org/org-w3m.el b/lisp/org/org-w3m.el
index 9690c8e..23fd0f8 100644
--- a/lisp/org/org-w3m.el
+++ b/lisp/org/org-w3m.el
@@ -1,6 +1,6 @@
 ;;; org-w3m.el --- Support from Copy and Paste From w3m -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Andy Stewart <lazycat dot manatee at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/org.el b/lisp/org/org.el
index 873ae6b..bf7e305 100644
--- a/lisp/org/org.el
+++ b/lisp/org/org.el
@@ -1,7 +1,7 @@
 ;;; org.el --- Outline-based notes management and organizer -*- 
lexical-binding: t; -*-
 
 ;; Carstens outline-mode for keeping track of everything.
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;; Maintainer: Carsten Dominik <carsten at orgmode dot org>
@@ -229,10 +229,10 @@ file to byte-code before it is loaded."
   (interactive "fFile to load: \nP")
   (let* ((age (lambda (file)
                (float-time
-                (time-subtract (current-time)
-                               (file-attribute-modification-time
-                                (or (file-attributes (file-truename file))
-                                    (file-attributes file)))))))
+                (time-since
+                 (file-attribute-modification-time
+                  (or (file-attributes (file-truename file))
+                      (file-attributes file)))))))
         (base-name (file-name-sans-extension file))
         (exported-file (concat base-name ".el")))
     ;; tangle if the Org file is newer than the elisp file
@@ -5613,22 +5613,20 @@ When ROUNDING-MINUTES is not an integer, fall back on 
the car of
 the rounding returns a past time."
   (let ((r (or (and (integerp rounding-minutes) rounding-minutes)
               (car org-time-stamp-rounding-minutes)))
-       (time (decode-time)) res)
+       (now (current-time)))
     (if (< r 1)
-       (current-time)
-      (setq res
-           (apply 'encode-time
-                  (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) 
r)))))
-                          (nthcdr 2 time))))
-      (if (and past (< (float-time (time-subtract (current-time) res)) 0))
-         (seconds-to-time (- (float-time res) (* r 60)))
-       res))))
+       now
+      (let* ((time (decode-time now))
+            (res (apply #'encode-time 0 (* r (round (nth 1 time) r))
+                        (nthcdr 2 time))))
+       (if (or (not past) (time-less-p res now))
+           res
+         (time-subtract res (* r 60)))))))
 
 (defun org-today ()
   "Return today date, considering `org-extend-today-until'."
   (time-to-days
-   (time-subtract (current-time)
-                 (list 0 (* 3600 org-extend-today-until) 0))))
+   (time-since (* 3600 org-extend-today-until))))
 
 ;;;; Font-Lock stuff, including the activators
 
@@ -9743,9 +9741,7 @@ active region."
          (setq link
                (format-time-string
                 (car org-time-stamp-formats)
-                (apply 'encode-time
-                       (list 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd)
-                             nil nil nil))))
+                (encode-time 0 0 0 (nth 1 cd) (nth 0 cd) (nth 2 cd))))
          (org-store-link-props :type "calendar" :date cd)))
 
        ((eq major-mode 'help-mode)
@@ -10471,7 +10467,7 @@ This is still an experimental function, your mileage 
may vary."
    ((and (equal type "lisp") (string-match "^/" path))
     ;; Planner has a slash, we do not.
     (setq type "elisp" path (substring path 1)))
-   ((string-match "^//\\(.?*\\)/\\(<.*>\\)$" path)
+   ((string-match "^//\\(.*\\)/\\(<.*>\\)$" path)
     ;; A typical message link.  Planner has the id after the final slash,
     ;; we separate it with a hash mark
     (setq path (concat (match-string 1 path) "#"
@@ -11882,7 +11878,8 @@ prefix argument (`C-u C-u C-u C-c C-w')."
            (when (featurep 'org-inlinetask)
              (org-inlinetask-remove-END-maybe))
            (setq org-markers-to-move nil)
-           (message (concat actionmsg " to \"%s\" in file %s: done") (car it) 
file)))))))
+           (message "%s to \"%s\" in file %s: done" actionmsg
+                    (car it) file)))))))
 
 (defun org-refile-goto-last-stored ()
   "Go to the location where the last refile was stored."
@@ -13113,8 +13110,7 @@ This function is run automatically after each state 
change to a DONE state."
                        (while (re-search-forward org-clock-line-re end t)
                          (when (org-at-clock-log-p) (throw :clock t))))))
            (org-entry-put nil "LAST_REPEAT" (format-time-string
-                                             (org-time-stamp-format t t)
-                                             (current-time))))
+                                             (org-time-stamp-format t t))))
          (when org-log-repeat
            (if (or (memq 'org-add-log-note (default-value 'post-command-hook))
                    (memq 'org-add-log-note post-command-hook))
@@ -13173,7 +13169,7 @@ has been set"
                          (let ((nshiftmax 10)
                                (nshift 0))
                            (while (or (= nshift 0)
-                                      (not (time-less-p (current-time) time)))
+                                      (not (time-less-p nil time)))
                              (when (= (cl-incf nshift) nshiftmax)
                                (or (y-or-n-p
                                     (format "%d repeater intervals were not \
@@ -13344,7 +13340,7 @@ for calling org-schedule with, or if there is no 
scheduling,
 returns nil."
   (let ((time (org-entry-get pom "SCHEDULED" inherit)))
     (when time
-      (apply 'encode-time (org-parse-time-string time)))))
+      (org-time-string-to-time time))))
 
 (defun org-get-deadline-time (pom &optional inherit)
   "Get the deadline as a time tuple, of a format suitable for
@@ -13352,7 +13348,7 @@ calling org-deadline with, or if there is no 
scheduling, returns
 nil."
   (let ((time (org-entry-get pom "DEADLINE" inherit)))
     (when time
-      (apply 'encode-time (org-parse-time-string time)))))
+      (org-time-string-to-time time))))
 
 (defun org-remove-timestamp-with-keyword (keyword)
   "Remove all time stamps with KEYWORD in the current entry."
@@ -13411,7 +13407,7 @@ WHAT entry will also be removed."
                                       org-deadline-time-regexp)
                                     end t)
              (setq ts (match-string 1)
-                   default-time (apply 'encode-time (org-parse-time-string ts))
+                   default-time (org-time-string-to-time ts)
                    default-input (and ts (org-get-compact-tod ts)))))))
       (when what
        (setq time
@@ -14668,16 +14664,15 @@ it as a time string and apply `float-time' to it.  If 
S is nil, just return 0."
    ((numberp s) s)
    ((stringp s)
     (condition-case nil
-       (float-time (apply #'encode-time (org-parse-time-string s)))
-      (error 0.)))
-   (t 0.)))
+       (float-time (org-time-string-to-time s))
+      (error 0)))
+   (t 0)))
 
 (defun org-time-today ()
   "Time in seconds today at 0:00.
 Returns the float number of seconds since the beginning of the
 epoch to the beginning of today (00:00)."
-  (float-time (apply 'encode-time
-                    (append '(0 0 0) (nthcdr 3 (decode-time))))))
+  (float-time (apply #'encode-time 0 0 0 (nthcdr 3 (decode-time)))))
 
 (defun org-matcher-time (s)
   "Interpret a time comparison value."
@@ -14958,7 +14953,7 @@ When JUST-ALIGN is non-nil, only align tags."
          (unless (equal tags "")
            (let* ((level (save-excursion
                            (beginning-of-line)
-                           (skip-chars-forward "\\*")))
+                           (skip-chars-forward "*")))
                   (offset (if (bound-and-true-p org-indent-mode)
                               (* (1- org-indent-indentation-per-level)
                                  (1- level))
@@ -16572,22 +16567,20 @@ non-nil."
              ((org-at-timestamp-p 'lax) (match-string 0))))
         ;; Default time is either the timestamp at point or today.
         ;; When entering a range, only the range start is considered.
-         (default-time (if (not ts) (current-time)
-                        (apply #'encode-time (org-parse-time-string ts))))
+        (default-time (and ts (org-time-string-to-time ts)))
          (default-input (and ts (org-get-compact-tod ts)))
          (repeater (and ts
                        (string-match "\\([.+-]+[0-9]+[hdwmy] ?\\)+" ts)
                        (match-string 0 ts)))
         org-time-was-given
         org-end-time-was-given
-        (time
-         (and (if (equal arg '(16)) (current-time)
+        (time (if (equal arg '(16)) (current-time)
                 ;; Preserve `this-command' and `last-command'.
                 (let ((this-command this-command)
                       (last-command last-command))
                   (org-read-date
                    arg 'totime nil nil default-time default-input
-                   inactive))))))
+                   inactive)))))
     (cond
      ((and ts
            (memq last-command '(org-time-stamp org-time-stamp-inactive))
@@ -16820,7 +16813,7 @@ user."
     (when (< (nth 2 org-defdecode) org-extend-today-until)
       (setf (nth 2 org-defdecode) -1)
       (setf (nth 1 org-defdecode) 59)
-      (setq org-def (apply #'encode-time org-defdecode))
+      (setq org-def (encode-time org-defdecode))
       (setq org-defdecode (decode-time org-def)))
     (let* ((timestr (format-time-string
                     (if org-with-time "%Y-%m-%d %H:%M" "%Y-%m-%d")
@@ -16893,13 +16886,14 @@ user."
                 "range representable on this machine"))
       (ding))
 
-    ;; One round trip to get rid of 34th of August and stuff like that....
-    (setq final (decode-time (apply 'encode-time final)))
+    (setq final (apply #'encode-time final))
 
     (setq org-read-date-final-answer ans)
 
     (if to-time
-       (apply 'encode-time final)
+       final
+      ;; This round-trip gets rid of 34th of August and stuff like that....
+      (setq final (decode-time final))
       (if (and (boundp 'org-time-was-given) org-time-was-given)
          (format "%04d-%02d-%02d %02d:%02d"
                  (nth 5 final) (nth 4 final) (nth 3 final)
@@ -16929,7 +16923,7 @@ user."
                          (and (boundp 'org-time-was-given) org-time-was-given))
                      (cdr fmts)
                    (car fmts)))
-            (txt (format-time-string fmt (apply 'encode-time f)))
+            (txt (format-time-string fmt (apply #'encode-time f)))
             (txt (if org-read-date-inactive (concat "[" (substring txt 1 -1) 
"]") txt))
             (txt (concat "=> " txt)))
        (when (and org-end-time-was-given
@@ -16960,7 +16954,7 @@ user."
     (when (string-match "\\`[ \t]*\\.[ \t]*\\'" ans)
       (setq ans "+0"))
 
-    (when (setq delta (org-read-date-get-relative ans (current-time) org-def))
+    (when (setq delta (org-read-date-get-relative ans nil org-def))
       (setq ans (replace-match "" t t ans)
            deltan (car delta)
            deltaw (nth 1 delta)
@@ -17117,7 +17111,7 @@ user."
                                        ;      (when (and 
org-read-date-prefer-future
                                        ;                (not iso-year)
                                        ;                (< 
(calendar-absolute-from-gregorian iso-date)
-                                       ;                   (time-to-days 
(current-time))))
+                                       ;                   (time-to-days nil)))
                                        ;       (setq year (1+ year)
                                        ;             iso-date 
(calendar-gregorian-from-absolute
                                        ;                       
(calendar-iso-to-absolute
@@ -17296,7 +17290,7 @@ The command returns the inserted time stamp."
          time (org-fix-decoded-time t1)
          str (org-add-props
                  (format-time-string
-                  (substring tf 1 -1) (apply 'encode-time time))
+                  (substring tf 1 -1) (encode-time time))
                  nil 'mouse-face 'highlight))
     (put-text-property beg end 'display str)))
 
@@ -17311,7 +17305,7 @@ Don't touch the rest."
 If SECONDS is non-nil, return the difference in seconds."
   (let ((fdiff (if seconds #'float-time #'time-to-days)))
     (- (funcall fdiff (org-time-string-to-time timestamp-string))
-       (funcall fdiff (current-time)))))
+       (funcall fdiff nil))))
 
 (defun org-deadline-close-p (timestamp-string &optional ndays)
   "Is the time in TIMESTAMP-STRING close to the current date?"
@@ -17493,10 +17487,8 @@ days in order to avoid rounding problems."
          (match-end (match-end 0))
          (time1 (org-time-string-to-time ts1))
          (time2 (org-time-string-to-time ts2))
-         (t1 (float-time time1))
-         (t2 (float-time time2))
-         (diff (abs (- t2 t1)))
-         (negative (< (- t2 t1) 0))
+         (diff (abs (float-time (time-subtract time2 time1))))
+         (negative (time-less-p time2 time1))
          ;; (ys (floor (* 365 24 60 60)))
          (ds (* 24 60 60))
          (hs (* 60 60))
@@ -17507,14 +17499,14 @@ days in order to avoid rounding problems."
          (fh "%02d:%02d")
          y d h m align)
      (if havetime
-        (setq ; y (floor (/ diff ys))  diff (mod diff ys)
+        (setq ; y (floor diff ys)  diff (mod diff ys)
          y 0
-         d (floor (/ diff ds))  diff (mod diff ds)
-         h (floor (/ diff hs))  diff (mod diff hs)
-         m (floor (/ diff 60)))
-       (setq ; y (floor (/ diff ys))  diff (mod diff ys)
+         d (floor diff ds)  diff (mod diff ds)
+         h (floor diff hs)  diff (mod diff hs)
+         m (floor diff 60))
+       (setq ; y (floor diff ys)  diff (mod diff ys)
        y 0
-       d (floor (+ (/ diff ds) 0.5))
+       d (round diff ds)
        h 0 m 0))
      (if (not to-buffer)
         (message "%s" (org-make-tdiff-string y d h m))
@@ -17553,7 +17545,7 @@ days in order to avoid rounding problems."
 
 (defun org-time-string-to-time (s)
   "Convert timestamp string S into internal time."
-  (apply #'encode-time (org-parse-time-string s)))
+  (encode-time (org-parse-time-string s)))
 
 (defun org-time-string-to-seconds (s)
   "Convert a timestamp string S into a number of seconds."
@@ -17588,7 +17580,7 @@ signaled."
    (daynr (org-closest-date s daynr prefer))
    (t (time-to-days
        (condition-case errdata
-          (apply #'encode-time (org-parse-time-string s))
+          (org-time-string-to-time s)
         (error (error "Bad timestamp `%s'%s\nError was: %s"
                       s
                       (if (not (and buffer pos)) ""
@@ -17605,7 +17597,7 @@ signaled."
 YEAR is expanded into one of the 30 next years, if possible, or
 into a past one.  Any year larger than 99 is returned unchanged."
   (if (>= year 100) year
-    (let* ((current (string-to-number (format-time-string "%Y" 
(current-time))))
+    (let* ((current (string-to-number (format-time-string "%Y")))
           (century (/ current 100))
           (offset (- year (% current 100))))
       (cond ((> offset 30) (+ (* (1- century) 100) year))
@@ -17686,12 +17678,12 @@ stamp stay unchanged.  In any case, return value is 
an absolute
 day number."
   (if (not (string-match "\\+\\([0-9]+\\)\\([hdwmy]\\)" start))
       ;; No repeater.  Do not shift time stamp.
-      (time-to-days (apply #'encode-time (org-parse-time-string start)))
+      (time-to-days (org-time-string-to-time start))
     (let ((value (string-to-number (match-string 1 start)))
          (type (match-string 2 start)))
       (if (= 0 value)
          ;; Repeater with a 0-value is considered as void.
-         (time-to-days (apply #'encode-time (org-parse-time-string start)))
+         (time-to-days (org-time-string-to-time start))
        (let* ((base (org-date-to-gregorian start))
               (target (org-date-to-gregorian current))
               (sday (calendar-absolute-from-gregorian base))
@@ -17796,7 +17788,7 @@ NODEFAULT, hour and minute fields will be nil if not 
given."
         ;; second argument.  However, this requires at least Emacs
         ;; 25.1.  We can do it when we switch to this version as our
         ;; minimal requirement.
-        (decode-time (seconds-to-time (org-matcher-time s))))
+        (decode-time (encode-time (org-matcher-time s))))
        (t (error "Not a standard Org time string: %s" s))))
 
 (defun org-timestamp-up (&optional arg)
@@ -18000,7 +17992,7 @@ When SUPPRESS-TMP-DELAY is non-nil, suppress delays 
like \"--2d\"."
          (setcar time0 (or (car time0) 0))
          (setcar (nthcdr 1 time0) (or (nth 1 time0) 0))
          (setcar (nthcdr 2 time0) (or (nth 2 time0) 0))
-         (setq time (apply 'encode-time time0))))
+         (setq time (encode-time time0))))
       ;; Insert the new time-stamp, and ensure point stays in the same
       ;; category as before (i.e. not after the last position in that
       ;; category).
@@ -18125,7 +18117,7 @@ A prefix ARG can be used to force the current date."
        diff)
     (when (or (org-at-timestamp-p 'lax)
              (org-match-line (concat ".*" org-ts-regexp)))
-      (let ((d1 (time-to-days (current-time)))
+      (let ((d1 (time-to-days nil))
            (d2 (time-to-days (org-time-string-to-time (match-string 1)))))
        (setq diff (- d2 d1))))
     (calendar)
@@ -20623,7 +20615,7 @@ this numeric value."
     (unless inc (setq inc 1))
     (let ((pos (point))
          (beg (skip-chars-backward "-+^/*0-9eE."))
-         (end (skip-chars-forward "-+^/*0-9eE^.")) nap)
+         (end (skip-chars-forward "-+^/*0-9eE.")) nap)
       (setq nap (buffer-substring-no-properties
                 (+ pos beg) (+ pos beg end)))
       (delete-region (+ pos beg) (+ pos beg end))
@@ -22845,9 +22837,9 @@ assumed to be significant there."
 (defun org-fill-line-break-nobreak-p ()
   "Non-nil when a new line at point would create an Org line break."
   (save-excursion
-    (skip-chars-backward "[ \t]")
+    (skip-chars-backward " \t")
     (skip-chars-backward "\\\\")
-    (looking-at "\\\\\\\\\\($\\|[^\\\\]\\)")))
+    (looking-at "\\\\\\\\\\($\\|[^\\]\\)")))
 
 (defun org-fill-paragraph-with-timestamp-nobreak-p ()
   "Non-nil when a new line at point would split a timestamp."
@@ -23389,13 +23381,12 @@ strictly within a source block, use appropriate 
comment syntax."
 (defun org-timestamp--to-internal-time (timestamp &optional end)
   "Encode TIMESTAMP object into Emacs internal time.
 Use end of date range or time range when END is non-nil."
-  (apply #'encode-time
-        (cons 0
-              (mapcar
-               (lambda (prop) (or (org-element-property prop timestamp) 0))
-               (if end '(:minute-end :hour-end :day-end :month-end :year-end)
-                 '(:minute-start :hour-start :day-start :month-start
-                                 :year-start))))))
+  (apply #'encode-time 0
+        (mapcar
+         (lambda (prop) (or (org-element-property prop timestamp) 0))
+         (if end '(:minute-end :hour-end :day-end :month-end :year-end)
+           '(:minute-start :hour-start :day-start :month-start
+                           :year-start)))))
 
 (defun org-timestamp-has-time-p (timestamp)
   "Non-nil when TIMESTAMP has a time specified."
diff --git a/lisp/org/ox-ascii.el b/lisp/org/ox-ascii.el
index c3ccb59..7c9920f 100644
--- a/lisp/org/ox-ascii.el
+++ b/lisp/org/ox-ascii.el
@@ -1,6 +1,6 @@
 ;;; ox-ascii.el --- ASCII Back-End for Org Export Engine -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -1474,8 +1474,8 @@ contextual information."
                   (replace-regexp-in-string
                    "-" "•"
                    (replace-regexp-in-string
-                    "+" "⁃"
-                    (replace-regexp-in-string "*" "‣" bul))))))))
+                    "\\+" "⁃"
+                    (replace-regexp-in-string "\\*" "‣" bul))))))))
         (indentation (if (eq list-type 'descriptive) org-ascii-quote-margin
                        (string-width bullet))))
     (concat
diff --git a/lisp/org/ox-beamer.el b/lisp/org/ox-beamer.el
index 15b78dc..11574a9 100644
--- a/lisp/org/ox-beamer.el
+++ b/lisp/org/ox-beamer.el
@@ -1,6 +1,6 @@
 ;;; ox-beamer.el --- Beamer Back-End for Org Export Engine -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten.dominik AT gmail DOT com>
 ;;         Nicolas Goaziou <n.goaziou AT gmail DOT com>
diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el
index 6166a4a..1f98fcd 100644
--- a/lisp/org/ox-html.el
+++ b/lisp/org/ox-html.el
@@ -1,6 +1,6 @@
 ;;; ox-html.el --- HTML Back-End for Org Export Engine -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;;      Jambunathan K <kjambunathan at gmail dot com>
@@ -234,7 +234,7 @@ property on the headline itself.")
 @licstart  The following is the entire license notice for the
 JavaScript code in this tag.
 
-Copyright (C) 2012-2018 Free Software Foundation, Inc.
+Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 The JavaScript code in this tag is free software: you can
 redistribute it and/or modify it under the terms of the GNU
@@ -524,7 +524,7 @@ means to use the maximum value consistent with other 
options."
  * @licstart  The following is the entire license notice for the
  *  JavaScript code in %SCRIPT_PATH.
  *
- * Copyright (C) 2012-2018 Free Software Foundation, Inc.
+ * Copyright (C) 2012-2019 Free Software Foundation, Inc.
  *
  *
  * The JavaScript code in this tag is free software: you can
@@ -553,7 +553,7 @@ means to use the maximum value consistent with other 
options."
 @licstart  The following is the entire license notice for the
 JavaScript code in this tag.
 
-Copyright (C) 2012-2018 Free Software Foundation, Inc.
+Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 The JavaScript code in this tag is free software: you can
 redistribute it and/or modify it under the terms of the GNU
diff --git a/lisp/org/ox-icalendar.el b/lisp/org/ox-icalendar.el
index 7d7c850..f66e100 100644
--- a/lisp/org/ox-icalendar.el
+++ b/lisp/org/ox-icalendar.el
@@ -1,6 +1,6 @@
 ;;; ox-icalendar.el --- iCalendar Back-End for Org Export Engine -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <carsten at orgmode dot org>
 ;;      Nicolas Goaziou <n dot goaziou at gmail dot com>
diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el
index 5aaaf99..d711530 100644
--- a/lisp/org/ox-latex.el
+++ b/lisp/org/ox-latex.el
@@ -1,6 +1,6 @@
 ;;; ox-latex.el --- LaTeX Back-End for Org Export Engine -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -1613,7 +1613,7 @@ INFO is a plist used as a communication channel."
 
 (defun org-latex-clean-invalid-line-breaks (data _backend _info)
   (replace-regexp-in-string
-   "\\(\\end{[A-Za-z0-9*]+}\\|^\\)[ \t]*\\\\\\\\[ \t]*$" "\\1"
+   "\\(\\\\end{[A-Za-z0-9*]+}\\|^\\)[ \t]*\\\\\\\\[ \t]*$" "\\1"
    data))
 
 
diff --git a/lisp/org/ox-man.el b/lisp/org/ox-man.el
index 2bc6392..816cc36 100644
--- a/lisp/org/ox-man.el
+++ b/lisp/org/ox-man.el
@@ -1,6 +1,6 @@
 ;; ox-man.el --- Man Back-End for Org Export Engine -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
 ;;      Luis R Anaya <papoanaya aroba hot mail punto com>
diff --git a/lisp/org/ox-md.el b/lisp/org/ox-md.el
index c4da8fc..fa663db 100644
--- a/lisp/org/ox-md.el
+++ b/lisp/org/ox-md.el
@@ -1,6 +1,6 @@
 ;;; ox-md.el --- Markdown Back-End for Org Export Engine -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <address@hidden>
 ;; Keywords: org, wp, markdown
diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el
index b878171..8deb6bd 100644
--- a/lisp/org/ox-odt.el
+++ b/lisp/org/ox-odt.el
@@ -1,6 +1,6 @@
 ;;; ox-odt.el --- OpenDocument Text Exporter for Org Mode -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Jambunathan K <kjambunathan at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
diff --git a/lisp/org/ox-org.el b/lisp/org/ox-org.el
index 1b5a7cc..ca10287 100644
--- a/lisp/org/ox-org.el
+++ b/lisp/org/ox-org.el
@@ -1,6 +1,6 @@
 ;;; ox-org.el --- Org Back-End for Org Export Engine -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <address@hidden>
 ;; Keywords: org, wp
diff --git a/lisp/org/ox-publish.el b/lisp/org/ox-publish.el
index 80ef239..74312bc 100644
--- a/lisp/org/ox-publish.el
+++ b/lisp/org/ox-publish.el
@@ -1,5 +1,5 @@
 ;;; ox-publish.el --- Publish Related Org Mode Files as a Website -*- 
lexical-binding: t; -*-
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: David O'Toole <address@hidden>
 ;; Maintainer: Carsten Dominik <carsten DOT dominik AT gmail DOT com>
@@ -793,13 +793,11 @@ Default for SITEMAP-FILENAME is `sitemap.org'."
                           (not (string-lessp B A))))))
                ((or `anti-chronologically `chronologically)
                 (let* ((adate (org-publish-find-date a project))
-                       (bdate (org-publish-find-date b project))
-                       (A (+ (ash (car adate) 16) (cadr adate)))
-                       (B (+ (ash (car bdate) 16) (cadr bdate))))
+                       (bdate (org-publish-find-date b project)))
                   (setq retval
-                        (if (eq sort-files 'chronologically)
-                            (<= A B)
-                          (>= A B)))))
+                        (not (if (eq sort-files 'chronologically)
+                                 (time-less-p bdate adate)
+                               (time-less-p adate bdate))))))
                (`nil nil)
                (_ (user-error "Invalid sort value %s" sort-files)))
              ;; Directory-wise wins:
@@ -1350,7 +1348,7 @@ does not exist."
               (expand-file-name (or (file-symlink-p file) file)
                                 (file-name-directory file)))))
     (if (not attr) (error "No such file: \"%s\"" file)
-      (floor (float-time (file-attribute-modification-time attr))))))
+      (encode-time (file-attribute-modification-time attr) 'integer))))
 
 
 (provide 'ox-publish)
diff --git a/lisp/org/ox-texinfo.el b/lisp/org/ox-texinfo.el
index d877c9c..468fc58 100644
--- a/lisp/org/ox-texinfo.el
+++ b/lisp/org/ox-texinfo.el
@@ -1,6 +1,6 @@
 ;;; ox-texinfo.el --- Texinfo Back-End for Org Export Engine -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 ;; Author: Jonathan Leech-Pepin <jonathan.leechpepin at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
 
diff --git a/lisp/org/ox.el b/lisp/org/ox.el
index ea7d1dc..58bc9b0 100644
--- a/lisp/org/ox.el
+++ b/lisp/org/ox.el
@@ -1,6 +1,6 @@
 ;;; ox.el --- Export Framework for Org Mode          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Goaziou <n.goaziou at gmail dot com>
 ;; Keywords: outlines, hypermedia, calendar, wp
@@ -3252,7 +3252,7 @@ locally for the subtree through node properties."
       (let ((val (cond ((equal (car key) "DATE")
                        (or (cdr key)
                            (with-temp-buffer
-                             (org-insert-time-stamp (current-time)))))
+                             (org-insert-time-stamp nil))))
                       ((equal (car key) "TITLE")
                        (or (let ((visited-file
                                   (buffer-file-name (buffer-base-buffer))))
@@ -3322,7 +3322,7 @@ storing and resolving footnotes.  It is created 
automatically."
                           (setq value (replace-match "" nil nil value)))))
                   (lines
                    (and (string-match
-                         ":lines +\"\\(\\(?:[0-9]+\\)?-\\(?:[0-9]+\\)?\\)\""
+                         ":lines +\"\\([0-9]*-[0-9]*\\)\""
                          value)
                         (prog1 (match-string 1 value)
                           (setq value (replace-match "" nil nil value)))))
diff --git a/lisp/outline.el b/lisp/outline.el
index 59169e4..74df77b 100644
--- a/lisp/outline.el
+++ b/lisp/outline.el
@@ -1,6 +1,6 @@
 ;;; outline.el --- outline mode commands for Emacs
 
-;; Copyright (C) 1986, 1993-1995, 1997, 2000-2018 Free Software
+;; Copyright (C) 1986, 1993-1995, 1997, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/paren.el b/lisp/paren.el
index 1cab6eb..13908d4 100644
--- a/lisp/paren.el
+++ b/lisp/paren.el
@@ -1,6 +1,6 @@
 ;;; paren.el --- highlight matching paren
 
-;; Copyright (C) 1993, 1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: address@hidden
 ;; Maintainer: address@hidden
diff --git a/lisp/password-cache.el b/lisp/password-cache.el
index f775389..b868b72 100644
--- a/lisp/password-cache.el
+++ b/lisp/password-cache.el
@@ -1,6 +1,6 @@
 ;;; password-cache.el --- Read passwords, possibly using a password cache.
 
-;; Copyright (C) 1999-2000, 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2000, 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 ;; Created: 2003-12-21
diff --git a/lisp/pcmpl-cvs.el b/lisp/pcmpl-cvs.el
index dedc007..c90e00f 100644
--- a/lisp/pcmpl-cvs.el
+++ b/lisp/pcmpl-cvs.el
@@ -1,6 +1,6 @@
 ;;; pcmpl-cvs.el --- functions for dealing with cvs completions
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 ;; Package: pcomplete
diff --git a/lisp/pcmpl-gnu.el b/lisp/pcmpl-gnu.el
index c4e5a67..d9caf35 100644
--- a/lisp/pcmpl-gnu.el
+++ b/lisp/pcmpl-gnu.el
@@ -1,6 +1,6 @@
 ;;; pcmpl-gnu.el --- completions for GNU project tools -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Package: pcomplete
 
diff --git a/lisp/pcmpl-linux.el b/lisp/pcmpl-linux.el
index 18cc647..9121e78 100644
--- a/lisp/pcmpl-linux.el
+++ b/lisp/pcmpl-linux.el
@@ -1,6 +1,6 @@
 ;;; pcmpl-linux.el --- functions for dealing with GNU/Linux completions
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Package: pcomplete
 
diff --git a/lisp/pcmpl-rpm.el b/lisp/pcmpl-rpm.el
index 7f164c9..213eac7 100644
--- a/lisp/pcmpl-rpm.el
+++ b/lisp/pcmpl-rpm.el
@@ -1,6 +1,6 @@
 ;;; pcmpl-rpm.el --- functions for dealing with rpm completions
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Package: pcomplete
 
diff --git a/lisp/pcmpl-unix.el b/lisp/pcmpl-unix.el
index 1b11afd..fa42809 100644
--- a/lisp/pcmpl-unix.el
+++ b/lisp/pcmpl-unix.el
@@ -1,6 +1,6 @@
 ;;; pcmpl-unix.el --- standard UNIX completions
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Package: pcomplete
 
diff --git a/lisp/pcmpl-x.el b/lisp/pcmpl-x.el
index 766ac2e..96dc6b2 100644
--- a/lisp/pcmpl-x.el
+++ b/lisp/pcmpl-x.el
@@ -1,6 +1,6 @@
 ;;; pcmpl-x.el --- completion for miscellaneous tools  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Leo Liu <address@hidden>
 ;; Keywords: processes, tools, convenience
diff --git a/lisp/pcomplete.el b/lisp/pcomplete.el
index 6bdea68..e080074 100644
--- a/lisp/pcomplete.el
+++ b/lisp/pcomplete.el
@@ -1,6 +1,6 @@
 ;;; pcomplete.el --- programmable completion -*- lexical-binding: t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 ;; Keywords: processes abbrev
@@ -444,10 +444,28 @@ Same as `pcomplete' but using the standard completion UI."
            ;; table which expects strings using a prefix from the
            ;; buffer's text but internally uses the corresponding
            ;; prefix from pcomplete-stub.
+           ;;
+           (argbeg (pcomplete-begin))
+           ;; When completing an envvar within an argument in Eshell
+           ;; (e.g. "cd /home/$US TAB"), `pcomplete-stub' will just be
+           ;; "US" whereas `argbeg' will point to the first "/".
+           ;; We could rely on c-t-subvert to handle the difference,
+           ;; but we try here to guess the "real" beginning so as to
+           ;; rely less on c-t-subvert.
            (beg (max (- (point) (length pcomplete-stub))
-                     (pcomplete-begin)))
-           (buftext (pcomplete-unquote-argument
-                     (buffer-substring beg (point)))))
+                     argbeg))
+           buftext)
+      ;; Try and improve our guess of `beg' in case the difference
+      ;; between pcomplete-stub and the buffer's text is simply due to
+      ;; some chars removed by unquoting.  Again, this is not
+      ;; indispensable but reduces the reliance on c-t-subvert and
+      ;; improves corner case behaviors.
+      (while (progn (setq buftext (pcomplete-unquote-argument
+                                   (buffer-substring beg (point))))
+                    (and (> beg argbeg)
+                         (> (length pcomplete-stub) (length buftext))))
+        (setq beg (max argbeg (- beg (- (length pcomplete-stub)
+                                        (length buftext))))))
       (when completions
         (let ((table
                (completion-table-with-quoting
@@ -768,7 +786,7 @@ this is `comint-dynamic-complete-functions'."
        (push (point) begins)
         (while
             (progn
-              (skip-chars-forward "^ \t\n\\")
+              (skip-chars-forward "^ \t\n\\\\")
               (when (eq (char-after) ?\\)
                 (forward-char 1)
                 (unless (eolp)
diff --git a/lisp/pixel-scroll.el b/lisp/pixel-scroll.el
index 227580f..dfd9a5a 100644
--- a/lisp/pixel-scroll.el
+++ b/lisp/pixel-scroll.el
@@ -1,6 +1,6 @@
 ;;; pixel-scroll.el --- Scroll a line smoothly
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 ;; Author: Tak Kunihiro <address@hidden>
 ;; Keywords: mouse
 ;; Package: emacs
@@ -97,10 +97,11 @@ When scrolling request is delivered soon after the previous 
one,
 user is in hurry.  When the time since last scroll is larger than
 `pixel-dead-time', we are ready for another smooth scroll, and this
 function returns nil."
-  (let* ((current-time (float-time))
-         (scroll-in-rush-p (< (- current-time pixel-last-scroll-time)
-                              pixel-dead-time)))
-    (setq pixel-last-scroll-time current-time)
+  (let* ((now (current-time))
+        (scroll-in-rush-p (time-less-p
+                           (time-subtract now pixel-last-scroll-time)
+                           pixel-dead-time)))
+    (setq pixel-last-scroll-time (float-time now))
     scroll-in-rush-p))
 
 ;;;###autoload
diff --git a/lisp/play/5x5.el b/lisp/play/5x5.el
index 9ac394c..e13a3c9 100644
--- a/lisp/play/5x5.el
+++ b/lisp/play/5x5.el
@@ -1,6 +1,6 @@
 ;;; 5x5.el --- simple little puzzle game
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Pearson <address@hidden>
 ;; Maintainer: Dave Pearson <address@hidden>
diff --git a/lisp/play/animate.el b/lisp/play/animate.el
index 0ed67bd..6b0b33b 100644
--- a/lisp/play/animate.el
+++ b/lisp/play/animate.el
@@ -1,6 +1,6 @@
 ;;; animate.el --- make text dance
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: Richard Stallman <address@hidden>
 ;; Keywords: games
diff --git a/lisp/play/blackbox.el b/lisp/play/blackbox.el
index d4814ba..53a0b0b 100644
--- a/lisp/play/blackbox.el
+++ b/lisp/play/blackbox.el
@@ -1,6 +1,6 @@
 ;;; blackbox.el --- blackbox game in Emacs Lisp
 
-;; Copyright (C) 1985-1987, 1992, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1985-1987, 1992, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: F. Thomas May <address@hidden>
diff --git a/lisp/play/bubbles.el b/lisp/play/bubbles.el
index a54682f..239fbe4 100644
--- a/lisp/play/bubbles.el
+++ b/lisp/play/bubbles.el
@@ -1,6 +1,6 @@
 ;;; bubbles.el --- Puzzle game for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <address@hidden>
 ;; URL:         http://ulf.epplejasper.de/
@@ -712,57 +712,57 @@ static char * dot3d_xpm[] = {
 (defsubst bubbles--grid-width ()
   "Return the grid width for the current game theme."
   (car (pcase bubbles-game-theme
-         (`easy
+         ('easy
           bubbles--grid-small)
-         (`medium
+         ('medium
           bubbles--grid-medium)
-         (`difficult
+         ('difficult
           bubbles--grid-large)
-         (`hard
+         ('hard
           bubbles--grid-huge)
-         (`user-defined
+         ('user-defined
           bubbles-grid-size))))
 
 (defsubst bubbles--grid-height ()
   "Return the grid height for the current game theme."
   (cdr (pcase bubbles-game-theme
-         (`easy
+         ('easy
           bubbles--grid-small)
-         (`medium
+         ('medium
           bubbles--grid-medium)
-         (`difficult
+         ('difficult
           bubbles--grid-large)
-         (`hard
+         ('hard
           bubbles--grid-huge)
-         (`user-defined
+         ('user-defined
           bubbles-grid-size))))
 
 (defsubst bubbles--colors ()
   "Return the color list for the current game theme."
   (pcase bubbles-game-theme
-    (`easy
+    ('easy
      bubbles--colors-2)
-    (`medium
+    ('medium
      bubbles--colors-3)
-    (`difficult
+    ('difficult
      bubbles--colors-4)
-    (`hard
+    ('hard
      bubbles--colors-5)
-    (`user-defined
+    ('user-defined
      bubbles-colors)))
 
 (defsubst bubbles--shift-mode ()
   "Return the shift mode for the current game theme."
   (pcase bubbles-game-theme
-    (`easy
+    ('easy
      'default)
-    (`medium
+    ('medium
      'default)
-    (`difficult
+    ('difficult
      'always)
-    (`hard
+    ('hard
      'always)
-    (`user-defined
+    ('user-defined
      bubbles-shift-mode)))
 
 (defun bubbles-save-settings ()
@@ -1328,11 +1328,11 @@ Return t if new char is non-empty."
   (when (and (display-images-p)
              (not (eq bubbles-graphics-theme 'ascii)))
     (let ((template (pcase bubbles-graphics-theme
-                      (`circles bubbles--image-template-circle)
-                      (`balls bubbles--image-template-ball)
-                      (`squares bubbles--image-template-square)
-                      (`diamonds bubbles--image-template-diamond)
-                      (`emacs bubbles--image-template-emacs))))
+                      ('circles bubbles--image-template-circle)
+                      ('balls bubbles--image-template-ball)
+                      ('squares bubbles--image-template-square)
+                      ('diamonds bubbles--image-template-diamond)
+                      ('emacs bubbles--image-template-emacs))))
       (setq bubbles--empty-image
             (create-image (replace-regexp-in-string
                            "^\"\\(.*\\)\t.*c .*\",$"
diff --git a/lisp/play/cookie1.el b/lisp/play/cookie1.el
index 7a6a56b..e461b37 100644
--- a/lisp/play/cookie1.el
+++ b/lisp/play/cookie1.el
@@ -1,6 +1,6 @@
 ;;; cookie1.el --- retrieve random phrases from fortune cookie files
 
-;; Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/play/decipher.el b/lisp/play/decipher.el
index 0e57278..cb0f075 100644
--- a/lisp/play/decipher.el
+++ b/lisp/play/decipher.el
@@ -1,6 +1,6 @@
 ;;; decipher.el --- cryptanalyze monoalphabetic substitution ciphers
 ;;
-;; Copyright (C) 1995-1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1996, 2001-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Christopher J. Madsen <address@hidden>
 ;; Keywords: games
diff --git a/lisp/play/dissociate.el b/lisp/play/dissociate.el
index 43a117c..a5880c0 100644
--- a/lisp/play/dissociate.el
+++ b/lisp/play/dissociate.el
@@ -1,6 +1,6 @@
 ;;; dissociate.el --- scramble text amusingly for Emacs
 
-;; Copyright (C) 1985, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: games
diff --git a/lisp/play/doctor.el b/lisp/play/doctor.el
index 1bdb9df..b1ab670 100644
--- a/lisp/play/doctor.el
+++ b/lisp/play/doctor.el
@@ -1,6 +1,6 @@
 ;;; doctor.el --- psychological help for frustrated users
 
-;; Copyright (C) 1985, 1987, 1994, 1996, 2000-2018 Free Software
+;; Copyright (C) 1985, 1987, 1994, 1996, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el
index 2b8bd9d..0a9ab37 100644
--- a/lisp/play/dunnet.el
+++ b/lisp/play/dunnet.el
@@ -1,6 +1,6 @@
 ;;; dunnet.el --- text adventure for Emacs -*- lexical-binding: t -*-
 
-;; Copyright (C) 1992-1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Ron Schnell <address@hidden>
 ;; Created: 25 Jul 1992
diff --git a/lisp/play/fortune.el b/lisp/play/fortune.el
index 740f436..3c057f4 100644
--- a/lisp/play/fortune.el
+++ b/lisp/play/fortune.el
@@ -1,6 +1,6 @@
 ;;; fortune.el --- use fortune to create signatures
 
-;; Copyright (C) 1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Holger Schauer <address@hidden>
 ;; Keywords: games utils mail
diff --git a/lisp/play/gamegrid.el b/lisp/play/gamegrid.el
index 6edd085..430a207 100644
--- a/lisp/play/gamegrid.el
+++ b/lisp/play/gamegrid.el
@@ -1,6 +1,6 @@
 ;;; gamegrid.el --- library for implementing grid-based games on Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Glynn Clements <address@hidden>
 ;; Version: 1.02
@@ -318,19 +318,19 @@ format."
   (let ((data (gamegrid-match-spec-list data-spec-list))
        (color (gamegrid-match-spec-list color-spec-list)))
     (pcase data
-      (`color-x
+      ('color-x
        (gamegrid-make-color-x-face color))
-      (`grid-x
+      ('grid-x
        (unless gamegrid-grid-x-face
         (setq gamegrid-grid-x-face (gamegrid-make-grid-x-face)))
        gamegrid-grid-x-face)
-      (`mono-x
+      ('mono-x
        (unless gamegrid-mono-x-face
         (setq gamegrid-mono-x-face (gamegrid-make-mono-x-face)))
        gamegrid-mono-x-face)
-      (`color-tty
+      ('color-tty
        (gamegrid-make-color-tty-face color))
-      (`mono-tty
+      ('mono-tty
        (unless gamegrid-mono-tty-face
         (setq gamegrid-mono-tty-face (gamegrid-make-mono-tty-face)))
        gamegrid-mono-tty-face))))
@@ -557,7 +557,7 @@ On non-POSIX systems Emacs searches for FILE in the 
directory
 specified by the variable `temporary-file-directory'.  If necessary,
 FILE is created there."
   (pcase system-type
-    ((or `ms-dos `windows-nt)
+    ((or 'ms-dos 'windows-nt)
      (gamegrid-add-score-insecure file score))
     (_
      (gamegrid-add-score-with-update-game-score file score))))
diff --git a/lisp/play/gametree.el b/lisp/play/gametree.el
index 5b05ae1..c0226c8 100644
--- a/lisp/play/gametree.el
+++ b/lisp/play/gametree.el
@@ -1,6 +1,6 @@
 ;;; gametree.el --- manage game analysis trees in Emacs
 
-;; Copyright (C) 1997, 1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Ian T Zimmerman <address@hidden>
 ;; Created: Wed Dec 10 07:41:46 PST 1997
diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el
index 6ce2750..6d5553b 100644
--- a/lisp/play/gomoku.el
+++ b/lisp/play/gomoku.el
@@ -1,6 +1,6 @@
 ;;; gomoku.el --- Gomoku game between you and Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1988, 1994, 1996, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1988, 1994, 1996, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Philippe Schnoebelen <address@hidden>
@@ -656,48 +656,48 @@ that DVAL has been added on SQUARE."
     ((eq result 'emacs-won)
      (setq gomoku-number-of-emacs-wins (1+ gomoku-number-of-emacs-wins))
      (cond ((< gomoku-number-of-moves 20)
-           "This was a REALLY QUICK win.")
+           "I won...  I hope you like the game as you get better.")
           (gomoku-human-refused-draw
            "I won...  Too bad you refused my offer of a draw!")
           (gomoku-human-took-back
-           "I won...  Taking moves back will not help you!")
+           "I won...  It's OK to take back more moves next time.")
           ((not gomoku-emacs-played-first)
-           "I won...  Playing first did not help you much!")
+           "I won...  Use C-c C-b to take back a move on second thought.")
           ((and (zerop gomoku-number-of-human-wins)
                 (zerop gomoku-number-of-draws)
                 (> gomoku-number-of-emacs-wins 1))
-           "I'm becoming tired of winning...")
+           "I won...  It might be time take a break before trying again.")
           ("I won.")))
     ((eq result 'human-won)
      (setq gomoku-number-of-human-wins (1+ gomoku-number-of-human-wins))
      (concat "OK, you won this one."
             (cond
              (gomoku-human-took-back
-              "  I, for one, never take my moves back...")
+              "  For a bigger challenge, play without taking moves back.")
              (gomoku-emacs-played-first
-              ".. so what?")
-             ("  Now, let me play first just once."))))
+              "  Congratulations!")
+             ("  For a bigger challenge, let me play first."))))
     ((eq result 'human-resigned)
      (setq gomoku-number-of-emacs-wins (1+ gomoku-number-of-emacs-wins))
-     "So you resign.  That's just one more win for me.")
+     "I see that you resigned.  Better luck next time.")
     ((eq result 'nobody-won)
      (setq gomoku-number-of-draws (1+ gomoku-number-of-draws))
      (concat "This is a draw.  "
             (cond
              (gomoku-human-took-back
-              "I, for one, never take my moves back...")
+              "  For a bigger challenge, try without taking moves back.")
              (gomoku-emacs-played-first
-              "Just chance, I guess.")
-             ("Now, let me play first just once."))))
+              "Wow, that was a long game.  We both played well.")
+             ("  For a bigger challenge, let me play first."))))
     ((eq result 'draw-agreed)
      (setq gomoku-number-of-draws (1+ gomoku-number-of-draws))
      (concat "Draw agreed.  "
             (cond
              (gomoku-human-took-back
-              "I, for one, never take my moves back...")
+              "  For a bigger challenge, try without taking moves back.")
              (gomoku-emacs-played-first
-              "You were lucky.")
-             ("Now, let me play first just once."))))
+              "Good game.")
+             ("  For a bigger challenge, let me play first."))))
     ((eq result 'crash-game)
      "Sorry, I have been interrupted and cannot resume that game...")))
   (gomoku-display-statistics)
diff --git a/lisp/play/handwrite.el b/lisp/play/handwrite.el
index 85723a6..15fac08 100644
--- a/lisp/play/handwrite.el
+++ b/lisp/play/handwrite.el
@@ -1,6 +1,6 @@
 ;;; handwrite.el --- turns your emacs buffer into a handwritten document
 
-;; Copyright (C) 1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Danny Roozendaal (was: <address@hidden>)
 ;; Created: October 21 1996
diff --git a/lisp/play/hanoi.el b/lisp/play/hanoi.el
index 635e4a9..d762290 100644
--- a/lisp/play/hanoi.el
+++ b/lisp/play/hanoi.el
@@ -381,7 +381,7 @@ BITS must be of length nrings.  Start at START-TIME."
        (cl-loop for elapsed = (- (float-time) start-time)
                  while (< elapsed hanoi-move-period)
                  with tick-period = (/ (float hanoi-move-period) total-ticks)
-                 for tick = (ceiling (/ elapsed tick-period)) do
+                for tick = (ceiling elapsed tick-period) do
                  (hanoi-ring-to-pos ring (funcall tick-to-pos tick))
                  (hanoi-sit-for (- (* tick tick-period) elapsed)))
       (cl-loop for tick from 1 to total-ticks by 2 do
diff --git a/lisp/play/life.el b/lisp/play/life.el
index c15f72b..6cce1e5 100644
--- a/lisp/play/life.el
+++ b/lisp/play/life.el
@@ -1,6 +1,6 @@
 ;;; life.el --- John Horton Conway's `Life' game for GNU Emacs
 
-;; Copyright (C) 1988, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Kyle Jones <kyleuunet.uu.net>
 ;; Maintainer: address@hidden
diff --git a/lisp/play/morse.el b/lisp/play/morse.el
index 3205394..1f62ec3 100644
--- a/lisp/play/morse.el
+++ b/lisp/play/morse.el
@@ -1,6 +1,6 @@
 ;;; morse.el --- convert text to morse code and back
 
-;; Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Rick Farnbach <address@hidden>
 ;; Keywords: games
diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el
index c446dbe..b280a42 100644
--- a/lisp/play/mpuz.el
+++ b/lisp/play/mpuz.el
@@ -1,6 +1,6 @@
 ;;; mpuz.el --- multiplication puzzle for GNU Emacs
 
-;; Copyright (C) 1990, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Philippe Schnoebelen <address@hidden>
 ;; Overhauled: Daniel Pfeiffer <address@hidden>
diff --git a/lisp/play/pong.el b/lisp/play/pong.el
index 3b97af5..555c193 100644
--- a/lisp/play/pong.el
+++ b/lisp/play/pong.el
@@ -1,6 +1,6 @@
 ;;; pong.el --- classical implementation of pong
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Benjamin Drieu <address@hidden>
 ;; Keywords: games
diff --git a/lisp/play/snake.el b/lisp/play/snake.el
index 78cea3e..7c19733 100644
--- a/lisp/play/snake.el
+++ b/lisp/play/snake.el
@@ -1,6 +1,6 @@
 ;;; snake.el --- implementation of Snake for Emacs
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Glynn Clements <address@hidden>
 ;; Created: 1997-09-10
diff --git a/lisp/play/solitaire.el b/lisp/play/solitaire.el
index a1c8638..34b2c7c 100644
--- a/lisp/play/solitaire.el
+++ b/lisp/play/solitaire.el
@@ -1,6 +1,6 @@
 ;;; solitaire.el --- game of solitaire in Emacs Lisp
 
-;; Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Jan Schormann <address@hidden>
 ;; Created: Fri afternoon, Jun  3,  1994
diff --git a/lisp/play/spook.el b/lisp/play/spook.el
index 93ef021..d884c0a 100644
--- a/lisp/play/spook.el
+++ b/lisp/play/spook.el
@@ -1,6 +1,6 @@
 ;;; spook.el --- spook phrase utility for overloading the NSA line eater
 
-;; Copyright (C) 1988, 1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: games
diff --git a/lisp/play/tetris.el b/lisp/play/tetris.el
index 9d6a212..1e0681d 100644
--- a/lisp/play/tetris.el
+++ b/lisp/play/tetris.el
@@ -1,6 +1,6 @@
 ;;; tetris.el --- implementation of Tetris for Emacs
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Glynn Clements <address@hidden>
 ;; Version: 2.01
diff --git a/lisp/play/zone.el b/lisp/play/zone.el
index 4584d26..40d43dc 100644
--- a/lisp/play/zone.el
+++ b/lisp/play/zone.el
@@ -1,6 +1,6 @@
 ;;; zone.el --- idle display hacks
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Victor Zandy <address@hidden>
 ;; Maintainer: Thien-Thi Nguyen <address@hidden>
@@ -109,7 +109,7 @@ If the element is a function or a list of a function and a 
number,
   (save-window-excursion
     (let ((f (selected-frame))
           (outbuf (get-buffer-create "*zone*"))
-          (text (buffer-substring (window-start) (window-end)))
+          (text (buffer-substring (window-start) (window-end nil t)))
           (wp (1+ (- (window-point)
                      (window-start)))))
       (put 'zone 'orig-buffer (current-buffer))
diff --git a/lisp/plstore.el b/lisp/plstore.el
index bbee41c..f24bac3 100644
--- a/lisp/plstore.el
+++ b/lisp/plstore.el
@@ -1,5 +1,5 @@
 ;;; plstore.el --- secure plist store -*- lexical-binding: t -*-
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Daiki Ueno <address@hidden>
 ;; Keywords: PGP, GnuPG
diff --git a/lisp/printing.el b/lisp/printing.el
index 2fc2323..27856eb 100644
--- a/lisp/printing.el
+++ b/lisp/printing.el
@@ -1,6 +1,6 @@
 ;;; printing.el --- printing utilities
 
-;; Copyright (C) 2000-2001, 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2001, 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
@@ -5672,7 +5672,7 @@ If menu binding was not done, calls `pr-menu-bind'."
 (defun pr-switches (switches mess)
   (or (listp switches)
       (error "%S should have a list of strings" mess))
-  (lpr-flatten-list                    ; dynamic evaluation
+  (flatten-tree                        ; dynamic evaluation
    (mapcar #'lpr-eval-switch switches)))
 
 
diff --git a/lisp/proced.el b/lisp/proced.el
index 45ed273..ce379a7 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -1,6 +1,6 @@
 ;;; proced.el --- operate on system processes like dired
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Roland Winkler <address@hidden>
 ;; Keywords: Processes, Unix
@@ -1348,7 +1348,7 @@ Prefix ARG controls sort order, see 
`proced-sort-interactive'."
 
 (defun proced-format-time (time)
   "Format time interval TIME."
-  (let* ((ftime (float-time time))
+  (let* ((ftime (encode-time time 'integer))
          (days (truncate ftime 86400))
          (ftime (mod ftime 86400))
          (hours (truncate ftime 3600))
diff --git a/lisp/profiler.el b/lisp/profiler.el
index 41dea68..45dc1d1 100644
--- a/lisp/profiler.el
+++ b/lisp/profiler.el
@@ -1,6 +1,6 @@
 ;;; profiler.el --- UI and helper functions for Emacs's native profiler -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Tomohiro Matsuyama <address@hidden>
 ;; Keywords: lisp
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el
index fd6a2b0..e01f1e8 100644
--- a/lisp/progmodes/ada-mode.el
+++ b/lisp/progmodes/ada-mode.el
@@ -1,6 +1,6 @@
 ;;; ada-mode.el --- major-mode for editing Ada sources
 
-;; Copyright (C) 1994-1995, 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Rolf Ebert      <address@hidden>
 ;;      Markus Heritsch <address@hidden>
@@ -767,7 +767,7 @@ the 4 file locations can be clicked on and jumped to."
   (interactive "d")
   (goto-char pos)
 
-  (skip-chars-backward "-a-zA-Z0-9_:./\\")
+  (skip-chars-backward "-a-zA-Z0-9_:./\\\\")
   (cond
    ;;  special case: looking at a filename:line not at the beginning of a line
    ;;  or a simple line reference "at line ..."
diff --git a/lisp/progmodes/ada-prj.el b/lisp/progmodes/ada-prj.el
index 91c8091..d9fa77c 100644
--- a/lisp/progmodes/ada-prj.el
+++ b/lisp/progmodes/ada-prj.el
@@ -1,6 +1,6 @@
 ;;; ada-prj.el --- GUI editing of project files for the ada-mode
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Emmanuel Briot <address@hidden>
 ;; Maintainer: Stephen Leake <address@hidden>
diff --git a/lisp/progmodes/ada-stmt.el b/lisp/progmodes/ada-stmt.el
index f1ed01e..ef42b0d 100644
--- a/lisp/progmodes/ada-stmt.el
+++ b/lisp/progmodes/ada-stmt.el
@@ -1,6 +1,6 @@
 ;;; ada-stmt.el --- an extension to Ada mode for inserting statement templates
 
-;; Copyright (C) 1987, 1993-1994, 1996-2018 Free Software Foundation,
+;; Copyright (C) 1987, 1993-1994, 1996-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Authors: Daniel Pfeiffer
diff --git a/lisp/progmodes/ada-xref.el b/lisp/progmodes/ada-xref.el
index 359c187..c9c923e 100644
--- a/lisp/progmodes/ada-xref.el
+++ b/lisp/progmodes/ada-xref.el
@@ -1,6 +1,6 @@
 ;; ada-xref.el --- for lookup and completion in Ada mode
 
-;; Copyright (C) 1994-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
 ;; Author: Markus Heritsch <address@hidden>
 ;;      Rolf Ebert <address@hidden>
@@ -416,7 +416,7 @@ As a special case, ${current} is replaced with the name of 
the current
 file, minus extension but with directory, and ${full_current} is
 replaced by the name including the extension."
 
-  (while (string-match "\\(-[^-$IO]*[IO]\\)?${\\([^}]+\\)}" cmd-string)
+  (while (string-match "\\(-[^-$IO]*[IO]\\)?\\${\\([^}]+\\)}" cmd-string)
     (let (value
          (name (match-string 2 cmd-string)))
       (cond
@@ -1133,8 +1133,7 @@ If OTHER-FRAME is non-nil, display the cross-reference in 
another frame."
        (ada-find-in-ali identlist other-frame)
       ;; File not found: print explicit error message
       (ada-error-file-not-found
-       (message (concat (error-message-string err)
-                       (nthcdr 1 err))))
+       (message "%s%s" (error-message-string err) (nthcdr 1 err)))
 
       (error
        (let ((ali-file (ada-get-ali-file-name (ada-file-of identlist))))
diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el
index 775fd87..40bef0b 100644
--- a/lisp/progmodes/antlr-mode.el
+++ b/lisp/progmodes/antlr-mode.el
@@ -1,6 +1,6 @@
 ;;; antlr-mode.el --- major mode for ANTLR grammar files
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Christoph Wedler <address@hidden>
 ;; Keywords: languages, ANTLR, code generator
diff --git a/lisp/progmodes/asm-mode.el b/lisp/progmodes/asm-mode.el
index fb16828..c56d16e 100644
--- a/lisp/progmodes/asm-mode.el
+++ b/lisp/progmodes/asm-mode.el
@@ -1,6 +1,6 @@
 ;;; asm-mode.el --- mode for editing assembler code
 
-;; Copyright (C) 1991, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/progmodes/autoconf.el b/lisp/progmodes/autoconf.el
index 59f4b07..9d70aeb 100644
--- a/lisp/progmodes/autoconf.el
+++ b/lisp/progmodes/autoconf.el
@@ -1,6 +1,6 @@
 ;;; autoconf.el --- mode for editing Autoconf configure.ac files
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;; Keywords: languages
@@ -84,7 +84,7 @@ searching backwards at another AC_... command."
   (setq-local syntax-propertize-function
              (syntax-propertize-rules ("\\<dnl\\>" (0 "<"))))
   (setq-local font-lock-defaults
-             `(autoconf-font-lock-keywords nil nil))
+             '(autoconf-font-lock-keywords nil nil))
   (setq-local imenu-generic-expression autoconf-imenu-generic-expression)
   (setq-local indent-line-function #'indent-relative)
   (setq-local add-log-current-defun-function
diff --git a/lisp/progmodes/bat-mode.el b/lisp/progmodes/bat-mode.el
index 51acc6a..6c85ff9 100644
--- a/lisp/progmodes/bat-mode.el
+++ b/lisp/progmodes/bat-mode.el
@@ -1,6 +1,6 @@
 ;;; bat-mode.el --- Major mode for editing DOS/Windows scripts
 
-;; Copyright (C) 2003, 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003, 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Arni Magnusson <address@hidden>
 ;; Keywords: languages
diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el
index 75bd0ba..8baf748 100644
--- a/lisp/progmodes/bug-reference.el
+++ b/lisp/progmodes/bug-reference.el
@@ -1,6 +1,6 @@
 ;; bug-reference.el --- buttonize bug references
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Tom Tromey <address@hidden>
 ;; Created: 21 Mar 2007
diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el
index 1b48a5a..009f58e 100644
--- a/lisp/progmodes/cc-align.el
+++ b/lisp/progmodes/cc-align.el
@@ -1,6 +1,6 @@
 ;;; cc-align.el --- custom indentation functions for CC Mode
 
-;; Copyright (C) 1985, 1987, 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2019 Free Software Foundation, Inc.
 
 ;; Authors:    2004- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -1083,6 +1083,130 @@ arglist-cont."
              (vector (+ (current-column) c-basic-offset))))
        (vector 0)))))
 
+(defun c-lineup-2nd-brace-entry-in-arglist (langelem)
+  "Lineup the second entry of a brace block under the first, when the first
+line is also contained in an arglist or an enclosing brace ON THAT LINE.
+
+I.e. handle something like the following:
+
+    set_line (line_t {point_t{0.4, 0.2},
+                      point_t{0.2, 0.5},       <---- brace-list-intro
+                      .....});
+             ^ enclosing parenthesis.
+
+The middle line of that example will have a syntactic context
+with three syntactic symbols, arglist-cont-nonempty, brace-list-intro, and
+brace-list-entry.
+
+This function is intended for use in a list.  If the construct
+being analyzed isn't like the preceding, the function returns nil.
+Otherwise it returns the function `c-lineup-arglist-intro-after-paren', which
+the caller then uses to perform indentation.
+
+Works with brace-list-intro."
+  ;; brace-list-intro and brace-list-entry are both present for the second
+  ;; entry of the list when the first entry is on the same line as the opening
+  ;; brace.
+  (and (assq 'brace-list-intro c-syntactic-context)
+       (assq 'brace-list-entry c-syntactic-context)
+       (or (assq 'arglist-cont-nonempty c-syntactic-context) ; "(" earlier on
+                                                            ; the line.
+          (save-excursion              ; "{" earlier on the line
+            (goto-char (c-langelem-pos
+                        (assq 'brace-list-intro c-syntactic-context)))
+            (and
+             (eq (c-backward-token-2
+                  1 nil
+                  (c-point 'bol (c-langelem-pos
+                                 (assq 'brace-list-entry
+                                       c-syntactic-context))))
+                 0)
+             (eq (char-after) ?{))))
+       'c-lineup-arglist-intro-after-paren))
+
+(defun c-lineup-class-decl-init-+ (langelem)
+  "Line up the second entry of a class (etc.) initializer c-basic-offset
+characters in from the identifier when:
+\(i) The type is a class, struct, union, etc. (but not an enum);
+\(ii) There is a brace block in the type declaration, specifying it; and
+\(iii) The first element of the initializer is on the same line as its opening
+brace.
+
+I.e. we have a construct like this:
+
+    struct STR {
+        int i; float f;
+    } str_1 = {1, 1.7},
+        str_2 = {2,
+             3.1                   <---- brace-list-intro
+        };
+        <-->                       <---- c-basic-offset
+
+Note that the syntactic context of the brace-list-intro line also has a
+syntactic element with the symbol brace-list-entry.
+
+This function is intended for use in a list.  If the above structure isn't
+present, this function returns nil, allowing a different offset specification
+to indent the line.
+
+Works with: brace-list-intro."
+  (and (assq 'brace-list-intro c-syntactic-context)
+       (assq 'brace-list-entry c-syntactic-context)
+       (let ((init-pos (c-point 'boi (c-langelem-pos
+                                     (assq 'brace-list-entry
+                                           c-syntactic-context))))
+            )
+        (save-excursion
+          (goto-char (c-langelem-pos (assq 'brace-list-intro
+                                           c-syntactic-context)))
+          (and
+           (c-forward-class-decl)
+           (not (c-do-declarators init-pos t nil nil nil))
+           (eq (point) init-pos)
+           (vector (+ (current-column) c-basic-offset)))))))
+
+(defun c-lineup-class-decl-init-after-brace (langelem)
+  "Line up the second entry of a class (etc.) initializer after its opening
+brace when:
+\(i) The type is a class, struct, union, etc. (but not an enum);
+\(ii) There is a brace block in the type declaration, specifying it; and
+\(iii) The first element of the initializer is on the same line as its opening
+brace.
+
+I.e. we have a construct like this:
+
+    struct STR {
+        int i; float f;
+    } str_1 = {1, 1.7},
+        str_2 = {2,
+                 3.1                   <---- brace-list-intro
+        };
+
+Note that the syntactic context of the brace-list-intro line also has a
+syntactic element with the symbol brace-list-entry.  Also note that this
+function works by returning the symbol `c-lineup-arglist-intro-after-paren',
+which the caller then uses to perform the indentation.
+
+This function is intended for use in a list.  If the above structure isn't
+present, this function returns nil, allowing a different offset specification
+to indent the line.
+
+Works with: brace-list-intro."
+  (and (assq 'brace-list-intro c-syntactic-context)
+       (assq 'brace-list-entry c-syntactic-context)
+       (let ((init-pos (c-point 'boi (c-langelem-pos
+                                     (assq 'brace-list-entry
+                                           c-syntactic-context))))
+            )
+        (save-excursion
+          (goto-char (c-langelem-pos (assq 'brace-list-intro
+                                           c-syntactic-context)))
+          (and
+           (c-forward-class-decl)
+           (not (c-do-declarators init-pos t nil nil nil))
+           (eq (point) init-pos)
+           'c-lineup-arglist-intro-after-paren)))))
+
 (defun c-lineup-cpp-define (_langelem)
   "Line up macro continuation lines according to the indentation of
 the construct preceding the macro.  E.g.:
diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el
index 4c04b59..70aa3c4 100644
--- a/lisp/progmodes/cc-awk.el
+++ b/lisp/progmodes/cc-awk.el
@@ -1,6 +1,6 @@
 ;;; cc-awk.el --- AWK specific code within cc-mode.
 
-;; Copyright (C) 1988, 1994, 1996, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1988, 1994, 1996, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Alan Mackenzie <address@hidden> (originally based on awk-mode.el)
@@ -130,7 +130,7 @@
 ;; REGEXPS FOR "HARMLESS" STRINGS/LINES.
 (defconst c-awk-harmless-_ "_\\([^\"]\\|\\'\\)")
 ;;   Matches an underline NOT followed by ".
-(defconst c-awk-harmless-char-re "[^_#/\"{}();\\\\\n\r]")
+(defconst c-awk-harmless-char-re "[^_#/\"{}();\\\n\r]")
 ;;   Matches any character not significant in the state machine applying
 ;; syntax-table properties to "s and /s.
 (defconst c-awk-harmless-string*-re
@@ -141,7 +141,7 @@
   (concat "\\=" c-awk-harmless-string*-re))
 ;; Matches the (possibly empty) sequence of "insignificant" chars at point.
 
-(defconst c-awk-harmless-line-char-re "[^_#/\"\\\\\n\r]")
+(defconst c-awk-harmless-line-char-re "[^_#/\"\\\n\r]")
 ;;   Matches any character but a _, #, /, ", \, or newline.  N.B. _" starts a
 ;; localization string in gawk 3.1
 (defconst c-awk-harmless-line-string*-re
@@ -188,8 +188,8 @@
   "\\[:[a-z]+:\\]")
   ;; Matches a character class spec (e.g. [:alpha:]).
 (defconst c-awk-regexp-char-list-re
-  (concat "\\[" c-awk-escaped-newlines*-re "^?" c-awk-escaped-newlines*-re "]?"
-          "\\(" c-awk-esc-pair-re "\\|" c-awk-regexp-char-class-re
+  (concat "\\[\\(" c-awk-escaped-newlines*-re "\\^\\)?" 
c-awk-escaped-newlines*-re "]?"
+         "\\(" c-awk-esc-pair-re "\\|" c-awk-regexp-char-class-re
          "\\|" "[^]\n\r]" "\\)*" "\\(]\\|$\\)"))
 ;;   Matches a regexp char list, up to (but not including) EOL if the ] is
 ;;   missing.
@@ -250,7 +250,7 @@
 ;; which can precede an expression.
 
 ;; REGEXPS USED FOR FINDING THE POSITION OF A "virtual semicolon"
-(defconst c-awk-_-harmless-nonws-char-re "[^#/\"\\\\\n\r \t]")
+(defconst c-awk-_-harmless-nonws-char-re "[^#/\"\\\n\r \t]")
 (defconst c-awk-non-/-syn-ws*-re
   (concat
    "\\(" c-awk-escaped-nls*-with-space*
diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el
index 754edf9..0cbff57 100644
--- a/lisp/progmodes/cc-bytecomp.el
+++ b/lisp/progmodes/cc-bytecomp.el
@@ -1,6 +1,6 @@
 ;;; cc-bytecomp.el --- compile time setup for proper compilation
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author:     Martin Stjernholm
 ;; Maintainer: address@hidden
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 0269c01..efc6747 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -1,6 +1,6 @@
 ;;; cc-cmds.el --- user level commands for CC Mode
 
-;; Copyright (C) 1985, 1987, 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2019 Free Software Foundation, Inc.
 
 ;; Authors:    2003- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -47,6 +47,7 @@
 ;; Silence the compiler.
 (cc-bytecomp-defvar filladapt-mode)    ; c-fill-paragraph contains a kludge
                                        ; which looks at this.
+(cc-bytecomp-defun electric-pair-post-self-insert-function)
 
 ;; Indentation / Display syntax functions
 (defvar c-fix-backslashes t)
@@ -503,7 +504,8 @@ inside a literal or a macro, nothing special happens."
                          (eq (char-before) ?\\))))
            (c-in-literal)))
       ;; do nothing special
-      (self-insert-command (prefix-numeric-value arg))
+      (let (post-self-insert-hook)     ; Disable random functionality.
+       (self-insert-command (prefix-numeric-value arg)))
     ;; place the pound character at the left edge
     (let ((pos (- (point-max) (point)))
          (bolp (bolp)))
@@ -694,6 +696,134 @@ inside a literal or a macro, nothing special happens."
                            t))))
          (goto-char (- (point-max) pos))))))
 
+(defun c-do-brace-electrics (before after)
+  ;; Point is just after a brace.  Indent the various lines, add any required
+  ;; auto newlines, and apply pertinent clean ups.  It is assumed that the
+  ;; caller has checked that point is at EOL if need be, and that the brace is
+  ;; not in a comment or string, and suchlike.
+  ;;
+  ;; BEFORE and AFTER qualify the newlines required before and after the
+  ;; brace as follows:
+  ;; If
+  ;;  o - nil: insert a newline or not according to `c-hanging-braces-alist'.
+  ;;  o - 'ignore: don't insert a newline.
+  ;;  o - 'assume: insert a newline.
+  ;;
+  ;; The return value has no significance.
+  (let (;; shut this up too
+       (c-echo-syntactic-information-p nil)
+       newlines
+       ln-syntax br-syntax syntax)  ; Syntactic context of the original line,
+                                       ; of the brace itself, of the line the
+                                       ; brace ends up on.
+    (c-save-buffer-state ((c-syntactic-indentation-in-macros t)
+                         (c-auto-newline-analysis t))
+      (setq ln-syntax (c-guess-basic-syntax)))
+    (if c-syntactic-indentation
+       (c-indent-line ln-syntax))
+
+    (when c-auto-newline
+      (backward-char)
+      (setq br-syntax (c-point-syntax)
+           newlines (c-brace-newlines br-syntax))
+
+      ;; Insert the BEFORE newline, if wanted, and reindent the newline.
+      (if (or (and (null before) (memq 'before newlines)
+                  (> (current-column) (current-indentation)))
+             (eq before 'assume))
+         (if c-syntactic-indentation
+             ;; Only a plain newline for now - it's indented
+             ;; after the cleanups when the line has its final
+             ;; appearance.
+             (newline)
+           (c-newline-and-indent)))
+      (forward-char)
+
+      ;; `syntax' is the syntactic context of the line which ends up
+      ;; with the brace on it.
+      (setq syntax (if (memq 'before newlines) br-syntax ln-syntax))
+
+      ;; Do all appropriate clean ups
+      (let ((here (point))
+           (pos (- (point-max) (point)))
+           mbeg mend
+           )
+
+       ;; `}': clean up empty defun braces
+       (when (c-save-buffer-state ()
+               (and (memq 'empty-defun-braces c-cleanup-list)
+                    (eq (c-last-command-char) ?\})
+                    (c-intersect-lists '(defun-close class-close inline-close)
+                                       syntax)
+                    (progn
+                      (forward-char -1)
+                      (c-skip-ws-backward)
+                      (eq (char-before) ?\{))
+                    ;; make sure matching open brace isn't in a comment
+                    (not (c-in-literal))))
+         (delete-region (point) (1- here))
+         (setq here (- (point-max) pos)))
+       (goto-char here)
+
+       ;; `}': compact to a one-liner defun?
+       (save-match-data
+         (when
+             (and (eq (c-last-command-char) ?\})
+                  (memq 'one-liner-defun c-cleanup-list)
+                  (c-intersect-lists '(defun-close) syntax)
+                  (c-try-one-liner))
+           (setq here (- (point-max) pos))))
+
+       ;; `{': clean up brace-else-brace and brace-elseif-brace
+       (when (eq (c-last-command-char) ?\{)
+         (cond
+          ((and (memq 'brace-else-brace c-cleanup-list)
+                (re-search-backward
+                 (concat "}"
+                         "\\([ \t\n]\\|\\\\\n\\)*"
+                         "else"
+                         "\\([ \t\n]\\|\\\\\n\\)*"
+                         "{"
+                         "\\=")
+                 nil t))
+           (delete-region (match-beginning 0) (match-end 0))
+           (insert-and-inherit "} else {"))
+          ((and (memq 'brace-elseif-brace c-cleanup-list)
+                (progn
+                  (goto-char (1- here))
+                  (setq mend (point))
+                  (c-skip-ws-backward)
+                  (setq mbeg (point))
+                  (eq (char-before) ?\)))
+                (zerop (c-save-buffer-state nil (c-backward-token-2 1 t)))
+                (eq (char-after) ?\()
+                (re-search-backward
+                 (concat "}"
+                         "\\([ \t\n]\\|\\\\\n\\)*"
+                         "else"
+                         "\\([ \t\n]\\|\\\\\n\\)+"
+                         "if"
+                         "\\([ \t\n]\\|\\\\\n\\)*"
+                         "\\=")
+                 nil t))
+           (delete-region mbeg mend)
+           (goto-char mbeg)
+           (insert ?\ ))))
+
+       (goto-char (- (point-max) pos))
+
+       ;; Indent the line after the cleanups since it might
+       ;; very well indent differently due to them, e.g. if
+       ;; c-indent-one-line-block is used together with the
+       ;; one-liner-defun cleanup.
+       (when c-syntactic-indentation
+         (c-indent-line)))
+
+      ;; does a newline go after the brace?
+      (if (or (and (null after) (memq 'after newlines))
+             (eq after 'assume))
+         (c-newline-and-indent)))))
+
 (defun c-electric-brace (arg)
   "Insert a brace.
 
@@ -716,7 +846,10 @@ settings of `c-cleanup-list' are done."
        ;; We want to inhibit blinking the paren since this would be
        ;; most disruptive.  We'll blink it ourselves later on.
        (old-blink-paren blink-paren-function)
-       blink-paren-function case-fold-search)
+       blink-paren-function case-fold-search
+       (at-eol (looking-at "[ \t]*\\\\?$"))
+       (active-region (and (fboundp 'use-region-p) (use-region-p)))
+       got-pair-} electric-pair-deletion)
 
     (c-save-buffer-state ()
       (setq safepos (c-safe-position (point) (c-parse-state))
@@ -724,128 +857,36 @@ settings of `c-cleanup-list' are done."
 
     ;; Insert the brace.  Note that expand-abbrev might reindent
     ;; the line here if there's a preceding "else" or something.
-    (self-insert-command (prefix-numeric-value arg))
-
-    (when (and c-electric-flag (not literal) (not arg))
-      (if (not (looking-at "[ \t]*\\\\?$"))
-         (if c-syntactic-indentation
-             (indent-according-to-mode))
-
-       (let ( ;; shut this up too
-             (c-echo-syntactic-information-p nil)
-             newlines
-             ln-syntax br-syntax syntax) ; Syntactic context of the original 
line,
-                       ; of the brace itself, of the line the brace ends up on.
-         (c-save-buffer-state ((c-syntactic-indentation-in-macros t)
-                               (c-auto-newline-analysis t))
-           (setq ln-syntax (c-guess-basic-syntax)))
-         (if c-syntactic-indentation
-             (c-indent-line ln-syntax))
-
-         (when c-auto-newline
-           (backward-char)
-           (setq br-syntax (c-point-syntax)
-                 newlines (c-brace-newlines br-syntax))
-
-           ;; Insert the BEFORE newline, if wanted, and reindent the newline.
-           (if (and (memq 'before newlines)
-                    (> (current-column) (current-indentation)))
-               (if c-syntactic-indentation
-                   ;; Only a plain newline for now - it's indented
-                   ;; after the cleanups when the line has its final
-                   ;; appearance.
-                   (newline)
-                 (c-newline-and-indent)))
+    (let (post-self-insert-hook) ; the only way to get defined functionality
+                                ; from `self-insert-command'.
+      (self-insert-command (prefix-numeric-value arg)))
+
+    ;; Emulate `electric-pair-mode'.
+    (when (and (boundp 'electric-pair-mode)
+              electric-pair-mode)
+      (let ((size (buffer-size))
+           (c-in-electric-pair-functionality t)
+           post-self-insert-hook)
+       (electric-pair-post-self-insert-function)
+       (setq got-pair-} (and at-eol
+                             (eq (c-last-command-char) ?{)
+                             (eq (char-after) ?}))
+             electric-pair-deletion (< (buffer-size) size))))
+
+    ;; Perform any required CC Mode electric actions.
+    (cond
+     ((or literal arg (not c-electric-flag) active-region))
+     ((not at-eol)
+      (c-indent-line))
+     (electric-pair-deletion
+      (c-indent-line)
+      (c-do-brace-electrics 'ignore nil))
+     (t (c-do-brace-electrics nil nil)
+       (when got-pair-}
+         (save-excursion
            (forward-char)
-
-           ;; `syntax' is the syntactic context of the line which ends up
-           ;; with the brace on it.
-           (setq syntax (if (memq 'before newlines) br-syntax ln-syntax))
-
-           ;; Do all appropriate clean ups
-           (let ((here (point))
-                 (pos (- (point-max) (point)))
-                 mbeg mend
-                 )
-
-             ;; `}': clean up empty defun braces
-             (when (c-save-buffer-state ()
-                     (and (memq 'empty-defun-braces c-cleanup-list)
-                          (eq (c-last-command-char) ?\})
-                          (c-intersect-lists '(defun-close class-close 
inline-close)
-                                             syntax)
-                          (progn
-                            (forward-char -1)
-                            (c-skip-ws-backward)
-                            (eq (char-before) ?\{))
-                          ;; make sure matching open brace isn't in a comment
-                          (not (c-in-literal))))
-               (delete-region (point) (1- here))
-               (setq here (- (point-max) pos)))
-             (goto-char here)
-
-             ;; `}': compact to a one-liner defun?
-             (save-match-data
-               (when
-                   (and (eq (c-last-command-char) ?\})
-                        (memq 'one-liner-defun c-cleanup-list)
-                        (c-intersect-lists '(defun-close) syntax)
-                        (c-try-one-liner))
-                 (setq here (- (point-max) pos))))
-
-             ;; `{': clean up brace-else-brace and brace-elseif-brace
-             (when (eq (c-last-command-char) ?\{)
-               (cond
-                ((and (memq 'brace-else-brace c-cleanup-list)
-                      (re-search-backward
-                       (concat "}"
-                               "\\([ \t\n]\\|\\\\\n\\)*"
-                               "else"
-                               "\\([ \t\n]\\|\\\\\n\\)*"
-                               "{"
-                               "\\=")
-                       nil t))
-                 (delete-region (match-beginning 0) (match-end 0))
-                 (insert-and-inherit "} else {"))
-                ((and (memq 'brace-elseif-brace c-cleanup-list)
-                      (progn
-                        (goto-char (1- here))
-                        (setq mend (point))
-                        (c-skip-ws-backward)
-                        (setq mbeg (point))
-                        (eq (char-before) ?\)))
-                      (zerop (c-save-buffer-state nil (c-backward-token-2 1 
t)))
-                      (eq (char-after) ?\()
-                     ; (progn
-                       ; (setq tmp (point))
-                        (re-search-backward
-                         (concat "}"
-                                 "\\([ \t\n]\\|\\\\\n\\)*"
-                                 "else"
-                                 "\\([ \t\n]\\|\\\\\n\\)+"
-                                 "if"
-                                 "\\([ \t\n]\\|\\\\\n\\)*"
-                                 "\\=")
-                         nil t);)
-                      ;(eq (match-end 0) tmp);
-                        )
-                 (delete-region mbeg mend)
-                 (goto-char mbeg)
-                 (insert ?\ ))))
-
-             (goto-char (- (point-max) pos))
-
-             ;; Indent the line after the cleanups since it might
-             ;; very well indent differently due to them, e.g. if
-             ;; c-indent-one-line-block is used together with the
-             ;; one-liner-defun cleanup.
-             (when c-syntactic-indentation
-               (c-indent-line)))
-
-           ;; does a newline go after the brace?
-           (if (memq 'after newlines)
-               (c-newline-and-indent))
-           ))))
+           (c-do-brace-electrics 'assume 'ignore))
+         (c-indent-line))))
 
     ;; blink the paren
     (and (eq (c-last-command-char) ?\})
@@ -903,7 +944,8 @@ is inhibited."
                       c-electric-flag
                       (eq (c-last-command-char) ?/)
                       (eq (char-before) (if literal ?* ?/))))
-    (self-insert-command (prefix-numeric-value arg))
+    (let (post-self-insert-hook)       ; Disable random functionality.
+      (self-insert-command (prefix-numeric-value arg)))
     (if indentp
        (indent-according-to-mode))))
 
@@ -916,7 +958,8 @@ supplied, point is inside a literal, or 
`c-syntactic-indentation' is nil,
 this indentation is inhibited."
 
   (interactive "*P")
-  (self-insert-command (prefix-numeric-value arg))
+  (let (post-self-insert-hook)         ; Disable random functionality.
+    (self-insert-command (prefix-numeric-value arg)))
   ;; if we are in a literal, or if arg is given do not reindent the
   ;; current line, unless this star introduces a comment-only line.
   (if (c-save-buffer-state ()
@@ -963,7 +1006,8 @@ settings of `c-cleanup-list'."
       (setq lim (c-most-enclosing-brace (c-parse-state))
            literal (c-in-literal lim)))
 
-    (self-insert-command (prefix-numeric-value arg))
+    (let (post-self-insert-hook)       ; Disable random functionality.
+      (self-insert-command (prefix-numeric-value arg)))
 
     (if (and c-electric-flag (not literal) (not arg))
        ;; do all cleanups and newline insertions if c-auto-newline is on.
@@ -1032,7 +1076,8 @@ reindented unless `c-syntactic-indentation' is nil.
         newlines is-scope-op
         ;; shut this up
         (c-echo-syntactic-information-p nil))
-    (self-insert-command (prefix-numeric-value arg))
+    (let (post-self-insert-hook)       ; Disable random functionality.
+      (self-insert-command (prefix-numeric-value arg)))
     ;; Any electric action?
     (if (and c-electric-flag (not literal) (not arg))
        ;; Unless we're at EOL, only re-indentation happens.
@@ -1122,49 +1167,76 @@ finishes a C++ style stream operator in C++ mode.  
Exceptions are when a
 numeric argument is supplied, or the point is inside a literal."
 
   (interactive "*P")
-  (let ((c-echo-syntactic-information-p nil)
+  (let ((literal (c-save-buffer-state () (c-in-literal)))
+       template-delim include-delim
+       (c-echo-syntactic-information-p nil)
        final-pos found-delim case-fold-search)
 
-    (self-insert-command (prefix-numeric-value arg))
+    (let (post-self-insert-hook)       ; Disable random functionality.
+      (self-insert-command (prefix-numeric-value arg)))
     (setq final-pos (point))
 
 ;;;; 2010-01-31: There used to be code here to put a syntax-table text
 ;;;; property on the new < or > and its mate (if any) when they are template
 ;;;; parens.  This is now done in an after-change function.
 
-    ;; Indent the line if appropriate.
-    (when (and c-electric-flag c-syntactic-indentation c-recognize-<>-arglists)
-      (setq found-delim
-           (if (eq (c-last-command-char) ?<)
-               ;; If a <, basically see if it's got "template" before it .....
-               (or (and (progn
-                          (backward-char)
-                          (= (point)
-                             (progn (c-beginning-of-current-token) (point))))
-                        (progn
-                          (c-backward-token-2)
-                          (looking-at c-opt-<>-sexp-key)))
-                   ;; ..... or is a C++ << operator.
+    (when (and (not arg) (not literal))
+      ;; Have we got a delimiter on a #include directive?
+      (beginning-of-line)
+      (setq include-delim
+           (and
+            (looking-at c-cpp-include-key)
+            (if (eq (c-last-command-char) ?<)
+                (eq (match-end 0) (1- final-pos))
+              (goto-char (1- final-pos))
+              (skip-chars-backward "^<>" (c-point 'bol))
+              (eq (char-before) ?<))))
+      (goto-char final-pos)
+
+      ;; Indent the line if appropriate.
+      (when (and c-electric-flag c-syntactic-indentation 
c-recognize-<>-arglists)
+       (setq found-delim
+             (if (eq (c-last-command-char) ?<)
+                 ;; If a <, basically see if it's got "template" before it 
.....
+                 (or (and (progn
+                            (backward-char)
+                            (= (point)
+                               (progn (c-beginning-of-current-token) (point))))
+                          (progn
+                            (c-backward-token-2)
+                            (looking-at c-opt-<>-sexp-key))
+                          (setq template-delim t))
+                     ;; ..... or is a C++ << operator.
+                     (and (c-major-mode-is 'c++-mode)
+                          (progn
+                            (goto-char (1- final-pos))
+                            (c-beginning-of-current-token)
+                            (looking-at "<<"))
+                          (>= (match-end 0) final-pos)))
+
+               ;; It's a >.  Either a template/generic terminator ...
+               (or (and (c-get-char-property (1- final-pos) 'syntax-table)
+                        (setq template-delim t))
+                   ;; or a C++ >> operator.
                    (and (c-major-mode-is 'c++-mode)
                         (progn
                           (goto-char (1- final-pos))
                           (c-beginning-of-current-token)
-                          (looking-at "<<"))
-                        (>= (match-end 0) final-pos)))
+                          (looking-at ">>"))
+                        (>= (match-end 0) final-pos)))))
+       (goto-char final-pos)
 
-             ;; It's a >.  Either a template/generic terminator ...
-             (or (c-get-char-property (1- final-pos) 'syntax-table)
-                 ;; or a C++ >> operator.
-                 (and (c-major-mode-is 'c++-mode)
-                      (progn
-                        (goto-char (1- final-pos))
-                        (c-beginning-of-current-token)
-                        (looking-at ">>"))
-                      (>= (match-end 0) final-pos))))))
+       (when found-delim
+         (indent-according-to-mode)))
+
+      ;; On the off chance that < and > are configured as pairs in
+      ;; electric-pair-mode.
+      (when (and (boundp 'electric-pair-mode) electric-pair-mode
+                (or template-delim include-delim))
+       (let (post-self-insert-hook)
+         (electric-pair-post-self-insert-function))))
 
-    (goto-char final-pos)
     (when found-delim
-      (indent-according-to-mode)
       (when (and (eq (char-before) ?>)
                 (not executing-kbd-macro)
                 blink-paren-function)
@@ -1190,10 +1262,12 @@ newline cleanups are done if appropriate; see the 
variable `c-cleanup-list'."
        ;; shut this up
        (c-echo-syntactic-information-p nil)
        case-fold-search)
-    (self-insert-command (prefix-numeric-value arg))
+    (let (post-self-insert-hook) ; The only way to get defined functionality
+                                ; from `self-insert-command'.
+      (self-insert-command (prefix-numeric-value arg)))
 
     (if (and (not arg) (not literal))
-       (let* ( ;; We want to inhibit blinking the paren since this will
+       (let* (;; We want to inhibit blinking the paren since this will
               ;; be most disruptive.  We'll blink it ourselves
               ;; afterwards.
               (old-blink-paren blink-paren-function)
@@ -1239,6 +1313,12 @@ newline cleanups are done if appropriate; see the 
variable `c-cleanup-list'."
              (delete-region (match-beginning 0) (match-end 0))
              (insert-and-inherit "} catch (")))
 
+         ;; Apply `electric-pair-mode' stuff.
+         (when (and (boundp 'electric-pair-mode)
+                    electric-pair-mode)
+           (let (post-self-insert-hook)
+             (electric-pair-post-self-insert-function)))
+
          ;; Check for clean-ups at function calls.  These two DON'T need
          ;; `c-electric-flag' or `c-syntactic-indentation' set.
          ;; Point is currently just after the inserted paren.
@@ -1263,21 +1343,26 @@ newline cleanups are done if appropriate; see the 
variable `c-cleanup-list'."
                (insert ?\ )))
 
             ;; compact-empty-funcall clean-up?
-                 ((c-save-buffer-state ()
-                    (and (memq 'compact-empty-funcall c-cleanup-list)
-                         (eq (c-last-command-char) ?\))
-                         (save-excursion
-                           (c-safe (backward-char 2))
-                           (when (looking-at "()")
-                             (setq end (point))
-                             (skip-chars-backward " \t")
-                             (setq beg (point))
-                             (c-on-identifier)))))
-                  (delete-region beg end))))
+            ((c-save-buffer-state ()
+               (and (memq 'compact-empty-funcall c-cleanup-list)
+                    (eq (c-last-command-char) ?\))
+                    (save-excursion
+                      (c-safe (backward-char 2))
+                      (when (looking-at "()")
+                        (setq end (point))
+                        (skip-chars-backward " \t")
+                        (setq beg (point))
+                        (c-on-identifier)))))
+             (delete-region beg end))))
          (and (eq last-input-event ?\))
               (not executing-kbd-macro)
               old-blink-paren
-              (funcall old-blink-paren))))))
+              (funcall old-blink-paren)))
+
+      ;; Apply `electric-pair-mode' stuff inside a string or comment.
+      (when (and (boundp 'electric-pair-mode) electric-pair-mode)
+       (let (post-self-insert-hook)
+         (electric-pair-post-self-insert-function))))))
 
 (defun c-electric-continued-statement ()
   "Reindent the current line if appropriate.
@@ -3524,7 +3609,7 @@ Otherwise reindent just the current line."
                                    (save-excursion
                                      (goto-char end)
                                      (point-marker))
-                                   (nth 1 (current-time))
+                                   (encode-time nil 'integer)
                                    context))
       (message "Indenting region..."))
    ))
@@ -3532,7 +3617,7 @@ Otherwise reindent just the current line."
 (defun c-progress-update ()
   (if (not (and c-progress-info c-progress-interval))
       nil
-    (let ((now (nth 1 (current-time)))
+    (let ((now (encode-time nil 'integer))
          (start (aref c-progress-info 0))
          (end (aref c-progress-info 1))
          (lastsecs (aref c-progress-info 2)))
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 972d214..87ddf3a 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -1,6 +1,6 @@
 ;;; cc-defs.el --- compile time definitions for CC Mode
 
-;; Copyright (C) 1985, 1987, 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2019 Free Software Foundation, Inc.
 
 ;; Authors:    2003- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -87,7 +87,7 @@
 
 ;;; Variables also used at compile time.
 
-(defconst c-version "5.33.1"
+(defconst c-version "5.33.2"
   "CC Mode version number.")
 
 (defconst c-version-sym (intern c-version))
@@ -212,6 +212,13 @@ This variant works around bugs in `eval-when-compile' in 
various
        `(cl-delete-duplicates ,cl-seq ,@cl-keys)
       `(delete-duplicates ,cl-seq ,@cl-keys))))
 
+(defmacro c-font-lock-flush (beg end)
+  "Declare the region BEG...END's fontification as out-of-date.
+On XEmacs and older Emacsen, this refontifies that region immediately."
+  (if (fboundp 'font-lock-flush)
+      `(font-lock-flush ,beg ,end)
+    `(font-lock-fontify-region ,beg ,end)))
+
 (defmacro c-point (position &optional point)
   "Return the value of certain commonly referenced POSITIONs relative to POINT.
 The current point is used if POINT isn't specified.  POSITION can be
@@ -241,7 +248,7 @@ to it is returned.  This function does not modify the point 
or the mark."
 
         ((eq position 'bol)
          (if (and (cc-bytecomp-fboundp 'line-beginning-position) (not point))
-             `(line-beginning-position)
+             '(line-beginning-position)
            `(save-excursion
               ,@(if point `((goto-char ,point)))
               (beginning-of-line)
@@ -249,7 +256,7 @@ to it is returned.  This function does not modify the point 
or the mark."
 
         ((eq position 'eol)
          (if (and (cc-bytecomp-fboundp 'line-end-position) (not point))
-             `(line-end-position)
+             '(line-end-position)
            `(save-excursion
               ,@(if point `((goto-char ,point)))
               (end-of-line)
@@ -258,10 +265,12 @@ to it is returned.  This function does not modify the 
point or the mark."
         ((eq position 'eoll)
          `(save-excursion
             ,@(if point `((goto-char ,point)))
-            (while (progn
-                     (end-of-line)
-                     (prog1 (eq (logand 1 (skip-chars-backward "\\\\")) 1)))
-              (beginning-of-line 2))
+            (while (and
+                    (not (eobp))
+                    (progn
+                      (end-of-line)
+                      (prog1 (eq (logand 1 (skip-chars-backward "\\\\")) 1))))
+              (forward-line))
             (end-of-line)
             (point)))
 
@@ -285,7 +294,7 @@ to it is returned.  This function does not modify the point 
or the mark."
 
         ((eq position 'bopl)
          (if (and (cc-bytecomp-fboundp 'line-beginning-position) (not point))
-             `(line-beginning-position 0)
+             '(line-beginning-position 0)
            `(save-excursion
               ,@(if point `((goto-char ,point)))
               (forward-line -1)
@@ -293,7 +302,7 @@ to it is returned.  This function does not modify the point 
or the mark."
 
         ((eq position 'bonl)
          (if (and (cc-bytecomp-fboundp 'line-beginning-position) (not point))
-             `(line-beginning-position 2)
+             '(line-beginning-position 2)
            `(save-excursion
               ,@(if point `((goto-char ,point)))
               (forward-line 1)
@@ -301,7 +310,7 @@ to it is returned.  This function does not modify the point 
or the mark."
 
         ((eq position 'eopl)
          (if (and (cc-bytecomp-fboundp 'line-end-position) (not point))
-             `(line-end-position 0)
+             '(line-end-position 0)
            `(save-excursion
               ,@(if point `((goto-char ,point)))
               (beginning-of-line)
@@ -310,7 +319,7 @@ to it is returned.  This function does not modify the point 
or the mark."
 
         ((eq position 'eonl)
          (if (and (cc-bytecomp-fboundp 'line-end-position) (not point))
-             `(line-end-position 2)
+             '(line-end-position 2)
            `(save-excursion
               ,@(if point `((goto-char ,point)))
               (forward-line 1)
@@ -482,17 +491,17 @@ to it is returned.  This function does not modify the 
point or the mark."
   ;; Get the regular expression `sentence-end'.
   (if (cc-bytecomp-fboundp 'sentence-end)
       ;; Emacs 22:
-      `(sentence-end)
+      '(sentence-end)
     ;; Emacs <22 + XEmacs
-    `sentence-end))
+    'sentence-end))
 
 (defmacro c-default-value-sentence-end ()
   ;; Get the default value of the variable sentence end.
   (if (cc-bytecomp-fboundp 'sentence-end)
       ;; Emacs 22:
-      `(let (sentence-end) (sentence-end))
+      '(let (sentence-end) (sentence-end))
     ;; Emacs <22 + XEmacs
-    `(default-value 'sentence-end)))
+    '(default-value 'sentence-end)))
 
 ;; The following is essentially `save-buffer-state' from lazy-lock.el.
 ;; It ought to be a standard macro.
@@ -691,7 +700,7 @@ leave point unmoved.
 
 A LIMIT for the search may be given.  The start position is assumed to be
 before it."
-  `(let ((dest (c-safe-scan-lists ,(or pos `(point)) 1 0 ,limit)))
+  `(let ((dest (c-safe-scan-lists ,(or pos '(point)) 1 0 ,limit)))
      (when dest (goto-char dest) dest)))
 
 (defmacro c-go-list-backward (&optional pos limit)
@@ -701,7 +710,7 @@ leave point unmoved.
 
 A LIMIT for the search may be given.  The start position is assumed to be
 after it."
-  `(let ((dest (c-safe-scan-lists ,(or pos `(point)) -1 0 ,limit)))
+  `(let ((dest (c-safe-scan-lists ,(or pos '(point)) -1 0 ,limit)))
      (when dest (goto-char dest) dest)))
 
 (defmacro c-up-list-forward (&optional pos limit)
@@ -710,7 +719,7 @@ or nil if no such position exists.  The point is used if 
POS is left out.
 
 A limit for the search may be given.  The start position is assumed to
 be before it."
-  `(c-safe-scan-lists ,(or pos `(point)) 1 1 ,limit))
+  `(c-safe-scan-lists ,(or pos '(point)) 1 1 ,limit))
 
 (defmacro c-up-list-backward (&optional pos limit)
   "Return the position of the start of the list sexp containing POS,
@@ -718,7 +727,7 @@ or nil if no such position exists.  The point is used if 
POS is left out.
 
 A limit for the search may be given.  The start position is assumed to
 be after it."
-  `(c-safe-scan-lists ,(or pos `(point)) -1 1 ,limit))
+  `(c-safe-scan-lists ,(or pos '(point)) -1 1 ,limit))
 
 (defmacro c-down-list-forward (&optional pos limit)
   "Return the first position inside the first list sexp after POS,
@@ -726,7 +735,7 @@ or nil if no such position exists.  The point is used if 
POS is left out.
 
 A limit for the search may be given.  The start position is assumed to
 be before it."
-  `(c-safe-scan-lists ,(or pos `(point)) 1 -1 ,limit))
+  `(c-safe-scan-lists ,(or pos '(point)) 1 -1 ,limit))
 
 (defmacro c-down-list-backward (&optional pos limit)
   "Return the last position inside the last list sexp before POS,
@@ -734,7 +743,7 @@ or nil if no such position exists.  The point is used if 
POS is left out.
 
 A limit for the search may be given.  The start position is assumed to
 be after it."
-  `(c-safe-scan-lists ,(or pos `(point)) -1 -1 ,limit))
+  `(c-safe-scan-lists ,(or pos '(point)) -1 -1 ,limit))
 
 (defmacro c-go-up-list-forward (&optional pos limit)
   "Move the point to the first position after the list sexp containing POS,
@@ -895,7 +904,7 @@ be after it."
   ;; c-beginning-of-statement-1.
   ;; Languages which don't have EOL terminated statements always return NIL
   ;; (they _know_ there's no vsemi ;-).
-  `(if c-vsemi-status-unknown-p-fn (funcall c-vsemi-status-unknown-p-fn)))
+  '(if c-vsemi-status-unknown-p-fn (funcall c-vsemi-status-unknown-p-fn)))
 
 
 (defmacro c-benign-error (format &rest args)
@@ -1214,7 +1223,7 @@ Leave point just after the character, and set the match 
data on
 this character, and return point.  If the search fails, return
 nil; point is then left undefined."
   `(let ((char-skip (concat "^" (char-to-string ,char)))
-        (-limit- ,limit)
+        (-limit- (or ,limit (point-max)))
         (-value- ,value))
      (while
         (and
@@ -1226,15 +1235,39 @@ nil; point is then left undefined."
        (search-forward-regexp ".")     ; to set the match-data.
        (point))))
 
+(defmacro c-search-forward-char-property-without-value-on-char
+    (property value char &optional limit)
+  "Search forward for a character CHAR without text property PROPERTY having
+a value CHAR.
+LIMIT bounds the search.  The value comparison is done with `equal'.
+PROPERTY must be a constant.
+
+Leave point just after the character, and set the match data on
+this character, and return point.  If the search fails, return
+nil; point is then left undefined."
+  `(let ((char-skip (concat "^" (char-to-string ,char)))
+        (-limit- (or ,limit (point-max)))
+        (-value- ,value))
+     (while
+        (and
+         (progn (skip-chars-forward char-skip -limit-)
+                (< (point) -limit-))
+         (equal (c-get-char-property (point) ,property) -value-))
+       (forward-char))
+     (when (< (point) -limit-)
+       (search-forward-regexp ".")     ; to set the match-data.
+       (point))))
+
 (defun c-clear-char-property-with-value-on-char-function (from to property
                                                               value char)
   "Remove all text-properties PROPERTY with value VALUE on
 characters with value CHAR from the region [FROM, TO), as tested
 by `equal'.  These properties are assumed to be over individual
 characters, having been put there by c-put-char-property.  POINT
-remains unchanged."
+remains unchanged.  Return the position of the first removed
+property, or nil."
   (let ((place from)
-       )
+       first)
     (while                       ; loop round occurrences of (PROPERTY VALUE)
        (progn
          (while           ; loop round changes in PROPERTY till we find VALUE
@@ -1243,28 +1276,34 @@ remains unchanged."
               (not (equal (get-text-property place property) value)))
            (setq place (c-next-single-property-change place property nil to)))
          (< place to))
-      (if (eq (char-after place) char)
-         (remove-text-properties place (1+ place) (cons property nil)))
+      (when (eq (char-after place) char)
+       (remove-text-properties place (1+ place) (cons property nil))
+       (or first (setq first place)))
       ;; Do we have to do anything with stickiness here?
-      (setq place (1+ place)))))
+      (setq place (1+ place)))
+    first))
 
 (defmacro c-clear-char-property-with-value-on-char (from to property value 
char)
   "Remove all text-properties PROPERTY with value VALUE on
 characters with value CHAR from the region [FROM, TO), as tested
 by `equal'.  These properties are assumed to be over individual
 characters, having been put there by c-put-char-property.  POINT
-remains unchanged."
+remains unchanged.  Return the position of the first removed
+property, or nil."
   (if c-use-extents
       ;; XEmacs
       `(let ((-property- ,property)
-            (-char- ,char))
+            (-char- ,char)
+            (first (1+ (point-max))))
         (map-extents (lambda (ext val)
-                       (if (and (equal (extent-property ext -property-) val)
-                                (eq (char-after
-                                     (extent-start-position ext))
-                                    -char-))
-                           (delete-extent ext)))
-                     nil ,from ,to ,value nil -property-))
+                       (when (and (equal (extent-property ext -property-) val)
+                                  (eq (char-after
+                                       (extent-start-position ext))
+                                      -char-))
+                         (setq first (min first (extent-start-position ext)))
+                         (delete-extent ext)))
+                     nil ,from ,to ,value nil -property-)
+        (and (<= first (point-max)) first))
     ;; GNU Emacs
     `(c-clear-char-property-with-value-on-char-function ,from ,to ,property
                                                        ,value ,char)))
@@ -1316,6 +1355,7 @@ with value CHAR in the region [FROM to)."
 ;(eval-after-load "edebug" ; 2006-07-09: def-edebug-spec is now in subr.el.
 ;  '(progn
 (def-edebug-spec cc-eval-when-compile (&rest def-form))
+(def-edebug-spec c-font-lock-flush t)
 (def-edebug-spec c--mapcan t)
 (def-edebug-spec c--set-difference (form form &rest [symbolp form]))
 (def-edebug-spec c--intersection (form form &rest [symbolp form]))
@@ -1607,12 +1647,12 @@ with value CHAR in the region [FROM to)."
 (defmacro c-looking-at-non-alphnumspace ()
   "Are we looking at a character which isn't alphanumeric or space?"
   (if (memq 'gen-comment-delim c-emacs-features)
-      `(looking-at
-"\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\|\\s!\\)")
-    `(or (looking-at
-"\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\)"
-        (let ((prop (c-get-char-property (point) 'syntax-table)))
-          (eq prop '(14)))))))         ; '(14) is generic comment delimiter.
+      '(looking-at
+       
"\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\|\\s!\\)")
+    '(or (looking-at
+         "\\([;#]\\|\\'\\|\\s(\\|\\s)\\|\\s\"\\|\\s\\\\|\\s$\\|\\s<\\|\\s>\\)"
+         (let ((prop (c-get-char-property (point) 'syntax-table)))
+           (eq prop '(14)))))))                ; '(14) is generic comment 
delimiter.
 
 
 (defsubst c-intersect-lists (list alist)
@@ -1769,7 +1809,8 @@ when it's needed.  The default is the current language 
taken from
                                     t))
                         (setq pos (cdr pos)))
                       found))
-             (setq pos list)
+             (setq pos (copy-tree list)
+                   )
              (while pos
                (if (string-match "\\w\\'" (car pos))
                    (setcar pos (concat (car pos) unique)))
@@ -1836,7 +1877,7 @@ The returned string is of the type that can be used with
 non-nil, a caret is prepended to invert the set."
   ;; This function ought to be in the elisp core somewhere.
   (let ((str (if inverted "^" "")) char char2)
-    (setq chars (sort (append chars nil) `<))
+    (setq chars (sort (append chars nil) #'<))
     (while chars
       (setq char (pop chars))
       (if (memq char '(?\\ ?^ ?-))
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 7a6cfdd..1a8c516 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -1,6 +1,6 @@
 ;;; cc-engine.el --- core syntax guessing engine for CC mode -*- coding: utf-8 
-*-
 
-;; Copyright (C) 1985, 1987, 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2019 Free Software Foundation, Inc.
 
 ;; Authors:    2001- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -152,8 +152,6 @@
 (cc-require-when-compile 'cc-langs)
 (cc-require 'cc-vars)
 
-(eval-when-compile (require 'cl))
-
 
 ;; Make declarations for all the `c-lang-defvar' variables in cc-langs.
 
@@ -665,10 +663,12 @@ comment at the start of cc-engine.el for more info."
             stack (cdr stack))
        t
      ,do-if-done
+     (setq pre-stmt-found t)
      (throw 'loop nil)))
 (defmacro c-bos-pop-state-and-retry ()
   '(throw 'loop (setq state (car (car stack))
                      saved-pos (cdr (car stack))
+                     pre-stmt-found (not (cdr stack))
                      ;; Throw nil if stack is empty, else throw non-nil.
                      stack (cdr stack))))
 (defmacro c-bos-save-pos ()
@@ -694,7 +694,7 @@ comment at the start of cc-engine.el for more info."
                             (c-point 'bol (elt saved-pos 0))))))))
 
 (defun c-beginning-of-statement-1 (&optional lim ignore-labels
-                                            noerror comma-delim)
+                                            noerror comma-delim hit-lim)
   "Move to the start of the current statement or declaration, or to
 the previous one if already at the beginning of one.  Only
 statements/declarations on the same level are considered, i.e. don't
@@ -729,14 +729,16 @@ Return:
 `up'            if stepped to a containing statement;
 `previous'      if stepped to a preceding statement;
 `beginning'     if stepped from a statement continuation clause to
-                its start clause; or
-`macro'         if stepped to a macro start.
+                its start clause;
+`macro'         if stepped to a macro start; or
+nil             if HIT-LIM is non-nil, and we hit the limit.
 Note that `same' and not `label' is returned if stopped at the same
 label without crossing the colon character.
 
 LIM may be given to limit the search.  If the search hits the limit,
 point will be left at the closest following token, or at the start
-position if that is less (`same' is returned in this case).
+position if that is less.  If HIT-LIM is non-nil, nil is returned in
+this case, otherwise `same'.
 
 NOERROR turns off error logging to `c-parsing-error'.
 
@@ -840,6 +842,10 @@ comment at the start of cc-engine.el for more info."
        pos
        ;; Position of last stmt boundary character (e.g. ;).
        boundary-pos
+       ;; Non-nil when a construct has been found which delimits the search
+       ;; for a statement start, e.g. an opening brace or a macro start, or a
+       ;; keyword like `if' when the PDA stack is empty.
+       pre-stmt-found
        ;; The position of the last sexp or bound that follows the
        ;; first found colon, i.e. the start of the nonlabel part of
        ;; the statement.  It's `start' if a colon is found just after
@@ -877,7 +883,10 @@ comment at the start of cc-engine.el for more info."
        tok ptok pptok)
 
     (save-restriction
-      (if lim (narrow-to-region lim (point-max)))
+      (setq lim (if lim
+                   (max lim (point-min))
+                 (point-min)))
+      (widen)
 
       (if (save-excursion
            (and (c-beginning-of-macro)
@@ -923,9 +932,10 @@ comment at the start of cc-engine.el for more info."
        ;; The loop is exited only by throwing nil to the (catch 'loop ...):
        ;; 1. On reaching the start of a macro;
        ;; 2. On having passed a stmt boundary with the PDA stack empty;
-       ;; 3. On reaching the start of an Objective C method def;
-       ;; 4. From macro `c-bos-pop-state'; when the stack is empty;
-       ;; 5. From macro `c-bos-pop-state-and-retry' when the stack is empty.
+       ;; 3. Going backwards past the search limit.
+       ;; 4. On reaching the start of an Objective C method def;
+       ;; 5. From macro `c-bos-pop-state'; when the stack is empty;
+       ;; 6. From macro `c-bos-pop-state-and-retry' when the stack is empty.
        (while
            (catch 'loop ;; Throw nil to break, non-nil to continue.
              (cond
@@ -950,6 +960,7 @@ comment at the start of cc-engine.el for more info."
                  (setq pos saved
                        ret 'macro
                        ignore-labels t))
+               (setq pre-stmt-found t)
                (throw 'loop nil))      ; 1. Start of macro.
 
               ;; Do a round through the automaton if we've just passed a
@@ -959,6 +970,7 @@ comment at the start of cc-engine.el for more info."
                         (setq sym (intern (match-string 1)))))
 
                (when (and (< pos start) (null stack))
+                 (setq pre-stmt-found t)
                  (throw 'loop nil))    ; 2. Statement boundary.
 
                ;; The PDA state handling.
@@ -1071,7 +1083,8 @@ comment at the start of cc-engine.el for more info."
              ;; Step to the previous sexp, but not if we crossed a
              ;; boundary, since that doesn't consume an sexp.
              (if (eq sym 'boundary)
-                 (setq ret 'previous)
+                 (when (>= (point) lim)
+                   (setq ret 'previous))
 
                 ;; HERE IS THE SINGLE PLACE INSIDE THE PDA LOOP WHERE WE MOVE
                ;; BACKWARDS THROUGH THE SOURCE.
@@ -1080,16 +1093,20 @@ comment at the start of cc-engine.el for more info."
                (let ((before-sws-pos (point))
                      ;; The end position of the area to search for statement
                      ;; barriers in this round.
-                     (maybe-after-boundary-pos pos))
+                     (maybe-after-boundary-pos pos)
+                     comma-delimited)
 
                  ;; Go back over exactly one logical sexp, taking proper
                  ;; account of macros and escaped EOLs.
                  (while
                      (progn
+                       (setq comma-delimited (and (not comma-delim)
+                                                  (eq (char-before) ?\,)))
                        (unless (c-safe (c-backward-sexp) t)
                          ;; Give up if we hit an unbalanced block.  Since the
                          ;; stack won't be empty the code below will report a
                          ;; suitable error.
+                         (setq pre-stmt-found t)
                          (throw 'loop nil))
                        (cond
                         ;; Have we moved into a macro?
@@ -1121,6 +1138,7 @@ comment at the start of cc-engine.el for more info."
                         ;; Just gone back over a brace block?
                         ((and
                           (eq (char-after) ?{)
+                          (not comma-delimited)
                           (not (c-looking-at-inexpr-block lim nil t))
                           (save-excursion
                             (c-backward-token-2 1 t nil)
@@ -1132,8 +1150,11 @@ comment at the start of cc-engine.el for more info."
                              (if (and (looking-at c-symbol-start)
                                       (not (looking-at c-keywords-regexp)))
                                  (c-backward-token-2 1 t nil))
-                             (not (looking-at
-                                   c-opt-block-decls-with-vars-key)))))
+                             (and
+                              (not (looking-at
+                                    c-opt-block-decls-with-vars-key))
+                              (or comma-delim
+                                  (not (eq (char-after) ?\,)))))))
                          (save-excursion
                            (c-forward-sexp) (point)))
                         ;; Just gone back over some paren block?
@@ -1155,12 +1176,17 @@ comment at the start of cc-engine.el for more info."
                    ;; Like a C "continue".  Analyze the next sexp.
                    (throw 'loop t))))
 
+             ;; Have we gone past the limit?
+             (when (< (point) lim)
+               (throw 'loop nil))      ; 3. Gone back over the limit.
+
              ;; ObjC method def?
              (when (and c-opt-method-key
                         (setq saved (c-in-method-def-p)))
                (setq pos saved
+                     pre-stmt-found t
                      ignore-labels t)  ; Avoid the label check on exit.
-               (throw 'loop nil))      ; 3. ObjC method def.
+               (throw 'loop nil))      ; 4. ObjC method def.
 
              ;; Might we have a bitfield declaration, "<type> <id> : <size>"?
              (if c-has-bitfields
@@ -1221,9 +1247,15 @@ comment at the start of cc-engine.el for more info."
                    ptok tok
                    tok (point)
                    pos tok) ; always non-nil
-             )              ; end of (catch loop ....)
+             )              ; end of (catch 'loop ....)
          )                  ; end of sexp-at-a-time (while ....)
 
+       (when (and hit-lim
+                  (or (not pre-stmt-found)
+                      (< pos lim)
+                      (>= pos start)))
+         (setq ret nil))
+
        ;; If the stack isn't empty there might be errors to report.
        (while stack
          (if (and (vectorp saved-pos) (eq (length saved-pos) 3))
@@ -1699,36 +1731,41 @@ comment at the start of cc-engine.el for more info."
   `(let ((beg ,beg) (end ,end))
      (put-text-property beg end 'c-is-sws t)
      ,@(when (facep 'c-debug-is-sws-face)
-        `((c-debug-add-face beg end 'c-debug-is-sws-face)))))
+        '((c-debug-add-face beg end 'c-debug-is-sws-face)))))
+(def-edebug-spec c-put-is-sws t)
 
 (defmacro c-put-in-sws (beg end)
   ;; This macro does a hidden buffer change.
   `(let ((beg ,beg) (end ,end))
      (put-text-property beg end 'c-in-sws t)
      ,@(when (facep 'c-debug-is-sws-face)
-        `((c-debug-add-face beg end 'c-debug-in-sws-face)))))
+        '((c-debug-add-face beg end 'c-debug-in-sws-face)))))
+(def-edebug-spec c-put-in-sws t)
 
 (defmacro c-remove-is-sws (beg end)
   ;; This macro does a hidden buffer change.
   `(let ((beg ,beg) (end ,end))
      (remove-text-properties beg end '(c-is-sws nil))
      ,@(when (facep 'c-debug-is-sws-face)
-        `((c-debug-remove-face beg end 'c-debug-is-sws-face)))))
+        '((c-debug-remove-face beg end 'c-debug-is-sws-face)))))
+(def-edebug-spec c-remove-is-sws t)
 
 (defmacro c-remove-in-sws (beg end)
   ;; This macro does a hidden buffer change.
   `(let ((beg ,beg) (end ,end))
      (remove-text-properties beg end '(c-in-sws nil))
      ,@(when (facep 'c-debug-is-sws-face)
-        `((c-debug-remove-face beg end 'c-debug-in-sws-face)))))
+        '((c-debug-remove-face beg end 'c-debug-in-sws-face)))))
+(def-edebug-spec c-remove-in-sws t)
 
 (defmacro c-remove-is-and-in-sws (beg end)
   ;; This macro does a hidden buffer change.
   `(let ((beg ,beg) (end ,end))
      (remove-text-properties beg end '(c-is-sws nil c-in-sws nil))
      ,@(when (facep 'c-debug-is-sws-face)
-        `((c-debug-remove-face beg end 'c-debug-is-sws-face)
+        '((c-debug-remove-face beg end 'c-debug-is-sws-face)
           (c-debug-remove-face beg end 'c-debug-in-sws-face)))))
+(def-edebug-spec c-remove-is-and-in-sws t)
 
 ;; The type of literal position `end' is in a `before-change-functions'
 ;; function - one of `c', `c++', `pound', or nil (but NOT `string').
@@ -1737,12 +1774,14 @@ comment at the start of cc-engine.el for more info."
 ;; enclosing END, if any, else nil.
 (defvar c-sws-lit-limits nil)
 
-(defun c-invalidate-sws-region-before (end)
-  ;; Called from c-before-change.  END is the end of the change region, the
-  ;; standard parameter given to all before-change-functions.
+(defun c-invalidate-sws-region-before (beg end)
+  ;; Called from c-before-change.  BEG and END are the bounds of the change
+  ;; region, the standard parameters given to all before-change-functions.
   ;;
-  ;; Note whether END is inside a comment or CPP construct, and if so note its
-  ;; bounds in `c-sws-lit-limits' and type in `c-sws-lit-type'.
+  ;; Note whether END is inside a comment, CPP construct, or noise macro, and
+  ;; if so note its bounds in `c-sws-lit-limits' and type in `c-sws-lit-type'.
+  (setq c-sws-lit-type nil
+       c-sws-lit-limits nil)
   (save-excursion
     (goto-char end)
     (let* ((limits (c-literal-limits))
@@ -1755,8 +1794,19 @@ comment at the start of cc-engine.el for more info."
        (setq c-sws-lit-type 'pound
              c-sws-lit-limits (cons (point)
                                     (progn (c-end-of-macro) (point)))))
-       (t (setq c-sws-lit-type nil
-               c-sws-lit-limits nil))))))
+       ((progn (skip-syntax-backward "w_")
+              (looking-at c-noise-macro-name-re))
+       (setq c-sws-lit-type 'noise
+             c-sws-lit-limits (cons (match-beginning 1) (match-end 1))))
+       (t))))
+  (save-excursion
+    (goto-char beg)
+    (skip-syntax-backward "w_")
+    (when (looking-at c-noise-macro-name-re)
+      (setq c-sws-lit-type 'noise)
+      (if (consp c-sws-lit-limits)
+         (setcar c-sws-lit-limits (match-beginning 1))
+       (setq c-sws-lit-limits (cons (match-beginning 1) (match-end 1)))))))
 
 (defun c-invalidate-sws-region-after-del (beg end old-len)
   ;; Text has been deleted, OLD-LEN characters of it starting from position
@@ -1765,7 +1815,6 @@ comment at the start of cc-engine.el for more info."
   ;; deletion deleted or "damaged" its opening delimiter.  If so, return the
   ;; current position of where the construct ended, otherwise return nil.
   (when c-sws-lit-limits
-    (setcdr c-sws-lit-limits (- (cdr c-sws-lit-limits) old-len))
     (if (and (< beg (+ (car c-sws-lit-limits) 2)) ; A lazy assumption that
                                                  ; comment delimiters are 2
                                                  ; chars long.
@@ -1783,9 +1832,9 @@ comment at the start of cc-engine.el for more info."
   ;; or `c-is-sws' text properties inside this literal.  If there are, return
   ;; the buffer position of the end of the literal, else return nil.
   (save-excursion
+    (goto-char end)
     (let* ((limits (c-literal-limits))
           (lit-type (c-literal-type limits)))
-      (goto-char end)
       (when (and (not (memq lit-type '(c c++)))
                 (c-beginning-of-macro))
        (setq lit-type 'pound
@@ -1809,6 +1858,10 @@ comment at the start of cc-engine.el for more info."
   ;; properties right after they're added.
   ;;
   ;; This function does hidden buffer changes.
+  (when c-sws-lit-limits
+    (setcar c-sws-lit-limits (min beg (car c-sws-lit-limits)))
+    (setcdr c-sws-lit-limits
+           (max end (- (+ (cdr c-sws-lit-limits) (- end beg)) old-len))))
   (let ((del-end
         (and (> old-len 0)
              (c-invalidate-sws-region-after-del beg end old-len)))
@@ -1828,6 +1881,10 @@ comment at the start of cc-engine.el for more info."
       (when (and (eolp) (not (eobp)))
        (setq end (1+ (point)))))
 
+    (when (eq c-sws-lit-type 'noise)
+      (setq beg (car c-sws-lit-limits)
+           end (cdr c-sws-lit-limits))) ; This last setting may be redundant.
+
     (when (and (= beg end)
               (get-text-property beg 'c-in-sws)
               (> beg (point-min))
@@ -1847,6 +1904,7 @@ comment at the start of cc-engine.el for more info."
 
     (setq end (max (or del-end end)
                   (or ins-end end)
+                  (or (cdr c-sws-lit-limits) end)
                   end))
 
     (c-debug-sws-msg "c-invalidate-sws-region-after [%s..%s]" beg end)
@@ -2115,7 +2173,8 @@ comment at the start of cc-engine.el for more info."
       ;; Try to find a rung position in the simple ws preceding point, so that
       ;; we can get a cache hit even if the last bit of the simple ws has
       ;; changed recently.
-      (setq simple-ws-beg (point))
+      (setq simple-ws-beg (or (match-end 1) ; Noise macro
+                             (match-end 0))) ; c-syntactic-ws-end
       (skip-chars-backward " \t\n\r\f\v")
       (if (setq rung-is-marked (text-property-any
                                (point) (min (1+ rung-pos) (point-max))
@@ -5059,7 +5118,7 @@ comment at the start of cc-engine.el for more info."
              (setq beg (c-safe (c-backward-sexp 1) (point))))
 
             ((and (c-safe (forward-char -2) t)
-                  (looking-at "*/"))
+                  (looking-at "\\*/"))
              ;; Block comment.  Due to the nature of line
              ;; comments, they will always be covered by the
              ;; normal case above.
@@ -5587,8 +5646,12 @@ comment at the start of cc-engine.el for more info."
               ;; Pseudo match inside a comment or string literal.  Skip out
               ;; of comments and string literals.
               (while (progn
-                       (goto-char (c-next-single-property-change
-                                   (point) 'face nil cfd-limit))
+                       (unless
+                           (and (match-end 1)
+                                (c-got-face-at (1- (point)) c-literal-faces)
+                                (not (c-got-face-at (point) c-literal-faces)))
+                         (goto-char (c-next-single-property-change
+                                     (point) 'face nil cfd-limit)))
                        (and (< (point) cfd-limit)
                             (c-got-face-at (point) c-literal-faces))))
               t)                     ; Continue the loop over pseudo matches.
@@ -6291,9 +6354,8 @@ comment at the start of cc-engine.el for more info."
 ;; Set by c-common-init in cc-mode.el.
 (defvar c-new-BEG)
 (defvar c-new-END)
-;; Set by c-after-change in cc-mode.el.
-(defvar c-old-BEG)
-(defvar c-old-END)
+;; Set by c-before-change-check-raw-strings.
+(defvar c-old-END-literality)
 
 (defun c-before-change-check-<>-operators (beg end)
   ;; Unmark certain pairs of "< .... >" which are currently marked as
@@ -6425,9 +6487,9 @@ comment at the start of cc-engine.el for more info."
 ;; A valid C++ raw string looks like
 ;;     R"<id>(<contents>)<id>"
 ;; , where <id> is an identifier from 0 to 16 characters long, not containing
-;; spaces, control characters, double quote or left/right paren.  <contents>
-;; can include anything which isn't the terminating )<id>", including new
-;; lines, "s, parentheses, etc.
+;; spaces, control characters, or left/right paren.  <contents> can include
+;; anything which isn't the terminating )<id>", including new lines, "s,
+;; parentheses, etc.
 ;;
 ;; CC Mode handles C++ raw strings by the use of `syntax-table' text
 ;; properties as follows:
@@ -6437,16 +6499,18 @@ comment at the start of cc-engine.el for more info."
 ;;   contents is given the property value "punctuation" (`(1)') to prevent it
 ;;   interacting with the "s in the delimiters.
 ;;
-;;   The font locking routine `c-font-lock-c++-raw-strings' (in cc-fonts.el)
+;;   The font locking routine `c-font-lock-raw-strings' (in cc-fonts.el)
 ;;   recognizes valid raw strings, and fontifies the delimiters (apart from
 ;;   the parentheses) with the default face and the parentheses and the
 ;;   <contents> with font-lock-string-face.
 ;;
 ;; (ii) A valid, but unterminated, raw string opening delimiter gets the
 ;;   "punctuation" value (`(1)') of the `syntax-table' text property, and the
-;;   open parenthesis gets the "string fence" value (`(15)').
+;;   open parenthesis gets the "string fence" value (`(15)').  When such a
+;;   delimiter is found, no attempt is made in any way to "correct" any text
+;;   properties after the delimiter.
 ;;
-;;   `c-font-lock-c++-raw-strings' puts c-font-lock-warning-face on the entire
+;;   `c-font-lock-raw-strings' puts c-font-lock-warning-face on the entire
 ;;   unmatched opening delimiter (from the R up to the open paren), and allows
 ;;   the rest of the buffer to get font-lock-string-face, caused by the
 ;;   unmatched "string fence" `syntax-table' text property value.
@@ -6463,10 +6527,14 @@ comment at the start of cc-engine.el for more info."
 ;;   already at the end of the macro, it gets the "punctuation" value, and no
 ;;   "string fence"s are used.
 ;;
-;;   The effect on the fontification of either of these tactics is that rest of
-;;   the macro (if any) after the "(" gets font-lock-string-face, but the rest
-;;   of the file is fontified normally.
+;;   The effect on the fontification of either of these tactics is that the
+;;   rest of the macro (if any) after the "(" gets font-lock-string-face, but
+;;   the rest of the file is fontified normally.
 
+;; The values of the function `c-raw-string-pos' at before-change-functions'
+;; BEG and END.
+(defvar c-old-beg-rs nil)
+(defvar c-old-end-rs nil)
 
 (defun c-raw-string-pos ()
   ;; Get POINT's relationship to any containing raw string.
@@ -6483,7 +6551,7 @@ comment at the start of cc-engine.el for more info."
   ;; characters.)  If the raw string is not terminated, E\) and E\" are set to
   ;; nil.
   ;;
-  ;; Note: this routine is dependant upon the correct syntax-table text
+  ;; Note: this function is dependant upon the correct syntax-table text
   ;; properties being set.
   (let ((state (c-state-semi-pp-to-literal (point)))
        open-quote-pos open-paren-pos close-paren-pos close-quote-pos id)
@@ -6496,8 +6564,20 @@ comment at the start of cc-engine.el for more info."
                 (search-backward "\"" (max (- (point) 17) (point-min)) t)))
            ((and (eq (cadr state) 'string)
                  (goto-char (nth 2 state))
-                 (or (eq (char-after) ?\")
-                     (search-backward "\"" (max (- (point) 17) (point-min)) t))
+                 (cond
+                  ((eq (char-after) ?\"))
+                  ((eq (char-after) ?\()
+                   (let ((here (point)))
+                     (goto-char (max (- (point) 18) (point-min)))
+                     (while
+                         (and
+                          (search-forward-regexp
+                           "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)("
+                           (1+ here) 'limit)
+                          (< (point) here)))
+                     (and (eq (point) (1+ here))
+                          (match-beginning 1)
+                          (goto-char (1- (match-beginning 1)))))))
                  (not (bobp)))))
           (eq (char-before) ?R)
           (looking-at "\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)("))
@@ -6520,6 +6600,21 @@ comment at the start of cc-engine.el for more info."
           (t nil))
          open-quote-pos open-paren-pos close-paren-pos close-quote-pos))))
 
+(defun c-raw-string-in-end-delim (beg end)
+  ;; If the region (BEG END) intersects a possible raw string terminator,
+  ;; return a cons of the position of the ) and the position of the " in the
+  ;; first one found.
+  (save-excursion
+    (goto-char (max (- beg 17) (point-min)))
+    (while
+       (and
+        (search-forward-regexp ")\\([^ ()\\\n\r\t]\\{0,16\\}\\)\""
+                               (min (+ end 17) (point-max)) t)
+        (<= (point) beg)))
+    (unless (or (<= (point) beg)
+               (>= (match-beginning 0) end))
+      (cons (match-beginning 0) (match-end 1)))))
+
 (defun c-depropertize-raw-string (id open-quote open-paren bound)
   ;; Point is immediately after a raw string opening delimiter.  Remove any
   ;; `syntax-table' text properties associated with the delimiter (if it's
@@ -6528,29 +6623,55 @@ comment at the start of cc-engine.el for more info."
   ;; ID, a string, is the delimiter's identifier.  OPEN-QUOTE and OPEN-PAREN
   ;; are the buffer positions of the delimiter's components.  BOUND is the
   ;; bound for searching for a matching closing delimiter; it is usually nil,
-  ;; but if we're inside a macro, it's the end of the macro.
+  ;; but if we're inside a macro, it's the end of the macro (i.e. just before
+  ;; the terminating \n).
   ;;
   ;; Point is moved to after the (terminated) raw string, or left after the
   ;; unmatched opening delimiter, as the case may be.  The return value is of
   ;; no significance.
-  (let ((open-paren-prop (c-get-char-property open-paren 'syntax-table)))
+  (let ((open-paren-prop (c-get-char-property open-paren 'syntax-table))
+       first)
+    ;; If the delimiter is "unclosed", or sombody's used " in their id, clear
+    ;; the 'syntax-table property from all of them.
+    (setq first (c-clear-char-property-with-value-on-char
+                open-quote open-paren 'syntax-table '(1) ?\"))
+    (if first (c-truncate-semi-nonlit-pos-cache first))
     (cond
      ((null open-paren-prop)
-      ;; A terminated raw string
+      ;; Should be a terminated raw string...
       (when (search-forward (concat ")" id "\"") nil t)
+       ;; Yes, it is.  :-)
+       ;; Clear any '(1)s from "s in the identifier.
+       (setq first (c-clear-char-property-with-value-on-char
+                    (1+ (match-beginning 0)) (1- (match-end 0))
+                    'syntax-table '(1) ?\"))
+       (if first (c-truncate-semi-nonlit-pos-cache first))
+       ;; Clear any random `syntax-table' text properties from the contents.
        (let* ((closing-paren (match-beginning 0))
-              (first-punctuation
-               (save-match-data
-                 (goto-char (1+ open-paren))
-                 (and (c-search-forward-char-property 'syntax-table '(1)
-                                                      closing-paren)
-                      (1- (point)))))
-              )
-         (when first-punctuation
-           (c-clear-char-property-with-value
-            first-punctuation (match-beginning 0) 'syntax-table '(1))
-           (c-truncate-semi-nonlit-pos-cache first-punctuation)
-           ))))
+              (first-st
+               (and
+                (< (1+ open-paren) closing-paren)
+                (or
+                 (and (c-get-char-property (1+ open-paren) 'syntax-table)
+                      (1+ open-paren))
+                 (and
+                  (setq first
+                        (c-next-single-property-change
+                         (1+ open-paren) 'syntax-table nil closing-paren))
+                  (< first closing-paren)
+                  first)))))
+         (when first-st
+           (c-clear-char-properties first-st (match-beginning 0)
+                                    'syntax-table)
+           (c-truncate-semi-nonlit-pos-cache first-st))
+         (when (c-get-char-property (1- (match-end 0)) 'syntax-table)
+           ;; Was previously an unterminated (ordinary) string
+           (save-excursion
+             (goto-char (1- (match-end 0)))
+             (when (c-safe (c-forward-sexp)) ; to '(1) at EOL.
+               (c-clear-char-property (1- (point)) 'syntax-table))
+             (c-clear-char-property (1- (match-end 0)) 'syntax-table)
+             (c-truncate-semi-nonlit-pos-cache (1- (match-end 0))))))))
      ((or (and (equal open-paren-prop '(15)) (null bound))
          (equal open-paren-prop '(1)))
       ;; An unterminated raw string either not in a macro, or in a macro with
@@ -6564,13 +6685,8 @@ comment at the start of cc-engine.el for more info."
       (c-clear-char-property open-quote 'syntax-table)
       (c-truncate-semi-nonlit-pos-cache open-quote)
       (c-clear-char-property open-paren 'syntax-table)
-      (let ((after-string-fence-pos
-            (save-excursion
-              (goto-char (1+ open-paren))
-              (c-search-forward-char-property 'syntax-table '(15) bound))))
-       (when after-string-fence-pos
-         (c-clear-char-property (1- after-string-fence-pos) 'syntax-table)))
-      ))))
+      (c-clear-char-property-with-value (1+ open-paren) bound 'syntax-table
+                                       '(15))))))
 
 (defun c-depropertize-raw-strings-in-region (start finish)
   ;; Remove any `syntax-table' text properties associated with C++ raw strings
@@ -6610,37 +6726,89 @@ comment at the start of cc-engine.el for more info."
 
 (defun c-before-change-check-raw-strings (beg end)
   ;; This function clears `syntax-table' text properties from C++ raw strings
-  ;; in the region (c-new-BEG c-new-END).  BEG and END are the standard
-  ;; arguments supplied to any before-change function.
+  ;; whose delimiters are about to change in the region (c-new-BEG c-new-END).
+  ;; BEG and END are the standard arguments supplied to any before-change
+  ;; function.
   ;;
   ;; Point is undefined on both entry and exit, and the return value has no
   ;; significance.
   ;;
   ;; This function is called as a before-change function solely due to its
   ;; membership of the C++ value of `c-get-state-before-change-functions'.
+  (goto-char end)
+  ;; We use the following to detect a R"<id>( being swallowed into a string by
+  ;; the pending change.
+  (setq c-old-END-literality (c-in-literal))
   (c-save-buffer-state
-      ((beg-rs (progn (goto-char beg) (c-raw-string-pos)))
-       (beg-plus (if (null beg-rs)
-                    beg
-                  (max beg
-                       (1+ (or (nth 4 beg-rs) (nth 2 beg-rs))))))
-       (end-rs (progn (goto-char end) (c-raw-string-pos))) ; FIXME!!!
+      (;; (beg-rs (progn (goto-char beg) (c-raw-string-pos)))
+       ;; (end-rs (progn (goto-char end) (c-raw-string-pos)))
+                                       ; FIXME!!!
                                        ; Optimize this so that we don't call
                                        ; `c-raw-string-pos' twice when once
                                        ; will do.  (2016-06-02).
-       (end-minus (if (null end-rs)
-                     end
-                   (min end (cadr end-rs))))
-       )
-    (when beg-rs
-      (setq c-new-BEG (min c-new-BEG (1- (cadr beg-rs)))))
-    (c-depropertize-raw-strings-in-region c-new-BEG beg-plus)
-
-    (when end-rs
-      (setq c-new-END (max c-new-END
-                          (1+ (or (nth 4 end-rs)
-                                  (nth 2 end-rs))))))
-    (c-depropertize-raw-strings-in-region end-minus c-new-END)))
+       (term-del (c-raw-string-in-end-delim beg end))
+       Rquote close-quote)
+    (setq c-old-beg-rs (progn (goto-char beg) (c-raw-string-pos))
+         c-old-end-rs (progn (goto-char end) (c-raw-string-pos)))
+    (cond
+     ;; We're not changing, or we're obliterating raw strings.
+     ((and (null c-old-beg-rs) (null c-old-end-rs)))
+     ;; We're changing the putative terminating delimiter of a raw string
+     ;; containing BEG.
+     ((and c-old-beg-rs term-del
+          (or (null (nth 3 c-old-beg-rs))
+              (<= (car term-del) (nth 3 c-old-beg-rs))))
+      (setq Rquote (1- (cadr c-old-beg-rs))
+           close-quote (1+ (cdr term-del)))
+      (c-depropertize-raw-strings-in-region Rquote close-quote)
+      (setq c-new-BEG (min c-new-BEG Rquote)
+           c-new-END (max c-new-END close-quote)))
+     ;; We're breaking an escaped NL in a raw string in a macro.
+     ((and c-old-end-rs
+          (< beg end)
+          (goto-char end) (eq (char-before) ?\\)
+          (c-beginning-of-macro))
+      (let ((bom (point))
+           (eom (progn (c-end-of-macro) (point))))
+       (c-depropertize-raw-strings-in-region bom eom)
+       (setq c-new-BEG (min c-new-BEG bom)
+             c-new-END (max c-new-END eom))))
+     ;; We're changing only the contents of a raw string.
+     ((and (equal (cdr c-old-beg-rs) (cdr c-old-end-rs))
+          (null (car c-old-beg-rs)) (null (car c-old-end-rs))))
+     ((or
+       ;; We're removing (at least part of) the R" of the starting delim of a
+       ;; raw string:
+       (null c-old-beg-rs)
+       (and (eq beg (cadr c-old-beg-rs))
+           (< beg end))
+       ;; Or we're removing the ( of the starting delim of a raw string.
+       (and (eq (car c-old-beg-rs) 'open-delim)
+           (or (null c-old-end-rs)
+               (not (eq (car c-old-end-rs) 'open-delim))
+               (not (equal (cdr c-old-beg-rs) (cdr c-old-end-rs))))))
+      (let ((close (nth 4 (or c-old-end-rs c-old-beg-rs))))
+       (setq Rquote (1- (cadr (or c-old-end-rs c-old-beg-rs)))
+             close-quote (if close (1+ close) (point-max))))
+      (c-depropertize-raw-strings-in-region Rquote close-quote)
+      (setq c-new-BEG (min c-new-BEG Rquote)
+           c-new-END (max c-new-END close-quote)))
+     ;; We're changing only the text of the identifier of the opening
+     ;; delimiter of a raw string.
+     ((and (eq (car c-old-beg-rs) 'open-delim)
+          (equal c-old-beg-rs c-old-end-rs))))))
+
+(defun c-propertize-raw-string-id (start end)
+  ;; If the raw string identifier between buffer positions START and END
+  ;; contains any double quote characters, put a punctuation syntax-table text
+  ;; property on them.  The return value is of no significance.
+  (save-excursion
+    (goto-char start)
+    (while (and (skip-chars-forward "^\"" end)
+               (< (point) end))
+      (c-put-char-property (point) 'syntax-table '(1))
+      (c-truncate-semi-nonlit-pos-cache (point))
+      (forward-char))))
 
 (defun c-propertize-raw-string-opener (id open-quote open-paren bound)
   ;; Point is immediately after a raw string opening delimiter.  Apply any
@@ -6650,117 +6818,264 @@ comment at the start of cc-engine.el for more info."
   ;; ID, a string, is the delimiter's identifier.  OPEN-QUOTE and OPEN-PAREN
   ;; are the buffer positions of the delimiter's components.  BOUND is the
   ;; bound for searching for a matching closing delimiter; it is usually nil,
-  ;; but if we're inside a macro, it's the end of the macro.
-  ;;
-  ;; Point is moved to after the (terminated) raw string, or left after the
-  ;; unmatched opening delimiter, as the case may be.  The return value is of
-  ;; no significance.
-  (if (search-forward (concat ")" id "\"") bound t)
-      (let ((end-string (match-beginning 0))
-           (after-quote (match-end 0)))
-       (goto-char open-paren)
-       (while (progn (skip-syntax-forward "^\"" end-string)
-                     (< (point) end-string))
-         (c-put-char-property (point) 'syntax-table '(1)) ; punctuation
-         (c-truncate-semi-nonlit-pos-cache (point))
-         (forward-char))
-       (goto-char after-quote))
-    (c-put-char-property open-quote 'syntax-table '(1))             ; 
punctuation
-    (c-truncate-semi-nonlit-pos-cache open-quote)
-    (c-put-char-property open-paren 'syntax-table '(15))     ; generic string
-    (when bound
-      ;; In a CPP construct, we try to apply a generic-string `syntax-table'
-      ;; text property to the last possible character in the string, so that
-      ;; only characters within the macro get "stringed out".
-      (goto-char bound)
-      (if (save-restriction
-           (narrow-to-region (1+ open-paren) (point-max))
-           (re-search-backward
-            (eval-when-compile
-              ;; This regular expression matches either an escape pair (which
-              ;; isn't an escaped NL) (submatch 5) or a non-escaped character
-              ;; (which isn't itself a backslash) (submatch 10).  The long
-              ;; preambles to these (respectively submatches 2-4 and 6-9)
-              ;; ensure that we have the correct parity for sequences of
-              ;; backslashes, etc..
-              (concat "\\("            ; 1
-                      "\\(\\`[^\\]?\\|[^\\][^\\]\\)\\(\\\\\\(.\\|\n\\)\\)*" ; 
2-4
-                      "\\(\\\\.\\)"    ; 5
-                      "\\|"
-                      
"\\(\\`\\|[^\\]\\|\\(\\`[^\\]?\\|[^\\][^\\]\\)\\(\\\\\\(.\\|\n\\)\\)+\\)" ; 6-9
-                      "\\([^\\]\\)"    ; 10
-                      "\\)"
-                      "\\(\\\\\n\\)*\\=")) ; 11
-             (1+ open-paren) t))
-         (if (match-beginning 10)
-             (progn
-               (c-put-char-property (match-beginning 10) 'syntax-table '(15))
-               (c-truncate-semi-nonlit-pos-cache (match-beginning 10)))
-           (c-put-char-property (match-beginning 5) 'syntax-table '(1))
-           (c-put-char-property (1+ (match-beginning 5)) 'syntax-table '(15))
-           (c-truncate-semi-nonlit-pos-cache (1+ (match-beginning 5))))
-       (c-put-char-property open-paren 'syntax-table '(1)))
-      (goto-char bound))))
-
-(defun c-after-change-re-mark-raw-strings (_beg _end _old-len)
-  ;; This function applies `syntax-table' text properties to C++ raw strings
-  ;; beginning in the region (c-new-BEG c-new-END).  BEG, END, and OLD-LEN are
-  ;; the standard arguments supplied to any after-change function.
+  ;; but if we're inside a macro, it's the end of the macro (i.e. the position
+  ;; of the closing newline).
+  ;;
+  ;; Point is moved to after the (terminated) raw string and t is returned, or
+  ;; it is left after the unmatched opening delimiter and nil is returned.
+  (c-propertize-raw-string-id (1+ open-quote) open-paren)
+  (prog1
+      (if (search-forward (concat ")" id "\"") bound t)
+         (let ((end-string (match-beginning 0))
+               (after-quote (match-end 0)))
+           (c-propertize-raw-string-id
+            (1+ (match-beginning 0)) (1- (match-end 0)))
+           (goto-char open-paren)
+           (while (progn (skip-syntax-forward "^\"" end-string)
+                         (< (point) end-string))
+             (c-put-char-property (point) 'syntax-table '(1)) ; punctuation
+             (c-truncate-semi-nonlit-pos-cache (point))
+             (forward-char))
+           (goto-char after-quote)
+           t)
+       (c-put-char-property open-quote 'syntax-table '(1)) ; punctuation
+       (c-truncate-semi-nonlit-pos-cache open-quote)
+       (c-put-char-property open-paren 'syntax-table '(15)) ; generic string
+       (when bound
+         ;; In a CPP construct, we try to apply a generic-string
+         ;; `syntax-table' text property to the last possible character in
+         ;; the string, so that only characters within the macro get
+         ;; "stringed out".
+         (goto-char bound)
+         (if (save-restriction
+               (narrow-to-region (1+ open-paren) (point-max))
+               (re-search-backward
+                (eval-when-compile
+                  ;; This regular expression matches either an escape pair
+                  ;; (which isn't an escaped NL) (submatch 5) or a
+                  ;; non-escaped character (which isn't itself a backslash)
+                  ;; (submatch 10).  The long preambles to these
+                  ;; (respectively submatches 2-4 and 6-9) ensure that we
+                  ;; have the correct parity for sequences of backslashes,
+                  ;; etc..
+                  (concat "\\("        ; 1
+                          
"\\(\\`[^\\]?\\|[^\\][^\\]\\)\\(\\\\\\(.\\|\n\\)\\)*" ; 2-4
+                          "\\(\\\\.\\)" ; 5
+                          "\\|"
+                          
"\\(\\`\\|[^\\]\\|\\(\\`[^\\]?\\|[^\\][^\\]\\)\\(\\\\\\(.\\|\n\\)\\)+\\)" ; 6-9
+                          "\\([^\\]\\)" ; 10
+                          "\\)"
+                          "\\(\\\\\n\\)*\\=")) ; 11
+                (1+ open-paren) t))
+             (if (match-beginning 10)
+                 (progn
+                   (c-put-char-property (match-beginning 10) 'syntax-table 
'(15))
+                   (c-truncate-semi-nonlit-pos-cache (match-beginning 10)))
+               (c-put-char-property (match-beginning 5) 'syntax-table '(1))
+               (c-put-char-property (1+ (match-beginning 5)) 'syntax-table 
'(15))
+               (c-truncate-semi-nonlit-pos-cache (1+ (match-beginning 5))))
+           ;; (c-put-char-property open-paren 'syntax-table '(1))
+           )
+         (goto-char bound))
+       nil)
+  ;; Ensure the opening delimiter will get refontified.
+    (c-font-lock-flush (1- open-quote) (1+ open-paren))))
+
+(defun c-after-change-unmark-raw-strings (beg end _old-len)
+  ;; This function removes `syntax-table' text properties from any raw strings
+  ;; which have been affected by the current change.  These are those which
+  ;; have been "stringed out" and from newly formed raw strings, or any
+  ;; existing raw string which the new text terminates.  BEG, END, and
+  ;; _OLD-LEN are the standard arguments supplied to any
+  ;; after-change-function.
   ;;
   ;; Point is undefined on both entry and exit, and the return value has no
   ;; significance.
   ;;
-  ;; This function is called as an after-change function solely due to its
+  ;; This functions is called as an after-change function by virtue of its
   ;; membership of the C++ value of `c-before-font-lock-functions'.
-  (c-save-buffer-state ()
-    ;; If the region (c-new-BEG c-new-END) has expanded, remove
-    ;; `syntax-table' text-properties from the new piece(s).
-    (when (< c-new-BEG c-old-BEG)
-      (let ((beg-rs (progn (goto-char c-old-BEG) (c-raw-string-pos))))
-       (c-depropertize-raw-strings-in-region
-        c-new-BEG
-        (if beg-rs
-            (1+ (or (nth 4 beg-rs) (nth 2 beg-rs)))
-          c-old-BEG))))
-    (when (> c-new-END c-old-END)
-      (let ((end-rs (progn (goto-char c-old-END) (c-raw-string-pos))))
-       (c-depropertize-raw-strings-in-region
-        (if end-rs
-            (cadr end-rs)
-          c-old-END)
-        c-new-END)))
+  ;; (when (< beg end)
+    (c-save-buffer-state (found eoll state id found-beg found-end)
+      ;; Has an inserted " swallowed up a R"(, turning it into "...R"(?
+      (goto-char end)
+      (setq eoll (c-point 'eoll))
+      (when (and (null c-old-END-literality)
+                (search-forward-regexp "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)("
+                                eoll t))
+       (setq state (c-state-semi-pp-to-literal end))
+       (when (eq (cadr state) 'string)
+         (unwind-protect
+             ;; Temporarily insert a closing string delimiter....
+             (progn
+               (goto-char end)
+               (cond
+                ((c-characterp (nth 3 (car state)))
+                 (insert (nth 3 (car state))))
+                ((eq (nth 3 (car state)) t)
+                 (insert ?\")
+                 (c-put-char-property end 'syntax-table '(15))))
+               (c-truncate-semi-nonlit-pos-cache end)
+               ;; ....ensure c-new-END extends right to the end of the about
+               ;; to be un-stringed raw string....
+               (save-excursion
+                 (goto-char (match-beginning 1))
+                 (let ((end-bs (c-raw-string-pos)))
+                   (setq c-new-END
+                         (max c-new-END
+                              (if (nth 4 end-bs)
+                                  (1+ (nth 4 end-bs))
+                                eoll)))))
+
+               ;; ...and clear `syntax-table' text propertes from the
+               ;; following raw strings.
+               (c-depropertize-raw-strings-in-region (point) (1+ eoll)))
+           ;; Remove the temporary string delimiter.
+           (goto-char end)
+           (delete-char 1))))
+
+      ;; Have we just created a new starting id?
+      (goto-char (max (- beg 18) (point-min)))
+      (while
+         (and
+          (setq found
+                (search-forward-regexp "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)("
+                                      c-new-END 'bound))
+          (<= (match-end 0) beg)))
+      (when (and found (<= (match-beginning 0) end))
+       (setq c-new-BEG (min c-new-BEG (match-beginning 0)))
+       (c-depropertize-raw-strings-in-region c-new-BEG c-new-END))
+
+      ;; Have we invalidated an opening delimiter by typing into it?
+      (when (and c-old-beg-rs
+                (eq (car c-old-beg-rs) 'open-delim)
+                (equal (c-get-char-property (cadr c-old-beg-rs)
+                                            'syntax-table)
+                       '(1)))
+       (goto-char (1- (cadr c-old-beg-rs)))
+       (unless (looking-at "R\"[^ ()\\\n\r\t]\\{0,16\\}(")
+         (c-clear-char-property (1+ (point)) 'syntax-table)
+         (c-truncate-semi-nonlit-pos-cache (1+ (point)))
+         (if (c-search-forward-char-property 'syntax-table '(15)
+                                             (c-point 'eol))
+             (c-clear-char-property (1- (point)) 'syntax-table))))
+
+      ;; Have we terminated an existing raw string by inserting or removing
+      ;; text?
+      (when (eq c-old-END-literality 'string)
+       (setq state (c-state-semi-pp-to-literal beg))
+       (cond
+        ;; Possibly terminating a(n un)terminated raw string.
+        ((eq (nth 3 (car state)) t)
+         (goto-char (nth 8 (car state)))
+         (when
+             (and (eq (char-after) ?\()
+                  (search-backward-regexp
+                   "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)\\=" (- (point) 18) t))
+           (setq id (match-string-no-properties 1)
+                 found-beg (match-beginning 0)
+                 found-end (1+ (match-end 0)))))
+        ;; Possibly terminating an already terminated raw string.
+        ((eq (nth 3 (car state)) ?\")
+         (goto-char (nth 8 (car state)))
+         (when
+             (and (eq (char-before) ?R)
+                  (looking-at "\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)("))
+           (setq id (match-string-no-properties 1)
+                 found-beg (1- (point))
+                 found-end (match-end 0)))))
+       (when id
+         (goto-char (max (- beg 18) (point-min)))
+         (when (search-forward (concat ")" id "\"") (+ end 1 (length id)) t)
+           ;; Has an earlier close delimiter just been inserted into an
+           ;; already terminated raw string?
+           (if (and (eq (nth 3 (car state)) ?\")
+                    (search-forward (concat ")" id "\"") nil t))
+               (setq found-end (point)))
+           (setq c-new-BEG (min c-new-BEG found-beg)
+                 c-new-END (max c-new-END found-end))
+           (c-clear-char-properties found-beg found-end 'syntax-table)
+           (c-truncate-semi-nonlit-pos-cache found-beg))))
+
+      ;; Are there any raw strings in a newly created macro?
+      (when (< beg end)
+       (goto-char beg)
+       (setq found-beg (point))
+       (when (search-forward-regexp c-anchored-cpp-prefix end t)
+         (c-end-of-macro)
+         (c-depropertize-raw-strings-in-region found-beg (point))))))
 
-    (goto-char c-new-BEG)
-    (while (and (< (point) c-new-END)
-               (re-search-forward
-                (concat "\\("                                 ; 1
-                        c-anchored-cpp-prefix                 ; 2
-                        "\\)\\|\\("                           ; 3
-                        "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)("  ; 4
-                        "\\)")
-                c-new-END t))
-      (when (save-excursion
-             (goto-char (match-beginning 0)) (not (c-in-literal)))
-       (if (match-beginning 4)         ; the id
-           ;; We've found a raw string.
+(defun c-maybe-re-mark-raw-string ()
+  ;; When this function is called, point is immediately after a ".  If this "
+  ;; is the characteristic " of of a raw string delimiter, apply the pertinent
+  ;; `syntax-table' text properties to the entire raw string (when properly
+  ;; terminated) or just the delimiter (otherwise).
+  ;;
+  ;; If the " is in any way part of a raw string, return non-nil.  Otherwise
+  ;; return nil.
+  (let ((here (point))
+       in-macro macro-end id Rquote found)
+    (cond
+     ((and
+       (eq (char-before (1- (point))) ?R)
+       (looking-at "\\([^ ()\\\n\r\t]\\{0,16\\}\\)("))
+      (save-excursion
+       (setq in-macro (c-beginning-of-macro))
+       (setq macro-end (when in-macro
+                         (c-end-of-macro)
+                         (point) ;; (min (1+ (point)) (point-max))
+                         )))
+      (if (not
+          (c-propertize-raw-string-opener
+           (match-string-no-properties 1) ; id
+           (1- (point))                   ; open quote
+           (match-end 1)                  ; open paren
+           macro-end))              ; bound (end of macro) or nil.
+         (goto-char (or macro-end (point-max))))
+      t)
+     ((save-excursion
+       (and
+        (search-backward-regexp ")\\([^ ()\\\n\r\t]\\{0,16\\}\\)\"\\=" nil t)
+        (setq id (match-string-no-properties 1))
+        (let* ((quoted-id (regexp-quote id))
+               (quoted-id-depth (regexp-opt-depth quoted-id)))
+          (while
+              (and
+               ;; Search back for an opening delimiter with identifier `id'.
+               ;; A closing delimiter with `id' "blocks" our search.
+               (search-backward-regexp ; This could be slow.
+                (concat "\\(R\"" quoted-id "(\\)"
+                        "\\|"
+                        "\\()" quoted-id "\"\\)")
+                nil t)
+               (setq found t)
+               (if (eq (c-in-literal) 'string)
+                   (match-beginning 1)
+                 (match-beginning (+ 2 quoted-id-depth)))))
+          (and found
+               (null (c-in-literal))
+               (match-beginning 1)))
+        (setq Rquote (point))))
+      (save-excursion
+       (goto-char Rquote)
+       (setq in-macro (c-beginning-of-macro))
+       (setq macro-end (when in-macro
+                         (c-end-of-macro)
+                         (point))))
+      (if (or (not in-macro)
+             (<= here macro-end))
+         (progn
            (c-propertize-raw-string-opener
-            (match-string-no-properties 4) ; id
-            (1+ (match-beginning 3))       ; open quote
-            (match-end 4)                  ; open paren
-            nil)                           ; bound
-         ;; We've found a CPP construct.  Search for raw strings within it.
-         (goto-char (match-beginning 2)) ; the "#"
-         (c-end-of-macro)
-         (let ((eom (point)))
-           (goto-char (match-end 2))   ; after the "#".
-           (while (and (< (point) eom)
-                       (c-syntactic-re-search-forward
-                        "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(" eom t))
-             (c-propertize-raw-string-opener
-              (match-string-no-properties 1) ; id
-              (1+ (match-beginning 0))       ; open quote
-              (match-end 1)                  ; open paren
-              eom))))))))                    ; bound
+            id (1+ (point)) (match-end 1) macro-end)
+           (goto-char here)
+           t)
+       (goto-char here)
+       nil))
+
+     (t
+      ;; If the " is in another part of a raw string (whether as part of the
+      ;; identifier, or in the string itself) the `syntax-table' text
+      ;; properties on the raw string will be current.  So, we can use...
+      (c-raw-string-pos)))))
 
 
 ;; Handling of small scale constructs like types and names.
@@ -6873,8 +7188,8 @@ comment at the start of cc-engine.el for more info."
   `(let (res)
      (setq c-last-identifier-range nil)
      (while (if (setq res ,(if (eq type 'type)
-                              `(c-forward-type)
-                            `(c-forward-name)))
+                              '(c-forward-type)
+                            '(c-forward-name)))
                nil
              (cond ((looking-at c-keywords-regexp)
                     (c-forward-keyword-clause 1))
@@ -6884,8 +7199,8 @@ comment at the start of cc-engine.el for more info."
      (when (memq res '(t known found prefix maybe))
        (when c-record-type-identifiers
         ,(if (eq type 'type)
-             `(c-record-type-id c-last-identifier-range)
-           `(c-record-ref-id c-last-identifier-range)))
+             '(c-record-type-id c-last-identifier-range)
+           '(c-record-ref-id c-last-identifier-range)))
        t)))
 
 (defmacro c-forward-id-comma-list (type update-safe-pos)
@@ -6896,7 +7211,7 @@ comment at the start of cc-engine.el for more info."
   ;; This macro might do hidden buffer changes.
   `(while (and (progn
                 ,(when update-safe-pos
-                   `(setq safe-pos (point)))
+                   '(setq safe-pos (point)))
                 (eq (char-after) ?,))
               (progn
                 (forward-char)
@@ -7917,7 +8232,7 @@ comment at the start of cc-engine.el for more info."
   ;; a comma.  If either of <symbol> or bracketed <expression> is missing,
   ;; throw nil to 'level.  If the terminating } or ) is unmatched, throw nil
   ;; to 'done.  This is not a general purpose macro!
-  `(while (eq (char-before) ?,)
+  '(while (eq (char-before) ?,)
      (backward-char)
      (c-backward-syntactic-ws)
      (when (not (memq (char-before) '(?\) ?})))
@@ -7981,49 +8296,28 @@ comment at the start of cc-engine.el for more info."
     (or res (goto-char here))
     res))
 
+(defun c-forward-class-decl ()
+  "From the beginning of a struct/union, etc. move forward to
+after the brace block which defines it, leaving point at the
+start of the next token and returning point.  On failure leave
+point unchanged and return nil."
+  (let ((here (point)))
+    (if
+       (and
+        (looking-at c-class-key)
+        (eq (c-forward-token-2) 0)
+        (c-on-identifier)
+        (eq (c-forward-token-2) 0)
+        (eq (char-after) ?{)
+        (c-go-list-forward))
+       (progn
+         (c-forward-syntactic-ws)
+         (point))
+      (goto-char here)
+      nil)))
 
 ;; Handling of large scale constructs like statements and declarations.
 
-;; Macro used inside `c-forward-decl-or-cast-1'.  It ought to be a
-;; defsubst or perhaps even a defun, but it contains lots of free
-;; variables that refer to things inside `c-forward-decl-or-cast-1'.
-(defmacro c-fdoc-shift-type-backward (&optional short)
-  ;; `c-forward-decl-or-cast-1' can consume an arbitrary length list
-  ;; of types when parsing a declaration, which means that it
-  ;; sometimes consumes the identifier in the declaration as a type.
-  ;; This is used to "backtrack" and make the last type be treated as
-  ;; an identifier instead.
-  `(progn
-     ,(unless short
-       ;; These identifiers are bound only in the inner let.
-       '(setq identifier-type at-type
-              identifier-start type-start
-              got-parens nil
-              got-identifier t
-              got-suffix t
-              got-suffix-after-parens id-start
-              paren-depth 0))
-
-     (if (setq at-type (if (eq backup-at-type 'prefix)
-                          t
-                        backup-at-type))
-        (setq type-start backup-type-start
-              id-start backup-id-start)
-       (setq type-start start-pos
-            id-start start-pos))
-
-     ;; When these flags already are set we've found specifiers that
-     ;; unconditionally signal these attributes - backtracking doesn't
-     ;; change that.  So keep them set in that case.
-     (or at-type-decl
-        (setq at-type-decl backup-at-type-decl))
-     (or maybe-typeless
-        (setq maybe-typeless backup-maybe-typeless))
-
-     ,(unless short
-       ;; This identifier is bound only in the inner let.
-       '(setq start id-start))))
-
 (defun c-forward-declarator (&optional limit accept-anon)
   ;; Assuming point is at the start of a declarator, move forward over it,
   ;; leaving point at the next token after it (e.g. a ) or a ; or a ,).
@@ -8176,6 +8470,176 @@ comment at the start of cc-engine.el for more info."
       (goto-char here)
       nil)))
 
+(defun c-do-declarators
+    (cdd-limit cdd-list cdd-not-top cdd-comma-prop cdd-function)
+  "Assuming point is at the start of a comma separated list of declarators,
+apply CDD-FUNCTION to each declarator (when CDD-LIST is non-nil) or just the
+first declarator (when CDD-LIST is nil).  When CDD-FUNCTION is nil, no
+function is applied.
+
+CDD-FUNCTION is supplied with 6 arguments:
+0. The start position of the declarator's identifier;
+1. The end position of this identifier;
+\[Note: if there is no identifier, as in int (*);, both of these are nil.]
+2. The position of the next token after the declarator (CLARIFY!!!).
+3. CDD-NOT-TOP;
+4. Non-nil if the identifier is of a function.
+5. When there is an initialization following the declarator (such as \"=
+....\" or \"( ....\".), the character which introduces this initialization,
+otherwise nil.
+
+Additionally, if CDD-COMMA-PROP is non-nil, mark the separating commas with
+this value of the c-type property, when CDD-LIST is non-nil.
+
+Stop at or before CDD-LIMIT (which may NOT be nil).
+
+If CDD-NOT-TOP is non-nil, we are not at the top-level (\"top-level\" includes
+being directly inside a class or namespace, etc.).
+
+Return non-nil if we've reached the token after the last declarator (often a
+semicolon, or a comma when CDD-LIST is nil); otherwise (when we hit CDD-LIMIT,
+or fail otherwise) return nil, leaving point at the beginning of the putative
+declarator that could not be processed.
+
+This function might do hidden buffer changes."
+  ;; N.B.: We use the "cdd-" prefix in this routine to try to prevent
+  ;; confusion with possible reference to common variable names from within
+  ;; CDD-FUNCTION.
+  (let
+      ((cdd-pos (point)) cdd-next-pos cdd-id-start cdd-id-end
+       cdd-decl-res cdd-got-func cdd-got-type cdd-got-init
+       c-last-identifier-range cdd-exhausted)
+
+    ;; The following `while' applies `cdd-function' to a single declarator id
+    ;; each time round.  It loops only when CDD-LIST is non-nil.
+    (while
+       (and (not cdd-exhausted)
+            (setq cdd-decl-res (c-forward-declarator cdd-limit)))
+      (setq cdd-next-pos (point)
+           cdd-id-start (car cdd-decl-res)
+           cdd-id-end (cadr cdd-decl-res)
+           cdd-got-func (and (eq (char-after) ?\()
+                         (or (not (c-major-mode-is 'c++-mode))
+                             (not cdd-not-top)
+                             (car (cddr (cddr cdd-decl-res))) ; Id is in
+                                       ; parens, etc.
+                             (save-excursion
+                               (forward-char)
+                               (c-forward-syntactic-ws)
+                               (looking-at "[*&]")))
+                         (not (car (cddr cdd-decl-res)))
+                         (or (not (c-major-mode-is 'c++-mode))
+                             (save-excursion
+                               (let (c-last-identifier-range)
+                                 (forward-char)
+                                 (c-forward-syntactic-ws)
+                                 (catch 'is-function
+                                   (while
+                                       (progn
+                                         (if (eq (char-after) ?\))
+                                             (throw 'is-function t))
+                                         (setq cdd-got-type (c-forward-type))
+                                         (cond
+                                          ((null cdd-got-type)
+                                           (throw 'is-function nil))
+                                          ((not (eq cdd-got-type 'maybe))
+                                           (throw 'is-function t)))
+                                         (c-forward-declarator nil t)
+                                         (eq (char-after) ?,))
+                                     (forward-char)
+                                     (c-forward-syntactic-ws))
+                                   t)))))
+           cdd-got-init (and (cadr (cddr cdd-decl-res))
+                         (char-after)))
+
+      ;; Jump past any initializer or function prototype to see if
+      ;; there's a ',' to continue at.
+      (cond (cdd-got-func
+            ;; Skip a parenthesized initializer (C++) or a function
+            ;; prototype.
+            (if (c-go-list-forward (point) cdd-limit) ; over the parameter 
list.
+                (c-forward-syntactic-ws cdd-limit)
+              (setq cdd-exhausted t))) ; unbalanced parens
+
+           (cdd-got-init       ; "=" sign OR opening "(", "[", or "{"
+            ;; Skip an initializer expression.  If we're at a '='
+            ;; then accept a brace list directly after it to cope
+            ;; with array initializers.  Otherwise stop at braces
+            ;; to avoid going past full function and class blocks.
+            (if (and (if (and (eq cdd-got-init ?=)
+                              (= (c-forward-token-2 1 nil cdd-limit) 0)
+                              (looking-at "{"))
+                         (c-go-list-forward (point) cdd-limit)
+                       t)
+                     ;; FIXME: Should look for c-decl-end markers here;
+                     ;; we might go far into the following declarations
+                     ;; in e.g. ObjC mode (see e.g. methods-4.m).
+                     (c-syntactic-re-search-forward "[;,{]" cdd-limit 'move t))
+                (backward-char)
+              (setq cdd-exhausted t)
+              ))
+
+           (t (c-forward-syntactic-ws cdd-limit)))
+
+      (if cdd-function
+         (funcall cdd-function cdd-id-start cdd-id-end cdd-next-pos
+                  cdd-not-top cdd-got-func cdd-got-init))
+
+      ;; If a ',' is found we set cdd-pos to the next declarator and iterate.
+      (if (and cdd-list (< (point) cdd-limit) (looking-at ","))
+         (progn
+           (when cdd-comma-prop
+             (c-put-char-property (point) 'c-type cdd-comma-prop))
+           (forward-char)
+           (c-forward-syntactic-ws cdd-limit)
+           (setq cdd-pos (point)))
+       (setq cdd-exhausted t)))
+
+    (if (> (point) cdd-pos)
+       t
+      (goto-char cdd-pos)
+      nil)))
+
+;; Macro used inside `c-forward-decl-or-cast-1'.  It ought to be a
+;; defsubst or perhaps even a defun, but it contains lots of free
+;; variables that refer to things inside `c-forward-decl-or-cast-1'.
+(defmacro c-fdoc-shift-type-backward (&optional short)
+  ;; `c-forward-decl-or-cast-1' can consume an arbitrary length list
+  ;; of types when parsing a declaration, which means that it
+  ;; sometimes consumes the identifier in the declaration as a type.
+  ;; This is used to "backtrack" and make the last type be treated as
+  ;; an identifier instead.
+  `(progn
+     ,(unless short
+       ;; These identifiers are bound only in the inner let.
+       '(setq identifier-type at-type
+              identifier-start type-start
+              got-parens nil
+              got-identifier t
+              got-suffix t
+              got-suffix-after-parens id-start
+              paren-depth 0))
+
+     (if (setq at-type (if (eq backup-at-type 'prefix)
+                          t
+                        backup-at-type))
+        (setq type-start backup-type-start
+              id-start backup-id-start)
+       (setq type-start start-pos
+            id-start start-pos))
+
+     ;; When these flags already are set we've found specifiers that
+     ;; unconditionally signal these attributes - backtracking doesn't
+     ;; change that.  So keep them set in that case.
+     (or at-type-decl
+        (setq at-type-decl backup-at-type-decl))
+     (or maybe-typeless
+        (setq maybe-typeless backup-maybe-typeless))
+
+     ,(unless short
+       ;; This identifier is bound only in the inner let.
+       '(setq start id-start))))
+
 (defun c-forward-decl-or-cast-1 (preceding-token-end context last-cast-end)
   ;; Move forward over a declaration or a cast if at the start of one.
   ;; The point is assumed to be at the start of some token.  Nil is
@@ -8543,6 +9007,8 @@ comment at the start of cc-engine.el for more info."
          got-parens
          ;; True if there is an identifier in the declarator.
          got-identifier
+         ;; True if we find a number where an identifier was expected.
+         got-number
          ;; True if there's a non-close-paren match of
          ;; `c-type-decl-suffix-key'.
          got-suffix
@@ -8620,7 +9086,9 @@ comment at the start of cc-engine.el for more info."
          (and (looking-at c-identifier-start)
               (setq pos (point))
               (setq got-identifier (c-forward-name))
-              (setq name-start pos)))
+              (setq name-start pos))
+         (when (looking-at "[0-9]")
+           (setq got-number t))) ; We've probably got an arithmetic expression.
 
       ;; Skip over type decl suffix operators and trailing noise macros.
       (while
@@ -8636,7 +9104,16 @@ comment at the start of cc-engine.el for more info."
                 (not (and (c-major-mode-is 'c-mode)
                           (not got-prefix)
                           (or (eq context 'top) make-top)
-                          (eq (char-after) ?\)))))
+                          (eq (char-after) ?\))
+                          (or (memq at-type '(nil maybe))
+                              (not got-identifier)
+                              (save-excursion
+                                (goto-char after-paren-pos)
+                                (c-forward-syntactic-ws)
+                                ;; Prevent the symbol being recorded as a type.
+                                (let (c-record-type-identifiers)
+                                  (not (memq (c-forward-type)
+                                             '(nil maybe)))))))))
            (if (eq (char-after) ?\))
                (when (> paren-depth 0)
                  (setq paren-depth (1- paren-depth))
@@ -8747,7 +9224,7 @@ comment at the start of cc-engine.el for more info."
 
         (setq at-decl-end
               (looking-at (cond ((eq context '<>) "[,>]")
-                                ((not (memq context '(nil top))) "[,\)]")
+                                ((not (memq context '(nil top))) "[,)]")
                                 (t "[,;]"))))
 
         ;; Now we've collected info about various characteristics of
@@ -9094,7 +9571,7 @@ comment at the start of cc-engine.el for more info."
 
           ;; CASE 18
           (when (and (not (memq context '(nil top)))
-                     (or got-prefix
+                     (or (and got-prefix (not got-number))
                          (and (eq context 'decl)
                               (not c-recognize-paren-inits)
                               (or got-parens got-suffix))))
@@ -9648,7 +10125,7 @@ comment at the start of cc-engine.el for more info."
 
   (let ((beg (point)) id-start)
     (and
-     (eq (c-beginning-of-statement-1 lim) 'same)
+     (eq (c-beginning-of-statement-1 lim nil nil nil t) 'same)
 
      (not (and (c-major-mode-is 'objc-mode)
               (c-forward-objc-directive)))
@@ -10100,7 +10577,7 @@ comment at the start of cc-engine.el for more info."
                          ;; Check for `c-opt-block-decls-with-vars-key'
                          ;; before the first paren.
                          (c-syntactic-re-search-forward
-                          (concat "[;=\(\[{]\\|\\("
+                          (concat "[;=([{]\\|\\("
                                   c-opt-block-decls-with-vars-key
                                   "\\)")
                           lim t t t)
@@ -10108,7 +10585,7 @@ comment at the start of cc-engine.el for more info."
                          (not (eq (char-before) ?_))
                          ;; Check that the first following paren is
                          ;; the block.
-                         (c-syntactic-re-search-forward "[;=\(\[{]"
+                         (c-syntactic-re-search-forward "[;=([{]"
                                                         lim t t t)
                          (eq (char-before) ?{))))))
            ;; The declaration doesn't have any of the
@@ -10655,12 +11132,17 @@ comment at the start of cc-engine.el for more info."
       )))
 
 (defun c-inside-bracelist-p (containing-sexp paren-state accept-in-paren)
-  ;; return the buffer position of the beginning of the brace list
-  ;; statement if we're inside a brace list, otherwise return nil.
-  ;; CONTAINING-SEXP is the buffer pos of the innermost containing
-  ;; paren.  PAREN-STATE is the remainder of the state of enclosing
-  ;; braces.  ACCEPT-IN-PAREN is non-nil iff we will accept as a brace
-  ;; list a brace directly enclosed in a parenthesis.
+  ;; return the buffer position of the beginning of the brace list statement
+  ;; if CONTAINING-SEXP is inside a brace list, otherwise return nil.
+  ;;
+  ;; CONTAINING-SEXP is the buffer pos of the innermost containing paren.  NO
+  ;; IT ISN'T!!!  [This function is badly designed, and probably needs
+  ;; reformulating without its first argument, and the critical position being
+  ;; at point.]
+  ;;
+  ;; PAREN-STATE is the remainder of the state of enclosing braces.
+  ;; ACCEPT-IN-PAREN is non-nil iff we will accept as a brace list a brace
+  ;; directly enclosed in a parenthesis.
   ;;
   ;; The "brace list" here is recognized solely by its context, not by
   ;; its contents.
@@ -10780,7 +11262,8 @@ comment at the start of cc-engine.el for more info."
 (defun c-looking-at-statement-block ()
   ;; Point is at an opening brace.  If this is a statement block (i.e. the
   ;; elements in the block are terminated by semicolons, or the block is
-  ;; empty, or the block contains a keyword) return t.  Otherwise, return nil.
+  ;; empty, or the block contains a keyword) return non-nil.  Otherwise,
+  ;; return nil.
   (let ((here (point)))
     (prog1
        (if (c-go-list-forward)
@@ -11284,7 +11767,7 @@ comment at the start of cc-engine.el for more info."
 
            (if (and (eq step-type 'same)
                     (/= paren-pos (point)))
-               (let (inexpr)
+               (let (inexpr bspec)
                  (cond
                   ((save-excursion
                      (goto-char paren-pos)
@@ -11306,6 +11789,13 @@ comment at the start of cc-engine.el for more info."
                          (c-looking-at-statement-block))
                        (c-add-syntax 'defun-block-intro nil)
                      (c-add-syntax 'brace-list-intro nil)))
+                  ((save-excursion
+                     (goto-char paren-pos)
+                     (setq bspec (c-looking-at-or-maybe-in-bracelist
+                                  containing-sexp containing-sexp))
+                     (and (consp bspec)
+                          (eq (cdr bspec) 'in-paren)))
+                   (c-add-syntax 'brace-list-intro (car bspec)))
                   (t (c-add-syntax 'defun-block-intro nil))))
 
              (c-add-syntax 'statement-block-intro nil)))
@@ -12711,7 +13201,7 @@ comment at the start of cc-engine.el for more info."
                               (c-back-over-member-initializers)
                               (point)))
                            (c-most-enclosing-brace state-cache (point))))
-             (c-beginning-of-statement-1 lim)
+             (c-beginning-of-statement-1 lim nil nil t)
              (c-add-stmt-syntax 'brace-list-intro nil t lim paren-state)))
 
           ;; CASE 9D: this is just a later brace-list-entry or
@@ -13170,7 +13660,7 @@ Cannot combine absolute offsets %S and %S in `add' 
method"
           nil))))
 
     (if (or (null res) (integerp res)
-           (and (vectorp res) (= (length res) 1) (integerp (aref res 0))))
+           (and (vectorp res) (>= (length res) 1) (integerp (aref res 0))))
        res
       (c-benign-error "Error evaluating offset %S for %s: Got invalid value %S"
                      offset symbol res)
@@ -13193,12 +13683,11 @@ Cannot combine absolute offsets %S and %S in `add' 
method"
       (if c-strict-syntax-p
          (c-benign-error "No offset found for syntactic symbol %s" symbol))
       (setq offset 0))
-    (if (vectorp offset)
-       offset
-      (or (and (numberp offset) offset)
-         (and (symbolp offset) (symbol-value offset))
-         0))
-    ))
+    (cond
+     ((or (vectorp offset) (numberp offset))
+      offset)
+     ((and (symbolp offset) (symbol-value offset)))
+     (t 0))))
 
 (defun c-get-offset (langelem)
   ;; This is a compatibility wrapper for `c-calc-offset' in case
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 79254ff..e7a3748 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1,6 +1,6 @@
 ;;; cc-fonts.el --- font lock support for CC Mode
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Authors:    2003- Alan Mackenzie
 ;;             2002- Martin Stjernholm
@@ -672,7 +672,7 @@ stuff.  Used on level 1 and higher."
 
       ,@(when (c-major-mode-is 'pike-mode)
          ;; Recognize hashbangs in Pike.
-         `((eval . (list "\\`#![^\n\r]*"
+         '((eval . (list "\\`#![^\n\r]*"
                          0 c-preprocessor-face-name))))
 
       ;; Make hard spaces visible through an inverted `font-lock-warning-face'.
@@ -1032,114 +1032,41 @@ casts and declarations are fontified.  Used on level 2 
and higher."
 
   ;;(message "c-font-lock-declarators from %s to %s" (point) limit)
   (c-fontify-types-and-refs
-      ((pos (point)) next-pos id-start
-       decl-res
-       id-face got-type got-init
-       c-last-identifier-range
-       (separator-prop (if types 'c-decl-type-start 'c-decl-id-start)))
-
-    ;; The following `while' fontifies a single declarator id each time round.
-    ;; It loops only when LIST is non-nil.
-    (while
-       (and pos (setq decl-res (c-forward-declarator)))
-      (setq next-pos (point)
-           id-start (car decl-res)
-           id-face (if (and (eq (char-after) ?\()
-                            (or (not (c-major-mode-is 'c++-mode))
-                                (not not-top)
-                                (car (cddr (cddr decl-res))) ; Id is in
-                                                             ; parens, etc.
-                                (save-excursion
-                                  (forward-char)
-                                  (c-forward-syntactic-ws)
-                                  (looking-at "[*&]")))
-                            (not (car (cddr decl-res)))
-                            (or (not (c-major-mode-is 'c++-mode))
-                                (save-excursion
-                                  (let (c-last-identifier-range)
-                                    (forward-char)
-                                    (c-forward-syntactic-ws)
-                                    (catch 'is-function
-                                      (while
-                                          (progn
-                                            (if (eq (char-after) ?\))
-                                                (throw 'is-function t))
-                                            (setq got-type (c-forward-type))
-                                            (cond
-                                             ((null got-type)
-                                              (throw 'is-function nil))
-                                             ((not (eq got-type 'maybe))
-                                              (throw 'is-function t)))
-                                            (c-forward-declarator nil t)
-                                            (eq (char-after) ?,))
-                                        (forward-char)
-                                        (c-forward-syntactic-ws))
-                                      t)))))
-                       'font-lock-function-name-face
-                     'font-lock-variable-name-face)
-           got-init (and (cadr (cddr decl-res)) ; got-init
-                         (char-after)))
-
-      (if types
-         ;; Register and fontify the identifier as a type.
-         (let ((c-promote-possible-types t))
-           (goto-char id-start)
-           (c-forward-type))
-       ;; Fontify the last symbol in the identifier if it isn't fontified
-       ;; already.  The check is necessary only in certain cases where this
-       ;; function is used "sloppily", e.g. in `c-simple-decl-matchers'.
-       (when (and c-last-identifier-range
-                  (not (get-text-property (car c-last-identifier-range)
-                                          'face)))
-         (c-put-font-lock-face (car c-last-identifier-range)
-                               (cdr c-last-identifier-range)
-                               id-face)))
-
-      (goto-char next-pos)
-      (setq pos nil)         ; So as to terminate the enclosing `while' form.
-      (if (and template-class
-              (eq got-init ?=) ; C++ "<class X = Y>"?
-              (c-forward-token-2 1 nil limit) ; Over "="
-              (let ((c-promote-possible-types t))
-                (c-forward-type t)))          ; Over "Y"
-         (setq list nil)) ; Shouldn't be needed.  We can't have a list, here.
-
-      (when list
-       ;; Jump past any initializer or function prototype to see if
-       ;; there's a ',' to continue at.
-       (cond ((eq id-face 'font-lock-function-name-face)
-              ;; Skip a parenthesized initializer (C++) or a function
-              ;; prototype.
-              (if (c-safe (c-forward-sexp 1) t) ; over the parameter list.
-                  (c-forward-syntactic-ws limit)
-                (goto-char limit)))    ; unbalanced parens
-
-             (got-init ; "=" sign OR opening "(", "[", or "{"
-              ;; Skip an initializer expression.  If we're at a '='
-              ;; then accept a brace list directly after it to cope
-              ;; with array initializers.  Otherwise stop at braces
-              ;; to avoid going past full function and class blocks.
-              (and (if (and (eq got-init ?=)
-                            (= (c-forward-token-2 1 nil limit) 0)
-                            (looking-at "{"))
-                       (c-safe (c-forward-sexp) t) ; over { .... }
-                     t)
-                   (< (point) limit)
-                   ;; FIXME: Should look for c-decl-end markers here;
-                   ;; we might go far into the following declarations
-                   ;; in e.g. ObjC mode (see e.g. methods-4.m).
-                   (c-syntactic-re-search-forward "[;,{]" limit 'move t)
-                   (backward-char)))
-
-             (t (c-forward-syntactic-ws limit)))
-
-       ;; If a ',' is found we set pos to the next declarator and iterate.
-       (when (and (< (point) limit) (looking-at ","))
-         (c-put-char-property (point) 'c-type separator-prop)
-         (forward-char)
-         (c-forward-syntactic-ws limit)
-         (setq pos (point))))))     ; acts to make the `while' form continue.
-  nil)
+      ()
+    (c-do-declarators
+     limit list not-top
+     (if types 'c-decl-type-start 'c-decl-id-start)
+     (lambda (id-start id-end end-pos not-top is-function init-char)
+       (if types
+          ;; Register and fontify the identifier as a type.
+          (let ((c-promote-possible-types t))
+            (goto-char id-start)
+            (c-forward-type))
+        ;; The following doesn't work properly (yet, 2018-09-22).
+        ;; (c-put-font-lock-face id-start id-end
+        ;;                    (if is-function
+        ;;                        'font-lock-function-name-face
+        ;;                      'font-lock-variable-name-face))
+        (when (and c-last-identifier-range
+                   (not (get-text-property (car c-last-identifier-range)
+                                           'face)))
+          ;; We use `c-last-identifier-range' rather than `id-start' and
+          ;; `id-end', since the latter two can be erroneous.  E.g. in
+          ;; "~Foo", `id-start' is at the tilde.  This is a bug in
+          ;; `c-forward-declarator'.
+          (c-put-font-lock-face (car c-last-identifier-range)
+                                (cdr c-last-identifier-range)
+                                (if is-function
+                                    'font-lock-function-name-face
+                                  'font-lock-variable-name-face))))
+       (and template-class
+           (eq init-char ?=)           ; C++ "<class X = Y>"?
+           (progn
+             (goto-char end-pos)
+             (c-forward-token-2 1 nil limit) ; Over "="
+             (let ((c-promote-possible-types t))
+               (c-forward-type t))))))
+    nil))
 
 (defun c-get-fontification-context (match-pos not-front-decl &optional toplev)
   ;; Return a cons (CONTEXT . RESTRICTED-<>-ARGLISTS) for MATCH-POS.
@@ -1250,12 +1177,14 @@ casts and declarations are fontified.  Used on level 2 
and higher."
           (c-put-char-property (1- match-pos)
                                'c-type 'c-decl-arg-start)
           (cons 'decl nil))
-         ;; Got an open paren preceded by an arith operator.
+         ;; Got (an) open paren(s) preceded by an arith operator.
          ((and (eq (char-before match-pos) ?\()
                (save-excursion
                  (goto-char match-pos)
-                 (and (zerop (c-backward-token-2 2))
-                      (looking-at c-arithmetic-op-regexp))))
+                 (while
+                     (and (zerop (c-backward-token-2))
+                          (eq (char-after) ?\()))
+                 (looking-at c-arithmetic-op-regexp)))
           (cons nil nil))
          ;; In a C++ member initialization list.
          ((and (eq (char-before match-pos) ?,)
@@ -1745,25 +1674,36 @@ casts and declarations are fontified.  Used on level 2 
and higher."
                        (goto-char string-start)
                        (and (eq (char-before) ?R)
                             (looking-at "\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(")
-                            (match-string-no-properties 1))))))
+                            (match-string-no-properties 1)))))
+        (content-start (and raw-id (point))))
+    ;; We go round the next loop twice per raw string, once for each "end".
     (while (< (point) limit)
       (if raw-id
+         ;; Search for the raw string end delimiter
          (progn
-           (if (search-forward-regexp (concat ")\\(" (regexp-quote raw-id) 
"\\)\"")
-                                      limit 'limit)
-               (c-put-font-lock-face (match-beginning 1) (point) 'default))
+           (when (search-forward-regexp (concat ")\\(" (regexp-quote raw-id) 
"\\)\"")
+                                        limit 'limit)
+             (c-put-font-lock-face content-start (match-beginning 1)
+                                   'font-lock-string-face)
+             (c-remove-font-lock-face (match-beginning 1) (point)))
            (setq raw-id nil))
-
+       ;; Search for the start of a raw string.
        (when (search-forward-regexp
               "R\\(\"\\)\\([^ ()\\\n\r\t]\\{0,16\\}\\)(" limit 'limit)
          (when
-             (or (and (eobp)
-                      (eq (c-get-char-property (1- (point)) 'face)
-                          'font-lock-warning-face))
-                 (eq (c-get-char-property (point) 'face) 
'font-lock-string-face)
-                 (and (equal (c-get-char-property (match-end 2) 'syntax-table) 
'(1))
-                      (equal (c-get-char-property (match-beginning 1) 
'syntax-table)
-                             '(1))))
+             ;; Make sure we're not in a comment or string.
+             (and
+              (not (memq (c-get-char-property (match-beginning 0) 'face)
+                         '(font-lock-comment-face 
font-lock-comment-delimiter-face
+                                                  font-lock-string-face)))
+              (or (and (eobp)
+                       (eq (c-get-char-property (1- (point)) 'face)
+                           'font-lock-warning-face))
+                  (not (eq (c-get-char-property (point) 'face) 
'font-lock-comment-face))
+                  ;; (eq (c-get-char-property (point) 'face) 
'font-lock-string-face)
+                  (and (equal (c-get-char-property (match-end 2) 
'syntax-table) '(1))
+                       (equal (c-get-char-property (match-beginning 1) 
'syntax-table)
+                              '(1)))))
            (let ((paren-prop (c-get-char-property (1- (point)) 'syntax-table)))
              (if paren-prop
                  (progn
@@ -1774,8 +1714,9 @@ casts and declarations are fontified.  Used on level 2 
and higher."
                         (equal paren-prop '(15))
                         (not (c-search-forward-char-property 'syntax-table 
'(15) limit)))
                      (goto-char limit)))
-               (c-put-font-lock-face (match-beginning 1) (match-end 2) 
'default)
-               (setq raw-id (match-string-no-properties 2)))))))))
+               (c-remove-font-lock-face (match-beginning 0) (match-end 2))
+               (setq raw-id (match-string-no-properties 2))
+               (setq content-start (match-end 0)))))))))
   nil)
 
 (defun c-font-lock-c++-lambda-captures (limit)
@@ -1937,7 +1878,7 @@ on level 2 only and so aren't combined with 
`c-complex-decl-matchers'."
 
       ;; Fontify generic colon labels in languages that support them.
       ,@(when (c-lang-const c-recognize-colon-labels)
-         `(c-font-lock-labels))))
+         '(c-font-lock-labels))))
 
 (c-lang-defconst c-complex-decl-matchers
   "Complex font lock matchers for types and declarations.  Used on level
@@ -1983,10 +1924,10 @@ on level 2 only and so aren't combined with 
`c-complex-decl-matchers'."
 
       ;; Fontify angle bracket arglists like templates in C++.
       ,@(when (c-lang-const c-recognize-<>-arglists)
-         `(c-font-lock-<>-arglists))
+         '(c-font-lock-<>-arglists))
 
       ,@(when (c-major-mode-is 'c++-mode)
-         `(c-font-lock-c++-lambda-captures))
+         '(c-font-lock-c++-lambda-captures))
 
       ;; The first two rules here mostly find occurrences that
       ;; `c-font-lock-declarations' has found already, but not
@@ -2008,7 +1949,7 @@ on level 2 only and so aren't combined with 
`c-complex-decl-matchers'."
       ,@(when (c-major-mode-is 'c++-mode)
          ;; This pattern is a probably a "(MATCHER . ANCHORED-HIGHLIGHTER)"
          ;; (see Elisp page "Search-based Fontification").
-         `(("\\<new\\>"
+         '(("\\<new\\>"
             (c-font-lock-c++-new))))
       ))
 
@@ -2076,10 +2017,10 @@ higher."
   t `(,@(when (c-lang-const c-brace-list-decl-kwds)
       ;; Fontify the remaining identifiers inside an enum list when we start
       ;; inside it.
-         `(c-font-lock-enum-tail
-      ;; Fontify the identifiers inside enum lists.  (The enum type
-      ;; name is handled by `c-simple-decl-matchers' or
-      ;; `c-complex-decl-matchers' below.
+         '(c-font-lock-enum-tail
+           ;; Fontify the identifiers inside enum lists.  (The enum type
+           ;; name is handled by `c-simple-decl-matchers' or
+           ;; `c-complex-decl-matchers' below.
            c-font-lock-enum-body))
 
        ;; Fontify labels after goto etc.
@@ -2130,7 +2071,7 @@ higher."
                     (if (> (point) limit) (goto-char limit))))))))
 
        ,@(when (c-major-mode-is 'java-mode)
-           `((eval . (list "\\<\\(@[a-zA-Z0-9]+\\)\\>" 1 c-annotation-face))))
+           '((eval . (list "\\<\\(@[a-zA-Z0-9]+\\)\\>" 1 c-annotation-face))))
       ))
 
 (c-lang-defconst c-matchers-1
diff --git a/lisp/progmodes/cc-guess.el b/lisp/progmodes/cc-guess.el
index 866e8b4..88e577a 100644
--- a/lisp/progmodes/cc-guess.el
+++ b/lisp/progmodes/cc-guess.el
@@ -1,6 +1,6 @@
 ;;; cc-guess.el --- guess indentation values by scanning existing code
 
-;; Copyright (C) 1985, 1987, 1992-2006, 2011-2018 Free Software
+;; Copyright (C) 1985, 1987, 1992-2006, 2011-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author:     1994-1995 Barry A. Warsaw
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index de49ad7..2dff5cf 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -1,6 +1,6 @@
 ;;; cc-langs.el --- language specific settings for CC Mode -*- coding: utf-8 
-*-
 
-;; Copyright (C) 1985, 1987, 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2019 Free Software Foundation, Inc.
 
 ;; Authors:    2002- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -293,7 +293,7 @@ the evaluated constant value at compile time."
       ["Forward Statement"      c-end-of-statement t]
       ,@(when (c-lang-const c-opt-cpp-prefix)
          ;; Only applicable if there's a cpp preprocessor.
-         `(["Up Conditional"         c-up-conditional t]
+         '(["Up Conditional"         c-up-conditional t]
            ["Backward Conditional"   c-backward-conditional t]
            ["Forward Conditional"    c-forward-conditional t]
            "----"
@@ -383,9 +383,9 @@ The syntax tables aren't stored directly since they're 
quite large."
                 ;; its compiler directives as single keyword tokens.
                 ;; This is then necessary since it's assumed that
                 ;; every keyword is a single symbol.
-                `(modify-syntax-entry ?@ "_" table))
+                '(modify-syntax-entry ?@ "_" table))
                ((c-major-mode-is 'pike-mode)
-                `(modify-syntax-entry ?@ "." table)))
+                '(modify-syntax-entry ?@ "." table)))
         table)))
 
 (c-lang-defconst c-mode-syntax-table
@@ -497,25 +497,25 @@ parameters \(point-min) and \(point-max).")
   ;; For documentation see the following c-lang-defvar of the same name.
   ;; The value here may be a list of functions or a single function.
   t '(c-depropertize-new-text
-      c-after-change-re-mark-unbalanced-strings
+      c-after-change-mark-abnormal-strings
       c-change-expand-fl-region)
   (c objc) '(c-depropertize-new-text
             c-parse-quotes-after-change
-            c-after-change-re-mark-unbalanced-strings
+            c-after-change-mark-abnormal-strings
             c-extend-font-lock-region-for-macros
             c-neutralize-syntax-in-CPP
             c-change-expand-fl-region)
   c++ '(c-depropertize-new-text
+       c-after-change-unmark-raw-strings
        c-parse-quotes-after-change
-       c-after-change-re-mark-unbalanced-strings
+       c-after-change-mark-abnormal-strings
        c-extend-font-lock-region-for-macros
-       c-after-change-re-mark-raw-strings
        c-neutralize-syntax-in-CPP
        c-restore-<>-properties
        c-change-expand-fl-region)
   java '(c-depropertize-new-text
         c-parse-quotes-after-change
-        c-after-change-re-mark-unbalanced-strings
+        c-after-change-mark-abnormal-strings
         c-restore-<>-properties
         c-change-expand-fl-region)
   awk '(c-depropertize-new-text
@@ -599,13 +599,21 @@ EOL terminated statements."
 (c-lang-defvar c-has-bitfields (c-lang-const c-has-bitfields))
 
 (c-lang-defconst c-single-quotes-quote-strings
-  "Whether the language uses single quotes for multi-char strings."
+  "Whether the language uses single quotes for multi-char strings.
+
+Note that to set up a language to use this, additionally:
+\(i) the syntax of \"'\" must be \"string quote\" (7);
+\(ii) the language's value of `c-has-quoted-numbers' must be nil;
+\(iii) the language's value of `c-get-state-before-change-functions' may not
+  contain `c-parse-quotes-before-change';
+\(iv) the language's value of `c-before-font-lock-functions' may not contain
+  `c-parse-quotes-after-change'."
   t nil)
 (c-lang-defvar c-single-quotes-quote-strings
               (c-lang-const c-single-quotes-quote-strings))
 
 (c-lang-defconst c-string-delims
-  "A list of characters which can delimit arbitrary length strings"
+;; A list of characters which can delimit arbitrary length strings.
   t (if (c-lang-const c-single-quotes-quote-strings)
        '(?\" ?\')
       '(?\")))
@@ -927,6 +935,19 @@ file name in angle brackets or quotes."
           '("include"))
   objc '("include" "import"))
 
+(c-lang-defconst c-cpp-include-key
+  ;; Matches an include directive anchored at BOL including any trailing
+  ;; whitespace, e.g. " # include  "
+  t (if (and (c-lang-const c-anchored-cpp-prefix)
+            (c-lang-const c-cpp-include-directives))
+       (concat
+        (c-lang-const c-anchored-cpp-prefix)
+        (c-make-keywords-re 'appendable
+          (c-lang-const c-cpp-include-directives))
+        "[ \t]*")
+      "a\\`"))                         ; Doesn't match anything
+(c-lang-defvar c-cpp-include-key (c-lang-const c-cpp-include-key))
+
 (c-lang-defconst c-opt-cpp-macro-define
   "Cpp directive (without the prefix) that is followed by a macro
 definition, or nil if the language doesn't have any."
@@ -1046,16 +1067,16 @@ since CC Mode treats every identifier as an expression."
       ;; Primary.
       ,@(c-lang-const c-identifier-ops)
       ,@(cond ((or (c-major-mode-is 'c++-mode) (c-major-mode-is 'java-mode))
-              `((postfix-if-paren "<" ">"))) ; Templates.
+              '((postfix-if-paren "<" ">"))) ; Templates.
              ((c-major-mode-is 'pike-mode)
-              `((prefix "global" "predef")))
+              '((prefix "global" "predef")))
              ((c-major-mode-is 'java-mode)
-              `((prefix "super"))))
+              '((prefix "super"))))
 
       ;; Postfix.
       ,@(when (c-major-mode-is 'c++-mode)
          ;; The following need special treatment.
-         `((prefix "dynamic_cast" "static_cast"
+         '((prefix "dynamic_cast" "static_cast"
                    "reinterpret_cast" "const_cast" "typeid"
                     "alignof")))
       (left-assoc "."
@@ -1085,7 +1106,7 @@ since CC Mode treats every identifier as an expression."
 
       ;; Member selection.
       ,@(when (c-major-mode-is 'c++-mode)
-         `((left-assoc ".*" "->*")))
+         '((left-assoc ".*" "->*")))
 
       ;; Multiplicative.
       (left-assoc "*" "/" "%")
@@ -1529,6 +1550,17 @@ properly."
 (c-lang-defvar c-block-comment-ender-regexp
               (c-lang-const c-block-comment-ender-regexp))
 
+(c-lang-defconst c-font-lock-comment-end-skip
+  ;; Regexp which matches whitespace followed by the end of a block comment
+  ;; (if such exists in the language).  This is used by font lock to determine
+  ;; the portion of the end of a comment to fontify with
+  ;; `font-lock-comment-delimiter-face'.
+  t (if (c-lang-const c-block-comment-ender)
+       (concat "[ \t]*" (c-lang-const c-block-comment-ender-regexp))
+      "a\\`"))                         ; Doesn't match anything.
+(c-lang-setvar font-lock-comment-end-skip
+              (c-lang-const c-font-lock-comment-end-skip))
+
 (c-lang-defconst c-comment-start-regexp
   ;; Regexp to match the start of any type of comment.
   t (let ((re (c-make-keywords-re nil
@@ -3234,7 +3266,7 @@ Identifier syntax is in effect when this is matched \(see
               "\\|"
               "\\.\\.\\."
               "\\|"
-              "[*(&]"
+              "[*(&~]"
               "\\|"
               (c-lang-const c-type-decl-prefix-key)
               "\\|"
diff --git a/lisp/progmodes/cc-menus.el b/lisp/progmodes/cc-menus.el
index a42fe27..c8e37e0 100644
--- a/lisp/progmodes/cc-menus.el
+++ b/lisp/progmodes/cc-menus.el
@@ -1,6 +1,6 @@
 ;;; cc-menus.el --- imenu support for CC Mode
 
-;; Copyright (C) 1985, 1987, 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2019 Free Software Foundation, Inc.
 
 ;; Authors:    1998- Martin Stjernholm
 ;;             1992-1999 Barry A. Warsaw
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index cc1991a..49268c4 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1,6 +1,6 @@
 ;;; cc-mode.el --- major mode for editing C and similar languages
 
-;; Copyright (C) 1985, 1987, 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2019 Free Software Foundation, Inc.
 
 ;; Authors:    2003- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -678,14 +678,12 @@ that requires a literal mode spec at compile time."
 (make-variable-buffer-local 'c-new-BEG)
 (defvar c-new-END 0)
 (make-variable-buffer-local 'c-new-END)
-;; The following two variables record the values of `c-new-BEG' and
-;; `c-new-END' just after `c-new-END' has been adjusted for the length of text
-;; inserted or removed.  They may be read by any after-change function (but
-;; should not be altered by one).
-(defvar c-old-BEG 0)
-(make-variable-buffer-local 'c-old-BEG)
-(defvar c-old-END 0)
-(make-variable-buffer-local 'c-old-END)
+
+;; Buffer local variable which notes the value of calling `c-in-literal' just
+;; before a change.  It is one of 'string, 'c, 'c++ (for the two sorts of
+;; comments), or nil.
+(defvar c-old-END-literality nil)
+(make-variable-buffer-local 'c-old-END-literality)
 
 (defun c-common-init (&optional mode)
   "Common initialization for all CC Mode modes.
@@ -900,7 +898,8 @@ Note that the style variables are always made local to the 
buffer."
 
 (defun c-depropertize-CPP (beg end)
   ;; Remove the punctuation syntax-table text property from the CPP parts of
-  ;; (c-new-BEG c-new-END).
+  ;; (c-new-BEG c-new-END), and remove all syntax-table properties from any
+  ;; raw strings within these CPP parts.
   ;;
   ;; This function is in the C/C++/ObjC values of
   ;; `c-get-state-before-change-functions' and is called exclusively as a
@@ -912,6 +911,7 @@ Note that the style variables are always made local to the 
buffer."
       (goto-char (match-beginning 1))
       (setq m-beg (point))
       (c-end-of-macro)
+      (save-excursion (c-depropertize-raw-strings-in-region m-beg (point)))
       (c-clear-char-property-with-value m-beg (point) 'syntax-table '(1)))
 
     (while (and (< (point) end)
@@ -920,14 +920,16 @@ Note that the style variables are always made local to 
the buffer."
       (goto-char (match-beginning 1))
       (setq m-beg (point))
       (c-end-of-macro))
-    (if (and ss-found (> (point) end))
-       (c-clear-char-property-with-value m-beg (point) 'syntax-table '(1)))
+    (when (and ss-found (> (point) end))
+      (save-excursion (c-depropertize-raw-strings-in-region m-beg (point)))
+      (c-clear-char-property-with-value m-beg (point) 'syntax-table '(1)))
 
     (while (and (< (point) c-new-END)
                (search-forward-regexp c-anchored-cpp-prefix c-new-END 'bound))
       (goto-char (match-beginning 1))
       (setq m-beg (point))
       (c-end-of-macro)
+      (save-excursion (c-depropertize-raw-strings-in-region m-beg (point)))
       (c-clear-char-property-with-value
        m-beg (point) 'syntax-table '(1)))))
 
@@ -1210,11 +1212,15 @@ Note that the style variables are always made local to 
the buffer."
               (while
                   (and
                    (c-syntactic-re-search-forward
-                    "\"\\|\\s|" (point-max) t t)
+                    (if c-single-quotes-quote-strings
+                        "[\"']\\|\\s|"
+                      "\"\\|\\s|")
+                    (point-max) t t)
                    (progn
                      (c-clear-char-property (1- (point)) 'syntax-table)
-                     (not (eq (char-before) ?\")))))
-              (eq (char-before) ?\"))
+                     (c-truncate-semi-nonlit-pos-cache (1- (point)))
+                     (not (memq (char-before) c-string-delims)))))
+              (memq (char-before) c-string-delims))
             (progn
               (c-pps-to-string-delim (point-max))
               (< (point) (point-max))))))
@@ -1226,7 +1232,9 @@ Note that the style variables are always made local to 
the buffer."
                     (eq beg-literal-type 'string))))
       ;; Deal with deletion of backslashes before "s.
       (goto-char end)
-      (if (and (looking-at "\\\\*\"")
+      (if (and (looking-at (if c-single-quotes-quote-strings
+                              "\\\\*[\"']"
+                            "\\\\*\""))
               (eq (logand (skip-chars-backward "\\\\" beg) 1) 1))
          (setq c-bc-changed-stringiness (not c-bc-changed-stringiness)))
       (if (eq beg-literal-type 'string)
@@ -1247,27 +1255,38 @@ Note that the style variables are always made local to 
the buffer."
                (forward-char)
                (backward-sexp)
                (c-clear-char-property eoll-1 'syntax-table)
-               (c-clear-char-property (point) 'syntax-table))
+               (c-clear-char-property (point) 'syntax-table)
+               (c-truncate-semi-nonlit-pos-cache (point)))
            ;; Opening " at EOB.
            (c-clear-char-property (1- (point)) 'syntax-table))
-       (if (c-search-backward-char-property 'syntax-table '(15) c-new-BEG)
-           ;; Opening " on last line of text (without EOL).
-           (c-clear-char-property (point) 'syntax-table))))
+       (when (and (c-search-backward-char-property 'syntax-table '(15) 
c-new-BEG)
+                  (memq (char-after) c-string-delims)) ; Ignore an 
unterminated raw string's (.
+         ;; Opening " on last line of text (without EOL).
+         (c-clear-char-property (point) 'syntax-table)
+         (c-truncate-semi-nonlit-pos-cache (point)))))
 
      (t (goto-char end)                        ; point-max
-       (if (c-search-backward-char-property 'syntax-table '(15) c-new-BEG)
-           (c-clear-char-property (point) 'syntax-table))))
+       (when
+           (and
+            (c-search-backward-char-property 'syntax-table '(15) c-new-BEG)
+            (memq (char-after) c-string-delims))
+         (c-clear-char-property (point) 'syntax-table)
+         (c-truncate-semi-nonlit-pos-cache (point)))))
 
     (unless (and c-multiline-string-start-char
                 (not (c-characterp c-multiline-string-start-char)))
-      (when (eq end-literal-type 'string)
-       (c-clear-char-property (1- (cdr end-limits)) 'syntax-table))
+      (when (and (eq end-literal-type 'string)
+                (not (eq (char-before (cdr end-limits)) ?\()))
+       (c-clear-char-property (1- (cdr end-limits)) 'syntax-table)
+       (c-truncate-semi-nonlit-pos-cache (1- (cdr end-limits))))
 
-      (when (eq beg-literal-type 'string)
+      (when (and (eq beg-literal-type 'string)
+                (memq (char-after (car beg-limits)) c-string-delims))
        (setq c-new-BEG (min c-new-BEG (car beg-limits)))
-       (c-clear-char-property (car beg-limits) 'syntax-table)))))
+       (c-clear-char-property (car beg-limits) 'syntax-table)
+       (c-truncate-semi-nonlit-pos-cache (car beg-limits))))))
 
-(defun c-after-change-re-mark-unbalanced-strings (beg end _old-len)
+(defun c-after-change-mark-abnormal-strings (beg end _old-len)
   ;; Mark any unbalanced strings in the region (c-new-BEG c-new-END) with
   ;; string fence syntax-table text properties.
   ;;
@@ -1318,7 +1337,8 @@ Note that the style variables are always made local to 
the buffer."
               (min (1+ (point)) (point-max)))))
           ((and (null beg-literal-type)
                 (goto-char beg)
-                (eq (char-before) c-multiline-string-start-char)
+                (and (not (bobp))
+                     (eq (char-before) c-multiline-string-start-char))
                 (memq (char-after) c-string-delims))
            (cons (point)
                  (progn
@@ -1343,22 +1363,24 @@ Note that the style variables are always made local to 
the buffer."
             (while (progn
                      (setq s (parse-partial-sexp (point) c-new-END nil
                                                  nil s 'syntax-table))
-                      (and (< (point) c-new-END)
-                           (or (not (nth 3 s))
-                               (not (memq (char-before) c-string-delims))))))
+                     (and (< (point) c-new-END)
+                          (or (not (nth 3 s))
+                              (not (memq (char-before) c-string-delims))))))
             ;; We're at the start of a string.
             (memq (char-before) c-string-delims)))
-       (if (c-unescaped-nls-in-string-p (1- (point)))
-           (looking-at "\\(\\\\\\(.\\|\n|\\\r\\)\\|[^\"]\\)*")
-         (looking-at (cdr (assq (char-before) c-string-innards-re-alist))))
-       (cond
-        ((memq (char-after (match-end 0)) '(?\n ?\r))
-         (c-put-char-property (1- (point)) 'syntax-table '(15))
-         (c-put-char-property (match-end 0) 'syntax-table '(15)))
-        ((or (eq (match-end 0) (point-max))
-             (eq (char-after (match-end 0)) ?\\)) ; \ at EOB
-         (c-put-char-property (1- (point)) 'syntax-table '(15))))
-       (goto-char (min (1+ (match-end 0)) (point-max)))
+       (unless (and (c-major-mode-is 'c++-mode)
+                    (c-maybe-re-mark-raw-string))
+         (if (c-unescaped-nls-in-string-p (1- (point)))
+             (looking-at "\\(\\\\\\(.\\|\n\\|\r\\)\\|[^\"]\\)*")
+           (looking-at (cdr (assq (char-before) c-string-innards-re-alist))))
+         (cond
+          ((memq (char-after (match-end 0)) '(?\n ?\r))
+           (c-put-char-property (1- (point)) 'syntax-table '(15))
+           (c-put-char-property (match-end 0) 'syntax-table '(15)))
+          ((or (eq (match-end 0) (point-max))
+               (eq (char-after (match-end 0)) ?\\)) ; \ at EOB
+           (c-put-char-property (1- (point)) 'syntax-table '(15))))
+         (goto-char (min (1+ (match-end 0)) (point-max))))
        (setq s nil)))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1475,7 +1497,7 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
   ;;
   ;; This function is called exclusively as a before-change function via the
   ;; variable `c-get-state-before-change-functions'.
-  (c-save-buffer-state ()
+  (c-save-buffer-state (case-fold-search)
     (goto-char c-new-BEG)
     ;; We need to scan for 's from the BO (logical) line.
     (beginning-of-line)
@@ -1491,13 +1513,13 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
        ((c-quoted-number-head-before-point)
        (if (>= (point) c-new-BEG)
            (setq c-new-BEG (match-beginning 0))))
-       ((looking-at "\\([^'\\]\\|\\\\.\\)'")
+       ((looking-at
+        "\\([^'\\]\\|\\\\\\([0-7]\\{1,3\\}\\|[xuU][0-9a-fA-F]+\\|.\\)\\)'")
        (goto-char (match-end 0))
        (if (> (match-end 0) c-new-BEG)
            (setq c-new-BEG (1- (match-beginning 0)))))
-       ((or (>= (point) (1- c-new-BEG))
-           (and (eq (point) (- c-new-BEG 2))
-                (eq (char-after) ?\\)))
+       ((save-excursion
+         (not (search-forward "'" c-new-BEG t)))
        (setq c-new-BEG (1- (point))))
        (t nil)))
 
@@ -1517,19 +1539,26 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
        (goto-char (match-end 0))
        (if (> (match-end 0) c-new-END)
            (setq c-new-END (match-end 0))))
-       ((looking-at "\\([^'\\]\\|\\\\.\\)'")
+       ((looking-at
+        "\\([^'\\]\\|\\\\\\([0-7]\\{1,3\\}\\|[xuU][0-9a-fA-F]+\\|.\\)\\)'")
        (goto-char (match-end 0))
        (if (> (match-end 0) c-new-END)
            (setq c-new-END (match-end 0))))
+       ((equal (c-get-char-property (1- (point)) 'syntax-table) '(1))
+       (when (c-search-forward-char-property-with-value-on-char
+              'syntax-table '(1) ?\' (c-point 'eoll))
+         (setq c-new-END (max (point) c-new-END))))
        (t nil)))
     ;; Having reached c-new-END, handle any 's after it whose context may be
-    ;; changed by the current buffer change.
+    ;; changed by the current buffer change.  The idea is to catch
+    ;; monstrosities like ',',',',',' changing "polarity".
     (goto-char c-new-END)
     (cond
      ((c-quoted-number-tail-after-point)
       (setq c-new-END (match-end 0)))
      ((looking-at
-       "\\(\\\\.\\|.\\)?\\('\\([^'\\]\\|\\\\.\\)\\)*'")
+       "\\(\\\\\\([0-7]\\{1,3\\}\\|[xuU][0-9a-fA-F]+\\|.\\)\\|.\\)?\
+\\('\\([^'\\]\\|\\\\\\([0-7]\\{1,3\\}\\|[xuU][0-9a-fA-F]+\\|.\\)\\)\\)*'")
       (setq c-new-END (match-end 0))))
 
     ;; Remove the '(1) syntax-table property from any "'"s within (c-new-BEG
@@ -1558,7 +1587,7 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
   ;;
   ;; This function is called exclusively as an after-change function via the
   ;; variable `c-before-font-lock-functions'.
-  (c-save-buffer-state (num-beg num-end)
+  (c-save-buffer-state (num-beg num-end case-fold-search)
     ;; Apply the needed syntax-table and c-digit-separator text properties to
     ;; quotes.
     (save-restriction
@@ -1580,7 +1609,9 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
               (c-put-char-properties-on-char num-beg num-end
                                              'c-digit-separator t ?')
               (goto-char num-end))
-             ((looking-at "\\([^\\']\\|\\\\.\\)'") ; balanced quoted 
expression.
+             ((looking-at
+               "\\([^\\']\\|\\\\\\([0-7]\\{1,3\\}\\|[xuU][0-9a-fA-F]+\\|.\\)\
+\\)'") ; balanced quoted expression.
               (goto-char (match-end 0)))
              (t
               (c-invalidate-state-cache (1- (point)))
@@ -1623,7 +1654,7 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
          ;; Are we coalescing two tokens together, e.g. "fo o" -> "foo"?
          (when (< beg end)
            (c-unfind-coalesced-tokens beg end))
-         (c-invalidate-sws-region-before end)
+         (c-invalidate-sws-region-before beg end)
          ;; Are we (potentially) disrupting the syntactic context which
          ;; makes a type a type?  E.g. by inserting stuff after "foo" in
          ;; "foo bar;", or before "foo" in "typedef foo *bar;"?
@@ -1721,7 +1752,6 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
   ;; (c-new-BEG c-new-END) will be the region to fontify.  It may become
   ;; larger than (beg end).
   (setq c-new-END (- (+ c-new-END (- end beg)) old-len))
-  (setq c-old-BEG c-new-BEG  c-old-END c-new-END)
 
   (unless (c-called-from-text-property-change-p)
     (setq c-just-done-before-change nil)
@@ -1779,6 +1809,7 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
   ;; lock context (etc.) fontification.
   (goto-char pos)
   (let ((lit-start (c-literal-start))
+       old-pos
        (new-pos pos)
        capture-opener
        bod-lim bo-decl)
@@ -1801,10 +1832,24 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
     (while
        ;; Go to a less nested declaration each time round this loop.
        (and
-        (c-syntactic-skip-backward "^;{}" bod-lim t)
+        (setq old-pos (point))
+        (let (pseudo)
+          (while
+              (progn
+                (c-syntactic-skip-backward "^;{}" bod-lim t)
+                (and (eq (char-before) ?})
+                     (save-excursion
+                       (backward-char)
+                       (setq pseudo (c-cheap-inside-bracelist-p 
(c-parse-state))))))
+            (goto-char pseudo))
+          t)
         (> (point) bod-lim)
         (progn (c-forward-syntactic-ws)
-               (setq bo-decl (point))
+               ;; Have we got stuck in a comment at EOB?
+               (not (and (eobp)
+                         (c-literal-start))))
+        (< (point) old-pos)
+        (progn (setq bo-decl (point))
                (or (not (looking-at c-protection-key))
                    (c-forward-keyword-clause 1)))
         (progn
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el
index a1f3261..92ea671 100644
--- a/lisp/progmodes/cc-styles.el
+++ b/lisp/progmodes/cc-styles.el
@@ -1,6 +1,6 @@
 ;;; cc-styles.el --- support for styles in CC Mode
 
-;; Copyright (C) 1985, 1987, 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2019 Free Software Foundation, Inc.
 
 ;; Authors:    2004- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -68,7 +68,9 @@
                         (arglist-close . c-lineup-arglist)
                         (inline-open . 0)
                         (brace-list-open . +)
-                        (brace-list-intro . c-lineup-arglist-intro-after-paren)
+                        (brace-list-intro . (first
+                                             
c-lineup-2nd-brace-entry-in-arglist
+                                             c-lineup-class-decl-init-+ +))
                         (topmost-intro-cont
                          . (first c-lineup-topmost-intro-cont
                                   c-lineup-gnu-DEFUN-intro-cont))))
@@ -95,6 +97,9 @@
                         (label . 0)
                         (statement-cont . +)
                         (inline-open . 0)
+                        (brace-list-intro . (first
+                                             
c-lineup-2nd-brace-entry-in-arglist
+                                             c-lineup-class-decl-init-+ +))
                         (inexpr-class . 0))))
 
     ("stroustrup"
@@ -104,6 +109,9 @@
                         (substatement-open . 0)
                         (substatement-label . 0)
                         (label . 0)
+                        (brace-list-intro . (first
+                                             
c-lineup-2nd-brace-entry-in-arglist
+                                             c-lineup-class-decl-init-+ +))
                         (statement-cont . +))))
 
     ("whitesmith"
@@ -194,6 +202,9 @@
      (c-offsets-alist  . ((substatement-open . 0)
                          (inextern-lang . 0)
                          (arglist-intro . +)
+                         (brace-list-intro . (first
+                                              
c-lineup-2nd-brace-entry-in-arglist
+                                              c-lineup-class-decl-init-+ +))
                          (knr-argdecl-intro . +)))
      (c-hanging-braces-alist . ((brace-list-open)
                                (brace-list-intro)
@@ -219,6 +230,9 @@
                         (statement-cont        . +)
                         (arglist-intro  . c-lineup-arglist-intro-after-paren)
                         (arglist-close  . c-lineup-arglist)
+                        (brace-list-intro . (first
+                                             
c-lineup-2nd-brace-entry-in-arglist
+                                             c-lineup-class-decl-init-+ +))
                         (access-label   . 0)
                         (inher-cont     . c-lineup-java-inher)
                         (func-decl-cont . c-lineup-java-throws))))
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index 0475114..6e8acd4 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -1,6 +1,6 @@
 ;;; cc-vars.el --- user customization variables for CC Mode
 
-;; Copyright (C) 1985, 1987, 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2019 Free Software Foundation, Inc.
 
 ;; Authors:    2002- Alan Mackenzie
 ;;             1998- Martin Stjernholm
@@ -1115,7 +1115,7 @@ can always override the use of `c-default-style' by 
making calls to
        ;; Anchor pos: At the brace list decl start(*).
        (brace-list-intro      . +)
        ;; Anchor pos: At the brace list decl start(*).
-       (brace-list-entry      . c-lineup-under-anchor)
+       (brace-list-entry      . 0)
        ;; Anchor pos: At the first non-ws char after the open paren if
        ;; the first token is on the same line, otherwise boi at that
        ;; token.
@@ -1649,7 +1649,9 @@ white space either before or after the operator, but not 
both."
 
 ;; Initialize the next two to a regexp which never matches.
 (defvar c-noise-macro-with-parens-name-re "a\\`")
+(make-variable-buffer-local 'c-noise-macro-with-parens-name-re)
 (defvar c-noise-macro-name-re "a\\`")
+(make-variable-buffer-local 'c-noise-macro-name-re)
 
 (defcustom c-noise-macro-names nil
   "A list of names of macros which expand to nothing, or compiler extensions
@@ -1664,6 +1666,7 @@ this implicitly by reinitializing C/C++/Objc Mode on any 
buffer)."
   :type '(repeat :tag "List of names" string)
   :group 'c)
 (put 'c-noise-macro-names 'safe-local-variable #'c-string-list-p)
+(make-variable-buffer-local 'c-noise-macro-names)
 
 (defcustom c-noise-macro-with-parens-names nil
   "A list of names of macros \(or compiler extensions like \"__attribute__\")
@@ -1673,6 +1676,7 @@ These are recognized by CC Mode only in declarations."
   :type '(repeat :tag "List of names (possibly empty)" string)
   :group 'c)
 (put 'c-noise-macro-with-parens-names 'safe-local-variable #'c-string-list-p)
+(make-variable-buffer-local 'c-noise-macro-with-parens-names)
 
 (defun c-make-noise-macro-regexps ()
   ;; Convert `c-noise-macro-names' and `c-noise-macro-with-parens-names' into
diff --git a/lisp/progmodes/cfengine.el b/lisp/progmodes/cfengine.el
index 1bac042..efe648b 100644
--- a/lisp/progmodes/cfengine.el
+++ b/lisp/progmodes/cfengine.el
@@ -1,6 +1,6 @@
 ;;; cfengine.el --- mode for editing Cfengine files
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;; Maintainer: Ted Zlatanov <address@hidden>
@@ -852,8 +852,8 @@ This includes those for cfservd as well as cfagent.")
     ;; Classes.
     ("^[ \t]*\\([[:alnum:]_().|!]+\\)::" 1 font-lock-function-name-face)
     ;; Variables.
-    ("$(\\([[:alnum:]_]+\\))" 1 font-lock-variable-name-face)
-    ("${\\([[:alnum:]_]+\\)}" 1 font-lock-variable-name-face)
+    ("\\$(\\([[:alnum:]_]+\\))" 1 font-lock-variable-name-face)
+    ("\\${\\([[:alnum:]_]+\\)}" 1 font-lock-variable-name-face)
     ;; Variable definitions.
     ("\\_<\\([[:alnum:]_]+\\)[ \t]*=[ \t]*(" 1 font-lock-variable-name-face)
     ;; File, acl &c in group:   { token ... }
diff --git a/lisp/progmodes/cmacexp.el b/lisp/progmodes/cmacexp.el
index 7dcfb10..a081c02 100644
--- a/lisp/progmodes/cmacexp.el
+++ b/lisp/progmodes/cmacexp.el
@@ -1,6 +1,6 @@
 ;;; cmacexp.el --- expand C macros in a region
 
-;; Copyright (C) 1992, 1994, 1996, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1992, 1994, 1996, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Francesco Potortì <address@hidden>
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 7e7c18f..3650b05 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1,6 +1,6 @@
 ;;; compile.el --- run compiler as inferior of Emacs, parse error messages  
-*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1987, 1993-1999, 2001-2018 Free Software
+;; Copyright (C) 1985-1987, 1993-1999, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Authors: Roland McGrath <address@hidden>,
@@ -43,23 +43,20 @@
 ;;;###autoload
 (defcustom compilation-mode-hook nil
   "List of hook functions run by `compilation-mode'."
-  :type 'hook
-  :group 'compilation)
+  :type 'hook)
 
 ;;;###autoload
 (defcustom compilation-start-hook nil
   "Hook run after starting a new compilation process.
 The hook is run with one argument, the new process."
-  :type 'hook
-  :group 'compilation)
+  :type 'hook)
 
 ;;;###autoload
 (defcustom compilation-window-height nil
   "Number of lines in a compilation window.
 If nil, use Emacs default."
   :type '(choice (const :tag "Default" nil)
-                integer)
-  :group 'compilation)
+                integer))
 
 (defvar compilation-filter-hook nil
   "Hook run after `compilation-filter' has inserted a string into the buffer.
@@ -83,7 +80,10 @@ buffer.  This enables a major-mode to specify its own 
value.")
 (defvar compilation-parse-errors-filename-function nil
   "Function to call to post-process filenames while parsing error messages.
 It takes one arg FILENAME which is the name of a file as found
-in the compilation output, and should return a transformed file name.")
+in the compilation output, and should return a transformed file name
+or a buffer, the one which was compiled.")
+;; Note: the compilation-parse-errors-filename-function need not save the
+;; match data.
 
 ;;;###autoload
 (defvar compilation-process-setup-function nil
@@ -523,7 +523,7 @@ File = \\(.+\\), Line = \\([0-9]+\\)\\(?:, Column = 
\\([0-9]+\\)\\)?"
   "Alist of values for `compilation-error-regexp-alist'.")
 
 (defcustom compilation-error-regexp-alist
-  (mapcar 'car compilation-error-regexp-alist-alist)
+  (mapcar #'car compilation-error-regexp-alist-alist)
   "Alist that specifies how to match errors in compiler output.
 On GNU and Unix, any string is a valid filename, so these
 matchers must make some common sense assumptions, which catch
@@ -550,7 +550,8 @@ FILE can also have the form (FILE FORMAT...), where the 
FORMATs
 \(e.g. \"%s.c\") will be applied in turn to the recognized file
 name, until a file of that name is found.  Or FILE can also be a
 function that returns (FILENAME) or (RELATIVE-FILENAME . DIRNAME).
-In the former case, FILENAME may be relative or absolute.
+In the former case, FILENAME may be relative or absolute, or it may
+be a buffer.
 
 LINE can also be of the form (LINE . END-LINE) meaning a range
 of lines.  COLUMN can also be of the form (COLUMN . END-COLUMN)
@@ -577,8 +578,7 @@ listed text properties PROP# are given values VAL# as well."
   :type '(repeat (choice (symbol :tag "Predefined symbol")
                         (sexp :tag "Error specification")))
   :link `(file-link :tag "example file"
-                   ,(expand-file-name "compilation.txt" data-directory))
-  :group 'compilation)
+                   ,(expand-file-name "compilation.txt" data-directory)))
 
 ;;;###autoload(put 'compilation-directory 'safe-local-variable 'stringp)
 (defvar compilation-directory nil
@@ -638,7 +638,6 @@ If this is buffer-local in the destination buffer, Emacs 
obeys
 that value, otherwise it uses the value in the *compilation*
 buffer.  This enables a major-mode to specify its own value."
   :type 'boolean
-  :group 'compilation
   :version "20.4")
 
 (defcustom compilation-read-command t
@@ -649,15 +648,13 @@ Note that changing this to nil may be a security risk, 
because a
 file might define a malicious `compile-command' as a file local
 variable, and you might not notice.  Therefore, `compile-command'
 is considered unsafe if this variable is nil."
-  :type 'boolean
-  :group 'compilation)
+  :type 'boolean)
 
 ;;;###autoload
 (defcustom compilation-ask-about-save t
   "Non-nil means \\[compile] asks which buffers to save before compiling.
 Otherwise, it saves all modified buffers without asking."
-  :type 'boolean
-  :group 'compilation)
+  :type 'boolean)
 
 (defcustom compilation-save-buffers-predicate nil
   "The second argument (PRED) passed to `save-some-buffers' before compiling.
@@ -671,7 +668,6 @@ of `my-compilation-root' here."
           (const :tag "Default (save all file-visiting buffers)" nil)
           (const :tag "Save all buffers" t)
           function)
-  :group 'compilation
   :version "24.1")
 
 ;;;###autoload
@@ -680,8 +676,7 @@ of `my-compilation-root' here."
 Elements should be directory names, not file names of directories.
 The value nil as an element means to try the default directory."
   :type '(repeat (choice (const :tag "Default" nil)
-                        (string :tag "Directory")))
-  :group 'compilation)
+                        (string :tag "Directory"))))
 
 ;;;###autoload
 (defcustom compile-command (purecopy "make -k ")
@@ -701,8 +696,7 @@ You might also use mode hooks to specify it in certain 
modes, like this:
                            (file-name-sans-extension buffer-file-name))))))))
 
 It's often useful to leave a space at the end of the value."
-  :type 'string
-  :group 'compilation)
+  :type 'string)
 ;;;###autoload(put 'compile-command 'safe-local-variable (lambda (a) (and 
(stringp a) (or (not (boundp 'compilation-read-command)) 
compilation-read-command))))
 
 ;;;###autoload
@@ -711,7 +705,6 @@ It's often useful to leave a space at the end of the value."
 This only affects platforms that support asynchronous processes (see
 `start-process'); synchronous compilation processes never accept input."
   :type 'boolean
-  :group 'compilation
   :version "22.1")
 
 ;; A weak per-compilation-buffer hash indexed by (FILENAME . DIRECTORY).  Each
@@ -737,7 +730,6 @@ This list is temporarily prepended to `process-environment' 
prior to
 starting the compilation process."
   :type '(repeat (string :tag "ENVVARNAME=VALUE"))
   :options '(("LANG=C"))
-  :group 'compilation
   :version "24.1")
 
 ;; History of compile commands.
@@ -746,19 +738,16 @@ starting the compilation process."
 (defface compilation-error
   '((t :inherit error))
   "Face used to highlight compiler errors."
-  :group 'compilation
   :version "22.1")
 
 (defface compilation-warning
   '((t :inherit warning))
   "Face used to highlight compiler warnings."
-  :group 'compilation
   :version "22.1")
 
 (defface compilation-info
   '((t :inherit success))
   "Face used to highlight compiler information."
-  :group 'compilation
   :version "22.1")
 
 ;; The next three faces must be able to stand out against the
@@ -770,13 +759,11 @@ starting the compilation process."
     (((class color) (min-colors 8)) (:foreground "red"))
     (t (:inverse-video t :weight bold)))
   "Face for Compilation mode's \"error\" mode line indicator."
-  :group 'compilation
   :version "24.3")
 
 (defface compilation-mode-line-run
   '((t :inherit compilation-warning))
   "Face for Compilation mode's \"running\" mode line indicator."
-  :group 'compilation
   :version "24.3")
 
 (defface compilation-mode-line-exit
@@ -786,19 +773,16 @@ starting the compilation process."
     (((class color)) (:foreground "green" :weight bold))
     (t (:weight bold)))
   "Face for Compilation mode's \"exit\" mode line indicator."
-  :group 'compilation
   :version "24.3")
 
 (defface compilation-line-number
   '((t :inherit font-lock-keyword-face))
   "Face for displaying line numbers in compiler messages."
-  :group 'compilation
   :version "22.1")
 
 (defface compilation-column-number
   '((t :inherit font-lock-doc-face))
   "Face for displaying column numbers in compiler messages."
-  :group 'compilation
   :version "22.1")
 
 (defcustom compilation-message-face 'underline
@@ -807,7 +791,6 @@ Faces `compilation-error-face', `compilation-warning-face',
 `compilation-info-face', `compilation-line-face' and
 `compilation-column-face' get prepended to this, when applicable."
   :type 'face
-  :group 'compilation
   :version "22.1")
 
 (defvar compilation-error-face 'compilation-error
@@ -840,7 +823,6 @@ Faces `compilation-error-face', `compilation-warning-face',
 (defcustom compilation-auto-jump-to-first-error nil
   "If non-nil, automatically jump to the first error during compilation."
   :type 'boolean
-  :group 'compilation
   :version "23.1")
 
 (defvar compilation-auto-jump-to-next nil
@@ -863,7 +845,6 @@ info, are considered errors."
   :type '(choice (const :tag "Skip warnings and info" 2)
                 (const :tag "Skip info" 1)
                 (const :tag "No skip" 0))
-  :group 'compilation
   :version "22.1")
 
 (defun compilation-set-skip-threshold (level)
@@ -887,7 +868,6 @@ Visited messages are ones for which the file, line and 
column have been jumped
 to from the current content in the current compilation buffer, even if it was
 from a different message."
   :type 'boolean
-  :group 'compilation
   :version "22.1")
 
 (defun compilation-type (type)
@@ -944,10 +924,11 @@ from a different message."
 ;;   FILE-STRUCTURE is a list of
 ;;   ((FILENAME DIRECTORY) FORMATS (LINE LOC ...) ...)
 
-;; FILENAME is a string parsed from an error message.  DIRECTORY is a string
-;; obtained by following directory change messages.  DIRECTORY will be nil for
-;; an absolute filename.  FORMATS is a list of formats to apply to FILENAME if
-;; a file of that name can't be found.
+;; FILENAME is a string parsed from an error message, or the buffer which was
+;; compiled.  DIRECTORY is a string obtained by following directory change
+;; messages.  DIRECTORY will be nil for an absolute filename or a buffer.
+;; FORMATS is a list of formats to apply to FILENAME if a file of that name
+;; can't be found.
 ;; The rest of the list is an alist of elements with LINE as key.  The keys
 ;; are either nil or line numbers.  If present, nil comes first, followed by
 ;; the numbers in decreasing order.  The LOCs for each line are again an alist
@@ -1180,7 +1161,8 @@ just char-counts."
   "Get the meta-info that will be added as text-properties.
 LINE, END-LINE, COL, END-COL are integers or nil.
 TYPE can be 0, 1, or 2, meaning error, warning, or just info.
-FILE should be (FILENAME) or (RELATIVE-FILENAME . DIRNAME) or nil.
+FILE should be (FILENAME) or (RELATIVE-FILENAME . DIRNAME) or (BUFFER) or
+nil.
 FMTS is a list of format specs for transforming the file name.
  (See `compilation-error-regexp-alist'.)"
   (unless file (setq file '("*unknown*")))
@@ -1419,17 +1401,17 @@ to `compilation-error-regexp-alist' if RULES is nil."
                              file line end-line col end-col (or type 2) fmt))
 
             (when (integerp file)
-              (setq type (if (consp type)
-                             (compilation-type type)
-                           (or type 2)))
-              (compilation--note-type type)
-
-              (compilation--put-prop
-               file 'font-lock-face
-               (symbol-value (aref [compilation-info-face
-                                    compilation-warning-face
-                                    compilation-error-face]
-                                   type))))
+              (let ((this-type (if (consp type)
+                                   (compilation-type type)
+                                 (or type 2))))
+                (compilation--note-type this-type)
+
+                (compilation--put-prop
+                 file 'font-lock-face
+                 (symbol-value (aref [compilation-info-face
+                                      compilation-warning-face
+                                      compilation-error-face]
+                                     this-type)))))
 
             (compilation--put-prop
              line 'font-lock-face compilation-line-face)
@@ -1577,7 +1559,7 @@ If the optional argument `edit-command' is non-nil, the 
command can be edited."
       (setq command (compilation-read-command (or (car compilation-arguments)
                                                  command)))
       (if compilation-arguments (setcar compilation-arguments command)))
-    (apply 'compilation-start (or compilation-arguments (list command)))))
+    (apply #'compilation-start (or compilation-arguments (list command)))))
 
 (defcustom compilation-scroll-output nil
   "Non-nil to scroll the *compilation* buffer window as output appears.
@@ -1591,8 +1573,7 @@ point on its location in the *compilation* buffer."
   :type '(choice (const :tag "No scrolling" nil)
                 (const :tag "Scroll compilation output" t)
                 (const :tag "Stop scrolling at the first error" first-error))
-  :version "20.3"
-  :group 'compilation)
+  :version "20.3")
 
 
 (defun compilation-buffer-name (name-of-mode mode-command name-function)
@@ -1616,8 +1597,7 @@ Otherwise, construct a buffer name from NAME-OF-MODE."
   "If t, always kill a running compilation process before starting a new one.
 If nil, ask to kill it."
   :type 'boolean
-  :version "24.3"
-  :group 'compilation)
+  :version "24.3")
 
 ;;;###autoload
 (defun compilation-start (command &optional mode name-function 
highlight-regexp)
@@ -1774,15 +1754,16 @@ Returns the compilation buffer created."
        (if (fboundp 'make-process)
            (let ((proc
                   (if (eq mode t)
-                      ;; comint uses `start-file-process'.
-                      (get-buffer-process
-                       (with-no-warnings
-                         (comint-exec
-                          outbuf (downcase mode-name)
-                          (if (file-remote-p default-directory)
-                              "/bin/sh"
-                            shell-file-name)
-                          nil `("-c" ,command))))
+                       ;; On remote hosts, the local `shell-file-name'
+                       ;; might be useless.
+                       (with-connection-local-variables
+                       ;; comint uses `start-file-process'.
+                       (get-buffer-process
+                        (with-no-warnings
+                          (comint-exec
+                           outbuf (downcase mode-name)
+                           shell-file-name
+                           nil `(,shell-command-switch ,command)))))
                     (start-file-process-shell-command (downcase mode-name)
                                                       outbuf command))))
               ;; Make the buffer's mode line show process state.
@@ -1796,11 +1777,11 @@ Returns the compilation buffer created."
               (when compilation-always-kill
                 (set-process-query-on-exit-flag proc nil))
 
-              (set-process-sentinel proc 'compilation-sentinel)
+              (set-process-sentinel proc #'compilation-sentinel)
               (unless (eq mode t)
                 ;; Keep the comint filter, since it's needed for proper
                ;; handling of the prompts.
-               (set-process-filter proc 'compilation-filter))
+               (set-process-filter proc #'compilation-filter))
              ;; Use (point-max) here so that output comes in
              ;; after the initial text,
              ;; regardless of where the user sees point.
@@ -2108,7 +2089,7 @@ by replacing the first word, e.g., 
`compilation-scroll-output' from
       (let (revert-buffer-function)
        (revert-buffer ignore-auto noconfirm))
     (if (or noconfirm (yes-or-no-p (format "Restart compilation? ")))
-       (apply 'compilation-start compilation-arguments))))
+       (apply #'compilation-start compilation-arguments))))
 
 (defvar compilation-current-error nil
   "Marker to the location from where the next error will be found.
@@ -2144,7 +2125,7 @@ Optional argument MINOR indicates this is called from
   ;; It's generally preferable to use after-change-functions since they
   ;; can be subject to combine-after-change-calls, but if we do that, we risk
   ;; running our hook after font-lock, resulting in incorrect refontification.
-  (add-hook 'before-change-functions 'compilation--flush-parse nil t)
+  (add-hook 'before-change-functions #'compilation--flush-parse nil t)
   ;; Also for minor mode, since it's not permanent-local.
   (add-hook 'change-major-mode-hook #'compilation--remove-properties nil t)
   (if minor
@@ -2156,7 +2137,7 @@ Optional argument MINOR indicates this is called from
 (defun compilation--unsetup ()
   ;; Only for minor mode.
   (font-lock-remove-keywords nil (compilation-mode-font-lock-keywords))
-  (remove-hook 'before-change-functions 'compilation--flush-parse t)
+  (remove-hook 'before-change-functions #'compilation--flush-parse t)
   (kill-local-variable 'compilation--parsed)
   (compilation--remove-properties)
   (font-lock-flush))
@@ -2169,8 +2150,7 @@ When Compilation Shell minor mode is enabled, all the
 error-parsing commands of the Compilation major mode are
 available but bound to keys that don't collide with Shell mode.
 See `compilation-mode'."
-  nil " Shell-Compile"
-  :group 'compilation
+  :lighter " Shell-Compile"
   (if compilation-shell-minor-mode
       (compilation-setup t)
     (compilation--unsetup)))
@@ -2182,8 +2162,7 @@ See `compilation-mode'."
 When Compilation minor mode is enabled, all the error-parsing
 commands of Compilation major mode are available.  See
 `compilation-mode'."
-  nil " Compilation"
-  :group 'compilation
+  :lighter " Compilation"
   (if compilation-minor-mode
       (compilation-setup t)
     (compilation--unsetup)))
@@ -2373,7 +2352,7 @@ looking for the next message."
                                                'compilation-message))
            (setq pt (compilation-next-single-property-change
                       pt 'compilation-message nil
-                                                 (line-end-position)))
+                     (line-end-position)))
            (or (setq msg (get-text-property pt 'compilation-message))
                (setq pt (point)))))
       (setq last (compilation--loc->file-struct loc))
@@ -2391,7 +2370,7 @@ looking for the next message."
                          "Moved back before first %s" (point-min))))
     (goto-char pt)
     (or msg
-       (error "No %s here" compilation-error))))
+       (user-error "No %s here" compilation-error))))
 
 (defun compilation-previous-error (n)
   "Move point to the previous error in the compilation buffer.
@@ -2493,12 +2472,14 @@ This is the value of `next-error-function' in 
Compilation buffers."
                  ;;            (setq timestamp compilation-buffer-modtime)))
                  )
       (with-current-buffer
-          (apply #'compilation-find-file
-                 marker
-                 (caar (compilation--loc->file-struct loc))
-                 (cadr (car (compilation--loc->file-struct loc)))
-                 (compilation--file-struct->formats
-                  (compilation--loc->file-struct loc)))
+          (if (bufferp (caar (compilation--loc->file-struct loc)))
+              (caar (compilation--loc->file-struct loc))
+            (apply #'compilation-find-file
+                   marker
+                   (caar (compilation--loc->file-struct loc))
+                   (cadr (car (compilation--loc->file-struct loc)))
+                   (compilation--file-struct->formats
+                    (compilation--loc->file-struct loc))))
         (let ((screen-columns
                ;; Obey the compilation-error-screen-columns of the target
                ;; buffer if its major mode set it buffer-locally.
@@ -2577,7 +2558,6 @@ compilation output window; an arrow in the left fringe 
points to
 the current message.  If nil and there is no left fringe, the message
 displays at the top of the window; there is no arrow."
   :type '(choice integer (const :tag "No window scrolling" nil))
-  :group 'compilation
   :version "22.1")
 
 (defsubst compilation-set-window (w mk)
@@ -2671,7 +2651,7 @@ and overlay is highlighted between MK and END-MK."
                    (numberp next-error-highlight))
                ;; We want highlighting: delete overlay on next input.
                (add-hook 'pre-command-hook
-                         'compilation-goto-locus-delete-o)
+                         #'compilation-goto-locus-delete-o)
              ;; We don't want highlighting: delete overlay now.
              (delete-overlay compilation-highlight-overlay))
            ;; We want highlighting for a limited time:
@@ -2691,7 +2671,7 @@ and overlay is highlighted between MK and END-MK."
   (if (timerp next-error-highlight-timer)
       (cancel-timer next-error-highlight-timer))
   (remove-hook 'pre-command-hook
-              'compilation-goto-locus-delete-o))
+              #'compilation-goto-locus-delete-o))
 
 (defun compilation-find-file (marker filename directory &rest formats)
   "Find a buffer for file FILENAME.
@@ -2810,18 +2790,21 @@ TRUE-DIRNAME is the `file-truename' of DIRNAME, if 
given."
                       (concat comint-file-name-prefix spec-directory))))))
 
        ;; If compilation-parse-errors-filename-function is
-       ;; defined, use it to process the filename.
+       ;; defined, use it to process the filename.  The result might be a
+       ;; buffer.
        (when compilation-parse-errors-filename-function
-         (setq filename
-               (funcall compilation-parse-errors-filename-function
-                        filename)))
+          (save-match-data
+           (setq filename
+                 (funcall compilation-parse-errors-filename-function
+                          filename))))
 
        ;; Some compilers (e.g. Sun's java compiler, reportedly) produce bogus
        ;; file names like "./bar//foo.c" for file "bar/foo.c";
        ;; expand-file-name will collapse these into "/foo.c" and fail to find
        ;; the appropriate file.  So we look for doubled slashes in the file
        ;; name and fix them.
-       (setq filename (command-line-normalize-file-name filename))
+       (if (stringp filename)
+            (setq filename (command-line-normalize-file-name filename)))
 
        ;; Store it for the possibly unnormalized name
        (puthash file
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 7d08843..73b55e2 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -1,6 +1,6 @@
 ;;; cperl-mode.el --- Perl code editing commands for Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985-1987, 1991-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 1991-2019 Free Software Foundation, Inc.
 
 ;; Author: Ilya Zakharevich
 ;;     Bob Olson
@@ -119,7 +119,7 @@
                (beginning-of-line 2)
                (list ,file ,line)))
        (defmacro cperl-etags-snarf-tag (_file _line)
-         `(etags-snarf-tag)))
+         '(etags-snarf-tag)))
       (if (featurep 'xemacs)
          (defmacro cperl-etags-goto-tag-location (elt)
            ;;(progn
@@ -1884,7 +1884,7 @@ or as help on variables `cperl-tips', `cperl-problems',
 ;;Point is at start of real comment."
 ;;  (let ((c (current-column)) target cnt prevc)
 ;;    (if (= c comment-column) nil
-;;      (setq cnt (skip-chars-backward "[ \t]"))
+;;      (setq cnt (skip-chars-backward " \t"))
 ;;      (setq target (max (1+ (setq prevc
 ;;                          (current-column))) ; Else indent at comment column
 ;;                comment-column))
@@ -3145,12 +3145,12 @@ Returns true if comment is found.  In POD will not move 
the point."
                  (cond
                   ((looking-at "\\(s\\|tr\\)\\>")
                    (or (re-search-forward
-                        "\\=\\w+[ 
\t]*#\\([^\n\\\\#]\\|\\\\[\\\\#]\\)*#\\([^\n\\\\#]\\|\\\\[\\\\#]\\)*"
+                        "\\=\\w+[ 
\t]*#\\([^\n\\#]\\|\\\\[\\#]\\)*#\\([^\n\\#]\\|\\\\[\\#]\\)*"
                         lim 'move)
                        (setq stop-in t)))
                   ((looking-at "\\(m\\|q\\([qxwr]\\)?\\)\\>")
                    (or (re-search-forward
-                        "\\=\\w+[ \t]*#\\([^\n\\\\#]\\|\\\\[\\\\#]\\)*#"
+                        "\\=\\w+[ \t]*#\\([^\n\\#]\\|\\\\[\\#]\\)*#"
                         lim 'move)
                        (setq stop-in t)))
                   (t                   ; It was fair comment
@@ -3507,18 +3507,18 @@ Should be called with the point before leading colon of 
an attribute."
 (defsubst cperl-highlight-charclass (endbracket dashface bsface onec-space)
   (let ((l '(1 5 7)) ll lle lll
        ;; 2 groups, the first takes the whole match (include \[trnfabe])
-       (singleChar (concat "\\(" "[^\\\\]" "\\|" "\\\\[^cdg-mo-qsu-zA-Z0-9_]" 
"\\|" "\\\\c." "\\|" "\\\\x" 
"\\([0-9a-fA-F][0-9a-fA-F]?\\|\\={[0-9a-fA-F]+}\\)" "\\|" 
"\\\\0?[0-7][0-7]?[0-7]?" "\\|" "\\\\N{[^{}]*}" "\\)")))
+       (singleChar (concat "\\(" "[^\\]" "\\|" "\\\\[^cdg-mo-qsu-zA-Z0-9_]" 
"\\|" "\\\\c." "\\|" "\\\\x" 
"\\([0-9a-fA-F][0-9a-fA-F]?\\|\\={[0-9a-fA-F]+}\\)" "\\|" 
"\\\\0?[0-7][0-7]?[0-7]?" "\\|" "\\\\N{[^{}]*}" "\\)")))
     (while                             ; look for unescaped - between 
non-classes
        (re-search-forward
         ;; On 19.33, certain simplifications lead
         ;; to bugs (as in  [^a-z] \\| [trnfabe]  )
         (concat                        ; 1: SingleChar (include \[trnfabe])
          singleChar
-         ;;"\\(" "[^\\\\]" "\\|" "\\\\[^cdg-mo-qsu-zA-Z0-9_]" "\\|" "\\\\c." 
"\\|" "\\\\x" "\\([0-9a-fA-F][0-9a-fA-F]?\\|\\={[0-9a-fA-F]+}\\)" "\\|" 
"\\\\0?[0-7][0-7]?[0-7]?" "\\|" "\\\\N{[^{}]*}" "\\)"
+         ;;"\\(" "[^\\]" "\\|" "\\\\[^cdg-mo-qsu-zA-Z0-9_]" "\\|" "\\\\c." 
"\\|" "\\\\x" "\\([0-9a-fA-F][0-9a-fA-F]?\\|\\={[0-9a-fA-F]+}\\)" "\\|" 
"\\\\0?[0-7][0-7]?[0-7]?" "\\|" "\\\\N{[^{}]*}" "\\)"
          "\\("                         ; 3: DASH SingleChar (match optionally)
            "\\(-\\)"                   ; 4: DASH
            singleChar                  ; 5: SingleChar
-           ;;"\\(" "[^\\\\]" "\\|" "\\\\[^cdg-mo-qsu-zA-Z0-9_]" "\\|" "\\\\c." 
"\\|" "\\\\x" "\\([0-9a-fA-F][0-9a-fA-F]?\\|\\={[0-9a-fA-F]+}\\)" "\\|" 
"\\\\0?[0-7][0-7]?[0-7]?" "\\|" "\\\\N{[^{}]*}" "\\)"
+           ;;"\\(" "[^\\]" "\\|" "\\\\[^cdg-mo-qsu-zA-Z0-9_]" "\\|" "\\\\c." 
"\\|" "\\\\x" "\\([0-9a-fA-F][0-9a-fA-F]?\\|\\={[0-9a-fA-F]+}\\)" "\\|" 
"\\\\0?[0-7][0-7]?[0-7]?" "\\|" "\\\\N{[^{}]*}" "\\)"
          "\\)?"
          "\\|"
          "\\("                         ; 7: other escapes
@@ -3749,7 +3749,7 @@ the sections using `cperl-pod-head-face', 
`cperl-pod-face',
                             state-point b nil nil state)
                      state-point b)
                (if (or (nth 3 state) (nth 4 state)
-                       (looking-at "\\(cut\\|\\end\\)\\>"))
+                       (looking-at "\\(cut\\|end\\)\\>"))
                    (if (or (nth 3 state) (nth 4 state) ignore-max)
                        nil             ; Doing a chunk only
                      (message "=cut is not preceded by a POD section")
@@ -3762,10 +3762,10 @@ the sections using `cperl-pod-head-face', 
`cperl-pod-face',
                        b1 nil)         ; error condition
                  ;; We do not search to max, since we may be called from
                  ;; some hook of fontification, and max is random
-                 (or (re-search-forward "^\n=\\(cut\\|\\end\\)\\>" stop-point 
'toend)
+                 (or (re-search-forward "^\n=\\(cut\\|end\\)\\>" stop-point 
'toend)
                      (progn
                        (goto-char b)
-                       (if (re-search-forward "\n=\\(cut\\|\\end\\)\\>" 
stop-point 'toend)
+                       (if (re-search-forward "\n=\\(cut\\|end\\)\\>" 
stop-point 'toend)
                            (progn
                              (message "=cut is not preceded by an empty line")
                              (setq b1 t)
@@ -4455,13 +4455,13 @@ the sections using `cperl-pod-head-face', 
`cperl-pod-face',
                              ;; Apparently, I can't put \] into a charclass
                              ;; in m]]: m][\\\]\]] produces [\\]]
 ;;;   POSIX?  [:word:] [:^word:] only inside []
-;;;           "\\=\\(\\\\.\\|[^][\\\\]\\|\\[:\\^?\sw+:]\\|\\[[^:]\\)*]")
+;;;           "\\=\\(\\\\.\\|[^][\\]\\|\\[:\\^?\sw+:]\\|\\[[^:]\\)*]")
                              (while    ; look for unescaped ]
                                  (and argument
                                       (re-search-forward
                                        (if (eq (char-after b) ?\] )
-                                           "\\=\\(\\\\[^]]\\|[^]\\\\]\\)*\\\\]"
-                                         "\\=\\(\\\\.\\|[^]\\\\]\\)*]")
+                                           "\\=\\(\\\\[^]]\\|[^]\\]\\)*\\\\]"
+                                         "\\=\\(\\\\.\\|[^]\\]\\)*]")
                                        (1- e) 'toend))
                                ;; Is this ] an end of POSIX class?
                                (if (save-excursion
@@ -4580,7 +4580,7 @@ the sections using `cperl-pod-head-face', 
`cperl-pod-face',
                              ;; Works also if the outside delimiters are ().
                              (or;;(if (eq (char-after b) ?\) )
                               ;;(re-search-forward
-                              ;; "[^\\\\]\\(\\\\\\\\\\)*\\\\)"
+                              ;; "[^\\]\\(\\\\\\\\\\)*\\\\)"
                               ;; (1- e) 'toend)
                               (search-forward ")" (1- e) 'toend)
                               ;;)
@@ -4924,7 +4924,7 @@ conditional/loop constructs."
                              (if (looking-at 
"\\(state\\|my\\|local\\|our\\)\\>")
                                  (forward-sexp -1))))
                        (if (looking-at
-                            (concat "\\(\\elsif\\|if\\|unless\\|while\\|until"
+                            (concat "\\(elsif\\|if\\|unless\\|while\\|until"
                                     "\\|for\\(each\\)?\\>\\(\\("
                                     cperl-maybe-white-and-comment-rex
                                     "\\(state\\|my\\|local\\|our\\)\\)?"
@@ -5003,7 +5003,7 @@ Returns some position at the last line."
        ;; Looking at:
        ;; else   {
        (if (looking-at
-            "[ \t]*}?[ 
\t]*\\<\\(\\els\\(e\\|if\\)\\|continue\\|unless\\|if\\|while\\|for\\(each\\)?\\|until\\)\\>\\(\t*\\|[
 \t][ \t]+\\)[^ \t\n#]")
+            "[ \t]*}?[ 
\t]*\\<\\(els\\(e\\|if\\)\\|continue\\|unless\\|if\\|while\\|for\\(each\\)?\\|until\\)\\>\\(\t*\\|[
 \t][ \t]+\\)[^ \t\n#]")
            (progn
              (forward-word-strictly 1)
              (delete-horizontal-space)
@@ -5031,7 +5031,7 @@ Returns some position at the last line."
        ;; Looking at (with or without "}" at start, ending after "({"):
        ;; } foreach my $var ()         OR   {
        (if (looking-at
-            "[ \t]*\\(}[ 
\t]*\\)?\\<\\(\\els\\(e\\|if\\)\\|continue\\|if\\|unless\\|while\\|for\\(each\\)?\\(\\([
 \t]+\\(state\\|my\\|local\\|our\\)\\)?[ 
\t]*\\$[_a-zA-Z0-9]+\\)?\\|until\\)\\>\\([ \t]*(\\|[ \t\n]*{\\)\\|[ \t]*{")
+            "[ \t]*\\(}[ 
\t]*\\)?\\<\\(els\\(e\\|if\\)\\|continue\\|if\\|unless\\|while\\|for\\(each\\)?\\(\\([
 \t]+\\(state\\|my\\|local\\|our\\)\\)?[ 
\t]*\\$[_a-zA-Z0-9]+\\)?\\|until\\)\\>\\([ \t]*(\\|[ \t\n]*{\\)\\|[ \t]*{")
            (progn
              (setq ml (match-beginning 8)) ; "(" or "{" after control word
              (re-search-forward "[({]")
@@ -5736,9 +5736,9 @@ indentation and initial hashes.  Behaves usually outside 
of comment."
                         (if (eq (char-after (cperl-1- (match-end 0))) ?\{ )
                             'font-lock-function-name-face
                           'font-lock-variable-name-face))))
-           '("\\<\\(package\\|require\\|use\\|import\\|no\\|bootstrap\\)[ 
\t]+\\([a-zA-z_][a-zA-z_0-9:]*\\)[ \t;]" ; require A if B;
+           '("\\<\\(package\\|require\\|use\\|import\\|no\\|bootstrap\\)[ 
\t]+\\([a-zA-Z_][a-zA-Z_0-9:]*\\)[ \t;]" ; require A if B;
              2 font-lock-function-name-face)
-           '("^[ \t]*format[ \t]+\\([a-zA-z_][a-zA-z_0-9:]*\\)[ \t]*=[ \t]*$"
+           '("^[ \t]*format[ \t]+\\([a-zA-Z_][a-zA-Z_0-9:]*\\)[ \t]*=[ \t]*$"
              1 font-lock-function-name-face)
            (cond ((featurep 'font-lock-extra)
                   '("\\([]}\\\\%@>*&]\\|\\$[a-zA-Z0-9_:]*\\)[ \t]*{[ 
\t]*\\(-?[a-zA-Z0-9_:]+\\)[ \t]*}"
@@ -7261,7 +7261,7 @@ One may build such TAGS files from CPerl mode menu."
      ".->"                             ; a->b
      "->"                              ; a SPACE ->b
      "\\[-"                            ; a[-1]
-     "\\\\[&address@hidden"                    ; \&func
+     "\\\\[&address@hidden"                    ; \&func
      "^="                              ; =head
      "\\$."                            ; $|
      "<<[a-zA-Z_'\"`]"                 ; <<FOO, <<'FOO'
@@ -7347,7 +7347,7 @@ Currently it is tuned to C and Perl syntax."
      "-[a-zA-Z]"                       ; File test
      "\\\\[a-zA-Z0]"                   ; Special chars
      "^=[a-z][a-zA-Z0-9_]*"            ; POD sections
-     "[-!&*+,-./<=>?\\\\^|~]+"         ; Operator
+     "[-!&*+,./<=>?\\^|~]+"            ; Operator
      "[a-zA-Z_0-9:]+"                  ; symbol or number
      "x="
      "#!")
@@ -7364,7 +7364,7 @@ Currently it is tuned to C and Perl syntax."
   ;; Does not save-excursion
   ;; Get to the something meaningful
   (or (eobp) (eolp) (forward-char 1))
-  (re-search-backward "[-a-zA-Z0-9_:!&*+,-./<=>?\\\\^|address@hidden"
+  (re-search-backward "[-a-zA-Z0-9_:!&*+,./<=>?\\^|address@hidden"
                      (point-at-bol)
                      'to-beg)
   ;;  (cond
@@ -7391,8 +7391,8 @@ Currently it is tuned to C and Perl syntax."
     (forward-char -1))
    ((and (looking-at "\\^") (eq (preceding-char) ?\$)) ; $^I
     (forward-char -1))
-   ((looking-at "[-!&*+,-./<=>?\\\\^|~]")
-    (skip-chars-backward "-!&*+,-./<=>?\\\\^|~")
+   ((looking-at "[-!&*+,./<=>?\\^|~]")
+    (skip-chars-backward "-!&*+,./<=>?\\^|~")
     (cond
      ((and (eq (preceding-char) ?\$)
           (not (eq (char-after (- (point) 2)) ?\$))) ; $-
@@ -8145,7 +8145,7 @@ prototype \\&SUB  Returns prototype of the function given 
a reference.
       ;; Protect fragile " ", "#"
       (if have-x nil
        (goto-char (1+ b))
-       (while (re-search-forward "\\(\\=\\|[^\\\\]\\)\\(\\\\\\\\\\)*[ \t\n#]" 
e t) ; Need to include (?#) too?
+       (while (re-search-forward "\\(\\=\\|[^\\]\\)\\(\\\\\\\\\\)*[ \t\n#]" e 
t) ; Need to include (?#) too?
          (forward-char -1)
          (insert "\\")
          (forward-char 1)))
@@ -8174,7 +8174,7 @@ We suppose that the regexp is scanned already."
          (error "Cannot find `(' which starts a group"))
       (setq done
            (save-excursion
-             (skip-chars-backward "\\")
+             (skip-chars-backward "\\\\")
              (looking-at "\\(\\\\\\\\\\)*(")))
       (or done (forward-char -1)))))
 
@@ -8675,9 +8675,7 @@ start with default arguments, then refine the slowdown 
regions."
   (or l (setq l 1))
   (or step (setq step 500))
   (or lim (setq lim 40))
-  (let* ((timems (function (lambda ()
-                            (let ((tt (current-time)))
-                              (+ (* 1000 (nth 1 tt)) (/ (nth 2 tt) 1000))))))
+  (let* ((timems (function (lambda () (car (encode-time nil 1000)))))
         (tt (funcall timems)) (c 0) delta tot)
     (goto-char (point-min))
     (forward-line (1- l))
diff --git a/lisp/progmodes/cpp.el b/lisp/progmodes/cpp.el
index 432be1a..29988eb 100644
--- a/lisp/progmodes/cpp.el
+++ b/lisp/progmodes/cpp.el
@@ -1,6 +1,6 @@
 ;;; cpp.el --- highlight or hide text according to cpp conditionals
 
-;; Copyright (C) 1994-1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <address@hidden>
 ;; Keywords: c, faces, tools
@@ -849,8 +849,8 @@ If that option is nil, don't prints messages.
 ARGS are the same as for `message'."
   (when cpp-message-min-time-interval
     (let ((time (current-time)))
-      (when (>= (float-time (time-subtract time cpp-progress-time))
-                cpp-message-min-time-interval)
+      (unless (time-less-p cpp-message-min-time-interval
+                          (time-subtract time cpp-progress-time))
         (setq cpp-progress-time time)
         (apply 'message args)))))
 
diff --git a/lisp/progmodes/cwarn.el b/lisp/progmodes/cwarn.el
index ff79b90..9ed9fb3 100644
--- a/lisp/progmodes/cwarn.el
+++ b/lisp/progmodes/cwarn.el
@@ -1,6 +1,6 @@
 ;;; cwarn.el --- highlight suspicious C and C++ constructions
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren
 ;; Keywords: c, languages, faces
diff --git a/lisp/progmodes/dcl-mode.el b/lisp/progmodes/dcl-mode.el
index bea2519..d5803c7 100644
--- a/lisp/progmodes/dcl-mode.el
+++ b/lisp/progmodes/dcl-mode.el
@@ -1,6 +1,6 @@
 ;;; dcl-mode.el --- major mode for editing DCL command files
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Odd Gripenstam <address@hidden>
 ;; Maintainer: address@hidden
@@ -1580,7 +1580,7 @@ Find the column of the first non-blank character on the 
line.
 Returns the column offset."
   (save-excursion
     (beginning-of-line)
-    (re-search-forward "^$[ \t]*" nil t)
+    (re-search-forward "^\\$[ \t]*" nil t)
     (current-column)))
 
 
diff --git a/lisp/progmodes/ebnf-abn.el b/lisp/progmodes/ebnf-abn.el
index 66f1d39..b8441a7 100644
--- a/lisp/progmodes/ebnf-abn.el
+++ b/lisp/progmodes/ebnf-abn.el
@@ -1,6 +1,6 @@
 ;;; ebnf-abn.el --- parser for ABNF (Augmented BNF)
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
diff --git a/lisp/progmodes/ebnf-bnf.el b/lisp/progmodes/ebnf-bnf.el
index 7defe98..f28f490 100644
--- a/lisp/progmodes/ebnf-bnf.el
+++ b/lisp/progmodes/ebnf-bnf.el
@@ -1,6 +1,6 @@
 ;;; ebnf-bnf.el --- parser for EBNF
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
diff --git a/lisp/progmodes/ebnf-dtd.el b/lisp/progmodes/ebnf-dtd.el
index 2dec3f9..98284fa 100644
--- a/lisp/progmodes/ebnf-dtd.el
+++ b/lisp/progmodes/ebnf-dtd.el
@@ -1,6 +1,6 @@
 ;;; ebnf-dtd.el --- parser for DTD (Data Type Description for XML)
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
diff --git a/lisp/progmodes/ebnf-ebx.el b/lisp/progmodes/ebnf-ebx.el
index 0dc82fc..5f9f9b2 100644
--- a/lisp/progmodes/ebnf-ebx.el
+++ b/lisp/progmodes/ebnf-ebx.el
@@ -1,6 +1,6 @@
 ;;; ebnf-ebx.el --- parser for EBNF used to specify XML (EBNFX)
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
diff --git a/lisp/progmodes/ebnf-iso.el b/lisp/progmodes/ebnf-iso.el
index 06aaf8a..88644bb 100644
--- a/lisp/progmodes/ebnf-iso.el
+++ b/lisp/progmodes/ebnf-iso.el
@@ -1,6 +1,6 @@
 ;;; ebnf-iso.el --- parser for ISO EBNF
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
diff --git a/lisp/progmodes/ebnf-otz.el b/lisp/progmodes/ebnf-otz.el
index 5857aa3..cbc058e 100644
--- a/lisp/progmodes/ebnf-otz.el
+++ b/lisp/progmodes/ebnf-otz.el
@@ -1,6 +1,6 @@
 ;;; ebnf-otz.el --- syntactic chart OpTimiZer
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
diff --git a/lisp/progmodes/ebnf-yac.el b/lisp/progmodes/ebnf-yac.el
index eac0bfc..9e71235 100644
--- a/lisp/progmodes/ebnf-yac.el
+++ b/lisp/progmodes/ebnf-yac.el
@@ -1,6 +1,6 @@
 ;;; ebnf-yac.el --- parser for Yacc/Bison
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
@@ -392,7 +392,7 @@ See documentation for variable `ebnf-yac-lex'."
 (defun ebnf-yac-skip-spaces ()
   (skip-chars-forward
    (if ebnf-yac-skip-char
-       "\n\r\t !#$&()address@hidden"
+       "-\n\r\t !#$&()*+,address@hidden"
      "\n\r\t ")
    ebnf-limit)
   (< (point) ebnf-limit))
diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el
index e29eb74..7e7efac 100644
--- a/lisp/progmodes/ebnf2ps.el
+++ b/lisp/progmodes/ebnf2ps.el
@@ -1,6 +1,6 @@
 ;;; ebnf2ps.el --- translate an EBNF to a syntactic chart on PostScript  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
diff --git a/lisp/progmodes/ebrowse.el b/lisp/progmodes/ebrowse.el
index 07b58b5..3faec49 100644
--- a/lisp/progmodes/ebrowse.el
+++ b/lisp/progmodes/ebrowse.el
@@ -1,6 +1,6 @@
-;;; ebrowse.el --- Emacs C++ class browser & tags facility
+;;; ebrowse.el --- Emacs C++ class browser & tags facility  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
 ;; Author: Gerd Moellmann <address@hidden>
 ;; Maintainer: address@hidden
@@ -233,30 +233,12 @@ Compare items with `eq' or TEST if specified."
     found))
 
 
-(defmacro ebrowse-output (&rest body)
-  "Eval BODY with a writable current buffer.
-Preserve buffer's modified state."
-  (declare (indent 0) (debug t))
-  (let ((modified (make-symbol "--ebrowse-output--")))
-    `(let (buffer-read-only (,modified (buffer-modified-p)))
-       (unwind-protect
-          (progn ,@body)
-        (set-buffer-modified-p ,modified)))))
-
-
 (defmacro ebrowse-ignoring-completion-case (&rest body)
   "Eval BODY with `completion-ignore-case' bound to t."
   (declare (indent 0) (debug t))
   `(let ((completion-ignore-case t))
      ,@body))
 
-(defmacro ebrowse-save-selective (&rest body)
-  "Eval BODY with `selective-display' restored at the end."
-  (declare (indent 0) (debug t))
-  ;; FIXME: Don't use selective-display.
-  `(let ((selective-display selective-display))
-     ,@body))
-
 (defmacro ebrowse-for-all-trees (spec &rest body)
   "For all trees in SPEC, eval BODY."
   (declare (indent 1) (debug ((sexp form) body)))
@@ -303,7 +285,7 @@ If a buffer with name NEW-NAME already exists, delete it 
first."
 (defun ebrowse-trim-string (string)
   "Return a copy of STRING with leading white space removed.
 Replace sequences of newlines with a single space."
-  (when (string-match "^[ \t\n\r]+" string)
+  (when (string-match "^[ \t\n]+" string)
     (setq string (substring string (match-end 0))))
   (cl-loop while (string-match "[\n]+" string)
            finally return string do
@@ -688,7 +670,7 @@ MARKED-ONLY non-nil means include marked classes only."
   "Return a list containing all files mentioned in a tree.
 MARKED-ONLY non-nil means include marked classes only."
   (let (list)
-    (maphash (lambda (file _dummy) (setq list (cons file list)))
+    (maphash (lambda (file _dummy) (push file list))
             (ebrowse-files-table marked-only))
     list))
 
@@ -865,7 +847,7 @@ and TREE is a list of `ebrowse-ts' structures forming the 
class tree."
     ;; Read Lisp objects.  Temporarily increase `gc-cons-threshold' to
     ;; prevent a GC that would not free any memory.
     (let ((gc-cons-threshold 2000000))
-      (while (not (progn (skip-chars-forward " \t\n\r") (eobp)))
+      (while (not (progn (skip-chars-forward " \t\n") (eobp)))
        (let* ((root (read (current-buffer)))
               (old-root-ptr (ebrowse-class-in-tree root tree)))
          (ebrowse-show-progress "Reading data" (null tree))
@@ -907,8 +889,8 @@ Return the buffer created."
     (ebrowse-redraw-tree)
     (set-buffer-modified-p nil)
     (pcase pop
-      (`switch (switch-to-buffer name))
-      (`pop (pop-to-buffer name)))
+      ('switch (switch-to-buffer name))
+      ('pop (pop-to-buffer name)))
     (current-buffer)))
 
 
@@ -996,7 +978,6 @@ if for some reason a circle is in the inheritance graph."
                               (ebrowse-qualified-class-name
                                (ebrowse-ts-class (car subclass)))
                               classes)
-                    as next = nil
                     do
                     ;; Replace the subclass tree with the one found in
                     ;; CLASSES if there is already an entry for that class
@@ -1096,8 +1077,7 @@ Tree mode key bindings:
     (set (make-local-variable 'ebrowse--frozen-flag) nil)
     (setq mode-line-buffer-identification ident)
     (setq buffer-read-only t)
-    (setq selective-display t)
-    (setq selective-display-ellipses t)
+    (add-to-invisibility-spec '(ebrowse . t))
     (set (make-local-variable 'revert-buffer-function)
          #'ebrowse-revert-tree-buffer-from-file)
     (set (make-local-variable 'ebrowse--header) header)
@@ -1107,7 +1087,7 @@ Tree mode key bindings:
          (and tree (ebrowse-build-tree-obarray tree)))
     (set (make-local-variable 'ebrowse--frozen-flag) nil)
 
-    (add-hook 'write-file-functions 'ebrowse-write-file-hook-fn nil t)
+    (add-hook 'write-file-functions #'ebrowse-write-file-hook-fn nil t)
     (modify-syntax-entry ?_ (char-to-string (char-syntax ?a)))
     (when tree
       (ebrowse-redraw-tree)
@@ -1184,7 +1164,7 @@ If given a numeric N-TIMES argument, mark that many 
classes."
       ;; by a regexp replace over the whole buffer. The reason for this
       ;; is that classes might have multiple base classes. If this is
       ;; the case, they are displayed more than once in the tree.
-      (ebrowse-output
+      (with-silent-modifications
        (cl-loop
          for tree in to-change
          as regexp = (concat "^.*\\b"
@@ -1213,7 +1193,7 @@ If given a numeric N-TIMES argument, mark that many 
classes."
   "Display class marker signs in the tree between START and END."
   (interactive)
   (save-excursion
-    (ebrowse-output
+    (with-silent-modifications
       (catch 'end
        (goto-char (point-min))
        (dolist (root ebrowse--tree)
@@ -1242,8 +1222,8 @@ If given a numeric N-TIMES argument, mark that many 
classes."
 With PREFIX, insert that many filenames."
   (interactive "p")
   (unless ebrowse--show-file-names-flag
-    (ebrowse-output
-      (dotimes (i prefix)
+    (with-silent-modifications
+      (dotimes (_ prefix)
        (let ((tree (ebrowse-tree-at-point))
              start
              file-name-existing)
@@ -1393,6 +1373,18 @@ Pop to member buffer if no prefix ARG, to tree buffer 
otherwise."
 
 
 
+;;; Functions to hide/unhide text
+
+(defun ebrowse--hidden-p (&optional pos)
+  (eq (get-char-property (or pos (point)) 'invisible) 'ebrowse))
+
+(defun ebrowse--hide (start end)
+  (put-text-property start end 'invisible 'ebrowse))
+
+(defun ebrowse--unhide (start end)
+  ;; FIXME: This also removes other invisible properties!
+  (remove-text-properties start end '(invisible)))
+
 ;;; Misc tree buffer commands
 
 (defun ebrowse-set-tree-indentation ()
@@ -1418,16 +1410,14 @@ Read a class name from the minibuffer if CLASS is nil."
       (setf class
            (completing-read "Goto class: "
                             (ebrowse-tree-obarray-as-alist) nil t)))
-    (ebrowse-save-selective
-      (goto-char (point-min))
-      (widen)
-      (setf selective-display nil)
-      (setq ebrowse--last-regexp (concat "\\b" class "\\b"))
-      (if (re-search-forward ebrowse--last-regexp nil t)
-         (progn
-           (goto-char (match-beginning 0))
-           (ebrowse-unhide-base-classes))
-       (error "Not found")))))
+    (goto-char (point-min))
+    (widen)
+    (setq ebrowse--last-regexp (concat "\\b" class "\\b"))
+    (if (re-search-forward ebrowse--last-regexp nil t)
+       (progn
+         (goto-char (match-beginning 0))
+         (ebrowse-unhide-base-classes))
+      (error "Not found"))))
 
 
 
@@ -1556,7 +1546,7 @@ and possibly kill the viewed buffer."
       (setq original-frame-configuration ebrowse--frame-configuration
            exit-action ebrowse--view-exit-action))
     ;; Delete the frame in which we viewed.
-    (mapc 'delete-frame
+    (mapc #'delete-frame
          (cl-loop for frame in (frame-list)
                    when (not (assq frame original-frame-configuration))
                    collect frame))
@@ -1610,17 +1600,15 @@ specifies where to find/view the result."
   (cond (view
         (setf ebrowse-temp-position-to-view struc
               ebrowse-temp-info-to-view info)
-        (unless (boundp 'view-mode-hook)
-          (setq view-mode-hook nil))
-        (push 'ebrowse-find-pattern view-mode-hook)
+         (add-hook 'view-mode-hook #'ebrowse-find-pattern)
         (pcase where
-          (`other-window (view-file-other-window file))
-          (`other-frame  (ebrowse-view-file-other-frame file))
+          ('other-window (view-file-other-window file))
+          ('other-frame  (ebrowse-view-file-other-frame file))
           (_             (view-file file))))
        (t
         (pcase where
-          (`other-window (find-file-other-window file))
-          (`other-frame  (find-file-other-frame file))
+          ('other-window (find-file-other-window file))
+          ('other-frame  (find-file-other-frame file))
           (_             (find-file file)))
         (ebrowse-find-pattern struc info))))
 
@@ -1676,7 +1664,7 @@ a pattern.  To be able to do a search in a viewed buffer,
 
 INFO is a list (TREE-HEADER TREE-OR-MEMBER MEMBER-LIST)."
   (unless position
-    (pop view-mode-hook)
+    (remove-hook 'view-mode-hook #'ebrowse-find-pattern)
     (setf viewing t
          position ebrowse-temp-position-to-view
          info ebrowse-temp-info-to-view))
@@ -1685,7 +1673,7 @@ INFO is a list (TREE-HEADER TREE-OR-MEMBER MEMBER-LIST)."
         (start (ebrowse-bs-point position))
         (offset 100)
         found)
-    (pcase-let ((`(,header ,class-or-member ,member-list) info))
+    (pcase-let ((`(,_header ,class-or-member ,member-list) info))
       ;; If no pattern is specified, construct one from the member name.
       (when (stringp pattern)
        (setq pattern (concat "^.*" (regexp-quote pattern))))
@@ -1695,9 +1683,9 @@ INFO is a list (TREE-HEADER TREE-OR-MEMBER MEMBER-LIST)."
          (ebrowse-ms
            (setf pattern
                  (pcase member-list
-                   ((or `ebrowse-ts-member-variables
-                        `ebrowse-ts-static-variables
-                        `ebrowse-ts-types)
+                   ((or 'ebrowse-ts-member-variables
+                        'ebrowse-ts-static-variables
+                        'ebrowse-ts-types)
                     (ebrowse-variable-declaration-regexp
                      (ebrowse-bs-name position)))
                    (_
@@ -1749,7 +1737,7 @@ QUIETLY non-nil means don't display progress messages."
   (interactive)
   (or quietly (message "Displaying..."))
   (save-excursion
-    (ebrowse-output
+    (with-silent-modifications
       (erase-buffer)
       (ebrowse-draw-tree-fn)))
   (ebrowse-update-tree-buffer-mode-line)
@@ -1816,7 +1804,8 @@ This function may look weird, but this is faster than 
recursion."
                    (nconc (copy-sequence (ebrowse-ts-subclasses tree)) stack2)
                    stack1
                    (nconc (make-list (length (ebrowse-ts-subclasses tree))
-                                     (1+ level)) stack1)))))
+                                     (1+ level))
+                          stack1)))))
 
 
 
@@ -1844,69 +1833,60 @@ With prefix ARG, expand all sub-trees."
   "Expand or fold all trees in the buffer.
 COLLAPSE non-nil means fold them."
   (interactive "P")
-  (let ((line-end  (if collapse "^\n" "^\r"))
-       (insertion (if collapse "\r"  "\n")))
-    (ebrowse-output
+  (with-silent-modifications
+    (if (not collapse)
+        (ebrowse--unhide (point-min) (point-max))
       (save-excursion
        (goto-char (point-min))
-       (while (not (progn (skip-chars-forward line-end) (eobp)))
-         (when (or (not collapse)
-                   (looking-at "\n "))
-           (delete-char 1)
-           (insert insertion))
-         (when collapse
-           (skip-chars-forward "\n ")))))))
+       (while (progn (end-of-line) (not (eobp)))
+         (when (looking-at "\n ")
+            (ebrowse--hide (point) (line-end-position 2)))
+         (skip-chars-forward "\n "))))))
 
 
 (defun ebrowse-unhide-base-classes ()
   "Unhide the line the cursor is on and all base classes."
-  (ebrowse-output
+  (with-silent-modifications
     (save-excursion
       (let (indent last-indent)
-       (skip-chars-backward "^\r\n")
-       (when (not (looking-at "[\r\n][^ \t]"))
-         (skip-chars-forward "\r\n \t")
+       (forward-line 0)
+       (when (not (looking-at "\n[^ \t]"))
+         (skip-chars-forward "\n \t")
          (while (and (or (null last-indent) ;first time
                          (> indent 1)) ;not root class
-                     (re-search-backward "[\r\n][ \t]*" nil t))
+                     (re-search-backward "\n[ \t]*" nil t))
            (setf indent (- (match-end 0)
                            (match-beginning 0)))
            (when (or (null last-indent)
                      (< indent last-indent))
              (setf last-indent indent)
-             (when (looking-at "\r")
-               (delete-char 1)
-               (insert 10)))
-           (backward-char 1)))))))
+             (when (ebrowse--hidden-p)
+                (ebrowse--unhide (point) (line-end-position 2))))))))))
 
 
 (defun ebrowse-hide-line (collapse)
   "Hide/show a single line in the tree.
 COLLAPSE non-nil means hide."
-  (save-excursion
-    (ebrowse-output
-      (skip-chars-forward "^\r\n")
-      (delete-char 1)
-      (insert (if collapse 13 10)))))
+  (with-silent-modifications
+    (funcall (if collapse #'ebrowse--hide #'ebrowse--unhide)
+             (line-end-position) (line-end-position 2))))
 
 
 (defun ebrowse-collapse-fn (collapse)
   "Collapse or expand a branch of the tree.
 COLLAPSE non-nil means collapse the branch."
-  (ebrowse-output
+  (with-silent-modifications
     (save-excursion
       (beginning-of-line)
       (skip-chars-forward "> \t")
       (let ((indentation (current-column)))
        (while (and (not (eobp))
                    (save-excursion
-                     (skip-chars-forward "^\r\n")
-                     (goto-char (1+ (point)))
+                     (forward-line 1)
                      (skip-chars-forward "> \t")
                      (> (current-column) indentation)))
          (ebrowse-hide-line collapse)
-         (skip-chars-forward "^\r\n")
-         (goto-char (1+ (point))))))))
+         (forward-line 1))))))
 
 
 ;;; Electric tree selection
@@ -2164,7 +2144,7 @@ See `Electric-command-loop' for a description of STATE 
and CONDITION."
 ;;;###autoload
 (define-derived-mode ebrowse-member-mode special-mode "Ebrowse-Members"
   "Major mode for Ebrowse member buffers."
-  (mapc 'make-local-variable
+  (mapc #'make-local-variable
        '(ebrowse--decl-column          ;display column
          ebrowse--n-columns            ;number of short columns
          ebrowse--column-width         ;width of columns above
@@ -2587,7 +2567,7 @@ TAGS-FILE is the file name of the BROWSE file."
   (let ((display-fn (if ebrowse--long-display-flag
                        'ebrowse-draw-member-long-fn
                      'ebrowse-draw-member-short-fn)))
-    (ebrowse-output
+    (with-silent-modifications
       (erase-buffer)
       ;; Show this class
       (ebrowse-draw-member-buffer-class-line)
@@ -2708,7 +2688,7 @@ means the member buffer is standalone.  CLASS is its 
class."
 (defun ebrowse-draw-member-long-fn (member-list tree)
   "Display member buffer for MEMBER-LIST in long form.
 TREE is the class tree of MEMBER-LIST."
-  (dolist (member-struc (mapcar 'ebrowse-member-display-p member-list))
+  (dolist (member-struc (mapcar #'ebrowse-member-display-p member-list))
     (when member-struc
       (let ((name (ebrowse-ms-name member-struc))
            (start (point)))
@@ -3172,9 +3152,9 @@ EVENT is the mouse event."
     (2 (ebrowse-find-member-definition))
     (1 (pcase (get-text-property (posn-point (event-start event))
                                  'ebrowse-what)
-        (`member-name
+        ('member-name
          (ebrowse-popup-menu ebrowse-member-name-object-menu event))
-        (`class-name
+        ('class-name
          (ebrowse-popup-menu ebrowse-member-class-name-object-menu event))
         (_
          (ebrowse-popup-menu ebrowse-member-buffer-object-menu event))))))
@@ -3189,7 +3169,7 @@ EVENT is the mouse event."
     (2 (ebrowse-find-member-definition))
     (1 (pcase (get-text-property (posn-point (event-start event))
                                'ebrowse-what)
-        (`member-name
+        ('member-name
          (ebrowse-view-member-definition 0))))))
 
 
@@ -3243,7 +3223,8 @@ from point as default.  Value is a list (CLASS-NAME 
MEMBER-NAME)."
        (if members
            (let* ((name (ebrowse-ignoring-completion-case
                           (completing-read prompt members nil nil 
member-name)))
-                  (completion-result (try-completion name members)))
+                  ;; (completion-result (try-completion name members))
+                   )
              ;; Cannot rely on `try-completion' returning t for exact
              ;; matches!  It returns the name as a string.
              (unless (gethash name members)
@@ -3522,12 +3503,12 @@ KIND is an additional string printed in the buffer."
     (insert kind)
     (indent-to 50)
     (insert (pcase (cl-second info)
-             (`ebrowse-ts-member-functions "member function")
-             (`ebrowse-ts-member-variables "member variable")
-             (`ebrowse-ts-static-functions "static function")
-             (`ebrowse-ts-static-variables "static variable")
-             (`ebrowse-ts-friends (if globals-p "define" "friend"))
-             (`ebrowse-ts-types "type")
+             ('ebrowse-ts-member-functions "member function")
+             ('ebrowse-ts-member-variables "member variable")
+             ('ebrowse-ts-static-functions "static function")
+             ('ebrowse-ts-static-variables "static variable")
+             ('ebrowse-ts-friends (if globals-p "define" "friend"))
+             ('ebrowse-ts-types "type")
              (_ "unknown"))
            "\n")))
 
@@ -3750,6 +3731,7 @@ looks like a function call to the member."
     ;; Get the member name NAME (class-name is ignored).
     (let ((name fix-name) class-name regexp)
       (unless name
+        (ignore class-name) ;Can't use an underscore to silence the warning 
:-(!
        (cl-multiple-value-setq (class-name name)
          (cl-values-list (ebrowse-tags-read-name header "Find calls of: "))))
       ;; Set tags loop form to search for member and begin loop.
@@ -3794,14 +3776,13 @@ If VIEW is non-nil, view the position, otherwise find 
it."
         (find-file (ebrowse-position-file-name position))
         (goto-char (ebrowse-position-point position)))
        (t
-        (unwind-protect
-            (progn
-              (push (function
-                     (lambda ()
-                       (goto-char (ebrowse-position-point position))))
-                    view-mode-hook)
-              (view-file (ebrowse-position-file-name position)))
-          (pop view-mode-hook)))))
+         (let ((fn (lambda ()
+                    (goto-char (ebrowse-position-point position)))))
+          (unwind-protect
+               (progn
+                (add-hook 'view-mode-hook fn)
+                (view-file (ebrowse-position-file-name position)))
+            (remove-hook 'view-mode-hook fn))))))
 
 
 (defun ebrowse-push-position (marker info &optional target)
@@ -3904,6 +3885,7 @@ Runs the hook `ebrowse-electric-position-mode-hook'."
   (setq mode-line-buffer-identification "Electric Position Menu")
   (when (memq 'mode-name mode-line-format)
     (setq mode-line-format (copy-sequence mode-line-format))
+    ;; FIXME: Why not set `mode-name' to "Positions"?
     (setcar (memq 'mode-name mode-line-format) "Positions"))
   (set (make-local-variable 'Helper-return-blurb) "return to buffer editing")
   (setq truncate-lines t
@@ -4050,7 +4032,7 @@ Otherwise, FILE-NAME specifies the file to save the tree 
in."
          (erase-buffer)
          (setf (ebrowse-hs-member-table header) nil)
          (insert (prin1-to-string header) " ")
-         (mapc 'ebrowse-save-class tree)
+         (mapc #'ebrowse-save-class tree)
          (write-file file-name)
          (message "Tree written to file `%s'" file-name))
       (kill-buffer temp-buffer)
@@ -4065,7 +4047,7 @@ Otherwise, FILE-NAME specifies the file to save the tree 
in."
   (insert "[ebrowse-ts ")
   (prin1 (ebrowse-ts-class class))     ;class name
   (insert "(")                         ;list of subclasses
-  (mapc 'ebrowse-save-class (ebrowse-ts-subclasses class))
+  (mapc #'ebrowse-save-class (ebrowse-ts-subclasses class))
   (insert ")")
   (dolist (func ebrowse-member-list-accessors)
     (prin1 (funcall func class))
@@ -4252,12 +4234,12 @@ NUMBER-OF-STATIC-VARIABLES:"
   (unwind-protect
       (progn
        (add-hook 'electric-buffer-menu-mode-hook
-                 'ebrowse-hack-electric-buffer-menu)
+                 #'ebrowse-hack-electric-buffer-menu)
        (add-hook 'electric-buffer-menu-mode-hook
-                 'ebrowse-install-1-to-9-keys)
+                 #'ebrowse-install-1-to-9-keys)
        (call-interactively 'electric-buffer-list))
     (remove-hook 'electric-buffer-menu-mode-hook
-                'ebrowse-hack-electric-buffer-menu)))
+                #'ebrowse-hack-electric-buffer-menu)))
 
 
 ;;; Mouse support
@@ -4371,7 +4353,7 @@ EVENT is the mouse event."
     (pcase (event-click-count event)
       (1
        (pcase property
-        (`class-name
+        ('class-name
          (ebrowse-popup-menu ebrowse-tree-buffer-class-object-menu event))
         (_
          (ebrowse-popup-menu ebrowse-tree-buffer-object-menu event)))))))
@@ -4386,7 +4368,7 @@ EVENT is the mouse event."
         (property (get-text-property where 'ebrowse-what)))
     (pcase (event-click-count event)
       (1 (pcase property
-          (`class-name
+          ('class-name
            (ebrowse-tree-command:show-member-functions)))))))
 
 
@@ -4399,11 +4381,10 @@ EVENT is the mouse event."
         (property (get-text-property where 'ebrowse-what)))
     (pcase (event-click-count event)
       (2 (pcase property
-          (`class-name
-           (let ((collapsed (save-excursion (skip-chars-forward "^\r\n")
-                                            (looking-at "\r"))))
+          ('class-name
+           (let ((collapsed (ebrowse--hidden-p (line-end-position))))
              (ebrowse-collapse-fn (not collapsed))))
-          (`mark
+          ('mark
            (ebrowse-toggle-mark-at-point 1)))))))
 
 
@@ -4411,9 +4392,7 @@ EVENT is the mouse event."
 (provide 'ebrowse)
 
 ;; Local variables:
-;; eval:(put 'ebrowse-output 'lisp-indent-hook 0)
 ;; eval:(put 'ebrowse-ignoring-completion-case 'lisp-indent-hook 0)
-;; eval:(put 'ebrowse-save-selective 'lisp-indent-hook 0)
 ;; eval:(put 'ebrowse-for-all-trees 'lisp-indent-hook 1)
 ;; End:
 
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index f694252..cb1b17b 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1,6 +1,6 @@
 ;;; elisp-mode.el --- Emacs Lisp mode  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 1999-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: lisp, languages
@@ -271,14 +271,14 @@ Blank lines separate paragraphs.  Semicolons start 
comments.
         (unless
             (setq res
                   (pcase sexp
-                    (`(,(or `let `let*) ,bindings)
+                    (`(,(or 'let 'let*) ,bindings)
                      (let ((vars vars))
                        (when (eq 'let* (car sexp))
                          (dolist (binding (cdr (reverse bindings)))
                            (push (or (car-safe binding) binding) vars)))
                        (elisp--local-variables-1
                         vars (car (cdr-safe (car (last bindings)))))))
-                    (`(,(or `let `let*) ,bindings . ,body)
+                    (`(,(or 'let 'let*) ,bindings . ,body)
                      (let ((vars vars))
                        (dolist (binding bindings)
                          (push (or (car-safe binding) binding) vars))
@@ -300,7 +300,7 @@ Blank lines separate paragraphs.  Semicolons start comments.
                     ;; FIXME: Handle `cond'.
                     (`(,_ . ,_)
                      (elisp--local-variables-1 vars (car (last sexp))))
-                    (`elisp--witness--lisp (or vars '(nil)))
+                    ('elisp--witness--lisp (or vars '(nil)))
                     (_ nil)))
           ;; We didn't find the witness in the last element so we try to
           ;; backtrack to the last-but-one.
@@ -541,7 +541,7 @@ functions are annotated with \"<f>\" via the
                      (pcase parent
                        ;; FIXME: Rather than hardcode special cases here,
                        ;; we should use something like a symbol-property.
-                       (`declare
+                       ('declare
                         (list t (mapcar (lambda (x) (symbol-name (car x)))
                                         (delete-dups
                                          ;; FIXME: We should include some
@@ -549,14 +549,14 @@ functions are annotated with \"<f>\" via the
                                          (append macro-declarations-alist
                                                  defun-declarations-alist
                                                  nil))))) ; Copy both alists.
-                       ((and (or `condition-case `condition-case-unless-debug)
+                       ((and (or 'condition-case 'condition-case-unless-debug)
                              (guard (save-excursion
                                       (ignore-errors
                                         (forward-sexp 2)
                                         (< (point) beg)))))
                         (list t obarray
                               :predicate (lambda (sym) (get sym 
'error-conditions))))
-                       ((and (or ?\( `let `let*)
+                       ((and (or ?\( 'let 'let*)
                              (guard (save-excursion
                                       (goto-char (1- beg))
                                       (when (eq parent ?\()
@@ -1669,6 +1669,16 @@ Calls REPORT-FN directly."
 (defvar-local elisp-flymake--byte-compile-process nil
   "Buffer-local process started for byte-compiling the buffer.")
 
+(defvar elisp-flymake-byte-compile-load-path (list "./")
+  "Like `load-path' but used by `elisp-flymake-byte-compile'.
+The default value contains just \"./\" which includes the default
+directory of the buffer being compiled, and nothing else.")
+
+(put 'elisp-flymake-byte-compile-load-path 'safe-local-variable
+     (lambda (x) (and (listp x) (catch 'tag
+                                  (dolist (path x t) (unless (stringp path)
+                                                       (throw 'tag nil)))))))
+
 ;;;###autoload
 (defun elisp-flymake-byte-compile (report-fn &rest _args)
   "A Flymake backend for elisp byte compilation.
@@ -1688,13 +1698,14 @@ current buffer state and calls REPORT-FN when done."
        (make-process
         :name "elisp-flymake-byte-compile"
         :buffer output-buffer
-        :command (list (expand-file-name invocation-name invocation-directory)
-                       "-Q"
-                       "--batch"
-                       ;; "--eval" "(setq load-prefer-newer t)" ; for testing
-                       "-L" default-directory
-                       "-f" "elisp-flymake--batch-compile-for-flymake"
-                       temp-file)
+        :command `(,(expand-file-name invocation-name invocation-directory)
+                   "-Q"
+                   "--batch"
+                   ;; "--eval" "(setq load-prefer-newer t)" ; for testing
+                   ,@(mapcan (lambda (path) (list "-L" path))
+                             elisp-flymake-byte-compile-load-path)
+                   "-f" "elisp-flymake--batch-compile-for-flymake"
+                   ,temp-file)
         :connection-type 'pipe
         :sentinel
         (lambda (proc _event)
diff --git a/lisp/progmodes/etags.el b/lisp/progmodes/etags.el
index 6844e9b..910c320 100644
--- a/lisp/progmodes/etags.el
+++ b/lisp/progmodes/etags.el
@@ -1,6 +1,6 @@
 ;;; etags.el --- etags facility for Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1988-1989, 1992-1996, 1998, 2000-2018 Free
+;; Copyright (C) 1985-1986, 1988-1989, 1992-1996, 1998, 2000-2019 Free
 ;; Software Foundation, Inc.
 
 ;; Author: Roland McGrath <address@hidden>
@@ -36,7 +36,7 @@
 (require 'ring)
 (require 'button)
 (require 'xref)
-(require 'multifile)
+(require 'fileloop)
 
 ;;;###autoload
 (defvar tags-file-name nil
@@ -1281,7 +1281,7 @@ buffer-local values of tags table format variables."
       ;; This regexp matches an explicit tag name or the place where
       ;; it would start.
       (while (re-search-forward
-              "[\f\t\n\r()=,; ]?\177\\\(?:\\([^\n\001]+\\)\001\\)?"
+              "[\f\t\n\r()=,; ]?\177\\(?:\\([^\n\001]+\\)\001\\)?"
              nil t)
        (push   (prog1 (if (match-beginning 1)
                           ;; There is an explicit tag name.
@@ -1645,7 +1645,7 @@ Point should be just after a string that matches TAG."
   ;; a textual description of the four rules.
   (and (string-match "^[^ \t()=,;]+$" tag) ;rule #1
        ;; Rules #2 and #4, and a check that there's no explicit name.
-       (looking-at "[ \t()=,;]?\177\\(?:[0-9]+\\)?,\\(?:[0-9]+\\)?$")
+       (looking-at "[ \t()=,;]?\177[0-9]*,[0-9]*$")
        (save-excursion
         (backward-char (1+ (length tag)))
         (looking-at "[\n \t()=,;]")))) ;rule #3
@@ -1693,12 +1693,12 @@ Point should be just after a string that matches TAG."
     (let ((bol (point)))
       (and (search-forward "\177" (line-end-position) t)
           (re-search-backward re bol t)))))
-(define-obsolete-variable-alias 'tags-loop-revert-buffers 
'multifile-revert-buffers "27.1")
+(define-obsolete-variable-alias 'tags-loop-revert-buffers 
'fileloop-revert-buffers "27.1")
 
 ;;;###autoload
 (defalias 'next-file 'tags-next-file)
 (make-obsolete 'next-file
-               "use tags-next-file or multifile-initialize and 
multifile-next-file instead" "27.1")
+               "use tags-next-file or fileloop-initialize and 
fileloop-next-file instead" "27.1")
 ;;;###autoload
 (defun tags-next-file (&optional initialize novisit)
   "Select next file among files in current tags table.
@@ -1716,7 +1716,7 @@ if the file was newly read in, the value is the filename."
   (interactive (list (if current-prefix-arg t)))
   (when initialize ;; Not the first run.
     (tags--compat-initialize initialize))
-  (multifile-next-file novisit)
+  (fileloop-next-file novisit)
   (switch-to-buffer (current-buffer)))
 
 (defun tags--all-files ()
@@ -1742,11 +1742,11 @@ if the file was newly read in, the value is the 
filename."
                 (mapcar #'expand-file-name (tags-table-files)))))
       files)))
 
-(make-obsolete-variable 'tags-loop-operate 'multifile-initialize "27.1")
+(make-obsolete-variable 'tags-loop-operate 'fileloop-initialize "27.1")
 (defvar tags-loop-operate nil
   "Form for `tags-loop-continue' to eval to change one file.")
 
-(make-obsolete-variable 'tags-loop-scan 'multifile-initialize "27.1")
+(make-obsolete-variable 'tags-loop-scan 'fileloop-initialize "27.1")
 (defvar tags-loop-scan
   '(user-error "%s"
               (substitute-command-keys
@@ -1775,7 +1775,7 @@ Bind `case-fold-search' during the evaluation, depending 
on the value of
     (eval files))))
 
 (defun tags--compat-initialize (initialize)
-  (multifile-initialize
+  (fileloop-initialize
    (tags--compat-files initialize)
    (if tags-loop-operate
        (lambda () (tags-loop-eval tags-loop-operate))
@@ -1792,11 +1792,11 @@ argument is passed to `next-file', which see)."
   ;; interesting (it returns non-nil if so) and `tags-loop-operate' is a form 
to
   ;; evaluate to operate on an interesting file.  If the latter evaluates to
   ;; nil, we exit; otherwise we scan the next file.
-  (declare (obsolete multifile-continue "27.1"))
+  (declare (obsolete fileloop-continue "27.1"))
   (interactive)
   (when first-time ;; Backward compatibility.
     (tags--compat-initialize first-time))
-  (multifile-continue))
+  (fileloop-continue))
 
 ;; We use it to detect when the last loop was a tags-search.
 (defvar tags--last-search-operate-function nil)
@@ -1813,18 +1813,18 @@ The search will be restricted to these files.
 Also see the documentation of the `tags-file-name' variable."
   (interactive "sTags search (regexp): ")
   (unless (and (equal regexp "")
-               ;; FIXME: If some other multifile operation took place,
+               ;; FIXME: If some other fileloop operation took place,
                ;; rather than search for "", we should repeat the last search!
-              (eq multifile--operate-function
+              (eq fileloop--operate-function
                    tags--last-search-operate-function))
-    (multifile-initialize-search
+    (fileloop-initialize-search
      regexp
      (tags--compat-files (or files t))
      tags-case-fold-search)
-    ;; Store it, so we can detect if some other multifile operation took
+    ;; Store it, so we can detect if some other fileloop operation took
     ;; place since the last search!
-    (setq tags--last-search-operate-function multifile--operate-function))
-  (multifile-continue))
+    (setq tags--last-search-operate-function fileloop--operate-function))
+  (fileloop-continue))
 
 ;;;###autoload
 (defun tags-query-replace (from to &optional delimited files)
@@ -1832,15 +1832,15 @@ Also see the documentation of the `tags-file-name' 
variable."
 Third arg DELIMITED (prefix arg) means replace only word-delimited matches.
 If you exit (\\[keyboard-quit], RET or q), you can resume the query replace
 with the command \\[tags-loop-continue].
-For non-interactive use, superceded by `multifile-initialize-replace'."
+For non-interactive use, superceded by `fileloop-initialize-replace'."
   (declare (advertised-calling-convention (from to &optional delimited) 
"27.1"))
   (interactive (query-replace-read-args "Tags query replace (regexp)" t t))
-  (multifile-initialize-replace
+  (fileloop-initialize-replace
    from to
    (tags--compat-files (or files t))
    (if (equal from (downcase from)) nil 'default)
    delimited)
-  (multifile-continue))
+  (fileloop-continue))
 
 (defun tags-complete-tags-table-file (string predicate what) ; Doc string?
   (save-excursion
diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el
index 9b556df..d7985a7 100644
--- a/lisp/progmodes/executable.el
+++ b/lisp/progmodes/executable.el
@@ -1,6 +1,6 @@
 ;;; executable.el --- base functionality for executable interpreter scripts 
-*- byte-compile-dynamic: t -*-
 
-;; Copyright (C) 1994-1996, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1996, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pfeiffer <address@hidden>
 ;; Keywords: languages, unix
diff --git a/lisp/progmodes/f90.el b/lisp/progmodes/f90.el
index c3e085d..9de8063 100644
--- a/lisp/progmodes/f90.el
+++ b/lisp/progmodes/f90.el
@@ -1,6 +1,6 @@
 ;;; f90.el --- Fortran-90 mode (free format)  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1995-1997, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1997, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Torbjörn Einarsson <address@hidden>
 ;; Maintainer: Glenn Morris <address@hidden>
@@ -648,7 +648,7 @@ forall\\|block\\|critical\\)\\)\\_>"
 \\|enumerator\\|procedure\\|\
 logical\\|double[ \t]*precision\\|type[ \t]*(\\(?:\\sw\\|\\s_\\)+)\\|none\\)[ 
\t]*"
       (1 font-lock-keyword-face) (2 font-lock-type-face))
-    '("\\_<\\(namelist\\|common\\)[ \t]*/\\(\\(?:\\sw\\|\\s_\\)+\\)?\/"
+    '("\\_<\\(namelist\\|common\\)[ \t]*/\\(\\(?:\\sw\\|\\s_\\)+\\)?/"
       (1 font-lock-keyword-face) (2 font-lock-constant-face nil t))
     "\\_<else\\([ \t]*if\\|where\\)?\\_>"
     '("\\(&\\)[ \t]*\\(!\\|$\\)"  (1 font-lock-keyword-face))
diff --git a/lisp/progmodes/flymake-cc.el b/lisp/progmodes/flymake-cc.el
index ebcfd7d..248c95a 100644
--- a/lisp/progmodes/flymake-cc.el
+++ b/lisp/progmodes/flymake-cc.el
@@ -1,6 +1,6 @@
 ;;; flymake-cc.el --- Flymake support for GNU tools for C/C++     -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2018  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: João Távora <address@hidden>
 ;; Keywords: languages, c
@@ -58,13 +58,15 @@ SOURCE."
   (cl-loop
    while
    (search-forward-regexp
-    "^\\(In file included from 
\\)?<stdin>:\\([0-9]+\\):\\([0-9]+\\):\n?\\(.*\\): \\(.*\\)$"
+    (concat
+     "^\\(In file included from \\)?<stdin>:\\([0-9]+\\)\\(?::\\([0-9]+\\)\\)"
+     "?:[\n ]?\\(error\\|warning\\|note\\): \\(.*\\)$")
     nil t)
    for msg = (match-string 5)
    for (beg . end) = (flymake-diag-region
                       source
                       (string-to-number (match-string 2))
-                      (string-to-number (match-string 3)))
+                      (and (match-string 3) (string-to-number (match-string 
3))))
    for type = (if (match-string 1)
                   :error
                 (assoc-default
@@ -78,7 +80,11 @@ SOURCE."
 (defun flymake-cc-use-special-make-target ()
   "Command for checking a file via a CHK_SOURCES Make target."
   (unless (executable-find "make") (error "Make not found"))
-  `("make" "check-syntax" "CHK_SOURCES=-x c -"))
+  `("make"
+    "check-syntax"
+    ,(format "CHK_SOURCES=-x %s -c -"
+             (cond ((derived-mode-p 'c++-mode) "c++")
+                   (t "c")))))
 
 (defvar-local flymake-cc--proc nil "Internal variable for `flymake-gcc'")
 
diff --git a/lisp/progmodes/flymake-proc.el b/lisp/progmodes/flymake-proc.el
index 8600be9..dbf7561 100644
--- a/lisp/progmodes/flymake-proc.el
+++ b/lisp/progmodes/flymake-proc.el
@@ -1,6 +1,6 @@
 ;;; flymake-proc.el --- Flymake backend for external tools  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author:  Pavel Kobyakov <address@hidden>
 ;; Maintainer: João Távora <address@hidden>
@@ -874,7 +874,7 @@ can also be executed interactively independently of
   (unless (stringp file-name)
     (error "Invalid file-name"))
 
-  (let* ((dir       (file-name-directory file-name))
+  (let* ((dir       (file-name-directory (file-name-unquote file-name)))
          ;; Not sure what this slash-pos is all about, but I guess it's just
          ;; trying to remove the leading / of absolute file names.
         (slash-pos (string-match "/" dir))
@@ -887,7 +887,7 @@ can also be executed interactively independently of
 (defun flymake-proc--delete-temp-directory (dir-name)
   "Attempt to delete temp dir created by 
`flymake-proc-create-temp-with-folder-structure', do not fail on error."
   (let* ((temp-dir    temporary-file-directory)
-        (suffix      (substring dir-name (1+ (length temp-dir)))))
+        (suffix      (substring dir-name (1+ (length (directory-file-name 
temp-dir))))))
 
     (while (> (length suffix) 0)
       (setq suffix (directory-file-name suffix))
@@ -1133,7 +1133,7 @@ Use CREATE-TEMP-F for creating temp copy."
   (let* ((temp-master-file-name 
(flymake-proc--init-create-temp-source-and-master-buffer-copy
                                  'flymake-proc-get-include-dirs-dot 
'flymake-proc-create-temp-inplace
                                 '("\\.tex\\'")
-                                "[ \t]*\\in\\(?:put\\|clude\\)[ 
\t]*{\\(.*%s\\)}")))
+                                "[ \t]*in\\(?:put\\|clude\\)[ 
\t]*{\\(.*%s\\)}")))
     (when temp-master-file-name
       (flymake-proc--get-tex-args temp-master-file-name))))
 
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index f0f93f1..d6cd370 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1,10 +1,11 @@
 ;;; flymake.el --- A universal on-the-fly syntax checker  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author:  Pavel Kobyakov <address@hidden>
 ;; Maintainer: João Távora <address@hidden>
-;; Version: 1.0
+;; Version: 1.0.5
+;; Package-Requires: ((emacs "26.1"))
 ;; Keywords: c languages tools
 
 ;; This file is part of GNU Emacs.
@@ -219,24 +220,34 @@ Specifically, start it when the saved buffer is actually 
displayed."
   :version "26.1"
   :type 'boolean)
 
-(define-fringe-bitmap 'flymake-double-exclamation-mark
-  (vector #b00000000
-          #b00000000
-          #b00000000
-          #b00000000
-          #b01100110
-          #b01100110
-          #b01100110
-          #b01100110
-          #b01100110
-          #b01100110
-          #b01100110
-          #b01100110
-          #b00000000
-          #b01100110
-          #b00000000
-          #b00000000
-          #b00000000))
+(defcustom flymake-suppress-zero-counters :warning
+  "Control appearance of zero-valued diagnostic counters in mode line.
+
+If set to t, supress all zero counters.  If set to a severity
+symbol like `:warning' (the default) suppress zero counters less
+severe than that severity, according to `warning-numeric-level'.
+If set to nil, don't supress any zero counters."
+  :type 'symbol)
+
+(when (fboundp 'define-fringe-bitmap)
+  (define-fringe-bitmap 'flymake-double-exclamation-mark
+    (vector #b00000000
+            #b00000000
+            #b00000000
+            #b00000000
+            #b01100110
+            #b01100110
+            #b01100110
+            #b01100110
+            #b01100110
+            #b01100110
+            #b01100110
+            #b01100110
+            #b00000000
+            #b01100110
+            #b00000000
+            #b00000000
+            #b00000000)))
 
 (defvar-local flymake-timer nil
   "Timer for starting syntax check.")
@@ -291,7 +302,7 @@ generated it."
 
 (cl-defstruct (flymake--diag
                (:constructor flymake--diag-make))
-  buffer beg end type text backend data overlay)
+  buffer beg end type text backend data overlay-properties overlay)
 
 ;;;###autoload
 (defun flymake-make-diagnostic (buffer
@@ -299,13 +310,20 @@ generated it."
                                 end
                                 type
                                 text
-                                &optional data)
+                                &optional data
+                                overlay-properties)
   "Make a Flymake diagnostic for BUFFER's region from BEG to END.
 TYPE is a key to symbol and TEXT is a description of the problem
 detected in this region.  DATA is any object that the caller
-wishes to attach to the created diagnostic for later retrieval."
+wishes to attach to the created diagnostic for later retrieval.
+
+OVERLAY-PROPERTIES is an an alist of properties attached to the
+created diagnostic, overriding the default properties and any
+properties of `flymake-overlay-control' of the diagnostic's
+type."
   (flymake--diag-make :buffer buffer :beg beg :end end
-                      :type type :text text :data data))
+                      :type type :text text :data data
+                      :overlay-properties overlay-properties))
 
 ;;;###autoload
 (defun flymake-diagnostics (&optional beg end)
@@ -402,7 +420,7 @@ region is invalid."
                        (beg)
                        (progn
                          (end-of-line)
-                         (skip-chars-backward " \t\f\t\n" beg)
+                         (skip-chars-backward " \t\f\n" beg)
                          (if (eq (point) beg)
                              (line-beginning-position 2)
                            (point)))))
@@ -518,7 +536,7 @@ Currently accepted REPORT-KEY arguments are:
 (put :warning 'flymake-category 'flymake-warning)
 (put :note 'flymake-category 'flymake-note)
 
-(defvar flymake-diagnostic-types-alist `() "")
+(defvar flymake-diagnostic-types-alist '() "")
 (make-obsolete-variable
  'flymake-diagnostic-types-alist
  "Set properties on the diagnostic symbols instead. See Info
@@ -598,7 +616,9 @@ associated `flymake-category' return DEFAULT."
     ;; properties.
     (cl-loop
      for (ov-prop . value) in
-     (append (reverse ; ensure ealier props override later ones
+     (append (reverse
+              (flymake--diag-overlay-properties diagnostic))
+             (reverse ; ensure ealier props override later ones
               (flymake--lookup-type-property type 'flymake-overlay-control))
              (alist-get type flymake-diagnostic-types-alist))
      do (overlay-put ov ov-prop value))
@@ -722,14 +742,13 @@ report applies to that region."
           ;; the associated overlay.
           (cond
            (region
-            (dolist (diag (flymake--backend-state-diags state))
-              (let ((diag-beg (flymake--diag-beg diag))
-                    (diag-end (flymake--diag-beg diag)))
-                (when (and (< diag-beg (cdr region))
-                           (> diag-end (car region)))
-                  (delete-overlay (flymake--diag-overlay diag))
-                  (setf (flymake--backend-state-diags state)
-                        (delq diag (flymake--backend-state-diags state)))))))
+            (cl-loop for diag in (flymake--backend-state-diags state)
+                     if (or (> (flymake--diag-end diag) (car region))
+                            (< (flymake--diag-beg diag) (cdr region)))
+                     do (delete-overlay (flymake--diag-overlay diag))
+                     else collect diag into surviving
+                     finally (setf (flymake--backend-state-diags state)
+                                   surviving)))
            (first-report
             (dolist (diag (flymake--backend-state-diags state))
               (delete-overlay (flymake--diag-overlay diag)))
@@ -746,7 +765,8 @@ report applies to that region."
             (flymake-log :debug "backend %s reported %d diagnostics in %.2f 
second(s)"
                          backend
                          (length new-diags)
-                         (- (float-time) flymake-check-start-time)))
+                        (float-time
+                         (time-since flymake-check-start-time))))
           (when (and (get-buffer (flymake--diagnostics-buffer-name))
                      (get-buffer-window (flymake--diagnostics-buffer-name))
                      (null (cl-set-difference (flymake-running-backends)
@@ -954,6 +974,11 @@ special *Flymake log* buffer."  :group 'flymake :lighter
     (add-hook 'after-save-hook 'flymake-after-save-hook nil t)
     (add-hook 'kill-buffer-hook 'flymake-kill-buffer-hook nil t)
 
+    ;; If Flymake happened to be alrady already ON, we must cleanup
+    ;; existing diagnostic overlays, lest we forget them by blindly
+    ;; reinitializing `flymake--backend-state' in the next line.
+    ;; See https://github.com/joaotavora/eglot/issues/223.
+    (mapc #'delete-overlay (flymake--overlays))
     (setq flymake--backend-state (make-hash-table))
     (setq flymake--recent-changes nil)
 
@@ -980,6 +1005,8 @@ Do it only if `flymake-no-changes-timeout' is non-nil."
     (setq
      flymake-timer
      (run-with-idle-timer
+      ;; This can use encode-time instead of seconds-to-time,
+      ;; once we can assume Emacs 27 or later.
       (seconds-to-time flymake-no-changes-timeout)
       nil
       (lambda (buffer)
@@ -1112,7 +1139,7 @@ default) no filter is applied."
 ;;; Mode-line and menu
 ;;;
 (easy-menu-define flymake-menu flymake-mode-map "Flymake"
-  `("Flymake"
+  '("Flymake"
     [ "Go to next problem"      flymake-goto-next-error t ]
     [ "Go to previous problem"  flymake-goto-prev-error t ]
     [ "Check now"               flymake-start t ]
@@ -1121,10 +1148,11 @@ default) no filter is applied."
     [ "Go to log buffer"        flymake-switch-to-log-buffer t ]
     [ "Turn off Flymake"        flymake-mode t ]))
 
-(defvar flymake--mode-line-format `(:eval (flymake--mode-line-format)))
+(defvar flymake--mode-line-format '(:eval (flymake--mode-line-format)))
 
 (put 'flymake--mode-line-format 'risky-local-variable t)
 
+
 (defun flymake--mode-line-format ()
   "Produce a pretty minor mode indicator."
   (let* ((known (hash-table-keys flymake--backend-state))
@@ -1160,16 +1188,16 @@ default) no filter is applied."
                       map))
       ,@(pcase-let ((`(,ind ,face ,explain)
                      (cond ((null known)
-                            `("?" mode-line "No known backends"))
+                            '("?" mode-line "No known backends"))
                            (some-waiting
                             `("Wait" compilation-mode-line-run
                               ,(format "Waiting for %s running backend(s)"
                                        (length some-waiting))))
                            (all-disabled
-                            `("!" compilation-mode-line-run
+                            '("!" compilation-mode-line-run
                               "All backends disabled"))
                            (t
-                            `(nil nil nil)))))
+                            '(nil nil nil)))))
           (when ind
             `((":"
                (:propertize ,ind
@@ -1192,8 +1220,14 @@ default) no filter is applied."
            for face = (flymake--lookup-type-property type
                                                      'mode-line-face
                                                      'compilation-error)
-           when (or diags (>= (flymake--severity type)
-                              (warning-numeric-level :warning)))
+           when (or diags
+                    (cond ((eq flymake-suppress-zero-counters t)
+                           nil)
+                          (flymake-suppress-zero-counters
+                           (>= (flymake--severity type)
+                               (warning-numeric-level
+                                flymake-suppress-zero-counters)))
+                          (t t)))
            collect `(:propertize
                      ,(format "%d" (length diags))
                      face ,face
@@ -1297,14 +1331,14 @@ POS can be a buffer position or a button"
   "Flymake diagnostics"
   "A mode for listing Flymake diagnostics."
   (setq tabulated-list-format
-        `[("Line" 5 (lambda (l1 l2)
-                      (< (plist-get (car l1) :line)
-                         (plist-get (car l2) :line)))
+        `[("Line" 5 ,(lambda (l1 l2)
+                       (< (plist-get (car l1) :line)
+                          (plist-get (car l2) :line)))
            :right-align t)
           ("Col" 3 nil :right-align t)
-          ("Type" 8 (lambda (l1 l2)
-                      (< (plist-get (car l1) :severity)
-                         (plist-get (car l2) :severity))))
+          ("Type" 8 ,(lambda (l1 l2)
+                       (< (plist-get (car l1) :severity)
+                          (plist-get (car l2) :severity))))
           ("Message" 0 t)])
   (setq tabulated-list-entries
         'flymake--diagnostics-buffer-entries)
@@ -1321,9 +1355,9 @@ POS can be a buffer position or a button"
          (target (or (get-buffer name)
                      (with-current-buffer (get-buffer-create name)
                        (flymake-diagnostics-buffer-mode)
-                       (setq flymake--diagnostics-buffer-source source)
                        (current-buffer)))))
     (with-current-buffer target
+      (setq flymake--diagnostics-buffer-source source)
       (revert-buffer)
       (display-buffer (current-buffer)))))
 
diff --git a/lisp/progmodes/fortran.el b/lisp/progmodes/fortran.el
index bfbf6c0..1526670 100644
--- a/lisp/progmodes/fortran.el
+++ b/lisp/progmodes/fortran.el
@@ -1,6 +1,6 @@
 ;;; fortran.el --- Fortran mode for GNU Emacs
 
-;; Copyright (C) 1986, 1993-1995, 1997-2018 Free Software Foundation,
+;; Copyright (C) 1986, 1993-1995, 1997-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Michael D. Prange <address@hidden>
@@ -495,7 +495,7 @@ This is used to fontify fixed-format Fortran comments."
   ;; `byte-compile', but simple benchmarks indicate that it's probably not
   ;; worth the trouble (about 0.5% of slow down).
   (eval                         ;I hate `eval', but it's hard to avoid it here.
-   `(syntax-propertize-rules
+   '(syntax-propertize-rules
      ("^[CcDd\\*]" (0 "<"))
      ;; We mark all chars after line-length as "comment-start", rather than
      ;; just the first one.  This is so that a closing ' that's past the
@@ -1795,7 +1795,7 @@ non-indentation text within the comment."
            (goto-char (match-end 0)))
           (t
            ;; Move past line number.
-           (skip-chars-forward "[ \t0-9]")))
+           (skip-chars-forward " \t0-9")))
     ;; Move past whitespace.
     (skip-chars-forward " \t")
     (current-column)))
@@ -2052,7 +2052,7 @@ If ALL is nil, only match comments that start in column > 
0."
                 (when (<= (point) bos)
                   (move-to-column (1+ fill-column))
                   ;; What is this doing???
-                  (or (re-search-forward "[\t\n,'+-/*)=]" eol t)
+                  (or (re-search-forward "[-\t\n,'+/*)=]" eol t)
                       (goto-char bol)))
                 (if (bolp)
                     (re-search-forward "[ \t]" opoint t))
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index 32bdc31..716f40c 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -1,6 +1,6 @@
 ;;; gdb-mi.el --- User Interface for running GDB  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Nick Roberts <address@hidden>
 ;; Maintainer: address@hidden
@@ -1120,13 +1120,15 @@ line, and no execution takes place."
 (defcustom gdb-show-changed-values t
   "If non-nil change the face of out of scope variables and changed values.
 Out of scope variables are suppressed with `shadow' face.
-Changed values are highlighted with the face `font-lock-warning-face'."
+Changed values are highlighted with the face `font-lock-warning-face'.
+Used by Speedbar."
   :type 'boolean
   :group 'gdb
   :version "22.1")
 
 (defcustom gdb-max-children 40
-  "Maximum number of children before expansion requires confirmation."
+  "Maximum number of children before expansion requires confirmation.
+Used by Speedbar."
   :type 'integer
   :group 'gdb
   :version "22.1")
@@ -1371,7 +1373,7 @@ With arg, enter name of variable to be watched in the 
minibuffer."
 TEXT is the text of the button we clicked on, a + or - item.
 TOKEN is data related to this node.
 INDENT is the current indentation depth."
-  (cond ((string-match "+" text)        ;expand this node
+  (cond ((string-match "\\+" text)        ;expand this node
         (let* ((var (assoc token gdb-var-list))
                (expr (nth 1 var)) (children (nth 2 var)))
           (if (or (<= (string-to-number children) gdb-max-children)
@@ -1841,7 +1843,7 @@ commands to be prefixed by \"-interpreter-exec 
console\".")
   ;; Python and Guile commands that have an argument don't enter the
   ;; recursive reading loop.
   (let* ((control-command-p (string-match gdb-control-commands-regexp string))
-         (command-arg (match-string 3 string))
+         (command-arg (and control-command-p (match-string 3 string)))
          (python-or-guile-p (string-match gdb-python-guile-commands-regexp
                                           string)))
     (if (and control-command-p
@@ -4151,7 +4153,7 @@ member."
         (when (not value)
           (setq value "<complex data type>"))
         (if (or (not value)
-                (string-match "\\0x" value))
+                (string-match "0x" value))
             (add-text-properties 0 (length name)
                                  `(mouse-face highlight
                                               help-echo "mouse-2: create watch 
expression"
diff --git a/lisp/progmodes/glasses.el b/lisp/progmodes/glasses.el
index f2bf209..2bfc256 100644
--- a/lisp/progmodes/glasses.el
+++ b/lisp/progmodes/glasses.el
@@ -1,6 +1,6 @@
 ;;; glasses.el --- make cantReadThis readable
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Milan Zamazal <address@hidden>
 ;; Maintainer: Milan Zamazal <address@hidden>
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 0ededb1..c0f4715 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -1,6 +1,6 @@
 ;;; grep.el --- run `grep' and display the results  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1987, 1993-1999, 2001-2018 Free Software
+;; Copyright (C) 1985-1987, 1993-1999, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Roland McGrath <address@hidden>
@@ -361,6 +361,9 @@ A grep buffer becomes most recent when you select Grep mode 
in it.
 Notice that using \\[next-error] or \\[compile-goto-error] modifies
 `compilation-last-buffer' rather than `grep-last-buffer'.")
 
+(defvar grep-match-face        'match
+  "Face name to use for grep matches.")
+
 ;;;###autoload
 (defconst grep-regexp-alist
   `((,(concat "^\\(?:"
@@ -384,7 +387,7 @@ Notice that using \\[next-error] or \\[compile-goto-error] 
modifies
          (when grep-highlight-matches
            (let* ((beg (match-end 0))
                   (end (save-excursion (goto-char beg) (line-end-position)))
-                  (mbeg (text-property-any beg end 'font-lock-face 
'grep-match-face)))
+                  (mbeg (text-property-any beg end 'font-lock-face 
grep-match-face)))
              (when mbeg
                (- mbeg beg)))))
       .
@@ -392,7 +395,7 @@ Notice that using \\[next-error] or \\[compile-goto-error] 
modifies
          (when grep-highlight-matches
            (let* ((beg (match-end 0))
                   (end (save-excursion (goto-char beg) (line-end-position)))
-                  (mbeg (text-property-any beg end 'font-lock-face 
'grep-match-face))
+                  (mbeg (text-property-any beg end 'font-lock-face 
grep-match-face))
                   (mend (and mbeg (next-single-property-change mbeg 
'font-lock-face nil end))))
              (when mend
                (- mend beg))))))
@@ -416,9 +419,6 @@ See `compilation-error-regexp-alist' for format details.")
 (defvar grep-error-face        'compilation-error
   "Face name to use for grep error messages.")
 
-(defvar grep-match-face        'match
-  "Face name to use for grep matches.")
-
 (defvar grep-context-face 'shadow
   "Face name to use for grep context lines.")
 
@@ -457,13 +457,13 @@ abbreviated part can also be toggled with
      (": \\(.+\\): \\(?:Permission denied\\|No such \\(?:file or 
directory\\|device or address\\)\\)$"
       1 grep-error-face)
      ;; remove match from grep-regexp-alist before fontifying
-     ("^Grep[/a-zA-z]* started.*"
+     ("^Grep[/a-zA-Z]* started.*"
       (0 '(face nil compilation-message nil help-echo nil mouse-face nil) t))
-     ("^Grep[/a-zA-z]* finished with \\(?:\\(\\(?:[0-9]+ \\)?matches 
found\\)\\|\\(no matches found\\)\\).*"
+     ("^Grep[/a-zA-Z]* finished with \\(?:\\(\\(?:[0-9]+ \\)?match\\(?:es\\)? 
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))
-     ("^Grep[/a-zA-z]* \\(exited 
abnormally\\|interrupt\\|killed\\|terminated\\)\\(?:.*with code 
\\([0-9]+\\)\\)?.*"
+     ("^Grep[/a-zA-Z]* \\(exited 
abnormally\\|interrupt\\|killed\\|terminated\\)\\(?:.*with code 
\\([0-9]+\\)\\)?.*"
       (0 '(face nil compilation-message nil help-echo nil mouse-face nil) t)
       (1 grep-error-face)
       (2 grep-error-face nil t))
@@ -552,7 +552,10 @@ Set up `compilation-exit-message-function' and run 
`grep-setup-hook'."
       ;; 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)
+                 (cons (format (ngettext "finished with %d match found\n"
+                                         "finished with %d matches found\n"
+                                         grep-num-matches-found)
+                               grep-num-matches-found)
                        "matched")
                '("finished with matches found\n" . "matched")))
            ((not (buffer-modified-p))
@@ -704,7 +707,7 @@ This function is called from `compilation-filter-hook'."
                  'exec-plus)
                 ((and
                   (grep-probe find-program `(nil nil nil ,null-device 
"-print0"))
-                  (grep-probe xargs-program `(nil nil nil "-0" "echo")))
+                  (grep-probe xargs-program '(nil nil nil "-0" "echo")))
                  'gnu)
                 (t
                  'exec))))
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 91b4a65..92f5205 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -1,6 +1,6 @@
 ;;; gud.el --- Grand Unified Debugger mode for running GDB and other debuggers 
 -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-1996, 1998, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1992-1996, 1998, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric S. Raymond <address@hidden>
@@ -545,8 +545,8 @@ required by the caller."
                   nil
                   (if gdb-show-changed-values
                       (or parent (pcase status
-                                   (`changed 'font-lock-warning-face)
-                                   (`out-of-scope 'shadow)
+                                   ('changed 'font-lock-warning-face)
+                                   ('out-of-scope 'shadow)
                                    (_ t)))
                     t)
                   depth)
@@ -566,8 +566,8 @@ required by the caller."
                     nil
                     (if gdb-show-changed-values
                         (or parent (pcase status
-                                     (`changed 'font-lock-warning-face)
-                                     (`out-of-scope 'shadow)
+                                     ('changed 'font-lock-warning-face)
+                                     ('out-of-scope 'shadow)
                                      (_ t)))
                       t)
                     depth)
@@ -2237,7 +2237,7 @@ relative to a classpath directory."
                    (split-string
                     ;; Eliminate any subclass references in the class
                     ;; name string. These start with a "$"
-                     (if (string-match "$.*" p)
+                     (if (string-match "\\$.*" p)
                          (replace-match "" t t p) p)
                     "\\.") "/")
         ".java"))
@@ -3516,11 +3516,11 @@ With arg, dereference expr if ARG is positive, 
otherwise do not dereference."
 (defun gud-tooltip-print-command (expr)
   "Return a suitable command to print the expression EXPR."
   (pcase gud-minor-mode
-    (`gdbmi (concat "-data-evaluate-expression \"" expr "\""))
-    (`guiler expr)
-    (`dbx (concat "print " expr))
-    ((or `xdb `pdb) (concat "p " expr))
-    (`sdb (concat expr "/"))))
+    ('gdbmi (concat "-data-evaluate-expression \"" expr "\""))
+    ('guiler expr)
+    ('dbx (concat "print " expr))
+    ((or 'xdb 'pdb) (concat "p " expr))
+    ('sdb (concat expr "/"))))
 
 (declare-function gdb-input "gdb-mi" (command handler &optional trigger))
 (declare-function tooltip-expr-to-print "tooltip" (event))
diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el
index 62e8c45..32b0b75 100644
--- a/lisp/progmodes/hideif.el
+++ b/lisp/progmodes/hideif.el
@@ -1,6 +1,6 @@
 ;;; hideif.el --- hides selected code within ifdef  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1988, 1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Brian Marick
 ;;     Daniel LaLiberte <address@hidden>
@@ -672,12 +672,7 @@ that form should be displayed.")
        result))
     (nreverse result)))
 
-(defun hif-flatten (l)
-  "Flatten a tree."
-  (apply #'nconc
-         (mapcar (lambda (x) (if (listp x)
-                                 (hif-flatten x)
-                               (list x))) l)))
+(define-obsolete-function-alias 'hif-flatten #'flatten-tree "27.1")
 
 (defun hif-expand-token-list (tokens &optional macroname expand_list)
   "Perform expansion on TOKENS till everything expanded.
@@ -748,7 +743,7 @@ detecting self-reference."
 
          expanded))
 
-      (hif-flatten (nreverse expanded)))))
+      (flatten-tree (nreverse expanded)))))
 
 (defun hif-parse-exp (token-list &optional macroname)
   "Parse the TOKEN-LIST.
@@ -1166,7 +1161,7 @@ preprocessing token"
         (setq actual-parms (cdr actual-parms)))
 
       ;; Replacement completed, flatten the whole token list
-      (setq macro-body (hif-flatten macro-body))
+      (setq macro-body (flatten-tree macro-body))
 
       ;; Stringification and token concatenation happens here
       (hif-token-concatenation (hif-token-stringification macro-body)))))
diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el
index 84b2147..dcce2a6 100644
--- a/lisp/progmodes/hideshow.el
+++ b/lisp/progmodes/hideshow.el
@@ -1,6 +1,6 @@
 ;;; hideshow.el --- minor mode cmds to selectively display code/comment blocks
 
-;; Copyright (C) 1994-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
 ;; Author: Thien-Thi Nguyen <address@hidden>
 ;;      Dan Nicolaescu <address@hidden>
diff --git a/lisp/progmodes/icon.el b/lisp/progmodes/icon.el
index 6e02392..750f124 100644
--- a/lisp/progmodes/icon.el
+++ b/lisp/progmodes/icon.el
@@ -1,6 +1,6 @@
 ;;; icon.el --- mode for editing Icon code
 
-;; Copyright (C) 1989, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Chris Smith <address@hidden>
 ;; Created: 15 Feb 89
diff --git a/lisp/progmodes/idlw-complete-structtag.el 
b/lisp/progmodes/idlw-complete-structtag.el
index 07c31e7..51c9117 100644
--- a/lisp/progmodes/idlw-complete-structtag.el
+++ b/lisp/progmodes/idlw-complete-structtag.el
@@ -1,6 +1,6 @@
 ;;; idlw-complete-structtag.el --- Completion of structure tags.
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: J.D. Smith <address@hidden>
@@ -128,7 +128,7 @@ an up-to-date completion list."
           ;; x[i+4].name.g*.  But it is complicated because we would have
           ;; to really parse this expression.  For now, we allow only
           ;; substructures, like "aaa.bbb.ccc.ddd"
-         (skip-chars-backward "[a-zA-Z0-9._$]")
+         (skip-chars-backward "a-zA-Z0-9._$")
           (setq start (point)) ;; remember the start of the completion pos.
          (and (< (point) pos)
               (not (equal (char-before) ?!)) ; no sysvars
diff --git a/lisp/progmodes/idlw-help.el b/lisp/progmodes/idlw-help.el
index 54e740b..4588e93 100644
--- a/lisp/progmodes/idlw-help.el
+++ b/lisp/progmodes/idlw-help.el
@@ -1,6 +1,6 @@
 ;;; idlw-help.el --- HTML Help code for IDLWAVE
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 ;;
 ;; Authors: J.D. Smith <address@hidden>
 ;;          Carsten Dominik <address@hidden>
diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el
index 46e2eca..a3b0798 100644
--- a/lisp/progmodes/idlw-shell.el
+++ b/lisp/progmodes/idlw-shell.el
@@ -1,6 +1,6 @@
 ;; idlw-shell.el --- run IDL as an inferior process of Emacs.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Authors: J.D. Smith <address@hidden>
 ;;          Carsten Dominik <address@hidden>
diff --git a/lisp/progmodes/idlw-toolbar.el b/lisp/progmodes/idlw-toolbar.el
index 75f5582..d3b442c 100644
--- a/lisp/progmodes/idlw-toolbar.el
+++ b/lisp/progmodes/idlw-toolbar.el
@@ -1,6 +1,6 @@
 ;;; idlw-toolbar.el --- a debugging toolbar for IDLWAVE
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: J.D. Smith <address@hidden>
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index 540931c..bded09d 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -1,6 +1,6 @@
 ;; idlwave.el --- IDL editing mode for GNU Emacs
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Authors: J.D. Smith <address@hidden>
 ;;          Carsten Dominik <address@hidden>
@@ -3690,7 +3690,7 @@ constants - a double quote followed by an octal digit."
    (save-excursion
      (forward-char)
      (re-search-backward (concat "\\(" idlwave-idl-keywords
-                                 "\\|[[(*+-/=,^><]\\)\\s-*\\*") limit t))))
+                                 "\\|[-[(*+/=,^><]\\)\\s-*\\*") limit t))))
 
 
 ;; Statement templates
@@ -5588,7 +5588,7 @@ be set to nil to disable library catalog scanning."
             (mapcar 'car idlwave-path-alist)))
          (old-libname "")
          dir-entry dir catalog all-routines)
-      (if message-base (message message-base))
+      (if message-base (message "%s" message-base))
       (while (setq dir (pop dirs))
        (catch 'continue
          (when (file-readable-p
@@ -5603,8 +5603,7 @@ be set to nil to disable library catalog scanning."
                     message-base
                     (not (string= idlwave-library-catalog-libname
                                   old-libname)))
-               (message "%s" (concat message-base
-                                     idlwave-library-catalog-libname))
+               (message "%s%s" message-base idlwave-library-catalog-libname)
                (setq old-libname idlwave-library-catalog-libname))
              (when idlwave-library-catalog-routines
                (setq all-routines
@@ -5618,7 +5617,7 @@ be set to nil to disable library catalog scanning."
                       (setq dir-entry (assoc dir idlwave-path-alist)))
              (idlwave-path-alist-add-flag dir-entry 'lib)))))
       (unless no-load (setq idlwave-library-catalog-routines all-routines))
-      (if message-base (message (concat message-base "done"))))))
+      (if message-base (message "%sdone" message-base)))))
 
 ;;----- Communicating with the Shell -------------------
 
@@ -7591,7 +7590,7 @@ property indicating the link is added."
        (case-fold-search t))
     (cond ((save-excursion
             ;; Check if the context is right for system variable
-            (skip-chars-backward "[a-zA-Z0-9_$]")
+            (skip-chars-backward "a-zA-Z0-9_$")
             (equal (char-before) ?!))
           (setq idlwave-completion-help-info '(idlwave-complete-sysvar-help))
           (idlwave-complete-in-buffer 'sysvar 'sysvar
@@ -9074,7 +9073,7 @@ Assumes that point is at the beginning of the unit as 
found by
 
 ;; Menus - using easymenu.el
 (defvar idlwave-mode-menu-def
-  `("IDLWAVE"
+  '("IDLWAVE"
     ["PRO/FUNC menu" idlwave-function-menu t]
     ("Motion"
      ["Subprogram Start" idlwave-beginning-of-subprogram t]
@@ -9151,7 +9150,7 @@ Assumes that point is at the beginning of the unit as 
found by
      ["Kill auto-created buffers" idlwave-kill-autoloaded-buffers t]
      "--"
      ["Insert TAB character" idlwave-hard-tab t])
-     "--"
+    "--"
     ("External"
      ["Start IDL shell" idlwave-shell t]
      ["Edit file in IDLDE" idlwave-edit-in-idlde t]
diff --git a/lisp/progmodes/inf-lisp.el b/lisp/progmodes/inf-lisp.el
index 55e5d0e..3476a7f 100644
--- a/lisp/progmodes/inf-lisp.el
+++ b/lisp/progmodes/inf-lisp.el
@@ -1,6 +1,6 @@
 ;;; inf-lisp.el --- an inferior-lisp mode
 
-;; Copyright (C) 1988, 1993-1994, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1988, 1993-1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Olin Shivers <address@hidden>
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 3ce5af4..4d91da7 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1,6 +1,6 @@
 ;;; js.el --- Major mode for editing JavaScript  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Karl Landstrom <address@hidden>
 ;;         Daniel Colascione <address@hidden>
@@ -45,13 +45,11 @@
 
 ;;; Code:
 
-
 (require 'cc-mode)
 (require 'newcomment)
-(require 'thingatpt)                    ; forward-symbol etc
 (require 'imenu)
 (require 'moz nil t)
-(require 'json nil t)
+(require 'json)
 (require 'sgml-mode)
 (require 'prog-mode)
 
@@ -479,6 +477,7 @@ This applies to function movement, marking, and so on."
   "Align continuation of non-empty ([{ lines in `js-mode'."
   :version "26.1"
   :type 'boolean
+  :safe 'booleanp
   :group 'js)
 
 (defcustom js-comment-lineup-func #'c-lineup-C-comments
@@ -623,12 +622,6 @@ then the \".\"s will be lined up:
   "Parse state at `js--last-parse-pos'.")
 (make-variable-buffer-local 'js--state-at-last-parse-pos)
 
-(defun js--flatten-list (list)
-  (cl-loop for item in list
-           nconc (cond ((consp item)
-                        (js--flatten-list item))
-                       (item (list item)))))
-
 (defun js--maybe-join (prefix separator suffix &rest list)
   "Helper function for `js--update-quick-match-re'.
 If LIST contains any element that is not nil, return its non-nil
@@ -636,7 +629,7 @@ elements, separated by SEPARATOR, prefixed by PREFIX, and 
ended
 with SUFFIX as with `concat'.  Otherwise, if LIST is empty, return
 nil.  If any element in LIST is itself a list, flatten that
 element."
-  (setq list (js--flatten-list list))
+  (setq list (flatten-tree list))
   (when list
     (concat prefix (mapconcat #'identity list separator) suffix)))
 
@@ -793,7 +786,6 @@ macro as normal text."
 (defun js--re-search-backward-inner (regexp &optional bound count)
   "Auxiliary function for `js--re-search-backward'."
   (let ((parse)
-        str-terminator
         (orig-macro-start
          (save-excursion
            (and (js--beginning-of-macro)
@@ -804,13 +796,7 @@ macro as normal text."
                  (save-excursion (backward-char) (looking-at "/[/*]")))
         (forward-char))
       (setq parse (syntax-ppss))
-      (cond ((setq str-terminator (nth 3 parse))
-             (when (eq str-terminator t)
-               (setq str-terminator ?/))
-             (re-search-backward
-              (concat "\\([^\\]\\|^\\)" (string str-terminator))
-              (point-at-bol) t))
-            ((nth 7 parse)
+      (cond ((nth 8 parse)
              (goto-char (nth 8 parse)))
             ((or (nth 4 parse)
                  (and (eq (char-before) ?/) (eq (char-after) ?*)))
@@ -1013,7 +999,7 @@ BEG defaults to `point-min', meaning to flush the entire 
cache."
 Update parsing information up to point, referring to parse,
 prev-parse-point, goal-point, and open-items bound lexically in
 the body of `js--ensure-cache'."
-  `(progn
+  '(progn
      (setq goal-point (point))
      (goto-char prev-parse-point)
      (while (progn
@@ -1023,7 +1009,7 @@ the body of `js--ensure-cache'."
               ;; the given depth -- i.e., make sure we're deeper than the 
target
               ;; depth.
               (cl-assert (> (nth 0 parse)
-                         (js--pitem-paren-depth (car open-items))))
+                            (js--pitem-paren-depth (car open-items))))
               (setq parse (parse-partial-sexp
                            prev-parse-point goal-point
                            (js--pitem-paren-depth (car open-items))
@@ -1849,10 +1835,10 @@ This performs fontification according to 
`js--class-styles'."
              (skip-chars-backward " \t")
              (or (bobp) (backward-char))
              (and (> (point) (point-min))
-                  (save-excursion (backward-char) (not (looking-at "[/*]/")))
+                  (save-excursion (backward-char) (not (looking-at 
"[/*]/\\|=>")))
                   (js--looking-at-operator-p)
                   (and (progn (backward-char)
-                              (not (looking-at "+\\+\\|--\\|/[/*]"))))))))))
+                              (not (looking-at "\\+\\+\\|--\\|/[/*]"))))))))))
 
 (defun js--skip-term-backward ()
   "Skip a term before point; return t if a term was skipped."
@@ -1922,7 +1908,7 @@ the same column as the current line."
     (save-match-data
       (when (looking-at "\\s-*\\_<while\\_>")
        (if (save-excursion
-             (skip-chars-backward "[ \t\n]*}")
+             (skip-chars-backward " \t\n}")
              (looking-at "[ \t\n]*}"))
            (save-excursion
              (backward-list) (forward-symbol -1) (looking-at "\\_<do\\_>"))
@@ -2078,6 +2064,24 @@ indentation is aligned to that column."
         (when comma-p
           (goto-char (1+ declaration-keyword-end))))))))
 
+(defconst js--line-terminating-arrow-re "\\s-*=>\\s-*\\(/[/*]\\|$\\)"
+  "Regexp matching the last \"=>\" (arrow) token on a line.
+Whitespace and comments around the arrow are ignored.")
+
+(defun js--looking-at-broken-arrow-function-p ()
+  "Helper function for `js--proper-indentation'.
+Return t if point is at the start of a (possibly async) arrow
+function and the last non-comment, non-whitespace token of the
+current line is the \"=>\" token."
+  (when (looking-at "\\s-*async\\s-*")
+    (goto-char (match-end 0)))
+  (cond
+   ((eq (char-after) ?\()
+    (forward-list)
+    (looking-at-p js--line-terminating-arrow-re))
+   (t (looking-at-p
+       (concat js--name-re js--line-terminating-arrow-re)))))
+
 (defun js--proper-indentation (parse-status)
   "Return the proper indentation for the current line."
   (save-excursion
@@ -2108,7 +2112,8 @@ indentation is aligned to that column."
                  (continued-expr-p (js--continued-expression-p)))
              (goto-char (nth 1 parse-status)) ; go to the opening char
              (if (or (not js-indent-align-list-continuation)
-                     (looking-at "[({[]\\s-*\\(/[/*]\\|$\\)"))
+                     (looking-at "[({[]\\s-*\\(/[/*]\\|$\\)")
+                     (save-excursion (forward-char) 
(js--looking-at-broken-arrow-function-p)))
                  (progn ; nothing following the opening paren/bracket
                    (skip-syntax-backward " ")
                    (when (eq (char-before) ?\)) (backward-list))
@@ -2766,8 +2771,8 @@ Otherwise, use the current value of `process-mark'."
   (with-current-buffer (process-buffer process)
     (cl-loop with start-pos = (or start
                                   (marker-position (process-mark process)))
-             with end-time = (+ (float-time) timeout)
-             for time-left = (- end-time (float-time))
+            with end-time = (time-add nil timeout)
+            for time-left = (float-time (time-subtract end-time nil))
              do (goto-char (point-max))
              if (looking-back regexp start-pos) return t
              while (> time-left 0)
@@ -3322,11 +3327,11 @@ If nil, the whole Array is treated as a JS symbol.")
 
 (defun js--js-decode-retval (result)
   (pcase (intern (cl-first result))
-    (`atom (cl-second result))
-    (`special (intern (cl-second result)))
-    (`array
+    ('atom (cl-second result))
+    ('special (intern (cl-second result)))
+    ('array
      (mapcar #'js--js-decode-retval (cl-second result)))
-    (`objid
+    ('objid
      (or (gethash (cl-second result)
                   js--js-references)
          (puthash (cl-second result)
@@ -3335,7 +3340,7 @@ If nil, the whole Array is treated as a JS symbol.")
                    :process (inferior-moz-process))
                   js--js-references)))
 
-    (`error (signal 'js-js-error (list (cl-second result))))
+    ('error (signal 'js-js-error (list (cl-second result))))
     (x (error "Unmatched case in js--js-decode-retval: %S" x))))
 
 (defvar comint-last-input-end)
@@ -3720,8 +3725,8 @@ If one hasn't been set, or if it's stale, prompt for a 
new one."
    (when (or (null js--js-context)
              (js--js-handle-expired-p (cdr js--js-context))
              (pcase (car js--js-context)
-               (`window (js? (js< (cdr js--js-context) "closed")))
-               (`browser (not (js? (js< (cdr js--js-context)
+               ('window (js? (js< (cdr js--js-context) "closed")))
+               ('browser (not (js? (js< (cdr js--js-context)
                                         "contentDocument"))))
                (x (error "Unmatched case in js--get-js-context: %S" x))))
      (setq js--js-context (js--read-tab "JavaScript Context: ")))
@@ -3730,8 +3735,8 @@ If one hasn't been set, or if it's stale, prompt for a 
new one."
 (defun js--js-content-window (context)
   (with-js
    (pcase (car context)
-     (`window (cdr context))
-     (`browser (js< (cdr context)
+     ('window (cdr context))
+     ('browser (js< (cdr context)
                     "contentWindow" "wrappedJSObject"))
      (x (error "Unmatched case in js--js-content-window: %S" x)))))
 
diff --git a/lisp/progmodes/ld-script.el b/lisp/progmodes/ld-script.el
index f555155..6dafb64 100644
--- a/lisp/progmodes/ld-script.el
+++ b/lisp/progmodes/ld-script.el
@@ -1,6 +1,6 @@
 ;;; ld-script.el --- GNU linker script editing mode for Emacs
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Masatake YAMATO<address@hidden>
 ;; Keywords: languages, faces
diff --git a/lisp/progmodes/m4-mode.el b/lisp/progmodes/m4-mode.el
index bb75f57..98b812f 100644
--- a/lisp/progmodes/m4-mode.el
+++ b/lisp/progmodes/m4-mode.el
@@ -1,6 +1,6 @@
 ;;; m4-mode.el --- m4 code editing commands for Emacs
 
-;; Copyright (C) 1996-1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Andrew Csillag <address@hidden>
 ;; Keywords: languages, faces
@@ -63,10 +63,9 @@ If m4 is not in your PATH, set this to an absolute file 
name."
 ;;(defconst m4-program-options '("--prefix-builtins"))
 
 (defvar m4-font-lock-keywords
-  `(
-    ("\\(\\_<\\(m4_\\)?dnl\\_>\\).*$" . font-lock-comment-face)
+  '(("\\(\\_<\\(m4_\\)?dnl\\_>\\).*$" . font-lock-comment-face)
     ("address@hidden" . font-lock-variable-name-face)
-    ("\\$\\@" . font-lock-variable-name-face)
+    ("\\$@" . font-lock-variable-name-face)
     ("\\$\\*" . font-lock-variable-name-face)
     
("\\_<\\(m4_\\)?\\(builtin\\|change\\(com\\|quote\\|word\\)\\|d\\(e\\(bug\\(file\\|mode\\)\\|cr\\|f\\(ine\\|n\\)\\)\\|iv\\(ert\\|num\\)\\|nl\\|umpdef\\)\\|e\\(rrprint\\|syscmd\\|val\\)\\|f\\(ile\\|ormat\\)\\|gnu\\|i\\(f\\(def\\|else\\)\\|n\\(c\\(lude\\|r\\)\\|d\\(ex\\|ir\\)\\)\\)\\|l\\(en\\|ine\\)\\|m\\(4\\(exit\\|wrap\\)\\|aketemp\\)\\|p\\(atsubst\\|opdef\\|ushdef\\)\\|regexp\\|s\\(hift\\|include\\|ubstr\\|ys\\(cmd\\|val\\)\\)\\|tra\\(ceo\\(ff\\|n\\)\\|nslit\\)\\|un\\(d\\(efine\\|iv
 [...]
   "Default `font-lock-keywords' for M4 mode.")
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
index f67407f..cffb749 100644
--- a/lisp/progmodes/make-mode.el
+++ b/lisp/progmodes/make-mode.el
@@ -1,6 +1,6 @@
 ;;; make-mode.el --- makefile editing commands for Emacs -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 1992, 1994, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1994, 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Thomas Neumann <address@hidden>
 ;;     Eric S. Raymond <address@hidden>
@@ -343,7 +343,7 @@ not be enclosed in { } or ( )."
   "List of keywords understood by gmake.")
 
 (defconst makefile-bsdmake-statements
-  `(".elif" ".elifdef" ".elifmake" ".elifndef" ".elifnmake" ".else" ".endfor"
+  '(".elif" ".elifdef" ".elifmake" ".elifndef" ".elifnmake" ".else" ".endfor"
     ".endif" ".for" ".if" ".ifdef" ".ifmake" ".ifndef" ".ifnmake" ".undef")
   "List of keywords understood by BSD make.")
 
diff --git a/lisp/progmodes/mantemp.el b/lisp/progmodes/mantemp.el
index 214aa39..4190a84 100644
--- a/lisp/progmodes/mantemp.el
+++ b/lisp/progmodes/mantemp.el
@@ -1,6 +1,6 @@
 ;;; mantemp.el --- create manual template instantiations from g++ 2.7.2 output
 
-;; Copyright (C) 1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Tom Houlder <address@hidden>
 ;; Created: 10 Dec 1996
@@ -89,7 +89,7 @@
   (save-excursion
     (goto-char (point-min))
     (message "Removing comments")
-    (while (re-search-forward "^[A-z.()+0-9: ]*`\\|'.*$" nil t)
+    (while (re-search-forward "^[a-zA-Z.()+0-9: ]*`\\|'.*$" nil t)
       (replace-match ""))))
 
 (defun mantemp-remove-memfuncs ()
@@ -99,14 +99,14 @@
     (goto-char (point-min))
     (message "Removing member function extensions")
     (while (re-search-forward
-           "^[A-z :&*<>~=,0-9+]*>::operator " nil t nil)
+           "^[a-zA-Z :&*<>~=,0-9+]*>::operator " nil t nil)
       (progn
        (backward-char 11)
        (delete-region (point) (line-end-position))))
     ;; Remove other member function extensions.
     (goto-char (point-min))
     (message "Removing member function extensions")
-    (while (re-search-forward "^[A-z :&*<>~=,0-9+]*>::" nil t nil)
+    (while (re-search-forward "^[a-zA-Z :&*<>~=,0-9+]*>::" nil t nil)
       (progn
        (backward-char 2)
        (delete-region (point) (line-end-position))))))
@@ -154,7 +154,7 @@ the lines."
     (goto-char (point-min))
     (message "Inserting 'template' for functions")
     (while (re-search-forward
-           "^template class [A-z :&*<>~=,0-9+!]*(" nil t nil)
+           "^template class [a-zA-Z :&*<>~=,0-9+!]*(" nil t nil)
       (progn
        (beginning-of-line)
        (forward-word-strictly 1)
diff --git a/lisp/progmodes/meta-mode.el b/lisp/progmodes/meta-mode.el
index e207d22..8d3745b 100644
--- a/lisp/progmodes/meta-mode.el
+++ b/lisp/progmodes/meta-mode.el
@@ -1,6 +1,6 @@
 ;;; meta-mode.el --- major mode for editing Metafont or MetaPost sources -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Ulrik Vieth <address@hidden>
 ;; Version: 1.0
@@ -666,7 +666,7 @@ If the list was changed, sort the list and remove 
duplicates first."
       (let ((count 0))
         (narrow-to-region
          (point) (save-excursion
-                   (re-search-forward "[^\\\\\"]%\\|\n\\|\\'" nil t)
+                   (re-search-forward "[^\\\"]%\\|\n\\|\\'" nil t)
                    (backward-char) (point)))
         (while (re-search-forward "\\<\\sw+\\>\\|(\\|)" nil t)
           (save-excursion
diff --git a/lisp/progmodes/mixal-mode.el b/lisp/progmodes/mixal-mode.el
index 22d6342..a759709 100644
--- a/lisp/progmodes/mixal-mode.el
+++ b/lisp/progmodes/mixal-mode.el
@@ -1,6 +1,6 @@
 ;;; mixal-mode.el --- Major mode for the mix asm language.
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Pieter E.J. Pareit <address@hidden>
 ;; Maintainer: address@hidden
@@ -1044,7 +1044,7 @@ EXECUTION-TIME holds info about the time it takes, number 
or string.")
      . mixal-font-lock-operation-code-face)
     (,(regexp-opt mixal-assembly-pseudoinstructions 'words)
      . mixal-font-lock-assembly-pseudoinstruction-face)
-    ("^[A-Z0-9a-z]*[ \t]+[A-ZO-9a-z]+[ \t]+\\(=.*=\\)"
+    ("^[A-Z0-9a-z]*[ \t]+[A-Z0-9a-z]+[ \t]+\\(=.*=\\)"
      (1 font-lock-constant-face)))
   "Keyword highlighting specification for `mixal-mode'.")
 ;; (makunbound 'mixal-font-lock-keywords)
@@ -1108,7 +1108,7 @@ Assumes that file has been compiled with debugging 
support."
   (set (make-local-variable 'comment-start) "*")
   (set (make-local-variable 'comment-start-skip) "^\\*[ \t]*")
   (set (make-local-variable 'font-lock-defaults)
-       `(mixal-font-lock-keywords))
+       '(mixal-font-lock-keywords))
   (set (make-local-variable 'syntax-propertize-function)
        mixal-syntax-propertize-function)
   ;; might add an indent function in the future
diff --git a/lisp/progmodes/modula2.el b/lisp/progmodes/modula2.el
index ef12352..aa41230 100644
--- a/lisp/progmodes/modula2.el
+++ b/lisp/progmodes/modula2.el
@@ -270,16 +270,16 @@
   ;; - The inner VAR/TYPE are indented just like the outer VAR/TYPE.
   ;; - The inner PROCEDURE is not aligned with its VAR/TYPE siblings.
   (pcase (cons kind token)
-    (`(:elem . basic) m2-indent)
-    (`(:after . ":=") (or m2-indent smie-indent-basic))
+    ('(:elem . basic) m2-indent)
+    ('(:after . ":=") (or m2-indent smie-indent-basic))
     (`(:after . ,(or "CONST" "VAR" "TYPE"))
      (or m2-indent smie-indent-basic))
     ;; (`(:before . ,(or `"VAR" `"TYPE" `"CONST"))
     ;;  (if (smie-rule-parent-p "PROCEDURE") 0))
-    (`(:after . ";-block")
+    ('(:after . ";-block")
      (if (smie-rule-parent-p "PROCEDURE")
          (smie-rule-parent (or m2-indent smie-indent-basic))))
-    (`(:before . "|") (smie-rule-separator kind))
+    ('(:before . "|") (smie-rule-separator kind))
     ))
 
 ;;;###autoload
diff --git a/lisp/progmodes/octave.el b/lisp/progmodes/octave.el
index cce5e17..52e5fd4 100644
--- a/lisp/progmodes/octave.el
+++ b/lisp/progmodes/octave.el
@@ -1,6 +1,6 @@
 ;;; octave.el --- editing octave source files under emacs  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Kurt Hornik <address@hidden>
 ;;        John Eaton <address@hidden>
@@ -442,12 +442,12 @@ Non-nil means always go to the next Octave code line 
after sending."
     ;; disadvantages:
     ;; - changes to octave-block-offset wouldn't take effect immediately.
     ;; - edebug wouldn't show the use of this variable.
-    (`(:elem . basic) octave-block-offset)
+    ('(:elem . basic) octave-block-offset)
     (`(:list-intro . ,(or "global" "persistent")) t)
     ;; Since "case" is in the same BNF rules as switch..end, SMIE by default
     ;; aligns it with "switch".
-    (`(:before . "case") (if (not (smie-rule-sibling-p)) octave-block-offset))
-    (`(:after . ";")
+    ('(:before . "case") (if (not (smie-rule-sibling-p)) octave-block-offset))
+    ('(:after . ";")
      (if (apply #'smie-rule-parent-p octave--block-offset-keywords)
          (smie-rule-parent octave-block-offset)
        ;; For (invalid) code between switch and case.
@@ -1652,11 +1652,11 @@ code line."
       ;;
       ;; Return the value according to style.
       (pcase octave-eldoc-message-style
-        (`auto (if (< (length oneline) (window-width (minibuffer-window)))
+        ('auto (if (< (length oneline) (window-width (minibuffer-window)))
                    oneline
                  multiline))
-        (`oneline oneline)
-        (`multiline multiline)))))
+        ('oneline oneline)
+        ('multiline multiline)))))
 
 (defcustom octave-help-buffer "*Octave Help*"
   "Buffer name for `octave-help'."
diff --git a/lisp/progmodes/opascal.el b/lisp/progmodes/opascal.el
index 7d055b7..7d51816 100644
--- a/lisp/progmodes/opascal.el
+++ b/lisp/progmodes/opascal.el
@@ -1,6 +1,6 @@
 ;;; opascal.el --- major mode for editing Object Pascal source in Emacs  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1998-1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Authors: Ray Blaak <address@hidden>,
 ;;          Simon South <address@hidden>
@@ -140,7 +140,7 @@ That is, regardless of where in the line point is at the 
time."
    opascal-directives)
   "OPascal4 keywords.")
 
-(defconst opascal-previous-terminators `(semicolon comma)
+(defconst opascal-previous-terminators '(semicolon comma)
   "Expression/statement terminators that denote a previous expression.")
 
 (defconst opascal-comments
@@ -186,7 +186,7 @@ are followed by an expression.")
   `(except finally ,@opascal-visibilities)
   "Statements that mark mid sections of the enclosing block.")
 
-(defconst opascal-end-block-statements `(end until)
+(defconst opascal-end-block-statements '(end until)
   "Statements that end block sections.")
 
 (defconst opascal-match-block-statements
@@ -210,7 +210,7 @@ are followed by an expression.")
   '(interface implementation program library package)
   "Unit sections within which the indent is 0.")
 
-(defconst opascal-use-clauses `(uses requires exports contains)
+(defconst opascal-use-clauses '(uses requires exports contains)
   "Statements that refer to foreign symbols.")
 
 (defconst opascal-unit-statements
@@ -1519,7 +1519,7 @@ value of `opascal-tab-always-indents' and the current 
line position."
         (setq dir-name (match-string 1 dir-name)
               recurse t))
     ;; Ensure the trailing slash is removed.
-    (if (string-match "^\\(.+\\)[\\\\/]$" dir-name)
+    (if (string-match "^\\(.+\\)[\\/]$" dir-name)
         (setq dir-name (match-string 1 dir-name)))
     (opascal-search-directory unit dir-name recurse)))
 
diff --git a/lisp/progmodes/pascal.el b/lisp/progmodes/pascal.el
index 6d13d32..cae514a 100644
--- a/lisp/progmodes/pascal.el
+++ b/lisp/progmodes/pascal.el
@@ -1,6 +1,6 @@
 ;;; pascal.el --- major mode for editing pascal source in Emacs -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-2019 Free Software Foundation, Inc.
 
 ;; Author: Espen Skoglund <address@hidden>
 ;; Keywords: languages
@@ -117,7 +117,7 @@
 (defconst pascal-beg-block-re   "\\<\\(begin\\|case\\|record\\|repeat\\)\\>")
 (defconst pascal-end-block-re   "\\<\\(end\\|until\\)\\>")
 (defconst pascal-declaration-re "\\<\\(const\\|label\\|type\\|var\\)\\>")
-(defconst pascal-progbeg-re     "\\<\\program\\>")
+(defconst pascal-progbeg-re     "\\<program\\>")
 (defconst pascal-defun-re       "\\<\\(function\\|procedure\\|program\\)\\>")
 (defconst pascal-sub-block-re   "\\<\\(if\\|else\\|for\\|while\\|with\\)\\>")
 (defconst pascal-noindent-re    "\\<\\(begin\\|end\\|until\\|else\\)\\>")
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index a61d1ad..7cbd30a 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -1,6 +1,6 @@
 ;;; perl-mode.el --- Perl code editing commands for GNU Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1990, 1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: William F. Mann
 ;; Maintainer: address@hidden
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index b1a17df..2b05735 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -1,6 +1,6 @@
 ;;; prog-mode.el --- Generic major mode for programming  -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: internal
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index f3f29cb..dabc4ab 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -1,6 +1,6 @@
 ;;; project.el --- Operations on the current project  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -35,7 +35,7 @@
 ;; Infrastructure:
 ;;
 ;; Function `project-current', to determine the current project
-;; instance, and 3 (at the moment) generic functions that act on it.
+;; instance, and 5 (at the moment) generic functions that act on it.
 ;; This list is to be extended in future versions.
 ;;
 ;; Utils:
@@ -45,8 +45,9 @@
 ;;
 ;; Commands:
 ;;
-;; `project-find-regexp' and `project-or-external-find-regexp' use the
-;; current API, and thus will work in any project that has an adapter.
+;; `project-find-file', `project-find-regexp' and
+;; `project-or-external-find-regexp' use the current API, and thus
+;; will work in any project that has an adapter.
 
 ;;; TODO:
 
@@ -54,9 +55,6 @@
 ;;   filenotify.el (if supported) to invalidate.  And avoiding caching
 ;;   if it's not available (manual cache invalidation is not nice).
 ;;
-;; * Allow the backend to override the file-listing logic?  Maybe also
-;;   to delegate file name completion to an external tool.
-;;
 ;; * Build tool related functionality.  Start with a `project-build'
 ;;   command, which should provide completions on tasks to run, and
 ;;   maybe allow entering some additional arguments.  This might
@@ -148,6 +146,8 @@ Patterns can match both regular files and directories.
 To root an entry, start it with `./'.  To match directories only,
 end it with `/'.  DIR must be one of `project-roots' or
 `project-external-roots'."
+  ;; TODO: Document and support regexp ignores as used by Hg.
+  ;; TODO: Support whitelist entries.
   (require 'grep)
   (defvar grep-find-ignored-files)
   (nconc
@@ -162,29 +162,14 @@ end it with `/'.  DIR must be one of `project-roots' or
 DIRS is a list of absolute directories; it should be some
 subset of the project roots and external roots.
 
-The default implementation uses `find-program'.  PROJECT is used
-to find the list of ignores for each directory."
-  ;; FIXME: Uniquely abbreviate the roots?
-  (require 'xref)
-  (let ((all-files
-        (cl-mapcan
-         (lambda (dir)
-           (let ((command
-                  (format "%s %s %s -type f -print0"
-                          find-program
-                           (shell-quote-argument
-                            (expand-file-name dir))
-                          (xref--find-ignores-arguments
-                           (project-ignores project dir)
-                           (expand-file-name dir)))))
-             (split-string (shell-command-to-string command) "\0" t)))
-         dirs)))
+The default implementation delegates to `project-files'."
+  (let ((all-files (project-files project dirs)))
     (lambda (string pred action)
       (cond
        ((eq action 'metadata)
-       '(metadata . ((category . project-file))))
+        '(metadata . ((category . project-file))))
        (t
-       (complete-with-action action all-files string pred))))))
+        (complete-with-action action all-files string pred))))))
 
 (cl-defmethod project-roots ((project (head transient)))
   (list (cdr project)))
@@ -192,14 +177,48 @@ to find the list of ignores for each directory."
 (cl-defgeneric project-files (project &optional dirs)
   "Return a list of files in directories DIRS in PROJECT.
 DIRS is a list of absolute directories; it should be some
-subset of the project roots and external roots."
-  ;; This default implementation only works if project-file-completion-table
-  ;; returns a "flat" completion table.
-  ;; FIXME: Maybe we should do the reverse: implement the default
-  ;; `project-file-completion-table' on top of `project-files'.
-  (all-completions
-   "" (project-file-completion-table
-       project (or dirs (project-roots project)))))
+subset of the project roots and external roots.
+
+The default implementation uses `find-program'.  PROJECT is used
+to find the list of ignores for each directory."
+  (require 'xref)
+  (cl-mapcan
+   (lambda (dir)
+     (project--files-in-directory dir
+                                  (project--dir-ignores project dir)))
+   (or dirs (project-roots project))))
+
+(defun project--files-in-directory (dir ignores &optional files)
+  (require 'find-dired)
+  (defvar find-name-arg)
+  (let ((default-directory dir)
+        (command (format "%s %s %s -type f %s -print0"
+                         find-program
+                         (file-local-name dir)
+                         (xref--find-ignores-arguments
+                          ignores
+                          (expand-file-name dir))
+                         (if files
+                             (concat (shell-quote-argument "(")
+                                     " " find-name-arg " "
+                                     (mapconcat
+                                      #'shell-quote-argument
+                                      (split-string files)
+                                      (concat " -o " find-name-arg " "))
+                                     " "
+                                     (shell-quote-argument ")"))"")
+                         )))
+    (project--remote-file-names
+     (split-string (shell-command-to-string command) "\0" t))))
+
+(defun project--remote-file-names (local-files)
+  "Return LOCAL-FILES as if they were on the system of `default-directory'."
+  (let ((remote-id (file-remote-p default-directory)))
+    (if (not remote-id)
+        local-files
+      (mapcar (lambda (file)
+                (concat remote-id file))
+              local-files))))
 
 (defgroup project-vc nil
   "Project implementation using the VC package."
@@ -276,7 +295,10 @@ backend implementation of `project-external-roots'.")
             entry))
         (vc-call-backend backend 'ignore-completion-table root)))
      (project--value-in-dir 'project-vc-ignores root)
-     (cl-call-next-method))))
+     (mapcar
+      (lambda (dir)
+        (concat dir "/"))
+      vc-directory-exclusion-list))))
 
 (defun project-combine-directories (&rest lists-of-dirs)
   "Return a sorted and culled list of directory names.
@@ -326,11 +348,27 @@ triggers completion when entering a pattern, including it
 requires quoting, e.g. `\\[quoted-insert]<space>'."
   (interactive (list (project--read-regexp)))
   (let* ((pr (project-current t))
-         (dirs (if current-prefix-arg
-                   (list (read-directory-name "Base directory: "
-                                              nil default-directory t))
-                 (project-roots pr))))
-    (project--find-regexp-in dirs regexp pr)))
+         (files
+          (if (not current-prefix-arg)
+              (project-files pr (project-roots pr))
+            (let ((dir (read-directory-name "Base directory: "
+                                            nil default-directory t)))
+              (project--files-in-directory dir
+                                           (project--dir-ignores pr dir)
+                                           (grep-read-files regexp))))))
+    (project--find-regexp-in-files regexp files)))
+
+(defun project--dir-ignores (project dir)
+  (let* ((roots (project-roots project))
+         (root (cl-find dir roots :test #'file-in-directory-p)))
+    (if (not root)
+        (project-ignores nil nil)       ;The defaults.
+      (let ((ignores (project-ignores project root)))
+        (if (file-equal-p root dir)
+            ignores
+          ;; FIXME: Update the "rooted" ignores to relate to DIR instead.
+          (cl-delete-if (lambda (str) (string-prefix-p "./" str))
+                        ignores))))))
 
 ;;;###autoload
 (defun project-or-external-find-regexp (regexp)
@@ -339,29 +377,76 @@ With \\[universal-argument] prefix, you can specify the 
file name
 pattern to search for."
   (interactive (list (project--read-regexp)))
   (let* ((pr (project-current t))
-         (dirs (append
-                (project-roots pr)
-                (project-external-roots pr))))
-    (project--find-regexp-in dirs regexp pr)))
+         (files
+          (project-files pr (append
+                             (project-roots pr)
+                             (project-external-roots pr)))))
+    (project--find-regexp-in-files regexp files)))
+
+(defun project--find-regexp-in-files (regexp files)
+  (pcase-let*
+      ((output (get-buffer-create " *project grep output*"))
+       (`(,grep-re ,file-group ,line-group . ,_) (car grep-regexp-alist))
+       (status nil)
+       (hits nil)
+       (xrefs nil)
+       (command (format "xargs -0 grep %s -nHE %s"
+                        (if (and case-fold-search
+                                 (isearch-no-upper-case-p regexp t))
+                            "-i"
+                          "")
+                        (shell-quote-argument (xref--regexp-to-extended 
regexp)))))
+    (with-current-buffer output
+      (erase-buffer)
+      (with-temp-buffer
+        (insert (mapconcat #'identity files "\0"))
+        (setq status
+              (project--process-file-region (point-min)
+                                            (point-max)
+                                            shell-file-name
+                                            output
+                                            nil
+                                            shell-command-switch
+                                            command)))
+      (goto-char (point-min))
+      (when (and (/= (point-min) (point-max))
+                 (not (looking-at grep-re))
+                 ;; TODO: Show these matches as well somehow?
+                 (not (looking-at "Binary file .* matches")))
+        (user-error "Search failed with status %d: %s" status
+                    (buffer-substring (point-min) (line-end-position))))
+      (while (re-search-forward grep-re nil t)
+        (push (list (string-to-number (match-string line-group))
+                    (match-string file-group)
+                    (buffer-substring-no-properties (point) 
(line-end-position)))
+              hits)))
+    (setq xrefs (xref--convert-hits (nreverse hits) regexp))
+    (unless xrefs
+      (user-error "No matches for: %s" regexp))
+    (xref--show-xrefs xrefs nil)))
+
+(defun project--process-file-region (start end program
+                                     &optional buffer display
+                                     &rest args)
+  ;; FIXME: This branching shouldn't be necessary, but
+  ;; call-process-region *is* measurably faster, even for a program
+  ;; doing some actual work (for a period of time). Even though
+  ;; call-process-region also creates a temp file internally
+  ;; (http://lists.gnu.org/archive/html/emacs-devel/2019-01/msg00211.html).
+  (if (not (file-remote-p default-directory))
+      (apply #'call-process-region
+             start end program nil buffer display args)
+    (let ((infile (make-temp-file "ppfr")))
+      (unwind-protect
+          (progn
+            (write-region start end infile nil 'silent)
+            (apply #'process-file program infile buffer display args))
+        (delete-file infile)))))
 
 (defun project--read-regexp ()
   (let ((id (xref-backend-identifier-at-point (xref-find-backend))))
     (read-regexp "Find regexp" (and id (regexp-quote id)))))
 
-(defun project--find-regexp-in (dirs regexp project)
-  (require 'grep)
-  (let* ((files (if current-prefix-arg
-                    (grep-read-files regexp)
-                  "*"))
-         (xrefs (cl-mapcan
-                 (lambda (dir)
-                   (xref-collect-matches regexp files dir
-                                         (project-ignores project dir)))
-                 dirs)))
-    (unless xrefs
-      (user-error "No matches for: %s" regexp))
-    (xref--show-xrefs xrefs nil)))
-
 ;;;###autoload
 (defun project-find-file ()
   "Visit a file (with completion) in the current project's roots.
@@ -401,48 +486,63 @@ recognized."
   ;; removing it when it has no matches.  Neither seems natural
   ;; enough.  Removal is confusing; early expansion makes the prompt
   ;; too long.
-  (let* (;; (initial-input
-         ;;  (let ((common-prefix (try-completion "" collection)))
-         ;;    (if (> (length common-prefix) 0)
-         ;;        (file-name-directory common-prefix))))
+  (let* ((common-parent-directory
+          (let ((common-prefix (try-completion "" collection)))
+            (if (> (length common-prefix) 0)
+                (file-name-directory common-prefix))))
+         (cpd-length (length common-parent-directory))
+         (prompt (if (zerop cpd-length)
+                     prompt
+                   (concat prompt (format " in %s" common-parent-directory))))
+         ;; XXX: This requires collection to be "flat" as well.
+         (substrings (mapcar (lambda (s) (substring s cpd-length))
+                             (all-completions "" collection)))
+         (new-collection
+          (lambda (string pred action)
+            (cond
+             ((eq action 'metadata)
+              (if (functionp collection) (funcall collection nil nil 
'metadata)))
+             (t
+             (complete-with-action action substrings string pred)))))
          (new-prompt (if default
                          (format "%s (default %s): " prompt default)
                        (format "%s: " prompt)))
          (res (completing-read new-prompt
-                               collection predicate t
+                               new-collection predicate t
                                nil ;; initial-input
                                hist default inherit-input-method)))
-    (if (and (equal res default)
-             (not (test-completion res collection predicate)))
-        (completing-read (format "%s: " prompt)
-                         collection predicate t res hist nil
-                         inherit-input-method)
-      res)))
+    (when (and (equal res default)
+               (not (test-completion res collection predicate)))
+      (setq res
+            (completing-read (format "%s: " prompt)
+                             new-collection predicate t res hist nil
+                             inherit-input-method)))
+    (concat common-parent-directory res)))
 
-(declare-function multifile-continue "multifile" ())
+(declare-function fileloop-continue "fileloop" ())
 
 ;;;###autoload
 (defun project-search (regexp)
   "Search for REGEXP in all the files of the project.
 Stops when a match is found.
-To continue searching for next match, use command \\[multifile-continue]."
+To continue searching for next match, use command \\[fileloop-continue]."
   (interactive "sSearch (regexp): ")
-  (multifile-initialize-search
+  (fileloop-initialize-search
    regexp (project-files (project-current t)) 'default)
-  (multifile-continue))
+  (fileloop-continue))
 
 ;;;###autoload
-(defun project-query-replace (from to)
+(defun project-query-replace-regexp (from to)
   "Search for REGEXP in all the files of the project.
 Stops when a match is found.
-To continue searching for next match, use command \\[multifile-continue]."
+To continue searching for next match, use command \\[fileloop-continue]."
   (interactive
    (pcase-let ((`(,from ,to)
                 (query-replace-read-args "Query replace (regexp)" t t)))
      (list from to)))
-  (multifile-initialize-replace
+  (fileloop-initialize-replace
    from to (project-files (project-current t)) 'default)
-  (multifile-continue))
+  (fileloop-continue))
 
 (provide 'project)
 ;;; project.el ends here
diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el
index b530c61..296a7ac 100644
--- a/lisp/progmodes/prolog.el
+++ b/lisp/progmodes/prolog.el
@@ -1,6 +1,6 @@
 ;;; prolog.el --- major mode for Prolog (and Mercury) -*- lexical-binding:t -*-
 
-;; Copyright (C) 1986-1987, 1997-1999, 2002-2003, 2011-2018 Free
+;; Copyright (C) 1986-1987, 1997-1999, 2002-2003, 2011-2019 Free
 ;; Software Foundation, Inc.
 
 ;; Authors: Emil Åström <emil_astrom(at)hotmail(dot)com>
@@ -942,13 +942,13 @@ This is really kludgy, and unneeded (i.e. obsolete) in 
Emacs>=24."
 
 (defun prolog-smie-rules (kind token)
   (pcase (cons kind token)
-    (`(:elem . basic) prolog-indent-width)
+    ('(:elem . basic) prolog-indent-width)
     ;; The list of arguments can never be on a separate line!
     (`(:list-intro . ,_) t)
     ;; When we don't know how to indent an empty line, assume the most
     ;; likely token will be ";".
-    (`(:elem . empty-line-token) ";")
-    (`(:after . ".") '(column . 0)) ;; To work around smie-closer-alist.
+    ('(:elem . empty-line-token) ";")
+    ('(:after . ".") '(column . 0)) ;; To work around smie-closer-alist.
     ;; Allow indentation of if-then-else as:
     ;;    (   test
     ;;    ->  thenrule
@@ -977,7 +977,7 @@ This is really kludgy, and unneeded (i.e. obsolete) in 
Emacs>=24."
                       (smie-indent-backward-token)
                       (smie-rule-bolp))))
        prolog-indent-width))
-    (`(:after . ";")
+    ('(:after . ";")
      ;; Align with same-line comment as in:
      ;;   ;   %% Toto
      ;;       foo
@@ -989,7 +989,7 @@ This is really kludgy, and unneeded (i.e. obsolete) in 
Emacs>=24."
             ;; Only do it for small offsets, since the comment may actually be
             ;; an "end-of-line" comment at comment-column!
             (if (<= offset prolog-indent-width) offset))))
-    (`(:after . ",")
+    ('(:after . ",")
      ;; Special indent for:
      ;;    foopredicate(x) :- !,
      ;;        toto.
@@ -998,7 +998,7 @@ This is really kludgy, and unneeded (i.e. obsolete) in 
Emacs>=24."
             (smie-indent-backward-token) ;Skip !
             (equal ":-" (car (smie-indent-backward-token))))
           (smie-rule-parent prolog-indent-width)))
-    (`(:after . ":-")
+    ('(:after . ":-")
      (if (bolp)
          (save-excursion
            (smie-indent-forward-token)
@@ -1007,7 +1007,7 @@ This is really kludgy, and unneeded (i.e. obsolete) in 
Emacs>=24."
                prolog-indent-width
              (min prolog-indent-width (current-column))))
        prolog-indent-width))
-    (`(:after . "-->") prolog-indent-width)))
+    ('(:after . "-->") prolog-indent-width)))
 
 
 ;;-------------------------------------------------------------------
@@ -2826,7 +2826,7 @@ STRING should be given if the last search was by 
`string-match' on STRING."
           (progn
             (if (and (eq prolog-system 'mercury)
                      (looking-at
-                      (format ":-[ \t]*\\(pred\\|mode\\)[ \t]+\\(%s+\\)"
+                      (format ":-[ \t]*\\(pred\\|mode\\)[ 
\t]+\\(\\(?:%s\\)+\\)"
                               prolog-atom-regexp)))
                 ;; Skip predicate declarations
                 (progn
@@ -2950,7 +2950,7 @@ objects (relevant only if `prolog-system' is set to 
`sicstus')."
            (predname
             (if (looking-at prolog-atom-char-regexp)
                 (progn
-                  (skip-chars-forward "^ (\\.")
+                  (skip-chars-forward "^ (.")
                   (buffer-substring op (point)))
               ""))
            (arity 0))
diff --git a/lisp/progmodes/ps-mode.el b/lisp/progmodes/ps-mode.el
index 92d673d..d940627 100644
--- a/lisp/progmodes/ps-mode.el
+++ b/lisp/progmodes/ps-mode.el
@@ -1,6 +1,6 @@
 ;;; ps-mode.el --- PostScript mode for GNU Emacs
 
-;; Copyright (C) 1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author:     Peter Kleiweg <address@hidden>
 ;; Maintainer: Peter Kleiweg <address@hidden>
@@ -458,9 +458,9 @@ If nil, use `temporary-file-directory'."
 
 (defun ps-mode-smie-rules (kind token)
   (pcase (cons kind token)
-    (`(:after . "<") (when (smie-rule-next-p "<") 0))
-    (`(:elem . basic) ps-mode-tab)
-    (`(:close-all . ">") t)
+    ('(:after . "<") (when (smie-rule-next-p "<") 0))
+    ('(:elem . basic) ps-mode-tab)
+    ('(:close-all . ">") t)
     (`(:list-intro . ,_) t)))
 
 ;;;###autoload
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index c55b69e..5d0d03d 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1,6 +1,6 @@
 ;;; python.el --- Python's flying circus support for Emacs -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Fabián E. Gallina <address@hidden>
 ;; URL: https://github.com/fgallina/python.el
@@ -342,7 +342,7 @@ It returns a file name which can be used directly as 
argument of
     (substitute-key-definition 'complete-symbol 'completion-at-point
                                map global-map)
     (easy-menu-define python-menu map "Python Mode menu"
-      `("Python"
+      '("Python"
         :help "Python-specific Features"
         ["Shift region left" python-indent-shift-left :active mark-active
          :help "Shift region left by a single indentation step"]
@@ -438,7 +438,7 @@ It returns a file name which can be used directly as 
argument of
                                          (* ?\\ ?\\) (any ?\' ?\")))
                                 (* ?\\ ?\\)
                                 ;; Match single or triple quotes of any kind.
-                                (group (or  "\"" "\"\"\"" "'" "'''")))))
+                                (group (or  "\"\"\"" "\"" "'''" "'")))))
       (coding-cookie . ,(rx line-start ?# (* space)
                             (or
                              ;; # coding=<encoding name>
@@ -469,13 +469,13 @@ This variant of `rx' supports common Python named 
REGEXPS."
 (eval-and-compile
   (defun python-syntax--context-compiler-macro (form type &optional 
syntax-ppss)
     (pcase type
-      (`'comment
+      (''comment
        `(let ((ppss (or ,syntax-ppss (syntax-ppss))))
           (and (nth 4 ppss) (nth 8 ppss))))
-      (`'string
+      (''string
        `(let ((ppss (or ,syntax-ppss (syntax-ppss))))
           (and (nth 3 ppss) (nth 8 ppss))))
-      (`'paren
+      (''paren
        `(nth 1 (or ,syntax-ppss (syntax-ppss))))
       (_ form))))
 
@@ -486,9 +486,9 @@ character address of the specified TYPE."
   (declare (compiler-macro python-syntax--context-compiler-macro))
   (let ((ppss (or syntax-ppss (syntax-ppss))))
     (pcase type
-      (`comment (and (nth 4 ppss) (nth 8 ppss)))
-      (`string (and (nth 3 ppss) (nth 8 ppss)))
-      (`paren (nth 1 ppss))
+      ('comment (and (nth 4 ppss) (nth 8 ppss)))
+      ('string (and (nth 3 ppss) (nth 8 ppss)))
+      ('paren (nth 1 ppss))
       (_ nil))))
 
 (defun python-syntax-context-type (&optional syntax-ppss)
@@ -575,7 +575,7 @@ class declarations.")
            "reload" "unichr" "unicode" "xrange" "apply" "buffer" "coerce"
            "intern"
            ;; Python 3:
-           "ascii" "bytearray" "bytes" "exec"
+           "ascii" "breakpoint" "bytearray" "bytes" "exec"
            ;; Extra:
            "__all__" "__doc__" "__name__" "__package__")
           symbol-end) . font-lock-builtin-face))
@@ -1334,16 +1334,17 @@ the line will be re-indented automatically if needed."
            (not (equal ?: (char-before (1- (point)))))
            (not (python-syntax-comment-or-string-p)))
       ;; Just re-indent dedenters
-      (let ((dedenter-pos (python-info-dedenter-statement-p))
-            (current-pos (point)))
+      (let ((dedenter-pos (python-info-dedenter-statement-p)))
         (when dedenter-pos
-          (save-excursion
-            (goto-char dedenter-pos)
-            (python-indent-line)
-            (unless (= (line-number-at-pos dedenter-pos)
-                       (line-number-at-pos current-pos))
-              ;; Reindent region if this is a multiline statement
-              (python-indent-region dedenter-pos current-pos)))))))))
+          (let ((start (copy-marker dedenter-pos))
+                (end (point-marker)))
+            (save-excursion
+              (goto-char start)
+              (python-indent-line)
+              (unless (= (line-number-at-pos start)
+                         (line-number-at-pos end))
+                ;; Reindent region if this is a multiline statement
+                (python-indent-region start end))))))))))
 
 
 ;;; Mark
@@ -4015,11 +4016,11 @@ JUSTIFY should be used (if applicable) as in 
`fill-paragraph'."
             ;; is NIL means to not add any newlines for start or end
             ;; of docstring.  See `python-fill-docstring-style' for a
             ;; graphic idea of each style.
-            (`django (cons 1 1))
-            (`onetwo (and multi-line-p (cons 1 2)))
-            (`pep-257 (and multi-line-p (cons nil 2)))
-            (`pep-257-nn (and multi-line-p (cons nil 1)))
-            (`symmetric (and multi-line-p (cons 1 1)))))
+            ('django (cons 1 1))
+            ('onetwo (and multi-line-p (cons 1 2)))
+            ('pep-257 (and multi-line-p (cons nil 2)))
+            ('pep-257-nn (and multi-line-p (cons nil 1)))
+            ('symmetric (and multi-line-p (cons 1 1)))))
          (fill-paragraph-function))
     (save-restriction
       (narrow-to-region str-start-pos str-end-pos)
@@ -5252,7 +5253,7 @@ configuration could be:
 By default messages are considered errors."
   :version "26.1"
   :group 'python-flymake
-  :type `(alist :key-type (regexp)
+  :type '(alist :key-type (regexp)
                 :value-type (symbol)))
 
 (defvar-local python--flymake-proc nil)
@@ -5414,7 +5415,7 @@ REPORT-FN is Flymake's callback function."
 
   (add-to-list
    'hs-special-modes-alist
-   `(python-mode
+   '(python-mode
      "\\s-*\\_<\\(?:def\\|class\\)\\_>"
      ;; Use the empty string as end regexp so it doesn't default to
      ;; "\\s)".  This way parens at end of defun are properly hidden.
diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el
index 32130ce..4fceda8 100644
--- a/lisp/progmodes/ruby-mode.el
+++ b/lisp/progmodes/ruby-mode.el
@@ -1,6 +1,6 @@
 ;;; ruby-mode.el --- Major mode for editing Ruby files -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1994-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
 ;; Authors: Yukihiro Matsumoto
 ;;     Nobuyoshi Nakada
@@ -108,7 +108,7 @@
   "Regexp to match the beginning of a heredoc.")
 
   (defconst ruby-expression-expansion-re
-    
"\\(?:[^\\]\\|\\=\\)\\(\\\\\\\\\\)*\\(#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\|\\$[^a-zA-Z
 \n]\\)\\)"))
+    
"\\(?:[^\\]\\|\\=\\)\\(\\\\\\\\\\)*\\(#\\({[^}\n\\]*\\(\\\\.[^}\n\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\|\\$[^a-zA-Z
 \n]\\)\\)"))
 
 (defun ruby-here-doc-end-match ()
   "Return a regexp to find the end of a heredoc.
@@ -217,19 +217,16 @@ This should only be called after matching against 
`ruby-here-doc-beg-re'."
 (defcustom ruby-indent-tabs-mode nil
   "Indentation can insert tabs in Ruby mode if this is non-nil."
   :type 'boolean
-  :group 'ruby
   :safe 'booleanp)
 
 (defcustom ruby-indent-level 2
   "Indentation of Ruby statements."
   :type 'integer
-  :group 'ruby
   :safe 'integerp)
 
 (defcustom ruby-comment-column (default-value 'comment-column)
   "Indentation column of comments."
   :type 'integer
-  :group 'ruby
   :safe 'integerp)
 
 (defconst ruby-alignable-keywords '(if while unless until begin case for def)
@@ -265,7 +262,6 @@ Only has effect when `ruby-use-smie' is t."
                   (choice ,@(mapcar
                              (lambda (kw) (list 'const kw))
                              ruby-alignable-keywords))))
-  :group 'ruby
   :safe 'listp
   :version "24.4")
 
@@ -277,7 +273,6 @@ of its parent.
 
 Only has effect when `ruby-use-smie' is t."
   :type 'boolean
-  :group 'ruby
   :safe 'booleanp
   :version "24.4")
 
@@ -286,7 +281,6 @@ Only has effect when `ruby-use-smie' is t."
 Also ignores spaces after parenthesis when `space'.
 Only has effect when `ruby-use-smie' is nil."
   :type 'boolean
-  :group 'ruby
   :safe 'booleanp)
 
 ;; FIXME Woefully under documented.  What is the point of the last t?.
@@ -301,14 +295,12 @@ Only has effect when `ruby-use-smie' is nil."
                                  (cons character (choice (const nil)
                                                          (const t)))
                                  (const t) ; why?
-                                 )))
-  :group 'ruby)
+                                 ))))
 
 (defcustom ruby-deep-indent-paren-style 'space
   "Default deep indent style.
 Only has effect when `ruby-use-smie' is nil."
-  :type '(choice (const t) (const nil) (const space))
-  :group 'ruby)
+  :type '(choice (const t) (const nil) (const space)))
 
 (defcustom ruby-encoding-map
   '((us-ascii       . nil)       ;; Do not put coding: us-ascii
@@ -318,8 +310,7 @@ Only has effect when `ruby-use-smie' is nil."
   "Alist to map encoding name from Emacs to Ruby.
 Associating an encoding name with nil means it needs not be
 explicitly declared in magic comment."
-  :type '(repeat (cons (symbol :tag "From") (symbol :tag "To")))
-  :group 'ruby)
+  :type '(repeat (cons (symbol :tag "From") (symbol :tag "To"))))
 
 (defcustom ruby-insert-encoding-magic-comment t
   "Insert a magic Ruby encoding comment upon save if this is non-nil.
@@ -336,14 +327,12 @@ even if it's not required."
           (const :tag "Emacs Style" emacs)
           (const :tag "Ruby Style" ruby)
           (const :tag "Custom Style" custom))
-  :group 'ruby
   :version "24.4")
 
 (defcustom ruby-custom-encoding-magic-comment-template "# encoding: %s"
   "A custom encoding comment template.
 It is used when `ruby-encoding-magic-comment-style' is set to `custom'."
   :type 'string
-  :group 'ruby
   :version "24.4")
 
 (defcustom ruby-use-encoding-map t
@@ -528,6 +517,9 @@ It is used when `ruby-encoding-magic-comment-style' is set 
to `custom'."
              ((ruby-smie--opening-pipe-p) "opening-|")
              ((ruby-smie--closing-pipe-p) "closing-|")
              (t tok)))
+           ((string-match "\\`[^|]+|\\'" tok)
+            (forward-char -1)
+            (substring tok 0 -1))
            ((and (equal tok "") (looking-at "\\\\\n"))
             (goto-char (match-end 0)) (ruby-smie--forward-token))
            ((equal tok "do")
@@ -570,6 +562,7 @@ It is used when `ruby-encoding-magic-comment-style' is set 
to `custom'."
            ((ruby-smie--opening-pipe-p) "opening-|")
            ((ruby-smie--closing-pipe-p) "closing-|")
            (t tok)))
+         ((string-match-p "\\`[^|]+|\\'" tok) "closing-|")
          ((string-match-p "\\`|[*&]\\'" tok)
           (forward-char 1)
           (substring tok 1))
@@ -597,12 +590,12 @@ It is used when `ruby-encoding-magic-comment-style' is 
set to `custom'."
 
 (defun ruby-smie-rules (kind token)
   (pcase (cons kind token)
-    (`(:elem . basic) ruby-indent-level)
+    ('(:elem . basic) ruby-indent-level)
     ;; "foo" "bar" is the concatenation of the two strings, so the second
     ;; should be aligned with the first.
-    (`(:elem . args) (if (looking-at "\\s\"") 0))
+    ('(:elem . args) (if (looking-at "\\s\"") 0))
     ;; (`(:after . ",") (smie-rule-separator kind))
-    (`(:before . ";")
+    ('(:before . ";")
      (cond
       ((smie-rule-parent-p "def" "begin" "do" "class" "module" "for"
                            "while" "until" "unless"
@@ -649,12 +642,12 @@ It is used when `ruby-encoding-magic-comment-style' is 
set to `custom'."
        ;; because we want to reject hanging tokens at bol, too.
        (unless (or (eolp) (forward-comment 1))
          (cons 'column (current-column)))))
-    (`(:before . " @ ")
+    ('(:before . " @ ")
      (save-excursion
        (skip-chars-forward " \t")
        (cons 'column (current-column))))
-    (`(:before . "do") (ruby-smie--indent-to-stmt))
-    (`(:before . ".")
+    ('(:before . "do") (ruby-smie--indent-to-stmt))
+    ('(:before . ".")
      (if (smie-rule-sibling-p)
          (and ruby-align-chained-calls 0)
        (smie-backward-sexp ".")
@@ -662,7 +655,7 @@ It is used when `ruby-encoding-magic-comment-style' is set 
to `custom'."
                         ruby-indent-level))))
     (`(:before . ,(or "else" "then" "elsif" "rescue" "ensure"))
      (smie-rule-parent))
-    (`(:before . "when")
+    ('(:before . "when")
      ;; Align to the previous `when', but look up the virtual
      ;; indentation of `case'.
      (if (smie-rule-sibling-p) 0 (smie-rule-parent)))
@@ -679,7 +672,7 @@ It is used when `ruby-encoding-magic-comment-style' is set 
to `custom'."
        (if (ruby-smie--indent-to-stmt-p token)
            (ruby-smie--indent-to-stmt)
          (cons 'column (current-column)))))
-    (`(:before . "iuwu-mod")
+    ('(:before . "iuwu-mod")
      (smie-rule-parent ruby-indent-level))
     ))
 
@@ -741,7 +734,7 @@ It is used when `ruby-encoding-magic-comment-style' is set 
to `custom'."
           (back-to-indentation)
           (narrow-to-region (point) end)
           (smie-forward-sexp))
-      (while (and (setq state (apply 'ruby-parse-partial end state))
+      (while (and (setq state (apply #'ruby-parse-partial end state))
                     (>= (nth 2 state) 0) (< (point) end))))))
 
 (defun ruby-mode-variables ()
@@ -751,7 +744,7 @@ It is used when `ruby-encoding-magic-comment-style' is set 
to `custom'."
       (smie-setup ruby-smie-grammar #'ruby-smie-rules
                   :forward-token  #'ruby-smie--forward-token
                   :backward-token #'ruby-smie--backward-token)
-    (setq-local indent-line-function 'ruby-indent-line))
+    (setq-local indent-line-function #'ruby-indent-line))
   (setq-local comment-start "# ")
   (setq-local comment-end "")
   (setq-local comment-column ruby-comment-column)
@@ -767,9 +760,9 @@ It is used when `ruby-encoding-magic-comment-style' is set 
to `custom'."
 The style of the comment is controlled by `ruby-encoding-magic-comment-style'."
   (let ((encoding-magic-comment-template
          (pcase ruby-encoding-magic-comment-style
-           (`ruby "# coding: %s")
-           (`emacs "# -*- coding: %s -*-")
-           (`custom
+           ('ruby "# coding: %s")
+           ('emacs "# -*- coding: %s -*-")
+           ('custom
             ruby-custom-encoding-magic-comment-template))))
     (insert
      (format encoding-magic-comment-template encoding)
@@ -936,9 +929,9 @@ Can be one of `heredoc', `modifier', `expr-qstr', 
`expr-re'."
                    (goto-char (match-end 0))
                    (not (looking-at "\\s_")))
                   ((eq option 'expr-qstr)
-                   (looking-at "[a-zA-Z][a-zA-z0-9_]* +%[^ \t]"))
+                   (looking-at "[a-zA-Z][a-zA-Z0-9_]* +%[^ \t]"))
                   ((eq option 'expr-re)
-                   (looking-at "[a-zA-Z][a-zA-z0-9_]* +/[^ \t]"))
+                   (looking-at "[a-zA-Z][a-zA-Z0-9_]* +/[^ \t]"))
                   (t nil)))))))))
 
 (defun ruby-forward-string (term &optional end no-error expand)
@@ -986,6 +979,7 @@ delimiter."
         ((eq c ?\( ) ruby-deep-arglist)))
 
 (defun ruby-parse-partial (&optional end in-string nest depth pcol indent)
+  ;; FIXME: Document why we can't just use parse-partial-sexp.
   "TODO: document throughout function body."
   (or depth (setq depth 0))
   (or indent (setq indent 0))
@@ -1053,7 +1047,7 @@ delimiter."
        ((looking-at "\\?")              ;skip ?char
         (cond
          ((and (ruby-expr-beg)
-               (looking-at "?\\(\\\\C-\\|\\\\M-\\)*\\\\?."))
+               (looking-at "\\?\\(\\\\C-\\|\\\\M-\\)*\\\\?."))
           (goto-char (match-end 0)))
          (t
           (goto-char pnt))))
@@ -1160,7 +1154,7 @@ delimiter."
                  (state (list in-string nest depth pcol indent)))
             ;; parse the rest of the line
             (while (and (> line-end-position (point))
-                        (setq state (apply 'ruby-parse-partial
+                        (setq state (apply #'ruby-parse-partial
                                            line-end-position state))))
             (setq in-string (car state)
                   nest (nth 1 state)
@@ -1197,7 +1191,7 @@ delimiter."
       (save-restriction
         (narrow-to-region (point) end)
         (while (and (> end (point))
-                    (setq state (apply 'ruby-parse-partial end state))))))
+                    (setq state (apply #'ruby-parse-partial end state))))))
     (list (nth 0 state)                 ; in-string
           (car (nth 1 state))           ; nest
           (nth 2 state)                 ; depth
@@ -1496,7 +1490,7 @@ With ARG, do it many times.  Negative ARG means move 
backward."
             (cond ((looking-at "\\?\\(\\\\[CM]-\\)*\\\\?\\S ")
                    (goto-char (match-end 0)))
                   ((progn
-                     (skip-chars-forward ",.:;|&^~=!?\\+\\-\\*")
+                     (skip-chars-forward "-,.:;|&^~=!?+*")
                      (looking-at "\\s("))
                    (goto-char (scan-sexps (point) 1)))
                   ((and (looking-at (concat "\\<\\(" ruby-block-beg-re
@@ -1539,7 +1533,7 @@ With ARG, do it many times.  Negative ARG means move 
forward."
     (let ((i (or arg 1)))
       (condition-case nil
           (while (> i 0)
-            (skip-chars-backward " \t\n,.:;|&^~=!?\\+\\-\\*")
+            (skip-chars-backward "- \t\n,.:;|&^~=!?+*")
             (forward-char -1)
             (cond ((looking-at "\\s)")
                    (goto-char (scan-sexps (1+ (point)) -1))
@@ -1552,7 +1546,7 @@ With ARG, do it many times.  Negative ARG means move 
forward."
                   ((looking-at "\\s\"\\|\\\\\\S_")
                    (let ((c (char-to-string (char-before (match-end 0)))))
                      (while (and (search-backward c)
-                                (eq (logand (skip-chars-backward "\\") 1)
+                                (eq (logand (skip-chars-backward "\\\\") 1)
                                     1))))
                    nil)
                   ((looking-at "\\s.\\|\\s\\")
@@ -1620,7 +1614,7 @@ See `add-log-current-defun-function'."
                   (concat "^[ \t]*" re "[ \t]+"
                           "\\("
                           ;; \\. and :: for class methods
-                          "\\([A-Za-z_]" ruby-symbol-re "*\\|\\.\\|::" "\\)"
+                          "\\([A-Za-z_]" ruby-symbol-re "*[?!]?\\|\\.\\|::" 
"\\)"
                           "+\\)")))
                (definition-re (funcall make-definition-re ruby-defun-beg-re))
                (module-re (funcall make-definition-re "\\(class\\|module\\)")))
@@ -1800,8 +1794,8 @@ If the result is do-end block, it will always be 
multiline."
             (buffer-substring-no-properties (1+ min) (1- max))))
       (setq content
             (if (equal string-quote "'")
-                (replace-regexp-in-string "\\\\\"" "\"" 
(replace-regexp-in-string "\\(\\`\\|[^\\\\]\\)'" "\\1\\\\'" content))
-              (replace-regexp-in-string "\\\\'" "'" (replace-regexp-in-string 
"\\(\\`\\|[^\\\\]\\)\"" "\\1\\\\\"" content))))
+                (replace-regexp-in-string "\\\\\"" "\"" 
(replace-regexp-in-string "\\(\\`\\|[^\\]\\)'" "\\1\\\\'" content))
+              (replace-regexp-in-string "\\\\'" "'" (replace-regexp-in-string 
"\\(\\`\\|[^\\]\\)\"" "\\1\\\\\"" content))))
       (let ((orig-point (point)))
         (delete-region min max)
         (insert
@@ -1873,7 +1867,7 @@ It will be properly highlighted even when the call omits 
parens.")
       ("^[ \t]*def +\\(`\\)" (1 "_"))
       ;; Ternary operator colon followed by opening paren or bracket
       ;; (semi-important for indentation).
-      ("\\(:\\)\\(?:[\({]\\|\\[[^]]\\)"
+      ("\\(:\\)\\(?:[({]\\|\\[[^]]\\)"
        (1 (string-to-syntax ".")))
       ;; Regular expressions.  Start with matching unescaped slash.
       ("\\(?:\\=\\|[^\\]\\)\\(?:\\\\\\\\\\)*\\(/\\)"
@@ -2034,13 +2028,6 @@ It will be properly highlighted even when the call omits 
parens.")
                  context)))
         t)))
 
-(defvar ruby-font-lock-syntax-table
-  (let ((tbl (make-syntax-table ruby-mode-syntax-table)))
-    (modify-syntax-entry ?_ "w" tbl)
-    tbl)
-  "The syntax table to use for fontifying Ruby mode buffers.
-See `font-lock-syntax-table'.")
-
 (defconst ruby-font-lock-keyword-beg-re 
"\\(?:^\\|address@hidden:]\\|\\.\\.\\)")
 
 (defconst ruby-font-lock-keywords
@@ -2191,7 +2178,7 @@ See `font-lock-syntax-table'.")
           font-lock-constant-face)
         nil t))
     ;; Special globals.
-    (,(concat "\\$\\(?:[:\"!@;,/\\._><\\$?~=*&`'+0-9]\\|-[0adFiIlpvw]\\|"
+    (,(concat "\\$\\(?:[:\"!@;,/._><\\$?~=*&`'+0-9]\\|-[0adFiIlpvw]\\|"
               (regexp-opt '("LOAD_PATH" "LOADED_FEATURES" "PROGRAM_NAME"
                             "ERROR_INFO" "ERROR_POSITION"
                             "FS" "FIELD_SEPARATOR"
@@ -2219,7 +2206,8 @@ See `font-lock-syntax-table'.")
     ;; Conversion methods on Kernel.
     (,(concat ruby-font-lock-keyword-beg-re
               (regexp-opt '("Array" "Complex" "Float" "Hash"
-                            "Integer" "Rational" "String") 'symbols))
+                            "Integer" "Rational" "String")
+                          'symbols))
      (1 font-lock-builtin-face))
     ;; Expression expansion.
     (ruby-match-expression-expansion
@@ -2300,7 +2288,7 @@ See `font-lock-syntax-table'.")
         :command command
         :sentinel
         (lambda (proc _event)
-          (when (eq 'exit (process-status proc))
+          (when (and (eq 'exit (process-status proc)) (buffer-live-p source))
             (unwind-protect
                 (if (with-current-buffer source (eq proc ruby--flymake-proc))
                     (with-current-buffer (process-buffer proc)
@@ -2313,17 +2301,18 @@ See `font-lock-syntax-table'.")
 
 (defcustom ruby-flymake-use-rubocop-if-available t
   "Non-nil to use the RuboCop Flymake backend.
-Only takes effect if RuboCop is installed."
+Only takes effect if RuboCop is installed.
+
+If there is no Rubocop config file, Rubocop will be passed a flag
+'--lint' to only show syntax errors and important problems."
   :version "26.1"
   :type 'boolean
-  :group 'ruby
   :safe 'booleanp)
 
 (defcustom ruby-rubocop-config ".rubocop.yml"
   "Configuration file for `ruby-flymake-rubocop'."
   :version "26.1"
   :type 'string
-  :group 'ruby
   :safe 'stringp)
 
 (defun ruby-flymake-rubocop (report-fn &rest _args)
@@ -2334,14 +2323,21 @@ Only takes effect if RuboCop is installed."
   (let ((command (list "rubocop" "--stdin" buffer-file-name "--format" "emacs"
                        "--cache" "false" ; Work around a bug in old version.
                        "--display-cop-names"))
+        (default-directory default-directory)
         config-dir)
     (when buffer-file-name
       (setq config-dir (locate-dominating-file buffer-file-name
                                                ruby-rubocop-config))
-      (when config-dir
+      (if (not config-dir)
+          (setq command (append command '("--lint")))
         (setq command (append command (list "--config"
                                             (expand-file-name 
ruby-rubocop-config
-                                                              config-dir)))))
+                                                              config-dir))))
+        (when (ruby-flymake-rubocop--use-bundler-p config-dir)
+          (setq command (append '("bundle" "exec") command))
+          ;; In case of a project with multiple nested subprojects,
+          ;; each one with a Gemfile.
+          (setq default-directory config-dir)))
 
       (ruby-flymake--helper
        "rubocop-flymake"
@@ -2379,6 +2375,13 @@ Only takes effect if RuboCop is installed."
           into diags
           finally (funcall report-fn diags)))))))
 
+(defun ruby-flymake-rubocop--use-bundler-p (dir)
+  (let ((file (expand-file-name "Gemfile" dir)))
+    (and (file-exists-p file)
+         (with-temp-buffer
+           (insert-file-contents file)
+           (re-search-forward "^ *gem ['\"]rubocop['\"]" nil t)))))
+
 (defun ruby-flymake-auto (report-fn &rest args)
   (apply
    (if (and ruby-flymake-use-rubocop-if-available
@@ -2393,18 +2396,17 @@ Only takes effect if RuboCop is installed."
   "Major mode for editing Ruby code."
   (ruby-mode-variables)
 
-  (setq-local imenu-create-index-function 'ruby-imenu-create-index)
-  (setq-local add-log-current-defun-function 'ruby-add-log-current-method)
-  (setq-local beginning-of-defun-function 'ruby-beginning-of-defun)
-  (setq-local end-of-defun-function 'ruby-end-of-defun)
+  (setq-local imenu-create-index-function #'ruby-imenu-create-index)
+  (setq-local add-log-current-defun-function #'ruby-add-log-current-method)
+  (setq-local beginning-of-defun-function #'ruby-beginning-of-defun)
+  (setq-local end-of-defun-function #'ruby-end-of-defun)
 
-  (add-hook 'after-save-hook 'ruby-mode-set-encoding nil 'local)
-  (add-hook 'electric-indent-functions 'ruby--electric-indent-p nil 'local)
-  (add-hook 'flymake-diagnostic-functions 'ruby-flymake-auto nil 'local)
+  (add-hook 'after-save-hook #'ruby-mode-set-encoding nil 'local)
+  (add-hook 'electric-indent-functions #'ruby--electric-indent-p nil 'local)
+  (add-hook 'flymake-diagnostic-functions #'ruby-flymake-auto nil 'local)
 
-  (setq-local font-lock-defaults '((ruby-font-lock-keywords) nil nil))
-  (setq-local font-lock-keywords ruby-font-lock-keywords)
-  (setq-local font-lock-syntax-table ruby-font-lock-syntax-table)
+  (setq-local font-lock-defaults '((ruby-font-lock-keywords) nil nil
+                                   ((?_ . "w"))))
 
   (setq-local syntax-propertize-function #'ruby-syntax-propertize))
 
diff --git a/lisp/progmodes/scheme.el b/lisp/progmodes/scheme.el
index c2be0b3..507a4c7 100644
--- a/lisp/progmodes/scheme.el
+++ b/lisp/progmodes/scheme.el
@@ -1,6 +1,6 @@
 ;;; scheme.el --- Scheme (and DSSSL) editing mode    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1986-1988, 1997-1998, 2001-2018 Free Software
+;; Copyright (C) 1986-1988, 1997-1998, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Bill Rozas <address@hidden>
@@ -433,7 +433,7 @@ that variable's value is a string."
               ;; (make-regexp '("case" "cond" "else" "if" "lambda"
               ;; "let" "let*" "letrec" "and" "or" "map" "with-mode"))
               "and\\|c\\(ase\\|ond\\)\\|else\\|if\\|"
-              "l\\(ambda\\|et\\(\\|*\\|rec\\)\\)\\|map\\|or\\|with-mode"
+              "l\\(ambda\\|et\\(\\|\\*\\|rec\\)\\)\\|map\\|or\\|with-mode"
               "\\)\\>")
       1)
      ;; DSSSL syntax
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 46c9e6e..dd3a6fa 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1,6 +1,6 @@
 ;;; sh-script.el --- shell-script editing commands for Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1993-1997, 1999, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1993-1997, 1999, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Daniel Pfeiffer <address@hidden>
@@ -345,7 +345,7 @@ naming the shell."
   :group 'sh-script)
 
 (defcustom sh-imenu-generic-expression
-  `((sh
+  '((sh
      . ((nil
         ;; function FOO
         ;; function FOO()
@@ -1022,7 +1022,7 @@ subshells can nest."
         ;; unescape " inside a $( ... ) construct.
         (pcase (char-after)
           (?\' (pcase state
-                 (`double-quote nil)
+                 ('double-quote nil)
                  (_ (forward-char 1)
                     ;; FIXME: mark skipped double quotes as punctuation syntax.
                     (let ((spos (point)))
@@ -1035,12 +1035,12 @@ subshells can nest."
                                             'syntax-table '(1)))))))))
           (?\\ (forward-char 1))
           (?\" (pcase state
-                 (`double-quote (setq state (pop states)))
+                 ('double-quote (setq state (pop states)))
                  (_ (push state states) (setq state 'double-quote)))
                (if state (put-text-property (point) (1+ (point))
                                             'syntax-table '(1))))
           (?\` (pcase state
-                 (`backquote (setq state (pop states)))
+                 ('backquote (setq state (pop states)))
                  (_ (push state states) (setq state 'backquote))))
           (?\$ (if (not (eq (char-after (1+ (point))) ?\())
                    nil
@@ -1048,10 +1048,10 @@ subshells can nest."
                  (pcase state
                    (_ (push state states) (setq state 'code)))))
           (?\( (pcase state
-                 (`double-quote nil)
+                 ('double-quote nil)
                  (_ (push state states) (setq state 'code))))
           (?\) (pcase state
-                 (`double-quote nil)
+                 ('double-quote nil)
                  (_ (setq state (pop states)))))
           (_ (error "Internal error in sh-font-lock-quoted-subshell")))
         (forward-char 1))
@@ -1601,7 +1601,7 @@ with your script for an edit-interpret-debug cycle."
   (setq-local comint-prompt-regexp "^[ \t]*")
   (setq-local imenu-case-fold-search nil)
   (setq font-lock-defaults
-       `((sh-font-lock-keywords
+       '((sh-font-lock-keywords
           sh-font-lock-keywords-1 sh-font-lock-keywords-2)
          nil nil
          ((?/ . "w") (?~ . "w") (?. . "w") (?- . "w") (?_ . "w")) nil
@@ -2035,8 +2035,8 @@ May return nil if the line should not be treated as 
continued."
 
 (defun sh-smie-sh-rules (kind token)
   (pcase (cons kind token)
-    (`(:elem . basic) sh-basic-offset)
-    (`(:after . "case-)") (- (sh-var-value 'sh-indent-for-case-alt)
+    ('(:elem . basic) sh-basic-offset)
+    ('(:after . "case-)") (- (sh-var-value 'sh-indent-for-case-alt)
                              (sh-var-value 'sh-indent-for-case-label)))
     (`(:before . ,(or "(" "{" "[" "while" "if" "for" "case"))
      (if (not (smie-rule-prev-p "&&" "||" "|"))
@@ -2069,17 +2069,17 @@ May return nil if the line should not be treated as 
continued."
                       (smie-indent-virtual)))))
 
     ;; Attempt at backward compatibility with the old config variables.
-    (`(:before . "fi") (sh-var-value 'sh-indent-for-fi))
-    (`(:before . "done") (sh-var-value 'sh-indent-for-done))
-    (`(:after . "else") (sh-var-value 'sh-indent-after-else))
-    (`(:after . "if") (sh-var-value 'sh-indent-after-if))
-    (`(:before . "then") (sh-var-value 'sh-indent-for-then))
-    (`(:before . "do") (sh-var-value 'sh-indent-for-do))
-    (`(:after . "do")
+    ('(:before . "fi") (sh-var-value 'sh-indent-for-fi))
+    ('(:before . "done") (sh-var-value 'sh-indent-for-done))
+    ('(:after . "else") (sh-var-value 'sh-indent-after-else))
+    ('(:after . "if") (sh-var-value 'sh-indent-after-if))
+    ('(:before . "then") (sh-var-value 'sh-indent-for-then))
+    ('(:before . "do") (sh-var-value 'sh-indent-for-do))
+    ('(:after . "do")
      (sh-var-value (if (smie-rule-hanging-p)
                        'sh-indent-after-loop-construct 'sh-indent-after-do)))
     ;; sh-indent-after-done: aligned completely differently.
-    (`(:after . "in") (sh-var-value 'sh-indent-for-case-label))
+    ('(:after . "in") (sh-var-value 'sh-indent-for-case-label))
     ;; sh-indent-for-continuation: Line continuations are handled differently.
     (`(:after . ,(or "(" "{" "["))
      (if (not (looking-at ".[ \t]*[^\n \t#]"))
@@ -2244,12 +2244,12 @@ Point should be before the newline."
 
 (defun sh-smie-rc-rules (kind token)
   (pcase (cons kind token)
-    (`(:elem . basic) sh-basic-offset)
+    ('(:elem . basic) sh-basic-offset)
     ;; (`(:after . "case") (or sh-basic-offset smie-indent-basic))
-    (`(:after . ";")
+    ('(:after . ";")
      (if (smie-rule-parent-p "case")
          (smie-rule-parent (sh-var-value 'sh-indent-after-case))))
-    (`(:before . "{")
+    ('(:before . "{")
      (save-excursion
        (when (sh-smie--rc-after-special-arg-p)
          `(column . ,(current-column)))))
diff --git a/lisp/progmodes/simula.el b/lisp/progmodes/simula.el
index 39d35cf..3bbf4e0 100644
--- a/lisp/progmodes/simula.el
+++ b/lisp/progmodes/simula.el
@@ -1,6 +1,6 @@
 ;;; simula.el --- SIMULA 87 code editing commands for Emacs
 
-;; Copyright (C) 1992, 1994, 1996, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1992, 1994, 1996, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Hans Henrik Eriksen <address@hidden>
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 1cdae35..4ab174d 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -1,6 +1,6 @@
 ;;; sql.el --- specialized comint.el for SQL interpreters  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Alex Schroeder <address@hidden>
 ;; Maintainer: Michael Mauger <address@hidden>
@@ -237,6 +237,7 @@
 (require 'custom)
 (require 'thingatpt)
 (require 'view)
+(eval-when-compile (require 'subr-x))   ; string-empty-p
 
 (defvar font-lock-keyword-face)
 (defvar font-lock-set-defaults)
@@ -738,16 +739,131 @@ The package must be available to be loaded and 
activated."
   :type 'booleanp
   :version "27.1")
 
-(defun sql-is-indent-available ()
-  "Check if sql-indent module is available."
-  (when (locate-library "sql-indent")
-    (fboundp 'sqlind-minor-mode)))
-
 (defun sql-indent-enable ()
   "Enable `sqlind-minor-mode' if available and requested."
-  (when (sql-is-indent-available)
+  (when (fboundp 'sqlind-minor-mode)
     (sqlind-minor-mode (if sql-use-indent-support +1 -1))))
 
+;; Secure Password wallet
+
+(require 'auth-source)
+
+(defun sql-auth-source-search-wallet (wallet product user server database port)
+    "Read auth source WALLET to locate the USER secret.
+Sets `auth-sources' to WALLET and uses `auth-source-search' to locate the 
entry.
+The DATABASE and SERVER are concatenated with a slash between them as the
+host key."
+    (let* ((auth-sources wallet)
+           host
+           secret h-secret sd-secret)
+
+      ;; product
+      (setq product (symbol-name product))
+
+      ;; user
+      (setq user (unless (string-empty-p user) user))
+
+      ;; port
+      (setq port
+            (when (and port (numberp port) (not (zerop port)))
+              (number-to-string port)))
+
+      ;; server
+      (setq server (unless (string-empty-p server) server))
+
+      ;; database
+      (setq database (unless (string-empty-p database) database))
+
+      ;; host
+      (setq host (if server
+                     (if database
+                         (concat server "/" database)
+                       server)
+                   database))
+
+      ;; Perform search
+      (dolist (s (auth-source-search :max 1000))
+        (when (and
+               ;; Is PRODUCT specified, in the enty, and they are equal
+               (if product
+                   (if (plist-member s :product)
+                       (equal (plist-get s :product) product)
+                     t)
+                 t)
+               ;; Is USER specified, in the entry, and they are equal
+               (if user
+                   (if (plist-member s :user)
+                       (equal (plist-get s :user) user)
+                     t)
+                 t)
+               ;; Is PORT specified, in the entry, and they are equal
+               (if port
+                   (if (plist-member s :port)
+                       (equal (plist-get s :port) port)
+                     t)
+                 t))
+          ;; Is HOST specified, in the entry, and they are equal
+          ;; then the H-SECRET list
+          (if (and host
+                   (plist-member s :host)
+                   (equal (plist-get s :host) host))
+              (push s h-secret)
+            ;; Are SERVER and DATABASE specified, present, and equal
+            ;; then the SD-SECRET list
+            (if (and server
+                     (plist-member s :server)
+                     database
+                     (plist-member s :database)
+                     (equal (plist-get s :server) server)
+                     (equal (plist-get s :database) database))
+                (push s sd-secret)
+              ;; Is SERVER specified, in the entry, and they are equal
+              ;; then the base SECRET list
+              (if (and server
+                       (plist-member s :server)
+                       (equal (plist-get s :server) server))
+                  (push s secret)
+                ;; Is DATABASE specified, in the entry, and they are equal
+                ;; then the base SECRET list
+                (if (and database
+                         (plist-member s :database)
+                         (equal (plist-get s :database) database))
+                    (push s secret)))))))
+      (setq secret (or h-secret sd-secret secret))
+
+      ;; If we found a single secret, return the password
+      (when (= 1 (length secret))
+        (setq secret (car secret))
+        (if (plist-member secret :secret)
+            (plist-get secret :secret)
+          nil))))
+
+(defcustom sql-password-wallet
+  (let (wallet w)
+    (dolist (ext '(".json.gpg" ".gpg" ".json" "") wallet)
+      (unless wallet
+        (setq w (locate-user-emacs-file (concat "sql-wallet" ext)
+                                        (concat ".sql-wallet" ext)))
+        (when (file-exists-p w)
+          (setq wallet w)))))
+  "Identification of the password wallet.
+See `sql-password-search-wallet-function' to understand how this value
+is used to locate the password wallet."
+  :type `(plist-get (symbol-plist 'auth-sources) 'custom-type)
+  :group 'SQL
+  :version "27.1")
+
+(defvar sql-password-search-wallet-function #'sql-auth-source-search-wallet
+  "Function to handle the lookup of the database password.
+The specified function will be called as:
+  (wallet-func WALLET PRODUCT USER SERVER DATABASE PORT)
+
+It is expected to return either a string containing the password,
+a function returning the password, or nil, If you want to support
+another format of password file, then implement a different
+search wallet function and identify the location of the password
+store with `sql-password-wallet'.")
+
 ;; misc customization of sql.el behavior
 
 (defcustom sql-electric-stuff nil
@@ -804,7 +920,7 @@ Globally should be set to nil; it will be non-nil in 
`sql-mode',
 
 (defvaralias 'sql-pop-to-buffer-after-send-region 
'sql-display-sqli-buffer-function)
 
-(defcustom sql-display-sqli-buffer-function 'display-buffer
+(defcustom sql-display-sqli-buffer-function #'display-buffer
   "Function to be called to display a SQLi buffer after `sql-send-*'.
 
 When set to a function, it will be called to display the buffer.
@@ -2609,7 +2725,7 @@ highlighting rules in SQL mode.")
              nil 'require-match
              init 'sql-product-history init))))
 
-(defun sql-add-product (product display &rest plist)
+(defun sql-add-product (product display &optional plist)
   "Add support for a database product in `sql-mode'.
 
 Add PRODUCT to `sql-product-alist' which enables `sql-mode' to
@@ -2666,15 +2782,38 @@ list.  See `sql-add-product' to add new products.  The 
FEATURE
 argument must be a plist keyword accepted by
 `sql-product-alist'."
 
-  (let* ((p (assoc product sql-product-alist))
-         (v (plist-get (cdr p) feature)))
+  (let* ((p (assoc product sql-product-alist))  ;; (PRODUCT :f v ...)
+         (v (plist-member (cdr p) feature)))    ;; (:FEATURE value ...) or null
+
     (if p
-        (if (and
-             (member feature sql-indirect-features)
-             (symbolp v))
-            (set v newvalue)
-          (setcdr p (plist-put (cdr p) feature newvalue)))
-      (error "`%s' is not a known product; use `sql-add-product' to add it 
first." product))))
+        (if (member feature sql-indirect-features) ; is indirect
+            (if v
+                (if (car (cdr v))
+                    (if (symbolp (car (cdr v)))
+                        ;; Indirect reference
+                        (set (car (cdr v)) newvalue)
+                      ;; indirect is not a symbol
+                      (error "The value of `%s' for `%s' is not a symbol" 
feature product))
+                  ;; keyword present, set the indirect variable name
+                  (if (symbolp newvalue)
+                      (if (cdr v)
+                          (setf (car (cdr v)) newvalue)
+                        (setf (cdr v) (list newvalue)))
+                    (error "The indirect variable of `%s' for `%s' must be a 
symbol" feature product)))
+              ;; not present; insert list
+              (setq v (list feature newvalue))
+              (setf (cdr (cdr v)) (cdr p))
+              (setf (cdr p) v))
+          ;; Not an indirect feature
+          (if v
+              (if (cdr v)
+                  (setf (car (cdr v)) newvalue)
+                (setf (cdr v) (list newvalue)))
+            ;; no value; insert into the list
+            (setq v (list feature newvalue))
+            (setf (cdr (cdr v)) (cdr p))
+            (setf (cdr p) v)))
+      (error "`%s' is not a known product; use `sql-add-product' to add it 
first" product))))
 
 (defun sql-get-product-feature (product feature &optional fallback 
not-indirect)
   "Lookup FEATURE associated with a SQL PRODUCT.
@@ -2702,7 +2841,7 @@ See `sql-product-alist' for a list of products and 
supported features."
                (member feature sql-indirect-features)
                (not not-indirect)
                (symbolp v))
-              (symbol-value v)
+              (eval v)
             v))
       (error "`%s' is not a known product; use `sql-add-product' to add it 
first." product)
       nil)))
@@ -2925,7 +3064,7 @@ displayed."
 ;;; Motion Functions
 
 (defun sql-statement-regexp (prod)
-  (let* ((ansi-stmt (sql-get-product-feature 'ansi :statement))
+  (let* ((ansi-stmt (or (sql-get-product-feature 'ansi :statement) "select"))
          (prod-stmt (sql-get-product-feature prod  :statement)))
     (concat "^\\<"
             (if prod-stmt
@@ -2966,7 +3105,7 @@ displayed."
 (defun sql-end-of-statement (arg)
   "Move to the end of the current SQL statement."
   (interactive "p")
-  (let ((term (sql-get-product-feature sql-product :terminator))
+  (let ((term (or (sql-get-product-feature sql-product :terminator) ";"))
         (re-search (if (> 0 arg) 're-search-backward 're-search-forward))
         (here (point))
         (n 0))
@@ -3086,11 +3225,11 @@ appended to the SQLi buffer without disturbing your SQL 
buffer.")
   "Return a docstring for `sql-help' listing loaded SQL products."
   (let ((doc sql--help-docstring))
     ;; Insert FREE software list
-    (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]FREE\\s-*$" doc 0)
+    (when (string-match "^\\(\\s-*\\)[\\][\\]FREE\\s-*$" doc 0)
       (setq doc (replace-match (sql-help-list-products (match-string 1 doc) t)
                               t t doc 0)))
     ;; Insert non-FREE software list
-    (when (string-match "^\\(\\s-*\\)[\\\\][\\\\]NONFREE\\s-*$" doc 0)
+    (when (string-match "^\\(\\s-*\\)[\\][\\]NONFREE\\s-*$" doc 0)
       (setq doc (replace-match (sql-help-list-products (match-string 1 doc) 
nil)
                               t t doc 0)))
     doc))
@@ -3195,6 +3334,10 @@ symbol `password', for the server if it contains the 
symbol
 `database'.  The members of WHAT are processed in the order in
 which they are provided.
 
+If the `sql-password-wallet' is non-nil and WHAT contains the
+`password' token, then the `password' token will be pushed to the
+end to be sure that all of the values can be fed to the wallet.
+
 Each token may also be a list with the token in the car and a
 plist of options as the cdr.  The following properties are
 supported:
@@ -3206,24 +3349,45 @@ supported:
 
 In order to ask the user for username, password and database, call the
 function like this: (sql-get-login \\='user \\='password \\='database)."
+
+  ;; Push the password to the end if we have a wallet
+  (when (and sql-password-wallet
+             (fboundp sql-password-search-wallet-function)
+             (member 'password what))
+    (setq what (append (cl-delete 'password what)
+                       '(password))))
+
+  ;; Prompt for each parameter
   (dolist (w what)
     (let ((plist (cdr-safe w)))
       (pcase (or (car-safe w) w)
-        (`user
+        ('user
          (sql-get-login-ext 'sql-user "User: " 'sql-user-history plist))
 
-        (`password
+        ('password
          (setq-default sql-password
-                       (read-passwd "Password: " nil (sql-default-value 
'sql-password))))
-
-        (`server
+                       (if (and sql-password-wallet
+                                (fboundp sql-password-search-wallet-function))
+                           (let ((password (funcall 
sql-password-search-wallet-function
+                                                    sql-password-wallet
+                                                    sql-product
+                                                    sql-user
+                                                    sql-server
+                                                    sql-database
+                                                    sql-port)))
+                             (if password
+                                 password
+                               (read-passwd "Password: " nil 
(sql-default-value 'sql-password))))
+                         (read-passwd "Password: " nil (sql-default-value 
'sql-password)))))
+
+        ('server
          (sql-get-login-ext 'sql-server "Server: " 'sql-server-history plist))
 
-        (`database
+        ('database
          (sql-get-login-ext 'sql-database "Database: "
                             'sql-database-history plist))
 
-        (`port
+        ('port
          (sql-get-login-ext 'sql-port "Port: "
                             nil (append '(:number t) plist)))))))
 
@@ -3332,20 +3496,20 @@ server/database name."
                           (sql-get-product-feature (or product sql-product) 
:sqli-login)
                           (lambda (token plist)
                               (pcase token
-                                (`user
+                                ('user
                                  (unless (string= "" sql-user)
                                    (list "/" sql-user)))
-                                (`port
+                                ('port
                                  (unless (or (not (numberp sql-port))
                                              (= 0 sql-port))
                                    (list ":" (number-to-string sql-port))))
-                                (`server
+                                ('server
                                  (unless (string= "" sql-server)
                                    (list "."
                                          (if (plist-member plist :file)
                                              (file-name-nondirectory 
sql-server)
                                            sql-server))))
-                                (`database
+                                ('database
                                  (unless (string= "" sql-database)
                                    (list "@"
                                          (if (plist-member plist :file)
@@ -3531,8 +3695,8 @@ Allows the suppression of continuation prompts.")
 
     ;; Count how many newlines in the string
     (setq sql-output-newline-count
-          (apply #'+ (mapcar (lambda (ch)
-                                (if (eq ch ?\n) 1 0)) string)))
+          (apply #'+ (mapcar (lambda (ch) (if (eq ch ?\n) 1 0))
+                             string)))
 
     ;; Send the string
     (comint-simple-send proc string)))
@@ -4082,7 +4246,7 @@ must tell Emacs.  Here's how to do that in your init file:
   ;; Set syntax and font-face highlighting
   ;; Catch changes to sql-product and highlight accordingly
   (sql-set-product (or sql-product 'ansi)) ; Fixes bug#13591
-  (add-hook 'hack-local-variables-hook 'sql-highlight-product t t))
+  (add-hook 'hack-local-variables-hook #'sql-highlight-product t t))
 
 
 
@@ -4090,7 +4254,7 @@ must tell Emacs.  Here's how to do that in your init file:
 
 (put 'sql-interactive-mode 'mode-class 'special)
 (put 'sql-interactive-mode 'custom-mode-group 'SQL)
-
+;; FIXME: Why not use `define-derived-mode'?
 (defun sql-interactive-mode ()
   "Major mode to use a SQL interpreter interactively.
 
@@ -4152,13 +4316,15 @@ certain length.
 
 \(add-hook \\='sql-interactive-mode-hook
     (function (lambda ()
-        (setq comint-output-filter-functions \\='comint-truncate-buffer))))
+        (setq comint-output-filter-functions #\\='comint-truncate-buffer))))
 
 Here is another example.  It will always put point back to the statement
 you entered, right above the output it created.
 
 \(setq comint-output-filter-functions
        (function (lambda (STR) (comint-show-output))))"
+  ;; FIXME: The doc above uses `setq' on `comint-output-filter-functions',
+  ;; whereas hooks should be manipulated with things like `add/remove-hook'.
   (delay-mode-hooks (comint-mode))
 
   ;; Get the `sql-product' for this interactive session.
@@ -4189,7 +4355,8 @@ you entered, right above the output it created.
   (setq local-abbrev-table sql-mode-abbrev-table)
   (setq abbrev-all-caps 1)
   ;; Exiting the process will call sql-stop.
-  (set-process-sentinel (get-buffer-process (current-buffer)) 'sql-stop)
+  (let ((proc (get-buffer-process (current-buffer))))
+    (when proc (set-process-sentinel proc #'sql-stop)))
   ;; Save the connection and login params
   (set (make-local-variable 'sql-user)       sql-user)
   (set (make-local-variable 'sql-database)   sql-database)
@@ -4207,7 +4374,7 @@ you entered, right above the output it created.
        (sql-make-alternate-buffer-name))
   ;; User stuff.  Initialize before the hook.
   (set (make-local-variable 'sql-prompt-regexp)
-       (sql-get-product-feature sql-product :prompt-regexp))
+       (or (sql-get-product-feature sql-product :prompt-regexp) "^"))
   (set (make-local-variable 'sql-prompt-length)
        (sql-get-product-feature sql-product :prompt-length))
   (set (make-local-variable 'sql-prompt-cont-regexp)
@@ -4215,7 +4382,7 @@ you entered, right above the output it created.
   (make-local-variable 'sql-output-newline-count)
   (make-local-variable 'sql-preoutput-hold)
   (add-hook 'comint-preoutput-filter-functions
-            'sql-interactive-remove-continuation-prompt nil t)
+            #'sql-interactive-remove-continuation-prompt nil t)
   (make-local-variable 'sql-input-ring-separator)
   (make-local-variable 'sql-input-ring-file-name)
   ;; Run the mode hook (along with comint's hooks).
@@ -4226,7 +4393,7 @@ you entered, right above the output it created.
             (concat "\\(" sql-prompt-regexp
                     "\\|" sql-prompt-cont-regexp "\\)")
           sql-prompt-regexp))
-  (setq left-margin sql-prompt-length)
+  (setq left-margin (or sql-prompt-length 0))
   ;; Install input sender
   (set (make-local-variable 'comint-input-sender) 'sql-input-sender)
   ;; People wanting a different history file for each
@@ -4264,8 +4431,7 @@ Sentinels will always get the two parameters PROCESS and 
EVENT."
   "Read a connection name."
   (let ((completion-ignore-case t))
     (completing-read prompt
-                     (mapcar (lambda (c) (car c))
-                             sql-connection-alist)
+                     (mapcar #'car sql-connection-alist)
                      nil t initial 'sql-connection-history default)))
 
 ;;;###autoload
@@ -4314,11 +4480,11 @@ is specified in the connection settings."
                       (mapcar
                        (lambda (v)
                          (pcase (car v)
-                           (`sql-user     'user)
-                           (`sql-password 'password)
-                           (`sql-server   'server)
-                           (`sql-database 'database)
-                           (`sql-port     'port)
+                           ('sql-user     'user)
+                           ('sql-password 'password)
+                           ('sql-server   'server)
+                           ('sql-database 'database)
+                           ('sql-port     'port)
                            (s             s)))
                        connect-set))
 
@@ -4382,11 +4548,11 @@ optionally is saved to the user's init file."
                        `(product ,@login)
                        (lambda (token _plist)
                            (pcase token
-                             (`product  `(sql-product  ',product))
-                             (`user     `(sql-user     ,user))
-                             (`database `(sql-database ,database))
-                             (`server   `(sql-server   ,server))
-                             (`port     `(sql-port     ,port)))))))
+                             ('product  `(sql-product  ',product))
+                             ('user     `(sql-user     ,user))
+                             ('database `(sql-database ,database))
+                             ('server   `(sql-server   ,server))
+                             ('port     `(sql-port     ,port)))))))
 
           (setq alist (append alist (list connect)))
 
@@ -4476,6 +4642,10 @@ the call to \\[sql-product-interactive] with
                                     (or sql-default-directory
                                         default-directory)))
 
+                ;; The password wallet returns a function which supplies the 
password.
+                (when (functionp sql-password)
+                  (setq sql-password (funcall sql-password)))
+
                 ;; Call the COMINT service
                 (funcall (sql-get-product-feature product :sqli-comint-func)
                          product
@@ -4518,7 +4688,8 @@ the call to \\[sql-product-interactive] with
               (let ((proc (get-buffer-process new-sqli-buffer))
                     (secs sql-login-delay)
                     (step 0.3))
-                (while (and (memq (process-status proc) '(open run))
+                (while (and proc
+                            (memq (process-status proc) '(open run))
                             (or (accept-process-output proc step)
                                 (<= 0.0 (setq secs (- secs step))))
                             (progn (goto-char (point-max))
@@ -5222,8 +5393,7 @@ The default comes from `process-coding-system-alist' and
 your might try undecided-dos as a coding system.  If this doesn't help,
 Try to set `comint-output-filter-functions' like this:
 
-\(setq comint-output-filter-functions (append comint-output-filter-functions
-                                            \\='(comint-strip-ctrl-m)))
+\(add-hook 'comint-output-filter-functions #\\='comint-strip-ctrl-m 'append)
 
 \(Type \\[describe-mode] in the SQL buffer for a list of commands.)"
   (interactive "P")
diff --git a/lisp/progmodes/subword.el b/lisp/progmodes/subword.el
index 685e171..58a266c 100644
--- a/lisp/progmodes/subword.el
+++ b/lisp/progmodes/subword.el
@@ -1,6 +1,6 @@
 ;;; subword.el --- Handling capitalized subwords in a nomenclature -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Masatake YAMATO
 
@@ -145,8 +145,6 @@ Optional argument ARG is the same as for `forward-word'."
    (t
     (point))))
 
-(put 'subword-forward 'CUA 'move)
-
 (defun subword-backward (&optional arg)
   "Do the same as `backward-word' but on subwords.
 See the command `subword-mode' for a description of subwords.
@@ -187,8 +185,6 @@ Optional argument ARG is the same as for `mark-word'."
            (point))
          nil t))))
 
-(put 'subword-backward 'CUA 'move)
-
 (defun subword-kill (arg)
   "Do the same as `kill-word' but on subwords.
 See the command `subword-mode' for a description of subwords.
diff --git a/lisp/progmodes/tcl.el b/lisp/progmodes/tcl.el
index 586d8cc..ffb3d41 100644
--- a/lisp/progmodes/tcl.el
+++ b/lisp/progmodes/tcl.el
@@ -1,6 +1,6 @@
 ;;; tcl.el --- Tcl code editing commands for Emacs
 
-;; Copyright (C) 1994, 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1998-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Tom Tromey <address@hidden>
diff --git a/lisp/progmodes/vera-mode.el b/lisp/progmodes/vera-mode.el
index 6c40dc7..a03556e 100644
--- a/lisp/progmodes/vera-mode.el
+++ b/lisp/progmodes/vera-mode.el
@@ -1,6 +1,6 @@
 ;;; vera-mode.el --- major mode for editing Vera files
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author:      Reto Zimmermann <address@hidden>
 ;; Maintainer:  Reto Zimmermann <address@hidden>
diff --git a/lisp/progmodes/verilog-mode.el b/lisp/progmodes/verilog-mode.el
index 6657761..f55cf00 100644
--- a/lisp/progmodes/verilog-mode.el
+++ b/lisp/progmodes/verilog-mode.el
@@ -1,6 +1,6 @@
 ;;; verilog-mode.el --- major mode for editing verilog source in Emacs
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael McNamara <address@hidden>
 ;;    Wilson Snyder <address@hidden>
@@ -108,7 +108,6 @@
 ;;         verilog-minimum-comment-distance 40
 ;;         verilog-indent-begin-after-if    t
 ;;         verilog-auto-lineup              'declarations
-;;         verilog-highlight-p1800-keywords nil
 ;;         verilog-linter                   "my_lint_shell_command"
 ;;         )
 
@@ -122,7 +121,7 @@
 ;;
 
 ;; This variable will always hold the version number of the mode
-(defconst verilog-mode-version "2017-08-07-c085e50-vpo-GNU"
+(defconst verilog-mode-version "2019-03-05-39b4dac-vpo-GNU"
   "Version of this Verilog mode.")
 (defconst verilog-mode-release-emacs t
   "If non-nil, this version of Verilog mode was released with Emacs itself.")
@@ -238,7 +237,7 @@ STRING should be given if the last search was by 
`string-match' on STRING."
   (unless (featurep 'xemacs)
     (unless (fboundp 'region-active-p)
       (defmacro region-active-p ()
-       `(and transient-mark-mode mark-active))))
+       '(and transient-mark-mode mark-active))))
   )
 
 ;; Provide a regular expression optimization routine, using regexp-opt
@@ -250,7 +249,7 @@ STRING should be given if the last search was by 
`string-match' on STRING."
       (if (fboundp 'regexp-opt)
           ;; regexp-opt is defined, does it take 3 or 2 arguments?
           (if (fboundp 'function-max-args)
-              (let ((args (function-max-args `regexp-opt)))
+              (let ((args (function-max-args 'regexp-opt)))
                 (cond
                  ((eq args 3)  ; It takes 3
                   (condition-case nil  ; Hide this defun from emacses
@@ -382,7 +381,7 @@ wherever possible, since it is slow."
        ((vectorp menu)
         (let ((i 0) (out []))
           (while (< i (length menu))
-            (if (equal `:help (aref menu i))
+            (if (equal :help (aref menu i))
                 (setq i (+ 2 i))
               (setq out (vconcat out (vector (aref menu i)))
                     i (1+ i))))
@@ -719,15 +718,13 @@ default avoids too many redundant comments in tight 
quarters."
 (put 'verilog-minimum-comment-distance 'safe-local-variable 'integerp)
 
 (defcustom verilog-highlight-p1800-keywords nil
-  "Non-nil means highlight words newly reserved by IEEE-1800.
-These will appear in `verilog-font-lock-p1800-face' in order to gently
-suggest changing where these words are used as variables to something else.
-A nil value means highlight these words as appropriate for the SystemVerilog
-IEEE-1800 standard.  Note that changing this will require restarting Emacs
-to see the effect as font color choices are cached by Emacs."
+  "Obsolete.
+Was non-nil means highlight SystemVerilog IEEE-1800 differently.
+All code is now highlighted as if SystemVerilog IEEE-1800."
   :group 'verilog-mode-indent
   :type 'boolean)
 (put 'verilog-highlight-p1800-keywords 'safe-local-variable 'verilog-booleanp)
+(make-obsolete-variable 'verilog-highlight-p1800-keywords nil "27.1")
 
 (defcustom verilog-highlight-grouping-keywords nil
   "Non-nil means highlight grouping keywords more dramatically.
@@ -1070,6 +1067,18 @@ of each Verilog file that requires it, rather than being 
set globally."
   :type 'boolean)
 (put 'verilog-auto-sense-defines-constant 'safe-local-variable 
'verilog-booleanp)
 
+(defcustom verilog-auto-simplify-expressions t
+  "Non-nil means AUTOs will simplify expressions when calculating bit ranges.
+When nil, do not simply ranges, which may simplify the output,
+but may cause problems when there are multiple instantiations
+outputting to the same wire.  To maintain compatibility with
+other sites, this should be set at the bottom of each Verilog
+file that requires it, rather than being set globally."
+  :version "27.1"
+  :group 'verilog-mode-auto
+  :type 'boolean)
+(put 'verilog-auto-simplify-expressions 'safe-local-variable 'verilog-booleanp)
+
 (defcustom verilog-auto-reset-blocking-in-non t
   "Non-nil means AUTORESET will reset blocking statements.
 When true, AUTORESET will reset in blocking statements those
@@ -1389,7 +1398,7 @@ See also `verilog-case-fold'."
     ("*Variables*"  
"^\\s-*\\(reg\\|wire\\|logic\\)\\s-+\\(\\|\\[[^]]+\\]\\s-+\\)\\([A-Za-z0-9_]+\\)"
 3)
     ("*Classes*"    
"^\\s-*\\(?:\\(?:virtual\\|interface\\)\\s-+\\)?class\\s-+\\([A-Za-z_][A-Za-z0-9_]+\\)"
 1)
     ("*Tasks*"      
"^\\s-*\\(?:\\(?:static\\|pure\\|virtual\\|local\\|protected\\)\\s-+\\)*task\\s-+\\(?:\\(?:static\\|automatic\\)\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_:]+\\)"
 1)
-    ("*Functions*"  
"^\\s-*\\(?:\\(?:static\\|pure\\|virtual\\|local\\|protected\\)\\s-+\\)*function\\s-+\\(?:\\(?:static\\|automatic\\)\\s-+\\)?\\(?:\\w+\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_:]+\\)"
 1)
+    ("*Functions*"  
"^\\s-*\\(?:\\(?:static\\|pure\\|virtual\\|local\\|protected\\)\\s-+\\)*function\\s-+\\(?:\\(?:static\\|automatic\\)\\s-+\\)?\\(?:\\w+\\s-+\\)?\\(?:\\(?:un\\)signed\\s-+\\)?\\([A-Za-z_][A-Za-z0-9_:]+\\)"
 1)
     ("*Interfaces*" "^\\s-*interface\\s-+\\([a-zA-Z_0-9]+\\)" 1)
     ("*Types*"      "^\\s-*typedef\\s-+.*\\s-+\\([a-zA-Z_0-9]+\\)\\s-*;" 1))
   "Imenu expression for Verilog mode.  See `imenu-generic-expression'.")
@@ -1432,7 +1441,7 @@ If set will become buffer local.")
       (define-key map [(meta delete)] 'kill-word))
     (define-key map "\M-\C-b"  'electric-verilog-backward-sexp)
     (define-key map "\M-\C-f"  'electric-verilog-forward-sexp)
-    (define-key map "\M-\r"    `electric-verilog-terminate-and-indent)
+    (define-key map "\M-\r"    'electric-verilog-terminate-and-indent)
     (define-key map "\M-\t"    (if (fboundp 'completion-at-point)
                                    'completion-at-point 
'verilog-complete-word))
     (define-key map "\M-?"     (if (fboundp 'completion-help-at-point)
@@ -1481,35 +1490,35 @@ If set will become buffer local.")
         (setq verilog-tool 'verilog-linter)
         (verilog-set-compile-command))
        :style radio
-       :selected (equal verilog-tool `verilog-linter)
+       :selected (equal verilog-tool 'verilog-linter)
        :help "When invoking compilation, use lint checker"]
       ["Coverage"
        (progn
         (setq verilog-tool 'verilog-coverage)
         (verilog-set-compile-command))
        :style radio
-       :selected (equal verilog-tool `verilog-coverage)
+       :selected (equal verilog-tool 'verilog-coverage)
        :help "When invoking compilation, annotate for coverage"]
       ["Simulator"
        (progn
         (setq verilog-tool 'verilog-simulator)
         (verilog-set-compile-command))
        :style radio
-       :selected (equal verilog-tool `verilog-simulator)
+       :selected (equal verilog-tool 'verilog-simulator)
        :help "When invoking compilation, interpret Verilog source"]
       ["Compiler"
        (progn
         (setq verilog-tool 'verilog-compiler)
         (verilog-set-compile-command))
        :style radio
-       :selected (equal verilog-tool `verilog-compiler)
+       :selected (equal verilog-tool 'verilog-compiler)
        :help "When invoking compilation, compile Verilog source"]
       ["Preprocessor"
        (progn
         (setq verilog-tool 'verilog-preprocessor)
         (verilog-set-compile-command))
        :style radio
-       :selected (equal verilog-tool `verilog-preprocessor)
+       :selected (equal verilog-tool 'verilog-preprocessor)
        :help "When invoking compilation, preprocess Verilog source, see also 
`verilog-preprocess'"]
       )
      ("Move"
@@ -1728,29 +1737,29 @@ If set will become buffer local.")
  :enable-function (lambda () (not (verilog-in-comment-or-string-p))))
 (verilog-define-abbrev verilog-mode-abbrev-table "class" "" 
'verilog-sk-ovm-class)
 (verilog-define-abbrev verilog-mode-abbrev-table "always" "" 
'verilog-sk-always)
-(verilog-define-abbrev verilog-mode-abbrev-table "begin" nil `verilog-sk-begin)
-(verilog-define-abbrev verilog-mode-abbrev-table "case" "" `verilog-sk-case)
-(verilog-define-abbrev verilog-mode-abbrev-table "for" "" `verilog-sk-for)
-(verilog-define-abbrev verilog-mode-abbrev-table "generate" "" 
`verilog-sk-generate)
-(verilog-define-abbrev verilog-mode-abbrev-table "initial" "" 
`verilog-sk-initial)
-(verilog-define-abbrev verilog-mode-abbrev-table "fork" "" `verilog-sk-fork)
-(verilog-define-abbrev verilog-mode-abbrev-table "module" "" 
`verilog-sk-module)
-(verilog-define-abbrev verilog-mode-abbrev-table "primitive" "" 
`verilog-sk-primitive)
-(verilog-define-abbrev verilog-mode-abbrev-table "repeat" "" 
`verilog-sk-repeat)
-(verilog-define-abbrev verilog-mode-abbrev-table "specify" "" 
`verilog-sk-specify)
-(verilog-define-abbrev verilog-mode-abbrev-table "task" "" `verilog-sk-task)
-(verilog-define-abbrev verilog-mode-abbrev-table "while" "" `verilog-sk-while)
-(verilog-define-abbrev verilog-mode-abbrev-table "casex" "" `verilog-sk-casex)
-(verilog-define-abbrev verilog-mode-abbrev-table "casez" "" `verilog-sk-casez)
-(verilog-define-abbrev verilog-mode-abbrev-table "if" "" `verilog-sk-if)
-(verilog-define-abbrev verilog-mode-abbrev-table "else if" "" 
`verilog-sk-else-if)
-(verilog-define-abbrev verilog-mode-abbrev-table "assign" "" 
`verilog-sk-assign)
-(verilog-define-abbrev verilog-mode-abbrev-table "function" "" 
`verilog-sk-function)
-(verilog-define-abbrev verilog-mode-abbrev-table "input" "" `verilog-sk-input)
-(verilog-define-abbrev verilog-mode-abbrev-table "output" "" 
`verilog-sk-output)
-(verilog-define-abbrev verilog-mode-abbrev-table "inout" "" `verilog-sk-inout)
-(verilog-define-abbrev verilog-mode-abbrev-table "wire" "" `verilog-sk-wire)
-(verilog-define-abbrev verilog-mode-abbrev-table "reg" "" `verilog-sk-reg)
+(verilog-define-abbrev verilog-mode-abbrev-table "begin" nil 'verilog-sk-begin)
+(verilog-define-abbrev verilog-mode-abbrev-table "case" "" 'verilog-sk-case)
+(verilog-define-abbrev verilog-mode-abbrev-table "for" "" 'verilog-sk-for)
+(verilog-define-abbrev verilog-mode-abbrev-table "generate" "" 
'verilog-sk-generate)
+(verilog-define-abbrev verilog-mode-abbrev-table "initial" "" 
'verilog-sk-initial)
+(verilog-define-abbrev verilog-mode-abbrev-table "fork" "" 'verilog-sk-fork)
+(verilog-define-abbrev verilog-mode-abbrev-table "module" "" 
'verilog-sk-module)
+(verilog-define-abbrev verilog-mode-abbrev-table "primitive" "" 
'verilog-sk-primitive)
+(verilog-define-abbrev verilog-mode-abbrev-table "repeat" "" 
'verilog-sk-repeat)
+(verilog-define-abbrev verilog-mode-abbrev-table "specify" "" 
'verilog-sk-specify)
+(verilog-define-abbrev verilog-mode-abbrev-table "task" "" 'verilog-sk-task)
+(verilog-define-abbrev verilog-mode-abbrev-table "while" "" 'verilog-sk-while)
+(verilog-define-abbrev verilog-mode-abbrev-table "casex" "" 'verilog-sk-casex)
+(verilog-define-abbrev verilog-mode-abbrev-table "casez" "" 'verilog-sk-casez)
+(verilog-define-abbrev verilog-mode-abbrev-table "if" "" 'verilog-sk-if)
+(verilog-define-abbrev verilog-mode-abbrev-table "else if" "" 
'verilog-sk-else-if)
+(verilog-define-abbrev verilog-mode-abbrev-table "assign" "" 
'verilog-sk-assign)
+(verilog-define-abbrev verilog-mode-abbrev-table "function" "" 
'verilog-sk-function)
+(verilog-define-abbrev verilog-mode-abbrev-table "input" "" 'verilog-sk-input)
+(verilog-define-abbrev verilog-mode-abbrev-table "output" "" 
'verilog-sk-output)
+(verilog-define-abbrev verilog-mode-abbrev-table "inout" "" 'verilog-sk-inout)
+(verilog-define-abbrev verilog-mode-abbrev-table "wire" "" 'verilog-sk-wire)
+(verilog-define-abbrev verilog-mode-abbrev-table "reg" "" 'verilog-sk-reg)
 
 ;;
 ;;  Macros
@@ -2044,7 +2053,7 @@ find the errors."
       "`resetall" "`timescale" "`unconnected_drive" "`undef" "`undefineall"
       ;; compiler directives not covered by IEEE 1800
       "`case" "`default" "`endfor" "`endprotect" "`endswitch" "`endwhile" 
"`for"
-      "`format" "`if" "`let" "`protect" "`switch" "`timescale" "`time_scale"
+      "`format" "`if" "`let" "`protect" "`switch" "`time_scale"
       "`while"
       ))
   "List of Verilog compiler directives.")
@@ -2402,12 +2411,10 @@ find the errors."
 (defconst verilog-assignment-operator-re
   (eval-when-compile
     (verilog-regexp-opt
-     `(
+     '(
        ;; blocking assignment_operator
        "=" "+=" "-=" "*=" "/=" "%=" "&=" "|=" "^=" "<<=" ">>=" "<<<=" ">>>="
-       ;; non blocking assignment operator
-       "<="
-       ;; comparison
+       ;; comparison (also nonblocking assignment "<=")
        "==" "!=" "===" "!==" "<=" ">=" "==?" "!=?" "<->"
        ;; event_trigger
        "->" "->>"
@@ -2478,7 +2485,7 @@ find the errors."
          verilog-directive-re "\\)\\|\\("
          (eval-when-compile
            (verilog-regexp-words
-            `( "begin"
+            '( "begin"
                "else"
                "end"
                "endcase"
@@ -2531,7 +2538,7 @@ find the errors."
   (eval-when-compile
     (verilog-regexp-words
 
-     `("end"      ; closes begin
+     '("end"      ; closes begin
        "endcase"  ; closes any of case, casex casez or randcase
        "join" "join_any" "join_none"  ; closes fork
        "endclass"
@@ -2601,7 +2608,7 @@ find the errors."
 (defconst verilog-beg-block-re
   (eval-when-compile
     (verilog-regexp-words
-     `("begin"
+     '("begin"
        "case" "casex" "casez" "randcase"
        "clocking"
        "generate"
@@ -2677,7 +2684,7 @@ find the errors."
 (defconst verilog-nameable-item-re
   (eval-when-compile
     (verilog-regexp-words
-     `("begin"
+     '("begin"
        "fork"
        "join" "join_any" "join_none"
        "end"
@@ -2704,12 +2711,12 @@ find the errors."
 (defconst verilog-declaration-opener
   (eval-when-compile
     (verilog-regexp-words
-     `("module" "begin" "task" "function"))))
+     '("module" "begin" "task" "function"))))
 
 (defconst verilog-declaration-prefix-re
   (eval-when-compile
     (verilog-regexp-words
-     `(
+     '(
        ;; port direction
        "inout" "input" "output" "ref"
        ;; changeableness
@@ -2718,11 +2725,13 @@ find the errors."
        "localparam" "parameter" "var"
        ;; type creation
        "typedef"
+       ;; randomness
+       "rand"
        ))))
 (defconst verilog-declaration-core-re
   (eval-when-compile
     (verilog-regexp-words
-     `(
+     '(
        ;; port direction (by themselves)
        "inout" "input" "output"
        ;; integer_atom_type
@@ -2764,25 +2773,25 @@ find the errors."
 (defconst verilog-declaration-re-1-no-macro (concat "^" 
verilog-declaration-re-2-no-macro))
 
 (defconst verilog-defun-re
-  (eval-when-compile (verilog-regexp-words `("macromodule" "module" "class" 
"program" "interface" "package" "primitive" "config"))))
+  (eval-when-compile (verilog-regexp-words '("macromodule" "module" "class" 
"program" "interface" "package" "primitive" "config"))))
 (defconst verilog-end-defun-re
-  (eval-when-compile (verilog-regexp-words `("endmodule" "endclass" 
"endprogram" "endinterface" "endpackage" "endprimitive" "endconfig"))))
+  (eval-when-compile (verilog-regexp-words '("endmodule" "endclass" 
"endprogram" "endinterface" "endpackage" "endprimitive" "endconfig"))))
 (defconst verilog-zero-indent-re
   (concat verilog-defun-re "\\|" verilog-end-defun-re))
 (defconst verilog-inst-comment-re
-  (eval-when-compile (verilog-regexp-words `("Outputs" "Inouts" "Inputs" 
"Interfaces" "Interfaced"))))
+  (eval-when-compile (verilog-regexp-words '("Outputs" "Inouts" "Inputs" 
"Interfaces" "Interfaced"))))
 
 (defconst verilog-behavioral-block-beg-re
-  (eval-when-compile (verilog-regexp-words `("initial" "final" "always" 
"always_comb" "always_latch" "always_ff"
-                                            "function" "task"))))
-(defconst verilog-coverpoint-re 
"\\w+\\s*:\\s*\\(coverpoint\\|cross\\constraint\\)"  )
+  (eval-when-compile (verilog-regexp-words '("initial" "final" "always" 
"always_comb" "always_latch" "always_ff"
+                                             "function" "task"))))
+(defconst verilog-coverpoint-re 
"\\w+\\s-*:\\s-*\\(coverpoint\\|cross\\|constraint\\)")
 (defconst verilog-in-constraint-re  ; keywords legal in constraint blocks 
starting a statement/block
-  (eval-when-compile (verilog-regexp-words `("if" "else" "solve" "foreach"))))
+  (eval-when-compile (verilog-regexp-words '("if" "else" "solve" "foreach"))))
 
 (defconst verilog-indent-re
   (eval-when-compile
     (verilog-regexp-words
-     `(
+     '(
        "{"
        "always" "always_latch" "always_ff" "always_comb"
        "begin" "end"
@@ -2866,28 +2875,28 @@ find the errors."
 (defconst verilog-defun-level-not-generate-re
   (eval-when-compile
     (verilog-regexp-words
-     `( "module" "macromodule" "primitive" "class" "program"
-       "interface" "package" "config"))))
+     '( "module" "macromodule" "primitive" "class" "program"
+        "interface" "package" "config"))))
 
 (defconst verilog-defun-level-re
   (eval-when-compile
     (verilog-regexp-words
      (append
-      `( "module" "macromodule" "primitive" "class" "program"
-        "interface" "package" "config")
-      `( "initial" "final" "always" "always_comb" "always_ff"
-        "always_latch" "endtask" "endfunction" )))))
+      '( "module" "macromodule" "primitive" "class" "program"
+         "interface" "package" "config")
+      '( "initial" "final" "always" "always_comb" "always_ff"
+         "always_latch" "endtask" "endfunction" )))))
 
 (defconst verilog-defun-level-generate-only-re
   (eval-when-compile
     (verilog-regexp-words
-     `( "initial" "final" "always" "always_comb" "always_ff"
-       "always_latch" "endtask" "endfunction" ))))
+     '( "initial" "final" "always" "always_comb" "always_ff"
+        "always_latch" "endtask" "endfunction" ))))
 
 (defconst verilog-cpp-level-re
   (eval-when-compile
     (verilog-regexp-words
-     `(
+     '(
        "endmodule" "endprimitive" "endinterface" "endpackage" "endprogram" 
"endclass"
        ))))
 
@@ -2908,7 +2917,7 @@ find the errors."
 (defconst verilog-basic-complete-re
   (eval-when-compile
     (verilog-regexp-words
-     `(
+     '(
        "always" "assign" "always_latch" "always_ff" "always_comb" "constraint"
        "import" "initial" "final" "module" "macromodule" "repeat" "randcase" 
"while"
        "if" "for" "forever" "foreach" "else" "parameter" "do" "localparam" 
"assert"
@@ -2937,7 +2946,7 @@ find the errors."
      ;; single words
      "\\(?:"
      (verilog-regexp-words
-      `("`__FILE__"
+      '("`__FILE__"
        "`__LINE__"
        "`celldefine"
        "`else"
@@ -2962,7 +2971,7 @@ find the errors."
      "\\<\\(`pragma\\)\\>\\s-+.+$"
      "\\)\\|\\(?:"
      ;; `timescale time_unit / time_precision
-     
"\\<\\(`timescale\\)\\>\\s-+10\\{0,2\\}\\s-*[munpf]?s\\s-*\\/\\s-*10\\{0,2\\}\\s-*[munpf]?s"
+     
"\\<\\(`timescale\\)\\>\\s-+10\\{0,2\\}\\s-*[munpf]?s\\s-*/\\s-*10\\{0,2\\}\\s-*[munpf]?s"
      "\\)\\|\\(?:"
      ;; `define and `if can span multiple lines if line ends in '\'. NOTE: `if 
is not IEEE 1800-2012
      ;; from http://www.emacswiki.org/emacs/MultilineRegexp
@@ -3096,7 +3105,7 @@ See also `verilog-font-lock-extra-types'.")
 
 (defvar verilog-font-lock-p1800-face
   'verilog-font-lock-p1800-face
-  "Font to use for p1800 keywords.")
+  "Obsolete font to use for p1800 keywords.")
 (defface verilog-font-lock-p1800-face
   '((((class color)
       (background light))
@@ -3107,6 +3116,7 @@ See also `verilog-font-lock-extra-types'.")
     (t (:italic t)))
   "Font lock mode face used to highlight P1800 keywords."
   :group 'font-lock-highlighting-faces)
+(make-obsolete-variable 'verilog-font-lock-p1800-face nil "27.1")
 
 (defvar verilog-font-lock-ams-face
   'verilog-font-lock-ams-face
@@ -3137,133 +3147,110 @@ See also `verilog-font-lock-extra-types'.")
   :group 'font-lock-highlighting-faces)
 
 (let* ((verilog-type-font-keywords
-       (eval-when-compile
-         (verilog-regexp-opt
-          '(
-            "and" "bit" "buf" "bufif0" "bufif1" "cmos" "defparam"
-            "event" "genvar" "inout" "input" "integer" "localparam"
-            "logic" "mailbox" "nand" "nmos" "nor" "not" "notif0" "notif1" "or"
-            "output" "parameter" "pmos" "pull0" "pull1" "pulldown" "pullup"
-            "rcmos" "real" "realtime" "reg" "rnmos" "rpmos" "rtran"
-            "rtranif0" "rtranif1" "semaphore" "signed" "struct" "supply"
-            "supply0" "supply1" "time" "tran" "tranif0" "tranif1"
-            "tri" "tri0" "tri1" "triand" "trior" "trireg" "typedef"
-            "uwire" "vectored" "wand" "wire" "wor" "xnor" "xor"
-            ) nil  )))
+        (eval-when-compile
+          (verilog-regexp-opt
+           '("and" "buf" "bufif0" "bufif1" "cmos" "defparam" "event"
+             "genvar" "highz0" "highz1" "inout" "input" "integer"
+             "localparam" "mailbox" "nand" "nmos" "nor" "not" "notif0"
+             "notif1" "or" "output" "parameter" "pmos" "pull0" "pull1"
+             "pulldown" "pullup" "rcmos" "real" "realtime" "reg" "rnmos"
+             "rpmos" "rtran" "rtranif0" "rtranif1" "semaphore" "signed"
+             "specparam" "strong0" "strong1" "supply" "supply0" "supply1"
+             "time" "tran" "tranif0" "tranif1" "tri" "tri0" "tri1" "triand"
+             "trior" "trireg" "unsigned" "uwire" "vectored" "wand" "weak0"
+             "weak1" "wire" "wor" "xnor" "xor"
+             ;; 1800-2005
+             "bit" "byte" "chandle" "const" "enum" "int" "logic" "longint"
+             "packed" "ref" "shortint" "shortreal" "static" "string"
+             "struct" "type" "typedef" "union" "var"
+             ;; 1800-2009
+             ;; 1800-2012
+             "interconnect" "nettype" ) nil)))
 
        (verilog-pragma-keywords
-       (eval-when-compile
-         (verilog-regexp-opt
-          '("surefire" "auto" "synopsys" "rtl_synthesis" "verilint" "leda" 
"0in"
-            ) nil  )))
-
-       (verilog-1800-2005-keywords
-       (eval-when-compile
-         (verilog-regexp-opt
-          '("alias" "assert" "assume" "automatic" "before" "bind"
-            "bins" "binsof" "break" "byte" "cell" "chandle" "class"
-            "clocking" "config" "const" "constraint" "context" "continue"
-            "cover" "covergroup" "coverpoint" "cross" "deassign" "design"
-            "dist" "do" "edge" "endclass" "endclocking" "endconfig"
-            "endgroup" "endprogram" "endproperty" "endsequence" "enum"
-            "expect" "export" "extends" "extern" "first_match" "foreach"
-            "forkjoin" "genvar" "highz0" "highz1" "ifnone" "ignore_bins"
-            "illegal_bins" "import" "incdir" "include" "inside" "instance"
-            "int" "intersect" "large" "liblist" "library" "local" "longint"
-            "matches" "medium" "modport" "new" "noshowcancelled" "null"
-            "packed" "program" "property" "protected" "pull0" "pull1"
-            "pulsestyle_onevent" "pulsestyle_ondetect" "pure" "rand" "randc"
-            "randcase" "randsequence" "ref" "release" "return" "scalared"
-            "sequence" "shortint" "shortreal" "showcancelled" "small" "solve"
-            "specparam" "static" "string" "strong0" "strong1" "struct"
-            "super" "tagged" "this" "throughout" "timeprecision" "timeunit"
-            "type" "union" "unsigned" "use" "var" "virtual" "void"
-            "wait_order" "weak0" "weak1" "wildcard" "with" "within"
-            ) nil )))
-
-       (verilog-1800-2009-keywords
-       (eval-when-compile
-         (verilog-regexp-opt
-          '("accept_on" "checker" "endchecker" "eventually" "global"
-            "implies" "let" "nexttime" "reject_on" "restrict" "s_always"
-            "s_eventually" "s_nexttime" "s_until" "s_until_with" "strong"
-            "sync_accept_on" "sync_reject_on" "unique0" "until"
-            "until_with" "untyped" "weak" ) nil )))
-
-       (verilog-1800-2012-keywords
-       (eval-when-compile
-         (verilog-regexp-opt
-          '("implements" "interconnect" "nettype" "soft" ) nil )))
+        (eval-when-compile
+          (verilog-regexp-opt
+           '("surefire" "0in" "auto" "leda" "rtl_synthesis" "synopsys"
+             "verilint" ) nil)))
 
        (verilog-ams-keywords
-       (eval-when-compile
-         (verilog-regexp-opt
-          '("above" "abs" "absdelay" "acos" "acosh" "ac_stim"
-            "aliasparam" "analog" "analysis" "asin" "asinh" "atan" "atan2" 
"atanh"
-            "branch" "ceil" "connectmodule" "connectrules" "cos" "cosh" "ddt"
-            "ddx" "discipline" "driver_update" "enddiscipline" 
"endconnectrules"
-            "endnature" "endparamset" "exclude" "exp" "final_step" 
"flicker_noise"
-            "floor" "flow" "from" "ground" "hypot" "idt" "idtmod" "inf"
-            "initial_step" "laplace_nd" "laplace_np" "laplace_zd" "laplace_zp"
-            "last_crossing" "limexp" "ln" "log" "max" "min" "nature"
-            "net_resolution" "noise_table" "paramset" "potential" "pow" "sin"
-            "sinh" "slew" "sqrt" "tan" "tanh" "timer" "transition" 
"white_noise"
-            "wreal" "zi_nd" "zi_np" "zi_zd" ) nil )))
-
-       (verilog-font-keywords
-       (eval-when-compile
-         (verilog-regexp-opt
-          '(
-            "assign" "case" "casex" "casez" "randcase" "deassign"
-            "default" "disable" "else" "endcase" "endfunction"
-            "endgenerate" "endinterface" "endmodule" "endprimitive"
-            "endspecify" "endtable" "endtask" "final" "for" "force" "return" 
"break"
-            "continue" "forever" "fork" "function" "generate" "if" "iff" 
"initial"
-            "interface" "join" "join_any" "join_none" "macromodule" "module" 
"negedge"
-            "package" "endpackage" "always" "always_comb" "always_ff"
-            "always_latch" "posedge" "primitive" "priority" "release"
-            "repeat" "specify" "table" "task" "unique" "wait" "while"
-            "class" "program" "endclass" "endprogram"
-            ) nil  )))
+        (eval-when-compile
+          (verilog-regexp-opt
+           '("above" "abs" "absdelay" "abstol" "ac_stim" "access" "acos"
+             "acosh" "aliasparam" "analog" "analysis" "asin" "asinh" "atan"
+             "atan2" "atanh" "branch" "ceil" "connect" "connectmodule"
+             "connectrules" "continuous" "cos" "cosh" "ddt" "ddt_nature"
+             "ddx" "discipline" "discrete" "domain" "driver_update"
+             "endconnectrules" "enddiscipline" "endnature" "endparamset"
+             "exclude" "exp" "final_step" "flicker_noise" "floor" "flow"
+             "from" "ground" "hypot" "idt" "idt_nature" "idtmod" "inf"
+             "initial_step" "laplace_nd" "laplace_np" "laplace_zd"
+             "laplace_zp" "last_crossing" "limexp" "ln" "log" "max"
+             "merged" "min" "nature" "net_resolution" "noise_table"
+             "paramset" "potential" "pow" "resolveto" "sin" "sinh" "slew"
+             "split" "sqrt" "tan" "tanh" "timer" "transition" "units"
+             "white_noise" "wreal" "zi_nd" "zi_np" "zi_zd" "zi_zp"
+             ;; Excluded AMS keywords: "assert" "cross" "string"
+             ) nil)))
+
+       (verilog-font-general-keywords
+        (eval-when-compile
+          (verilog-regexp-opt
+           '("always" "assign" "automatic" "case" "casex" "casez" "cell"
+             "config" "deassign" "default" "design" "disable" "edge" "else"
+             "endcase" "endconfig" "endfunction" "endgenerate" "endmodule"
+             "endprimitive" "endspecify" "endtable" "endtask" "for" "force"
+             "forever" "fork" "function" "generate" "if" "ifnone" "incdir"
+             "include" "initial" "instance" "join" "large" "liblist"
+             "library" "macromodule" "medium" "module" "negedge"
+             "noshowcancelled" "posedge" "primitive" "pulsestyle_ondetect"
+             "pulsestyle_onevent" "release" "repeat" "scalared"
+             "showcancelled" "small" "specify" "strength" "table" "task"
+             "use" "wait" "while"
+             ;; 1800-2005
+             "alias" "always_comb" "always_ff" "always_latch" "assert"
+             "assume" "before" "bind" "bins" "binsof" "break" "class"
+             "clocking" "constraint" "context" "continue" "cover"
+             "covergroup" "coverpoint" "cross" "dist" "do" "endclass"
+             "endclocking" "endgroup" "endinterface" "endpackage"
+             "endprogram" "endproperty" "endsequence" "expect" "export"
+             "extends" "extern" "final" "first_match" "foreach" "forkjoin"
+             "iff" "ignore_bins" "illegal_bins" "import" "inside"
+             "interface" "intersect" "join_any" "join_none" "local"
+             "matches" "modport" "new" "null" "package" "priority"
+             "program" "property" "protected" "pure" "rand" "randc"
+             "randcase" "randsequence" "return" "sequence" "solve" "super"
+             "tagged" "this" "throughout" "timeprecision" "timeunit"
+             "unique" "virtual" "void" "wait_order" "wildcard" "with"
+             "within"
+             ;; 1800-2009
+             "accept_on" "checker" "endchecker" "eventually" "global"
+             "implies" "let" "nexttime" "reject_on" "restrict" "s_always"
+             "s_eventually" "s_nexttime" "s_until" "s_until_with" "strong"
+             "sync_accept_on" "sync_reject_on" "unique0" "until"
+             "until_with" "untyped" "weak"
+             ;; 1800-2012
+             "implements" "soft" ) nil)))
 
        (verilog-font-grouping-keywords
-       (eval-when-compile
-         (verilog-regexp-opt
-          '( "begin" "end" ) nil  ))))
+        (eval-when-compile
+          (verilog-regexp-opt
+           '( "begin" "end" ) nil))))
 
   (setq verilog-font-lock-keywords
        (list
         ;; Fontify all builtin keywords
-        (concat "\\<\\(" verilog-font-keywords "\\|"
+         (concat "\\<\\(" verilog-font-general-keywords "\\|"
                  ;; And user/system tasks and functions
                  "\\$[a-zA-Z][a-zA-Z0-9_\\$]*"
                  "\\)\\>")
         ;; Fontify all types
-        (if verilog-highlight-grouping-keywords
-            (cons (concat "\\<\\(" verilog-font-grouping-keywords "\\)\\>")
-                  'verilog-font-lock-grouping-keywords-face)
-          (cons (concat "\\<\\(" verilog-font-grouping-keywords "\\)\\>")
+         (cons (concat "\\<\\(" verilog-font-grouping-keywords "\\)\\>")
+               (if verilog-highlight-grouping-keywords
+                   'verilog-font-lock-grouping-keywords-face
                 'font-lock-type-face))
         (cons (concat "\\<\\(" verilog-type-font-keywords "\\)\\>")
                'font-lock-type-face)
-        ;; Fontify IEEE-1800-2005 keywords appropriately
-        (if verilog-highlight-p1800-keywords
-            (cons (concat "\\<\\(" verilog-1800-2005-keywords "\\)\\>")
-                  'verilog-font-lock-p1800-face)
-          (cons (concat "\\<\\(" verilog-1800-2005-keywords "\\)\\>")
-                'font-lock-type-face))
-        ;; Fontify IEEE-1800-2009 keywords appropriately
-        (if verilog-highlight-p1800-keywords
-            (cons (concat "\\<\\(" verilog-1800-2009-keywords "\\)\\>")
-                  'verilog-font-lock-p1800-face)
-          (cons (concat "\\<\\(" verilog-1800-2009-keywords "\\)\\>")
-                'font-lock-type-face))
-        ;; Fontify IEEE-1800-2012 keywords appropriately
-        (if verilog-highlight-p1800-keywords
-            (cons (concat "\\<\\(" verilog-1800-2012-keywords "\\)\\>")
-                  'verilog-font-lock-p1800-face)
-          (cons (concat "\\<\\(" verilog-1800-2012-keywords "\\)\\>")
-                'font-lock-type-face))
         ;; Fontify Verilog-AMS keywords
         (cons (concat "\\<\\(" verilog-ams-keywords "\\)\\>")
               'verilog-font-lock-ams-face)))
@@ -3492,7 +3479,7 @@ either is ok to parse as a non-comment, or 
`verilog-insert' was used."
     (remove-text-properties (point-min) (point-max) '(face nil))
     (while (not (eobp))
       (cond ((get-text-property (point) 'v-cmts)
-            (put-text-property (point) (1+ (point)) `face 'underline)
+            (put-text-property (point) (1+ (point)) 'face 'underline)
             ;;(if dbg (setq dbg (concat dbg (format "  v-cmts at %S\n" 
(point)))))
             (forward-char 1))
            (t
@@ -3960,15 +3947,15 @@ Key bindings specific to `verilog-mode-map' are:
       (setq hs-special-modes-alist
             (cons '(verilog-mode "\\<begin\\>" "\\<end\\>" nil
                                  verilog-forward-sexp-function)
-                 hs-special-modes-alist))))
+                  hs-special-modes-alist))))
 
   (add-hook 'completion-at-point-functions
             #'verilog-completion-at-point nil 'local)
 
   ;; Stuff for autos
   (add-hook (if (boundp 'write-contents-hooks) 'write-contents-hooks
-             'write-contents-functions) ; Emacs >= 22.1
-           'verilog-auto-save-check nil 'local)
+              'write-contents-functions) ; Emacs >= 22.1
+            'verilog-auto-save-check nil 'local)
   ;; verilog-mode-hook call added by define-derived-mode
   )
 
@@ -4164,6 +4151,7 @@ With optional ARG, remove existing end of line comments."
 To call this from the command line, see \\[verilog-batch-indent]."
   (interactive)
   (verilog-mode)
+  (verilog-auto-reeval-locals)
   (indent-region (point-min) (point-max) nil))
 
 (defun verilog-insert-block ()
@@ -4985,21 +4973,21 @@ primitive or interface named NAME."
                   (match-end 11)  ; of verilog-end-block-ordered-re
                   ;;(goto-char there)
                   (let ((nest 0)
-                        (reg 
"\\<\\(class\\)\\|\\(endclass\\)\\|\\(package\\|primitive\\|\\(macro\\)?module\\)\\>")
+                        (reg 
"\\<\\(\\(class\\)\\|\\(endclass\\)\\|\\(package\\|primitive\\|\\(macro\\)?module\\)\\)\\>")
                         string)
                     (save-excursion
                       (catch 'skip
                         (while (verilog-re-search-backward reg nil 'move)
                           (cond
-                           ((match-end 3)      ; endclass
+                           ((match-end 4)       ; endclass
                             (ding 't)
                             (setq string "unmatched endclass")
                             (throw 'skip 1))
 
-                           ((match-end 2)      ; endclass
+                           ((match-end 3)       ; endclass
                             (setq nest (1+ nest)))
 
-                           ((match-end 1) ; class
+                           ((match-end 2) ; class
                             (setq nest (1- nest))
                             (if (< nest 0)
                                 (progn
@@ -5237,11 +5225,11 @@ Useful for creating tri's and other expanded fields."
                                                       compile-command))
        (lint-word1    (verilog-string-replace-matches "\\s .*$" "" nil nil
                                                       verilog-linter)))
-    (cond ((equal compile-word1 "surelint") `surelint)
-         ((equal compile-word1 "verilint") `verilint)
-         ((equal lint-word1 "surelint")    `surelint)
-         ((equal lint-word1 "verilint")    `verilint)
-          (t `surelint))))  ; back compatibility
+    (cond ((equal compile-word1 "surelint") 'surelint)
+         ((equal compile-word1 "verilint") 'verilint)
+         ((equal lint-word1 "surelint")    'surelint)
+         ((equal lint-word1 "verilint")    'verilint)
+          (t 'surelint))))  ; back compatibility
 
 (defun verilog-lint-off ()
   "Convert a Verilog linter warning line into a disable statement.
@@ -5255,9 +5243,9 @@ variables is used to determine which product is being 
used.
 See \\[verilog-surelint-off] and \\[verilog-verilint-off]."
   (interactive)
   (let ((linter (verilog-linter-name)))
-    (cond ((equal linter `surelint)
+    (cond ((equal linter 'surelint)
           (verilog-surelint-off))
-         ((equal linter `verilint)
+         ((equal linter 'verilint)
           (verilog-verilint-off))
          (t (error "Linter name not set")))))
 
@@ -5361,7 +5349,7 @@ FILENAME to find directory to run in, or defaults to 
`buffer-file-name'."
   (interactive
    (list
     (let ((default (verilog-expand-command verilog-preprocessor)))
-      (set (make-local-variable `verilog-preprocessor)
+      (set (make-local-variable 'verilog-preprocessor)
           (read-from-minibuffer "Run Preprocessor (like this): "
                                 default nil nil
                                 'verilog-preprocess-history default)))))
@@ -5407,6 +5395,9 @@ This lets programs calling batch mode to easily extract 
error messages."
        (error "%%Error: %s%s" (error-message-string err)
                (if (featurep 'xemacs) "\n" ""))))))  ; XEmacs forgets to add a 
newline
 
+;; Eliminate compile warning
+(defvar verilog-batch-orig-buffer-string)
+
 (defun verilog-batch-execute-func (funref &optional no-save)
   "Internal processing of a batch command.
 Runs FUNREF on all command arguments.
@@ -5428,26 +5419,31 @@ Save the result unless optional NO-SAVE is t."
    ;; Remember buffer list, so don't later pickup any verilog-getopt files
    (let ((orig-buffer-list (buffer-list)))
      (mapc (lambda (buf)
-            (when (buffer-file-name buf)
-              (with-current-buffer buf
-                (verilog-mode)
-                (verilog-auto-reeval-locals)
-                (verilog-getopt-flags))))
-          orig-buffer-list)
+             (when (buffer-file-name buf)
+               (with-current-buffer buf
+                 (set (make-local-variable 'verilog-batch-orig-buffer-string)
+                      (buffer-string))
+                 (put 'verilog-batch-orig-buffer-string 'permanent-local t)
+                 (verilog-mode)
+                 (verilog-auto-reeval-locals)
+                 (verilog-getopt-flags))))
+           orig-buffer-list)
      ;; Process the files
-     (mapcar (lambda (buf)
-              (when (buffer-file-name buf)
-                (save-excursion
-                  (if (not (file-exists-p (buffer-file-name buf)))
-                      (error
-                       "File not found: %s" (buffer-file-name buf)))
-                  (message "Processing %s" (buffer-file-name buf))
-                  (set-buffer buf)
-                  (funcall funref)
-                  (when (and (not no-save)
-                              (buffer-modified-p))  ; Avoid "no changes to be 
saved"
-                    (save-buffer)))))
-            orig-buffer-list))))
+     (mapc (lambda (buf)
+             (when (buffer-file-name buf)
+               (save-excursion
+                 (if (not (file-exists-p (buffer-file-name buf)))
+                     (error
+                      "File not found: %s" (buffer-file-name buf)))
+                 (message "Processing %s" (buffer-file-name buf))
+                 (set-buffer buf)
+                 (funcall funref)
+                 (verilog-star-cleanup)
+                 (when (and (not no-save)
+                            (buffer-modified-p)
+                            (not (equal verilog-batch-orig-buffer-string 
(buffer-string))))
+                   (save-buffer)))))
+           orig-buffer-list))))
 
 (defun verilog-batch-auto ()
   "For use with --batch, perform automatic expansions as a stand-alone tool.
@@ -5457,7 +5453,7 @@ For proper results, multiple filenames need to be passed 
on the command
 line in bottom-up order."
   (unless noninteractive
     (error "Use verilog-batch-auto only with --batch"))  ; Otherwise we'd mess 
up buffer modes
-  (verilog-batch-execute-func `verilog-auto))
+  (verilog-batch-execute-func 'verilog-auto))
 
 (defun verilog-batch-delete-auto ()
   "For use with --batch, perform automatic deletion as a stand-alone tool.
@@ -5465,7 +5461,7 @@ This sets up the appropriate Verilog mode environment, 
deletes automatics
 with \\[verilog-delete-auto] on all command-line files, and saves the buffers."
   (unless noninteractive
     (error "Use verilog-batch-delete-auto only with --batch"))  ; Otherwise 
we'd mess up buffer modes
-  (verilog-batch-execute-func `verilog-delete-auto))
+  (verilog-batch-execute-func 'verilog-delete-auto))
 
 (defun verilog-batch-delete-trailing-whitespace ()
   "For use with --batch, perform whitespace deletion as a stand-alone tool.
@@ -5474,7 +5470,7 @@ whitespace with \\[verilog-delete-trailing-whitespace] on 
all
 command-line files, and saves the buffers."
   (unless noninteractive
     (error "Use verilog-batch-delete-trailing-whitespace only with --batch"))  
; Otherwise we'd mess up buffer modes
-  (verilog-batch-execute-func `verilog-delete-trailing-whitespace))
+  (verilog-batch-execute-func 'verilog-delete-trailing-whitespace))
 
 (defun verilog-batch-diff-auto ()
   "For use with --batch, perform automatic differences as a stand-alone tool.
@@ -5484,7 +5480,7 @@ if any differences are observed.  This is appropriate for 
adding to regressions
 to insure automatics are always properly maintained."
   (unless noninteractive
     (error "Use verilog-batch-diff-auto only with --batch"))  ; Otherwise we'd 
mess up buffer modes
-  (verilog-batch-execute-func `verilog-diff-auto t))
+  (verilog-batch-execute-func 'verilog-diff-auto t))
 
 (defun verilog-batch-inject-auto ()
   "For use with --batch, perform automatic injection as a stand-alone tool.
@@ -5494,7 +5490,7 @@ For proper results, multiple filenames need to be passed 
on the command
 line in bottom-up order."
   (unless noninteractive
     (error "Use verilog-batch-inject-auto only with --batch"))  ; Otherwise 
we'd mess up buffer modes
-  (verilog-batch-execute-func `verilog-inject-auto))
+  (verilog-batch-execute-func 'verilog-inject-auto))
 
 (defun verilog-batch-indent ()
   "For use with --batch, reindent an entire file as a stand-alone tool.
@@ -5502,7 +5498,7 @@ This sets up the appropriate Verilog mode environment, 
calls
 \\[verilog-indent-buffer] on all command-line files, and saves the buffers."
   (unless noninteractive
     (error "Use verilog-batch-indent only with --batch"))  ; Otherwise we'd 
mess up buffer modes
-  (verilog-batch-execute-func `verilog-indent-buffer))
+  (verilog-batch-execute-func 'verilog-indent-buffer))
 
 ;;; Indentation:
 ;;
@@ -6408,7 +6404,7 @@ Return >0 for nested struct."
                        (equal (char-before) ?\;)
                        (equal (char-before) ?\}))
                    ;; skip what looks like bus repetition operator {#{
-                   (not (string-match "^{\\s-*[0-9]+\\s-*{" (buffer-substring 
p (point)))))))))
+                   (not (string-match "^{\\s-*[0-9a-zA-Z_]+\\s-*{" 
(buffer-substring p (point)))))))))
       (progn
         (let ( (pt (point)) (pass 0))
           (verilog-backward-ws&directives)
@@ -6426,9 +6422,11 @@ Return >0 for nested struct."
             ;;   check next word token
             (if (looking-at "\\<\\w+\\>\\|\\s-*(\\s-*\\S-+")
                 (progn (verilog-beg-of-statement)
-                       (if (looking-at (concat "\\<\\(constraint\\|"
+                       (if (and
+                            (not (string-match verilog-named-block-re 
(buffer-substring pt (point)))) ;; Abort if 'begin' keyword is found
+                            (looking-at (concat "\\<\\(constraint\\|"
                                                
"\\(?:\\w+\\s-*:\\s-*\\)?\\(coverpoint\\|cross\\)"
-                                               "\\|with\\)\\>\\|" 
verilog-in-constraint-re))
+                                               "\\|with\\)\\>\\|" 
verilog-in-constraint-re)))
                            (setq pass 1)))))
           (if (eq pass 0)
               (progn (goto-char pt) nil) 1)))
@@ -6558,9 +6556,9 @@ Return >0 for nested struct."
                (t nil))))
     (skip-chars-forward " \t\n\f")
     (while
-       (cond
-        ((looking-at "\\/\\*")
-         (progn
+        (cond
+         ((looking-at "/\\*")
+          (progn
            (setq h (point))
            (goto-char (match-end 0))
            (if (search-forward "*/" nil t)
@@ -7339,7 +7337,7 @@ will be completed at runtime and should not be added to 
this list.")
     ("xor"     "output"))
   "Map of direction for each positional argument to each gate primitive.")
 
-(defvar verilog-gate-keywords (mapcar `car verilog-gate-ios)
+(defvar verilog-gate-keywords (mapcar #'car verilog-gate-ios)
   "Keywords for gate primitives.")
 
 (defun verilog-string-diff (str1 str2)
@@ -8172,7 +8170,7 @@ Duplicate signals are also removed.  For example A[2] and 
A[1] become A[2:1]."
        sv-modport
        bus)
     ;; Shove signals so duplicated signals will be adjacent
-    (setq in-list (sort in-list `verilog-signals-sort-compare))
+    (setq in-list (sort in-list #'verilog-signals-sort-compare))
     (while in-list
       (setq sig (car in-list))
       ;; No current signal; form from existing details
@@ -8193,11 +8191,11 @@ Duplicate signals are also removed.  For example A[2] 
and A[1] become A[2:1]."
       (setq bus (verilog-sig-bits sig))
       (setq bus (and bus (verilog-simplify-range-expression bus)))
       (cond ((and bus
-                 (or (and (string-match "\\[\\([0-9]+\\):\\([0-9]+\\)\\]" bus)
+                 (or (and (string-match "^\\[\\([0-9]+\\):\\([0-9]+\\)\\]$" 
bus)
                           (setq highbit (string-to-number (match-string 1 bus))
                                 lowbit  (string-to-number
                                          (match-string 2 bus))))
-                     (and (string-match "\\[\\([0-9]+\\)\\]" bus)
+                     (and (string-match "^\\[\\([0-9]+\\)\\]$" bus)
                           (setq highbit (string-to-number (match-string 1 bus))
                                 lowbit  highbit))))
             ;; Combine bits in bus
@@ -8431,7 +8429,7 @@ Optional NUM-PARAM and MAX-PARAM check for a specific 
number of parameters."
       ;; /*AUTOPUNT("parameter", "parameter")*/
       (backward-sexp 1)
       (while (looking-at "(?\\s *\"\\([^\"]*\\)\"\\s *,?")
-       (setq olist (cons (match-string 1) olist))
+        (setq olist (cons (match-string-no-properties 1) olist))
        (goto-char (match-end 0))))
     (or (eq nil num-param)
        (<= num-param (length olist))
@@ -8463,12 +8461,12 @@ Return an array of [outputs inouts inputs wire reg 
assign const]."
        (cond
         ((looking-at "//")
          (when (looking-at "[^\n]*\\(auto\\|synopsys\\)\\s +enum\\s 
+\\([a-zA-Z0-9_]+\\)")
-            (setq enum (match-string 2)))
+            (setq enum (match-string-no-properties 2)))
          (search-forward "\n"))
         ((looking-at "/\\*")
          (forward-char 2)
          (when (looking-at "[^\n]*\\(auto\\|synopsys\\)\\s +enum\\s 
+\\([a-zA-Z0-9_]+\\)")
-            (setq enum (match-string 2)))
+            (setq enum (match-string-no-properties 2)))
          (or (search-forward "*/")
              (error "%s: Unmatched /* */, at char %d" (verilog-point-text) 
(point))))
         ((looking-at "(\\*")
@@ -8515,33 +8513,36 @@ Return an array of [outputs inouts inputs wire reg 
assign const]."
          (forward-char 1)
          (when (< paren sig-paren)
            (setq expect-signal nil rvalue nil)))   ; ) that ends variables 
inside v2k arg list
-        ((looking-at "\\s-*\\(\\[[^]]+\\]\\)")
-         (goto-char (match-end 0))
+        ((looking-at "\\[")
+          (setq keywd (buffer-substring-no-properties
+                       (point)
+                       (progn (forward-sexp 1) (point))))
          (cond (newsig ; Memory, not just width.  Patch last signal added's 
memory (nth 3)
                 (setcar (cdr (cdr (cdr newsig)))
                         (if (verilog-sig-memory newsig)
-                            (concat (verilog-sig-memory newsig) (match-string 
1))
-                          (match-string-no-properties 1))))
+                             (concat (verilog-sig-memory newsig)
+                                     keywd)
+                          keywd)))
                 (vec  ; Multidimensional
                 (setq multidim (cons vec multidim))
                 (setq vec (verilog-string-replace-matches
-                           "\\s-+" "" nil nil (match-string-no-properties 1))))
+                           "\\s-+" "" nil nil keywd)))
                 (t  ; Bit width
                 (setq vec (verilog-string-replace-matches
-                           "\\s-+" "" nil nil (match-string-no-properties 
1))))))
+                           "\\s-+" "" nil nil keywd)))))
         ;; Normal or escaped identifier -- note we remember the \ if escaped
         ((looking-at "\\s-*\\([a-zA-Z0-9`_$]+\\|\\\\[^ \t\n\f]+\\)")
          (goto-char (match-end 0))
          (setq last-keywd keywd
                 keywd (match-string-no-properties 1))
-         (when (string-match "^\\\\" (match-string 1))
+          (when (string-match "^\\\\" (match-string-no-properties 1))
             (setq keywd (concat keywd " ")))  ; Escaped ID needs space at end
          ;; Add any :: package names to same identifier
           ;; '*' here is for "import x::*"
           (while (looking-at "\\s-*::\\s-*\\(\\*\\|[a-zA-Z0-9`_$]+\\|\\\\[^ 
\t\n\f]+\\)")
            (goto-char (match-end 0))
-           (setq keywd (concat keywd "::" (match-string 1)))
-           (when (string-match "^\\\\" (match-string 1))
+            (setq keywd (concat keywd "::" (match-string-no-properties 1)))
+            (when (string-match "^\\\\" (match-string-no-properties 1))
               (setq keywd (concat keywd " "))))  ; Escaped ID needs space at 
end
          (cond ((equal keywd "input")
                 (setq vec nil        enum nil      rvalue nil  newsig nil  
signed nil
@@ -8626,10 +8627,12 @@ Return an array of [outputs inouts inputs wire reg 
assign const]."
                ((and v2kargs-ok
                      (eq paren 1)
                      (not rvalue)
-                     (looking-at 
"\\s-*\\(\\.\\(\\s-*[a-zA-Z`_$][a-zA-Z0-9`_$]*\\)\\|\\)\\s-*[a-zA-Z`_$][a-zA-Z0-9`_$]*"))
+                      (or (looking-at "\\s-*#")
+                          (looking-at 
"\\s-*\\(\\.\\(\\s-*[a-zA-Z`_$][a-zA-Z0-9`_$]*\\)\\|\\)\\s-*[a-zA-Z`_$][a-zA-Z0-9`_$]*")))
                 (when (match-end 2) (goto-char (match-end 2)))
                 (setq vec nil          enum nil       rvalue nil  signed nil
-                      typedefed keywd  multidim nil   ptype nil   modport 
(match-string 2)
+                       typedefed keywd  multidim nil   ptype nil
+                       modport (match-string-no-properties 2)
                       newsig nil    sig-paren paren
                       expect-signal 'sigs-intf  io t  ))
                ;; Ignore dotted LHS assignments: "assign foo.bar = z;"
@@ -8678,7 +8681,8 @@ Return an array of [outputs inouts inputs wire reg assign 
const]."
                ((and expect-signal
                      (not rvalue)
                      (eq functask 0)
-                     (not (member keywd verilog-keywords)))
+                      (not (member keywd verilog-keywords))
+                      (or (not io) (eq paren sig-paren)))
                 ;; Add new signal to expect-signal's variable
                 ;;(if dbg (setq dbg (concat dbg (format "Pt %s  New sig %s'\n" 
(point) keywd))))
                 (setq newsig (verilog-sig-new keywd vec nil nil enum signed 
typedefed multidim modport))
@@ -8743,7 +8747,7 @@ Return an array of [outputs inouts inputs wire reg assign 
const]."
       (setq port (verilog-symbol-detick-denumber port))
       (setq sig  (if dotname port (verilog-symbol-detick-denumber sig)))
       (if vec (setq vec  (verilog-symbol-detick-denumber vec)))
-      (if multidim (setq multidim  (mapcar `verilog-symbol-detick-denumber 
multidim)))
+      (if multidim (setq multidim  (mapcar #'verilog-symbol-detick-denumber 
multidim)))
       (if mem (setq mem (verilog-symbol-detick-denumber mem)))
       (unless (or (not sig)
                   (equal sig ""))  ; Ignore .foo(1'b1) assignments
@@ -8851,8 +8855,9 @@ Return an array of [outputs inouts inputs wire reg assign 
const]."
        ;;(message "vrsde-s: `%s'" (match-string 1 expr))
        (setq sig (verilog-string-remove-spaces (match-string 1 expr))
              expr (substring expr (match-end 0)))))
-      ;; Find [vector] or [multi][multi][multi][vector]
-      (while (string-match "^\\s-*\\(\\[[^]]+\\]\\)" expr)
+      ;; Find [vector] or [multi][multi][multi][vector] or [vector[VEC2]]
+      ;; Unfortunately Emacs regexps don't allow matching bracket searches, so 
just 2 deep.
+      (while (string-match "^\\s-*\\(\\[\\([^][]+\\|\\[[^][]+\\]\\)*\\]\\)" 
expr)
        ;;(message "vrsde-v: `%s'" (match-string 1 expr))
        (when vec (setq multidim (cons vec multidim)))
        (setq vec (match-string 1 expr)
@@ -8910,7 +8915,7 @@ Inserts the list of signals found, using submodi to look 
up each port."
                  (verilog-string-remove-spaces (match-string-no-properties 1)) 
; sig
                  nil nil nil)) ; vec multidim mem
                ;;
-               ((looking-at 
"\\([a-zA-Z_][a-zA-Z_0-9]*\\)\\s-*\\(\\[[^]]+\\]\\)\\s-*)")
+               ((looking-at 
"\\([a-zA-Z_][a-zA-Z_0-9]*\\)\\s-*\\(\\[[^][]+\\]\\)\\s-*)")
                 (verilog-read-sub-decls-sig
                   submoddecls par-values comment port
                  (verilog-string-remove-spaces (match-string-no-properties 1)) 
; sig
@@ -8926,7 +8931,7 @@ Inserts the list of signals found, using submodi to look 
up each port."
                                      (point)))))))) ; expr
        ;;
        (forward-line 1)))))
-;;(verilog-read-sub-decls-line (verilog-subdecls-new nil nil nil nil nil) nil 
"Cmt")
+;;(verilog-read-sub-decls-line (verilog-decls-new nil nil nil nil nil nil nil 
nil nil) nil "Cmt")
 
 (defun verilog-read-sub-decls-gate (submoddecls par-values comment submod 
end-inst-point)
   "For `verilog-read-sub-decls', read lines of UDP gate decl until none match.
@@ -8945,15 +8950,15 @@ Inserts the list of signals found."
               (forward-char 1)
               (or (search-forward "*)")
                   (error "%s: Unmatched (* *), at char %d" 
(verilog-point-text) (point))))
-             ;; On pins, parse and advance to next pin
-             ;; Looking at pin, but *not* an // Output comment, or ) to end 
the inst
-             ((looking-at "\\s-*[a-zA-Z0-9`_$({}\\\\][^,]*")
-              (goto-char (match-end 0))
+              ;; On pins, parse and advance to next pin
+              ;; Looking at pin, but *not* an // Output comment, or ) to end 
the inst
+              ((looking-at "\\s-*[a-zA-Z0-9`_$({}\\][^,]*")
+               (goto-char (match-end 0))
               (setq verilog-read-sub-decls-gate-ios (or (car iolist) "input")
                     iolist (cdr iolist))
               (verilog-read-sub-decls-expr
                 submoddecls par-values comment "primitive_port"
-               (match-string 0)))
+                (match-string-no-properties 0)))
              (t
               (forward-char 1)
               (skip-syntax-forward " ")))))))
@@ -8997,7 +9002,7 @@ Outputs comments above subcell signals, for example:
                   submodi submoddecls)
              (cond
               (subprim
-               (setq submodi `primitive
+               (setq submodi 'primitive
                      submoddecls (verilog-decls-new nil nil nil nil nil nil 
nil nil nil)
                      comment (concat inst " of " submod))
                (verilog-backward-open-paren)
@@ -9050,7 +9055,7 @@ For example if declare A A (.B(SIG)) then B will be 
included in the list."
          pins pin)
       (verilog-backward-open-paren)
       (while (re-search-forward "\\.\\([^(,) \t\n\f]*\\)\\s-*" end-mod-point t)
-       (setq pin (match-string 1))
+        (setq pin (match-string-no-properties 1))
        (unless (verilog-inside-comment-or-string-p)
          (setq pins (cons (list pin) pins))
          (when (looking-at "(")
@@ -9064,7 +9069,7 @@ For example if declare A A (.B(SIG)) then B will be 
included in the list."
          pins pin)
       (verilog-backward-open-paren)
       (while (re-search-forward "\\([a-zA-Z0-9$_.%`]+\\)" end-mod-point t)
-       (setq pin (match-string 1))
+        (setq pin (match-string-no-properties 1))
        (unless (verilog-inside-comment-or-string-p)
          (setq pins (cons (list pin) pins))))
       (vector pins))))
@@ -9085,7 +9090,7 @@ For example if declare A A (.B(SIG)) then B will be 
included in the list."
                           (backward-char 1)
                           (point)))
        (while (re-search-forward "\\s-*\\([\"a-zA-Z0-9$_.%`]+\\)\\s-*,*" 
tpl-end-pt t)
-         (setq sig-list (cons (list (match-string 1) nil nil) sig-list))))
+          (setq sig-list (cons (list (match-string-no-properties 1) nil nil) 
sig-list))))
       sig-list)))
 
 (defvar verilog-cache-has-lisp nil "True if any AUTO_LISP in buffer.")
@@ -9117,7 +9122,7 @@ Must call `verilog-read-auto-lisp-present' before this 
function."
   "Recursive routine for parentheses/bracket matching.
 EXIT-KEYWD is expression to stop at, nil if top level.
 RVALUE is true if at right hand side of equal.
-IGNORE-NEXT is true to ignore next token, fake from inside case statement."
+TEMP-NEXT is true to ignore next token, fake from inside case statement."
   (let* ((semi-rvalue (equal "endcase" exit-keywd))  ; true if after a ; we 
are looking for rvalue
         keywd last-keywd sig-tolk sig-last-tolk gotend got-sig got-list 
end-else-check
         ignore-next)
@@ -9156,7 +9161,9 @@ IGNORE-NEXT is true to ignore next token, fake from 
inside case statement."
            ;;(if dbg (setq dbg (concat dbg (format "\tif-check-else-other 
%s\n" keywd))))
            (setq gotend t))
           ;; Final statement?
-          ((and exit-keywd (and (equal keywd exit-keywd)
+          ((and exit-keywd (and (or (equal keywd exit-keywd)
+                                     (and (equal exit-keywd "'}")
+                                          (equal keywd "}")))
                                  (not (looking-at "::"))))
            (setq gotend t)
            (forward-char (length keywd)))
@@ -9169,9 +9176,13 @@ IGNORE-NEXT is true to ignore next token, fake from 
inside case statement."
              (setq end-else-check t))
            (forward-char 1))
           ((equal keywd "'")
-           (if (looking-at "'[sS]?[hdxboHDXBO]?[ \t]*[0-9a-fA-F_xzXZ?]+")
-               (goto-char (match-end 0))
-             (forward-char 1)))
+           (cond ((looking-at "'[sS]?[hdxboHDXBO]?[ \t]*[0-9a-fA-F_xzXZ?]+")
+                   (goto-char (match-end 0)))
+                  ((looking-at "'{")
+                   (forward-char 2)
+                   (verilog-read-always-signals-recurse "'}" t nil))
+                  (t
+                   (forward-char 1))))
            ((equal keywd ":")  ; Case statement, begin/end label, x?y:z
             (cond ((looking-at "::")
                    (forward-char 1))  ; Another forward-char below
@@ -9181,6 +9192,8 @@ IGNORE-NEXT is true to ignore next token, fake from 
inside case statement."
                    )  ; NOP
                   ((equal "]" exit-keywd)  ; [x:y] rvalue
                    )  ; NOP
+                  ((equal "'}" exit-keywd)  ; Pattern assignment
+                   )  ; NOP
                   (got-sig  ; label: statement
                   (setq ignore-next nil rvalue semi-rvalue got-sig nil))
                   ((not rvalue)  ; begin label
@@ -9291,9 +9304,8 @@ IGNORE-NEXT is true to ignore next token, fake from 
inside case statement."
          (forward-line 1))
        (beginning-of-line)
        (if (looking-at 
"^\\s-*\\([a-zA-Z0-9`_$]+\\)\\s-+\\([a-zA-Z0-9`_$]+\\)\\s-*(")
-           ;;(if (looking-at "^\\(.+\\)$")
-           (let ((module (match-string 1))
-                 (instant (match-string 2)))
+            (let ((module (match-string-no-properties 1))
+                  (instant (match-string-no-properties 2)))
              (if (not (member module verilog-keywords))
                  (setq instants-list (cons (list module instant) 
instants-list)))))
        (forward-line 1)))
@@ -9313,7 +9325,7 @@ Returns REGEXP and list of ( (signal_name 
connection_name)... )."
       ;; We reserve @"..." for future lisp expressions that evaluate
       ;; once-per-AUTOINST
       (when (looking-at "\\s-*\"\\([^\"]*\\)\"")
-       (setq tpl-regexp (match-string 1))
+        (setq tpl-regexp (match-string-no-properties 1))
        (goto-char (match-end 0)))
       (search-forward "(")
       ;; Parse lines in the template
@@ -9342,10 +9354,10 @@ Returns REGEXP and list of ( (signal_name 
connection_name)... )."
                            templateno lineno)
                           tpl-sig-list))
               (goto-char (match-end 0)))
-             ;; Regexp form??
-             ((looking-at
-               ;; Regexp bug in XEmacs disallows ][ inside [], and wants + last
-               
"\\s-*\\.\\(\\(address@hidden|---]\\|[][]\\|\\\\[()|]\\)+\\)\\s-*(\\(.*\\))\\s-*\\(,\\|)\\s-*;\\)")
+              ;; Regexp form??
+              ((looking-at
+                ;; Regexp bug in XEmacs disallows ][ inside [], and wants + 
last
+                
"\\s-*\\.\\(\\(address@hidden|]\\|[][]\\|\\\\[()|0-9]\\)+\\)\\s-*(\\(.*\\))\\s-*\\(,\\|)\\s-*;\\)")
               (setq rep (match-string-no-properties 3))
               (goto-char (match-end 0))
               (setq tpl-wild-list
@@ -9510,8 +9522,8 @@ warning message, you need to add to your init file:
       (when recurse
        (goto-char (point-min))
        (while (re-search-forward "^\\s-*`include\\s-+\\([^ \t\n\f]+\\)" nil t)
-         (let ((inc (verilog-string-replace-matches
-                     "\"" "" nil nil (match-string-no-properties 1))))
+         (let ((inc (verilog-substitute-include-name
+                      (match-string-no-properties 1))))
            (unless (verilog-inside-comment-or-string-p)
              (verilog-read-defines inc recurse t)))))
       ;; Read `defines
@@ -9583,7 +9595,8 @@ foo.v (an include file):
     (verilog-getopt-flags)
     (goto-char (point-min))
     (while (re-search-forward "^\\s-*`include\\s-+\\([^ \t\n\f]+\\)" nil t)
-      (let ((inc (verilog-string-replace-matches "\"" "" nil nil (match-string 
1))))
+      (let ((inc (verilog-substitute-include-name
+                  (match-string-no-properties 1))))
        (verilog-read-defines inc nil t)))))
 
 (defun verilog-read-signals (&optional start end)
@@ -9652,7 +9665,7 @@ Use DEFAULT-DIR to anchor paths if non-nil."
        ((string-match "^\\+libext\\+\\(.*\\)" arg)
        (setq arg (match-string 1 arg))
        (while (string-match "\\([^+]+\\)\\+?\\(.*\\)" arg)
-         (verilog-add-list-unique `verilog-library-extensions
+         (verilog-add-list-unique 'verilog-library-extensions
                                   (match-string 1 arg))
          (setq arg (match-string 2 arg))))
        ;;
@@ -9664,7 +9677,7 @@ Use DEFAULT-DIR to anchor paths if non-nil."
        ;;
        ((or (string-match "^\\+incdir\\+\\(.*\\)" arg)  ; +incdir+dir
             (string-match "^-I\\(.*\\)" arg))   ; -Idir
-       (verilog-add-list-unique `verilog-library-directories
+       (verilog-add-list-unique 'verilog-library-directories
                                 (substitute-in-file-name (match-string 1 
arg))))
        ;; Ignore
        ((equal "+librescan" arg))
@@ -9679,15 +9692,15 @@ Use DEFAULT-DIR to anchor paths if non-nil."
        (verilog-getopt-file (verilog-substitute-file-name-path arg 
default-dir) nil))
        ((equal next-param "-v")
        (setq next-param nil)
-       (verilog-add-list-unique `verilog-library-files
+       (verilog-add-list-unique 'verilog-library-files
                                 (verilog-substitute-file-name-path arg 
default-dir)))
        ((equal next-param "-y")
        (setq next-param nil)
-       (verilog-add-list-unique `verilog-library-directories
+       (verilog-add-list-unique 'verilog-library-directories
                                 (verilog-substitute-file-name-path arg 
default-dir)))
        ;; Filename
        ((string-match "^[^-+]" arg)
-       (verilog-add-list-unique `verilog-library-files
+       (verilog-add-list-unique 'verilog-library-files
                                 (verilog-substitute-file-name-path arg 
default-dir)))
        ;; Default - ignore; no warning
        ))))
@@ -9716,7 +9729,7 @@ Use DEFAULT-DIR to anchor paths if non-nil."
 (defun verilog-getopt-flags ()
   "Convert `verilog-library-flags' into standard library variables."
   ;; If the flags are local, then all the outputs should be local also
-  (when (local-variable-p `verilog-library-flags (current-buffer))
+  (when (local-variable-p 'verilog-library-flags (current-buffer))
     (mapc 'make-local-variable '(verilog-library-extensions
                                  verilog-library-directories
                                  verilog-library-files
@@ -9735,6 +9748,12 @@ Use DEFAULT-DIR to anchor paths if non-nil."
       (expand-file-name (substitute-in-file-name filename) default-dir)
   (substitute-in-file-name filename)))
 
+(defun verilog-substitute-include-name (filename)
+  "Return FILENAME for include with define substituted."
+  (setq filename (verilog-string-replace-matches "\"" "" nil nil filename))
+  (verilog-string-replace-matches "\"" "" nil nil
+                                  (verilog-symbol-detick filename t)))
+
 (defun verilog-add-list-unique (varref object)
   "Append to VARREF list the given OBJECT,
 unless it is already a member of the variable's list."
@@ -9746,10 +9765,10 @@ unless it is already a member of the variable's list."
 (defun verilog-current-flags ()
   "Convert `verilog-library-flags' and similar variables to command line.
 Used for __FLAGS__ in `verilog-expand-command'."
-  (let ((cmd (mapconcat `concat verilog-library-flags " ")))
+  (let ((cmd (mapconcat #'concat verilog-library-flags " ")))
     (when (equal cmd "")
       (setq cmd (concat
-                "+libext+" (mapconcat `concat verilog-library-extensions "+")
+                "+libext+" (mapconcat #'concat verilog-library-extensions "+")
                 (mapconcat (lambda (i) (concat " -y " i " +incdir+" i))
                            verilog-library-directories "")
                 (mapconcat (lambda (i) (concat " -v " i))
@@ -9888,7 +9907,8 @@ If undefined, and WING-IT, return just SYMBOL without the 
tick, else nil."
 
 (defun verilog-symbol-detick-text (text)
   "Return TEXT without any known defines.
-If the variable vh-{symbol} is defined, substitute that value."
+If the variable vh-{symbol} is defined, substitute that value.
+This function is intended for use in AUTO_TEMPLATE Lisp expressions."
   (let ((ok t) symbol val)
     (while (and ok (string-match "`\\([a-zA-Z0-9_]+\\)" text))
       (setq symbol (match-string 1 text))
@@ -9974,7 +9994,7 @@ variables to build the path.  With optional CHECK-EXT 
also check
           (while chkdirs
             (setq chkdir (expand-file-name (car chkdirs)
                                            (file-name-directory current))
-                  chkexts (if check-ext verilog-library-extensions `("")))
+                  chkexts (if check-ext verilog-library-extensions '("")))
             (while chkexts
               (setq fn (expand-file-name (concat filename (car chkexts))
                                          chkdir))
@@ -10133,7 +10153,7 @@ Return modi if successful, else print message unless 
IGNORE-ERROR is true."
   (set-buffer (if (bufferp (verilog-modi-file-or-buffer modi))
                  (verilog-modi-file-or-buffer modi)
                (find-file-noselect (verilog-modi-file-or-buffer modi))))
-  (or (equal major-mode `verilog-mode)  ; Put into Verilog mode to get syntax
+  (or (equal major-mode 'verilog-mode)  ; Put into Verilog mode to get syntax
       (verilog-mode))
   (goto-char (verilog-modi-get-point modi)))
 
@@ -10404,7 +10424,7 @@ When MODI is non-null, also add to modi-cache, for 
tracking."
          (t
           (error "Unsupported verilog-insert-definition direction: `%s'" 
direction))))
   (or dont-sort
-      (setq sigs (sort (copy-alist sigs) `verilog-signals-sort-compare)))
+      (setq sigs (sort (copy-alist sigs) #'verilog-signals-sort-compare)))
   (while sigs
     (let ((sig (car sigs)))
       (verilog-insert-one-definition
@@ -10472,7 +10492,7 @@ Presumes that any newlines end a list element."
                      (looking-at "[(,]")))
                (not (save-excursion  ; Not `endif, or user define
                      (backward-char 1)
-                     (skip-chars-backward "[a-zA-Z0-9_`]")
+                     (skip-chars-backward "a-zA-Z0-9_`")
                      (looking-at "`"))))
       (insert ","))))
 
@@ -10520,67 +10540,96 @@ This repairs those mis-inserted by an AUTOARG."
 (defun verilog-simplify-range-expression (expr)
   "Return a simplified range expression with constants eliminated from EXPR."
   ;; Note this is always called with brackets; ie [z] or [z:z]
-  (if (not (string-match "[---+*()]" expr))
-      expr  ; short-circuit
+  (if (or (not verilog-auto-simplify-expressions)
+          (not (string-match "[---+*/<>()]" expr)))
+      expr  ; disabled or short-circuited
     (let ((out expr)
          (last-pass ""))
       (while (not (equal last-pass out))
-       (setq last-pass out)
-       ;; Prefix regexp needs beginning of match, or some symbol of
-       ;; lesser or equal precedence.  We assume the [:]'s exist in expr.
-       ;; Ditto the end.
-       (while (string-match
-               (concat "\\([[({:*+-]\\)"  ; - must be last
-                       "(\\<\\([0-9A-Za-z_]+\\))"
-                       "\\([])}:*+-]\\)")
-               out)
-         (setq out (replace-match "\\1\\2\\3" nil nil out)))
-       (while (string-match
-               (concat "\\([[({:*+-]\\)"  ; - must be last
-                       "\\$clog2\\s *(\\<\\([0-9]+\\))"
-                       "\\([])}:*+-]\\)")
-               out)
-         (setq out (replace-match
-                    (concat
-                     (match-string 1 out)
-                     (int-to-string (verilog-clog2 (string-to-number 
(match-string 2 out))))
-                     (match-string 3 out))
-                    nil nil out)))
-       ;; For precedence do * before +/-
-       (while (string-match
-               (concat "\\([[({:*+-]\\)"
-                       "\\([0-9]+\\)\\s *\\([*]\\)\\s *\\([0-9]+\\)"
-                       "\\([])}:*+-]\\)")
-               out)
-         (setq out (replace-match
-                    (concat (match-string 1 out)
-                            (int-to-string (* (string-to-number (match-string 
2 out))
-                                              (string-to-number (match-string 
4 out))))
-                            (match-string 5 out))
-                    nil nil out)))
-       (while (string-match
-               (concat "\\([[({:+-]\\)" ; No * here as higher prec
-                       "\\([0-9]+\\)\\s *\\([---+]\\)\\s *\\([0-9]+\\)"
-                       "\\([])}:+-]\\)")
-               out)
-         (let ((pre (match-string 1 out))
-               (lhs (string-to-number (match-string 2 out)))
-               (rhs (string-to-number (match-string 4 out)))
-               (post (match-string 5 out))
-               val)
-           (when (equal pre "-")
-             (setq lhs (- lhs)))
-           (setq val (if (equal (match-string 3 out) "-")
-                         (- lhs rhs)
-                       (+ lhs rhs))
-                 out (replace-match
-                      (concat (if (and (equal pre "-")
-                                       (< val 0))
-                                  ""  ; Not "--20" but just "-20"
-                                pre)
-                              (int-to-string val)
-                              post)
-                      nil nil out)) )))
+        (while (not (equal last-pass out))
+          (setq last-pass out)
+          ;; Prefix regexp needs beginning of match, or some symbol of
+          ;; lesser or equal precedence.  We assume the [:]'s exist in expr.
+          ;; Ditto the end.
+          (while (string-match
+                  (concat "\\([[({:*/<>+-]\\)"  ; - must be last
+                          "(\\<\\([0-9A-Za-z_]+\\))"
+                          "\\([])}:*/<>+-]\\)")
+                  out)
+            (setq out (replace-match "\\1\\2\\3" nil nil out)))
+          (while (string-match
+                  (concat "\\([[({:*/<>+-]\\)"  ; - must be last
+                          "\\$clog2\\s *(\\<\\([0-9]+\\))"
+                          "\\([])}:*/<>+-]\\)")
+                  out)
+            (setq out (replace-match
+                       (concat
+                        (match-string 1 out)
+                        (int-to-string (verilog-clog2 (string-to-number 
(match-string 2 out))))
+                        (match-string 3 out))
+                       nil nil out)))
+          ;; For precedence do *,/ before +,-,>>,<<
+          (while (string-match
+                  (concat "\\([[({:*/<>+-]\\)"
+                          "\\([0-9]+\\)\\s *\\([*/]\\)\\s *\\([0-9]+\\)"
+                          "\\([])}:*/<>+-]\\)")
+                  out)
+            (setq out (replace-match
+                       (concat (match-string 1 out)
+                               (if (equal (match-string 3 out) "/")
+                                   (int-to-string (/ (string-to-number 
(match-string 2 out))
+                                                     (string-to-number 
(match-string 4 out)))))
+                               (if (equal (match-string 3 out) "*")
+                                   (int-to-string (* (string-to-number 
(match-string 2 out))
+                                                     (string-to-number 
(match-string 4 out)))))
+                               (match-string 5 out))
+                       nil nil out)))
+          ;; Next precedence is +,-
+          (while (string-match
+                  (concat "\\([[({:<>+-]\\)"  ; No *,/ here as higher prec
+                          "\\([0-9]+\\)\\s *\\([---+]\\)\\s *\\([0-9]+\\)"
+                          "\\([])}:<>+-]\\)")
+                  out)
+            (let ((pre (match-string 1 out))
+                  (lhs (string-to-number (match-string 2 out)))
+                  (rhs (string-to-number (match-string 4 out)))
+                  (post (match-string 5 out))
+                  val)
+              (when (equal pre "-")
+                (setq lhs (- lhs)))
+              (setq val (if (equal (match-string 3 out) "-")
+                            (- lhs rhs)
+                          (+ lhs rhs))
+                    out (replace-match
+                         (concat (if (and (equal pre "-")
+                                          (< val 0))
+                                     ""  ; Not "--20" but just "-20"
+                                   pre)
+                                 (int-to-string val)
+                                 post)
+                         nil nil out)) ))
+          ;; Next precedence is >>,<<
+          (while (string-match
+                  (concat "\\([[({:]\\)"  ;; No << as not transitive
+                          "\\([0-9]+\\)\\s 
*\\([<]\\{2,3\\}\\|[>]\\{2,3\\}\\)\\s *\\([0-9]+\\)"
+                          "\\([])}:<>]\\)")
+                  out)
+            (setq out (replace-match
+                       (concat (match-string 1 out)
+                               (if (equal (match-string 3 out) ">>")
+                                   (int-to-string (lsh (string-to-number 
(match-string 2 out))
+                                                       (* -1 (string-to-number 
(match-string 4 out))))))
+                               (if (equal (match-string 3 out) "<<")
+                                   (int-to-string (lsh (string-to-number 
(match-string 2 out))
+                                                       (string-to-number 
(match-string 4 out)))))
+                               (if (equal (match-string 3 out) ">>>")
+                                   (int-to-string (ash (string-to-number 
(match-string 2 out))
+                                                       (* -1 (string-to-number 
(match-string 4 out))))))
+                               (if (equal (match-string 3 out) "<<<")
+                                   (int-to-string (ash (string-to-number 
(match-string 2 out))
+                                                       (string-to-number 
(match-string 4 out)))))
+                               (match-string 5 out))
+                       nil nil out)))))
       out)))
 
 ;;(verilog-simplify-range-expression "[1:3]")  ; 1
@@ -10593,6 +10642,9 @@ This repairs those mis-inserted by an AUTOARG."
 ;;(verilog-simplify-range-expression "[FOO-1+1-1+1]")  ; FOO-0
 ;;(verilog-simplify-range-expression "[$clog2(2)]")  ; 1
 ;;(verilog-simplify-range-expression "[$clog2(7)]")  ; 3
+;;(verilog-simplify-range-expression "[(TEST[1])-1:0]")
+;;(verilog-simplify-range-expression "[1<<2:8>>2]")  ; [4:2]
+;;(verilog-simplify-range-expression "[2*4/(4-2) +2+4 <<4 >>2]")
 
 (defun verilog-clog2 (value)
   "Compute $clog2 - ceiling log2 of VALUE."
@@ -10748,7 +10800,7 @@ Intended for internal use inside a 
`verilog-save-font-no-change-functions' block
    (concat "/\\*"
            (eval-when-compile
              (verilog-regexp-words
-              `("AS" "AUTOARG" "AUTOCONCATWIDTH" "AUTOINST" "AUTOINSTPARAM"
+              '("AS" "AUTOARG" "AUTOCONCATWIDTH" "AUTOINST" "AUTOINSTPARAM"
                 "AUTOSENSE")))
            "\\*/")
    'verilog-delete-to-paren)
@@ -11020,8 +11072,7 @@ or `diff' in batch mode."
              (progn
                (with-current-buffer b1 (setq buffer-file-name nil))
                (verilog-auto)
-               (when (not verilog-auto-star-save)
-                 (verilog-delete-auto-star-implicit)))
+                (verilog-star-cleanup))
            ;; Restore name if unwind
            (with-current-buffer b1 (setq buffer-file-name name1)))))
       ;;
@@ -11038,6 +11089,11 @@ or `diff' in batch mode."
 ;; Auto save
 ;;
 
+(defun verilog-star-cleanup ()
+  "On saving or diff, cleanup .* expansions."
+  (when (not verilog-auto-star-save)
+    (verilog-delete-auto-star-implicit)))
+
 (defun verilog-auto-save-check ()
   "On saving see if we need auto update."
   (cond ((not verilog-auto-save-policy)) ; disabled
@@ -11057,8 +11113,7 @@ or `diff' in batch mode."
           (verilog-auto))
         ;; Don't ask again if didn't update
         (set (make-local-variable 'verilog-auto-update-tick) 
(buffer-chars-modified-tick))))
-  (when (not verilog-auto-star-save)
-    (verilog-delete-auto-star-implicit))
+  (verilog-star-cleanup)
   nil)  ; Always return nil -- we don't write the file ourselves
 
 (defun verilog-auto-read-locals ()
@@ -11089,7 +11144,7 @@ If FORCE, always reread it."
 Takes SIGS list, adds MESSAGE to front and inserts each at INDENT-PT."
   (when sigs
     (when verilog-auto-arg-sort
-      (setq sigs (sort (copy-alist sigs) `verilog-signals-sort-compare)))
+      (setq sigs (sort (copy-alist sigs) #'verilog-signals-sort-compare)))
     (insert "\n")
     (indent-to indent-pt)
     (insert message)
@@ -11243,8 +11298,8 @@ See the example in `verilog-auto-inout-modport'."
                             (verilog-signals-matching-dir-re
                              (verilog-signals-matching-regexp sig-list-o 
regexp)
                              "output" direction-re)))
-         (setq sig-list-i (sort (copy-alist sig-list-i) 
`verilog-signals-sort-compare))
-         (setq sig-list-o (sort (copy-alist sig-list-o) 
`verilog-signals-sort-compare))
+         (setq sig-list-i (sort (copy-alist sig-list-i) 
#'verilog-signals-sort-compare))
+         (setq sig-list-o (sort (copy-alist sig-list-o) 
#'verilog-signals-sort-compare))
          (when (or sig-list-i sig-list-o)
            (verilog-insert-indent "// Beginning of automatic assignments from 
modport\n")
            ;; Don't sort them so an upper AUTOINST will match the main module
@@ -11388,7 +11443,7 @@ If PAR-VALUES replace final strings with these 
parameter values."
           (indent-to (+ (if (< verilog-auto-inst-column 48) 24 16)
                         verilog-auto-inst-column))
           ;; verilog-insert requires the complete comment in one call - 
including the newline
-          (cond ((equal verilog-auto-inst-template-numbers `lhs)
+          (cond ((equal verilog-auto-inst-template-numbers 'lhs)
                  (verilog-insert " // Templated"
                                  " LHS: " (nth 0 tpl-ass)
                                  "\n"))
@@ -11412,7 +11467,7 @@ If PAR-VALUES replace final strings with these 
parameter values."
 (defun verilog-auto-inst-port-list (sig-list indent-pt moddecls tpl-list 
tpl-num for-star par-values)
   "For `verilog-auto-inst' print a list of ports using 
`verilog-auto-inst-port'."
   (when verilog-auto-inst-sort
-    (setq sig-list (sort (copy-alist sig-list) `verilog-signals-sort-compare)))
+    (setq sig-list (sort (copy-alist sig-list) 
#'verilog-signals-sort-compare)))
   (mapc (lambda (port)
          (verilog-auto-inst-port port indent-pt moddecls
                                  tpl-list tpl-num for-star par-values))
@@ -12254,7 +12309,7 @@ same expansion will result from only extracting outputs 
starting with ov:
   "Expand AUTOOUTPUTEVERY statements, as part of \\[verilog-auto].
 Make output statements for any signals that aren't primary inputs or
 outputs already.  This makes every signal in the design an output.  This is
-useful to get Synopsys to preserve every signal in the design, since it
+useful to get synthesis to preserve every signal in the design, since it
 won't optimize away the outputs.
 
 An example:
@@ -13110,7 +13165,7 @@ operator.  (This was added to the language in part due 
to AUTOSENSE!)
                                 (verilog-re-search-backward-quick "\\s-" 
start-pt t))
                               (not (looking-at "\\s-or\\b"))))
          (setq not-first t))
-      (setq sig-list (sort sig-list `verilog-signals-sort-compare))
+      (setq sig-list (sort sig-list #'verilog-signals-sort-compare))
       (while sig-list
        (cond ((> (+ 4 (current-column) (length (verilog-sig-name (car 
sig-list)))) fill-column) ;+4 for width of or
               (insert "\n")
@@ -13219,7 +13274,7 @@ Typing \\[verilog-auto] will make this into:
                      (append
                       (verilog-alw-get-temps sigss)
                       prereset-sigs)))
-      (setq sig-list (sort sig-list `verilog-signals-sort-compare))
+      (setq sig-list (sort sig-list #'verilog-signals-sort-compare))
       (when sig-list
        (insert "\n");
        (verilog-insert-indent "// Beginning of autoreset for uninitialized 
flops\n");
@@ -13310,7 +13365,7 @@ Typing \\[verilog-auto] will make this into:
       (when sig-list
        (verilog-forward-or-insert-line)
        (verilog-insert-indent "// Beginning of automatic tieoffs (for this 
module's unterminated outputs)\n")
-       (setq sig-list (sort (copy-alist sig-list) 
`verilog-signals-sort-compare))
+       (setq sig-list (sort (copy-alist sig-list) 
#'verilog-signals-sort-compare))
        (verilog-modi-cache-add-vars modi sig-list)  ; Before we trash list
        (while sig-list
          (let ((sig (car sig-list)))
@@ -13463,7 +13518,7 @@ Typing \\[verilog-auto] will make this into:
       (when sig-list
        (verilog-forward-or-insert-line)
        (verilog-insert-indent "// Beginning of automatic unused inputs\n")
-       (setq sig-list (sort (copy-alist sig-list) 
`verilog-signals-sort-compare))
+       (setq sig-list (sort (copy-alist sig-list) 
#'verilog-signals-sort-compare))
        (while sig-list
          (let ((sig (car sig-list)))
            (indent-to indent-pt)
@@ -13512,19 +13567,19 @@ Finally, an AUTOASCIIENUM command is used.
   `verilog-auto-wire-type' may be used to change the datatype of
   the declarations.
 
-  \"auto enum\" may be used in place of \"synopsys enum\".
+  \"synopsys enum\" may be used in place of \"auto enum\".
 
 An example:
 
        //== State enumeration
-       parameter [2:0] // synopsys enum state_info
+       parameter [2:0] // auto enum state_info
                           SM_IDLE =  3\\='b000,
                           SM_SEND =  3\\='b001,
                           SM_WAIT1 = 3\\='b010;
        //== State variables
-       reg [2:0]  /* synopsys enum state_info */
-                  state_r;  /* synopsys state_vector state_r */
-       reg [2:0]  /* synopsys enum state_info */
+       reg [2:0]  /* auto enum state_info */
+                  state_r;  /* auto state_vector state_r */
+       reg [2:0]  /* auto enum state_info */
                   state_e1;
 
        /*AUTOASCIIENUM(\"state_r\", \"state_ascii_r\", \"SM_\")*/
@@ -13656,9 +13711,11 @@ being different from the final output's line 
numbering."
     (while (re-search-forward " Templated T\\([0-9]+\\) L\\([0-9]+\\)" nil t)
       (replace-match
        (concat " Templated "
-              (int-to-string (+ (nth (string-to-number (match-string 1))
+               (int-to-string (+ (nth (string-to-number
+                                       (match-string-no-properties 1))
                                      template-line)
-                                (string-to-number (match-string 2)))))
+                                 (string-to-number
+                                  (match-string-no-properties 2)))))
        t t))))
 
 (defun verilog-auto-template-lint ()
@@ -13789,7 +13846,7 @@ Wilson Snyder (address@hidden)."
         ;; Local state
         (verilog-read-auto-template-init)
         ;; If we're not in verilog-mode, change syntax table so parsing works 
right
-        (unless (eq major-mode `verilog-mode) (verilog-mode))
+        (unless (eq major-mode 'verilog-mode) (verilog-mode))
         ;; Allow user to customize
         (verilog-run-hooks 'verilog-before-auto-hook)
         ;; Try to save the user from needing to revert-file to reread file 
local-variables
@@ -14420,11 +14477,14 @@ Files are checked based on `verilog-library-flags'."
       (when (and (not hit)
                 (looking-at verilog-include-file-regexp))
        (if (and (car (verilog-library-filenames
-                      (match-string 1) (buffer-file-name)))
+                       (match-string-no-properties 1)
+                       (buffer-file-name)))
                 (file-readable-p (car (verilog-library-filenames
-                                       (match-string 1) (buffer-file-name)))))
+                                        (match-string-no-properties 1)
+                                        (buffer-file-name)))))
            (find-file (car (verilog-library-filenames
-                            (match-string 1) (buffer-file-name))))
+                             (match-string-no-properties 1)
+                             (buffer-file-name))))
          (when warn
            (message
             "File `%s' isn't readable, use shift-mouse2 to paste in this field"
@@ -14509,7 +14569,6 @@ Files are checked based on `verilog-library-flags'."
        verilog-highlight-grouping-keywords
        verilog-highlight-includes
        verilog-highlight-modules
-       verilog-highlight-p1800-keywords
        verilog-highlight-translate-off
        verilog-indent-begin-after-if
        verilog-indent-declaration-macros
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index e17b7f5..1dc0c61 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -1,6 +1,6 @@
 ;;; vhdl-mode.el --- major mode for editing VHDL code
 
-;; Copyright (C) 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
 ;; Authors:     Reto Zimmermann <address@hidden>
 ;;              Rodney J. Whitby <address@hidden>
@@ -2474,7 +2474,7 @@ specified."
 
 (defun vhdl-resolve-env-variable (string)
   "Resolve environment variables in STRING."
-  (while (string-match "\\(.*\\)${?\\(\\(\\w\\|_\\)+\\)}?\\(.*\\)" string)
+  (while (string-match "\\(.*\\)\\${?\\(\\(\\w\\|_\\)+\\)}?\\(.*\\)" string)
     (setq string (concat (match-string 1 string)
                         (getenv (match-string 2 string))
                         (match-string 4 string))))
@@ -7392,8 +7392,8 @@ only-lines."
 (defun vhdl-update-progress-info (string pos)
   "Update progress information."
   (when (and vhdl-progress-info (not noninteractive)
-            (< vhdl-progress-interval
-               (- (nth 1 (current-time)) (aref vhdl-progress-info 2))))
+            (time-less-p vhdl-progress-interval
+                         (time-since (aref vhdl-progress-info 2))))
     (let ((delta (- (aref vhdl-progress-info 1)
                     (aref vhdl-progress-info 0))))
       (message "%s... (%2d%%)" string
@@ -7401,7 +7401,7 @@ only-lines."
                   100
                  (floor (* 100.0 (- pos (aref vhdl-progress-info 0)))
                         delta))))
-    (aset vhdl-progress-info 2 (nth 1 (current-time)))))
+    (aset vhdl-progress-info 2 (encode-time nil 'integer))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Indentation commands
@@ -8142,12 +8142,12 @@ depending on parameter UPPER-CASE."
                 (upcase-word -1)
               (downcase-word -1)))
         (when (and count vhdl-progress-interval (not noninteractive)
-                   (< vhdl-progress-interval
-                      (- (nth 1 (current-time)) last-update)))
+                   (time-less-p vhdl-progress-interval
+                                (time-since last-update)))
           (message "Fixing case... (%2d%s)"
                    (+ (* count 20) (/ (* 20 (- (point) beg)) (- end beg)))
                    "%")
-          (setq last-update (nth 1 (current-time)))))
+          (setq last-update (encode-time nil 'integer))))
        (goto-char end)))))
 
 (defun vhdl-fix-case-region (beg end &optional arg)
@@ -15115,7 +15115,7 @@ otherwise use cached data."
 (defun vhdl-speedbar-expand-project (text token indent)
   "Expand/contract the project under the cursor."
   (cond
-   ((string-match "+" text)            ; expand project
+   ((string-match "\\+" text)          ; expand project
     (speedbar-change-expand-button-char ?-)
     (unless (member token vhdl-speedbar-shown-project-list)
       (setq vhdl-speedbar-shown-project-list
@@ -15137,7 +15137,7 @@ otherwise use cached data."
 (defun vhdl-speedbar-expand-entity (text token indent)
   "Expand/contract the entity under the cursor."
   (cond
-   ((string-match "+" text)            ; expand entity
+   ((string-match "\\+" text)          ; expand entity
     (let* ((key (vhdl-speedbar-line-key indent))
           (ent-alist (vhdl-aget vhdl-entity-alist key))
           (ent-entry (vhdl-aget ent-alist token))
@@ -15206,7 +15206,7 @@ otherwise use cached data."
 (defun vhdl-speedbar-expand-architecture (text token indent)
   "Expand/contract the architecture under the cursor."
   (cond
-   ((string-match "+" text)            ; expand architecture
+   ((string-match "\\+" text)          ; expand architecture
     (let* ((key (vhdl-speedbar-line-key (1- indent)))
           (ent-alist (vhdl-aget vhdl-entity-alist key))
           (conf-alist (vhdl-aget vhdl-config-alist key))
@@ -15266,7 +15266,7 @@ otherwise use cached data."
 (defun vhdl-speedbar-expand-config (text token indent)
   "Expand/contract the configuration under the cursor."
   (cond
-   ((string-match "+" text)            ; expand configuration
+   ((string-match "\\+" text)          ; expand configuration
     (let* ((key (vhdl-speedbar-line-key indent))
           (conf-alist (vhdl-aget vhdl-config-alist key))
           (conf-entry (vhdl-aget conf-alist token))
@@ -15324,7 +15324,7 @@ otherwise use cached data."
 (defun vhdl-speedbar-expand-package (text token indent)
   "Expand/contract the package under the cursor."
   (cond
-   ((string-match "+" text)            ; expand package
+   ((string-match "\\+" text)          ; expand package
     (let* ((key (vhdl-speedbar-line-key indent))
           (pack-alist (vhdl-aget vhdl-package-alist key))
           (pack-entry (vhdl-aget pack-alist token))
@@ -15729,7 +15729,7 @@ NO-POSITION non-nil means do not re-position cursor."
 
 (defun vhdl-speedbar-dired (text token indent)
   "Speedbar click handler for directory expand button in hierarchy mode."
-  (cond ((string-match "+" text)       ; we have to expand this dir
+  (cond ((string-match "\\+" text)     ; we have to expand this dir
         (setq speedbar-shown-directories
               (cons (expand-file-name
                      (concat (speedbar-line-directory indent) token "/"))
diff --git a/lisp/progmodes/which-func.el b/lisp/progmodes/which-func.el
index 7604be0..564e0ff 100644
--- a/lisp/progmodes/which-func.el
+++ b/lisp/progmodes/which-func.el
@@ -1,6 +1,6 @@
 ;;; which-func.el --- print current function in mode line  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1994, 1997-1998, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1994, 1997-1998, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author:   Alex Rezinsky <address@hidden>
@@ -272,16 +272,21 @@ It calls them sequentially, and if any returns non-nil,
 
 (defun which-function ()
   "Return current function name based on point.
-Uses `which-func-functions', `imenu--index-alist'
-or `add-log-current-defun'.
+Uses `which-func-functions', `add-log-current-defun'.
+or `imenu--index-alist'
 If no function name is found, return nil."
   (let ((name
         ;; Try the `which-func-functions' functions first.
         (run-hook-with-args-until-success 'which-func-functions)))
-
+    ;; Try using add-log support.
+    (when (null name)
+      (setq name (add-log-current-defun)))
     ;; If Imenu is loaded, try to make an index alist with it.
     (when (and (null name)
-              (boundp 'imenu--index-alist) (null imenu--index-alist)
+              (boundp 'imenu--index-alist)
+               (or (null imenu--index-alist)
+                   ;; Update if outdated
+                   (/= (buffer-chars-modified-tick) 
imenu-menubar-modified-tick))
               (null which-function-imenu-failed))
       (ignore-errors (imenu--make-index-alist t))
       (unless imenu--index-alist
@@ -323,10 +328,6 @@ If no function name is found, return nil."
                              (funcall
                               which-func-imenu-joiner-function
                               (reverse (cons (car pair) namestack))))))))))))
-
-    ;; Try using add-log support.
-    (when (null name)
-      (setq name (add-log-current-defun)))
     ;; Filter the name if requested.
     (when name
       (if which-func-cleanup-function
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 6b1421a..aed92f8 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1,6 +1,6 @@
 ;; xref.el --- Cross-referencing commands              -*-lexical-binding:t-*-
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -71,9 +71,6 @@
 (require 'ring)
 (require 'project)
 
-(eval-when-compile
-  (require 'semantic/symref)) ;; for hit-lines slot
-
 (defgroup xref nil "Cross-referencing commands"
   :version "25.1"
   :group 'tools)
@@ -317,8 +314,12 @@ backward."
 ;;; Marker stack  (M-. pushes, M-, pops)
 
 (defcustom xref-marker-ring-length 16
-  "Length of the xref marker ring."
-  :type 'integer)
+  "Length of the xref marker ring.
+If this variable is not set through Customize, you must call
+`xref-set-marker-ring-length' for changes to take effect."
+  :type 'integer
+  :initialize #'custom-initialize-default
+  :set #'xref-set-marker-ring-length)
 
 (defcustom xref-prompt-for-identifier '(not xref-find-definitions
                                             xref-find-definitions-other-window
@@ -354,6 +355,14 @@ elements is negated: these commands will NOT prompt."
 (defvar xref--marker-ring (make-ring xref-marker-ring-length)
   "Ring of markers to implement the marker stack.")
 
+(defun xref-set-marker-ring-length (var val)
+  "Set `xref-marker-ring-length'.
+VAR is the symbol `xref-marker-ring-length' and VAL is the new
+value."
+  (set-default var val)
+  (if (ring-p xref--marker-ring)
+      (ring-resize xref--marker-ring val)))
+
 (defun xref-push-marker-stack (&optional m)
   "Add point M (defaults to `point-marker') to the marker stack."
   (ring-insert xref--marker-ring (or m (point-marker))))
@@ -465,27 +474,17 @@ and finally return the window."
           (or (eq xref--original-window-intent 'frame)
               pop-up-frames))
          (action
-          (cond ((memq
-                  xref--original-window-intent
-                  '(window frame))
+          (cond ((eq xref--original-window-intent 'frame)
                  t)
+                ((eq xref--original-window-intent 'window)
+                 '(display-buffer-same-window))
                 ((and
                   (window-live-p xref--original-window)
                   (or (not (window-dedicated-p xref--original-window))
                       (eq (window-buffer xref--original-window) buf)))
-                 `(,(lambda (buf _alist)
-                      (set-window-buffer xref--original-window buf)
-                      xref--original-window))))))
-    (with-selected-window
-        (with-selected-window
-            ;; Just before `display-buffer', place ourselves in the
-            ;; original window to suggest preserving it. Of course, if
-            ;; user has deleted the original window, all bets are off,
-            ;; just use the selected one.
-            (or (and (window-live-p xref--original-window)
-                     xref--original-window)
-                (selected-window))
-          (display-buffer buf action))
+                 `((display-buffer-in-previous-window)
+                   (previous-window . ,xref--original-window))))))
+    (with-selected-window (display-buffer buf action)
       (xref--goto-char pos)
       (run-hooks 'xref-after-jump-hook)
       (let ((buf (current-buffer)))
@@ -542,9 +541,10 @@ SELECT is `quit', also quit the *xref* window."
 Non-interactively, non-nil QUIT means to first quit the *xref*
 buffer."
   (interactive)
-  (let ((buffer (current-buffer))
-        (xref (or (xref--item-at-point)
-                  (user-error "No reference at point"))))
+  (let* ((buffer (current-buffer))
+         (xref (or (xref--item-at-point)
+                   (user-error "No reference at point")))
+         (xref--current-item xref))
     (xref--show-location (xref-item-location xref) (if quit 'quit t))
     (next-error-found buffer (current-buffer))))
 
@@ -694,8 +694,10 @@ references displayed in the current *xref* buffer."
   (let ((backward (< n 0))
         (n (abs n))
         (xref nil))
-    (dotimes (_ n)
-      (setq xref (xref--search-property 'xref-item backward)))
+    (if (= n 0)
+        (setq xref (get-text-property (point) 'xref-item))
+      (dotimes (_ n)
+        (setq xref (xref--search-property 'xref-item backward))))
     (cond (xref
            ;; Save the current position (when the buffer is visible,
            ;; it gets reset to that window's point from time to time).
@@ -795,6 +797,7 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)."
 (defvar xref--read-pattern-history nil)
 
 (defun xref--show-xrefs (xrefs display-action &optional always-show-list)
+  (unless (region-active-p) (push-mark nil t))
   (cond
    ((and (not (cdr xrefs)) (not always-show-list))
     (xref-push-marker-stack)
diff --git a/lisp/progmodes/xscheme.el b/lisp/progmodes/xscheme.el
index fa14e44..62c42d3 100644
--- a/lisp/progmodes/xscheme.el
+++ b/lisp/progmodes/xscheme.el
@@ -1,6 +1,6 @@
 ;;; xscheme.el --- run MIT Scheme under Emacs        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1986-1987, 1989-1990, 2001-2018 Free Software
+;; Copyright (C) 1986-1987, 1989-1990, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/ps-bdf.el b/lisp/ps-bdf.el
index f9632f0..be80b4a 100644
--- a/lisp/ps-bdf.el
+++ b/lisp/ps-bdf.el
@@ -1,6 +1,6 @@
 ;;; ps-bdf.el --- BDF font file handler for ps-print
 
-;; Copyright (C) 1998-1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-1999, 2001-2019 Free Software Foundation, Inc.
 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
 ;;   2008, 2009, 2010, 2011
 ;;   National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/lisp/ps-def.el b/lisp/ps-def.el
index d0cd762..2063133 100644
--- a/lisp/ps-def.el
+++ b/lisp/ps-def.el
@@ -1,6 +1,6 @@
 ;;; ps-def.el --- XEmacs and Emacs definitions for ps-print -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;;     Kenichi Handa <address@hidden> (multi-byte characters)
diff --git a/lisp/ps-mule.el b/lisp/ps-mule.el
index ae2dd19..c88d6d2 100644
--- a/lisp/ps-mule.el
+++ b/lisp/ps-mule.el
@@ -1,6 +1,6 @@
 ;;; ps-mule.el --- provide multi-byte character facility to ps-print
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;;     Kenichi Handa <address@hidden> (multi-byte characters)
@@ -1031,7 +1031,7 @@ the sequence."
   (setq ps-mule-prologue-generated nil
        ps-mule-composition-prologue-generated nil
        ps-mule-bitmap-prologue-generated nil)
-  (mapcar `(lambda (x) (setcar (nthcdr 2 x) nil))
+  (mapcar (lambda (x) (setcar (nthcdr 2 x) nil))
          ps-mule-external-libraries))
 
 (defun ps-mule-encode-header-string (string fonttag)
diff --git a/lisp/ps-print.el b/lisp/ps-print.el
index 7dd1103..647597c 100644
--- a/lisp/ps-print.el
+++ b/lisp/ps-print.el
@@ -1,6 +1,6 @@
 ;;; ps-print.el --- print text from the buffer as PostScript -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1993-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-2019 Free Software Foundation, Inc.
 
 ;; Author: Jim Thompson (was <address@hidden>)
 ;;     Jacques Duthen (was <address@hidden>)
diff --git a/lisp/ps-samp.el b/lisp/ps-samp.el
index bd5fff8..784b435 100644
--- a/lisp/ps-samp.el
+++ b/lisp/ps-samp.el
@@ -1,6 +1,6 @@
 ;;; ps-samp.el --- ps-print sample setup code
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Jim Thompson (was <address@hidden>)
 ;;     Jacques Duthen (was <address@hidden>)
@@ -76,8 +76,8 @@
       (concat "Subject: " (or (mail-fetch-field "Subject") "???")))))
 
 ;; Look in an article or mail message for the From: line.  Sorta-kinda
-;; understands RFC-822 addresses and can pull the real name out where
-;; it's provided.
+;; understands RFC 822 (or later) addresses and can pull the real name
+;; out where it's provided.
 (defun ps-article-author ()
   (save-excursion
     (save-restriction
diff --git a/lisp/recentf.el b/lisp/recentf.el
index e318486..9b70017 100644
--- a/lisp/recentf.el
+++ b/lisp/recentf.el
@@ -1,6 +1,6 @@
 ;;; recentf.el --- setup a menu of recently opened files
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <address@hidden>
 ;; Created: July 19 1999
diff --git a/lisp/rect.el b/lisp/rect.el
index 6b6906a..1790753 100644
--- a/lisp/rect.el
+++ b/lisp/rect.el
@@ -1,6 +1,6 @@
 ;;; rect.el --- rectangle functions for GNU Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1999-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: Didier Verna <address@hidden>
 ;; Keywords: internal
diff --git a/lisp/register.el b/lisp/register.el
index e25f9fd..775e1a2 100644
--- a/lisp/register.el
+++ b/lisp/register.el
@@ -1,6 +1,6 @@
 ;;; register.el --- register commands for Emacs      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 1985, 1993-1994, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1985, 1993-1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/registry.el b/lisp/registry.el
index c3184a8..8e2005b 100644
--- a/lisp/registry.el
+++ b/lisp/registry.el
@@ -1,6 +1,6 @@
 ;;; registry.el --- Track and remember data items by various fields
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Teodor Zlatanov <address@hidden>
 ;; Keywords: data
diff --git a/lisp/repeat.el b/lisp/repeat.el
index 578034f..8d902d9 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -1,6 +1,6 @@
 ;;; repeat.el --- convenient way to repeat the previous command  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Will Mengarini <address@hidden>
 ;; Created: Mo 02 Mar 98
diff --git a/lisp/replace.el b/lisp/replace.el
index ecb4793..318a9fb 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -1,6 +1,6 @@
 ;;; replace.el --- replace commands for Emacs -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1987, 1992, 1994, 1996-1997, 2000-2018 Free
+;; Copyright (C) 1985-1987, 1992, 1994, 1996-1997, 2000-2019 Free
 ;; Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -850,7 +850,6 @@ If nil, uses `regexp-history'."
 (defalias 'delete-matching-lines 'flush-lines)
 (defalias 'count-matches 'how-many)
 
-
 (defun keep-lines-read-args (prompt)
   "Read arguments for `keep-lines' and friends.
 Prompt for a regexp with PROMPT.
@@ -930,9 +929,8 @@ a previously found match."
   (set-marker rend nil)
   nil)
 
-
 (defun flush-lines (regexp &optional rstart rend interactive)
- "Delete lines containing matches for REGEXP.
+  "Delete lines containing matches for REGEXP.
 When called from Lisp (and usually when called interactively as
 well, see below), applies to the part of the buffer after point.
 The line point is in is deleted if and only if it contains a
@@ -953,7 +951,10 @@ a non-nil INTERACTIVE argument.
 
 If a match is split across lines, all the lines it lies in are deleted.
 They are deleted _before_ looking for the next match.  Hence, a match
-starting on the same line at which another match ended is ignored."
+starting on the same line at which another match ended is ignored.
+
+Return the number of deleted matching lines.  When called interactively,
+also print the number."
   (interactive
    (progn
      (barf-if-buffer-read-only)
@@ -968,7 +969,8 @@ starting on the same line at which another match ended is 
ignored."
       (setq rstart (point)
            rend (point-max-marker)))
     (goto-char rstart))
-  (let ((case-fold-search
+  (let ((count 0)
+        (case-fold-search
         (if (and case-fold-search search-upper-case)
             (isearch-no-upper-case-p regexp t)
           case-fold-search)))
@@ -978,10 +980,14 @@ starting on the same line at which another match ended is 
ignored."
        (delete-region (save-excursion (goto-char (match-beginning 0))
                                       (forward-line 0)
                                       (point))
-                      (progn (forward-line 1) (point))))))
-  (set-marker rend nil)
-  nil)
-
+                      (progn (forward-line 1) (point)))
+        (setq count (1+ count))))
+    (set-marker rend nil)
+    (when interactive (message (ngettext "Deleted %d matching line"
+                                        "Deleted %d matching lines"
+                                        count)
+                              count))
+    count))
 
 (defun how-many (regexp &optional rstart rend interactive)
   "Print and return number of matches for REGEXP following point.
@@ -1029,9 +1035,10 @@ a previously found match."
        (if (= opoint (point))
            (forward-char 1)
          (setq count (1+ count))))
-      (when interactive (message "%d occurrence%s"
-                                count
-                                (if (= count 1) "" "s")))
+      (when interactive (message (ngettext "%d occurrence"
+                                          "%d occurrences"
+                                          count)
+                                count))
       count)))
 
 
@@ -1614,11 +1621,12 @@ See also `multi-occur'."
                  (not (eq occur-excluded-properties t))))))
          (let* ((bufcount (length active-bufs))
                 (diff (- (length bufs) bufcount)))
-           (message "Searched %d buffer%s%s; %s match%s%s"
-                    bufcount (if (= bufcount 1) "" "s")
+           (message "Searched %d %s%s; %s %s%s"
+                    bufcount
+                    (ngettext "buffer" "buffers" bufcount)
                     (if (zerop diff) "" (format " (%d killed)" diff))
                     (if (zerop count) "no" (format "%d" count))
-                    (if (= count 1) "" "es")
+                    (ngettext "match" "matches" count)
                     ;; Don't display regexp if with remaining text
                     ;; it is longer than window-width.
                     (if (> (+ (length (or (get-text-property 0 'isearch-string 
regexp)
@@ -1657,7 +1665,10 @@ See also `multi-occur'."
                   (lines 0)               ; count of matching lines
                  (matches 0)             ; count of matches
                  (headerpt (with-current-buffer out-buf (point)))
-                  )
+                 (orig-line (if (not (overlayp boo))
+                                (line-number-at-pos)
+                              (line-number-at-pos
+                               (overlay-get boo 'occur--orig-point)))))
              (save-excursion
                 ;; begin searching in the buffer
                (goto-char (if (overlayp boo) (overlay-start boo) (point-min)))
@@ -1665,9 +1676,6 @@ See also `multi-occur'."
                (let* ((limit (if (overlayp boo) (overlay-end boo) (point-max)))
                        (start-line (line-number-at-pos))
                       (curr-line start-line) ; line count
-                      (orig-line (if (not (overlayp boo)) 1
-                                    (line-number-at-pos
-                                     (overlay-get boo 'occur--orig-point))))
                       (orig-line-shown-p)
                       (prev-line nil)        ; line number of prev match endpt
                       (prev-after-lines nil) ; context lines of prev match
@@ -1796,7 +1804,7 @@ See also `multi-occur'."
                                (setq orig-line-shown-p t)
                                (save-excursion
                                  (goto-char (point-min))
-                                 (forward-line (- orig-line start-line 1))
+                                 (forward-line (1- orig-line))
                                  (occur-engine-line (line-beginning-position)
                                                     (line-end-position) 
keep-props)))))
                        ;; Actually insert the match display data
@@ -1834,7 +1842,7 @@ See also `multi-occur'."
                    (let ((orig-line-str
                           (save-excursion
                             (goto-char (point-min))
-                            (forward-line (- orig-line start-line 1))
+                            (forward-line (1- orig-line))
                             (occur-engine-line (line-beginning-position)
                                                (line-end-position) 
keep-props))))
                      (add-face-text-property
@@ -1853,14 +1861,15 @@ See also `multi-occur'."
                  (let ((beg (point))
                        end)
                    (insert (propertize
-                            (format "%d match%s%s%s in buffer: %s%s\n"
-                                    matches (if (= matches 1) "" "es")
+                            (format "%d %s%s%s in buffer: %s%s\n"
+                                    matches
+                                    (ngettext "match" "matches" matches)
                                     ;; Don't display the same number of lines
                                     ;; and matches in case of 1 match per line.
                                     (if (= lines matches)
-                                        "" (format " in %d line%s"
+                                        "" (format " in %d %s"
                                                    lines
-                                                   (if (= lines 1) "" "s")))
+                                                   (ngettext "line" "lines" 
lines)))
                                     ;; Don't display regexp for multi-buffer.
                                     (if (> (length buffers) 1)
                                         "" (occur-regexp-descr regexp))
@@ -1886,13 +1895,15 @@ See also `multi-occur'."
        (goto-char (point-min))
        (let ((beg (point))
              end)
-         (insert (format "%d match%s%s total%s:\n"
-                         global-matches (if (= global-matches 1) "" "es")
+         (insert (format "%d %s%s total%s:\n"
+                         global-matches
+                         (ngettext "match" "matches" global-matches)
                          ;; Don't display the same number of lines
                          ;; and matches in case of 1 match per line.
                          (if (= global-lines global-matches)
-                             "" (format " in %d line%s"
-                                        global-lines (if (= global-lines 1) "" 
"s")))
+                             "" (format " in %d %s"
+                                        global-lines
+                                        (ngettext "line" "lines" 
global-lines)))
                          (occur-regexp-descr regexp)))
          (setq end (point))
          (when title-face
@@ -1907,10 +1918,8 @@ See also `multi-occur'."
       global-matches)))
 
 (defun occur-engine-line (beg end &optional keep-props)
-  (if (and keep-props (if (boundp 'jit-lock-mode) jit-lock-mode)
-          (text-property-not-all beg end 'fontified t))
-      (if (fboundp 'jit-lock-fontify-now)
-         (jit-lock-fontify-now beg end)))
+  (if (and keep-props font-lock-mode)
+      (font-lock-ensure beg end))
   (if (and keep-props (not (eq occur-excluded-properties t)))
       (let ((str (buffer-substring beg end)))
        (remove-list-of-text-properties
@@ -2729,10 +2738,10 @@ characters."
                                            (1+ num-replacements))))))
                              (when (and (eq def 'undo-all)
                                         (null (zerop num-replacements)))
-                               (message "Undid %d %s" num-replacements
-                                        (if (= num-replacements 1)
-                                            "replacement"
-                                          "replacements"))
+                               (message (ngettext "Undid %d replacement"
+                                                  "Undid %d replacements"
+                                                  num-replacements)
+                                        num-replacements)
                                (ding 'no-terminate)
                                (sit-for 1)))
                           (setq replaced nil last-was-undo t 
last-was-act-and-show nil)))
@@ -2858,9 +2867,10 @@ characters."
                       last-was-act-and-show     nil))))))
       (replace-dehighlight))
     (or unread-command-events
-       (message "Replaced %d occurrence%s%s"
+       (message (ngettext "Replaced %d occurrence%s"
+                          "Replaced %d occurrences%s"
+                          replace-count)
                 replace-count
-                (if (= replace-count 1) "" "s")
                 (if (> (+ skip-read-only-count
                           skip-filtered-count
                           skip-invisible-count)
diff --git a/lisp/reposition.el b/lisp/reposition.el
index 146fa9a..22f9986 100644
--- a/lisp/reposition.el
+++ b/lisp/reposition.el
@@ -1,6 +1,6 @@
 ;;; reposition.el --- center a Lisp function or comment on the screen
 
-;; Copyright (C) 1991, 1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael D. Ernst <address@hidden>
 ;; Created: Jan 1991
diff --git a/lisp/reveal.el b/lisp/reveal.el
index a3ecfc4..67740c8 100644
--- a/lisp/reveal.el
+++ b/lisp/reveal.el
@@ -1,6 +1,6 @@
 ;;; reveal.el --- Automatically reveal hidden text at point -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: outlines
diff --git a/lisp/rfn-eshadow.el b/lisp/rfn-eshadow.el
index d6e9a1e..d0a022a 100644
--- a/lisp/rfn-eshadow.el
+++ b/lisp/rfn-eshadow.el
@@ -1,6 +1,6 @@
 ;;; rfn-eshadow.el --- Highlight `shadowed' part of read-file-name input text
 ;;
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Miles Bader <address@hidden>
 ;; Keywords: convenience minibuffer
diff --git a/lisp/rot13.el b/lisp/rot13.el
index c1de71f..8f4044d 100644
--- a/lisp/rot13.el
+++ b/lisp/rot13.el
@@ -1,6 +1,6 @@
 ;;; rot13.el --- display a buffer in ROT13  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1988, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Howard Gayle
 ;; Maintainer: address@hidden
diff --git a/lisp/rtree.el b/lisp/rtree.el
index ee2fca6..9a0a649 100644
--- a/lisp/rtree.el
+++ b/lisp/rtree.el
@@ -1,6 +1,6 @@
 ;;; rtree.el --- functions for manipulating range trees  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 
@@ -44,7 +44,7 @@
 ;;; Code:
 
 (defmacro rtree-make-node ()
-  `(list (list nil) nil))
+  '(list (list nil) nil))
 
 (defmacro rtree-set-left (node left)
   `(setcar (cdr ,node) ,left))
diff --git a/lisp/ruler-mode.el b/lisp/ruler-mode.el
index 366bd15..c5c88d0 100644
--- a/lisp/ruler-mode.el
+++ b/lisp/ruler-mode.el
@@ -1,6 +1,6 @@
 ;;; ruler-mode.el --- display a ruler in the header line
 
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <address@hidden>
 ;; Maintainer: David Ponce <address@hidden>
@@ -613,7 +613,7 @@ format first."
 
 ;; Add ruler-mode to the minor mode menu in the mode line
 (define-key mode-line-mode-menu [ruler-mode]
-  `(menu-item "Ruler" ruler-mode
+  '(menu-item "Ruler" ruler-mode
               :button (:toggle . ruler-mode)))
 
 (defconst ruler-mode-ruler-help-echo
diff --git a/lisp/savehist.el b/lisp/savehist.el
index 329929b..1eab18e 100644
--- a/lisp/savehist.el
+++ b/lisp/savehist.el
@@ -1,6 +1,6 @@
 ;;; savehist.el --- Save minibuffer history
 
-;; Copyright (C) 1997, 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Hrvoje Niksic <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/saveplace.el b/lisp/saveplace.el
index f8f15ca..730d31e 100644
--- a/lisp/saveplace.el
+++ b/lisp/saveplace.el
@@ -1,6 +1,6 @@
 ;;; saveplace.el --- automatically save place in files
 
-;; Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Karl Fogel <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/sb-image.el b/lisp/sb-image.el
index f467948..f44f2ed 100644
--- a/lisp/sb-image.el
+++ b/lisp/sb-image.el
@@ -1,6 +1,6 @@
 ;;; sb-image --- Image management for speedbar
 
-;; Copyright (C) 1999-2003, 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2003, 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: file, tags, tools
diff --git a/lisp/scroll-all.el b/lisp/scroll-all.el
index c32960e..78a05b5 100644
--- a/lisp/scroll-all.el
+++ b/lisp/scroll-all.el
@@ -1,6 +1,6 @@
 ;;; scroll-all.el --- scroll all buffers together minor mode
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Gary D. Foster <address@hidden>
 ;; Keywords: convenience scroll lock
diff --git a/lisp/scroll-bar.el b/lisp/scroll-bar.el
index 7efbfc7..dc0df7a 100644
--- a/lisp/scroll-bar.el
+++ b/lisp/scroll-bar.el
@@ -1,6 +1,6 @@
 ;;; scroll-bar.el --- window system-independent scroll bar support
 
-;; Copyright (C) 1993-1995, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1995, 1999-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: hardware
diff --git a/lisp/scroll-lock.el b/lisp/scroll-lock.el
index 123fbb2..8281edb 100644
--- a/lisp/scroll-lock.el
+++ b/lisp/scroll-lock.el
@@ -1,6 +1,6 @@
 ;;; scroll-lock.el --- Scroll lock scrolling.
 
-;; Copyright (C) 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Ralf Angeli <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/select.el b/lisp/select.el
index bd7fd0c..c79e923 100644
--- a/lisp/select.el
+++ b/lisp/select.el
@@ -1,6 +1,6 @@
 ;;; select.el --- lisp portion of standard selection support  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: internal
diff --git a/lisp/server.el b/lisp/server.el
index d0a8ca3..c38fdf8 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -1,6 +1,6 @@
 ;;; server.el --- Lisp code for GNU Emacs running as server process -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1986-1987, 1992, 1994-2018 Free Software Foundation,
+;; Copyright (C) 1986-1987, 1992, 1994-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: William Sommerfeld <address@hidden>
@@ -270,7 +270,14 @@ been consumed.")
     "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."
+changed while a server is running.
+If this is a file name with no leading directories, Emacs will
+create a socket file by that name under `server-socket-dir'
+if `server-use-tcp' is nil, else under `server-auth-dir'.
+If this is an absolute file name, it specifies where the socket
+file will be created.  To have emacsclient connect to the same
+socket, use the \"-s\" switch for local non-TCP sockets, and
+the \"-f\" switch otherwise."
   :group 'server
   :type 'string
   :version "23.1")
@@ -281,7 +288,10 @@ changed while a server is running."
   (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))))
+        (let ((xdg_runtime_dir (getenv "XDG_RUNTIME_DIR")))
+          (if xdg_runtime_dir
+              (format "%s/emacs" xdg_runtime_dir)
+            (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.")
 
@@ -1734,7 +1744,7 @@ returns the process ID of the Emacs instance running 
\"server\"."
                                   (server-quote-arg (format "%S" form))
                                   "\n"))
       (while (memq (process-status process) '(open run))
-       (accept-process-output process 0 10))
+       (accept-process-output process 0.01))
       (goto-char (point-min))
       ;; If the result is nil, there's nothing in the buffer.  If the
       ;; result is non-nil, it's after "-print ".
diff --git a/lisp/ses.el b/lisp/ses.el
index bcf8bdb..73157d6 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -1,6 +1,6 @@
 ;;; ses.el -- Simple Emacs Spreadsheet  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Jonathan Yavner <address@hidden>
 ;; Maintainer: Vincent Belaïche  <address@hidden>
@@ -837,7 +837,7 @@ updated again."
 (defmacro ses--time-check (format &rest args)
   "If `ses-start-time' is more than a second ago, call `message' with FORMAT
 and ARGS and reset `ses-start-time' to the current time."
-  `(when (> (- (float-time) ses-start-time) 1.0)
+  `(when (time-less-p 1 (time-since ses-start-time))
      (message ,format ,@args)
      (setq ses-start-time (float-time))))
 
@@ -858,7 +858,7 @@ cell (ROW,COL).  This is undoable.  The cell's data will be 
updated through
              ,(let ((field (progn (cl-assert (eq (car field) 'quote))
                                   (cadr field))))
                 (if (eq field 'value)
-                    `(ses-set-with-undo (ses-cell-symbol cell) val)
+                    '(ses-set-with-undo (ses-cell-symbol cell) val)
                   ;; (let* ((slots (get 'ses-cell 'cl-struct-slots))
                   ;;        (slot (or (assq field slots)
                   ;;                  (error "Unknown field %S" field)))
@@ -3956,17 +3956,17 @@ Use `math-format-value' as a printer for Calc objects."
     (while rest
       (let ((x (pop rest)))
        (pcase x
-         (`>v (setq transpose nil reorient-x nil reorient-y nil))
-         (`>^ (setq transpose nil reorient-x nil reorient-y t))
-         (`<^ (setq transpose nil reorient-x t reorient-y t))
-         (`<v (setq transpose nil reorient-x t reorient-y nil))
-         (`v> (setq transpose t reorient-x nil reorient-y t))
-         (`^> (setq transpose t reorient-x nil reorient-y nil))
-         (`^< (setq transpose t reorient-x t reorient-y nil))
-         (`v< (setq transpose t reorient-x t reorient-y t))
-         ((or `* `*2 `*1) (setq vectorize x))
-         (`! (setq clean 'ses--clean-!))
-         (`_ (setq clean `(lambda (&rest x)
+         ('>v (setq transpose nil reorient-x nil reorient-y nil))
+         ('>^ (setq transpose nil reorient-x nil reorient-y t))
+         ('<^ (setq transpose nil reorient-x t reorient-y t))
+         ('<v (setq transpose nil reorient-x t reorient-y nil))
+         ('v> (setq transpose t reorient-x nil reorient-y t))
+         ('^> (setq transpose t reorient-x nil reorient-y nil))
+         ('^< (setq transpose t reorient-x t reorient-y nil))
+         ('v< (setq transpose t reorient-x t reorient-y t))
+         ((or '* '*2 '*1) (setq vectorize x))
+         ('! (setq clean 'ses--clean-!))
+         ('_ (setq clean `(lambda (&rest x)
                              (ses--clean-_  x ,(if rest (pop rest) 0)))))
          (_
           (cond
@@ -4001,10 +4001,10 @@ Use `math-format-value' as a printer for Calc objects."
                                            (cons  clean (cons (quote 'vec) x)))
                                          result)))))
       (pcase vectorize
-       (`nil (cons clean (apply #'append result)))
-       (`*1 (vectorize-*1 clean result))
-       (`*2 (vectorize-*2 clean result))
-       (`* (funcall (if (cdr result)
+       ('nil (cons clean (apply #'append result)))
+       ('*1 (vectorize-*1 clean result))
+       ('*2 (vectorize-*2 clean result))
+       ('* (funcall (if (cdr result)
                          #'vectorize-*2
                        #'vectorize-*1)
                      clean result))))))
diff --git a/lisp/shadowfile.el b/lisp/shadowfile.el
index 180d502..07e7850 100644
--- a/lisp/shadowfile.el
+++ b/lisp/shadowfile.el
@@ -1,6 +1,6 @@
 ;;; shadowfile.el --- automatic file copying
 
-;; Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <address@hidden>
 ;; Keywords: comm files
diff --git a/lisp/shell.el b/lisp/shell.el
index ac6f11a..5357027 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -1,6 +1,6 @@
 ;;; shell.el --- specialized comint.el for running the shell -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1988, 1993-1997, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1988, 1993-1997, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Olin Shivers <address@hidden>
@@ -99,6 +99,7 @@
 
 (require 'comint)
 (require 'pcomplete)
+(eval-when-compile (require 'files-x)) ;with-connection-local-variables
 
 ;;; Customization and Buffer Variables
 
@@ -426,7 +427,7 @@ Thus, this does not include the shell's current directory.")
           (while (looking-at
                   (eval-when-compile
                     (concat
-                     "\\(?:[^\s\t\n\\\"']+"
+                     "\\(?:[^\s\t\n\\\"';]+"
                      "\\|'\\([^']*\\)'?"
                      "\\|\"\\(\\(?:[^\"\\]\\|\\\\.\\)*\\)\"?"
                      "\\|\\\\\\(\\(?:.\\|\n\\)?\\)\\)")))
@@ -487,10 +488,10 @@ Shell buffers.  It implements `shell-completion-execonly' 
for
   ;; Don't use pcomplete's defaulting mechanism, rely on
   ;; shell-dynamic-complete-functions instead.
   (set (make-local-variable 'pcomplete-default-completion-function) #'ignore)
-  (setq comint-input-autoexpand shell-input-autoexpand)
+  (setq-local comint-input-autoexpand shell-input-autoexpand)
   ;; Not needed in shell-mode because it's inherited from comint-mode, but
   ;; placed here for read-shell-command.
-  (add-hook 'completion-at-point-functions 'comint-completion-at-point nil t))
+  (add-hook 'completion-at-point-functions #'comint-completion-at-point nil t))
 
 (put 'shell-mode 'mode-class 'special)
 
@@ -606,7 +607,7 @@ buffer."
       ;; Bypass a bug in certain versions of bash.
       (when (string-equal shell "bash")
         (add-hook 'comint-preoutput-filter-functions
-                  'shell-filter-ctrl-a-ctrl-b nil t)))
+                  #'shell-filter-ctrl-a-ctrl-b nil t)))
     (comint-read-input-ring t)))
 
 (defun shell-apply-ansi-color (beg end face)
@@ -720,43 +721,37 @@ Otherwise, one argument `-i' is passed to the shell.
                  (current-buffer)))
 
   (with-current-buffer buffer
-    (when (file-remote-p default-directory)
-      ;; Apply connection-local variables.
-      (hack-connection-local-variables-apply
-       `(:application tramp
-         :protocol ,(file-remote-p default-directory 'method)
-         :user ,(file-remote-p default-directory 'user)
-         :machine ,(file-remote-p default-directory 'host)))
-
-      ;; On remote hosts, the local `shell-file-name' might be useless.
-      (if (and (called-interactively-p 'any)
-               (null explicit-shell-file-name)
-               (null (getenv "ESHELL")))
-          (set (make-local-variable 'explicit-shell-file-name)
-               (file-local-name
-               (expand-file-name
-                 (read-file-name
-                  "Remote shell path: " default-directory shell-file-name
-                  t shell-file-name)))))))
-
-  ;; The buffer's window must be correctly set when we call comint
-  ;; (so that comint sets the COLUMNS env var properly).
-  (pop-to-buffer buffer)
-  ;; Rain or shine, BUFFER must be current by now.
-  (unless (comint-check-proc buffer)
-    (let* ((prog (or explicit-shell-file-name
-                     (getenv "ESHELL") shell-file-name))
-           (name (file-name-nondirectory prog))
-           (startfile (concat "~/.emacs_" name))
-           (xargs-name (intern-soft (concat "explicit-" name "-args"))))
-      (unless (file-exists-p startfile)
-        (setq startfile (concat user-emacs-directory "init_" name ".sh")))
-      (apply 'make-comint-in-buffer "shell" buffer prog
-             (if (file-exists-p startfile) startfile)
-             (if (and xargs-name (boundp xargs-name))
-                 (symbol-value xargs-name)
-               '("-i")))
-      (shell-mode)))
+    (with-connection-local-variables
+     ;; On remote hosts, the local `shell-file-name' might be useless.
+     (when (file-remote-p default-directory)
+       (if (and (called-interactively-p 'any)
+                (null explicit-shell-file-name)
+                (null (getenv "ESHELL")))
+           (set (make-local-variable 'explicit-shell-file-name)
+                (file-local-name
+                (expand-file-name
+                  (read-file-name
+                   "Remote shell path: " default-directory shell-file-name
+                   t shell-file-name))))))
+
+     ;; The buffer's window must be correctly set when we call comint
+     ;; (so that comint sets the COLUMNS env var properly).
+     (pop-to-buffer buffer)
+     ;; Rain or shine, BUFFER must be current by now.
+     (unless (comint-check-proc buffer)
+       (let* ((prog (or explicit-shell-file-name
+                        (getenv "ESHELL") shell-file-name))
+              (name (file-name-nondirectory prog))
+              (startfile (concat "~/.emacs_" name))
+              (xargs-name (intern-soft (concat "explicit-" name "-args"))))
+         (unless (file-exists-p startfile)
+           (setq startfile (concat user-emacs-directory "init_" name ".sh")))
+         (apply #'make-comint-in-buffer "shell" buffer prog
+                (if (file-exists-p startfile) startfile)
+                (if (and xargs-name (boundp xargs-name))
+                    (symbol-value xargs-name)
+                  '("-i")))
+         (shell-mode)))))
   buffer)
 
 ;;; Directory tracking
@@ -973,10 +968,10 @@ this feature; see the function `dirtrack-mode'."
   nil nil nil
   (setq list-buffers-directory (if shell-dirtrack-mode default-directory))
   (if shell-dirtrack-mode
-      (add-hook 'comint-input-filter-functions 'shell-directory-tracker nil t)
-    (remove-hook 'comint-input-filter-functions 'shell-directory-tracker t)))
+      (add-hook 'comint-input-filter-functions #'shell-directory-tracker nil t)
+    (remove-hook 'comint-input-filter-functions #'shell-directory-tracker t)))
 
-(define-obsolete-function-alias 'shell-dirtrack-toggle 'shell-dirtrack-mode
+(define-obsolete-function-alias 'shell-dirtrack-toggle #'shell-dirtrack-mode
   "23.1")
 
 (defun shell-cd (dir)
diff --git a/lisp/simple.el b/lisp/simple.el
index 2456755..f76f31a 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1,6 +1,6 @@
 ;;; simple.el --- basic editing commands for Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1987, 1993-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1987, 1993-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: internal
@@ -383,13 +383,11 @@ backwards, if negative).
 Finds and highlights the source line like \\[next-error], but does not
 select the source buffer."
   (interactive "p")
-  (let ((next-error-highlight next-error-highlight-no-select))
-    (next-error n))
-  (let ((display-buffer-overriding-action '(display-buffer-reuse-window)))
-    ;; Override user customization such as display-buffer-same-window
-    ;; and use display-buffer-reuse-window to ensure next-error-last-buffer
-    ;; is displayed somewhere, not necessarily in the same window (bug#32607).
-    (pop-to-buffer next-error-last-buffer)))
+  (save-selected-window
+    (let ((next-error-highlight next-error-highlight-no-select)
+          (display-buffer-overriding-action
+           '(nil (inhibit-same-window . t))))
+      (next-error n))))
 
 (defun previous-error-no-select (&optional n)
   "Move point to the previous error in the `next-error' buffer and highlight 
match.
@@ -595,25 +593,35 @@ When called from Lisp code, ARG may be a prefix string to 
copy."
     (indent-to col 0)
     (goto-char pos)))
 
-(defun delete-indentation (&optional arg)
+(defun delete-indentation (&optional arg beg end)
   "Join this line to previous and fix up whitespace at join.
-If there is a fill prefix, delete it from the beginning of this line.
-With argument, join this line to following line."
-  (interactive "*P")
+If there is a fill prefix, delete it from the beginning of this
+line.
+With prefix ARG, join the current line to the following line.
+If the region is active, join all the lines in the region.  (The
+region is ignored if prefix argument is given.)"
+  (interactive "*P\nr")
+  (if arg (forward-line 1)
+    (if (use-region-p)
+       (goto-char end)))
   (beginning-of-line)
-  (if arg (forward-line 1))
-  (if (eq (preceding-char) ?\n)
-      (progn
-       (delete-region (point) (1- (point)))
-       ;; If the second line started with the fill prefix,
-       ;; delete the prefix.
-       (if (and fill-prefix
-                (<= (+ (point) (length fill-prefix)) (point-max))
-                (string= fill-prefix
-                         (buffer-substring (point)
-                                           (+ (point) (length fill-prefix)))))
-           (delete-region (point) (+ (point) (length fill-prefix))))
-       (fixup-whitespace))))
+  (while (eq (preceding-char) ?\n)
+    (progn
+      (delete-region (point) (1- (point)))
+      ;; If the second line started with the fill prefix,
+      ;; delete the prefix.
+      (if (and fill-prefix
+              (<= (+ (point) (length fill-prefix)) (point-max))
+              (string= fill-prefix
+                       (buffer-substring (point)
+                                         (+ (point) (length fill-prefix)))))
+         (delete-region (point) (+ (point) (length fill-prefix))))
+      (fixup-whitespace)
+      (if (and (use-region-p)
+               beg
+               (not arg)
+              (< beg (point-at-bol)))
+         (beginning-of-line)))))
 
 (defalias 'join-line #'delete-indentation) ; easier to find
 
@@ -1615,7 +1623,7 @@ this command arranges for all errors to enter the 
debugger."
          (eval-expression-get-print-arguments current-prefix-arg)))
 
   (if (null eval-expression-debug-on-error)
-      (push (eval exp lexical-binding) values)
+      (push (eval (macroexpand-all exp) lexical-binding) values)
     (let ((old-value (make-symbol "t")) new-value)
       ;; Bind debug-on-error to something unique so that we can
       ;; detect when evalled code changes it.
@@ -1841,9 +1849,11 @@ invoking, give a prefix argument to 
`execute-extended-command'."
             ;; If this command displayed something in the echo area;
             ;; wait a few seconds, then display our suggestion message.
             ;; FIXME: Wait *after* running post-command-hook!
-            ;; FIXME: Don't wait if execute-extended-command--shorter won't
-            ;; find a better answer anyway!
-            (when suggest-key-bindings
+            ;; FIXME: If execute-extended-command--shorter were
+            ;; faster, we could compute the result here first too.
+            (when (and suggest-key-bindings
+                       (or binding
+                           (and extended-command-suggest-shorter typed)))
               (sit-for (cond
                         ((zerop (length (current-message))) 0)
                         ((numberp suggest-key-bindings) suggest-key-bindings)
@@ -2172,7 +2182,11 @@ next element of the minibuffer history in the 
minibuffer."
         (prompt-end (minibuffer-prompt-end))
         (old-column (unless (and (eolp) (> (point) prompt-end))
                       (if (= (line-number-at-pos) 1)
-                          (max (- (current-column) (1- prompt-end)) 0)
+                          (max (- (current-column)
+                                  (save-excursion
+                                    (goto-char (1- prompt-end))
+                                    (current-column)))
+                               0)
                         (current-column)))))
     (condition-case nil
        (with-no-warnings
@@ -2191,7 +2205,10 @@ next element of the minibuffer history in the 
minibuffer."
        (goto-char (point-max))
        (when old-column
         (if (= (line-number-at-pos) 1)
-            (move-to-column (+ old-column (1- (minibuffer-prompt-end))))
+            (move-to-column (+ old-column
+                               (save-excursion
+                                 (goto-char (1- (minibuffer-prompt-end)))
+                                 (current-column))))
           (move-to-column old-column)))))))
 
 (defun previous-line-or-history-element (&optional arg)
@@ -2206,7 +2223,11 @@ previous element of the minibuffer history in the 
minibuffer."
         (prompt-end (minibuffer-prompt-end))
         (old-column (unless (and (eolp) (> (point) prompt-end))
                       (if (= (line-number-at-pos) 1)
-                          (max (- (current-column) (1- prompt-end)) 0)
+                          (max (- (current-column)
+                                  (save-excursion
+                                    (goto-char (1- prompt-end))
+                                    (current-column)))
+                               0)
                         (current-column)))))
     (condition-case nil
        (with-no-warnings
@@ -2225,7 +2246,10 @@ previous element of the minibuffer history in the 
minibuffer."
        (goto-char (minibuffer-prompt-end))
        (if old-column
           (if (= (line-number-at-pos) 1)
-              (move-to-column (+ old-column (1- (minibuffer-prompt-end))))
+              (move-to-column (+ old-column
+                                 (save-excursion
+                                   (goto-char (1- (minibuffer-prompt-end)))
+                                   (current-column))))
             (move-to-column old-column))
         ;; Put the cursor at the end of the visual line instead of the
         ;; logical line, so the next `previous-line-or-history-element'
@@ -3878,18 +3902,21 @@ interactively, this is t."
       (shell-command command t))))
 
 (defun process-file (program &optional infile buffer display &rest args)
-  "Process files synchronously in a separate process.
-Similar to `call-process', but may invoke a file handler based on
+  "Process files synchronously in a separate process that runs PROGRAM.
+Similar to `call-process', but may invoke a file name handler based on
 `default-directory'.  The current working directory of the
 subprocess is `default-directory'.
 
+If PROGRAM is a remote file name, it should be processed
+by `file-local-name' before passing it to this function.
+
 File names in INFILE and BUFFER are handled normally, but file
 names in ARGS should be relative to `default-directory', as they
 are passed to the process verbatim.  (This is a difference to
-`call-process' which does not support file handlers for INFILE
+`call-process' which does not support file name handlers for INFILE
 and BUFFER.)
 
-Some file handlers might not support all variants, for example
+Some file name handlers might not support all variants, for example
 they might behave as if DISPLAY was nil, regardless of the actual
 value passed."
   (let ((fh (find-file-name-handler default-directory 'process-file))
@@ -3913,7 +3940,7 @@ value passed."
 
 By default, this variable is always set to t, meaning that a
 call of `process-file' could potentially change any file on a
-remote host.  When set to nil, a file handler could optimize
+remote host.  When set to nil, a file name handler could optimize
 its behavior with respect to remote file attribute caching.
 
 You should only ever change this variable with a let-binding;
@@ -3922,17 +3949,20 @@ never with `setq'.")
 (defun start-file-process (name buffer program &rest program-args)
   "Start a program in a subprocess.  Return the process object for it.
 
-Similar to `start-process', but may invoke a file handler based on
+Similar to `start-process', but may invoke a file name handler based on
 `default-directory'.  See Info node `(elisp)Magic File Names'.
 
 This handler ought to run PROGRAM, perhaps on the local host,
 perhaps on a remote host that corresponds to `default-directory'.
-In the latter case, the local part of `default-directory' becomes
-the working directory of the process.
+In the latter case, the local part of `default-directory', the one
+produced from it by `file-local-name', becomes the working directory
+of the process on the remote host.
 
 PROGRAM and PROGRAM-ARGS might be file names.  They are not
-objects of file handler invocation.  File handlers might not
-support pty association, if PROGRAM is nil."
+objects of file name handler invocation, so they need to be obtained
+by calling `file-local-name', in case they are remote file names.
+
+File name handlers might not support pty association, if PROGRAM is nil."
   (let ((fh (find-file-name-handler default-directory 'start-file-process)))
     (if fh (apply fh 'start-file-process name buffer program program-args)
       (apply 'start-process name buffer program program-args))))
@@ -4006,7 +4036,9 @@ Also, delete any process that is exited or signaled."
                  (tty (or (process-tty-name p) "--"))
                  (thread
                    (cond
-                    ((null (process-thread p)) "--")
+                    ((or
+                      (null (process-thread p))
+                      (not (fboundp 'thread-name))) "--")
                     ((eq (process-thread p) main-thread) "Main")
                     ((thread-name (process-thread p)))))
                  (cmd
@@ -4118,7 +4150,7 @@ Runs `prefix-command-preserve-state-hook'."
   (when prefix-arg
     (concat "C-u"
             (pcase prefix-arg
-              (`(-) " -")
+              ('(-) " -")
               (`(,(and (pred integerp) n))
                (let ((str ""))
                  (while (and (> n 4) (= (mod n 4) 0))
@@ -7812,7 +7844,7 @@ appears to have customizations applying to the old 
default,
   "If the buffer starts with a mail header, move point to the header's end.
 Otherwise, moves to `point-min'.
 The end of the header is the start of the next line, if there is one,
-else the end of the last line.  This function obeys RFC822."
+else the end of the last line.  This function obeys RFC 822 (or later)."
   (goto-char (point-min))
   (when (re-search-forward
         "^\\([:\n]\\|[^: \t\n]+[ \t\n]\\)" nil 'move)
@@ -8699,7 +8731,7 @@ See also `normal-erase-is-backspace'."
     (cond ((or (memq window-system '(x w32 ns pc))
               (memq system-type '(ms-dos windows-nt)))
           (let ((bindings
-                 `(([M-delete] [M-backspace])
+                 '(([M-delete] [M-backspace])
                    ([C-M-delete] [C-M-backspace])
                    ([?\e C-delete] [?\e C-backspace]))))
 
diff --git a/lisp/skeleton.el b/lisp/skeleton.el
index e7ac2ea..bce73d6 100644
--- a/lisp/skeleton.el
+++ b/lisp/skeleton.el
@@ -1,6 +1,6 @@
 ;;; skeleton.el --- Lisp language extension for writing statement skeletons
 
-;; Copyright (C) 1993-1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pfeiffer <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/sort.el b/lisp/sort.el
index 3929f19..6ea1c44 100644
--- a/lisp/sort.el
+++ b/lisp/sort.el
@@ -1,6 +1,6 @@
 ;;; sort.el --- commands to sort text in an Emacs buffer -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 1986-1987, 1994-1995, 2001-2018 Free Software
+;; Copyright (C) 1986-1987, 1994-1995, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Howie Kaye
diff --git a/lisp/soundex.el b/lisp/soundex.el
index 036ce5c..1f1f9ca 100644
--- a/lisp/soundex.el
+++ b/lisp/soundex.el
@@ -1,6 +1,6 @@
 ;;; soundex.el --- implement Soundex algorithm -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Christian Plaunt <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index f3ea048..4823e4b 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -1,6 +1,6 @@
 ;;; speedbar --- quick access to files and tags in a frame
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 ;; Keywords: file, tags, tools
@@ -647,9 +647,9 @@ speedbar is loaded.  You may place anything you like in 
this list
 before speedbar has been loaded."
   :group 'speedbar
   :type '(repeat (regexp :tag "Directory Regexp"))
-  :set (lambda (_sym val)
-        (setq speedbar-ignored-directory-expressions val
-              speedbar-ignored-directory-regexp
+  :set (lambda (sym val)
+        (set sym val)
+         (setq speedbar-ignored-directory-regexp
               (speedbar-extension-list-to-regex val))))
 
 (defcustom speedbar-directory-unshown-regexp "^\\(\\..*\\)\\'"
@@ -701,9 +701,9 @@ need to also modify `completion-ignored-extension' which 
will also help
 file completion."
   :group 'speedbar
   :type '(repeat (regexp :tag "Extension Regexp"))
-  :set (lambda (_sym val)
-        (set 'speedbar-supported-extension-expressions val)
-        (set 'speedbar-file-regexp (speedbar-extension-list-to-regex val))))
+  :set (lambda (sym val)
+        (set sym val)
+        (setq speedbar-file-regexp (speedbar-extension-list-to-regex val))))
 
 (setq speedbar-file-regexp
       (speedbar-extension-list-to-regex 
speedbar-supported-extension-expressions))
@@ -972,9 +972,8 @@ supported at a time.
   (interactive "P")
   ;; Get the buffer to play with
   (if (not (buffer-live-p speedbar-buffer))
-      (save-excursion
-       (setq speedbar-buffer (get-buffer-create " SPEEDBAR"))
-       (set-buffer speedbar-buffer)
+      (with-current-buffer
+          (setq speedbar-buffer (get-buffer-create " SPEEDBAR"))
        (speedbar-mode)))
   ;; Do the frame thing
   (dframe-frame-mode arg
@@ -1476,57 +1475,59 @@ instead of reading it from the speedbar buffer."
 Return nil if not applicable."
   (save-excursion
     (beginning-of-line)
-    (if (re-search-forward " [-+=]?> \\([^\n]+\\)" (line-end-position) t)
-       (let* ((tag (match-string 1))
-             (attr (speedbar-line-token))
-             (item nil)
-             (semantic-tagged (if (fboundp 'semantic-tag-p)
-                                  (semantic-tag-p attr))))
-         (if semantic-tagged
-           (with-no-warnings
-             (save-excursion
-               (when (and (semantic-tag-overlay attr)
-                          (semantic-tag-buffer attr))
-                 (set-buffer (semantic-tag-buffer attr)))
-               (dframe-message
-                (funcall semantic-sb-info-format-tag-function attr)
-                )))
-           (looking-at "\\([0-9]+\\):")
-           (setq item (file-name-nondirectory (speedbar-line-directory)))
-           (dframe-message "Tag: %s  in %s" tag item)))
-      (if (re-search-forward "{[+-]} \\([^\n]+\\)$" (line-end-position) t)
-         (dframe-message "Group of tags \"%s\"" (match-string 1))
-       (if (re-search-forward " [+-]?[()|@] \\([^\n]+\\)$" nil t)
-           (let* ((detailtext (match-string 1))
-                  (detail (or (speedbar-line-token) detailtext))
-                  (parent (save-excursion
-                            (beginning-of-line)
-                            (let ((dep (if (looking-at "[0-9]+:")
-                                           (1- (string-to-number (match-string 
0)))
-                                         0)))
-                              (re-search-backward (concat "^"
-                              (int-to-string dep)
-                              ":")
-                                                  nil t))
-                            (if (looking-at "[0-9]+: +[-+=>]> \\([^\n]+\\)$")
-                                (speedbar-line-token)
-                              nil))))
-             (if (featurep 'semantic)
-                 (with-no-warnings
-                   (if (semantic-tag-p detail)
-                       (dframe-message
-                        (funcall semantic-sb-info-format-tag-function detail 
parent))
-                     (if parent
-                         (dframe-message "Detail: %s of tag %s" detail
-                                           (if (semantic-tag-p parent)
-                                               (semantic-format-tag-name 
parent nil t)
-                                             parent))
-                       (dframe-message "Detail: %s" detail))))
-               ;; Not using `semantic':
-               (if parent
-                   (dframe-message "Detail: %s of tag %s" detail parent)
-                 (dframe-message "Detail: %s" detail))))
-         nil)))))
+    (cond
+     ((re-search-forward " [-+=]?> \\([^\n]+\\)" (line-end-position) t)
+      (let* ((tag (match-string 1))
+             (attr (speedbar-line-token))
+             (item nil)
+             (semantic-tagged (if (fboundp 'semantic-tag-p)
+                                  (semantic-tag-p attr))))
+        (if semantic-tagged
+            (with-no-warnings
+              (save-excursion
+                (when (and (semantic-tag-overlay attr)
+                           (semantic-tag-buffer attr))
+                  (set-buffer (semantic-tag-buffer attr)))
+                (dframe-message
+                 (funcall semantic-sb-info-format-tag-function attr)
+                 )))
+          (looking-at "\\([0-9]+\\):")
+          (setq item (file-name-nondirectory (speedbar-line-directory)))
+          (dframe-message "Tag: %s  in %s" tag item))))
+     ((re-search-forward "{[+-]} \\([^\n]+\\)$" (line-end-position) t)
+      (dframe-message "Group of tags \"%s\"" (match-string 1)))
+     ((re-search-forward " [+-]?[()|@] \\([^\n]+\\)$" nil t)
+      (let* ((detailtext (match-string 1))
+             (detail (or (speedbar-line-token) detailtext))
+             (parent (save-excursion
+                       (beginning-of-line)
+                       (let ((dep (if (looking-at "[0-9]+:")
+                                      (1- (string-to-number (match-string 0)))
+                                    0)))
+                         (re-search-backward (concat "^"
+                                                     (int-to-string dep)
+                                                     ":")
+                                             nil t))
+                       (if (looking-at "[0-9]+: +[-+=>]> \\([^\n]+\\)$")
+                           (speedbar-line-token)
+                         nil))))
+        (cond
+         ((featurep 'semantic)
+          (with-no-warnings
+            (if (semantic-tag-p detail)
+                (dframe-message
+                 (funcall semantic-sb-info-format-tag-function detail parent))
+              (if parent
+                  (dframe-message "Detail: %s of tag %s" detail
+                                  (if (semantic-tag-p parent)
+                                      (semantic-format-tag-name parent nil t)
+                                    parent))
+                (dframe-message "Detail: %s" detail)))))
+         ;; Not using `semantic':
+         (parent
+          (dframe-message "Detail: %s of tag %s" detail parent))
+         (t
+          (dframe-message "Detail: %s" detail))))))))
 
 (defun speedbar-files-item-info ()
   "Display info in the minibuffer about the button the mouse is over."
@@ -2848,7 +2849,7 @@ indicator, then do not add a space."
        (progn
          (goto-char speedbar-ro-to-do-point)
          (while (and (not (input-pending-p))
-                     (re-search-forward "^\\([0-9]+\\):\\s-*[[<][+-?][]>] "
+                     (re-search-forward "^\\([0-9]+\\):\\s-*[[<][+?-][]>] "
                                         nil t))
            (setq speedbar-ro-to-do-point (point))
            (let ((f (speedbar-line-file)))
@@ -2899,7 +2900,7 @@ to add more types of version control systems."
        (progn
          (goto-char speedbar-vc-to-do-point)
          (while (and (not (input-pending-p))
-                     (re-search-forward "^\\([0-9]+\\):\\s-*\\[[+-?]\\] "
+                     (re-search-forward "^\\([0-9]+\\):\\s-*\\[[+?-]\\] "
                                         nil t))
            (setq speedbar-vc-to-do-point (point))
            (if (speedbar-check-vc-this-line (match-string 1))
@@ -3353,7 +3354,7 @@ Handles end-of-sublist smartly."
 Clicking this button expands or contracts a directory.  TEXT is the
 button clicked which has either a + or -.  TOKEN is the directory to be
 expanded.  INDENT is the current indentation level."
-  (cond ((string-match "+" text)       ;we have to expand this dir
+  (cond ((string-match "\\+" text)     ;we have to expand this dir
         (setq speedbar-shown-directories
               (cons (expand-file-name
                      (concat (speedbar-line-directory indent) token "/"))
@@ -3388,9 +3389,7 @@ expanded.  INDENT is the current indentation level."
   "Speedbar click handler for default directory buttons.
 TEXT is the button clicked on.  TOKEN is the directory to follow.
 INDENT is the current indentation level and is unused."
-  (if (string-match "^[A-z]:$" token)
-      (setq default-directory (concat token "/"))
-    (setq default-directory token))
+  (setq default-directory (file-name-as-directory token))
   ;; Because we leave speedbar as the current buffer,
   ;; update contents will change directory without
   ;; having to touch the attached frame.
@@ -3402,7 +3401,7 @@ INDENT is the current indentation level and is unused."
 The parameter TEXT and TOKEN are required, where TEXT is the button
 clicked, and TOKEN is the file to expand.  INDENT is the current
 indentation level."
-  (cond ((string-match "+" text)       ;we have to expand this file
+  (cond ((string-match "\\+" text)     ;we have to expand this file
         (let* ((fn (expand-file-name (concat (speedbar-line-directory indent)
                                              token)))
                (lst (speedbar-fetch-dynamic-tags fn)))
@@ -3443,7 +3442,7 @@ INDENT is the current indentation level."
   "Expand a tag sublist.  Imenu will return sub-lists of specialized tag types.
 Etags does not support this feature.  TEXT will be the button string.
 TOKEN will be the list, and INDENT is the current indentation level."
-  (cond ((string-match "+" text)       ;we have to expand this file
+  (cond ((string-match "\\+" text)     ;we have to expand this file
         (speedbar-change-expand-button-char ?-)
         (speedbar-with-writable
           (save-excursion
@@ -3964,7 +3963,7 @@ TEXT is the buffer's name, TOKEN and INDENT are unused."
   (speedbar-unhighlight-one-tag-line)
   (setq speedbar-highlight-one-tag-line
        (speedbar-make-overlay (line-beginning-position)
-                              (1+ (line-end-position))))
+                              (line-beginning-position 2)))
   (speedbar-overlay-put speedbar-highlight-one-tag-line 'face
                        'speedbar-highlight-face)
   (add-hook 'pre-command-hook 'speedbar-unhighlight-one-tag-line))
diff --git a/lisp/startup.el b/lisp/startup.el
index 4eb71ab..a9b58c5 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1,6 +1,6 @@
 ;;; startup.el --- process Emacs shell arguments  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1992, 1994-2018 Free Software Foundation,
+;; Copyright (C) 1985-1986, 1992, 1994-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: address@hidden
@@ -60,8 +60,7 @@ string or function value that this variable has."
          (const     :tag "Remember Mode notes buffer" remember-notes)
          (function  :tag "Function")
          (const     :tag "Lisp scratch buffer" t))
-  :version "23.1"
-  :group 'initialization)
+  :version "23.1")
 
 (defvaralias 'inhibit-splash-screen 'inhibit-startup-screen)
 (defvaralias 'inhibit-startup-message 'inhibit-startup-screen)
@@ -71,8 +70,7 @@ string or function value that this variable has."
 
 This is for use in your personal init file (but NOT site-start.el),
 once you are familiar with the contents of the startup screen."
-  :type 'boolean
-  :group 'initialization)
+  :type 'boolean)
 
 (defvar startup-screen-inhibit-startup-screen nil)
 
@@ -101,18 +99,15 @@ instead:
 Thus, someone else using a copy of your init file will see the
 startup message unless he personally acts to inhibit it."
   :type '(choice (const :tag "Don't inhibit")
-                (string :tag "Enter your user name, to inhibit"))
-  :group 'initialization)
+                (string :tag "Enter your user name, to inhibit")))
 
 (defcustom inhibit-default-init nil
   "Non-nil inhibits loading the `default' library."
-  :type 'boolean
-  :group 'initialization)
+  :type 'boolean)
 
 (defcustom inhibit-startup-buffer-menu nil
   "Non-nil inhibits display of buffer list when more than 2 files are loaded."
-  :type 'boolean
-  :group 'initialization)
+  :type 'boolean)
 
 (defvar command-switch-alist nil
   "Alist of command-line switches.
@@ -336,8 +331,7 @@ is due to historical reasons, and does not reflect its 
purpose very well.)")
 
 (defcustom initial-major-mode 'lisp-interaction-mode
   "Major mode command symbol to use for the initial `*scratch*' buffer."
-  :type 'function
-  :group 'initialization)
+  :type 'function)
 
 (defvar init-file-user nil
   "Identity of user whose init file is or was read.
@@ -376,7 +370,6 @@ it visible in the relevant context.  However, actually 
customizing it
 is not allowed, since it would not work anyway.  The only way to set
 this variable usefully is to set it while building and dumping Emacs."
   :type '(choice (const :tag "none" nil) string)
-  :group 'initialization
   :initialize #'custom-initialize-default
   :set (lambda (_variable _value)
          (error "Customizing `site-run-file' does not work")))
@@ -886,7 +879,7 @@ If STYLE is nil, display appropriately for the terminal."
           (when standard-display-table
             (aset standard-display-table char nil)))))))
 
-(defun load-user-init-file
+(defun startup--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
@@ -913,11 +906,17 @@ init-file, or to a default value if loading is not 
possible."
               ;; the name of the file that it loads into
               ;; `user-init-file'.
               (setq user-init-file t)
-              (load init-file-name 'noerror 'nomessage)
+              (load (if (equal (file-name-extension init-file-name)
+                               "el")
+                        (file-name-sans-extension init-file-name)
+                      init-file-name)
+                    'noerror 'nomessage)
 
               (when (and (eq user-init-file t) alternate-filename-function)
-                (load (funcall alternate-filename-function)
-                      'noerror 'nomessage))
+                (let ((alt-file (funcall alternate-filename-function)))
+                  (and (equal (file-name-extension alt-file) "el")
+                       (setq alt-file (file-name-sans-extension alt-file)))
+                  (load alt-file 'noerror 'nomessage)))
 
               ;; If we did not find the user's init file, set
               ;; user-init-file conclusively.  Don't let it be
@@ -1056,7 +1055,8 @@ please check its value")
       (let* ((longopts '(("--no-init-file") ("--no-site-file")
                          ("--no-x-resources") ("--debug-init")
                          ("--user") ("--iconic") ("--icon-type") ("--quick")
-                        ("--no-blinking-cursor") ("--basic-display")))
+                        ("--no-blinking-cursor") ("--basic-display")
+                         ("--dump-file") ("--temacs")))
              (argi (pop args))
              (orig-argi argi)
              argval)
@@ -1108,6 +1108,9 @@ please check its value")
          (push '(visibility . icon) initial-frame-alist))
         ((member argi '("-nbc" "-no-blinking-cursor"))
          (setq no-blinking-cursor t))
+         ((member argi '("-dump-file" "-temacs"))  ; Handled in C
+          (or argval (pop args))
+          (setq argval nil))
         ;; Push the popped arg back on the list of arguments.
         (t
           (push argi args)
@@ -1160,10 +1163,14 @@ please check its value")
                          :error))))
 
   ;; Load the early init file, if found.
-  (load-user-init-file
+  (startup--load-user-init-file
    (lambda ()
      (expand-file-name
-      "early-init"
+      ;; We use an explicit .el extension here to force
+      ;; startup--load-user-init-file to set user-init-file to "early-init.el",
+      ;; with the .el extension, if the file doesn't exist, not just
+      ;; "early-init" without an extension, as it does for ".emacs".
+      "early-init.el"
       (file-name-as-directory
        (concat "~" init-file-user "/.emacs.d")))))
   (setq early-init-file user-init-file)
@@ -1300,7 +1307,7 @@ please check its value")
          (load site-run-file t t)))
 
     ;; Load that user's init file, or the default one, or none.
-    (load-user-init-file
+    (startup--load-user-init-file
      (lambda ()
        (cond
         ((eq system-type 'ms-dos)
@@ -1473,8 +1480,7 @@ settings will be marked as \"CHANGED outside of 
Customize\"."
   "Initial documentation displayed in *scratch* buffer at startup.
 If this is nil, no message will be displayed."
   :type '(choice (text :tag "Message")
-                (const :tag "none" nil))
-  :group 'initialization)
+                (const :tag "none" nil)))
 
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -1628,13 +1634,13 @@ Each element in the list should be a list of strings or 
pairs
 
 
 (defgroup fancy-splash-screen ()
+  ;; FIXME: Do we really need this group with a single custom var?
   "Fancy splash screen when Emacs starts."
   :version "21.1"
   :group 'initialization)
 
 (defcustom fancy-splash-image nil
   "The image to show in the splash screens, or nil for defaults."
-  :group 'fancy-splash-screen
   :type '(choice (const :tag "Default" nil)
                 (file :tag "File")))
 
@@ -1755,7 +1761,7 @@ a face or button specification."
    :face 'variable-pitch "To quit a partially entered command, type "
    :face 'default "Control-g"
    :face 'variable-pitch ".\n")
-  (fancy-splash-insert :face `(variable-pitch font-lock-builtin-face)
+  (fancy-splash-insert :face '(variable-pitch font-lock-builtin-face)
                       "\nThis is "
                       (emacs-version)
                       "\n"
diff --git a/lisp/strokes.el b/lisp/strokes.el
index d5c287c..9265b8a 100644
--- a/lisp/strokes.el
+++ b/lisp/strokes.el
@@ -1,6 +1,6 @@
 ;;; strokes.el --- control Emacs through mouse strokes
 
-;; Copyright (C) 1997, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: David Bakhash <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/subr.el b/lisp/subr.el
index aaf8909..f1a1ddd 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1,6 +1,6 @@
 ;;; subr.el --- basic lisp subroutines for Emacs  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2018 Free Software
+;; Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -93,12 +93,13 @@ Info node `(elisp)Specification List' for details."
   `(put (quote ,symbol) 'edebug-form-spec (quote ,spec)))
 
 (defmacro lambda (&rest cdr)
-  "Return a lambda expression.
-A call of the form (lambda ARGS DOCSTRING INTERACTIVE BODY) is
-self-quoting; the result of evaluating the lambda expression is the
-expression itself.  The lambda expression may then be treated as a
-function, i.e., stored as the function value of a symbol, passed to
-`funcall' or `mapcar', etc.
+  "Return an anonymous function.
+Under dynamic binding, a call of the form (lambda ARGS DOCSTRING
+INTERACTIVE BODY) is self-quoting; the result of evaluating the
+lambda expression is the expression itself.  Under lexical
+binding, the result is a closure.  Regardless, the result is a
+function, i.e., it may be stored as the function value of a
+symbol, passed to `funcall' or `mapcar', etc.
 
 ARGS should take the same form as an argument list for a `defun'.
 DOCSTRING is an optional documentation string.
@@ -755,9 +756,31 @@ Elements of ALIST that are not conses are ignored."
 If KEY is not found in ALIST, return DEFAULT.
 Use TESTFN to lookup in the alist if non-nil.  Otherwise, use `assq'.
 
-This is a generalized variable suitable for use with `setf'.
+You can use `alist-get' in PLACE expressions.  This will modify
+an existing association (more precisely, the first one if
+multiple exist), or add a new element to the beginning of ALIST,
+destructively modifying the list stored in ALIST.
+
+Example:
+
+   (setq foo '((a . 0)))
+   (setf (alist-get 'a foo) 1
+         (alist-get 'b foo) 2)
+
+   foo => ((b . 2) (a . 1))
+
+
 When using it to set a value, optional argument REMOVE non-nil
-means to remove KEY from ALIST if the new value is `eql' to DEFAULT."
+means to remove KEY from ALIST if the new value is `eql' to
+DEFAULT (more precisely the first found association will be
+deleted from the alist).
+
+Example:
+
+  (setq foo '((a . 1) (b . 2)))
+  (setf (alist-get 'b foo nil 'remove) nil)
+
+  foo => ((a . 1))"
   (ignore remove) ;;Silence byte-compiler.
   (let ((x (if (not testfn)
                (assq key alist)
@@ -1510,6 +1533,8 @@ be a list of the form returned by `event-start' and 
`event-end'."
 (make-obsolete-variable 'x-gtk-use-window-move nil "26.1")
 
 (defvaralias 'messages-buffer-max-lines 'message-log-max)
+(define-obsolete-variable-alias 'inhibit-null-byte-detection
+  'inhibit-nul-byte-detection "27.1")
 
 ;;;; Alternate names for functions - these are not being phased out.
 
@@ -3184,11 +3209,12 @@ discouraged."
   "Start a program in a subprocess.  Return the process object for it.
 Similar to `start-process-shell-command', but calls `start-file-process'."
   (declare (advertised-calling-convention (name buffer command) "23.1"))
-  (start-file-process
-   name buffer
-   (if (file-remote-p default-directory) "/bin/sh" shell-file-name)
-   (if (file-remote-p default-directory) "-c" shell-command-switch)
-   (mapconcat 'identity args " ")))
+  ;; On remote hosts, the local `shell-file-name' might be useless.
+  (with-connection-local-variables
+   (start-file-process
+    name buffer
+    shell-file-name shell-command-switch
+    (mapconcat 'identity args " "))))
 
 (defun call-process-shell-command (command &optional infile buffer display
                                           &rest args)
@@ -3229,11 +3255,11 @@ discouraged."
 Similar to `call-process-shell-command', but calls `process-file'."
   (declare (advertised-calling-convention
             (command &optional infile buffer display) "24.5"))
-  (process-file
-   (if (file-remote-p default-directory) "/bin/sh" shell-file-name)
-   infile buffer display
-   (if (file-remote-p default-directory) "-c" shell-command-switch)
-   (mapconcat 'identity (cons command args) " ")))
+  ;; On remote hosts, the local `shell-file-name' might be useless.
+  (with-connection-local-variables
+   (process-file
+    shell-file-name infile buffer display shell-command-switch
+    (mapconcat 'identity (cons command args) " "))))
 
 (defun call-shell-region (start end command &optional delete buffer)
   "Send text from START to END as input to an inferior shell running COMMAND.
@@ -3684,7 +3710,7 @@ the specified region.  It must not change
 `before-change-functions' or `after-change-functions'.
 
 Additionally, the buffer modifications of BODY are recorded on
-the buffer's undo list as a single \(apply ...) entry containing
+the buffer's undo list as a single (apply ...) entry containing
 the function `undo--wrap-and-run-primitive-undo'."
   (let ((old-bul buffer-undo-list)
        (end-marker (copy-marker end t))
@@ -3697,7 +3723,14 @@ the function `undo--wrap-and-run-primitive-undo'."
        (if (eq buffer-undo-list t)
            (setq result (funcall body))
          (let (;; (inhibit-modification-hooks t)
-                before-change-functions after-change-functions)
+                (before-change-functions
+                 ;; Ugly Hack: if the body uses syntax-ppss/syntax-propertize
+                 ;; (e.g. via a regexp-search or sexp-movement trigerring
+                 ;; on-the-fly syntax-propertize), make sure that this gets
+                 ;; properly refreshed after subsequent changes.
+                 (if (memq #'syntax-ppss-flush-cache before-change-functions)
+                     '(syntax-ppss-flush-cache)))
+                after-change-functions)
            (setq result (funcall body)))
          (let ((ap-elt
                 (list 'apply
@@ -4814,7 +4847,7 @@ command is called from a keyboard macro?"
                           'called-interactively-p-functions
                           i frame nextframe)))
                (pcase skip
-                 (`nil nil)
+                 ('nil nil)
                  (0 t)
                  (_ (setq i (+ i skip -1)) (funcall get-next-frame)))))))
       ;; Now `frame' should be "the function from which we were called".
@@ -5034,7 +5067,7 @@ NEW-MESSAGE, if non-nil, sets a new message for the 
reporter."
         (enough-time-passed
          ;; See if enough time has passed since the last update.
          (or (not update-time)
-             (when (>= (float-time) update-time)
+             (when (time-less-p update-time nil)
                ;; Calculate time for the next update
                (aset parameters 0 (+ update-time (aref parameters 5)))))))
     (cond ((and min-value max-value)
@@ -5447,5 +5480,26 @@ This function is called from lisp/Makefile and 
leim/Makefile."
     (setq file (concat (substring file 1 2) ":" (substring file 2))))
   file)
 
+(defun flatten-tree (tree)
+  "Return a \"flattened\" copy of TREE.
+In other words, return a list of the non-nil terminal nodes, or
+leaves, of the tree of cons cells rooted at TREE.  Leaves in the
+returned list are in the same order as in TREE.
+
+\(flatten-tree \\='(1 (2 . 3) nil (4 5 (6)) 7))
+=> (1 2 3 4 5 6 7)"
+  (let (elems)
+    (while (consp tree)
+      (let ((elem (pop tree)))
+        (while (consp elem)
+          (push (cdr elem) tree)
+          (setq elem (car elem)))
+        (if elem (push elem elems))))
+    (if tree (push tree elems))
+    (nreverse elems)))
+
+;; Technically, `flatten-list' is a misnomer, but we provide it here
+;; for discoverability:
+(defalias 'flatten-list 'flatten-tree)
 
 ;;; subr.el ends here
diff --git a/lisp/svg.el b/lisp/svg.el
index 1178905..291b9a1 100644
--- a/lisp/svg.el
+++ b/lisp/svg.el
@@ -1,6 +1,6 @@
 ;;; svg.el --- SVG image creation functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: image
diff --git a/lisp/t-mouse.el b/lisp/t-mouse.el
index 3ad719d..14b292d 100644
--- a/lisp/t-mouse.el
+++ b/lisp/t-mouse.el
@@ -4,7 +4,7 @@
 ;; Maintainer: address@hidden
 ;; Keywords: mouse gpm linux
 
-;; Copyright (C) 1994-1995, 1998, 2006-2018 Free Software Foundation,
+;; Copyright (C) 1994-1995, 1998, 2006-2019 Free Software Foundation,
 ;; Inc.
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/tabify.el b/lisp/tabify.el
index 57eafc6..37cd8fb 100644
--- a/lisp/tabify.el
+++ b/lisp/tabify.el
@@ -1,6 +1,6 @@
 ;;; tabify.el --- tab conversion commands for Emacs
 
-;; Copyright (C) 1985, 1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Package: emacs
diff --git a/lisp/talk.el b/lisp/talk.el
index f6aae28..0b7d5db 100644
--- a/lisp/talk.el
+++ b/lisp/talk.el
@@ -1,6 +1,6 @@
 ;;; talk.el --- allow several users to talk to each other through Emacs
 
-;; Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: comm, frames
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index cf4e53a..599da9a 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -1,6 +1,6 @@
 ;;; tar-mode.el --- simple editing of tar files from GNU Emacs
 
-;; Copyright (C) 1990-1991, 1993-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1990-1991, 1993-2019 Free Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski <address@hidden>
 ;; Maintainer: address@hidden
@@ -95,6 +95,7 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl-lib))
+(require 'arc-mode)
 
 (defgroup tar nil
   "Simple editing of tar files."
@@ -931,6 +932,7 @@ actually appear on disk when you save the tar-file's 
buffer."
         (setq buffer-file-name new-buffer-file-name)
         (setq buffer-file-truename
               (abbreviate-file-name buffer-file-name))
+        (archive-try-jka-compr)       ;Pretty ugly hack :-(
         ;; Force buffer-file-coding-system to what
         ;; decode-coding-region actually used.
         (set-buffer-file-coding-system last-coding-system-used t)
diff --git a/lisp/tempo.el b/lisp/tempo.el
index 5d4dea5..28afbec 100644
--- a/lisp/tempo.el
+++ b/lisp/tempo.el
@@ -1,6 +1,6 @@
 ;;; tempo.el --- Flexible template insertion
 
-;; Copyright (C) 1994-1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: David Kågedal <address@hidden>
 ;; Created: 16 Feb 1994
diff --git a/lisp/term.el b/lisp/term.el
index 9f8f1f7..586a887 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -1,6 +1,6 @@
 ;;; term.el --- general command interpreter in a window stuff -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1988, 1990, 1992, 1994-1995, 2001-2018 Free Software
+;; Copyright (C) 1988, 1990, 1992, 1994-1995, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Per Bothner <address@hidden>
@@ -284,17 +284,6 @@
 ;; merge them into the master source.
 ;;     - Per Bothner (address@hidden)
 
-;; This file defines a general command-interpreter-in-a-buffer package
-;; (term mode).  The idea is that you can build specific process-in-a-buffer
-;; modes on top of term mode -- e.g., lisp, shell, scheme, T, soar, ....
-;; This way, all these specific packages share a common base functionality,
-;; and a common set of bindings, which makes them easier to use (and
-;; saves code, implementation time, etc., etc.).
-
-;; For hints on converting existing process modes (e.g., tex-mode,
-;; background, dbx, gdb, kermit, prolog, telnet) to use term-mode
-;; instead of shell-mode, see the notes at the end of this file.
-
 
 ;; Brief Command Documentation:
 ;;============================================================================
@@ -406,7 +395,9 @@ This emulates (more or less) the behavior of xterm.")
 (defvar term-pager-count nil
   "Number of lines before we need to page; if nil, paging is disabled.")
 (defvar term-saved-cursor nil)
-(defvar term-command-hook)
+(define-obsolete-variable-alias 'term-command-hook
+  'term-command-function "27.1")
+(defvar term-command-function #'term-command-hook)
 (defvar term-log-buffer nil)
 (defvar term-scroll-with-delete nil
   "If t, forward scrolling should be implemented by delete to
@@ -545,6 +536,8 @@ This means text can automatically reflow if the window is 
resized."
   :version "24.4"
   :type 'boolean
   :group 'term)
+(make-obsolete-variable 'term-suppress-hard-newline nil
+                        "27.1")
 
 ;; Where gud-display-frame should put the debugging arrow.  This is
 ;; set by the marker-filter, which scans the debugger's output for
@@ -579,7 +572,7 @@ These functions get one argument, a string containing the 
text to send.
 
 This variable is buffer-local.")
 
-(defvar term-input-sender (function term-simple-send)
+(defvar term-input-sender #'term-simple-send
   "Function to actually send to PROCESS the STRING submitted by user.
 Usually this is just `term-simple-send', but if your mode needs to
 massage the input string, this is your hook.  This is called from
@@ -1036,8 +1029,6 @@ Entry to this mode runs the hooks on `term-mode-hook'."
   (set (make-local-variable 'term-last-input-start) (make-marker))
   (set (make-local-variable 'term-last-input-end) (make-marker))
   (set (make-local-variable 'term-last-input-match) "")
-  (set (make-local-variable 'term-command-hook)
-       (symbol-function 'term-command-hook))
 
   ;; These local variables are set to their local values:
   (make-local-variable 'term-saved-home-marker)
@@ -1091,21 +1082,18 @@ Entry to this mode runs the hooks on `term-mode-hook'."
   (make-local-variable 'term-pager-old-local-map)
   (make-local-variable 'term-old-mode-map)
   (make-local-variable 'term-insert-mode)
-  (make-local-variable 'term-dynamic-complete-functions)
   (make-local-variable 'term-completion-fignore)
   (make-local-variable 'term-get-old-input)
   (make-local-variable 'term-matching-input-from-input-string)
   (make-local-variable 'term-input-autoexpand)
   (make-local-variable 'term-input-ignoredups)
   (make-local-variable 'term-delimiter-argument-list)
-  (make-local-variable 'term-input-filter-functions)
   (make-local-variable 'term-input-filter)
   (make-local-variable 'term-input-sender)
   (make-local-variable 'term-eol-on-send)
   (make-local-variable 'term-scroll-to-bottom-on-output)
   (make-local-variable 'term-scroll-show-maximum-output)
   (make-local-variable 'term-ptyp)
-  (make-local-variable 'term-exec-hook)
   (set (make-local-variable 'term-vertical-motion) 'vertical-motion)
   (set (make-local-variable 'term-pending-delete-marker) (make-marker))
   (make-local-variable 'term-current-face)
@@ -1117,6 +1105,9 @@ Entry to this mode runs the hooks on `term-mode-hook'."
   (set (make-local-variable 'font-lock-defaults) '(nil t))
 
   (add-function :filter-return
+                (local 'filter-buffer-substring-function)
+                #'term--filter-buffer-substring)
+  (add-function :filter-return
                 (local 'window-adjust-process-window-size-function)
                 (lambda (size)
                   (when size
@@ -1132,9 +1123,51 @@ Entry to this mode runs the hooks on `term-mode-hook'."
       (setq term-input-ring (make-ring term-input-ring-size)))
   (term-update-mode-line))
 
+(defun term--remove-fake-newlines ()
+  (goto-char (point-min))
+  (let (fake-newline)
+    (while (setq fake-newline (next-single-property-change (point)
+                                                           'term-line-wrap))
+      (goto-char fake-newline)
+      (cl-assert (eq ?\n (char-after)))
+      (let ((inhibit-read-only t))
+        (delete-char 1)))))
+
+(defun term--filter-buffer-substring (content)
+  (with-temp-buffer
+    (insert content)
+    (term--remove-fake-newlines)
+    (buffer-string)))
+
+(defun term--unwrap-visible-long-lines (width)
+  ;; Unwrap lines longer than width using fake newlines.  Only do it
+  ;; for lines that are currently visible (i.e. following the home
+  ;; marker).  Invisible lines don't have to be unwrapped since they
+  ;; are unreachable using the cursor movement anyway.  Not having to
+  ;; unwrap the entire buffer means the runtime of this function is
+  ;; bounded by the size of the screen instead of the buffer size.
+
+  (save-excursion
+    ;; We will just assume that our accounting for the home marker is
+    ;; correct, i.e. programs will not try to reach any position
+    ;; earlier than this marker.
+    (goto-char term-home-marker)
+
+    (move-to-column width)
+    (while (not (eobp))
+      (if (eolp)
+          (forward-char)
+        (let ((inhibit-read-only t))
+          (term-unwrap-line)))
+      (move-to-column width))))
+
 (defun term-reset-size (height width)
   (when (or (/= height term-height)
             (/= width term-width))
+    ;; Delete all newlines used for wrapping
+    (when (/= width term-width)
+      (save-excursion
+        (term--remove-fake-newlines)))
     (let ((point (point)))
       (setq term-height height)
       (setq term-width width)
@@ -1147,7 +1180,8 @@ Entry to this mode runs the hooks on `term-mode-hook'."
       (setq term-start-line-column nil)
       (setq term-current-row nil)
       (setq term-current-column nil)
-      (goto-char point))))
+      (goto-char point))
+    (term--unwrap-visible-long-lines width)))
 
 ;; Recursive routine used to check if any string in term-kill-echo-list
 ;; matches part of the buffer before point.
@@ -1280,16 +1314,14 @@ intervention from Emacs, except for the escape 
character (usually C-c)."
     (add-hook 'post-command-hook #'term-goto-process-mark-maybe nil t)
 
     ;; Send existing partial line to inferior (without newline).
-    (let ((pmark (process-mark (get-buffer-process (current-buffer))))
-         (save-input-sender term-input-sender))
+    (let ((pmark (process-mark (get-buffer-process (current-buffer)))))
       (when (> (point) pmark)
        (unwind-protect
            (progn
-             (setq term-input-sender
-                   (symbol-function 'term-send-string))
+             (add-function :override term-input-sender #'term-send-string)
              (end-of-line)
              (term-send-input))
-         (setq term-input-sender save-input-sender))))
+         (remove-function term-input-sender #'term-send-string))))
     (term-update-mode-line)))
 
 (defun term-line-mode  ()
@@ -1419,8 +1451,8 @@ buffer.  The hook `term-exec-hook' is run after each 
exec."
       ;; Jump to the end, and set the process mark.
       (goto-char (point-max))
       (set-marker (process-mark proc) (point))
-      (set-process-filter proc 'term-emulate-terminal)
-      (set-process-sentinel proc 'term-sentinel)
+      (set-process-filter proc #'term-emulate-terminal)
+      (set-process-sentinel proc #'term-sentinel)
       ;; Feed it the startfile.
       (when startfile
         ;;This is guaranteed to wait long enough
@@ -1549,7 +1581,7 @@ Nil if unknown.")
     (when (term--bash-needs-EMACSp)
       (push (format "EMACS=%s (term:%s)" emacs-version term-protocol-version)
             process-environment))
-    (apply 'start-process name buffer
+    (apply #'start-process name buffer
           "/bin/sh" "-c"
           (format "stty -nl echo rows %d columns %d sane 2>/dev/null;\
 if [ $1 = .. ]; then shift; fi; exec \"address@hidden""
@@ -1952,8 +1984,8 @@ A useful command to bind to SPC.  See 
`term-replace-by-expanded-history'."
 (defun term-within-quotes (beg end)
   "Return t if the number of quotes between BEG and END is odd.
 Quotes are single and double."
-  (let ((countsq (term-how-many-region "\\(^\\|[^\\\\]\\)'" beg end))
-       (countdq (term-how-many-region "\\(^\\|[^\\\\]\\)\"" beg end)))
+  (let ((countsq (term-how-many-region "\\(^\\|[^\\]\\)'" beg end))
+       (countdq (term-how-many-region "\\(^\\|[^\\]\\)\"" beg end)))
     (or (= (mod countsq 2) 1) (= (mod countdq 2) 1))))
 
 (defun term-how-many-region (regexp beg end)
@@ -2043,7 +2075,7 @@ Argument 0 is the command name."
     (let ((n (or nth (1- count)))
          (m (if mth (1- (- count mth)) 0)))
       (mapconcat
-       (function (lambda (a) a)) (nthcdr n (nreverse (nthcdr m args))) " "))))
+       #'identity (nthcdr n (nreverse (nthcdr m args))) " "))))
 
 ;;;
 ;;; Input processing stuff [line mode]
@@ -2123,10 +2155,7 @@ Similarly for Soar, Scheme, etc."
                       (not (string-equal (ring-ref term-input-ring 0)
                                          history))))
          (ring-insert term-input-ring history))
-       (let ((functions term-input-filter-functions))
-         (while functions
-           (funcall (car functions) (concat input "\n"))
-           (setq functions (cdr functions))))
+        (run-hook-with-args 'term-input-filter-functions (concat input "\n"))
        (setq term-input-ring-index nil)
 
        ;; Update the markers before we send the input
@@ -2906,6 +2935,7 @@ See `term-prompt-regexp'."
                       (delete-region (point) (line-end-position))
                       (term-down 1 t)
                       (term-move-columns (- (term-current-column)))
+                      (put-text-property (1- (point)) (point) 'term-line-wrap 
t)
                       (setq decoded-substring
                             (substring decoded-substring (- term-width 
old-column)))
                       (setq old-column 0)))
@@ -2960,7 +2990,7 @@ See `term-prompt-regexp'."
                 (?\C-g                  ;; (terminfo: bel)
                  (beep t))
                 (?\032 ; Emacs specific control sequence.
-                 (funcall term-command-hook
+                 (funcall term-command-function
                           (decode-coding-string
                            (substring str (1+ i)
                                       (- ctl-end
@@ -3054,8 +3084,10 @@ See `term-prompt-regexp'."
                         (setq term-terminal-undecoded-bytes (substring str (1- 
i)))
                         (aset term-terminal-undecoded-bytes 0 ?\r))
                       (goto-char (point-max)))
+                    ;; FIXME: Use (add-function :override (process-filter proc)
                     (make-local-variable 'term-pager-old-filter)
                     (setq term-pager-old-filter (process-filter proc))
+                    ;; FIXME: Where is `term-pager-filter' set to a function?!
                     (set-process-filter proc term-pager-filter)
                     (setq i str-length))
                 (setq i ctl-end)))))
@@ -3437,7 +3469,7 @@ The top-most line is line 0."
 ;;     (setq term-current-row 0)
 ;;     (term-goto row col))))
 
-;; Default value for the symbol term-command-hook.
+;; Default value for the symbol term-command-function.
 
 (defun term-command-hook (string)
   (cond ((equal string "")
@@ -3719,7 +3751,10 @@ all pending output has been dealt with."))
 ;; if the line above point wraps around, add a ?\n to undo the wrapping.
 ;; FIXME:  Probably should be called more than it is.
 (defun term-unwrap-line ()
-  (when (not (bolp)) (insert-before-markers ?\n)))
+  (when (not (bolp))
+    (let ((old-point (point)))
+      (insert-before-markers ?\n)
+      (put-text-property old-point (point) 'term-line-wrap t))))
 
 (defun term-erase-in-line (kind)
   (when (= kind 1) ;; erase left of point
@@ -3988,9 +4023,7 @@ Calls the functions in `term-dynamic-complete-functions' 
to perform
 completion until a function returns non-nil, at which point completion is
 assumed to have occurred."
   (interactive)
-  (let ((functions term-dynamic-complete-functions))
-    (while (and functions (null (funcall (car functions))))
-      (setq functions (cdr functions)))))
+  (run-hook-with-args-until-success 'term-dynamic-complete-functions))
 
 
 (defun term-dynamic-complete-filename ()
@@ -4090,7 +4123,6 @@ Returns `listed' if a completion listing was shown.
 See also `term-dynamic-complete-filename'."
   (declare (obsolete completion-in-region "23.2"))
   (let* ((completion-ignore-case nil)
-        (candidates (mapcar (function (lambda (x) (list x))) candidates))
         (completions (all-completions stub candidates)))
     (cond ((null completions)
           (message "No completions of %s" stub)
@@ -4315,9 +4347,9 @@ well as the newer ports COM10 and higher."
       (setq serial-name-history file-name-history))
     (when (or (null x) (and (stringp x) (zerop (length x))))
       (error "No serial port selected"))
-    (when (and (not (serial-port-is-file-p))
-               (not (string-match "\\\\" x)))
-      (set 'x (concat "\\\\.\\" x)))
+    (when (not (or (serial-port-is-file-p)
+                   (string-match "\\\\" x)))
+      (setq x (concat "\\\\.\\" x)))
     x))
 
 (defun serial-read-speed ()
@@ -4371,8 +4403,8 @@ use in that buffer.
       (term-char-mode)
       (goto-char (point-max))
       (set-marker (process-mark process) (point))
-      (set-process-filter process 'term-emulate-terminal)
-      (set-process-sentinel process 'term-sentinel))
+      (set-process-filter process #'term-emulate-terminal)
+      (set-process-sentinel process #'term-sentinel))
     (switch-to-buffer buffer)
     buffer))
 
@@ -4509,27 +4541,19 @@ The return value may be nil for a special serial port."
 ;; term-mode will take care of it.  The following example, from shell.el,
 ;; is typical:
 ;;
-;; (defvar shell-mode-map '())
-;; (cond ((not shell-mode-map)
-;;        (setq shell-mode-map (copy-keymap term-mode-map))
-;;        (define-key shell-mode-map "\C-c\C-f" 'shell-forward-command)
-;;        (define-key shell-mode-map "\C-c\C-b" 'shell-backward-command)
-;;        (define-key shell-mode-map "\t" 'term-dynamic-complete)
-;;        (define-key shell-mode-map "\M-?"
-;;          'term-dynamic-list-filename-completions)))
-;;
-;; (defun shell-mode ()
-;;   (interactive)
-;;   (term-mode)
-;;   (setq term-prompt-regexp shell-prompt-pattern)
-;;   (setq major-mode 'shell-mode)
-;;   (setq mode-name "Shell")
-;;   (use-local-map shell-mode-map)
-;;   (make-local-variable 'shell-directory-stack)
-;;   (setq shell-directory-stack nil)
-;;   (add-hook 'term-input-filter-functions 'shell-directory-tracker)
-;;   (run-mode-hooks 'shell-mode-hook))
+;; (defvar shell-mode-map
+;;   (let ((map (make-sparse-keymap)))
+;;     (define-key map "\C-c\C-f" 'shell-forward-command)
+;;     (define-key map "\C-c\C-b" 'shell-backward-command)
+;;     (define-key map "\t" 'term-dynamic-complete)
+;;     (define-key map "\M-?"
+;;       'term-dynamic-list-filename-completions)))
 ;;
+;; (define-derived-mode shell-mode term-mode "Shell"
+;;   "A shell mode."
+;;   (setq-local term-prompt-regexp shell-prompt-pattern)
+;;   (setq-local shell-directory-stack nil)
+;;   (add-hook 'term-input-filter-functions #'shell-directory-tracker nil t))
 ;;
 ;; Completion for term-mode users
 ;;
diff --git a/lisp/term/AT386.el b/lisp/term/AT386.el
index cc6c5ca..b0cb953 100644
--- a/lisp/term/AT386.el
+++ b/lisp/term/AT386.el
@@ -1,6 +1,6 @@
 ;;; AT386.el --- terminal support package for IBM AT keyboards
 
-;; Copyright (C) 1992, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric S. Raymond <address@hidden>
 ;; Keywords: terminals
diff --git a/lisp/term/README b/lisp/term/README
index 4ab1a43..a9b131c 100644
--- a/lisp/term/README
+++ b/lisp/term/README
@@ -1,4 +1,4 @@
-Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/lisp/term/common-win.el b/lisp/term/common-win.el
index a482067..b7a778f 100644
--- a/lisp/term/common-win.el
+++ b/lisp/term/common-win.el
@@ -1,6 +1,6 @@
 ;;; common-win.el --- common part of handling window systems
 
-;; Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: terminals
diff --git a/lisp/term/internal.el b/lisp/term/internal.el
index 0cdf0c1..396521d 100644
--- a/lisp/term/internal.el
+++ b/lisp/term/internal.el
@@ -1,6 +1,6 @@
 ;;; internal.el --- support for PC internal terminal
 
-;; Copyright (C) 1993-1994, 1998-1999, 2001-2018 Free Software
+;; Copyright (C) 1993-1994, 1998-1999, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Morten Welinder <address@hidden>
diff --git a/lisp/term/iris-ansi.el b/lisp/term/iris-ansi.el
index eb882da..23c6768 100644
--- a/lisp/term/iris-ansi.el
+++ b/lisp/term/iris-ansi.el
@@ -1,6 +1,6 @@
 ;;; iris-ansi.el --- configure Emacs for SGI xwsh and winterm apps
 
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Dan Nicolaescu <address@hidden>
 
diff --git a/lisp/term/konsole.el b/lisp/term/konsole.el
index 86a2150..f2186ae 100644
--- a/lisp/term/konsole.el
+++ b/lisp/term/konsole.el
@@ -1,5 +1,5 @@
 ;;; konsole.el --- terminal initialization for konsole
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 (require 'term/xterm)
 
diff --git a/lisp/term/news.el b/lisp/term/news.el
index 7cbbde4..7ef80a5 100644
--- a/lisp/term/news.el
+++ b/lisp/term/news.el
@@ -1,6 +1,6 @@
 ;;; news.el --- keypad and function key bindings for the Sony NEWS keyboard
 
-;; Copyright (C) 1989, 1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: FSF
 ;; Keywords: terminals
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index 8b23cab..6a668b2 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -1,6 +1,6 @@
 ;;; ns-win.el --- lisp side of interface with NeXT/Open/GNUstep/macOS window 
system  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1993-1994, 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2005-2019 Free Software Foundation, Inc.
 
 ;; Authors: Carl Edman
 ;;     Christian Limpach
@@ -501,48 +501,38 @@ unless the current buffer is a scratch buffer."
       (find-file f)))))
 
 
-(defun ns-drag-n-drop (event &optional new-frame force-text)
+(defun ns-drag-n-drop (event)
   "Edit the files listed in the drag-n-drop EVENT.
-Switch to a buffer editing the last file dropped."
+Switch to a buffer editing the last file dropped, or insert the
+string dropped into the current buffer."
   (interactive "e")
   (let* ((window (posn-window (event-start event)))
          (arg (car (cdr (cdr event))))
          (type (car arg))
-         (data (car (cdr arg)))
-         (url-or-string (cond ((eq type 'file)
-                               (concat "file:" data))
-                              (t data))))
+         (operations (car (cdr arg)))
+         (objects (cdr (cdr arg)))
+         (string (mapconcat 'identity objects "\n")))
     (set-frame-selected-window nil window)
-    (when new-frame
-      (select-frame (make-frame)))
     (raise-frame)
     (setq window (selected-window))
-    (if force-text
-        (dnd-insert-text window 'private data)
-      (dnd-handle-one-url window 'private url-or-string))))
-
-
-(defun ns-drag-n-drop-other-frame (event)
-  "Edit the files listed in the drag-n-drop EVENT, in other frames.
-May create new frames, or reuse existing ones.  The frame editing
-the last file dropped is selected."
-  (interactive "e")
-  (ns-drag-n-drop event t))
-
-(defun ns-drag-n-drop-as-text (event)
-  "Drop the data in EVENT as text."
-  (interactive "e")
-  (ns-drag-n-drop event nil t))
-
-(defun ns-drag-n-drop-as-text-other-frame (event)
-  "Drop the data in EVENT as text in a new frame."
-  (interactive "e")
-  (ns-drag-n-drop event t t))
+    (cond ((memq 'ns-drag-operation-generic operations)
+           ;; Perform the default action for the type.
+           (if (eq type 'file)
+               (dolist (data objects)
+                 (dnd-handle-one-url window 'private (concat "file:" data)))
+             (dnd-insert-text window 'private string)))
+          ((memq 'ns-drag-operation-copy operations)
+           ;; Try to open the file/URL.  If type is nil, try to open
+           ;; it as a URL anyway.
+           (dolist (data objects)
+             (dnd-handle-one-url window 'private (if (eq type 'file)
+                                                     (concat "file:" data)
+                                                   data))))
+          (t
+           ;; Insert the text as is.
+           (dnd-insert-text window 'private string)))))
 
 (global-set-key [drag-n-drop] 'ns-drag-n-drop)
-(global-set-key [C-drag-n-drop] 'ns-drag-n-drop-other-frame)
-(global-set-key [M-drag-n-drop] 'ns-drag-n-drop-as-text)
-(global-set-key [C-M-drag-n-drop] 'ns-drag-n-drop-as-text-other-frame)
 
 ;;;; Frame-related functions.
 
@@ -623,7 +613,7 @@ the last file dropped is selected."
       (let ((last-nonmenu-event (if (listp last-nonmenu-event)
                                     last-nonmenu-event
                                   ;; Fake it:
-                                  `(mouse-1 POSITION 1))))
+                                  '(mouse-1 POSITION 1))))
         (if (y-or-n-p (format "Print buffer %s? " (buffer-name)))
             (print-buffer)
          (error "Canceled")))
diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el
index e0e412e..0927599 100644
--- a/lisp/term/pc-win.el
+++ b/lisp/term/pc-win.el
@@ -1,6 +1,6 @@
 ;;; pc-win.el --- setup support for `PC windows' (whatever that is)  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1994, 1996-1997, 1999, 2001-2018 Free Software
+;; Copyright (C) 1994, 1996-1997, 1999, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Morten Welinder <address@hidden>
diff --git a/lisp/term/rxvt.el b/lisp/term/rxvt.el
index 870282a..8376e5a 100644
--- a/lisp/term/rxvt.el
+++ b/lisp/term/rxvt.el
@@ -1,6 +1,6 @@
 ;;; rxvt.el --- define function key sequences and standard colors for rxvt
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii
 ;; Keywords: terminals
diff --git a/lisp/term/screen.el b/lisp/term/screen.el
index dffcb0b..bb74901 100644
--- a/lisp/term/screen.el
+++ b/lisp/term/screen.el
@@ -1,5 +1,5 @@
 ;;; screen.el --- terminal initialization for screen and tmux  -*- 
lexical-binding: t -*-
-;; Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 (require 'term/xterm)
 
diff --git a/lisp/term/sun.el b/lisp/term/sun.el
index 34ed492..c9f531e 100644
--- a/lisp/term/sun.el
+++ b/lisp/term/sun.el
@@ -1,6 +1,6 @@
 ;;; sun.el --- keybinding for standard default sunterm keys
 
-;; Copyright (C) 1987, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1987, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Jeff Peck <address@hidden>
 ;; Keywords: terminals
diff --git a/lisp/term/tmux.el b/lisp/term/tmux.el
index ca21d5e..c6c2244 100644
--- a/lisp/term/tmux.el
+++ b/lisp/term/tmux.el
@@ -1,5 +1,5 @@
 ;;; tmux.el --- terminal initialization for tmux  -*- lexical-binding: t -*-
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 (require 'term/xterm)
 
diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el
index d9b2726..307586f 100644
--- a/lisp/term/tty-colors.el
+++ b/lisp/term/tty-colors.el
@@ -1,6 +1,6 @@
 ;;; tty-colors.el --- color support for character terminals
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii
 ;; Maintainer: address@hidden
diff --git a/lisp/term/tvi970.el b/lisp/term/tvi970.el
index 0c4b0ae..3b74848 100644
--- a/lisp/term/tvi970.el
+++ b/lisp/term/tvi970.el
@@ -1,6 +1,6 @@
 ;;; tvi970.el --- terminal support for the Televideo 970
 
-;; Copyright (C) 1992, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Jim Blandy <address@hidden>
 ;; Keywords: terminals
diff --git a/lisp/term/vt100.el b/lisp/term/vt100.el
index b61e557..81843ce 100644
--- a/lisp/term/vt100.el
+++ b/lisp/term/vt100.el
@@ -1,6 +1,6 @@
 ;;; vt100.el --- define VT100 function key sequences in function-key-map
 
-;; Copyright (C) 1989, 1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: FSF
 ;; Keywords: terminals
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el
index dc57160..beb7425 100644
--- a/lisp/term/w32-win.el
+++ b/lisp/term/w32-win.el
@@ -1,6 +1,6 @@
 ;;; w32-win.el --- parse switches controlling interface with W32 window system 
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Kevin Gallo
 ;; Keywords: terminals
diff --git a/lisp/term/w32console.el b/lisp/term/w32console.el
index 75d68f8..fe75145 100644
--- a/lisp/term/w32console.el
+++ b/lisp/term/w32console.el
@@ -1,6 +1,6 @@
 ;;; w32console.el -- Setup w32 console keys and colors.
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: FSF
 ;; Keywords: terminals
diff --git a/lisp/term/wyse50.el b/lisp/term/wyse50.el
index 7e29828..17f87eb 100644
--- a/lisp/term/wyse50.el
+++ b/lisp/term/wyse50.el
@@ -1,6 +1,6 @@
 ;;; wyse50.el --- terminal support code for Wyse 50
 
-;; Copyright (C) 1989, 1993-1994, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1989, 1993-1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Daniel Pfeiffer <address@hidden>,
diff --git a/lisp/term/x-win.el b/lisp/term/x-win.el
index f169b27..5606137 100644
--- a/lisp/term/x-win.el
+++ b/lisp/term/x-win.el
@@ -1,6 +1,6 @@
 ;;; x-win.el --- parse relevant switches and set up for X  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: FSF
 ;; Keywords: terminals, i18n
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 00747af..c4b0a8f 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -1,6 +1,6 @@
 ;;; xterm.el --- define function key sequences and standard colors for xterm  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: FSF
 ;; Keywords: terminals
@@ -767,13 +767,15 @@ Can be nil to mean \"no timeout\".")
 By not redisplaying right away for xterm queries, we can avoid
 unsightly flashing during initialization. Give up and redisplay
 anyway if we've been waiting a little while."
-  (let ((start-time (float-time)))
+  (let ((start-time (current-time)))
     (or (let ((inhibit-redisplay t))
           (read-event nil nil xterm-query-redisplay-timeout))
         (read-event nil nil
                     (and xterm-query-timeout
-                         (max 0 (+ start-time xterm-query-timeout
-                                   (- (float-time)))))))))
+                        (max 0 (float-time
+                                (time-subtract
+                                 xterm-query-timeout
+                                 (time-since start-time)))))))))
 
 (defun xterm--query (query handlers &optional no-async)
   "Send QUERY string to the terminal and watch for a response.
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index 940a78a..e9b1779 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -1,6 +1,6 @@
 ;;; artist.el --- draw ascii graphics with your mouse
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author:       Tomas Abrahamsson <address@hidden>
 ;; Maintainer:   Tomas Abrahamsson <address@hidden>
@@ -2895,7 +2895,7 @@ Returns a list of strings."
        dir-list)
       (mapcar
        (lambda (file)
-         (replace-regexp-in-string "\.flf\\'" "" file))
+         (replace-regexp-in-string "\\.flf\\'" "" file))
        result))))
 
 (defun artist-figlet-choose-font ()
diff --git a/lisp/textmodes/bib-mode.el b/lisp/textmodes/bib-mode.el
index 403d00f..7a5d3ef 100644
--- a/lisp/textmodes/bib-mode.el
+++ b/lisp/textmodes/bib-mode.el
@@ -1,6 +1,6 @@
 ;;; bib-mode.el --- major mode for editing bib files
 
-;; Copyright (C) 1989, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Henry Kautz
 ;; (according to authors.el)
@@ -198,7 +198,7 @@ named by variable `unread-bib-file'."
 
 (defvar bib-capitalize-title-stop-words
    (concat
-      "the\\|and\\|of\\|is\\|a\\|an\\|of\\|for\\|in\\|to\\|in\\|on\\|at\\|"
+      "the\\|and\\|of\\|is\\|a\\|an\\|for\\|in\\|to\\|on\\|at\\|"
       "by\\|with\\|that\\|its")
    "Words not to be capitalized in a title (unless the first word).")
 
diff --git a/lisp/textmodes/bibtex-style.el b/lisp/textmodes/bibtex-style.el
index 9515c39..badbb2a 100644
--- a/lisp/textmodes/bibtex-style.el
+++ b/lisp/textmodes/bibtex-style.el
@@ -1,6 +1,6 @@
 ;;; bibtex-style.el --- Major mode for BibTeX Style files -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2005, 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: tex
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 57e5ef8..a560c2b 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -1,6 +1,6 @@
 ;;; bibtex.el --- BibTeX mode for GNU Emacs -*- lexical-binding: t -*-
 
-;; Copyright (C) 1992, 1994-1999, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1992, 1994-1999, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Stefan Schoef <address@hidden>
@@ -5095,7 +5095,7 @@ entries from minibuffer."
              (list beg end
                    (lambda (s p a)
                      (cond
-                      ((eq a 'metadata) `(metadata (category . bibtex-key)))
+                      ((eq a 'metadata) '(metadata (category . bibtex-key)))
                       (t (let ((completion-ignore-case nil))
                            (complete-with-action
                             a (bibtex-global-key-alist) s p)))))
@@ -5113,7 +5113,7 @@ entries from minibuffer."
            (list beg end
                  (lambda (s p a)
                    (cond
-                    ((eq a 'metadata) `(metadata (category . bibtex-string)))
+                    ((eq a 'metadata) '(metadata (category . bibtex-string)))
                     (t (let ((completion-ignore-case t))
                          (complete-with-action a compl s p)))))
                  :exit-function (bibtex-complete-string-cleanup compl))))))
diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el
index 45fd040..ad9f60f 100644
--- a/lisp/textmodes/conf-mode.el
+++ b/lisp/textmodes/conf-mode.el
@@ -1,6 +1,6 @@
-;;; conf-mode.el --- Simple major mode for editing conf/ini/properties files
+;;; conf-mode.el --- Simple major mode for editing conf/ini/properties files  
-*- lexical-binding: t; -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pfeiffer <address@hidden>
 ;; Keywords: conf ini windows java
@@ -230,7 +230,7 @@ This variable is best set in the file local variables, or 
through
 (put 'conf-space-keywords 'safe-local-variable 'stringp)
 
 (defvar conf-space-font-lock-keywords
-  `(;; [section] (do this first because it may look like a parameter)
+  '(;; [section] (do this first because it may look like a parameter)
     ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face)
     ;; section { ... } (do this first because it looks like a parameter)
     ("^[ \t]*\\(.+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face)
@@ -243,7 +243,7 @@ This variable is best set in the file local variables, or 
through
   "Keywords to highlight in Conf Space mode.")
 
 (defvar conf-colon-font-lock-keywords
-  `(;; [section] (do this first because it may look like a parameter)
+  '(;; [section] (do this first because it may look like a parameter)
     ("^[ \t]*\\[\\(.+\\)\\]" 1 'font-lock-type-face)
     ;; var: val
     ("^[ \t]*\\(.+?\\)[ \t]*:"
@@ -281,10 +281,10 @@ whitespace.")
 ;; If anybody can figure out how to get the same effect by configuring
 ;; `align', I'd be glad to hear.
 (defun conf-align-assignments (&optional arg)
-  (interactive "P")
   "Align the assignments in the buffer or active region.
 In Transient Mark mode, if the mark is active, operate on the
 contents of the region.  Otherwise, operate on the whole buffer."
+  (interactive "P")
   (setq arg (if arg
                (prefix-numeric-value arg)
              conf-assignment-column))
@@ -323,7 +323,7 @@ contents of the region.  Otherwise, operate on the whole 
buffer."
 
 (defun conf-quote-normal (arg)
   "Set the syntax of \\=' and \" to punctuation.
-With prefix arg, only do it for \\=' if 1, or only for \" if 2.
+With prefix ARG, only do it for \\=' if 1, or only for \" if 2.
 This only affects the current buffer.  Some conf files use quotes
 to delimit strings, while others allow quotes as simple parts of
 the assigned value.  In those files font locking will be wrong,
@@ -442,7 +442,7 @@ See also `conf-space-mode', `conf-colon-mode', 
`conf-javaprop-mode',
     (run-mode-hooks 'conf-mode-hook)))
 
 (defun conf-mode-initialize (comment &optional font-lock)
-  "Initializations for sub-modes of conf-mode.
+  "Initializations for sub-modes of `conf-mode'.
 COMMENT initializes `comment-start' and `comment-start-skip'.
 The optional arg FONT-LOCK is the value for FONT-LOCK-KEYWORDS."
   (set (make-local-variable 'comment-start) comment)
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 63c8631..11a77b5 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -1,6 +1,6 @@
 ;;; css-mode.el --- Major mode to edit CSS files  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Maintainer: Simen Heggestøyl <address@hidden>
@@ -112,7 +112,6 @@
     ("bottom" length percentage "auto")
     ("caption-side" "top" "bottom")
     ("clear" "none" "left" "right" "both")
-    ("clip" shape "auto")
     ("content" "normal" "none" string uri counter "attr()"
      "open-quote" "close-quote" "no-open-quote" "no-close-quote")
     ("counter-increment" identifier integer "none")
@@ -375,6 +374,31 @@
     ("orphans" integer)
     ("widows" integer)
 
+    ;; CSS Masking Module Level 1
+    ;; (https://www.w3.org/TR/css-masking-1/#property-index)
+    ("clip-path" clip-source basic-shape geometry-box "none")
+    ("clip-rule" "nonzero" "evenodd")
+    ("mask-image" mask-reference)
+    ("mask-mode" masking-mode)
+    ("mask-repeat" repeat-style)
+    ("mask-position" position)
+    ("mask-clip" geometry-box "no-clip")
+    ("mask-origin" geometry-box)
+    ("mask-size" bg-size)
+    ("mask-composite" compositing-operator)
+    ("mask" mask-layer)
+    ("mask-border-source" "none" image)
+    ("mask-border-mode" "luminance" "alpha")
+    ("mask-border-slice" number percentage "fill")
+    ("mask-border-width" length percentage number "auto")
+    ("mask-border-outset" length number)
+    ("mask-border-repeat" "stretch" "repeat" "round" "space")
+    ("mask-border" mask-border-source mask-border-slice
+     mask-border-width mask-border-outset mask-border-repeat
+     mask-border-mode)
+    ("mask-type" "luminance" "alpha")
+    ("clip" "rect()" "auto")
+
     ;; CSS Multi-column Layout Module
     ;; (https://www.w3.org/TR/css3-multicol/#property-index)
     ;; "break-after", "break-before", and "break-inside" are left out
@@ -652,14 +676,17 @@ further value candidates, since that list would be 
infinite.")
     (attachment "scroll" "fixed" "local")
     (auto-repeat "repeat()")
     (auto-track-list line-names fixed-size fixed-repeat auto-repeat)
+    (basic-shape "inset()" "circle()" "ellipse()" "polygon()")
     (bg-image image "none")
     (bg-layer bg-image position repeat-style attachment box)
     (bg-size length percentage "auto" "cover" "contain")
     (box "border-box" "padding-box" "content-box")
+    (clip-source uri)
     (color
      "rgb()" "rgba()" "hsl()" "hsla()" named-color "transparent"
      "currentColor")
     (common-lig-values "common-ligatures" "no-common-ligatures")
+    (compositing-operator "add" "subtract" "intersect" "exclude")
     (contextual-alt-values "contextual" "no-contextual")
     (counter "counter()" "counters()")
     (discretionary-lig-values
@@ -685,6 +712,7 @@ further value candidates, since that list would be 
infinite.")
     (generic-family
      "serif" "sans-serif" "cursive" "fantasy" "monospace")
     (generic-voice "male" "female" "child")
+    (geometry-box shape-box "fill-box" "stroke-box" "view-box")
     (gradient
      linear-gradient radial-gradient repeating-linear-gradient
      repeating-radial-gradient)
@@ -705,6 +733,12 @@ further value candidates, since that list would be 
infinite.")
     (line-width length "thin" "medium" "thick")
     (linear-gradient "linear-gradient()")
     (margin-width "auto" length percentage)
+    (mask-layer
+     mask-reference masking-mode position bg-size repeat-style
+     geometry-box "no-clip" compositing-operator)
+    (mask-reference "none" image mask-source)
+    (mask-source uri)
+    (masking-mode "alpha" "luminance" "auto")
     (named-color . ,(mapcar #'car css--color-map))
     (number "calc()")
     (numeric-figure-values "lining-nums" "oldstyle-nums")
@@ -720,7 +754,7 @@ further value candidates, since that list would be 
infinite.")
     (repeating-linear-gradient "repeating-linear-gradient()")
     (repeating-radial-gradient "repeating-radial-gradient()")
     (shadow "inset" length color)
-    (shape "rect()")
+    (shape-box box "margin-box")
     (single-animation-direction
      "normal" "reverse" "alternate" "alternate-reverse")
     (single-animation-fill-mode "none" "forwards" "backwards" "both")
@@ -858,7 +892,7 @@ cannot be completed sensibly: `custom-ident',
     (,(concat "@" css-ident-re) (0 font-lock-builtin-face))
     ;; Selectors.
     ;; Allow plain ":root" as a selector.
-    ("^[ \t]*\\(:root\\)\\(?:[\n \t]*\\)*{" (1 'css-selector keep))
+    ("^[ \t]*\\(:root\\)[\n \t]*{" (1 'css-selector keep))
     ;; FIXME: attribute selectors don't work well because they may contain
     ;; strings which have already been highlighted as f-l-string-face and
     ;; thus prevent this highlighting from being applied (actually now that
@@ -881,7 +915,7 @@ cannot be completed sensibly: `custom-ident',
        "\\(?:\\(:" (regexp-opt (append css-pseudo-class-ids
                                        css-pseudo-element-ids)
                                t)
-       "\\|\\::" (regexp-opt css-pseudo-element-ids t) "\\)"
+       "\\|::" (regexp-opt css-pseudo-element-ids t) "\\)"
        "\\(?:([^)]+)\\)?"
        (if (not sassy)
            "[^:{}()\n]*"
@@ -1216,20 +1250,20 @@ for determining whether point is within a selector."
 
 (defun css-smie-rules (kind token)
   (pcase (cons kind token)
-    (`(:elem . basic) css-indent-offset)
-    (`(:elem . arg) 0)
+    ('(:elem . basic) css-indent-offset)
+    ('(:elem . arg) 0)
     ;; "" stands for BOB (bug#15467).
     (`(:list-intro . ,(or ";" "" ":-property")) t)
-    (`(:before . "{")
+    ('(:before . "{")
      (when (or (smie-rule-hanging-p) (smie-rule-bolp))
        (smie-backward-sexp ";")
        (unless (eq (char-after) ?\{)
          (smie-indent-virtual))))
-    (`(:before . "(")
+    ('(:before . "(")
      (cond
       ((smie-rule-hanging-p) (smie-rule-parent 0))
       ((not (smie-rule-bolp)) 0)))
-    (`(:after . ":-property")
+    ('(:after . ":-property")
      (when (smie-rule-hanging-p)
        css-indent-offset))))
 
@@ -1523,7 +1557,7 @@ rgb()/rgba()."
         (prev nil))
     (dolist (sel selectors)
       (cond
-       ((seq-contains sel ?&)
+       ((seq-contains-p sel ?&)
         (setq sel (replace-regexp-in-string "&" prev sel))
         (pop processed))
        ;; Unless this is the first selector, separate this one and the
diff --git a/lisp/textmodes/dns-mode.el b/lisp/textmodes/dns-mode.el
index 87ae35d..1dbc7bd 100644
--- a/lisp/textmodes/dns-mode.el
+++ b/lisp/textmodes/dns-mode.el
@@ -1,6 +1,6 @@
 ;;; dns-mode.el --- a mode for viewing/editing Domain Name System master files
 
-;; Copyright (C) 2000-2001, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2001, 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 ;; Keywords: DNS master zone file SOA comm
@@ -114,9 +114,9 @@
                        "26.1" 'set)
 
 (defcustom dns-mode-font-lock-keywords
-  `((,(concat "^$" (regexp-opt dns-mode-control-entities))
+  `((,(concat "^\\$" (regexp-opt dns-mode-control-entities))
      0 ,dns-mode-control-entity-face)
-    ("^$[a-z0-9A-Z]+" 0 ,dns-mode-bad-control-entity-face)
+    ("^\\$[a-z0-9A-Z]+" 0 ,dns-mode-bad-control-entity-face)
     (,(regexp-opt dns-mode-classes) 0 ,dns-mode-class-face)
     (,(regexp-opt dns-mode-types) 0 ,dns-mode-type-face))
   "Font lock keywords used to highlight text in DNS master file mode."
@@ -292,9 +292,9 @@ Examples:
   (skip-syntax-backward " ")
   (skip-syntax-backward "w_.")
   (re-search-forward "\\([[:xdigit:]:]+\\)\\(/-?[0-9]\\{2,3\\}\\)?")
-  (kill-new (match-string 0))
   (let ((address (match-string 1))
         (prefix-length (match-string 2)))
+    (kill-new (match-string 0))
     (when prefix-length
       (setq prefix-length (string-to-number (substring prefix-length 1)))
       (if negate-prefix
diff --git a/lisp/textmodes/enriched.el b/lisp/textmodes/enriched.el
index f2065cb..e89ffea 100644
--- a/lisp/textmodes/enriched.el
+++ b/lisp/textmodes/enriched.el
@@ -1,6 +1,6 @@
 ;;; enriched.el --- read and save files in text/enriched format
 
-;; Copyright (C) 1994-1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Boris Goldowsky <address@hidden>
 ;; Keywords: wp, faces
diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el
index 08e975f..c285491 100644
--- a/lisp/textmodes/fill.el
+++ b/lisp/textmodes/fill.el
@@ -1,6 +1,6 @@
 ;;; fill.el --- fill commands for Emacs
 
-;; Copyright (C) 1985-1986, 1992, 1994-1997, 1999, 2001-2018 Free
+;; Copyright (C) 1985-1986, 1992, 1994-1997, 1999, 2001-2019 Free
 ;; Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 37f2245..d18916d 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1,6 +1,6 @@
 ;;; flyspell.el --- On-the-fly spell checker  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Manuel Serrano <address@hidden>
 ;; Maintainer: address@hidden
@@ -929,7 +929,7 @@ Mostly we check word delimiters."
                           (or (string= "" ispell-otherchars)
                               (not (looking-at ispell-otherchars)))
                           (or flyspell-consider-dash-as-word-delimiter-flag
-                              (not (looking-at "\\-")))
+                              (not (looking-at "-")))
                           2)))))
        (format "  because    : %S\n"
                (cond
@@ -947,7 +947,7 @@ Mostly we check word delimiters."
                             (or (string= "" ispell-otherchars)
                                 (not (looking-at ispell-otherchars)))
                             (or flyspell-consider-dash-as-word-delimiter-flag
-                                (not (looking-at "\\-")))))))
+                                (not (looking-at "-")))))))
                  ;; Yes because we have reached or typed a word delimiter.
                  'separator)
                 ((not (integerp flyspell-delay))
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 87bcb5d..6553a27 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1,6 +1,6 @@
 ;;; ispell.el --- interface to spell checkers  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1994-1995, 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1995, 1997-2019 Free Software Foundation, Inc.
 
 ;; Author:           Ken Stevens <address@hidden>
 
@@ -726,6 +726,7 @@ Otherwise returns the library directory name, if that is 
defined."
        ;; Make sure these variables are (re-)initialized to the default value
        (setq ispell-really-aspell nil
               ispell-really-hunspell nil
+              ispell-really-enchant nil
              ispell-encoding8-command nil)
 
        (goto-char (point-min))
@@ -1106,7 +1107,19 @@ dictionary from that list was found."
                                 null-device
                                 t
                                 nil
-                                "-D")
+                                 "-D"
+                                 ;; Use -a to prevent Hunspell from
+                                 ;; trying to initialize its
+                                 ;; curses/termcap UI, which causes it
+                                 ;; to crash or fail to start in some
+                                 ;; MS-Windows ports.
+                                 "-a"
+                                 ;; Hunspell 1.7.0 (and later?) won't
+                                 ;; show LOADED DICTIONARY unless
+                                 ;; there's at least one file argument
+                                 ;; on the command line.  So we feed
+                                 ;; it with the null device.
+                                null-device)
            (buffer-string))
          "[\n\r]+"
          t))
@@ -1260,7 +1273,6 @@ aspell is used along with Emacs).")
 (defun ispell-set-spellchecker-params ()
   "Initialize some spellchecker parameters when changed or first used."
   (unless (eq ispell-last-program-name ispell-program-name)
-    (setq ispell-last-program-name ispell-program-name)
     (ispell-kill-ispell t)
     (if (and (condition-case ()
                 (progn
@@ -1375,7 +1387,8 @@ aspell is used along with Emacs).")
                            (nth 7 adict)))
                       adict)
                     tmp-dicts-alist :test #'equal))
-      (setq ispell-dictionary-alist tmp-dicts-alist))))
+      (setq ispell-dictionary-alist tmp-dicts-alist)))
+      (setq ispell-last-program-name ispell-program-name))
 
 (defun ispell-valid-dictionary-list ()
   "Return a list of valid dictionaries.
@@ -1777,11 +1790,15 @@ You can set this variable in hooks in your init file -- 
eg:
 
 
 (defun ispell-accept-output (&optional timeout-secs timeout-msecs)
-  "Wait for output from Ispell process, or TIMEOUT-SECS and TIMEOUT-MSECS.
+  "Wait for output from Ispell process, or for TIMEOUT-SECS + TIMEOUT-MSECS.
+\(The TIMEOUT-MSECS argument is obsolete and should be avoided.)
 If asynchronous subprocesses are not supported, call function `ispell-filter'
 and pass it the output of the last Ispell invocation."
   (if ispell-async-processp
-      (accept-process-output ispell-process timeout-secs timeout-msecs)
+      (let ((timeout (if timeout-msecs
+                        (+ (or timeout-secs 0) (/ timeout-msecs 1000.0))
+                      timeout-secs)))
+       (accept-process-output ispell-process timeout))
     (if (null ispell-process)
        (error "No Ispell process to read output from!")
       (let ((buf ispell-output-buffer)
@@ -3458,7 +3475,7 @@ Returns the sum SHIFT due to changes in word 
replacements."
             ;; Error in tex mode when a potential math mode change exists.
             (if (and replace (listp replace) (= 2 (length replace)))
                 (if (and (eq ispell-parser 'tex)
-                         (string-match "[\\\\][]()[]\\|\\\\begin\\|\\$"
+                         (string-match "[\\][]()[]\\|\\\\begin\\|\\$"
                                        (regexp-quote string)))
                     (error
                      "Don't start query replace on a line with math characters"
diff --git a/lisp/textmodes/less-css-mode.el b/lisp/textmodes/less-css-mode.el
index 1f9b24d..b4c7f28 100644
--- a/lisp/textmodes/less-css-mode.el
+++ b/lisp/textmodes/less-css-mode.el
@@ -1,6 +1,6 @@
 ;;; less-css-mode.el --- Major mode for editing Less CSS files  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Steve Purcell <address@hidden>
 ;; Maintainer: Simen Heggestøyl <address@hidden>
diff --git a/lisp/textmodes/makeinfo.el b/lisp/textmodes/makeinfo.el
index 99654a2..ff3d242 100644
--- a/lisp/textmodes/makeinfo.el
+++ b/lisp/textmodes/makeinfo.el
@@ -1,6 +1,6 @@
 ;;; makeinfo.el --- run makeinfo conveniently
 
-;; Copyright (C) 1991, 1993, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 1993, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Robert J. Chassell
 ;; Maintainer: address@hidden
diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el
index 552fcd3..7de24c7 100644
--- a/lisp/textmodes/mhtml-mode.el
+++ b/lisp/textmodes/mhtml-mode.el
@@ -1,6 +1,6 @@
 ;;; mhtml-mode.el --- HTML editing mode that handles CSS and JS -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Keywords: wp, hypermedia, comm, languages
 
@@ -23,12 +23,10 @@
 
 (eval-and-compile
   (require 'cl-lib)
-  (require 'flyspell)
   (require 'sgml-mode))
 (require 'js)
 (require 'css-mode)
 (require 'prog-mode)
-(require 'font-lock)
 
 (defcustom mhtml-tag-relative-indent t
   "How <script> and <style> bodies are indented relative to the tag.
@@ -350,6 +348,8 @@ This is used by `mhtml--pre-command'.")
       ;; HTML.
       (sgml-indent-line))))
 
+(declare-function flyspell-generic-progmode-verify "flyspell")
+
 (defun mhtml--flyspell-check-word ()
   (let ((submode (get-text-property (point) 'mhtml-submode)))
     (if submode
diff --git a/lisp/textmodes/nroff-mode.el b/lisp/textmodes/nroff-mode.el
index 51a9f58..f33d4df 100644
--- a/lisp/textmodes/nroff-mode.el
+++ b/lisp/textmodes/nroff-mode.el
@@ -1,6 +1,6 @@
 ;;; nroff-mode.el --- GNU Emacs major mode for editing nroff source
 
-;; Copyright (C) 1985-1986, 1994-1995, 1997, 2001-2018 Free Software
+;; Copyright (C) 1985-1986, 1994-1995, 1997, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/textmodes/page-ext.el b/lisp/textmodes/page-ext.el
index 92fce4d..23e2d28 100644
--- a/lisp/textmodes/page-ext.el
+++ b/lisp/textmodes/page-ext.el
@@ -1,6 +1,6 @@
 ;;; page-ext.el --- extended page handling commands  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1990-1991, 1993-1994, 2001-2018 Free Software
+;; Copyright (C) 1990-1991, 1993-1994, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Robert J. Chassell <address@hidden>
diff --git a/lisp/textmodes/page.el b/lisp/textmodes/page.el
index cbd9168..220ef2d 100644
--- a/lisp/textmodes/page.el
+++ b/lisp/textmodes/page.el
@@ -1,6 +1,6 @@
 ;;; page.el --- page motion commands for Emacs
 
-;; Copyright (C) 1985, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: wp convenience
diff --git a/lisp/textmodes/paragraphs.el b/lisp/textmodes/paragraphs.el
index ee81256..92a6b90 100644
--- a/lisp/textmodes/paragraphs.el
+++ b/lisp/textmodes/paragraphs.el
@@ -1,6 +1,6 @@
 ;;; paragraphs.el --- paragraph and sentence parsing
 
-;; Copyright (C) 1985-1987, 1991, 1994-1997, 1999-2018 Free Software
+;; Copyright (C) 1985-1987, 1991, 1994-1997, 1999-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el
index 6836fd0..b520849 100644
--- a/lisp/textmodes/picture.el
+++ b/lisp/textmodes/picture.el
@@ -1,6 +1,6 @@
 ;;; picture.el --- "Picture mode" -- editing using quarter-plane screen model
 
-;; Copyright (C) 1985, 1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: K. Shane Hartman
 ;; Maintainer: address@hidden
@@ -387,7 +387,8 @@ Interactively, ARG is the numeric argument, and defaults to 
1."
 \\[picture-set-tab-stops] and \\[picture-tab-search].
 The syntax for this variable is like the syntax used inside of `[...]'
 in a regular expression--but without the `[' and the `]'.
-It is NOT a regular expression, any regexp special characters will be quoted.
+It is NOT a regular expression, and should follow the usual
+rules for the contents of a character alternative.
 It defines a set of \"interesting characters\" to look for when setting
 \(or searching for) tab stops, initially \"!-~\" (all printing characters).
 For example, suppose that you are editing a table which is formatted thus:
@@ -425,7 +426,7 @@ stops computed are displayed in the minibuffer with `:' at 
each stop."
       (if arg
          (setq tabs (or (default-value 'tab-stop-list)
                         (indent-accumulate-tab-stops (window-width))))
-       (let ((regexp (concat "[ \t]+[" (regexp-quote picture-tab-chars) "]")))
+       (let ((regexp (concat "[ \t]+[" picture-tab-chars "]")))
          (beginning-of-line)
          (let ((bol (point)))
            (end-of-line)
@@ -433,8 +434,8 @@ stops computed are displayed in the minibuffer with `:' at 
each stop."
              (skip-chars-forward " \t")
              (setq tabs (cons (current-column) tabs)))
            (if (null tabs)
-               (error "No characters in set %s on this line"
-                      (regexp-quote picture-tab-chars))))))
+               (error "No characters in set [%s] on this line"
+                      picture-tab-chars)))))
       (setq tab-stop-list tabs)
       (let ((blurb (make-string (1+ (nth (1- (length tabs)) tabs)) ?\ )))
        (while tabs
@@ -455,12 +456,13 @@ If no such character is found, move to beginning of line."
               (progn
                 (beginning-of-line)
                 (skip-chars-backward
-                 (concat "^" (regexp-quote picture-tab-chars))
+                 (concat "^" (replace-regexp-in-string
+                              "\\\\" "\\\\" picture-tab-chars nil t))
                  (point-min))
                 (not (bobp))))
          (move-to-column target))
       (if (re-search-forward
-          (concat "[ \t]+[" (regexp-quote picture-tab-chars) "]")
+          (concat "[ \t]+[" picture-tab-chars "]")
           (line-end-position)
           'move)
          (setq target (1- (current-column)))
diff --git a/lisp/textmodes/po.el b/lisp/textmodes/po.el
index 27c5fb7..100ce95 100644
--- a/lisp/textmodes/po.el
+++ b/lisp/textmodes/po.el
@@ -1,6 +1,6 @@
 ;;; po.el --- basic support of PO translation files
 
-;; Copyright (C) 1995-1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Authors: François Pinard <address@hidden>,
 ;;          Greg McGary <address@hidden>,
diff --git a/lisp/textmodes/refbib.el b/lisp/textmodes/refbib.el
index 98ba123..3ba52e6 100644
--- a/lisp/textmodes/refbib.el
+++ b/lisp/textmodes/refbib.el
@@ -1,6 +1,6 @@
 ;;; refbib.el --- convert refer-style references to ones usable by Latex bib
 
-;; Copyright (C) 1989, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1989, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Henry Kautz <address@hidden>
 ;; Maintainer: address@hidden
@@ -137,7 +137,7 @@ This is in addition to the 
`r2b-capitalize-title-stop-words'.")
 
 (defvar r2b-capitalize-title-stop-words
    (concat
-      "the\\|and\\|of\\|is\\|a\\|an\\|of\\|for\\|in\\|to\\|in\\|on\\|at\\|"
+      "the\\|and\\|of\\|is\\|a\\|an\\|for\\|in\\|to\\|on\\|at\\|"
       "by\\|with\\|that\\|its")
    "Words not to be capitalized in a title (unless the first word).")
 
diff --git a/lisp/textmodes/refer.el b/lisp/textmodes/refer.el
index f378e64..f13e1d7 100644
--- a/lisp/textmodes/refer.el
+++ b/lisp/textmodes/refer.el
@@ -1,6 +1,6 @@
 ;;; refer.el --- look up references in bibliography files
 
-;; Copyright (C) 1992, 1996, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992, 1996, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Ashwin Ram <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/textmodes/refill.el b/lisp/textmodes/refill.el
index 229d6a2..5c69fdc 100644
--- a/lisp/textmodes/refill.el
+++ b/lisp/textmodes/refill.el
@@ -1,6 +1,6 @@
 ;;; refill.el --- `auto-fill' by refilling paragraphs on changes
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;; Maintainer: Miles Bader <address@hidden>
@@ -169,7 +169,7 @@ complex processing.")
   (when refill-doit ; there was a change
     ;; There's probably scope for more special cases here...
     (pcase this-command
-      (`self-insert-command
+      ('self-insert-command
        ;; Treat self-insertion commands specially, since they don't
        ;; always reset `refill-doit' -- for self-insertion commands that
        ;; *don't* cause a refill, we want to leave it turned on so that
@@ -179,9 +179,9 @@ complex processing.")
         ;; newline, covered below).
         (refill-fill-paragraph-at refill-doit)
         (setq refill-doit nil)))
-      ((or `quoted-insert `fill-paragraph `fill-region) nil)
-      ((or `newline `newline-and-indent `open-line `indent-new-comment-line
-           `reindent-then-newline-and-indent)
+      ((or 'quoted-insert 'fill-paragraph 'fill-region) nil)
+      ((or 'newline 'newline-and-indent 'open-line 'indent-new-comment-line
+           'reindent-then-newline-and-indent)
        ;; Don't zap what was just inserted.
        (save-excursion
         (beginning-of-line)            ; for newline-and-indent
diff --git a/lisp/textmodes/reftex-auc.el b/lisp/textmodes/reftex-auc.el
index d1b78ff..e9f9885 100644
--- a/lisp/textmodes/reftex-auc.el
+++ b/lisp/textmodes/reftex-auc.el
@@ -1,6 +1,6 @@
 ;;; reftex-auc.el --- RefTeX's interface to AUCTeX
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index fd229a6..5b42b25 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -1,6 +1,6 @@
 ;;; reftex-cite.el --- creating citations with RefTeX
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
@@ -172,7 +172,7 @@ If RETURN is non-nil, just return the entry and restore 
point."
         (if item
             (progn (end-of-line)
                    (re-search-forward
-                    "\\\\bibitem\\|\\end{thebibliography}")
+                    "\\\\bibitem\\|\\\\end{thebibliography}")
                    (1- (match-beginning 0)))
           (progn (forward-list 1) (point)))
       (error (min (point-max) (+ 300 (point)))))))
@@ -447,7 +447,7 @@ If FIELD is empty try \"editor\" field."
         (setq names (reftex-get-bib-field "editor" entry)))
     (while (string-match "\\band\\b[ \t]*" names)
       (setq names (replace-match "\n" nil t names)))
-    (while (string-match "[\\.a-zA-Z\\-]+\\.[ \t]*\\|,.*\\|[{}]+" names)
+    (while (string-match "[-.a-zA-Z]+\\.[ \t]*\\|,.*\\|[{}]+" names)
       (setq names (replace-match "" nil t names)))
     (while (string-match "^[ \t]+\\|[ \t]+$" names)
       (setq names (replace-match "" nil t names)))
diff --git a/lisp/textmodes/reftex-dcr.el b/lisp/textmodes/reftex-dcr.el
index 74a5e63..8973e5d 100644
--- a/lisp/textmodes/reftex-dcr.el
+++ b/lisp/textmodes/reftex-dcr.el
@@ -1,6 +1,6 @@
 ;;; reftex-dcr.el --- viewing cross references and citations with RefTeX
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/textmodes/reftex-global.el b/lisp/textmodes/reftex-global.el
index c234247..cdff2f4 100644
--- a/lisp/textmodes/reftex-global.el
+++ b/lisp/textmodes/reftex-global.el
@@ -1,6 +1,6 @@
 ;;; reftex-global.el --- operations on entire documents with RefTeX
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/textmodes/reftex-index.el b/lisp/textmodes/reftex-index.el
index 781e3e9..9f5242a 100644
--- a/lisp/textmodes/reftex-index.el
+++ b/lisp/textmodes/reftex-index.el
@@ -1,6 +1,6 @@
 ;;; reftex-index.el --- index support with RefTeX
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/textmodes/reftex-parse.el b/lisp/textmodes/reftex-parse.el
index 492f546..005816e 100644
--- a/lisp/textmodes/reftex-parse.el
+++ b/lisp/textmodes/reftex-parse.el
@@ -1,6 +1,6 @@
 ;;; reftex-parse.el --- parser functions for RefTeX
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
@@ -1000,7 +1000,7 @@ OPT-ARGS is a list of argument numbers which are 
optional."
                     (eq (following-char) ?\{))
           (cl-incf cnt)))
       (if (and (= n cnt)
-               (> (skip-chars-forward "{\\[") 0))
+               (> (skip-chars-forward "{[") 0))
           (reftex-context-substring)
         nil))))
 
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index eb8d98c..3ec96aa 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -1,6 +1,6 @@
 ;;; reftex-ref.el --- code to create labels and references with RefTeX
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
@@ -308,7 +308,7 @@ also applies `reftex-translate-to-ascii-function' to the 
string."
   ;; Replace %escapes in a label prefix
   (save-match-data
     (let (letter (num 0) replace)
-      (while (string-match "\\%\\([a-zA-Z]\\)" prefix num)
+      (while (string-match "%\\([a-zA-Z]\\)" prefix num)
         (setq letter (match-string 1 prefix))
         (setq replace
               (save-match-data
diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el
index f9e2cf8..1a605ec 100644
--- a/lisp/textmodes/reftex-sel.el
+++ b/lisp/textmodes/reftex-sel.el
@@ -1,6 +1,6 @@
 ;;; reftex-sel.el --- the selection modes for RefTeX
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el
index 9c158a5..30e4c45 100644
--- a/lisp/textmodes/reftex-toc.el
+++ b/lisp/textmodes/reftex-toc.el
@@ -1,6 +1,6 @@
 ;;; reftex-toc.el --- RefTeX's table of contents mode
 
-;; Copyright (C) 1997-2000, 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2000, 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index e7fe8ff..88ad447 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -1,6 +1,6 @@
 ;;; reftex-vars.el --- configuration variables for RefTeX
 
-;; Copyright (C) 1997-1999, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1999, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
@@ -891,21 +891,58 @@ DOWNCASE    t:   Downcase words before using them."
     ;; so this list mustn't get any more items.
     (defconst reftex-label-regexps '("\\\\label{\\([^}]*\\)}"))
   (defcustom reftex-label-regexps
-    '(;; Normal \\label{foo} labels
+    `(;; Normal \\label{foo} labels
       "\\\\label{\\(?1:[^}]*\\)}"
       ;; keyvals [..., label = {foo}, ...] forms used by ctable,
-      ;; listings, minted, ...
-      
"\\[[^][]\\{0,2000\\}\\<label[[:space:]]*=[[:space:]]*{?\\(?1:[^],}]+\\)}?")
+      ;; listings, breqn, ...
+      ,(concat
+        ;; Make sure we search only for optional arguments of
+        ;; environments/macros and don't match any other [.  ctable
+        ;; provides a macro called \ctable, listings/breqn have
+        ;; environments.  Start with a backslash and a group for names
+        "\\\\\\(?:"
+        ;; begin, optional spaces and opening brace
+        "begin[[:space:]]*{"
+        ;; Build a regexp for env names
+        (regexp-opt '("lstlisting" "dmath" "dseries" "dgroup" "darray"))
+        ;; closing brace, optional spaces
+        "}[[:space:]]*"
+        ;; Now for macros
+        "\\|"
+        ;; Build a regexp for macro names; currently only \ctable
+        (regexp-opt '("ctable"))
+        ;; Close the group for names
+        "\\)"
+        ;; Match the opening [ and the following chars
+        "\\[[^][]*"
+        ;; Allow nested levels of chars enclosed in braces
+        "\\(?:{[^}{]*"
+          "\\(?:{[^}{]*"
+            "\\(?:{[^}{]*}[^}{]*\\)*"
+          "}[^}{]*\\)*"
+        "}[^][]*\\)*"
+        ;; Match the label key
+        "\\<label[[:space:]]*=[[:space:]]*"
+        ;; Match the label value; braces around the value are
+        ;; optional.
+        "{?\\(?1:[^] ,}\r\n\t%]+\\)}?"
+        ;; We are done.  Just search until the next closing bracket
+        "[^]]*\\]"))
     "List of regexps matching \\label definitions.
 The default value matches usual \\label{...} definitions and
-keyval style [..., label = {...}, ...] label definitions.  It is
-assumed that the regexp group 1 matches the label text, so you
-have to define it using \\(?1:...\\) when adding new regexps.
+keyval style [..., label = {...}, ...] label definitions.  The
+regexp for keyval style explicitly looks for environments
+provided by the packages \"listings\" (\"lstlisting\"),
+\"breqn\" (\"dmath\", \"dseries\", \"dgroup\", \"darray\") and
+the macro \"\\ctable\" provided by the package of the same name.
+
+It is assumed that the regexp group 1 matches the label text, so
+you have to define it using \\(?1:...\\) when adding new regexps.
 
 When changed from Lisp, make sure to call
 `reftex-compile-variables' afterwards to make the change
 effective."
-    :version "25.1"
+    :version "27.1"
     :set (lambda (symbol value)
           (set symbol value)
           (when (fboundp 'reftex-compile-variables)
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index ea28e09..d763769 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -1,5 +1,5 @@
 ;;; reftex.el --- minor mode for doing \label, \ref, \cite, \index in LaTeX
-;; Copyright (C) 1997-2000, 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2000, 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: Carsten Dominik <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/textmodes/remember.el b/lisp/textmodes/remember.el
index 83bfc79..67ecd3c 100644
--- a/lisp/textmodes/remember.el
+++ b/lisp/textmodes/remember.el
@@ -1,6 +1,6 @@
 ;;; remember --- a mode for quickly jotting down things to remember
 
-;; Copyright (C) 1999-2001, 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2001, 2003-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el
index 126804f..ba5d7e4 100644
--- a/lisp/textmodes/rst.el
+++ b/lisp/textmodes/rst.el
@@ -1,6 +1,6 @@
 ;;; rst.el --- Mode for viewing and editing reStructuredText-documents  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: Stefan Merten <stefan at merten-home dot de>
 ;; Author: Stefan Merten <stefan at merten-home dot de>,
@@ -225,7 +225,7 @@ and before TAIL-RE and DELIM-RE in VAR or DEFAULT for no 
match."
   "The SVN revision of this file.
 SVN revision is the upstream (docutils) revision.")
 (defconst rst-svn-timestamp
-  (rst-extract-version "\\$" "LastChangedDate: " ".+?+" " "
+  (rst-extract-version "\\$" "LastChangedDate: " ".+" " "
                       "$LastChangedDate: 2017-01-08 10:54:35 +0100 (Sun, 08 
Jan 2017) $")
   "The SVN time stamp of this file.")
 
diff --git a/lisp/textmodes/sgml-mode.el b/lisp/textmodes/sgml-mode.el
index 470f4a3..9e3be99 100644
--- a/lisp/textmodes/sgml-mode.el
+++ b/lisp/textmodes/sgml-mode.el
@@ -1,6 +1,6 @@
 ;;; sgml-mode.el --- SGML- and HTML-editing modes -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992, 1995-1996, 1998, 2001-2018 Free Software
+;; Copyright (C) 1992, 1995-1996, 1998, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: James Clark <address@hidden>
@@ -46,8 +46,7 @@
 
 (defcustom sgml-basic-offset 2
   "Specifies the basic indentation level for `sgml-indent-line'."
-  :type 'integer
-  :group 'sgml)
+  :type 'integer)
 
 (defcustom sgml-attribute-offset 0
   "Specifies a delta for attribute indentation in `sgml-indent-line'.
@@ -65,16 +64,14 @@ When 2, attribute indentation looks like this:
   </element>"
   :version "25.1"
   :type 'integer
-  :safe 'integerp
-  :group 'sgml)
+  :safe 'integerp)
 
 (defcustom sgml-xml-mode nil
   "When non-nil, tag insertion functions will be XML-compliant.
 It is set to be buffer-local when the file has
 a DOCTYPE or an XML declaration."
   :type 'boolean
-  :version "22.1"
-  :group 'sgml)
+  :version "22.1")
 
 (defvaralias 'sgml-transformation 'sgml-transformation-function)
 
@@ -89,8 +86,7 @@ a DOCTYPE or an XML declaration."
                    (and (derived-mode-p 'sgml-mode)
                         (not sgml-xml-mode)
                         (setq skeleton-transformation-function val))))
-               (buffer-list)))
-  :group 'sgml)
+               (buffer-list))))
 
 (put 'sgml-transformation-function 'variable-interactive
      "aTransformation function: ")
@@ -98,7 +94,6 @@ a DOCTYPE or an XML declaration."
 (defcustom sgml-mode-hook nil
   "Hook run by command `sgml-mode'.
 `text-mode-hook' is run first."
-  :group 'sgml
   :type 'hook)
 
 ;; As long as Emacs's syntax can't be complemented with predicates to context
@@ -211,8 +206,7 @@ This takes effect when first loading the `sgml-mode' 
library.")
 
 (defcustom sgml-name-8bit-mode nil
   "When non-nil, insert non-ASCII characters as named entities."
-  :type 'boolean
-  :group 'sgml)
+  :type 'boolean)
 
 (defvar sgml-char-names
   [nil nil nil nil nil nil nil nil
@@ -282,8 +276,7 @@ Currently, only Latin-1 characters are supported.")
 The file name of current buffer file name will be appended to this,
 separated by a space."
   :type 'string
-  :version "21.1"
-  :group 'sgml)
+  :version "21.1")
 
 (defvar sgml-saved-validate-command nil
   "The command last used to validate in this buffer.")
@@ -292,8 +285,7 @@ separated by a space."
 ;; so use a small distance here.
 (defcustom sgml-slash-distance 1000
   "If non-nil, is the maximum distance to search for matching `/'."
-  :type '(choice (const nil) integer)
-  :group 'sgml)
+  :type '(choice (const nil) integer))
 
 (defconst sgml-namespace-re "[_[:alpha:]][-_.[:alnum:]]*")
 (defconst sgml-name-re "[_:[:alpha:]][-_.:[:alnum:]]*")
@@ -305,8 +297,7 @@ Any terminating `>' or `/' is not matched.")
 
 (defface sgml-namespace
   '((t (:inherit font-lock-builtin-face)))
-  "`sgml-mode' face used to highlight the namespace part of identifiers."
-  :group 'sgml)
+  "`sgml-mode' face used to highlight the namespace part of identifiers.")
 (defvar sgml-namespace-face 'sgml-namespace)
 
 ;; internal
@@ -352,12 +343,21 @@ Any terminating `>' or `/' is not matched.")
      ("--[ \t\n]*\\(>\\)" (1 "> b"))
      ("\\(<\\)[?!]" (1 (prog1 "|>"
                          (sgml-syntax-propertize-inside end))))
-     ;; Double quotes outside of tags should not introduce strings.
-     ;; Be careful to call `syntax-ppss' on a position before the one we're
-     ;; going to change, so as not to need to flush the data we just computed.
-     ("\"" (0 (if (prog1 (zerop (car (syntax-ppss (match-beginning 0))))
-                    (goto-char (match-end 0)))
-                  (string-to-syntax ".")))))))
+     ;; Double quotes outside of tags should not introduce strings which end up
+     ;; hiding tags.  We used to test every double quote and mark it as "."
+     ;; if it's outside of tags, but there are too many double quotes and
+     ;; the resulting number of calls to syntax-ppss made it too slow
+     ;; (bug#33887), so we're now careful to leave alone any pair
+     ;; of quotes that doesn't hold a < or > char, which is the vast majority.
+     ("\\(\"\\)[^\"<>]*[<>\"]"
+      (1 (unless (eq ?\" (char-before))
+           ;; Be careful to call `syntax-ppss' on a position before the one
+           ;; we're going to change, so as not to need to flush the data we
+           ;; just computed.
+           (if (prog1 (zerop (car (syntax-ppss (match-beginning 0))))
+                 (goto-char (1- (match-end 0))))
+               (string-to-syntax ".")))))
+     )))
 
 (defun sgml-syntax-propertize (start end)
   "Syntactic keywords for `sgml-mode'."
@@ -421,8 +421,7 @@ The attribute alist is made up as
 ATTRIBUTERULE is a list of optionally t (no value when no input) followed by
 an optional alist of possible values."
   :type '(repeat (cons (string :tag "Tag Name")
-                      (repeat :tag "Tag Rule" sexp)))
-  :group 'sgml)
+                      (repeat :tag "Tag Rule" sexp))))
 (put 'sgml-tag-alist 'risky-local-variable t)
 
 (defcustom sgml-tag-help
@@ -434,8 +433,7 @@ an optional alist of possible values."
     ("!entity" . "Entity (macro) declaration"))
   "Alist of tag name and short description."
   :type '(repeat (cons (string :tag "Tag Name")
-                      (string :tag "Description")))
-  :group 'sgml)
+                      (string :tag "Description"))))
 
 (defvar sgml-empty-tags nil
   "List of tags whose !ELEMENT definition says EMPTY.")
@@ -461,7 +459,7 @@ an optional alist of possible values."
               nil t)
          (string-match "X\\(HT\\)?ML" (match-string 3))))))
 
-(defvar v2)                            ; free for skeleton
+(with-no-warnings (defvar v2))                         ; free for skeleton
 
 (defun sgml-comment-indent-new-line (&optional soft)
   (let ((comment-start "-- ")
@@ -896,7 +894,7 @@ Return non-nil if we skipped over matched tags."
   (condition-case err
   (save-excursion
     (goto-char end)
-    (skip-chars-backward "[:alnum:]-_.:")
+    (skip-chars-backward "-[:alnum:]_.:")
     (if (and ;; (<= (point) beg) ; This poses problems for downcase-word.
              (or (eq (char-before) ?<)
                  (and (eq (char-before) ?/)
@@ -904,7 +902,7 @@ Return non-nil if we skipped over matched tags."
              (null (get-char-property (point) 'text-clones)))
         (let* ((endp (eq (char-before) ?/))
                (cl-start (point))
-               (cl-end (progn (skip-chars-forward "[:alnum:]-_.:") (point)))
+              (cl-end (progn (skip-chars-forward "-[:alnum:]_.:") (point)))
                (match
                 (if endp
                     (when (sgml-skip-tag-backward 1) (forward-char 1) t)
@@ -921,7 +919,8 @@ Return non-nil if we skipped over matched tags."
                      (equal (buffer-substring cl-start cl-end)
                             (buffer-substring (point)
                                               (save-excursion
-                                                (skip-chars-forward 
"[:alnum:]-_.:")
+                                               (skip-chars-forward
+                                                "-[:alnum:]_.:")
                                                 (point))))
                      (or (not endp) (eq (char-after cl-end) ?>)))
             (when clones
@@ -1524,12 +1523,12 @@ Depending on context, inserts a matching close-tag, or 
closes
 the current start-tag or the current comment or the current cdata, ..."
   (interactive)
   (pcase (car (sgml-lexical-context))
-    (`comment  (insert " -->"))
-    (`cdata    (insert "]]>"))
-    (`pi       (insert " ?>"))
-    (`jsp      (insert " %>"))
-    (`tag      (insert " />"))
-    (`text
+    ('comment  (insert " -->"))
+    ('cdata    (insert "]]>"))
+    ('pi       (insert " ?>"))
+    ('jsp      (insert " %>"))
+    ('tag      (insert " />"))
+    ('text
      (let ((context (save-excursion (sgml-get-context))))
        (if context
            (progn
@@ -1562,7 +1561,7 @@ LCON is the lexical context, if any."
 
   (pcase (car lcon)
 
-    (`string
+    ('string
      ;; Go back to previous non-empty line.
      (while (and (> (point) (cdr lcon))
                 (zerop (forward-line -1))
@@ -1573,7 +1572,7 @@ LCON is the lexical context, if any."
        (goto-char (cdr lcon))
        (1+ (current-column))))
 
-    (`comment
+    ('comment
      (let ((mark (looking-at "--")))
        ;; Go back to previous non-empty line.
        (while (and (> (point) (cdr lcon))
@@ -1592,11 +1591,11 @@ LCON is the lexical context, if any."
        (current-column)))
 
     ;; We don't know how to indent it.  Let's be honest about it.
-    (`cdata nil)
+    ('cdata nil)
     ;; We don't know how to indent it.  Let's be honest about it.
-    (`pi nil)
+    ('pi nil)
 
-    (`tag
+    ('tag
      (goto-char (+ (cdr lcon) sgml-attribute-offset))
      (skip-chars-forward "^ \t\n")     ;Skip tag name.
      (skip-chars-forward " \t")
@@ -1606,7 +1605,7 @@ LCON is the lexical context, if any."
        (goto-char (+ (cdr lcon) sgml-attribute-offset))
        (+ (current-column) sgml-basic-offset)))
 
-    (`text
+    ('text
      (while (looking-at "</")
        (sgml-forward-sexp 1)
        (skip-chars-forward " \t"))
@@ -1722,7 +1721,6 @@ Currently just returns (EMPTY-TAGS UNCLOSED-TAGS)."
 (defcustom html-mode-hook nil
   "Hook run by command `html-mode'.
 `text-mode-hook' and `sgml-mode-hook' are run first."
-  :group 'sgml
   :type 'hook
   :options '(html-autoview-mode))
 
@@ -2381,10 +2379,9 @@ HTML Autoview mode is a buffer-local minor mode for use 
with
 `html-mode'.  If enabled, saving the file automatically runs
 `browse-url-of-buffer' to view it."
   nil nil nil
-  :group 'sgml
   (if html-autoview-mode
-      (add-hook 'after-save-hook 'browse-url-of-buffer nil t)
-    (remove-hook 'after-save-hook 'browse-url-of-buffer t)))
+      (add-hook 'after-save-hook #'browse-url-of-buffer nil t)
+    (remove-hook 'after-save-hook #'browse-url-of-buffer t)))
 
 
 (define-skeleton html-href-anchor
diff --git a/lisp/textmodes/table.el b/lisp/textmodes/table.el
index 49d1fc2..bed8b2f 100644
--- a/lisp/textmodes/table.el
+++ b/lisp/textmodes/table.el
@@ -1,6 +1,6 @@
 ;;; table.el --- create and edit WYSIWYG text based embedded tables  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Keywords: wp, convenience
 ;; Author: Takaaki Ota <address@hidden>
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 8b06777..9c91d27 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1,6 +1,6 @@
 ;;; tex-mode.el --- TeX, LaTeX, and SliTeX mode commands  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985-1986, 1989, 1992, 1994-1999, 2001-2018 Free
+;; Copyright (C) 1985-1986, 1989, 1992, 1994-1999, 2001-2019 Free
 ;; Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -601,9 +601,9 @@ An alternative value is \" . \", if you use a font with a 
narrow period."
        (list (concat slash citations opt arg) 3 'font-lock-constant-face)
        ;;
        ;; Text between `` quotes ''.
-       (cons (concat (regexp-opt `("``" "\"<" "\"`" "<<" "«") t)
+       (cons (concat (regexp-opt '("``" "\"<" "\"`" "<<" "«") t)
                      "[^'\">{]+"       ;a bit pessimistic
-                     (regexp-opt `("''" "\">" "\"'" ">>" "»") t))
+                     (regexp-opt '("''" "\">" "\"'" ">>" "»") t))
              'font-lock-string-face)
        ;;
        ;; Command names, special and general.
@@ -1656,7 +1656,7 @@ Puts point on a blank line between them."
     (let ((pt (point)))
       (skip-chars-backward "^ {}\n\t\\\\")
       (pcase (char-before)
-        ((or `nil ?\s ?\n ?\t ?\}) nil)
+        ((or 'nil ?\s ?\n ?\t ?\}) nil)
         (?\\
          ;; TODO: Complete commands.
          nil)
@@ -2994,7 +2994,7 @@ There might be text before point."
              (mapcar
               (lambda (x)
                 (pcase (car-safe x)
-                  (`font-lock-syntactic-face-function
+                  ('font-lock-syntactic-face-function
                    (cons (car x) #'doctex-font-lock-syntactic-face-function))
                   (_ x)))
               (cdr font-lock-defaults))))
diff --git a/lisp/textmodes/texinfmt.el b/lisp/textmodes/texinfmt.el
index e89da65..4bfecb4 100644
--- a/lisp/textmodes/texinfmt.el
+++ b/lisp/textmodes/texinfmt.el
@@ -1,6 +1,6 @@
 ;;; texinfmt.el --- format Texinfo files into Info files
 
-;; Copyright (C) 1985-1986, 1988, 1990-1998, 2000-2018 Free Software
+;; Copyright (C) 1985-1986, 1988, 1990-1998, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: Robert J. Chassell <address@hidden>
@@ -552,13 +552,7 @@ if large.  You can use `Info-split' to do this manually."
 
 (defvar texinfo-accent-commands
   (concat
-   "@^\\|"
-   "@`\\|"
-   "@'\\|"
-   "@\"\\|"
-   "@,\\|"
-   "@=\\|"
-   "@~\\|"
+   "@[\"',=^`~]\\|"
    "@OE{\\|"
    "@oe{\\|"
    "@AA{\\|"
diff --git a/lisp/textmodes/texinfo.el b/lisp/textmodes/texinfo.el
index ff723a4..71cdcab 100644
--- a/lisp/textmodes/texinfo.el
+++ b/lisp/textmodes/texinfo.el
@@ -1,6 +1,6 @@
 ;;; texinfo.el --- major mode for editing Texinfo files
 
-;; Copyright (C) 1985, 1988-1993, 1996-1997, 2000-2018 Free Software
+;; Copyright (C) 1985, 1988-1993, 1996-1997, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Robert J. Chassell
@@ -470,6 +470,7 @@ Subexpression 1 is what goes into the corresponding 
address@hidden' statement.")
     (define-key map "\C-c\C-cu"    'address@hidden)
     (define-key map "\C-c\C-ct"    'address@hidden)
     (define-key map "\C-c\C-cs"    'address@hidden)
+    (define-key map "\C-c\C-cr"    'address@hidden)
     (define-key map "\C-c\C-cq"    'address@hidden)
     (define-key map "\C-c\C-co"    'address@hidden)
     (define-key map "\C-c\C-cn"    'address@hidden)
@@ -825,6 +826,38 @@ Leave point after address@hidden'."
   "Insert the string address@hidden' in a Texinfo buffer."
   \n "@quotation" \n _ \n)
 
+(define-skeleton address@hidden
+  "Insert appropriate address@hidden', address@hidden', or address@hidden' 
command.
+
+Looks at text around point to decide what to insert; an unclosed
+preceding open parenthesis results in '@pxref{}', point at the
+beginning of a sentence or at (point-min) yields '@xref{}', any
+other location (including inside a word), will result in '@ref{}'
+at the nearest previous whitespace or beginning-of-line.  A
+numeric argument says how many words the braces should surround.
+The default is not to surround any existing words with the
+braces."
+  nil
+  (cond
+   ;; parenthesis
+   ((looking-back "([^)]*" (point-at-bol 0))
+    "@pxref{")
+   ;; beginning of sentence or buffer
+   ((or (looking-back (sentence-end) (point-at-bol 0))
+        (= (point) (point-min)))
+    "@xref{")
+   ;; bol or eol
+   ((looking-at "^\\|$")
+    "@ref{")
+   ;; inside word
+   ((not (eq (char-syntax (char-after)) ? ))
+    (skip-syntax-backward "^ " (point-at-bol))
+    "@ref{")
+   ;; everything else
+   (t
+    "@ref{"))
+  _ "}")
+
 (define-skeleton address@hidden
   "Insert a address@hidden' command in a Texinfo buffer.
 A numeric argument says how many words the braces should surround.
diff --git a/lisp/textmodes/texnfo-upd.el b/lisp/textmodes/texnfo-upd.el
index a41042d..e960e99 100644
--- a/lisp/textmodes/texnfo-upd.el
+++ b/lisp/textmodes/texnfo-upd.el
@@ -1,6 +1,6 @@
 ;;; texnfo-upd.el --- utilities for updating nodes and menus in Texinfo files
 
-;; Copyright (C) 1989-1992, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1989-1992, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Robert J. Chassell
 ;; Maintainer: address@hidden
@@ -642,7 +642,7 @@ appears in the texinfo file."
   "Return description field of old menu line as string.
 Point must be located just after the node name.  Point left before description.
 Single argument, END-OF-MENU, is position limiting search."
-  (skip-chars-forward "[:.,\t\n ]+")
+  (skip-chars-forward ":.,\t\n ")
   ;; don't copy a carriage return at line beginning with asterisk!
   ;; don't copy @detailmenu or @end menu or @ignore as descriptions!
   ;; do copy a description that begins with an `@'!
diff --git a/lisp/textmodes/text-mode.el b/lisp/textmodes/text-mode.el
index 8dd4682..931faad 100644
--- a/lisp/textmodes/text-mode.el
+++ b/lisp/textmodes/text-mode.el
@@ -1,6 +1,6 @@
 ;;; text-mode.el --- text mode, and its idiosyncratic commands
 
-;; Copyright (C) 1985, 1992, 1994, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1985, 1992, 1994, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/textmodes/tildify.el b/lisp/textmodes/tildify.el
index 613d78d..cf33d44 100644
--- a/lisp/textmodes/tildify.el
+++ b/lisp/textmodes/tildify.el
@@ -1,6 +1,6 @@
 ;;; tildify.el --- adding hard spaces into texts -*- lexical-binding: t -*-
 
-;; Copyright (C) 1997-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-2019 Free Software Foundation, Inc.
 
 ;; Author:     Milan Zamazal <address@hidden>
 ;;             Michal Nazarewicz <address@hidden>
diff --git a/lisp/textmodes/two-column.el b/lisp/textmodes/two-column.el
index d27abb4..e1ebf1a 100644
--- a/lisp/textmodes/two-column.el
+++ b/lisp/textmodes/two-column.el
@@ -1,6 +1,6 @@
 ;;; two-column.el --- minor mode for editing of two-column text
 
-;; Copyright (C) 1992-1995, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1995, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Daniel Pfeiffer <address@hidden>
 ;; Adapted-By: ESR, Daniel Pfeiffer
diff --git a/lisp/textmodes/underline.el b/lisp/textmodes/underline.el
index 8b4ac2f..e0bfd24 100644
--- a/lisp/textmodes/underline.el
+++ b/lisp/textmodes/underline.el
@@ -1,6 +1,6 @@
 ;;; underline.el --- insert/remove underlining (done by overstriking) in Emacs
 
-;; Copyright (C) 1985, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: wp
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 5f9de9a..26e0843 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -1,6 +1,6 @@
 ;;; thingatpt.el --- get the `thing' at point  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1991-1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991-1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Mike Williams <address@hidden>
 ;; Maintainer: address@hidden
@@ -466,11 +466,14 @@ looks like an email address, \"ftp://\"; if it starts with
      (while htbs
        (setq htb (car htbs) htbs (cdr htbs))
        (ignore-errors
-        ;; errs: htb symbol may be unbound, or not a hash-table.
-        ;; gnus-gethash is just a macro for intern-soft.
-        (and (symbol-value htb)
-             (intern-soft string (symbol-value htb))
-             (setq ret string htbs nil))
+         (setq htb (symbol-value htb))
+        (when (cond ((obarrayp htb)
+                     (intern-soft string htb))
+                     ((listp htb)
+                      (member string htb))
+                     ((hash-table-p htb)
+                      (gethash string htb)))
+          (setq ret string htbs nil))
         ;; If we made it this far, gnus is running, so ignore "heads":
         (setq heads nil)))
      (or ret (not heads)
diff --git a/lisp/thread.el b/lisp/thread.el
index 7974a26..e8f3cc7 100644
--- a/lisp/thread.el
+++ b/lisp/thread.el
@@ -1,6 +1,6 @@
 ;;; thread.el --- Thread support in Emacs Lisp -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/thumbs.el b/lisp/thumbs.el
index 067a32b..6a17a75 100644
--- a/lisp/thumbs.el
+++ b/lisp/thumbs.el
@@ -1,6 +1,6 @@
 ;;; thumbs.el --- Thumbnails previewer for images files
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Jean-Philippe Theberge <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/time-stamp.el b/lisp/time-stamp.el
index 4e7f5ef..91e02be 100644
--- a/lisp/time-stamp.el
+++ b/lisp/time-stamp.el
@@ -1,6 +1,6 @@
 ;;; time-stamp.el --- Maintain last change time stamps in files edited by Emacs
 
-;; Copyright (C) 1989, 1993-1995, 1997, 2000-2018 Free Software
+;; Copyright (C) 1989, 1993-1995, 1997, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
diff --git a/lisp/time.el b/lisp/time.el
index bfecba9..35157c5 100644
--- a/lisp/time.el
+++ b/lisp/time.el
@@ -1,6 +1,6 @@
 ;;; time.el --- display time, load and mail indicator in mode line of Emacs
 
-;; Copyright (C) 1985-1987, 1993-1994, 1996, 2000-2018 Free Software
+;; Copyright (C) 1985-1987, 1993-1994, 1996, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -434,16 +434,17 @@ update which can wait for the next redisplay."
                ((and (stringp mail-spool-file)
                      (or (null display-time-server-down-time)
                          ;; If have been down for 20 min, try again.
-                         (< 1200 (- (float-time now)
-                                    display-time-server-down-time))))
-                (let ((start-time (float-time)))
+                         (time-less-p 1200 (time-since
+                                            display-time-server-down-time))))
+                (let ((start-time (current-time)))
                   (prog1
                       (display-time-file-nonempty-p mail-spool-file)
                     ;; Record whether mail file is accessible.
                     (setq display-time-server-down-time
-                          (let ((end-time (float-time)))
-                            (and (< 20 (- end-time start-time))
-                                 end-time))))))))
+                          (let ((end-time (current-time)))
+                            (and (time-less-p 20 (time-subtract
+                                                  end-time start-time))
+                                 (float-time end-time)))))))))
          (24-hours (substring time 11 13))
          (hour (string-to-number 24-hours))
          (12-hours (int-to-string (1+ (% (+ hour 11) 12))))
@@ -571,8 +572,9 @@ For example, the Unix uptime command format is \"%D, 
%z%2h:%.2m\"."
   (interactive)
   (let ((str
          (format-seconds (or format "%Y, %D, %H, %M, %z%S")
-                         (float-time
-                          (time-subtract nil before-init-time)))))
+                        (encode-time
+                         (time-since before-init-time)
+                         'integer))))
     (if (called-interactively-p 'interactive)
         (message "%s" str)
       str)))
@@ -582,7 +584,7 @@ For example, the Unix uptime command format is \"%D, 
%z%2h:%.2m\"."
   "Return a string giving the duration of the Emacs initialization."
   (interactive)
   (let ((str
-        (format "%.1f seconds"
+        (format "%s seconds"
                 (float-time
                  (time-subtract after-init-time before-init-time)))))
     (if (called-interactively-p 'interactive)
diff --git a/lisp/timezone.el b/lisp/timezone.el
index ee83d3a..621f024 100644
--- a/lisp/timezone.el
+++ b/lisp/timezone.el
@@ -1,6 +1,6 @@
 ;;; timezone.el --- time zone package for GNU Emacs
 
-;; Copyright (C) 1990-1993, 1996, 1999, 2001-2018 Free Software
+;; Copyright (C) 1990-1993, 1996, 1999, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Masanobu Umeda
diff --git a/lisp/tmm.el b/lisp/tmm.el
index ff62774..44f04ea 100644
--- a/lisp/tmm.el
+++ b/lisp/tmm.el
@@ -1,6 +1,6 @@
 ;;; tmm.el --- text mode access to menu-bar  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1994-1996, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1996, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Ilya Zakharevich <address@hidden>
 ;; Maintainer: address@hidden
@@ -42,6 +42,23 @@
 (defvar tmm-next-shortcut-digit)
 (defvar tmm-table-undef)
 
+(defun tmm-menubar-keymap ()
+  "Return the current menu-bar keymap.
+
+The ordering of the return value respects `menu-bar-final-items'."
+  (let ((menu-bar '())
+        (menu-end '()))
+    (map-keymap
+     (lambda (key binding)
+       (push (cons key binding)
+             ;; If KEY is the name of an item that we want to put last,
+             ;; move it to the end.
+             (if (memq key menu-bar-final-items)
+                 menu-end
+               menu-bar)))
+     (tmm-get-keybind [menu-bar]))
+    `(keymap ,@(nreverse menu-bar) ,@(nreverse menu-end))))
+
 ;;;###autoload (define-key global-map "\M-`" 'tmm-menubar)
 ;;;###autoload (define-key global-map [menu-bar mouse-1] 'tmm-menubar-mouse)
 
@@ -58,19 +75,8 @@ to invoke `tmm-menubar' instead, customize the variable
   (interactive)
   (run-hooks 'menu-bar-update-hook)
   ;; Obey menu-bar-final-items; put those items last.
-  (let ((menu-bar '())
-        (menu-end '())
+  (let ((menu-bar (tmm-menubar-keymap))
        menu-bar-item)
-    (map-keymap
-     (lambda (key binding)
-       (push (cons key binding)
-             ;; If KEY is the name of an item that we want to put last,
-             ;; move it to the end.
-             (if (memq key menu-bar-final-items)
-                 menu-end
-               menu-bar)))
-     (tmm-get-keybind [menu-bar]))
-    (setq menu-bar `(keymap ,@(nreverse menu-bar) ,@(nreverse menu-end)))
     (if x-position
        (let ((column 0)
               prev-key)
@@ -154,7 +160,7 @@ specify nil for this variable."
 (defvar tmm--history nil)
 
 ;;;###autoload
-(defun tmm-prompt (menu &optional in-popup default-item)
+(defun tmm-prompt (menu &optional in-popup default-item no-execute)
   "Text-mode emulation of calling the bindings in keymap.
 Creates a text-mode menu of possible choices.  You can access the elements
 in the menu in two ways:
@@ -165,7 +171,9 @@ The last alternative is currently a hack, you cannot use 
mouse reliably.
 MENU is like the MENU argument to `x-popup-menu': either a
 keymap or an alist of alists.
 DEFAULT-ITEM, if non-nil, specifies an initial default choice.
-Its value should be an event that has a binding in MENU."
+Its value should be an event that has a binding in MENU.
+NO-EXECUTE, if non-nil, means to return the command the user selects
+instead of executing it."
   ;; If the optional argument IN-POPUP is t,
   ;; then MENU is an alist of elements of the form (STRING . VALUE).
   ;; That is used for recursive calls only.
@@ -268,7 +276,7 @@ Its value should be an event that has a binding in MENU."
           ;; We just did the inner level of a -popup menu.
           choice)
          ;; We just did the outer level.  Do the inner level now.
-         (not-menu (tmm-prompt choice t))
+         (not-menu (tmm-prompt choice t nil no-execute))
          ;; We just handled a menu keymap and found another keymap.
          ((keymapp choice)
           (if (symbolp choice)
@@ -276,11 +284,11 @@ Its value should be an event that has a binding in MENU."
           (condition-case nil
               (require 'mouse)
             (error nil))
-          (tmm-prompt choice))
+          (tmm-prompt choice nil nil no-execute))
          ;; We just handled a menu keymap and found a command.
          (choice
           (if chosen-string
-              (progn
+              (if no-execute choice
                 (setq last-command-event chosen-string)
                 (call-interactively choice))
             choice)))))
diff --git a/lisp/tool-bar.el b/lisp/tool-bar.el
index e2242cf..4be16b2 100644
--- a/lisp/tool-bar.el
+++ b/lisp/tool-bar.el
@@ -1,6 +1,6 @@
 ;;; tool-bar.el --- setting up the tool bar
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;; Keywords: mouse frames
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index 384d3d1..b1c69ae 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -1,6 +1,6 @@
 ;;; tooltip.el --- show tooltip windows
 
-;; Copyright (C) 1997, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Gerd Moellmann <address@hidden>
 ;; Keywords: help c mouse tools
@@ -201,7 +201,8 @@ This might return nil if the event did not occur over a 
buffer."
 (defun tooltip-delay ()
   "Return the delay in seconds for the next tooltip."
   (if (and tooltip-hide-time
-           (< (- (float-time) tooltip-hide-time) tooltip-recent-seconds))
+          (time-less-p (time-since tooltip-hide-time)
+                       tooltip-recent-seconds))
       tooltip-short-delay
     tooltip-delay))
 
diff --git a/lisp/tree-widget.el b/lisp/tree-widget.el
index 2346035..61bfacd 100644
--- a/lisp/tree-widget.el
+++ b/lisp/tree-widget.el
@@ -1,6 +1,6 @@
 ;;; tree-widget.el --- Tree widget
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: David Ponce <address@hidden>
 ;; Maintainer: David Ponce <address@hidden>
diff --git a/lisp/tutorial.el b/lisp/tutorial.el
index 1ddf7a8..37ebb5c 100644
--- a/lisp/tutorial.el
+++ b/lisp/tutorial.el
@@ -1,6 +1,6 @@
 ;;; tutorial.el --- tutorial for Emacs
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: help, internal
@@ -476,8 +476,8 @@ where
                    ((and cua-mode
                          (or (and (eq def-fun 'ESC-prefix)
                                   (equal key-fun
-                                         `(keymap
-                                           (118 . cua-repeat-replace-region)))
+                                         '(keymap
+                                            (118 . cua-repeat-replace-region)))
                                   (setq def-fun-txt "\"ESC prefix\""))
                              (and (eq def-fun 'mode-specific-command-prefix)
                                   (equal key-fun
diff --git a/lisp/type-break.el b/lisp/type-break.el
index c7cdc46..0ad79dd 100644
--- a/lisp/type-break.el
+++ b/lisp/type-break.el
@@ -1,6 +1,6 @@
 ;;; type-break.el --- encourage rests from typing at appropriate intervals  
-*- lexical-binding: t -*-
 
-;; Copyright (C) 1994-1995, 1997, 2000-2018 Free Software Foundation,
+;; Copyright (C) 1994-1995, 1997, 2000-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Noah Friedman
@@ -460,8 +460,7 @@ the variable of the same name."
              ))))))
 
 (defun timep (time)
-  "If TIME is in the format returned by `current-time' then
-return TIME, else return nil."
+  "If TIME is a Lisp time value then return TIME, else return nil."
   (condition-case nil
       (and (float-time time) time)
     (error nil)))
@@ -481,8 +480,7 @@ return TIME, else return nil."
 
 (defun type-break-get-previous-time ()
   "Get previous break time from `type-break-file-name'.
-Returns nil if the file is missing or if the time breaks with the
-`current-time' format."
+Return nil if the file is missing or if the time is not a Lisp time value."
   (let ((file (type-break-choose-file)))
     (if file
         (timep ;; returns expected format, else nil
@@ -808,7 +806,7 @@ this or ask the user to start one right now."
    ((and (car type-break-keystroke-threshold)
          (< type-break-keystroke-count (car type-break-keystroke-threshold))))
    ((> type-break-time-warning-count 0)
-    (let ((timeleft (type-break-time-difference (current-time)
+    (let ((timeleft (type-break-time-difference nil
                                                 type-break-time-next-break)))
       (setq type-break-warning-countdown-string (number-to-string timeleft))
       (cond
@@ -905,8 +903,8 @@ Current keystroke count     : %s"
                                (current-time-string type-break-time-next-break)
                                (type-break-format-time
                                 (type-break-time-difference
-                                (current-time)
-                                type-break-time-next-break)))
+                                nil
+                                type-break-time-next-break)))
                      "none scheduled")
                    (or (car type-break-keystroke-threshold) "none")
                    (or (cdr type-break-keystroke-threshold) "none")
@@ -1090,7 +1088,7 @@ With optional non-nil ALL, force redisplay of all 
mode-lines."
             (erase-buffer)
             (setq elapsed (type-break-time-difference
                            type-break-time-last-break
-                           (current-time)))
+                          nil))
             (let ((good-interval (or type-break-good-rest-interval
                                      type-break-good-break-interval)))
               (cond
diff --git a/lisp/uniquify.el b/lisp/uniquify.el
index 9cc7b00..3dd9e34 100644
--- a/lisp/uniquify.el
+++ b/lisp/uniquify.el
@@ -1,6 +1,6 @@
 ;;; uniquify.el --- unique buffer names dependent on file name -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1989, 1995-1997, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1989, 1995-1997, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Dick King <address@hidden>
diff --git a/lisp/url/ChangeLog.1 b/lisp/url/ChangeLog.1
index fb9dbaa..828c9b1 100644
--- a/lisp/url/ChangeLog.1
+++ b/lisp/url/ChangeLog.1
@@ -3068,7 +3068,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1999, 2001-2002, 2004-2018 Free Software Foundation,
+  Copyright (C) 1999, 2001-2002, 2004-2019 Free Software Foundation,
   Inc.
 
   This file is part of GNU Emacs.
diff --git a/lisp/url/url-about.el b/lisp/url/url-about.el
index a9c7e86..e9d9d63 100644
--- a/lisp/url/url-about.el
+++ b/lisp/url/url-about.el
@@ -1,6 +1,6 @@
 ;;; url-about.el --- Show internal URLs
 
-;; Copyright (C) 2001, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el
index 401baec..0746cfd 100644
--- a/lisp/url/url-auth.el
+++ b/lisp/url/url-auth.el
@@ -1,6 +1,6 @@
 ;;; url-auth.el --- Uniform Resource Locator authorization modules -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
@@ -192,8 +192,7 @@ key cache `url-digest-auth-storage'."
 (defun url-digest-auth-make-cnonce ()
   "Compute a new unique client nonce value."
   (base64-encode-string
-   (apply #'format "%016x%08x%08x" (random)
-         (read (format-time-string "(%s %N)")))
+   (format "%016x%016x" (random) (car (encode-time nil t)))
    t))
 
 (defun url-digest-auth-nonce-count (_nonce)
diff --git a/lisp/url/url-cache.el b/lisp/url/url-cache.el
index 3765d9d..b306082 100644
--- a/lisp/url/url-cache.el
+++ b/lisp/url/url-cache.el
@@ -1,6 +1,6 @@
 ;;; url-cache.el --- Uniform Resource Locator retrieval tool
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
@@ -205,7 +205,7 @@ If `url-standalone-mode' is non-nil, cached items never 
expire."
          (time-less-p
           (time-add
            cache-time
-           (seconds-to-time (or expire-time url-cache-expire-time)))
+           (or expire-time url-cache-expire-time))
           nil)))))
 
 (defun url-cache-prune-cache (&optional directory)
@@ -227,7 +227,7 @@ considered \"expired\"."
           ((time-less-p
             (time-add
              (file-attribute-modification-time (file-attributes file))
-             (seconds-to-time url-cache-expire-time))
+             url-cache-expire-time)
             now)
            (delete-file file)
            (setq deleted-files (1+ deleted-files))))))
diff --git a/lisp/url/url-cid.el b/lisp/url/url-cid.el
index 1422da2..0c1924f 100644
--- a/lisp/url/url-cid.el
+++ b/lisp/url/url-cid.el
@@ -1,6 +1,6 @@
 ;;; url-cid.el --- Content-ID URL loader
 
-;; Copyright (C) 1998-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el
index 3adca26..31fc3e7 100644
--- a/lisp/url/url-cookie.el
+++ b/lisp/url/url-cookie.el
@@ -1,6 +1,6 @@
 ;;; url-cookie.el --- URL cookie support  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
@@ -105,11 +105,10 @@ i.e. 1970-1-1) are loaded as expiring one year from now 
instead."
                    ;; away, make it expire a year from now
                    (expires (format-time-string
                              "%d %b %Y %T [GMT]"
-                             (seconds-to-time
-                              (let ((s (string-to-number (nth 4 fields))))
-                                (if (and (= s 0) long-session)
-                                    (seconds-to-time (+ (* 365 24 60 60) 
(float-time)))
-                                  s)))))
+                             (let ((s (string-to-number (nth 4 fields))))
+                               (if (and (zerop s) long-session)
+                                   (time-add nil (* 365 24 60 60))
+                                 s))))
                    (key (nth 5 fields))
                    (val (nth 6 fields)))
                (cl-incf n)
diff --git a/lisp/url/url-dav.el b/lisp/url/url-dav.el
index 9c8c052..a4cf0f0 100644
--- a/lisp/url/url-dav.el
+++ b/lisp/url/url-dav.el
@@ -1,6 +1,6 @@
 ;;; url-dav.el --- WebDAV support
 
-;; Copyright (C) 2001, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <address@hidden>
 ;; Maintainer: address@hidden
@@ -146,7 +146,7 @@ Returns nil if WebDAV is not supported."
       (setq time (parse-time-string date-string)))
 
     (if time
-       (setq time (apply 'encode-time time))
+       (setq time (encode-time time))
       (url-debug 'dav "Unable to decode date (%S) (%s)"
                 (xml-node-name node) date-string))
     time))
@@ -204,22 +204,22 @@ Returns nil if WebDAV is not supported."
            value nil)
 
       (pcase node-type
-       ((or `dateTime.iso8601tz
-             `dateTime.iso8601
-             `dateTime.tz
-             `dateTime.rfc1123
-             `dateTime
-             `date)                     ; date is our 'special' one...
+       ((or 'dateTime.iso8601tz
+             'dateTime.iso8601
+             'dateTime.tz
+             'dateTime.rfc1123
+             'dateTime
+             'date)                     ; date is our 'special' one...
         ;; Some type of date/time string.
         (setq value (url-dav-process-date-property node)))
-       (`int
+       ('int
         ;; Integer type...
         (setq value (url-dav-process-integer-property node)))
-       ((or `number `float)
+       ((or 'number 'float)
         (setq value (url-dav-process-number-property node)))
-       (`boolean
+       ('boolean
         (setq value (url-dav-process-boolean-property node)))
-       (`uri
+       ('uri
         (setq value (url-dav-process-uri-property node)))
        (_
         (if (not (eq node-type 'unknown))
@@ -611,11 +611,11 @@ Returns t if the lock was successfully released."
       (setq lock (car supported-locks)
            supported-locks (cdr supported-locks))
       (pcase (car lock)
-       (`DAV:write
+       ('DAV:write
         (pcase (cdr lock)
-          (`DAV:shared                 ; group permissions (possibly world)
+          ('DAV:shared                 ; group permissions (possibly world)
            (aset modes 5 ?w))
-          (`DAV:exclusive
+          ('DAV:exclusive
            (aset modes 2 ?w))          ; owner permissions?
           (_
            (url-debug 'dav "Unrecognized DAV:lockscope (%S)" (cdr lock)))))
diff --git a/lisp/url/url-dired.el b/lisp/url/url-dired.el
index 50d84f7..a665db8 100644
--- a/lisp/url/url-dired.el
+++ b/lisp/url/url-dired.el
@@ -1,6 +1,6 @@
 ;;; url-dired.el --- URL Dired minor mode
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, files
 
diff --git a/lisp/url/url-domsuf.el b/lisp/url/url-domsuf.el
index fe8ce6c..151b57f 100644
--- a/lisp/url/url-domsuf.el
+++ b/lisp/url/url-domsuf.el
@@ -1,6 +1,6 @@
 ;;; url-domsuf.el --- Say what domain names can have cookies set.
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 
diff --git a/lisp/url/url-expand.el b/lisp/url/url-expand.el
index 86df7ad..f937a22 100644
--- a/lisp/url/url-expand.el
+++ b/lisp/url/url-expand.el
@@ -1,6 +1,6 @@
 ;;; url-expand.el --- expand-file-name for URLs -*- lexical-binding: t -*-
 
-;; Copyright (C) 1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-file.el b/lisp/url/url-file.el
index 02542cc..b953ce7 100644
--- a/lisp/url/url-file.el
+++ b/lisp/url/url-file.el
@@ -1,6 +1,6 @@
 ;;; url-file.el --- File retrieval code  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-ftp.el b/lisp/url/url-ftp.el
index 7661294..8e64e67 100644
--- a/lisp/url/url-ftp.el
+++ b/lisp/url/url-ftp.el
@@ -1,6 +1,6 @@
 ;;; url-ftp.el --- FTP wrapper
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-future.el b/lisp/url/url-future.el
index 03de150..3a0c712 100644
--- a/lisp/url/url-future.el
+++ b/lisp/url/url-future.el
@@ -1,6 +1,6 @@
 ;;; url-future.el --- general futures facility for url.el -*- lexical-binding: 
t -*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Teodor Zlatanov <address@hidden>
 ;; Keywords: data
diff --git a/lisp/url/url-gw.el b/lisp/url/url-gw.el
index e175036..5436084 100644
--- a/lisp/url/url-gw.el
+++ b/lisp/url/url-gw.el
@@ -1,6 +1,6 @@
 ;;; url-gw.el --- Gateway munging for URL loading
 
-;; Copyright (C) 1997-1998, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <address@hidden>
 ;; Maintainer: address@hidden
@@ -239,7 +239,7 @@ overriding the value of `url-gateway-method'."
          (let ((coding-system-for-read 'binary)
                (coding-system-for-write 'binary))
            (setq conn (pcase gw-method
-                        ((or `tls `ssl `native)
+                        ((or 'tls 'ssl 'native)
                          (if (eq gw-method 'native)
                              (setq gw-method 'plain))
                          (open-network-stream
@@ -249,11 +249,11 @@ overriding the value of `url-gateway-method'."
                           :nowait (and (featurep 'make-network-process)
                                         (url-asynchronous url-current-object)
                                         '(:nowait t))))
-                         (`socks
+                         ('socks
                          (socks-open-network-stream name buffer host service))
-                        (`telnet
+                        ('telnet
                          (url-open-telnet name buffer host service))
-                        (`rlogin
+                        ('rlogin
                          (url-open-rlogin name buffer host service))
                         (_
                          (error "Bad setting of url-gateway-method: %s"
diff --git a/lisp/url/url-handlers.el b/lisp/url/url-handlers.el
index 3802c39..e35d999 100644
--- a/lisp/url/url-handlers.el
+++ b/lisp/url/url-handlers.el
@@ -1,6 +1,6 @@
 ;;; url-handlers.el --- file-name-handler stuff for URL loading  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
@@ -44,7 +44,7 @@
 (declare-function mail-content-type-get "mail-parse" (ct attribute))
 ;; mm-decode loads mm-bodies, which loads mm-util.
 (declare-function mm-charset-to-coding-system "mm-util"
-                 (charset &optional lbt allow-override silent))
+                  (charset &optional lbt allow-override silent))
 
 ;; Implementation status
 ;; ---------------------
@@ -260,15 +260,15 @@ the arguments that would have been passed to OPERATION."
 ;; The actual implementation
 ;;;###autoload
 (defun url-copy-file (url newname &optional ok-if-already-exists
-                         _keep-time _preserve-uid-gid)
+                          _keep-time _preserve-uid-gid _preserve-permissions)
   "Copy URL to NEWNAME.  Both args must be strings.
-Signals a `file-already-exists' error if file NEWNAME already exists,
+Signal a `file-already-exists' error if file NEWNAME already exists,
 unless a third argument OK-IF-ALREADY-EXISTS is supplied and non-nil.
 A number as third arg means request confirmation if NEWNAME already exists.
 This is what happens in interactive use with M-x.
 Fourth arg KEEP-TIME non-nil means give the new file the same
 last-modified time as the old one.  (This works on only some systems.)
-Fifth arg PRESERVE-UID-GID is ignored.
+Args PRESERVE-UID-GID and PRESERVE-PERMISSIONS are ignored.
 A prefix arg makes KEEP-TIME non-nil."
   (if (and (file-exists-p newname)
           (not ok-if-already-exists))
@@ -351,7 +351,7 @@ if it had been inserted from a file named URL."
     (unless buffer (signal 'file-error (list url "No Data")))
     (with-current-buffer buffer
       ;; XXX: This is HTTP/S specific and should be moved to url-http
-      ;; instead.  See https://debbugs.gnu.org/17549.
+      ;; instead.  See bug#17549.
       (when (bound-and-true-p url-http-response-status)
         ;; Don't signal an error if VISIT is non-nil, because
         ;; 'insert-file-contents' doesn't.  This is required to
@@ -364,7 +364,7 @@ if it had been inserted from a file named URL."
                          (< url-http-response-status 300)))
           (let ((desc (nth 2 (assq url-http-response-status url-http-codes))))
             (kill-buffer buffer)
-            ;; Signal file-error per https://debbugs.gnu.org/16733.
+            ;; Signal file-error per bug#16733.
             (signal 'file-error (list url desc))))))
     (url-insert-buffer-contents buffer url visit beg end replace)))
 
diff --git a/lisp/url/url-history.el b/lisp/url/url-history.el
index 37425c8..d043114 100644
--- a/lisp/url/url-history.el
+++ b/lisp/url/url-history.el
@@ -1,6 +1,6 @@
 ;;; url-history.el --- Global history tracking for URL package  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 6b5749e..1fbc087 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -1,6 +1,6 @@
 ;;; url-http.el --- HTTP retrieval routines  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1999, 2001, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2001, 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <address@hidden>
 ;; Maintainer: address@hidden
@@ -150,7 +150,7 @@ request.")
 ;; These routines will allow us to implement persistent HTTP
 ;; connections.
 (defsubst url-http-debug (&rest args)
-  (if quit-flag
+  (if (eq quit-flag t)
       (let ((proc (get-buffer-process (current-buffer))))
        ;; The user hit C-g, honor it!  Some things can get in an
        ;; incredibly tight loop (chunked encoding)
@@ -513,11 +513,11 @@ Return the number of characters removed."
   (url-http-debug "url-http-parse-response called in (%s)" (buffer-name))
   (goto-char (point-min))
   (skip-chars-forward " \t\n")         ; Skip any blank crap
-  (skip-chars-forward "HTTP/")         ; Skip HTTP Version
+  (skip-chars-forward "/HPT")          ; Skip HTTP Version "HTTP/".
   (setq url-http-response-version
        (buffer-substring (point)
                          (progn
-                           (skip-chars-forward "[0-9].")
+                           (skip-chars-forward "0-9.")
                            (point))))
   (setq url-http-response-status (read (current-buffer))))
 
@@ -613,7 +613,7 @@ should be shown to the user."
        ;; 206 Partial content
        ;; 207 Multi-status (Added by DAV)
        (pcase status-symbol
-        ((or `no-content `reset-content)
+        ((or 'no-content 'reset-content)
          ;; No new data, just stay at the same document
          (url-mark-buffer-as-dead buffer))
         (_
@@ -634,7 +634,7 @@ should be shown to the user."
        (let ((redirect-uri (or (mail-fetch-field "Location")
                               (mail-fetch-field "URI"))))
         (pcase status-symbol
-          (`multiple-choices       ; 300
+          ('multiple-choices       ; 300
            ;; Quoth the spec (section 10.3.1)
            ;; -------------------------------
            ;; The requested resource corresponds to any one of a set of
@@ -651,26 +651,26 @@ should be shown to the user."
            ;; We do not support agent-driven negotiation, so we just
            ;; redirect to the preferred URI if one is provided.
            nil)
-           (`found                     ; 302
+           ('found                     ; 302
            ;; 302 Found was ambiguously defined in the standards, but
            ;; it's now recommended that it's treated like 303 instead
            ;; of 307, since that's what most servers expect.
            (setq url-http-method "GET"
                  url-http-data nil))
-           (`see-other                 ; 303
+           ('see-other                 ; 303
            ;; The response to the request can be found under a different
            ;; URI and SHOULD be retrieved using a GET method on that
            ;; resource.
            (setq url-http-method "GET"
                  url-http-data nil))
-          (`not-modified               ; 304
+          ('not-modified               ; 304
            ;; The 304 response MUST NOT contain a message-body.
            (url-http-debug "Extracting document from cache... (%s)"
                            (url-cache-create-filename (url-view-url t)))
            (url-cache-extract (url-cache-create-filename (url-view-url t)))
            (setq redirect-uri nil
                  success t))
-          (`use-proxy                  ; 305
+          ('use-proxy                  ; 305
            ;; The requested resource MUST be accessed through the
            ;; proxy given by the Location field.  The Location field
            ;; gives the URI of the proxy.  The recipient is expected
@@ -768,50 +768,50 @@ should be shown to the user."
        ;; 424 Failed Dependency
        (setq success
              (pcase status-symbol
-               (`unauthorized                  ; 401
+               ('unauthorized                  ; 401
                 ;; The request requires user authentication.  The response
                 ;; MUST include a WWW-Authenticate header field containing a
                 ;; challenge applicable to the requested resource.  The
                 ;; client MAY repeat the request with a suitable
                 ;; Authorization header field.
                 (url-http-handle-authentication nil))
-               (`payment-required              ; 402
+               ('payment-required              ; 402
                 ;; This code is reserved for future use
                 (url-mark-buffer-as-dead buffer)
                 (error "Somebody wants you to give them money"))
-               (`forbidden                     ; 403
+               ('forbidden                     ; 403
                 ;; The server understood the request, but is refusing to
                 ;; fulfill it.  Authorization will not help and the request
                 ;; SHOULD NOT be repeated.
                 t)
-               (`not-found                     ; 404
+               ('not-found                     ; 404
                 ;; Not found
                 t)
-               (`method-not-allowed            ; 405
+               ('method-not-allowed            ; 405
                 ;; The method specified in the Request-Line is not allowed
                 ;; for the resource identified by the Request-URI.  The
                 ;; response MUST include an Allow header containing a list of
                 ;; valid methods for the requested resource.
                 t)
-               (`not-acceptable                ; 406
+               ('not-acceptable                ; 406
                 ;; The resource identified by the request is only capable of
                 ;; generating response entities which have content
                 ;; characteristics not acceptable according to the accept
                 ;; headers sent in the request.
                 t)
-               (`proxy-authentication-required ; 407
+               ('proxy-authentication-required ; 407
                 ;; This code is similar to 401 (Unauthorized), but indicates
                 ;; that the client must first authenticate itself with the
                 ;; proxy.  The proxy MUST return a Proxy-Authenticate header
                 ;; field containing a challenge applicable to the proxy for
                 ;; the requested resource.
                 (url-http-handle-authentication t))
-               (`request-timeout               ; 408
+               ('request-timeout               ; 408
                 ;; The client did not produce a request within the time that
                 ;; the server was prepared to wait.  The client MAY repeat
                 ;; the request without modifications at any later time.
                 t)
-               (`conflict                      ; 409
+               ('conflict                      ; 409
                 ;; The request could not be completed due to a conflict with
                 ;; the current state of the resource.  This code is only
                 ;; allowed in situations where it is expected that the user
@@ -820,11 +820,11 @@ should be shown to the user."
                 ;; information for the user to recognize the source of the
                 ;; conflict.
                 t)
-               (`gone                          ; 410
+               ('gone                          ; 410
                 ;; The requested resource is no longer available at the
                 ;; server and no forwarding address is known.
                 t)
-               (`length-required               ; 411
+               ('length-required               ; 411
                 ;; The server refuses to accept the request without a defined
                 ;; Content-Length.  The client MAY repeat the request if it
                 ;; adds a valid Content-Length header field containing the
@@ -834,29 +834,29 @@ should be shown to the user."
                 ;; `url-http-create-request' automatically calculates the
                 ;; content-length.
                 t)
-               (`precondition-failed           ; 412
+               ('precondition-failed           ; 412
                 ;; The precondition given in one or more of the
                 ;; request-header fields evaluated to false when it was
                 ;; tested on the server.
                 t)
-               ((or `request-entity-too-large `request-uri-too-large) ; 413 414
+               ((or 'request-entity-too-large 'request-uri-too-large) ; 413 414
                 ;; The server is refusing to process a request because the
                 ;; request entity|URI is larger than the server is willing or
                 ;; able to process.
                 t)
-               (`unsupported-media-type        ; 415
+               ('unsupported-media-type        ; 415
                 ;; The server is refusing to service the request because the
                 ;; entity of the request is in a format not supported by the
                 ;; requested resource for the requested method.
                 t)
-               (`requested-range-not-satisfiable ; 416
+               ('requested-range-not-satisfiable ; 416
                 ;; A server SHOULD return a response with this status code if
                 ;; a request included a Range request-header field, and none
                 ;; of the range-specifier values in this field overlap the
                 ;; current extent of the selected resource, and the request
                 ;; did not include an If-Range request-header field.
                 t)
-               (`expectation-failed            ; 417
+               ('expectation-failed            ; 417
                 ;; The expectation given in an Expect request-header field
                 ;; could not be met by this server, or, if the server is a
                 ;; proxy, the server has unambiguous evidence that the
@@ -883,16 +883,16 @@ should be shown to the user."
        ;; 507 Insufficient storage
        (setq success t)
        (pcase url-http-response-status
-        (`not-implemented              ; 501
+        ('not-implemented              ; 501
          ;; The server does not support the functionality required to
          ;; fulfill the request.
          nil)
-        (`bad-gateway                  ; 502
+        ('bad-gateway                  ; 502
          ;; The server, while acting as a gateway or proxy, received
          ;; an invalid response from the upstream server it accessed
          ;; in attempting to fulfill the request.
          nil)
-        (`service-unavailable          ; 503
+        ('service-unavailable          ; 503
          ;; The server is currently unable to handle the request due
          ;; to a temporary overloading or maintenance of the server.
          ;; The implication is that this is a temporary condition
@@ -901,19 +901,19 @@ should be shown to the user."
          ;; header.  If no Retry-After is given, the client SHOULD
          ;; handle the response as it would for a 500 response.
          nil)
-        (`gateway-timeout              ; 504
+        ('gateway-timeout              ; 504
          ;; The server, while acting as a gateway or proxy, did not
          ;; receive a timely response from the upstream server
          ;; specified by the URI (e.g. HTTP, FTP, LDAP) or some other
          ;; auxiliary server (e.g. DNS) it needed to access in
          ;; attempting to complete the request.
          nil)
-        (`http-version-not-supported   ; 505
+        ('http-version-not-supported   ; 505
          ;; The server does not support, or refuses to support, the
          ;; HTTP protocol version that was used in the request
          ;; message.
          nil)
-        (`insufficient-storage         ; 507 (DAV)
+        ('insufficient-storage         ; 507 (DAV)
          ;; The method could not be performed on the resource
          ;; because the server is unable to store the representation
          ;; needed to successfully complete the request.  This
@@ -1353,10 +1353,10 @@ The return value of this function is the retrieval 
buffer."
        (set-process-buffer connection buffer)
        (set-process-filter connection 'url-http-generic-filter)
        (pcase (process-status connection)
-          (`connect
+          ('connect
            ;; Asynchronous connection
            (set-process-sentinel connection 'url-http-async-sentinel))
-          (`failed
+          ('failed
            ;; Asynchronous connection failed
            (error "Could not create connection to %s:%d" (url-host url)
                   (url-port url)))
diff --git a/lisp/url/url-imap.el b/lisp/url/url-imap.el
index 9d3232b..2fb1880 100644
--- a/lisp/url/url-imap.el
+++ b/lisp/url/url-imap.el
@@ -1,6 +1,6 @@
 ;;; url-imap.el --- IMAP retrieval routines
 
-;; Copyright (C) 1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Simon Josefsson <address@hidden>
 ;; Keywords: comm, data, processes
diff --git a/lisp/url/url-irc.el b/lisp/url/url-irc.el
index 818002b..27b05fc 100644
--- a/lisp/url/url-irc.el
+++ b/lisp/url/url-irc.el
@@ -1,6 +1,6 @@
 ;;; url-irc.el --- IRC URL interface
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-ldap.el b/lisp/url/url-ldap.el
index b60b304..1c73a66 100644
--- a/lisp/url/url-ldap.el
+++ b/lisp/url/url-ldap.el
@@ -1,6 +1,6 @@
 ;;; url-ldap.el --- LDAP Uniform Resource Locator retrieval code
 
-;; Copyright (C) 1998-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-mailto.el b/lisp/url/url-mailto.el
index 3a09ba7..e35a032 100644
--- a/lisp/url/url-mailto.el
+++ b/lisp/url/url-mailto.el
@@ -1,6 +1,6 @@
 ;;; url-mail.el --- Mail Uniform Resource Locator retrieval code
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-methods.el b/lisp/url/url-methods.el
index db6ef72..1c0c5af 100644
--- a/lisp/url/url-methods.el
+++ b/lisp/url/url-methods.el
@@ -1,6 +1,6 @@
 ;;; url-methods.el --- Load URL schemes as needed
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
@@ -134,11 +134,11 @@ it has not already been loaded."
                        (type (cdr cell)))
                    (if symbol
                        (pcase type
-                         (`function
+                         ('function
                           ;; Store the symbol name of a function
                           (if (fboundp symbol)
                               (setq desc (plist-put desc (car cell) symbol))))
-                         (`variable
+                         ('variable
                           ;; Store the VALUE of a variable
                           (if (boundp symbol)
                               (setq desc (plist-put desc (car cell)
diff --git a/lisp/url/url-misc.el b/lisp/url/url-misc.el
index e794786..4969cba 100644
--- a/lisp/url/url-misc.el
+++ b/lisp/url/url-misc.el
@@ -1,6 +1,6 @@
 ;;; url-misc.el --- Misc Uniform Resource Locator retrieval code
 
-;; Copyright (C) 1996-1999, 2002, 2004-2018 Free Software Foundation,
+;; Copyright (C) 1996-1999, 2002, 2004-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Keywords: comm, data, processes
diff --git a/lisp/url/url-news.el b/lisp/url/url-news.el
index ef3842d..750b1be 100644
--- a/lisp/url/url-news.el
+++ b/lisp/url/url-news.el
@@ -1,6 +1,6 @@
 ;;; url-news.el --- News Uniform Resource Locator retrieval code
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-nfs.el b/lisp/url/url-nfs.el
index c25dc27..36535a0 100644
--- a/lisp/url/url-nfs.el
+++ b/lisp/url/url-nfs.el
@@ -1,6 +1,6 @@
 ;;; url-nfs.el --- NFS URL interface
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
diff --git a/lisp/url/url-ns.el b/lisp/url/url-ns.el
index b97f7a7..733f3a9 100644
--- a/lisp/url/url-ns.el
+++ b/lisp/url/url-ns.el
@@ -1,6 +1,6 @@
 ;;; url-ns.el --- Various netscape-ish functions for proxy definitions
 
-;; Copyright (C) 1997-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
diff --git a/lisp/url/url-parse.el b/lisp/url/url-parse.el
index 9cd5c0d..1f72f51 100644
--- a/lisp/url/url-parse.el
+++ b/lisp/url/url-parse.el
@@ -1,6 +1,6 @@
 ;;; url-parse.el --- Uniform Resource Locator parser -*- lexical-binding: t -*-
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes
 
@@ -209,7 +209,7 @@ parses to
            ;; 3.3. Path
            (skip-chars-forward "^?#")
            ;; 3.4. Query
-           (when (looking-at "?")
+           (when (looking-at "\\?")
              (skip-chars-forward "^#"))
            (setq file (buffer-substring save-pos (point)))
            ;; 3.5 Fragment
diff --git a/lisp/url/url-privacy.el b/lisp/url/url-privacy.el
index 92523a6..ef9ff84 100644
--- a/lisp/url/url-privacy.el
+++ b/lisp/url/url-privacy.el
@@ -1,6 +1,6 @@
 ;;; url-privacy.el --- Global history tracking for URL package
 
-;; Copyright (C) 1996-1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
@@ -45,9 +45,9 @@
         ((memq (url-device-type) '(win32 w32)) "Windows; 32bit")
         (t
          (pcase (url-device-type)
-           (`x "X11")
-           (`ns "OpenStep")
-           (`tty "TTY")
+           ('x "X11")
+           ('ns "OpenStep")
+           ('tty "TTY")
            (_ nil)))))
 
   (setq url-personal-mail-address (or url-personal-mail-address
diff --git a/lisp/url/url-proxy.el b/lisp/url/url-proxy.el
index cd9f74b..c62b75a 100644
--- a/lisp/url/url-proxy.el
+++ b/lisp/url/url-proxy.el
@@ -1,6 +1,6 @@
 ;;; url-proxy.el --- Proxy server support
 
-;; Copyright (C) 1999, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999, 2004-2019 Free Software Foundation, Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
 
diff --git a/lisp/url/url-queue.el b/lisp/url/url-queue.el
index cfa8e9a..9bf1bca 100644
--- a/lisp/url/url-queue.el
+++ b/lisp/url/url-queue.el
@@ -1,6 +1,6 @@
 ;;; url-queue.el --- Fetching web pages in parallel   -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Magne Ingebrigtsen <address@hidden>
 ;; Keywords: comm
@@ -162,8 +162,8 @@ The variable `url-queue-timeout' sets a timeout."
     (dolist (job url-queue)
       ;; Kill jobs that have lasted longer than the timeout.
       (when (and (url-queue-start-time job)
-                (> (- (float-time) (url-queue-start-time job))
-                   url-queue-timeout))
+                (time-less-p url-queue-timeout
+                             (time-since (url-queue-start-time job))))
        (push job dead-jobs)))
     (dolist (job dead-jobs)
       (url-queue-kill-job job)
diff --git a/lisp/url/url-tramp.el b/lisp/url/url-tramp.el
index 5c2e574..305635c 100644
--- a/lisp/url/url-tramp.el
+++ b/lisp/url/url-tramp.el
@@ -1,6 +1,6 @@
 ;;; url-tramp.el --- file-name-handler magic invoking Tramp for some protocols
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 ;; Keywords: comm, data, processes, hypermedia
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el
index ffae984..72ff4f1 100644
--- a/lisp/url/url-util.el
+++ b/lisp/url/url-util.el
@@ -1,6 +1,6 @@
 ;;; url-util.el --- Miscellaneous helper routines for URL library -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1996-1999, 2001, 2004-2018 Free Software Foundation,
+;; Copyright (C) 1996-1999, 2001, 2004-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Perry <address@hidden>
@@ -61,7 +61,7 @@ If a list, it is a list of the types of messages to be 
logged."
 
 ;;;###autoload
 (defun url-debug (tag &rest args)
-  (if quit-flag
+  (if (eq quit-flag t)
       (error "Interrupted!"))
   (if (or (eq url-debug t)
          (numberp url-debug)
@@ -74,7 +74,8 @@ If a list, it is a list of the types of messages to be 
logged."
 
 ;;;###autoload
 (defun url-parse-args (str &optional nodowncase)
-  ;; Return an assoc list of attribute/value pairs from an RFC822-type string
+  ;; Return an assoc list of attribute/value pairs from a string
+  ;; that uses RFC 822 (or later) format.
   (let (
        name                            ; From name=
        value                           ; its value
@@ -182,7 +183,7 @@ Will not do anything if `url-show-status' is nil."
          (null url-show-status)
          (active-minibuffer-window)
          (= url-lazy-message-time
-            (setq url-lazy-message-time (nth 1 (current-time)))))
+            (setq url-lazy-message-time (encode-time nil 'integer))))
       nil
     (apply 'message args)))
 
@@ -502,7 +503,7 @@ WIDTH defaults to the current frame width."
         (urlobj nil))
     ;; The first thing that can go are the search strings
     (if (and (>= str-width fr-width)
-            (string-match "?" url))
+            (string-match "\\?" url))
        (setq url (concat (substring url 0 (match-beginning 0)) "?...")
              str-width (length url)))
     (if (< str-width fr-width)
diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el
index ef990a7..ae1d6e5 100644
--- a/lisp/url/url-vars.el
+++ b/lisp/url/url-vars.el
@@ -1,6 +1,6 @@
 ;;; url-vars.el --- Variables for Uniform Resource Locator tool
 
-;; Copyright (C) 1996-1999, 2001, 2004-2018 Free Software Foundation,
+;; Copyright (C) 1996-1999, 2001, 2004-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Keywords: comm, data, processes, hypermedia
diff --git a/lisp/url/url.el b/lisp/url/url.el
index ea58101..ed09477 100644
--- a/lisp/url/url.el
+++ b/lisp/url/url.el
@@ -1,6 +1,6 @@
 ;;; url.el --- Uniform Resource Locator retrieval tool  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 1996-1999, 2001, 2004-2018 Free Software Foundation,
+;; Copyright (C) 1996-1999, 2001, 2004-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Bill Perry <address@hidden>
@@ -259,8 +259,7 @@ how long to wait for a response before giving up."
        ;; process output.
        (while (and (not retrieval-done)
                     (or (not timeout)
-                        (< (float-time (time-subtract nil start-time))
-                           timeout)))
+                       (time-less-p (time-since start-time) timeout)))
          (url-debug 'retrieval
                     "Spinning in url-retrieve-synchronously: %S (%S)"
                     retrieval-done asynch-buffer)
diff --git a/lisp/userlock.el b/lisp/userlock.el
index 73bb0d2..f077bc9 100644
--- a/lisp/userlock.el
+++ b/lisp/userlock.el
@@ -1,6 +1,6 @@
 ;;; userlock.el --- handle file access contention between multiple users
 
-;; Copyright (C) 1985-1986, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1985-1986, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Richard King
 ;; (according to authors.el)
@@ -174,7 +174,9 @@ really edit the buffer? (y, n, r or C-h) "
 
 (defun ask-user-about-supersession-help ()
   (with-output-to-temp-buffer "*Help*"
-    (princ "You want to modify a buffer whose disk file has changed
+    (princ
+     (substitute-command-keys
+      "You want to modify a buffer whose disk file has changed
 since you last read it in or saved it with this buffer.
 
 If you say `y' to go ahead and modify this buffer,
@@ -184,7 +186,7 @@ from the file on disk.
 If you say `n', the change you started to make will be aborted.
 
 Usually, you should type `n' and then `\\[revert-buffer]',
-to get the latest version of the file, then make the change again.")
+to get the latest version of the file, then make the change again."))
     (with-current-buffer standard-output
       (help-mode))))
 
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el
index d6e8540..f9efd44 100644
--- a/lisp/vc/add-log.el
+++ b/lisp/vc/add-log.el
@@ -1,6 +1,6 @@
 ;;; add-log.el --- change log maintenance commands for Emacs
 
-;; Copyright (C) 1985-1986, 1988, 1993-1994, 1997-1998, 2000-2018 Free
+;; Copyright (C) 1985-1986, 1988, 1993-1994, 1997-1998, 2000-2019 Free
 ;; Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -239,7 +239,7 @@ a case simply use the directory containing the changed 
file."
     ;; wrongly with a non-date line existing as a random note.  In
     ;; addition, using any kind of fixed setting like this doesn't
     ;; work if a user customizes add-log-time-format.
-    ("^[0-9-]+ +\\|^ \\{11,\\}\\|^\t 
\\{3,\\}\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\) [A-z][a-z][a-z] 
[0-9:+ ]+"
+    ("^[0-9-]+ +\\|^ \\{11,\\}\\|^\t 
\\{3,\\}\\|^\\(Sun\\|Mon\\|Tue\\|Wed\\|Thu\\|Fri\\|Sat\\) [A-Z][a-z][a-z] 
[0-9:+ ]+"
      (0 'change-log-date)
      ;; Name and e-mail; some people put e-mail in parens, not angles.
      ("\\([^<(]+?\\)[ \t]*[(<]\\(address@hidden)[>)]" nil nil
diff --git a/lisp/vc/compare-w.el b/lisp/vc/compare-w.el
index 4151063..02c08af 100644
--- a/lisp/vc/compare-w.el
+++ b/lisp/vc/compare-w.el
@@ -1,6 +1,6 @@
 ;;; compare-w.el --- compare text between windows for Emacs
 
-;; Copyright (C) 1986, 1989, 1993, 1997, 2001-2018 Free Software
+;; Copyright (C) 1986, 1989, 1993, 1997, 2001-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
diff --git a/lisp/vc/cvs-status.el b/lisp/vc/cvs-status.el
index 13b8762..ccc8e5f 100644
--- a/lisp/vc/cvs-status.el
+++ b/lisp/vc/cvs-status.el
@@ -1,6 +1,6 @@
 ;;; cvs-status.el --- major mode for browsing `cvs status' output -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: pcl-cvs cvs status tree vc tools
@@ -269,9 +269,9 @@ BEWARE:  because of stability issues, this is not a 
symmetric operation."
     (cond
      ((= l1 l2)
       (pcase (cvs-tag-compare tag1 tag2)
-       (`more1 (cons rev2 (cvs-tree-merge tree1 (cdr tree2))))
-       (`more2 (cons rev1 (cvs-tree-merge (cdr tree1) tree2)))
-       (`equal
+       ('more1 (cons rev2 (cvs-tree-merge tree1 (cdr tree2))))
+       ('more2 (cons rev1 (cvs-tree-merge (cdr tree1) tree2)))
+       ('equal
         (cons (cons (cvs-tag-merge tag1 tag2)
                     (cvs-tree-merge (cvs-cdr rev1) (cvs-cdr rev2)))
               (cvs-tree-merge (cdr tree1) (cdr tree2))))))
@@ -395,33 +395,33 @@ Otherwise, default to ASCII chars like +, - and |.")
 
 (defconst cvs-tree-char-space
   (pcase cvs-tree-use-charset
-    (`jisx0208 (make-char 'japanese-jisx0208 33 33))
-    (`unicode " ")
+    ('jisx0208 (make-char 'japanese-jisx0208 33 33))
+    ('unicode " ")
     (_ "  ")))
 (defconst cvs-tree-char-hbar
   (pcase cvs-tree-use-charset
-    (`jisx0208 (make-char 'japanese-jisx0208 40 44))
-    (`unicode "━")
+    ('jisx0208 (make-char 'japanese-jisx0208 40 44))
+    ('unicode "━")
     (_ "--")))
 (defconst cvs-tree-char-vbar
   (pcase cvs-tree-use-charset
-    (`jisx0208 (make-char 'japanese-jisx0208 40 45))
-    (`unicode "┃")
+    ('jisx0208 (make-char 'japanese-jisx0208 40 45))
+    ('unicode "┃")
     (_ "| ")))
 (defconst cvs-tree-char-branch
   (pcase cvs-tree-use-charset
-    (`jisx0208 (make-char 'japanese-jisx0208 40 50))
-    (`unicode "┣")
+    ('jisx0208 (make-char 'japanese-jisx0208 40 50))
+    ('unicode "┣")
     (_ "+-")))
 (defconst cvs-tree-char-eob            ;end of branch
   (pcase cvs-tree-use-charset
-    (`jisx0208 (make-char 'japanese-jisx0208 40 49))
-    (`unicode "┗")
+    ('jisx0208 (make-char 'japanese-jisx0208 40 49))
+    ('unicode "┗")
     (_ "`-")))
 (defconst cvs-tree-char-bob            ;beginning of branch
   (pcase cvs-tree-use-charset
-    (`jisx0208 (make-char 'japanese-jisx0208 40 51))
-    (`unicode "┳")
+    ('jisx0208 (make-char 'japanese-jisx0208 40 51))
+    ('unicode "┳")
     (_ "+-")))
 
 (defun cvs-tag-lessp (tag1 tag2)
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index cf52368..dbde284 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -1,6 +1,6 @@
 ;;; diff-mode.el --- a mode for viewing/editing context diffs -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: convenience patch diff vc
@@ -55,6 +55,9 @@
 ;;; Code:
 (eval-when-compile (require 'cl-lib))
 
+(autoload 'vc-find-revision "vc")
+(autoload 'vc-find-revision-no-save "vc")
+(defvar vc-find-revision-no-save)
 (defvar add-log-buffer-file-name-function)
 
 
@@ -91,19 +94,60 @@ when editing big diffs)."
   :type 'hook
   :options '(diff-delete-empty-files diff-make-unified))
 
-(defcustom diff-font-lock-refine t
-  "If non-nil, font-lock highlighting includes hunk refinement."
+(defcustom diff-refine 'font-lock
+  "If non-nil, enable hunk refinement.
+
+The value `font-lock' means to refine during font-lock.
+The value `navigation' means to refine each hunk as you visit it
+with `diff-hunk-next' or `diff-hunk-prev'.
+
+You can always manually refine a hunk with `diff-refine-hunk'."
   :version "27.1"
-  :type 'boolean)
+  :type '(choice (const :tag "Don't refine hunks" nil)
+                 (const :tag "Refine hunks during font-lock" font-lock)
+                 (const :tag "Refine hunks during navigation" navigation)))
 
 (defcustom diff-font-lock-prettify nil
   "If non-nil, font-lock will try and make the format prettier."
   :version "27.1"
   :type 'boolean)
 
+(defcustom diff-font-lock-syntax t
+  "If non-nil, diff hunk font-lock includes source language syntax 
highlighting.
+This highlighting is the same as added by `font-lock-mode'
+when corresponding source files are visited normally.
+Syntax highlighting is added over diff own highlighted changes.
+
+If t, the default, highlight syntax only in Diff buffers created by Diff
+commands that compare files or by VC commands that compare revisions.
+These provide all necessary context for reliable highlighting.  This value
+requires support from a VC backend to find the files being compared.
+For diffs against the working-tree version of a file, the highlighting is
+based on the current file contents.  File-based fontification tries to
+infer fontification from the compared files.
+
+If revision-based or file-based method fails, use hunk-based method to get
+fontification from hunk alone if the value is `hunk-also'.
+
+If `hunk-only', fontification is based on hunk alone, without full source.
+It tries to highlight hunks without enough context that sometimes might result
+in wrong fontification.  This is the fastest option, but less reliable."
+  :version "27.1"
+  :type '(choice (const :tag "Don't highlight syntax" nil)
+                 (const :tag "Hunk-based also" hunk-also)
+                 (const :tag "Hunk-based only" hunk-only)
+                 (const :tag "Highlight syntax" t)))
+
 (defvar diff-vc-backend nil
   "The VC backend that created the current Diff buffer, if any.")
 
+(defvar diff-vc-revisions nil
+  "The VC revisions compared in the current Diff buffer, if any.")
+
+(defvar diff-default-directory nil
+  "The default directory where the current Diff buffer was created.")
+(make-variable-buffer-local 'diff-default-directory)
+
 (defvar diff-outline-regexp
   "\\([*+][*+][*+] [^0-9]\\|@@ ...\\|\\*\\*\\* [0-9].\\|--- [0-9]..\\)")
 
@@ -219,16 +263,22 @@ when editing big diffs)."
   "Keymap for `diff-minor-mode'.  See also `diff-mode-shared-map'.")
 
 (define-minor-mode diff-auto-refine-mode
-  "Toggle automatic diff hunk highlighting (Diff Auto Refine mode).
+  "Toggle automatic diff hunk finer highlighting (Diff Auto Refine mode).
 
 Diff Auto Refine mode is a buffer-local minor mode used with
 `diff-mode'.  When enabled, Emacs automatically highlights
 changes in detail as the user visits hunks.  When transitioning
 from disabled to enabled, it tries to refine the current hunk, as
 well."
-  :group 'diff-mode :init-value t :lighter nil ;; " Auto-Refine"
-  (when diff-auto-refine-mode
-    (condition-case-unless-debug nil (diff-refine-hunk) (error nil))))
+  :group 'diff-mode :init-value nil :lighter nil ;; " Auto-Refine"
+  (if diff-auto-refine-mode
+      (progn
+        (customize-set-variable 'diff-refine 'navigation)
+        (condition-case-unless-debug nil (diff-refine-hunk) (error nil)))
+    (customize-set-variable 'diff-refine nil)))
+(make-obsolete 'diff-auto-refine-mode "set `diff-refine' instead." "27.1")
+(make-obsolete-variable 'diff-auto-refine-mode
+                        "set `diff-refine' instead." "27.1")
 
 ;;;;
 ;;;; font-lock support
@@ -236,7 +286,7 @@ well."
 
 (defface diff-header
   '((((class color) (min-colors 88) (background light))
-     :background "grey80")
+     :background "grey85")
     (((class color) (min-colors 88) (background dark))
      :background "grey45")
     (((class color))
@@ -246,7 +296,7 @@ well."
 
 (defface diff-file-header
   '((((class color) (min-colors 88) (background light))
-     :background "grey70" :weight bold)
+     :background "grey75" :weight bold)
     (((class color) (min-colors 88) (background dark))
      :background "grey60" :weight bold)
     (((class color))
@@ -266,7 +316,7 @@ well."
   '((default
      :inherit diff-changed)
     (((class color) (min-colors 88) (background light))
-     :background "#ffdddd")
+     :background "#ffeeee")
     (((class color) (min-colors 88) (background dark))
      :background "#553333")
     (((class color))
@@ -277,7 +327,7 @@ well."
   '((default
      :inherit diff-changed)
     (((class color) (min-colors 88) (background light))
-     :background "#ddffdd")
+     :background "#eeffee")
     (((class color) (min-colors 88) (background dark))
      :background "#335533")
     (((class color))
@@ -290,19 +340,25 @@ well."
   :version "25.1")
 
 (defface diff-indicator-removed
-  '((t :inherit diff-removed))
+  '((default :inherit diff-removed)
+    (((class color) (min-colors 88))
+     :foreground "#aa2222"))
   "`diff-mode' face used to highlight indicator of removed lines (-, <)."
   :version "22.1")
 (defvar diff-indicator-removed-face 'diff-indicator-removed)
 
 (defface diff-indicator-added
-  '((t :inherit diff-added))
+  '((default :inherit diff-added)
+    (((class color) (min-colors 88))
+     :foreground "#22aa22"))
   "`diff-mode' face used to highlight indicator of added lines (+, >)."
   :version "22.1")
 (defvar diff-indicator-added-face 'diff-indicator-added)
 
 (defface diff-indicator-changed
-  '((t :inherit diff-changed))
+  '((default :inherit diff-changed)
+    (((class color) (min-colors 88))
+     :foreground "#aaaa22"))
   "`diff-mode' face used to highlight indicator of changed lines."
   :version "22.1")
 (defvar diff-indicator-changed-face 'diff-indicator-changed)
@@ -312,10 +368,7 @@ well."
   "`diff-mode' face used to highlight function names produced by \"diff -p\".")
 
 (defface diff-context
-  '((((class color grayscale) (min-colors 88) (background light))
-     :foreground "#333333")
-    (((class color grayscale) (min-colors 88) (background dark))
-     :foreground "#dddddd"))
+  '((t nil))
   "`diff-mode' face used to highlight context and other side-information."
   :version "25.1")
 
@@ -396,11 +449,15 @@ and the face `diff-added' for added lines.")
                'diff-removed))))))
     ("^\\(?:Index\\|revno\\): \\(.+\\).*\n"
      (0 'diff-header) (1 'diff-index prepend))
+    ("^\\(?:index .*\\.\\.\\|diff \\).*\n" . 'diff-header)
+    ("^\\(?:new\\|deleted\\) file mode .*\n" . 'diff-header)
     ("^Only in .*\n" . 'diff-nonexistent)
+    ("^Binary files .* differ\n" . 'diff-file-header)
     ("^\\(#\\)\\(.*\\)"
      (1 font-lock-comment-delimiter-face)
      (2 font-lock-comment-face))
     ("^[^-=+*!<>#].*\n" (0 'diff-context))
+    (,#'diff--font-lock-syntax)
     (,#'diff--font-lock-prettify)
     (,#'diff--font-lock-refined)))
 
@@ -471,13 +528,14 @@ See 
https://lists.gnu.org/r/emacs-devel/2007-11/msg01990.html";)
     (unless end
       (setq end (and (re-search-forward
                       (pcase style
-                        (`unified
+                        ('unified
                          (concat (if diff-valid-unified-empty-line
                                      "^[^-+# \\\n]\\|" "^[^-+# \\]\\|")
                                  ;; A `unified' header is ambiguous.
                                  diff-file-header-re))
-                        (`context "^[^-+#! \\]")
-                        (`normal "^[^<>#\\]")
+                        ('context (if diff-valid-unified-empty-line
+                                      "^[^-+#! \n\\]" "^[^-+#! \\]"))
+                        ('normal "^[^<>#\\]")
                         (_ "^[^-+#!<> \\]"))
                       nil t)
                      (match-beginning 0)))
@@ -580,7 +638,7 @@ next hunk if TRY-HARDER is non-nil; otherwise signal an 
error."
 ;; Define diff-{hunk,file}-{prev,next}
 (easy-mmode-define-navigation
  diff-hunk diff-hunk-header-re "hunk" diff-end-of-hunk diff-restrict-view
- (when diff-auto-refine-mode
+ (when (and (eq diff-refine 'navigation) (called-interactively-p 'interactive))
    (unless (prog1 diff--auto-refine-data
              (setq diff--auto-refine-data
                    (cons (current-buffer) (point-marker))))
@@ -1008,7 +1066,7 @@ else cover the whole buffer."
                             " ----\n" hunk))
                  ;;(goto-char (point-min))
                  (forward-line 1)
-                 (if (not (save-excursion (re-search-forward "^+" nil t)))
+                 (if (not (save-excursion (re-search-forward "^\\+" nil t)))
                      (delete-region (point) (point-max))
                    (let ((modif nil) (delete nil))
                      (if (save-excursion (re-search-forward "^\\+.*\n-"
@@ -1343,6 +1401,7 @@ See `after-change-functions' for the meaning of BEG, END 
and LEN."
 
 (defun diff--font-lock-cleanup ()
   (remove-overlays nil nil 'diff-mode 'fine)
+  (remove-overlays nil nil 'diff-mode 'syntax)
   (when font-lock-mode
     (make-local-variable 'font-lock-extra-managed-props)
     ;; Added when diff--font-lock-prettify is non-nil!
@@ -1415,7 +1474,7 @@ a diff with \\[diff-reverse-direction].
        (lambda () (diff-find-file-name nil 'noprompt)))
   (add-function :filter-return (local 'filter-buffer-substring-function)
                 #'diff--filter-substring)
-  (unless (buffer-file-name)
+  (unless buffer-file-name
     (hack-dir-local-variables-non-file-buffer)))
 
 ;;;###autoload
@@ -1656,10 +1715,11 @@ char-offset in TEXT."
              (delete-region divider-pos (point-max)))
            (delete-region (point-min) keep))
          ;; Remove line-prefix characters, and unneeded lines (unified diffs).
-         (let ((kill-char (if destp ?- ?+)))
+          ;; Also skip lines like "\ No newline at end of file"
+         (let ((kill-chars (list (if destp ?- ?+) ?\\)))
            (goto-char (point-min))
            (while (not (eobp))
-             (if (eq (char-after) kill-char)
+             (if (memq (char-after) kill-chars)
                  (delete-region (point) (progn (forward-line 1) (point)))
                (delete-char num-pfx-chars)
                (forward-line 1)))))
@@ -1736,7 +1796,15 @@ NOPROMPT, if non-nil, means not to prompt the user."
                       (match-string 1)))))
           (file (or (diff-find-file-name other noprompt)
                      (error "Can't find the file")))
-          (buf (find-file-noselect file)))
+          (revision (and other diff-vc-backend
+                          (if reverse (nth 1 diff-vc-revisions)
+                            (or (nth 0 diff-vc-revisions)
+                                ;; When diff shows changes in working revision
+                                (vc-working-revision file)))))
+          (buf (if revision
+                    (let ((vc-find-revision-no-save t))
+                      (vc-find-revision (expand-file-name file) revision 
diff-vc-backend))
+                  (find-file-noselect file))))
       ;; Update the user preference if he so wished.
       (when (> (prefix-numeric-value other-file) 8)
        (setq diff-jump-to-old-file other))
@@ -1862,20 +1930,24 @@ With a prefix argument, try to REVERSE the hunk."
 `diff-jump-to-old-file' (or its opposite if the OTHER-FILE prefix arg
 is given) determines whether to jump to the old or the new file.
 If the prefix arg is bigger than 8 (for example with \\[universal-argument] 
\\[universal-argument])
-then `diff-jump-to-old-file' is also set, for the next invocations."
+then `diff-jump-to-old-file' is also set, for the next invocations.
+
+Under version control, the OTHER-FILE prefix arg means jump to the old
+revision of the file if point is on an old changed line, or to the new
+revision of the file otherwise."
   (interactive (list current-prefix-arg last-input-event))
   ;; When pointing at a removal line, we probably want to jump to
   ;; the old location, and else to the new (i.e. as if reverting).
   ;; This is a convenient detail when using smerge-diff.
   (if event (posn-set-point (event-end event)))
   (let ((buffer (when event (current-buffer)))
-        (rev (not (save-excursion (beginning-of-line) (looking-at "[-<]")))))
+        (reverse (not (save-excursion (beginning-of-line) (looking-at 
"[-<]")))))
     (pcase-let ((`(,buf ,line-offset ,pos ,src ,_dst ,switched)
-                 (diff-find-source-location other-file rev)))
+                 (diff-find-source-location other-file reverse)))
       (pop-to-buffer buf)
       (goto-char (+ (car pos) (cdr src)))
       (when buffer (next-error-found buffer (current-buffer)))
-      (diff-hunk-status-msg line-offset (diff-xor rev switched) t))))
+      (diff-hunk-status-msg line-offset (diff-xor reverse switched) t))))
 
 
 (defun diff-current-defun ()
@@ -1970,7 +2042,7 @@ For use in `add-log-current-defun-function'."
   '((default
      :inherit diff-refine-changed)
     (((class color) (min-colors 88) (background light))
-     :background "#ffbbbb")
+     :background "#ffcccc")
     (((class color) (min-colors 88) (background dark))
      :background "#aa2222"))
   "Face used for removed characters shown by `diff-refine-hunk'."
@@ -1980,7 +2052,7 @@ For use in `add-log-current-defun-function'."
   '((default
      :inherit diff-refine-changed)
     (((class color) (min-colors 88) (background light))
-     :background "#aaffaa")
+     :background "#bbffbb")
     (((class color) (min-colors 88) (background dark))
      :background "#22aa22"))
   "Face used for added characters shown by `diff-refine-hunk'."
@@ -2031,7 +2103,7 @@ Return new point, if it was moved."
 
     (goto-char beg)
     (pcase style
-      (`unified
+      ('unified
        (while (re-search-forward "^-" end t)
          (let ((beg-del (progn (beginning-of-line) (point)))
                beg-add end-add)
@@ -2044,8 +2116,8 @@ Return new point, if it was moved."
                              (setq end-add (point))))
              (smerge-refine-regions beg-del beg-add beg-add end-add
                                     nil #'diff-refine-preproc props-r 
props-a)))))
-      (`context
-       (let* ((middle (save-excursion (re-search-forward "^---")))
+      ('context
+       (let* ((middle (save-excursion (re-search-forward "^---" end)))
               (other middle))
          (while (re-search-forward "^\\(?:!.*\n\\)+" middle t)
            (smerge-refine-regions (match-beginning 0) (match-end 0)
@@ -2067,9 +2139,29 @@ Return new point, if it was moved."
                                   (match-end 0) end
                                   nil #'diff-refine-preproc props-r 
props-a)))))))
 
+(defun diff--iterate-hunks (max fun)
+  "Iterate over all hunks between point and MAX.
+Call FUN with two args (BEG and END) for each hunk."
+  (save-excursion
+    (let* ((beg (or (ignore-errors (diff-beginning-of-hunk))
+                    (ignore-errors (diff-hunk-next) (point))
+                    max)))
+      (while (< beg max)
+        (goto-char beg)
+        (cl-assert (looking-at diff-hunk-header-re))
+        (let ((end
+               (save-excursion (diff-end-of-hunk) (point))))
+          (cl-assert (< beg end))
+          (funcall fun beg end)
+          (goto-char end)
+          (setq beg (if (looking-at diff-hunk-header-re)
+                        end
+                      (or (ignore-errors (diff-hunk-next) (point))
+                          max))))))))
+
 (defun diff--font-lock-refined (max)
   "Apply hunk refinement from font-lock."
-  (when diff-font-lock-refine
+  (when (eq diff-refine 'font-lock)
     (when (get-char-property (point) 'diff--font-lock-refined)
       ;; Refinement works over a complete hunk, whereas font-lock limits itself
       ;; to highlighting smallish chunks between point..max, so we may be
@@ -2082,27 +2174,19 @@ Return new point, if it was moved."
       ;; same hunk.
       (goto-char (next-single-char-property-change
                   (point) 'diff--font-lock-refined nil max)))
-    (let* ((min (point))
-           (beg (or (ignore-errors (diff-beginning-of-hunk))
-                    (ignore-errors (diff-hunk-next) (point))
-                    max)))
-      (while (< beg max)
-        (let ((end
-               (save-excursion (goto-char beg) (diff-end-of-hunk) (point))))
-          (if (< end min) (setq beg min))
-          (unless (or (< end beg)
-                      (get-char-property beg 'diff--font-lock-refined))
-            (diff--refine-hunk beg end)
-            (let ((ol (make-overlay beg end)))
-              (overlay-put ol 'diff--font-lock-refined t)
-              (overlay-put ol 'diff-mode 'fine)
-              (overlay-put ol 'evaporate t)
-              (overlay-put ol 'modification-hooks
-                           '(diff--font-lock-refine--refresh))))
-          (goto-char (max beg end))
-          (setq beg (or (ignore-errors (diff-hunk-next) (point)) max)))))))
-
-(defun diff--font-lock-refine--refresh (ol _after _beg _end &optional _len)
+    (diff--iterate-hunks
+     max
+     (lambda (beg end)
+       (unless (get-char-property beg 'diff--font-lock-refined)
+         (diff--refine-hunk beg end)
+         (let ((ol (make-overlay beg end)))
+           (overlay-put ol 'diff--font-lock-refined t)
+           (overlay-put ol 'diff-mode 'fine)
+           (overlay-put ol 'evaporate t)
+           (overlay-put ol 'modification-hooks
+                        '(diff--overlay-auto-delete))))))))
+
+(defun diff--overlay-auto-delete (ol _after _beg _end &optional _len)
   (delete-overlay ol))
 
 (defun diff-undo (&optional arg)
@@ -2129,7 +2213,7 @@ I.e. like `add-change-log-entry-other-window' but applied 
to all hunks."
                  ;; `add-change-log-entry-other-window' works better in
                  ;; that case.
                  (re-search-forward
-                  (concat "\n[!+-<>]"
+                 (concat "\n[!+<>-]"
                           ;; If the hunk is a context hunk with an empty first
                           ;; half, recognize the "--- NNN,MMM ----" line
                           "\\(-- [0-9]+\\(,[0-9]+\\)? ----\n"
@@ -2267,9 +2351,9 @@ fixed, visit it in a buffer."
       ;; FIXME: Include the first space for context-style hunks!
       (while (re-search-forward "^[-+! ]" limit t)
         (let ((spec (alist-get (char-before)
-                               '((?+ . (left-fringe diff-fringe-add 
diff-added))
-                                 (?- . (left-fringe diff-fringe-del 
diff-removed))
-                                 (?! . (left-fringe diff-fringe-rep 
diff-changed))
+                               '((?+ . (left-fringe diff-fringe-add 
diff-indicator-added))
+                                 (?- . (left-fringe diff-fringe-del 
diff-indicator-removed))
+                                 (?! . (left-fringe diff-fringe-rep 
diff-indicator-changed))
                                  (?\s . (left-fringe diff-fringe-nul))))))
           (put-text-property (match-beginning 0) (match-end 0) 'display 
spec))))
     ;; Mimicks the output of Magit's diff.
@@ -2299,6 +2383,191 @@ fixed, visit it in a buffer."
                              'display "")))))
   nil)
 
+;;; Syntax highlighting from font-lock
+
+(defun diff--font-lock-syntax (max)
+  "Apply source language syntax highlighting from font-lock.
+Calls `diff-syntax-fontify' on every hunk found between point
+and the position in MAX."
+  (when diff-font-lock-syntax
+    (when (get-char-property (point) 'diff--font-lock-syntax)
+      (goto-char (next-single-char-property-change
+                  (point) 'diff--font-lock-syntax nil max)))
+    (diff--iterate-hunks
+     max
+     (lambda (beg end)
+       (unless (get-char-property beg 'diff--font-lock-syntax)
+         (diff-syntax-fontify beg end)
+         (let ((ol (make-overlay beg end)))
+           (overlay-put ol 'diff--font-lock-syntax t)
+           (overlay-put ol 'diff-mode 'syntax)
+           (overlay-put ol 'evaporate t)
+           (overlay-put ol 'modification-hooks
+                        '(diff--overlay-auto-delete))))))))
+
+(defun diff-syntax-fontify (beg end)
+  "Highlight source language syntax in diff hunk between BEG and END."
+  (remove-overlays beg end 'diff-mode 'syntax)
+  (save-excursion
+    (diff-syntax-fontify-hunk beg end t)
+    (diff-syntax-fontify-hunk beg end nil)))
+
+(defvar diff-syntax-fontify-revisions (make-hash-table :test 'equal))
+
+(eval-when-compile (require 'subr-x)) ; for string-trim-right
+
+(defun diff-syntax-fontify-hunk (beg end old)
+  "Highlight source language syntax in diff hunk between BEG and END.
+When OLD is non-nil, highlight the hunk from the old source."
+  (goto-char beg)
+  (let* ((hunk (buffer-substring-no-properties beg end))
+         ;; Trim a trailing newline to find hunk in diff-syntax-fontify-props
+         ;; in diffs that have no newline at end of diff file.
+         (text (string-trim-right (or (with-demoted-errors (diff-hunk-text 
hunk (not old) nil)) "")))
+        (line (if (looking-at "\\(?:\\*\\{15\\}.*\n\\)address@hidden 
]*\\([0-9,]+\\)\\([ acd+]+\\([0-9,]+\\)\\)?")
+                  (if old (match-string 1)
+                    (if (match-end 3) (match-string 3) (match-string 1)))))
+         (line-nb (when line
+                    (if (string-match "\\([0-9]+\\),\\([0-9]+\\)" line)
+                        (list (string-to-number (match-string 1 line))
+                              (string-to-number (match-string 2 line)))
+                      (list (string-to-number line) 1)))) ; One-line diffs
+         props)
+    (cond
+     ((and diff-vc-backend (not (eq diff-font-lock-syntax 'hunk-only)))
+      (let* ((file (diff-find-file-name old t))
+             (revision (and file (if (not old) (nth 1 diff-vc-revisions)
+                                   (or (nth 0 diff-vc-revisions)
+                                       (vc-working-revision file))))))
+        (if file
+            (if (not revision)
+                ;; Get properties from the current working revision
+                (when (and (not old) (file-exists-p file) (file-regular-p 
file))
+                  ;; Try to reuse an existing buffer
+                  (if (get-file-buffer (expand-file-name file))
+                      (with-current-buffer (get-file-buffer (expand-file-name 
file))
+                        (setq props (diff-syntax-fontify-props nil text 
line-nb)))
+                    ;; Get properties from the file
+                    (with-temp-buffer
+                      (insert-file-contents file)
+                      (setq props (diff-syntax-fontify-props file text 
line-nb)))))
+              ;; Get properties from a cached revision
+              (let* ((buffer-name (format " *diff-syntax:%s.~%s~*"
+                                          (expand-file-name file) revision))
+                     (buffer (gethash buffer-name 
diff-syntax-fontify-revisions)))
+                (unless (and buffer (buffer-live-p buffer))
+                  (let* ((vc-buffer (ignore-errors
+                                      (vc-find-revision-no-save
+                                       (expand-file-name file) revision
+                                       diff-vc-backend
+                                       (get-buffer-create buffer-name)))))
+                    (when vc-buffer
+                      (setq buffer vc-buffer)
+                      (puthash buffer-name buffer 
diff-syntax-fontify-revisions))))
+                (when buffer
+                  (with-current-buffer buffer
+                    (setq props (diff-syntax-fontify-props file text 
line-nb))))))
+          ;; If file is unavailable, get properties from the hunk alone
+          (setq file (car (diff-hunk-file-names old)))
+          (with-temp-buffer
+            (insert text)
+            (setq props (diff-syntax-fontify-props file text line-nb t))))))
+     ((and diff-default-directory (not (eq diff-font-lock-syntax 'hunk-only)))
+      (let ((file (car (diff-hunk-file-names old))))
+        (if (and file (file-exists-p file) (file-regular-p file))
+            ;; Try to get full text from the file
+            (with-temp-buffer
+              (insert-file-contents file)
+              (setq props (diff-syntax-fontify-props file text line-nb)))
+          ;; Otherwise, get properties from the hunk alone
+          (with-temp-buffer
+            (insert text)
+            (setq props (diff-syntax-fontify-props file text line-nb t))))))
+     ((memq diff-font-lock-syntax '(hunk-also hunk-only))
+      (let ((file (car (diff-hunk-file-names old))))
+        (with-temp-buffer
+          (insert text)
+          (setq props (diff-syntax-fontify-props file text line-nb t))))))
+
+    ;; Put properties over the hunk text
+    (goto-char beg)
+    (when (and props (eq (diff-hunk-style) 'unified))
+      (while (< (progn (forward-line 1) (point)) end)
+        (when (or (and (not old) (not (looking-at-p "[-<]")))
+                  (and      old  (not (looking-at-p "[+>]"))))
+          (unless (looking-at-p "\\\\") ; skip "\ No newline at end of file"
+            (if (and old (not (looking-at-p "[-<]")))
+                ;; Fontify context lines only from new source,
+                ;; don't refontify context lines from old source.
+                (pop props)
+              (let ((line-props (pop props))
+                    (bol (1+ (point))))
+                (dolist (prop line-props)
+                  (let ((ol (make-overlay (+ bol (nth 0 prop))
+                                          (+ bol (nth 1 prop))
+                                          nil 'front-advance nil)))
+                    (overlay-put ol 'diff-mode 'syntax)
+                    (overlay-put ol 'evaporate t)
+                    (overlay-put ol 'face (nth 2 prop))))))))))))
+
+(defun diff-syntax-fontify-props (file text line-nb &optional hunk-only)
+  "Get font-lock properties from the source code.
+FILE is the name of the source file.  If non-nil, it requests initialization
+of the mode according to FILE.
+TEXT is the literal source text from hunk.
+LINE-NB is a pair of numbers: start line number and the number of
+lines in the hunk.  NO-INIT means no initialization is needed to set major
+mode.  When HUNK-ONLY is non-nil, then don't verify the existence of the
+hunk text in the source file.  Otherwise, don't highlight the hunk if the
+hunk text is not found in the source file."
+  (when file
+    ;; When initialization is requested, we should be in a brand new
+    ;; temp buffer.
+    (cl-assert (eq t buffer-undo-list))
+    (cl-assert (not font-lock-mode))
+    (cl-assert (null buffer-file-name))
+    (let ((enable-local-variables :safe) ;; to find `mode:'
+          (buffer-file-name file))
+      (set-auto-mode)
+      (when (and (memq 'generic-mode-find-file-hook find-file-hook)
+                 (fboundp 'generic-mode-find-file-hook))
+        (generic-mode-find-file-hook))))
+
+  (let ((font-lock-defaults (or font-lock-defaults '(nil t)))
+        props beg end)
+    (goto-char (point-min))
+    (if hunk-only
+        (setq beg (point-min) end (point-max))
+      (forward-line (1- (nth 0 line-nb)))
+      ;; non-regexp looking-at to compare hunk text for verification
+      (if (search-forward text (+ (point) (length text)) t)
+          (setq beg (- (point) (length text)) end (point))
+        (goto-char (point-min))
+        (if (search-forward text nil t)
+            (setq beg (- (point) (length text)) end (point)))))
+
+    (when (and beg end)
+      (goto-char beg)
+      (font-lock-ensure beg end)
+
+      (while (< (point) end)
+        (let* ((bol (point))
+               (eol (line-end-position))
+               line-props
+               (searching t)
+               (from (point)) to
+               (val (get-text-property from 'face)))
+          (while searching
+            (setq to (next-single-property-change from 'face nil eol))
+            (when val (push (list (- from bol) (- to bol) val) line-props))
+            (setq val (get-text-property to 'face) from to)
+            (unless (< to eol) (setq searching nil)))
+          (when val (push (list from eol val) line-props))
+          (push (nreverse line-props) props))
+        (forward-line 1)))
+    (nreverse props)))
+
+
 (defun diff--filter-substring (str)
   (when diff-font-lock-prettify
     ;; Strip the `display' properties added by diff-font-lock-prettify,
diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el
index ac94586..523be87 100644
--- a/lisp/vc/diff.el
+++ b/lisp/vc/diff.el
@@ -1,6 +1,6 @@
 ;;; diff.el --- run `diff'  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1992, 1994, 1996, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1992, 1994, 1996, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Frank Bresz
@@ -121,6 +121,8 @@ Possible values are:
   nil   -- no, it does not
   check -- try to probe whether it does")
 
+(defvar diff-default-directory)
+
 (defun diff-no-select (old new &optional switches no-async buf)
   ;; Noninteractive helper for creating and reverting diff buffers
   (unless (bufferp new) (setq new (expand-file-name new)))
@@ -165,6 +167,7 @@ Possible values are:
            (lambda (_ignore-auto _noconfirm)
              (diff-no-select old new switches no-async (current-buffer))))
       (setq default-directory thisdir)
+      (setq diff-default-directory default-directory)
       (let ((inhibit-read-only t))
        (insert command "\n"))
       (if (and (not no-async) (fboundp 'make-process))
diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el
index 3441092..a1d27af 100644
--- a/lisp/vc/ediff-diff.el
+++ b/lisp/vc/ediff-diff.el
@@ -1,6 +1,6 @@
 ;;; ediff-diff.el --- diff-related utilities
 
-;; Copyright (C) 1994-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: ediff
diff --git a/lisp/vc/ediff-help.el b/lisp/vc/ediff-help.el
index 0c8b840..11c8b35 100644
--- a/lisp/vc/ediff-help.el
+++ b/lisp/vc/ediff-help.el
@@ -1,6 +1,6 @@
 ;;; ediff-help.el --- Code related to the contents of Ediff help buffers
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: ediff
diff --git a/lisp/vc/ediff-hook.el b/lisp/vc/ediff-hook.el
index 9b697c8..8412215 100644
--- a/lisp/vc/ediff-hook.el
+++ b/lisp/vc/ediff-hook.el
@@ -1,6 +1,6 @@
 ;;; ediff-hook.el --- setup for Ediff's menus and autoloads
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: ediff
diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el
index e5e2a04..a74d6a8 100644
--- a/lisp/vc/ediff-init.el
+++ b/lisp/vc/ediff-init.el
@@ -1,6 +1,6 @@
 ;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff
 
-;; Copyright (C) 1994-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: ediff
@@ -267,17 +267,17 @@ It needs to be killed when we quit the session.")
   (and (ediff-window-display-p) ediff-multiframe))
 
 (defmacro ediff-narrow-control-frame-p ()
-  `(and (ediff-multiframe-setup-p)
-       (equal ediff-help-message ediff-brief-message-string)))
+  '(and (ediff-multiframe-setup-p)
+        (equal ediff-help-message ediff-brief-message-string)))
 
 (defmacro ediff-3way-comparison-job ()
-  `(memq
+  '(memq
     ediff-job-name
     '(ediff-files3 ediff-buffers3)))
 (ediff-defvar-local ediff-3way-comparison-job nil "")
 
 (defmacro ediff-merge-job ()
-  `(memq
+  '(memq
     ediff-job-name
     '(ediff-merge-files
       ediff-merge-buffers
@@ -288,10 +288,10 @@ It needs to be killed when we quit the session.")
 (ediff-defvar-local ediff-merge-job nil "")
 
 (defmacro ediff-patch-job ()
-  `(eq ediff-job-name 'epatch))
+  '(eq ediff-job-name 'epatch))
 
 (defmacro ediff-merge-with-ancestor-job ()
-  `(memq
+  '(memq
     ediff-job-name
     '(ediff-merge-files-with-ancestor
       ediff-merge-buffers-with-ancestor
@@ -299,26 +299,26 @@ It needs to be killed when we quit the session.")
 (ediff-defvar-local ediff-merge-with-ancestor-job nil "")
 
 (defmacro ediff-3way-job ()
-  `(or ediff-3way-comparison-job ediff-merge-job))
+  '(or ediff-3way-comparison-job ediff-merge-job))
 (ediff-defvar-local ediff-3way-job nil "")
 
 ;; A diff3 job is like a 3way job, but ediff-merge doesn't require the use
 ;; of diff3.
 (defmacro ediff-diff3-job ()
-  `(or ediff-3way-comparison-job
+  '(or ediff-3way-comparison-job
        ediff-merge-with-ancestor-job))
 (ediff-defvar-local ediff-diff3-job nil "")
 
 (defmacro ediff-windows-job ()
-  `(memq ediff-job-name '(ediff-windows-wordwise ediff-windows-linewise)))
+  '(memq ediff-job-name '(ediff-windows-wordwise ediff-windows-linewise)))
 (ediff-defvar-local ediff-windows-job nil "")
 
 (defmacro ediff-word-mode-job ()
-  `(memq ediff-job-name '(ediff-windows-wordwise ediff-regions-wordwise)))
+  '(memq ediff-job-name '(ediff-windows-wordwise ediff-regions-wordwise)))
 (ediff-defvar-local ediff-word-mode-job nil "")
 
 (defmacro ediff-narrow-job ()
-  `(memq ediff-job-name '(ediff-windows-wordwise
+  '(memq ediff-job-name '(ediff-windows-wordwise
                          ediff-regions-wordwise
                          ediff-windows-linewise
                          ediff-regions-linewise)))
diff --git a/lisp/vc/ediff-merg.el b/lisp/vc/ediff-merg.el
index b67f520..a511f44 100644
--- a/lisp/vc/ediff-merg.el
+++ b/lisp/vc/ediff-merg.el
@@ -1,6 +1,6 @@
 ;;; ediff-merg.el --- merging utilities
 
-;; Copyright (C) 1994-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: ediff
diff --git a/lisp/vc/ediff-mult.el b/lisp/vc/ediff-mult.el
index 342e91d..21f8916 100644
--- a/lisp/vc/ediff-mult.el
+++ b/lisp/vc/ediff-mult.el
@@ -1,6 +1,6 @@
 ;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff
 
-;; Copyright (C) 1995-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: ediff
diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el
index b3cf2fe..4178b5a 100644
--- a/lisp/vc/ediff-ptch.el
+++ b/lisp/vc/ediff-ptch.el
@@ -1,6 +1,6 @@
 ;;; ediff-ptch.el --- Ediff's  patch support
 
-;; Copyright (C) 1996-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: ediff
@@ -681,7 +681,7 @@ optional argument, then use it."
        (error
         "Ediff doesn't take the -V option in `ediff-patch-options'--sorry"))
 
-    ;; Make a temp file, if source-filename has a magic file handler (or if
+    ;; Make a temp file, if source-filename has a magic file name handler (or 
if
     ;; it is handled via auto-mode-alist and similar magic).
     ;; Check if there is a buffer visiting source-filename and if they are in
     ;; sync; arrange for the deletion of temp file.
@@ -691,7 +691,7 @@ optional argument, then use it."
     ;; Check if source file name has triggered black magic, such as file name
     ;; handlers or auto mode alist, and make a note of it.
     ;; true-source-filename should be either the original name or a
-    ;; temporary file where we put the after-product of the file handler.
+    ;; temporary file where we put the after-product of the file name handler.
     (setq file-name-magic-p (not (equal (file-truename true-source-filename)
                                        (file-truename source-filename))))
 
@@ -823,11 +823,11 @@ you can still examine the changes via M-x ediff-files"
     (setq startup-hooks
          ;; this sets various vars in the meta buffer inside
          ;; ediff-prepare-meta-buffer
-         (cons `(lambda ()
-                  ;; tell what to do if the user clicks on a session record
-                  (setq ediff-session-action-function
-                        'ediff-patch-file-form-meta
-                        ediff-meta-patchbufer patch-buf) )
+         (cons (lambda ()
+                 ;; tell what to do if the user clicks on a session record
+                 (setq ediff-session-action-function
+                       'ediff-patch-file-form-meta
+                       ediff-meta-patchbufer patch-buf) )
                startup-hooks))
     (setq meta-buf (ediff-prepare-meta-buffer
                    'ediff-filegroup-action
diff --git a/lisp/vc/ediff-util.el b/lisp/vc/ediff-util.el
index b1652e7..6e282a4 100644
--- a/lisp/vc/ediff-util.el
+++ b/lisp/vc/ediff-util.el
@@ -1,6 +1,6 @@
 ;;; ediff-util.el --- the core commands and utilities of ediff  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1994-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: ediff
@@ -3221,9 +3221,9 @@ Hit \\[ediff-recenter] to reset the windows afterward."
          short-f (concat ediff-temp-file-prefix short-p)
          f (cond (given-file)
                  ((find-file-name-handler f 'insert-file-contents)
-                  ;; to thwart file handlers in write-region, e.g., if file
-                  ;; name ends with .Z or .gz
-                  ;; This is needed so that patches produced by ediff will
+                  ;; to thwart file name handlers in write-region,
+                  ;; e.g., if file name ends with .Z or .gz
+                   ;; This is needed so that patches produced by ediff will
                   ;; have more meaningful names
                   (ediff-make-empty-tmp-file short-f))
                  (prefix
diff --git a/lisp/vc/ediff-vers.el b/lisp/vc/ediff-vers.el
index d3f918c..664ae5a 100644
--- a/lisp/vc/ediff-vers.el
+++ b/lisp/vc/ediff-vers.el
@@ -1,6 +1,6 @@
 ;;; ediff-vers.el --- version control interface to Ediff
 
-;; Copyright (C) 1995-1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995-1997, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: ediff
diff --git a/lisp/vc/ediff-wind.el b/lisp/vc/ediff-wind.el
index 0535aa6..492ddd3 100644
--- a/lisp/vc/ediff-wind.el
+++ b/lisp/vc/ediff-wind.el
@@ -1,6 +1,6 @@
 ;;; ediff-wind.el --- window manipulation utilities
 
-;; Copyright (C) 1994-1997, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-1997, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Package: ediff
diff --git a/lisp/vc/ediff.el b/lisp/vc/ediff.el
index 32a6820..0dfbe2e 100644
--- a/lisp/vc/ediff.el
+++ b/lisp/vc/ediff.el
@@ -1,6 +1,6 @@
 ;;; ediff.el --- a comprehensive visual interface to diff & patch
 
-;; Copyright (C) 1994-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Kifer <address@hidden>
 ;; Created: February 2, 1994
@@ -923,6 +923,7 @@ MERGE-AUTOSTORE-DIR is the directory in which to store 
merged files."
 ;;;###autoload
 (defun ediff-windows-wordwise (dumb-mode &optional wind-A wind-B startup-hooks)
   "Compare WIND-A and WIND-B, which are selected by clicking, wordwise.
+This compares the portions of text visible in each of the two windows.
 With prefix argument, DUMB-MODE, or on a non-windowing display, works as
 follows:
 If WIND-A is nil, use selected window.
@@ -936,6 +937,7 @@ arguments after setting up the Ediff buffers."
 ;;;###autoload
 (defun ediff-windows-linewise (dumb-mode &optional wind-A wind-B startup-hooks)
   "Compare WIND-A and WIND-B, which are selected by clicking, linewise.
+This compares the portions of text visible in each of the two windows.
 With prefix argument, DUMB-MODE, or on a non-windowing display, works as
 follows:
 If WIND-A is nil, use selected window.
@@ -946,7 +948,8 @@ arguments after setting up the Ediff buffers."
   (ediff-windows dumb-mode wind-A wind-B
                 startup-hooks 'ediff-windows-linewise nil))
 
-;; Compare WIND-A and WIND-B, which are selected by clicking.
+;; Compare visible portions of text in WIND-A and WIND-B, which are
+;; selected by clicking.
 ;; With prefix argument, DUMB-MODE, or on a non-windowing display,
 ;; works as follows:
 ;; If WIND-A is nil, use selected window.
@@ -987,8 +990,8 @@ arguments after setting up the Ediff buffers."
   "Run Ediff on a pair of regions in specified buffers.
 BUFFER-A and BUFFER-B are the buffers to be compared.
 Regions (i.e., point and mark) can be set in advance or marked interactively.
-This function is effective only for relatively small regions, up to 200
-lines.  For large regions, use `ediff-regions-linewise'.
+This function might be slow for large regions.  If you find it slow,
+use `ediff-regions-linewise' instead.
 STARTUP-HOOKS is a list of functions that Emacs calls without
 arguments after setting up the Ediff buffers."
   (interactive
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index 90860fb..8bd1bbd 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -1,6 +1,6 @@
 ;;; log-edit.el --- Major mode for editing CVS commit messages -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: pcl-cvs cvs commit log vc
@@ -52,7 +52,7 @@
 ;; The main keymap
 
 (easy-mmode-defmap log-edit-mode-map
-  `(("\C-c\C-c" . log-edit-done)
+  '(("\C-c\C-c" . log-edit-done)
     ("\C-c\C-a" . log-edit-insert-changelog)
     ("\C-c\C-d" . log-edit-show-diff)
     ("\C-c\C-f" . log-edit-show-files)
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index 6ff50dc..e47fad8 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -1,6 +1,6 @@
 ;;; log-view.el --- Major mode for browsing revision log histories -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: tools, vc
@@ -157,7 +157,7 @@
 
 (easy-menu-define log-view-mode-menu log-view-mode-map
   "Log-View Display Menu"
-  `("Log-View"
+  '("Log-View"
     ;; XXX Do we need menu entries for these?
     ;; ["Quit"  quit-window]
     ;; ["Kill This Buffer"  kill-this-buffer]
@@ -217,7 +217,7 @@ If it is nil, `log-view-toggle-entry-display' does 
nothing.")
 The match group number 1 should match the file name itself.")
 
 (defvar log-view-per-file-logs t
-  "Set if to t if the logs are shown one file at a time.")
+  "Set to t if the logs are shown one file at a time.")
 
 (defvar log-view-message-re
   (concat "^\\(?:revision \\(?1:[.0-9]+\\)\\(?:\t.*\\)?" ; RCS and CVS.
@@ -517,8 +517,10 @@ Works like `end-of-defun'."
 If called interactively, visit the version at point."
   (interactive "d")
   (unless log-view-per-file-logs
-    (when (> (length log-view-vc-fileset) 1)
-      (error "Multiple files shown in this buffer, cannot use this command 
here")))
+    (when (or (> (length log-view-vc-fileset) 1)
+              (null (car log-view-vc-fileset))
+              (file-directory-p (car log-view-vc-fileset)))
+      (user-error "Multiple files shown in this buffer, cannot use this 
command here")))
   (save-excursion
     (goto-char pos)
     (switch-to-buffer (vc-find-revision (if log-view-per-file-logs
@@ -561,8 +563,10 @@ If called interactively, visit the version at point."
 If called interactively, annotate the version at point."
   (interactive "d")
   (unless log-view-per-file-logs
-    (when (> (length log-view-vc-fileset) 1)
-      (error "Multiple files shown in this buffer, cannot use this command 
here")))
+    (when (or (> (length log-view-vc-fileset) 1)
+              (null (car log-view-vc-fileset))
+              (file-directory-p (car log-view-vc-fileset)))
+      (user-error "Multiple files shown in this buffer, cannot use this 
command here")))
   (save-excursion
     (goto-char pos)
     (vc-annotate (if log-view-per-file-logs
diff --git a/lisp/vc/pcvs-defs.el b/lisp/vc/pcvs-defs.el
index 362498d..7065b8d 100644
--- a/lisp/vc/pcvs-defs.el
+++ b/lisp/vc/pcvs-defs.el
@@ -1,6 +1,6 @@
 ;;; pcvs-defs.el --- variable definitions for PCL-CVS
 
-;; Copyright (C) 1991-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: pcl-cvs
diff --git a/lisp/vc/pcvs-info.el b/lisp/vc/pcvs-info.el
index 2947733..224bab3 100644
--- a/lisp/vc/pcvs-info.el
+++ b/lisp/vc/pcvs-info.el
@@ -1,6 +1,6 @@
 ;;; pcvs-info.el --- internal representation of a fileinfo entry
 
-;; Copyright (C) 1991-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: pcl-cvs
@@ -263,9 +263,9 @@ to confuse some users sometimes."
             (setq check 'type)         (symbolp type)
             (setq check 'consistency)
             (pcase type
-              (`DIRCHANGE (and (null subtype) (string= "." file)))
-              ((or `NEED-UPDATE `ADDED `MISSING `DEAD `MODIFIED `MESSAGE
-                    `UP-TO-DATE `REMOVED `NEED-MERGE `CONFLICT `UNKNOWN)
+              ('DIRCHANGE (and (null subtype) (string= "." file)))
+              ((or 'NEED-UPDATE 'ADDED 'MISSING 'DEAD 'MODIFIED 'MESSAGE
+                    'UP-TO-DATE 'REMOVED 'NEED-MERGE 'CONFLICT 'UNKNOWN)
                t)))
        fi
       (error "Invalid :%s in cvs-fileinfo %s" check fi))))
@@ -326,11 +326,11 @@ For use by the ewoc package."
        (subtype (cvs-fileinfo->subtype fileinfo)))
     (insert
      (pcase type
-       (`DIRCHANGE (concat "In directory "
+       ('DIRCHANGE (concat "In directory "
                            (cvs-add-face (cvs-fileinfo->full-name fileinfo)
                                          'cvs-header t 'cvs-goal-column t)
                            ":"))
-       (`MESSAGE
+       ('MESSAGE
        (cvs-add-face (format "Message: %s" (cvs-fileinfo->full-log fileinfo))
                      'cvs-msg))
        (_
@@ -344,7 +344,7 @@ For use by the ewoc package."
               (type
                (let ((str (pcase type
                             ;;(MOD-CONFLICT "Not Removed")
-                            (`DEAD       "")
+                            ('DEAD       "")
                             (_ (capitalize (symbol-name type)))))
                      (face (let ((sym (intern-soft
                                        (concat "cvs-fi-"
diff --git a/lisp/vc/pcvs-parse.el b/lisp/vc/pcvs-parse.el
index dbd25d9..0596ccb 100644
--- a/lisp/vc/pcvs-parse.el
+++ b/lisp/vc/pcvs-parse.el
@@ -1,6 +1,6 @@
 ;;; pcvs-parse.el --- the CVS output parser
 
-;; Copyright (C) 1991-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: pcl-cvs
diff --git a/lisp/vc/pcvs-util.el b/lisp/vc/pcvs-util.el
index 5edd886..55da04f 100644
--- a/lisp/vc/pcvs-util.el
+++ b/lisp/vc/pcvs-util.el
@@ -1,6 +1,6 @@
 ;;; pcvs-util.el --- utility functions for PCL-CVS  -*- byte-compile-dynamic: 
t -*-
 
-;; Copyright (C) 1991-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: pcl-cvs
diff --git a/lisp/vc/pcvs.el b/lisp/vc/pcvs.el
index 501666a..4679996 100644
--- a/lisp/vc/pcvs.el
+++ b/lisp/vc/pcvs.el
@@ -1,6 +1,6 @@
 ;;; pcvs.el --- a front-end to CVS  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1991-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1991-2019 Free Software Foundation, Inc.
 
 ;; Author: The PCL-CVS Trust <address@hidden>
 ;;     Per Cederqvist <address@hidden>
@@ -430,11 +430,11 @@ If non-nil, NEW means to create a new buffer no matter 
what."
                    (set-buffer buffer)
                    (and (cvs-buffer-p)
                         (pcase cvs-reuse-cvs-buffer
-                          (`always t)
-                          (`subdir
+                          ('always t)
+                          ('subdir
                            (or (string-prefix-p default-directory dir)
                                (string-prefix-p dir default-directory)))
-                          (`samedir (string= default-directory dir)))
+                          ('samedir (string= default-directory dir)))
                         (cl-return buffer)))))
              ;; we really have to create a new buffer:
              ;; we temporarily bind cwd to "" to prevent
@@ -876,11 +876,11 @@ RM-MSGS if non-nil means remove messages."
                  (keep
                   (pcase type
                     ;; Remove temp messages and keep the others.
-                    (`MESSAGE (not (or rm-msgs (eq subtype 'TEMP))))
+                    ('MESSAGE (not (or rm-msgs (eq subtype 'TEMP))))
                     ;; Remove dead entries.
-                    (`DEAD nil)
+                    ('DEAD nil)
                     ;; Handled also?
-                    (`UP-TO-DATE
+                    ('UP-TO-DATE
                       (not
                        (if (find-buffer-visiting (cvs-fileinfo->full-name fi))
                            (eq rm-handled 'all)
diff --git a/lisp/vc/smerge-mode.el b/lisp/vc/smerge-mode.el
index ff41473..6b1df66 100644
--- a/lisp/vc/smerge-mode.el
+++ b/lisp/vc/smerge-mode.el
@@ -1,6 +1,6 @@
 ;;; smerge-mode.el --- Minor mode to resolve diff3 conflicts -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: vc, tools, revision control, merge, diff3, cvs, conflict
@@ -44,7 +44,7 @@
 ;;; Code:
 
 (eval-when-compile (require 'cl-lib))
-(require 'diff-mode)                    ;For diff-auto-refine-mode.
+(require 'diff-mode)                    ;For diff-refine.
 (require 'newcomment)
 
 ;;; The real definition comes later.
@@ -264,7 +264,7 @@ Can be nil if the style is undecided, or else:
 
 ;; Define smerge-next and smerge-prev
 (easy-mmode-define-navigation smerge smerge-begin-re "conflict" nil nil
-  (if diff-auto-refine-mode
+  (if diff-refine
       (condition-case nil (smerge-refine) (error nil))))
 
 (defconst smerge-match-names ["conflict" "upper" "base" "lower"])
@@ -363,9 +363,9 @@ function should only apply safe heuristics) and with the 
match data set
 according to `smerge-match-conflict'.")
 
 (defvar smerge-text-properties
-  `(help-echo "merge conflict: mouse-3 shows a menu"
-    ;; mouse-face highlight
-    keymap (keymap (down-mouse-3 . smerge-popup-context-menu))))
+  '(help-echo "merge conflict: mouse-3 shows a menu"
+              ;; mouse-face highlight
+              keymap (keymap (down-mouse-3 . smerge-popup-context-menu))))
 
 (defun smerge-remove-props (beg end)
   (remove-overlays beg end 'smerge 'refine)
@@ -1432,6 +1432,40 @@ If no conflict maker is found, turn off `smerge-mode'."
         (smerge-next))
     (error (smerge-auto-leave))))
 
+(defcustom smerge-change-buffer-confirm t
+  "If non-nil, request confirmation before moving to another buffer."
+  :type 'boolean)
+
+(defun smerge-vc-next-conflict ()
+  "Go to next conflict, possibly in another file.
+First tries to go to the next conflict in the current buffer, and if not
+found, uses VC to try and find the next file with conflict."
+  (interactive)
+  (let ((buffer (current-buffer)))
+    (condition-case nil
+        ;; FIXME: Try again from BOB before moving to the next file.
+        (smerge-next)
+      (error
+       (if (and (or smerge-change-buffer-confirm
+                    (and (buffer-modified-p) buffer-file-name))
+                (not (or (eq last-command this-command)
+                         (eq ?\r last-command-event)))) ;Called via M-x!?
+           ;; FIXME: Don't emit this message if `vc-find-conflicted-file' won't
+           ;; go to another file anyway (because there are no more conflicted
+           ;; files).
+           (message (if (buffer-modified-p)
+                        "No more conflicts here.  Repeat to save and go to 
next buffer"
+                      "No more conflicts here.  Repeat to go to next buffer"))
+         (if (and (buffer-modified-p) buffer-file-name)
+             (save-buffer))
+         (vc-find-conflicted-file)
+         (if (eq buffer (current-buffer))
+             ;; Do nothing: presumably `vc-find-conflicted-file' already
+             ;; emitted a message explaining there aren't any more conflicts.
+             nil
+           (goto-char (point-min))
+           (smerge-next)))))))
+
 (provide 'smerge-mode)
 
 ;;; smerge-mode.el ends here
diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el
index 5ee3ac8..8483813 100644
--- a/lisp/vc/vc-annotate.el
+++ b/lisp/vc/vc-annotate.el
@@ -1,6 +1,6 @@
 ;;; vc-annotate.el --- VC Annotate Support  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1997-1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author:     Martin Lorentzson  <address@hidden>
 ;; Maintainer: address@hidden
@@ -541,7 +541,9 @@ Return a cons (REV . FILENAME)."
        (setq prev-rev
              (vc-call-backend vc-annotate-backend 'previous-revision
                                fname rev))
-       (vc-annotate-warp-revision prev-rev fname)))))
+       (if (not prev-rev)
+            (message "No previous revisions")
+          (vc-annotate-warp-revision prev-rev fname))))))
 
 (defvar log-view-vc-backend)
 (defvar log-view-vc-fileset)
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index 8e1a6be..ab5a449 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -1,6 +1,6 @@
 ;;; vc-bzr.el --- VC backend for the bzr revision control system  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Dave Love <address@hidden>
 ;;        Riccardo Murri <address@hidden>
@@ -332,7 +332,7 @@ in the repository root directory of FILE."
          (file-relative-name filename* rootdir))))
 
 (defvar vc-bzr-error-regexp-alist
-  '(("^\\( M[* ]\\|+N \\|-D \\|\\|  \\*\\|R[M ] \\) \\(.+\\)" 2 nil nil 1)
+  '(("^\\( M[* ]\\|\\+N \\|-D \\|\\|  \\*\\|R[M ] \\) \\(.+\\)" 2 nil nil 1)
     ("^C  \\(.+\\)" 2)
     ("^Text conflict in \\(.+\\)" 1 nil nil 2)
     ("^Using saved parent location: \\(.+\\)" 1 nil nil 0))
@@ -782,7 +782,11 @@ If LIMIT is non-nil, show no more than this many entries."
 (defun vc-bzr-expanded-log-entry (revision)
   (with-temp-buffer
     (apply 'vc-bzr-command "log" t nil nil
-          (list "--long" (format "-r%s" revision)))
+           (append
+            (list "--long" (format "-r%s" revision))
+            (if (stringp vc-bzr-log-switches)
+                (list vc-bzr-log-switches)
+              vc-bzr-log-switches)))
     (goto-char (point-min))
     (when (looking-at "^-+\n")
       ;; Indent the expanded log entry.
@@ -1243,7 +1247,11 @@ stream.  Standard error output is discarded."
   (let ((vc-bzr-revisions '())
         (default-directory (file-name-directory (car files))))
     (with-temp-buffer
-      (vc-bzr-command "log" t 0 files "--line")
+      (apply 'vc-bzr-command "log" t 0 files
+             (append '("--line")
+                     (if (stringp vc-bzr-log-switches)
+                         (list vc-bzr-log-switches)
+                       vc-bzr-log-switches)))
       (let ((start (point-min))
             (loglines (buffer-substring-no-properties (point-min) 
(point-max))))
         (while (string-match "^\\([0-9]+\\):" loglines)
diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el
index ac98d99..3bbd0ed 100644
--- a/lisp/vc/vc-cvs.el
+++ b/lisp/vc/vc-cvs.el
@@ -1,6 +1,6 @@
 ;;; vc-cvs.el --- non-resident support for CVS version-control  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1995, 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1998-2019 Free Software Foundation, Inc.
 
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  address@hidden
@@ -650,7 +650,7 @@ Optional arg REVISION is a revision to annotate from."
   "Return the current time, based at midnight of the current day, and
 encoded as fractional days."
   (vc-annotate-convert-time
-   (apply 'encode-time 0 0 0 (nthcdr 3 (decode-time)))))
+   (apply #'encode-time 0 0 0 (nthcdr 3 (decode-time)))))
 
 (defun vc-cvs-annotate-time ()
   "Return the time of the next annotation (as fraction of days)
@@ -910,7 +910,7 @@ essential information. Note that this can never set the 
`ignored'
 state."
   (let (file status missing)
     (goto-char (point-min))
-    (while (looking-at "? \\(.*\\)")
+    (while (looking-at "\\? \\(.*\\)")
       (setq file (expand-file-name (match-string 1)))
       (vc-file-setprop file 'vc-state 'unregistered)
       (forward-line 1))
@@ -1184,9 +1184,8 @@ is non-nil."
                   (car parsed-time)
                   ;; Compare just the seconds part of the file time,
                   ;; since CVS file time stamp resolution is just 1 second.
-                  (let ((ptime (apply 'encode-time parsed-time)))
-                    (and (eq (car mtime) (car ptime))
-                         (eq (cadr mtime) (cadr ptime)))))
+                 (= (encode-time mtime 'integer)
+                    (encode-time parsed-time 'integer)))
              (vc-file-setprop file 'vc-checkout-time mtime)
              (if set-state (vc-file-setprop file 'vc-state 'up-to-date)))
             (t
diff --git a/lisp/vc/vc-dav.el b/lisp/vc/vc-dav.el
index 4ce1a7f..d0b202c 100644
--- a/lisp/vc/vc-dav.el
+++ b/lisp/vc/vc-dav.el
@@ -1,6 +1,6 @@
 ;;; vc-dav.el --- vc.el support for WebDAV
 
-;; Copyright (C) 2001, 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2001, 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Bill Perry <address@hidden>
 ;; Maintainer: Bill Perry <address@hidden>
diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el
index 18da6e3..75697e3 100644
--- a/lisp/vc/vc-dir.el
+++ b/lisp/vc/vc-dir.el
@@ -1,6 +1,6 @@
 ;;; vc-dir.el --- Directory status display under VC  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author:   Dan Nicolaescu <address@hidden>
 ;; Keywords: vc tools
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index da9d346..edbb83f 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -1,6 +1,6 @@
 ;;; vc-dispatcher.el -- generic command-dispatcher facility.  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see below for full credits)
 ;; Maintainer: address@hidden
diff --git a/lisp/vc/vc-filewise.el b/lisp/vc/vc-filewise.el
index bc74fa4..f05e8ef 100644
--- a/lisp/vc/vc-filewise.el
+++ b/lisp/vc/vc-filewise.el
@@ -1,6 +1,6 @@
 ;;; vc-filewise.el --- common functions for file-oriented back ends.
 
-;; Copyright (C) 1992-1996, 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1996, 1998-2019 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: address@hidden
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 4ea7ea5..a921ff1 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -1,6 +1,6 @@
 ;;; vc-git.el --- VC backend for the git version control system -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Alexandre Julliard <address@hidden>
 ;; Keywords: vc tools
@@ -101,6 +101,7 @@
 
 (eval-when-compile
   (require 'cl-lib)
+  (require 'subr-x) ; for string-trim-right
   (require 'vc)
   (require 'vc-dir))
 
@@ -253,7 +254,7 @@ The following place holders should be present in the string:
                        ;; Git for Windows appends ".windows.N" to the
                        ;; numerical version reported by Git.
                        (string-match
-                        "git version \\([0-9.]+\\)\\(\.windows.[0-9]+\\)?$"
+                        "git version \\([0-9.]+\\)\\(\\.windows\\.[0-9]+\\)?$"
                         version-string))
                   (match-string 1 version-string)
                 "0")))))
@@ -289,7 +290,7 @@ in the order given by 'git status'."
     ;;  2. When a file A is renamed to B in the index and then back to A
     ;;     in the working tree.
     ;;  In both of these instances, `unregistered' is a reasonable response.
-    (`("D " "??") 'unregistered)
+    ('("D " "??") 'unregistered)
     ;;  In other cases, let us return `edited'.
     (_ 'edited)))
 
@@ -486,9 +487,9 @@ or an empty string if none."
         (files (vc-git-dir-status-state->files git-state)))
     (goto-char (point-min))
     (pcase (vc-git-dir-status-state->stage git-state)
-      (`update-index
+      ('update-index
        (setq next-stage (if (vc-git--empty-db-p) 'ls-files-added 'diff-index)))
-      (`ls-files-added
+      ('ls-files-added
        (setq next-stage 'ls-files-unknown)
        (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 
0\t\\([^\0]+\\)\0" nil t)
          (let ((new-perm (string-to-number (match-string 1) 8))
@@ -496,7 +497,7 @@ or an empty string if none."
            (vc-git-dir-status-update-file
             git-state name 'added
             (vc-git-create-extra-fileinfo 0 new-perm)))))
-      (`ls-files-up-to-date
+      ('ls-files-up-to-date
        (setq next-stage 'ls-files-unknown)
        (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 
\\([0-3]\\)\t\\([^\0]+\\)\0" nil t)
          (let ((perm (string-to-number (match-string 1) 8))
@@ -507,7 +508,7 @@ or an empty string if none."
                                'up-to-date
                              'conflict)
             (vc-git-create-extra-fileinfo perm perm)))))
-      (`ls-files-conflict
+      ('ls-files-conflict
        (setq next-stage 'ls-files-unknown)
        ;; It's enough to look for "3" to notice a conflict.
        (while (re-search-forward "\\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 
3\t\\([^\0]+\\)\0" nil t)
@@ -516,16 +517,16 @@ or an empty string if none."
            (vc-git-dir-status-update-file
             git-state name 'conflict
             (vc-git-create-extra-fileinfo perm perm)))))
-      (`ls-files-unknown
+      ('ls-files-unknown
        (when files (setq next-stage 'ls-files-ignored))
        (while (re-search-forward "\\([^\0]*?\\)\0" nil t 1)
          (vc-git-dir-status-update-file git-state (match-string 1) 
'unregistered
                                         (vc-git-create-extra-fileinfo 0 0))))
-      (`ls-files-ignored
+      ('ls-files-ignored
        (while (re-search-forward "\\([^\0]*?\\)\0" nil t 1)
          (vc-git-dir-status-update-file git-state (match-string 1) 'ignored
                                         (vc-git-create-extra-fileinfo 0 0))))
-      (`diff-index
+      ('diff-index
        (setq next-stage (if files 'ls-files-up-to-date 'ls-files-conflict))
        (while (re-search-forward
                ":\\([0-7]\\{6\\}\\) \\([0-7]\\{6\\}\\) [0-9a-f]\\{40\\} 
[0-9a-f]\\{40\\} 
\\(\\([ADMUT]\\)\0\\([^\0]+\\)\\|\\([CR]\\)[0-9]*\0\\([^\0]+\\)\0\\([^\0]+\\)\\)\0"
@@ -577,30 +578,30 @@ or an empty string if none."
   (let ((files (vc-git-dir-status-state->files git-state)))
     (erase-buffer)
     (pcase (vc-git-dir-status-state->stage git-state)
-      (`update-index
+      ('update-index
        (if files
            (vc-git-command (current-buffer) 'async files "add" "--refresh" 
"--")
          (vc-git-command (current-buffer) 'async nil
                          "update-index" "--refresh")))
-      (`ls-files-added
+      ('ls-files-added
        (vc-git-command (current-buffer) 'async files
                        "ls-files" "-z" "-c" "-s" "--"))
-      (`ls-files-up-to-date
+      ('ls-files-up-to-date
        (vc-git-command (current-buffer) 'async files
                        "ls-files" "-z" "-c" "-s" "--"))
-      (`ls-files-conflict
+      ('ls-files-conflict
        (vc-git-command (current-buffer) 'async files
                        "ls-files" "-z" "-u" "--"))
-      (`ls-files-unknown
+      ('ls-files-unknown
        (vc-git-command (current-buffer) 'async files
                        "ls-files" "-z" "-o" "--directory"
                        "--no-empty-directory" "--exclude-standard" "--"))
-      (`ls-files-ignored
+      ('ls-files-ignored
        (vc-git-command (current-buffer) 'async files
                        "ls-files" "-z" "-o" "-i" "--directory"
                        "--no-empty-directory" "--exclude-standard" "--"))
       ;; --relative added in Git 1.5.5.
-      (`diff-index
+      ('diff-index
        (vc-git-command (current-buffer) 'async files
                        "diff-index" "--relative" "-z" "-M" "HEAD" "--")))
     (vc-run-delayed
@@ -757,6 +758,11 @@ the commit message."
   (interactive)
   (log-edit-toggle-header "Sign-Off" "yes"))
 
+(defun vc-git-log-edit-toggle-no-verify ()
+  "Toggle whether to bypass the pre-commit and commit-msg hooks."
+  (interactive)
+  (log-edit-toggle-header "No-Verify" "yes"))
+
 (defun vc-git-log-edit-toggle-amend ()
   "Toggle whether this will amend the previous commit.
 If toggling on, also insert its message into the buffer."
@@ -782,6 +788,7 @@ If toggling on, also insert its message into the buffer."
 (defvar vc-git-log-edit-mode-map
   (let ((map (make-sparse-keymap "Git-Log-Edit")))
     (define-key map "\C-c\C-s" 'vc-git-log-edit-toggle-signoff)
+    (define-key map "\C-c\C-n" 'vc-git-log-edit-toggle-no-verify)
     (define-key map "\C-c\C-e" 'vc-git-log-edit-toggle-amend)
     map))
 
@@ -825,6 +832,7 @@ It is based on `log-edit-mode', and has Git-specific 
extensions.")
                             `(("Author" . "--author")
                               ("Date" . "--date")
                               ("Amend" . ,(boolean-arg-fn "--amend"))
+                              ("No-Verify" . ,(boolean-arg-fn "--no-verify"))
                               ("Sign-Off" . ,(boolean-arg-fn "--signoff")))
                             comment)))
                       (when msg-file
@@ -1010,7 +1018,8 @@ This prompts for a branch to merge from."
 If SHORTLOG is non-nil, use a short format based on `vc-git-root-log-format'.
 \(This requires at least Git version 1.5.6, for the --graph option.)
 If START-REVISION is non-nil, it is the newest revision to show.
-If LIMIT is non-nil, show no more than this many entries."
+If LIMIT is a number, show no more than this many entries.
+If LIMIT is a revision string, use it as an end-revision."
   (let ((coding-system-for-read
          (or coding-system-for-read vc-git-log-output-coding-system)))
     ;; `vc-do-command' creates the buffer, but we need it before running
@@ -1038,8 +1047,14 @@ If LIMIT is non-nil, show no more than this many 
entries."
                     ,(format "--pretty=tformat:%s"
                             (car vc-git-root-log-format))
                    "--abbrev-commit"))
-               (when limit (list "-n" (format "%s" limit)))
-               (when start-revision (list start-revision))
+               (when (numberp limit)
+                  (list "-n" (format "%s" limit)))
+               (when start-revision
+                  (if (and limit (not (numberp limit)))
+                      (list (concat start-revision ".." (if (equal limit "")
+                                                            "HEAD"
+                                                          limit)))
+                    (list start-revision)))
                '("--")))))))
 
 (defun vc-git-log-outgoing (buffer remote-location)
@@ -1070,6 +1085,10 @@ If LIMIT is non-nil, show no more than this many 
entries."
                        "@{upstream}"
                      remote-location))))
 
+(defun vc-git-mergebase (rev1 &optional rev2)
+  (unless rev2 (setq rev2 "HEAD"))
+  (string-trim-right (vc-git--run-command-string nil "merge-base" rev1 rev2)))
+
 (defvar log-view-message-re)
 (defvar log-view-file-re)
 (defvar log-view-font-lock-keywords)
@@ -1086,7 +1105,7 @@ If LIMIT is non-nil, show no more than this many entries."
           (cadr vc-git-root-log-format)
         "^commit *\\([0-9a-z]+\\)"))
   ;; Allow expanding short log entries.
-  (when (memq vc-log-view-type '(short log-outgoing log-incoming))
+  (when (memq vc-log-view-type '(short log-outgoing log-incoming mergebase))
     (setq truncate-lines t)
     (set (make-local-variable 'log-view-expanded-log-entry-function)
         'vc-git-expanded-log-entry))
@@ -1189,7 +1208,7 @@ This requires git 1.8.4 or later, for the \"-L\" option 
of \"git log\"."
 (defvar vc-git--log-view-long-font-lock-keywords nil)
 (defvar font-lock-keywords)
 (defvar vc-git-region-history-font-lock-keywords
-  `((vc-git-region-history-font-lock)))
+  '((vc-git-region-history-font-lock)))
 
 (defun vc-git-region-history-font-lock (limit)
   (let ((in-diff (save-excursion
@@ -1475,12 +1494,16 @@ This command shares argument histories with \\[rgrep] 
and \\[grep]."
        (if (eq next-error-last-buffer (current-buffer))
            (setq default-directory dir))))))
 
+(autoload 'vc-dir-marked-files "vc-dir")
+
 (defun vc-git-stash (name)
   "Create a stash."
   (interactive "sStash name: ")
   (let ((root (vc-git-root default-directory)))
     (when root
-      (apply #'vc-git--call nil "stash" "push" "-m" name (vc-dir-marked-files))
+      (apply #'vc-git--call nil "stash" "push" "-m" name
+             (when (derived-mode-p 'vc-dir-mode)
+               (vc-dir-marked-files)))
       (vc-resynch-buffer root t t))))
 
 (defvar vc-git-stash-read-history nil
@@ -1530,10 +1553,7 @@ This command shares argument histories with \\[rgrep] 
and \\[grep]."
   "Create a stash with the current tree state."
   (interactive)
   (vc-git--call nil "stash" "save"
-               (let ((ct (current-time)))
-                 (concat
-                  (format-time-string "Snapshot on %Y-%m-%d" ct)
-                  (format-time-string " at %H:%M" ct))))
+               (format-time-string "Snapshot on %Y-%m-%d at %H:%M"))
   (vc-git-command "*vc-git-stash*" 0 nil "stash" "apply" "-q" "address@hidden")
   (vc-resynch-buffer (vc-git-root default-directory) t t))
 
@@ -1621,9 +1641,9 @@ The difference to vc-do-command is that this function 
always invokes
 (defun vc-git--call (buffer command &rest args)
   ;; We don't need to care the arguments.  If there is a file name, it
   ;; is always a relative one.  This works also for remote
-  ;; directories.  We enable `inhibit-null-byte-detection', otherwise
+  ;; directories.  We enable `inhibit-nul-byte-detection', otherwise
   ;; Tramp's eol conversion might be confused.
-  (let ((inhibit-null-byte-detection t)
+  (let ((inhibit-nul-byte-detection t)
        (coding-system-for-read
          (or coding-system-for-read vc-git-log-output-coding-system))
        (coding-system-for-write
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 3696573..6b17e861 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -1,6 +1,6 @@
 ;;; vc-hg.el --- VC backend for the mercurial version control system  -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; Author: Ivan Kanis
 ;; Maintainer: address@hidden
@@ -145,6 +145,15 @@ switches."
   :version "25.1"
   :group 'vc-hg)
 
+(defcustom vc-hg-revert-switches nil
+  "String or list of strings specifying switches for hg revert
+under VC."
+  :type '(choice (const :tag "None" nil)
+                (string :tag "Argument String")
+                (repeat :tag "Argument List" :value ("") string))
+  :version "27.1"
+  :group 'vc-hg)
+
 (defcustom vc-hg-program "hg"
   "Name of the Mercurial executable (excluding any arguments)."
   :type 'string
@@ -914,9 +923,6 @@ FILENAME must be the file's true absolute name."
       (setf ignored (string-match (pop patterns) filename)))
     ignored))
 
-(defun vc-hg--time-to-integer (ts)
-  (+ (* 65536 (car ts)) (cadr ts)))
-
 (defvar vc-hg--cached-ignore-patterns nil
   "Cached pre-parsed hg ignore patterns.")
 
@@ -1037,8 +1043,9 @@ hg binary."
                (let ((vc-hg-size (nth 2 dirstate-entry))
                      (vc-hg-mtime (nth 3 dirstate-entry))
                      (fs-size (file-attribute-size stat))
-                     (fs-mtime (vc-hg--time-to-integer
-                               (file-attribute-modification-time stat))))
+                    (fs-mtime (encode-time
+                               (file-attribute-modification-time stat)
+                               'integer)))
                  (if (and (eql vc-hg-size fs-size) (eql vc-hg-mtime fs-mtime))
                      'up-to-date
                    'edited)))
@@ -1142,11 +1149,9 @@ REV is the revision to check out into WORKFILE."
 
 (defun vc-hg-find-file-hook ()
   (when (and buffer-file-name
-             (file-exists-p (concat buffer-file-name ".orig"))
              ;; Hg does not seem to have a "conflict" status, eg
              ;; hg http://bz.selenic.com/show_bug.cgi?id=2724
-             (memq (vc-file-getprop buffer-file-name 'vc-state)
-                   '(edited conflict))
+             (memq (vc-state buffer-file-name) '(edited conflict))
              ;; Maybe go on to check that "hg resolve -l" says "U"?
              ;; If "hg resolve -l" says there's a conflict but there are no
              ;; conflict markers, it's not clear what we should do.
@@ -1163,7 +1168,11 @@ REV is the revision to check out into WORKFILE."
 ;; Modeled after the similar function in vc-bzr.el
 (defun vc-hg-revert (file &optional contents-done)
   (unless contents-done
-    (with-temp-buffer (vc-hg-command t 0 file "revert"))))
+    (with-temp-buffer
+      (apply #'vc-hg-command
+             t 0 file
+             "revert"
+             (append (vc-switches 'hg 'revert))))))
 
 ;;; Hg specific functionality.
 
@@ -1194,9 +1203,9 @@ REV is the revision to check out into WORKFILE."
       (insert (propertize
                (format "   (%s %s)"
                        (pcase (vc-hg-extra-fileinfo->rename-state extra)
-                         (`copied "copied from")
-                         (`renamed-from "renamed from")
-                         (`renamed-to "renamed to"))
+                         ('copied "copied from")
+                         ('renamed-from "renamed from")
+                         ('renamed-to "renamed to"))
                        (vc-hg-extra-fileinfo->extra-name extra))
                'face 'font-lock-comment-face)))))
 
diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el
index 84e11f2..07b3d86 100644
--- a/lisp/vc/vc-hooks.el
+++ b/lisp/vc/vc-hooks.el
@@ -1,6 +1,6 @@
-;;; vc-hooks.el --- resident support for version-control
+;;; vc-hooks.el --- resident support for version-control  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1992-1996, 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1996, 1998-2019 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: address@hidden
@@ -173,9 +173,9 @@ Otherwise, not displayed."
 (make-variable-buffer-local 'vc-mode)
 (put 'vc-mode 'permanent-local t)
 
-;;; We signal this error when we try to do something a VC backend
-;;; doesn't support.  Two arguments: the method that's not supported
-;;; and the backend
+;; We signal this error when we try to do something a VC backend
+;; doesn't support.  Two arguments: the method that's not supported
+;; and the backend
 (define-error 'vc-not-supported "VC method not implemented for backend")
 
 (defun vc-mode (&optional _arg)
@@ -243,12 +243,12 @@ if that doesn't exist either, return nil."
   "Call for BACKEND the implementation of FUNCTION-NAME with the given ARGS.
 Calls
 
-    (apply \\='vc-BACKEND-FUN ARGS)
+    (apply #\\='vc-BACKEND-FUN ARGS)
 
 if vc-BACKEND-FUN exists (after trying to find it in vc-BACKEND.el)
 and else calls
 
-    (apply \\='vc-default-FUN BACKEND ARGS)
+    (apply #\\='vc-default-FUN BACKEND ARGS)
 
 It is usually called via the `vc-call' macro."
   (let ((f (assoc function-name (get backend 'vc-functions))))
@@ -603,7 +603,7 @@ a regexp for matching all such backup files, regardless of 
the version."
   "Delete all existing automatic version backups for FILE."
   (condition-case nil
       (mapc
-       'delete-file
+       #'delete-file
        (directory-files (or (file-name-directory file) default-directory) t
                        (vc-version-backup-file-name file nil nil t)))
     ;; Don't fail when the directory doesn't exist.
@@ -811,7 +811,7 @@ In the latter case, VC mode is deactivated for this buffer."
   (when buffer-file-name
     (vc-file-clearprops buffer-file-name)
     ;; FIXME: Why use a hook?  Why pass it buffer-file-name?
-    (add-hook 'vc-mode-line-hook 'vc-mode-line nil t)
+    (add-hook 'vc-mode-line-hook #'vc-mode-line nil t)
     (let (backend)
       (cond
         ((setq backend (with-demoted-errors (vc-backend buffer-file-name)))
@@ -862,13 +862,13 @@ In the latter case, VC mode is deactivated for this 
buffer."
                   )))))))))
 
 (add-hook 'find-file-hook #'vc-refresh-state)
-(define-obsolete-function-alias 'vc-find-file-hook 'vc-refresh-state "25.1")
+(define-obsolete-function-alias 'vc-find-file-hook #'vc-refresh-state "25.1")
 
 (defun vc-kill-buffer-hook ()
   "Discard VC info about a file when we kill its buffer."
   (when buffer-file-name (vc-file-clearprops buffer-file-name)))
 
-(add-hook 'kill-buffer-hook 'vc-kill-buffer-hook)
+(add-hook 'kill-buffer-hook #'vc-kill-buffer-hook)
 
 ;; Now arrange for (autoloaded) bindings of the main package.
 ;; Bindings for this have to go in the global map, as we'll often
@@ -890,6 +890,8 @@ In the latter case, VC mode is deactivated for this buffer."
     (define-key map "L" 'vc-print-root-log)
     (define-key map "I" 'vc-log-incoming)
     (define-key map "O" 'vc-log-outgoing)
+    (define-key map "ML" 'vc-log-mergebase)
+    (define-key map "MD" 'vc-diff-mergebase)
     (define-key map "m" 'vc-merge)
     (define-key map "r" 'vc-retrieve-tag)
     (define-key map "s" 'vc-create-tag)
@@ -950,8 +952,7 @@ In the latter case, VC mode is deactivated for this buffer."
     (bindings--define-key map [separator2] menu-bar-separator)
     (bindings--define-key map [vc-insert-header]
       '(menu-item "Insert Header" vc-insert-headers
-                 :help "Insert headers into a file for use with a version 
control system.
-"))
+                 :help "Insert headers into a file for use with a version 
control system."))
     (bindings--define-key map [vc-revert]
       '(menu-item "Revert to Base Version" vc-revert
                  :help "Revert working copies of the selected file set to 
their repository contents"))
diff --git a/lisp/vc/vc-mtn.el b/lisp/vc/vc-mtn.el
index 94cf769..f0b1248 100644
--- a/lisp/vc/vc-mtn.el
+++ b/lisp/vc/vc-mtn.el
@@ -1,6 +1,6 @@
 ;;; vc-mtn.el --- VC backend for Monotone  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords: vc
@@ -190,8 +190,8 @@ switches."
                 (setq branch (replace-match (cdr rule) t nil branch))))
           (format "Mtn%c%s"
                   (pcase (vc-state file)
-                    ((or `up-to-date `needs-update) ?-)
-                    (`added ?@)
+                    ((or 'up-to-date 'needs-update) ?-)
+                    ('added ?@)
                     (_ ?:))
                   branch))
       "")))
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 51a4443..598e982 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -1,6 +1,6 @@
 ;;; vc-rcs.el --- support for RCS version-control  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: address@hidden
@@ -684,13 +684,13 @@ Optional arg REVISION is a revision to annotate from."
           (forward-line (1- (pop insn)))
           (setq p (point))
           (pcase (pop insn)
-            (`k (setq s (buffer-substring-no-properties
+            ('k (setq s (buffer-substring-no-properties
                          p (progn (forward-line (car insn))
                                   (point))))
                 (when prda
                   (push `(,p . ,(propertize s :vc-rcs-r/d/a prda)) path))
                 (delete-region p (point)))
-            (`i (setq s (car insn))
+            ('i (setq s (car insn))
                 (when prda
                   (push `(,p . ,(length s)) path))
                 (insert s)))))
@@ -716,10 +716,10 @@ Optional arg REVISION is a revision to annotate from."
                    (goto-char (point-min))
                    (forward-line (1- (pop insn)))
                    (pcase (pop insn)
-                     (`k (delete-region
+                     ('k (delete-region
                           (point) (progn (forward-line (car insn))
                                          (point))))
-                     (`i (insert (propertize
+                     ('i (insert (propertize
                                   (car insn)
                                   :vc-rcs-r/d/a
                                   (or prda (setq prda (r/d/a))))))))
diff --git a/lisp/vc/vc-sccs.el b/lisp/vc/vc-sccs.el
index 4ca89da..4e9f5a0 100644
--- a/lisp/vc/vc-sccs.el
+++ b/lisp/vc/vc-sccs.el
@@ -1,6 +1,6 @@
 ;;; vc-sccs.el --- support for SCCS version-control  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: address@hidden
diff --git a/lisp/vc/vc-src.el b/lisp/vc/vc-src.el
index 58d4dec..f847592 100644
--- a/lisp/vc/vc-src.el
+++ b/lisp/vc/vc-src.el
@@ -1,6 +1,6 @@
 ;;; vc-src.el --- support for SRC version-control  -*- lexical-binding:t -*-
 
-;; Copyright (C) 1992-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2019 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see vc.el for full credits)
 ;; Maintainer: address@hidden
diff --git a/lisp/vc/vc-svn.el b/lisp/vc/vc-svn.el
index 4b1a34b..618f03e 100644
--- a/lisp/vc/vc-svn.el
+++ b/lisp/vc/vc-svn.el
@@ -1,6 +1,6 @@
 ;;; vc-svn.el --- non-resident support for Subversion version-control  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author:      FSF (see vc.el for full credits)
 ;; Maintainer:  Stefan Monnier <address@hidden>
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 57bc3c2..e6f30c9 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -1,6 +1,6 @@
 ;;; vc.el --- drive a version-control system from within Emacs  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1992-1998, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1992-1998, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author:     FSF (see below for full credits)
 ;; Maintainer: address@hidden
@@ -429,6 +429,10 @@
 ;; - region-history-mode ()
 ;;
 ;;   Major mode to use for the output of `region-history'.
+;;
+;; - mergebase (rev1 &optional rev2)
+;;
+;;   Return the common ancestor between REV1 and REV2 revisions.
 
 ;; TAG SYSTEM
 ;;
@@ -736,8 +740,7 @@ These are passed to the checkin program by \\[vc-checkin]."
                 (string :tag "Argument String")
                 (repeat :tag "Argument List"
                         :value ("")
-                        string))
-  :group 'vc)
+                        string)))
 
 (defcustom vc-checkout-switches nil
   "A string or list of strings specifying extra switches for checkout.
@@ -746,8 +749,7 @@ These are passed to the checkout program by 
\\[vc-checkout]."
                 (string :tag "Argument String")
                 (repeat :tag "Argument List"
                         :value ("")
-                        string))
-  :group 'vc)
+                        string)))
 
 (defcustom vc-register-switches nil
   "A string or list of strings; extra switches for registering a file.
@@ -756,8 +758,7 @@ These are passed to the checkin program by \\[vc-register]."
                 (string :tag "Argument String")
                 (repeat :tag "Argument List"
                         :value ("")
-                        string))
-  :group 'vc)
+                        string)))
 
 (defcustom vc-diff-switches nil
   "A string or list of strings specifying switches for diff under VC.
@@ -772,7 +773,6 @@ not specific to any particular backend."
                 (const :tag "None" t)
                 (string :tag "Argument String")
                 (repeat :tag "Argument List" :value ("") string))
-  :group 'vc
   :version "21.1")
 
 (defcustom vc-annotate-switches nil
@@ -792,15 +792,13 @@ for the backend you use."
                 (const :tag "None" t)
                 (string :tag "Argument String")
                 (repeat :tag "Argument List" :value ("") string))
-  :group 'vc
   :version "25.1")
 
 (defcustom vc-log-show-limit 2000
   "Limit the number of items shown by the VC log commands.
 Zero means unlimited.
 Not all VC backends are able to support this feature."
-  :type 'integer
-  :group 'vc)
+  :type 'integer)
 
 (defcustom vc-allow-async-revert nil
   "Specifies whether the diff during \\[vc-revert] may be asynchronous.
@@ -808,7 +806,6 @@ Enabling this option means that you can confirm a revert 
operation even
 if the local changes in the file have not been found and displayed yet."
   :type '(choice (const :tag "No" nil)
                  (const :tag "Yes" t))
-  :group 'vc
   :version "22.1")
 
 ;;;###autoload
@@ -816,7 +813,6 @@ if the local changes in the file have not been found and 
displayed yet."
   "Normal hook (list of functions) run after checking out a file.
 See `run-hooks'."
   :type 'hook
-  :group 'vc
   :version "21.1")
 
 ;;;###autoload
@@ -824,26 +820,22 @@ See `run-hooks'."
   "Normal hook (list of functions) run after commit or file checkin.
 See also `log-edit-done-hook'."
   :type 'hook
-  :options '(log-edit-comment-to-change-log)
-  :group 'vc)
+  :options '(log-edit-comment-to-change-log))
 
 ;;;###autoload
 (defcustom vc-before-checkin-hook nil
   "Normal hook (list of functions) run before a commit or a file checkin.
 See `run-hooks'."
-  :type 'hook
-  :group 'vc)
+  :type 'hook)
 
 (defcustom vc-retrieve-tag-hook nil
   "Normal hook (list of functions) run after retrieving a tag."
   :type 'hook
-  :group 'vc
   :version "27.1")
 
 (defcustom vc-revert-show-diff t
   "If non-nil, `vc-revert' shows a `vc-diff' buffer before querying."
   :type 'boolean
-  :group 'vc
   :version "24.1")
 
 ;; Header-insertion hair
@@ -856,8 +848,7 @@ A %s in the template is replaced with the first string 
associated with
 the file's version control type in `vc-BACKEND-header'."
   :type '(repeat (cons :format "%v"
                       (regexp :tag "File Type")
-                      (string :tag "Header String")))
-  :group 'vc)
+                      (string :tag "Header String"))))
 
 (defcustom vc-comment-alist
   '((nroff-mode ".\\\"" ""))
@@ -868,8 +859,12 @@ is sensitive to blank lines."
   :type '(repeat (list :format "%v"
                       (symbol :tag "Mode")
                       (string :tag "Comment Start")
-                      (string :tag "Comment End")))
-  :group 'vc)
+                      (string :tag "Comment End"))))
+
+(defcustom vc-find-revision-no-save nil
+  "If non-nil, `vc-find-revision' doesn't write the created buffer to file."
+  :type 'boolean
+  :version "27.1")
 
 
 ;; File property caching
@@ -934,7 +929,7 @@ use."
             ;; 'create-repo method.
             (completing-read
              (format "%s is not in a version controlled directory.\nUse VC 
backend: " file)
-             (mapcar 'symbol-name possible-backends) nil t)))
+             (mapcar #'symbol-name possible-backends) nil t)))
           (repo-dir
            (let ((def-dir (file-name-directory file)))
              ;; read the directory where to create the
@@ -987,6 +982,7 @@ Within directories, only files already under version 
control are noticed."
 (defvar log-view-vc-backend)
 (defvar log-edit-vc-backend)
 (defvar diff-vc-backend)
+(defvar diff-vc-revisions)
 
 (defun vc-deduce-backend ()
   (cond ((derived-mode-p 'vc-dir-mode)   vc-dir-backend)
@@ -1061,27 +1057,27 @@ BEWARE: this function may change the current buffer."
      (t (error "File is not under version control")))))
 
 (defun vc-dired-deduce-fileset ()
-  (let ((backend (vc-responsible-backend default-directory)))
-    (unless backend (error "Directory not under VC"))
-    (list backend
-          (dired-map-over-marks (dired-get-filename nil t) nil))))
+  (list (vc-responsible-backend default-directory)
+        (dired-map-over-marks (dired-get-filename nil t) nil)))
 
 (defun vc-ensure-vc-buffer ()
   "Make sure that the current buffer visits a version-controlled file."
   (cond
    ((derived-mode-p 'vc-dir-mode)
     (set-buffer (find-file-noselect (vc-dir-current-file))))
+   ((derived-mode-p 'dired-mode)
+    (set-buffer (find-file-noselect (dired-get-filename))))
    (t
     (while (and vc-parent-buffer
                 (buffer-live-p vc-parent-buffer)
                ;; Avoid infinite looping when vc-parent-buffer and
                ;; current buffer are the same buffer.
                (not (eq vc-parent-buffer (current-buffer))))
-      (set-buffer vc-parent-buffer))
-    (if (not buffer-file-name)
-       (error "Buffer %s is not associated with a file" (buffer-name))
-      (unless (vc-backend buffer-file-name)
-       (error "File %s is not under version control" buffer-file-name))))))
+      (set-buffer vc-parent-buffer))))
+  (if (not buffer-file-name)
+      (error "Buffer %s is not associated with a file" (buffer-name))
+    (unless (vc-backend buffer-file-name)
+      (error "File %s is not under version control" buffer-file-name))))
 
 ;;; Support for the C-x v v command.
 ;; This is where all the single-file-oriented code from before the fileset
@@ -1102,7 +1098,7 @@ BEWARE: this function may change the current buffer."
 
 (defun vc-read-backend (prompt)
   (intern
-   (completing-read prompt (mapcar 'symbol-name vc-handled-backends)
+   (completing-read prompt (mapcar #'symbol-name vc-handled-backends)
                     nil 'require-match)))
 
 ;; Here's the major entry point.
@@ -1360,7 +1356,7 @@ first backend that could register the file is used."
              (set-buffer-modified-p t))
            (vc-buffer-sync)))))
     (message "Registering %s... " files)
-    (mapc 'vc-file-clearprops files)
+    (mapc #'vc-file-clearprops files)
     (vc-call-backend backend 'register files comment)
     (mapc
      (lambda (file)
@@ -1562,7 +1558,7 @@ Runs the normal hooks `vc-before-checkin-hook' and 
`vc-checkin-hook'."
        ;; not a well-defined concept for filesets.
        (progn
          (vc-call-backend backend 'checkin files comment rev)
-         (mapc 'vc-delete-automatic-version-backups files))
+         (mapc #'vc-delete-automatic-version-backups files))
        `((vc-state . up-to-date)
          (vc-checkout-time . ,(file-attribute-modification-time
                               (file-attributes file)))
@@ -1720,7 +1716,7 @@ Return t if the buffer had changes, nil otherwise."
                 (error "No revisions of %s exist" file)
               ;; We regard this as "changed".
               ;; Diff it against /dev/null.
-              (apply 'vc-do-command buffer
+              (apply #'vc-do-command buffer
                      (if async 'async 1) "diff" file
                      (append (vc-switches nil 'diff) '("/dev/null"))))))
         (setq files (nreverse filtered))))
@@ -1728,6 +1724,7 @@ Return t if the buffer had changes, nil otherwise."
     (set-buffer buffer)
     (diff-mode)
     (set (make-local-variable 'diff-vc-backend) (car vc-fileset))
+    (set (make-local-variable 'diff-vc-revisions) (list rev1 rev2))
     (set (make-local-variable 'revert-buffer-function)
         (lambda (_ignore-auto _noconfirm)
            (vc-diff-internal async vc-fileset rev1 rev2 verbose)))
@@ -1769,9 +1766,9 @@ Return t if the buffer had changes, nil otherwise."
                          nil nil initial-input 'vc-revision-history default)
       (read-string prompt initial-input nil default))))
 
-(defun vc-diff-build-argument-list-internal ()
+(defun vc-diff-build-argument-list-internal (&optional fileset)
   "Build argument list for calling internal diff functions."
-  (let* ((vc-fileset (vc-deduce-fileset t)) ;FIXME: why t?  --Stef
+  (let* ((vc-fileset (or fileset (vc-deduce-fileset t))) ;FIXME: why t?  --Stef
          (files (cadr vc-fileset))
          (backend (car vc-fileset))
          (first (car files))
@@ -1809,7 +1806,7 @@ Return t if the buffer had changes, nil otherwise."
 
 ;;;###autoload
 (defun vc-version-diff (_files rev1 rev2)
-  "Report diffs between revisions of the fileset in the repository history."
+  "Report diffs between REV1 and REV2 revisions of the fileset."
   (interactive (vc-diff-build-argument-list-internal))
   ;; All that was just so we could do argument completion!
   (when (and (not rev1) rev2)
@@ -1820,6 +1817,32 @@ Return t if the buffer had changes, nil otherwise."
                    (called-interactively-p 'interactive)))
 
 ;;;###autoload
+(defun vc-root-version-diff (_files rev1 rev2)
+  "Report diffs between REV1 and REV2 revisions of the whole tree."
+  (interactive
+   (vc-diff-build-argument-list-internal
+    (or (ignore-errors (vc-deduce-fileset t))
+        (let ((backend (or (vc-deduce-backend) (vc-responsible-backend 
default-directory))))
+          (list backend (list (vc-call-backend backend 'root 
default-directory)))))))
+  ;; This is a mix of `vc-root-diff' and `vc-version-diff'
+  (when (and (not rev1) rev2)
+    (error "Not a valid revision range"))
+  (let ((backend (vc-deduce-backend))
+        (default-directory default-directory)
+        rootdir)
+    (if backend
+        (setq rootdir (vc-call-backend backend 'root default-directory))
+      (setq rootdir (read-directory-name "Directory for VC root-diff: "))
+      (setq backend (vc-responsible-backend rootdir))
+      (if backend
+          (setq default-directory rootdir)
+        (error "Directory is not version controlled")))
+    (let ((default-directory rootdir))
+      (vc-diff-internal
+       t (list backend (list rootdir)) rev1 rev2
+       (called-interactively-p 'interactive)))))
+
+;;;###autoload
 (defun vc-diff (&optional historic not-urgent)
   "Display diffs between file revisions.
 Normally this compares the currently selected fileset with their
@@ -1835,6 +1858,33 @@ saving the buffer."
     (vc-diff-internal t (vc-deduce-fileset t) nil nil
                      (called-interactively-p 'interactive))))
 
+;;;###autoload
+(defun vc-diff-mergebase (_files rev1 rev2)
+  "Report diffs between the merge base of REV1 and REV2 revisions.
+The merge base is a common ancestor between REV1 and REV2 revisions."
+  (interactive
+   (vc-diff-build-argument-list-internal
+    (or (ignore-errors (vc-deduce-fileset t))
+        (let ((backend (or (vc-deduce-backend) (vc-responsible-backend 
default-directory))))
+          (list backend (list (vc-call-backend backend 'root 
default-directory)))))))
+  (when (and (not rev1) rev2)
+    (error "Not a valid revision range"))
+  (let ((backend (vc-deduce-backend))
+        (default-directory default-directory)
+        rootdir)
+    (if backend
+        (setq rootdir (vc-call-backend backend 'root default-directory))
+      (setq rootdir (read-directory-name "Directory for VC root-diff: "))
+      (setq backend (vc-responsible-backend rootdir))
+      (if backend
+          (setq default-directory rootdir)
+        (error "Directory is not version controlled")))
+    (let ((default-directory rootdir)
+          (rev1 (vc-call-backend backend 'mergebase rev1 rev2)))
+      (vc-diff-internal
+       t (list backend (list rootdir)) rev1 rev2
+       (called-interactively-p 'interactive)))))
+
 (declare-function ediff-load-version-control "ediff" (&optional silent))
 (declare-function ediff-vc-internal "ediff-vers"
                   (rev1 rev2 &optional startup-hooks))
@@ -1892,10 +1942,8 @@ The optional argument NOT-URGENT non-nil means it is ok 
to say no to
 saving the buffer."
   (interactive (list current-prefix-arg t))
   (if historic
-      ;; FIXME: this does not work right, `vc-version-diff' ends up
-      ;; calling `vc-deduce-fileset' to find the files to diff, and
-      ;; that's not what we want here, we want the diff for the VC root dir.
-      (call-interactively 'vc-version-diff)
+      ;; We want the diff for the VC root dir.
+      (call-interactively 'vc-root-version-diff)
     (when buffer-file-name (vc-buffer-sync not-urgent))
     (let ((backend (vc-deduce-backend))
          (default-directory default-directory)
@@ -1951,6 +1999,13 @@ If `F.~REV~' already exists, use it instead of checking 
it out again."
 (defun vc-find-revision (file revision &optional backend)
   "Read REVISION of FILE into a buffer and return the buffer.
 Use BACKEND as the VC backend if specified."
+  (if vc-find-revision-no-save
+      (vc-find-revision-no-save file revision backend)
+    (vc-find-revision-save file revision backend)))
+
+(defun vc-find-revision-save (file revision &optional backend)
+  "Read REVISION of FILE into a buffer and return the buffer.
+Saves the buffer to the file."
   (let ((automatic-backup (vc-version-backup-file-name file revision))
        (filebuf (or (get-file-buffer file) (current-buffer)))
         (filename (vc-version-backup-file-name file revision 'manual)))
@@ -1961,10 +2016,13 @@ Use BACKEND as the VC backend if specified."
        (with-current-buffer filebuf
          (let ((failed t))
            (unwind-protect
-               (let ((coding-system-for-read 'no-conversion)
-                     (coding-system-for-write 'no-conversion))
+               (let ((coding-system-for-read 'no-conversion))
                  (with-temp-file filename
                    (let ((outbuf (current-buffer)))
+                      ;; We will read the backend's output with no
+                      ;; conversions, so we should also save the
+                      ;; temporary file with no encoding conversions.
+                      (setq buffer-file-coding-system 'no-conversion)
                      ;; Change buffer to get local value of
                      ;; vc-checkout-switches.
                      (with-current-buffer filebuf
@@ -1983,6 +2041,51 @@ Use BACKEND as the VC backend if specified."
        (set (make-local-variable 'vc-parent-buffer) filebuf))
       result-buf)))
 
+(defun vc-find-revision-no-save (file revision &optional backend buffer)
+  "Read REVISION of FILE into BUFFER and return the buffer.
+If BUFFER omitted or nil, this function creates a new buffer and sets
+`buffer-file-name' to the name constructed from the file name and the
+revision number.
+Unlike `vc-find-revision-save', doesn't save the buffer to the file."
+  (let* ((buffer (when (buffer-live-p buffer) buffer))
+         (filebuf (or buffer (get-file-buffer file) (current-buffer)))
+         (filename (unless buffer (vc-version-backup-file-name file revision 
'manual))))
+    (unless (and (not buffer)
+                 (or (get-file-buffer filename)
+                     (file-exists-p filename)))
+      (with-current-buffer filebuf
+       (let ((failed t))
+         (unwind-protect
+             (with-current-buffer (or buffer (create-file-buffer filename))
+                (unless buffer (setq buffer-file-name filename))
+               (let ((outbuf (current-buffer)))
+                 (with-current-buffer filebuf
+                   (if backend
+                       (vc-call-backend backend 'find-revision file revision 
outbuf)
+                     (vc-call find-revision file revision outbuf))))
+                (decode-coding-inserted-region (point-min) (point-max) file)
+                (after-insert-file-set-coding (- (point-max) (point-min)))
+                (goto-char (point-min))
+                (if buffer
+                    ;; For non-interactive, skip any questions
+                    (let ((enable-local-variables :safe) ;; to find `mode:'
+                          (buffer-file-name file))
+                      (ignore-errors (set-auto-mode)))
+                  (normal-mode))
+               (set-buffer-modified-p nil)
+                (setq buffer-read-only t))
+               (setq failed nil)
+           (when (and failed (unless buffer (get-file-buffer filename)))
+             (with-current-buffer (get-file-buffer filename)
+               (set-buffer-modified-p nil))
+             (kill-buffer (get-file-buffer filename)))))))
+    (let ((result-buf (or buffer
+                          (get-file-buffer filename)
+                          (find-file-noselect filename))))
+      (with-current-buffer result-buf
+       (set (make-local-variable 'vc-parent-buffer) filebuf))
+      result-buf)))
+
 ;; Header-insertion code
 
 ;;;###autoload
@@ -2089,6 +2192,7 @@ changes from the current branch."
 ;; `default-next-file' variable for its default file (M-n), and
 ;; we could then set it upon mark-resolve, so C-x C-s C-x C-f M-n would
 ;; automatically offer the next conflicted file.
+;;;###autoload
 (defun vc-find-conflicted-file ()
   "Visit the next conflicted file in the current project."
   (interactive)
@@ -2412,6 +2516,28 @@ When called interactively with a prefix argument, prompt 
for REMOTE-LOCATION."
                                    "*vc-outgoing*" 'log-outgoing)))
 
 ;;;###autoload
+(defun vc-log-mergebase (_files rev1 rev2)
+  "Show a log of changes between the merge base of REV1 and REV2 revisions.
+The merge base is a common ancestor between REV1 and REV2 revisions."
+  (interactive
+   (vc-diff-build-argument-list-internal
+    (or (ignore-errors (vc-deduce-fileset t))
+        (let ((backend (or (vc-deduce-backend) (vc-responsible-backend 
default-directory))))
+          (list backend (list (vc-call-backend backend 'root 
default-directory)))))))
+  (let ((backend (vc-deduce-backend))
+       (default-directory default-directory)
+       rootdir)
+    (if backend
+       (setq rootdir (vc-call-backend backend 'root default-directory))
+      (setq rootdir (read-directory-name "Directory for VC root-log: "))
+      (setq backend (vc-responsible-backend rootdir))
+      (unless backend
+        (error "Directory is not version controlled")))
+    (setq default-directory rootdir)
+    (setq rev1 (vc-call-backend backend 'mergebase rev1 rev2))
+    (vc-print-log-internal backend (list rootdir) rev1 t (or rev2 ""))))
+
+;;;###autoload
 (defun vc-region-history (from to)
   "Show the history of the region between FROM and TO.
 
@@ -2689,7 +2815,8 @@ If called interactively, read FILE, defaulting to the 
current
 buffer's file name if it's under version control."
   (interactive (list (read-file-name "VC delete file: " nil
                                      (when (vc-backend buffer-file-name)
-                                       buffer-file-name) t)))
+                                       buffer-file-name)
+                                     t)))
   (setq file (expand-file-name file))
   (let ((buf (get-file-buffer file))
         (backend (vc-backend file)))
diff --git a/lisp/vcursor.el b/lisp/vcursor.el
index ce7a895..3e8b6ee 100644
--- a/lisp/vcursor.el
+++ b/lisp/vcursor.el
@@ -1,6 +1,6 @@
 ;;; vcursor.el --- manipulate an alternative ("virtual") cursor
 
-;; Copyright (C) 1994, 1996, 1998, 2001-2018 Free Software Foundation,
+;; Copyright (C) 1994, 1996, 1998, 2001-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author:   Peter Stephenson <address@hidden>
diff --git a/lisp/version.el b/lisp/version.el
index 8491930..d13d8c3 100644
--- a/lisp/version.el
+++ b/lisp/version.el
@@ -1,6 +1,6 @@
 ;;; version.el --- record version number of Emacs
 
-;; Copyright (C) 1985, 1992, 1994-1995, 1999-2018 Free Software
+;; Copyright (C) 1985, 1992, 1994-1995, 1999-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -135,6 +135,34 @@ Optional argument DIR is a directory to use instead of 
`source-directory'.
 Optional argument EXTERNAL is ignored."
   (emacs-repository-version-git (or dir source-directory)))
 
+(defvar emacs-repository-branch nil
+  "String giving the repository branch from which this Emacs was built.
+Value is nil if Emacs was not built from a repository checkout,
+or if we could not determine the branch.")
+
+(defun emacs-repository-branch-git (dir)
+  "Ask git itself for the branch information for directory DIR."
+  (message "Waiting for git...")
+  (with-temp-buffer
+    (let ((default-directory (file-name-as-directory dir)))
+      (and (zerop
+           (with-demoted-errors "Error running git rev-parse --abbrev-ref: %S"
+             (call-process "git" nil '(t nil) nil
+                            "rev-parse" "--abbrev-ref" "HEAD")))
+           (goto-char (point-min))
+           (buffer-substring (point) (line-end-position))))))
+
+(defun emacs-repository-get-branch (&optional dir)
+  "Try to return as a string the repository branch of the Emacs sources.
+The format of the returned string is dependent on the VCS in use.
+Value is nil if the sources do not seem to be under version
+control, or if we could not determine the branch.  Note that
+this reports on the current state of the sources, which may not
+correspond to the running Emacs.
+
+Optional argument DIR is a directory to use instead of `source-directory'."
+  (emacs-repository-branch-git (or dir source-directory)))
+
 ;; We put version info into the executable in the form that `ident' uses.
 (purecopy (concat "\n$Id: " (subst-char-in-string ?\n ?\s (emacs-version))
                  " $\n"))
diff --git a/lisp/view.el b/lisp/view.el
index 56f98a6..e74ce1e 100644
--- a/lisp/view.el
+++ b/lisp/view.el
@@ -1,6 +1,6 @@
 ;;; view.el --- peruse file or buffer without editing
 
-;; Copyright (C) 1985, 1989, 1994-1995, 1997, 2000-2018 Free Software
+;; Copyright (C) 1985, 1989, 1994-1995, 1997, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: K. Shane Hartman
diff --git a/lisp/vt-control.el b/lisp/vt-control.el
index 50e86f4..7175095 100644
--- a/lisp/vt-control.el
+++ b/lisp/vt-control.el
@@ -1,6 +1,6 @@
 ;;; vt-control.el --- Common VTxxx control functions
 
-;; Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Rob Riepel <address@hidden>
 ;; Maintainer: Rob Riepel <address@hidden>
diff --git a/lisp/vt100-led.el b/lisp/vt100-led.el
index 55ed896..d7b5f0a 100644
--- a/lisp/vt100-led.el
+++ b/lisp/vt100-led.el
@@ -1,6 +1,6 @@
 ;;; vt100-led.el --- functions for LED control on VT-100 terminals & clones
 
-;; Copyright (C) 1988, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1988, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Howard Gayle
 ;; Maintainer: address@hidden
diff --git a/lisp/w32-fns.el b/lisp/w32-fns.el
index 91fe518..8762fe7 100644
--- a/lisp/w32-fns.el
+++ b/lisp/w32-fns.el
@@ -1,6 +1,6 @@
 ;;; w32-fns.el --- Lisp routines for 32-bit Windows
 
-;; Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Geoff Voelker <address@hidden>
 ;; Keywords: internal
diff --git a/lisp/w32-vars.el b/lisp/w32-vars.el
index 44f9b76..2861a35 100644
--- a/lisp/w32-vars.el
+++ b/lisp/w32-vars.el
@@ -1,6 +1,6 @@
 ;;; w32-vars.el --- MS-Windows specific user options
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; Author: Jason Rumney <address@hidden>
 ;; Keywords: internal
diff --git a/lisp/wdired.el b/lisp/wdired.el
index 3157e88..acc62e4 100644
--- a/lisp/wdired.el
+++ b/lisp/wdired.el
@@ -1,6 +1,6 @@
 ;;; wdired.el --- Rename files editing their names in dired buffers -*- 
coding: utf-8; -*-
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Filename: wdired.el
 ;; Author: Juan León Lahoz García <address@hidden>
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index d824931..2463e65 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -1,6 +1,6 @@
 ;;; whitespace.el --- minor mode to visualize TAB, (HARD) SPACE, NEWLINE -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Vinicius Jose Latorre <address@hidden>
 ;; Maintainer: Vinicius Jose Latorre <address@hidden>
@@ -1708,7 +1708,7 @@ cleaning up these problems."
                        (setq has-bogus (memq (car option) style)))
                      t)))
              whitespace-report-list)))
-      (when (pcase report-if-bogus (`nil t) (`never nil) (_ has-bogus))
+      (when (pcase report-if-bogus ('nil t) ('never nil) (_ has-bogus))
         (whitespace-kill-buffer whitespace-report-buffer-name)
         ;; `indent-tabs-mode' may be local to current buffer
         ;; `tab-width' may be local to current buffer
diff --git a/lisp/wid-browse.el b/lisp/wid-browse.el
index d86e9cd..dbc4100 100644
--- a/lisp/wid-browse.el
+++ b/lisp/wid-browse.el
@@ -1,6 +1,6 @@
 ;;; wid-browse.el --- functions for browsing widgets
 ;;
-;; Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <address@hidden>
 ;; Keywords: extensions
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index bee7f80..52c0b5b 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -1,6 +1,6 @@
 ;;; wid-edit.el --- Functions for creating and using widgets 
-*-byte-compile-dynamic: t; lexical-binding:t -*-
 ;;
-;; Copyright (C) 1996-1997, 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 1999-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <address@hidden>
 ;; Maintainer: address@hidden
@@ -2746,7 +2746,7 @@ Return an alist of (TYPE MATCH)."
   "A widget which groups other widgets inside."
   :convert-widget 'widget-types-convert-widget
   :copy 'widget-types-copy
-  :format "%v"
+  :format ":\n%v"
   :value-create 'widget-group-value-create
   :value-get 'widget-editable-list-value-get
   :default-get 'widget-group-default-get
diff --git a/lisp/widget.el b/lisp/widget.el
index 6b1e233..4028fa1 100644
--- a/lisp/widget.el
+++ b/lisp/widget.el
@@ -1,6 +1,6 @@
 ;;; widget.el --- a library of user interface components
 ;;
-;; Copyright (C) 1996-1997, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1996-1997, 2001-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Per Abrahamsen <address@hidden>
 ;; Keywords: help, extensions, faces, hypermedia
diff --git a/lisp/windmove.el b/lisp/windmove.el
index 42e10b5..0853f7e 100644
--- a/lisp/windmove.el
+++ b/lisp/windmove.el
@@ -1,6 +1,6 @@
-;;; windmove.el --- directional window-selection routines
+;;; windmove.el --- directional window-selection routines  -*- 
lexical-binding:t -*-
 ;;
-;; Copyright (C) 1998-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1998-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Hovav Shacham (address@hidden)
 ;; Created: 17 October 1998
@@ -149,6 +149,15 @@ is inactive."
   :type 'boolean
   :group 'windmove)
 
+(defcustom windmove-create-window nil
+  "Whether movement off the edge of the frame creates a new window.
+If this variable is set to t, moving left from the leftmost window in
+a frame will create a new window on the left, and similarly for the other
+directions."
+  :type 'boolean
+  :group 'windmove
+  :version "27.1")
+
 ;; If your Emacs sometimes places an empty column between two adjacent
 ;; windows, you may wish to set this delta to 2.
 (defcustom windmove-window-distance-delta 1
@@ -159,8 +168,7 @@ placement bugs in old versions of Emacs."
   :type 'number
   :group 'windmove)
 
-
-
+
 ;; Implementation overview:
 ;;
 ;; The conceptual framework behind this code is all fairly simple.  We
@@ -459,6 +467,7 @@ movement is relative to."
                windmove-window-distance-delta))) ; (x, y1+d-1)
      (t (error "Invalid direction of movement: %s" dir)))))
 
+
 ;; Rewritten on 2013-12-13 using `window-in-direction'.  After the
 ;; pixelwise change the old approach didn't work any more.  martin
 (defun windmove-find-other-window (dir &optional arg window)
@@ -471,8 +480,15 @@ DIR, ARG, and WINDOW are handled as by 
`windmove-other-window-loc'."
 (defun windmove-do-window-select (dir &optional arg window)
   "Move to the window at direction DIR.
 DIR, ARG, and WINDOW are handled as by `windmove-other-window-loc'.
-If no window is at direction DIR, an error is signaled."
+If no window is at direction DIR, an error is signaled.
+If `windmove-create-window' is non-nil, try to create a new window
+in direction DIR instead."
   (let ((other-window (windmove-find-other-window dir arg window)))
+    (when (and windmove-create-window
+               (or (null other-window)
+                   (and (window-minibuffer-p other-window)
+                        (not (minibuffer-window-active-p other-window)))))
+      (setq other-window (split-window window nil dir)))
     (cond ((null other-window)
            (user-error "No window %s from selected window" dir))
           ((and (window-minibuffer-p other-window)
@@ -481,9 +497,9 @@ If no window is at direction DIR, an error is signaled."
           (t
            (select-window other-window)))))
 
-
-;;; end-user functions
-;; these are all simple interactive wrappers to
+
+;;; End-user functions
+;; These are all simple interactive wrappers to
 ;; `windmove-do-window-select', meant to be bound to keys.
 
 ;;;###autoload
@@ -493,9 +509,10 @@ With no prefix argument, or with prefix argument equal to 
zero,
 \"left\" is relative to the position of point in the window; otherwise
 it is relative to the top edge (for positive ARG) or the bottom edge
 \(for negative ARG) of the current window.
-If no window is at the desired location, an error is signaled."
+If no window is at the desired location, an error is signaled
+unless `windmove-create-window' is non-nil and a new window is created."
   (interactive "P")
-  (windmove-do-window-select 'left arg))
+  (windmove-do-window-select 'left (and arg (prefix-numeric-value arg))))
 
 ;;;###autoload
 (defun windmove-up (&optional arg)
@@ -504,9 +521,10 @@ With no prefix argument, or with prefix argument equal to 
zero, \"up\"
 is relative to the position of point in the window; otherwise it is
 relative to the left edge (for positive ARG) or the right edge (for
 negative ARG) of the current window.
-If no window is at the desired location, an error is signaled."
+If no window is at the desired location, an error is signaled
+unless `windmove-create-window' is non-nil and a new window is created."
   (interactive "P")
-  (windmove-do-window-select 'up arg))
+  (windmove-do-window-select 'up (and arg (prefix-numeric-value arg))))
 
 ;;;###autoload
 (defun windmove-right (&optional arg)
@@ -515,9 +533,10 @@ With no prefix argument, or with prefix argument equal to 
zero,
 \"right\" is relative to the position of point in the window;
 otherwise it is relative to the top edge (for positive ARG) or the
 bottom edge (for negative ARG) of the current window.
-If no window is at the desired location, an error is signaled."
+If no window is at the desired location, an error is signaled
+unless `windmove-create-window' is non-nil and a new window is created."
   (interactive "P")
-  (windmove-do-window-select 'right arg))
+  (windmove-do-window-select 'right (and arg (prefix-numeric-value arg))))
 
 ;;;###autoload
 (defun windmove-down (&optional arg)
@@ -526,9 +545,10 @@ With no prefix argument, or with prefix argument equal to 
zero,
 \"down\" is relative to the position of point in the window; otherwise
 it is relative to the left edge (for positive ARG) or the right edge
 \(for negative ARG) of the current window.
-If no window is at the desired location, an error is signaled."
+If no window is at the desired location, an error is signaled
+unless `windmove-create-window' is non-nil and a new window is created."
   (interactive "P")
-  (windmove-do-window-select 'down arg))
+  (windmove-do-window-select 'down (and arg (prefix-numeric-value arg))))
 
 
 ;;; set up keybindings
@@ -551,7 +571,241 @@ Default value of MODIFIERS is `shift'."
   (global-set-key (vector (append modifiers '(up)))    'windmove-up)
   (global-set-key (vector (append modifiers '(down)))  'windmove-down))
 
+
+;;; Directional window display and selection
+
+(defcustom windmove-display-no-select nil
+  "Whether the window should be selected after displaying the buffer in it."
+  :type 'boolean
+  :group 'windmove
+  :version "27.1")
+
+(defun windmove-display-in-direction (dir &optional arg)
+  "Display the next buffer in the window at direction DIR.
+The next buffer is the buffer displayed by the next command invoked
+immediately after this command (ignoring reading from the minibuffer).
+Create a new window if there is no window in that direction.
+By default, select the window with a displayed buffer.
+If prefix ARG is `C-u', reselect a previously selected window.
+If `windmove-display-no-select' is non-nil, this command doesn't
+select the window with a displayed buffer, and the meaning of
+the prefix argument is reversed.
+When `switch-to-buffer-obey-display-actions' is non-nil,
+`switch-to-buffer' commands are also supported."
+  (let* ((no-select (not (eq (consp arg) windmove-display-no-select))) ; xor
+         (old-window (or (minibuffer-selected-window) (selected-window)))
+         (new-window)
+         (minibuffer-depth (minibuffer-depth))
+         (action display-buffer-overriding-action)
+         (command this-command)
+         (clearfun (make-symbol "clear-display-buffer-overriding-action"))
+         (exitfun
+          (lambda ()
+            (setq display-buffer-overriding-action action)
+            (when (window-live-p (if no-select old-window new-window))
+              (select-window (if no-select old-window new-window)))
+            (remove-hook 'post-command-hook clearfun))))
+    (fset clearfun
+          (lambda ()
+            (unless (or
+                    ;; Remove the hook immediately
+                    ;; after exiting the minibuffer.
+                    (> (minibuffer-depth) minibuffer-depth)
+                    ;; But don't remove immediately after
+                    ;; adding the hook by the same command below.
+                    (eq this-command command))
+              (funcall exitfun))))
+    (add-hook 'post-command-hook clearfun)
+    (push (lambda (buffer alist)
+           (unless (> (minibuffer-depth) minibuffer-depth)
+             (let ((window (if (eq dir 'same-window)
+                               (selected-window)
+                              (window-in-direction
+                               dir nil nil
+                               (and arg (prefix-numeric-value arg))
+                               windmove-wrap-around)))
+                    (type 'reuse))
+                (unless window
+                  (setq window (split-window nil nil dir) type 'window))
+               (setq new-window (window--display-buffer buffer window type 
alist)))))
+          display-buffer-overriding-action)
+    (message "[display-%s]" dir)))
+
+;;;###autoload
+(defun windmove-display-left (&optional arg)
+  "Display the next buffer in window to the left of the current one.
+See the logic of the prefix ARG in `windmove-display-in-direction'."
+  (interactive "P")
+  (windmove-display-in-direction 'left arg))
+
+;;;###autoload
+(defun windmove-display-up (&optional arg)
+  "Display the next buffer in window above the current one.
+See the logic of the prefix ARG in `windmove-display-in-direction'."
+  (interactive "P")
+  (windmove-display-in-direction 'up arg))
+
+;;;###autoload
+(defun windmove-display-right (&optional arg)
+  "Display the next buffer in window to the right of the current one.
+See the logic of the prefix ARG in `windmove-display-in-direction'."
+  (interactive "P")
+  (windmove-display-in-direction 'right arg))
+
+;;;###autoload
+(defun windmove-display-down (&optional arg)
+  "Display the next buffer in window below the current one.
+See the logic of the prefix ARG in `windmove-display-in-direction'."
+  (interactive "P")
+  (windmove-display-in-direction 'down arg))
+
+;;;###autoload
+(defun windmove-display-same-window (&optional arg)
+  "Display the next buffer in the same window."
+  (interactive "P")
+  (windmove-display-in-direction 'same-window arg))
+
+;;;###autoload
+(defun windmove-display-default-keybindings (&optional modifiers)
+  "Set up keybindings for directional buffer display.
+Keys are bound to commands that display the next buffer in the specified
+direction.  Keybindings are of the form MODIFIERS-{left,right,up,down},
+where MODIFIERS is either a list of modifiers or a single modifier.
+Default value of MODIFIERS is `shift-meta'."
+  (interactive)
+  (unless modifiers (setq modifiers '(shift meta)))
+  (unless (listp modifiers) (setq modifiers (list modifiers)))
+  (global-set-key (vector (append modifiers '(left)))  'windmove-display-left)
+  (global-set-key (vector (append modifiers '(right))) 'windmove-display-right)
+  (global-set-key (vector (append modifiers '(up)))    'windmove-display-up)
+  (global-set-key (vector (append modifiers '(down)))  'windmove-display-down)
+  (global-set-key (vector (append modifiers '(?0)))    
'windmove-display-same-window))
+
+
+;;; Directional window deletion
+
+(defun windmove-delete-in-direction (dir &optional arg)
+  "Delete the window at direction DIR.
+If prefix ARG is `\\[universal-argument]', also kill the buffer in that window.
+With `M-0' prefix, delete the selected window and
+select the window at direction DIR.
+When `windmove-wrap-around' is non-nil, takes the window
+from the opposite side of the frame."
+  (let ((other-window (window-in-direction dir nil nil arg
+                                           windmove-wrap-around t)))
+    (cond ((null other-window)
+           (user-error "No window %s from selected window" dir))
+          (t
+           (when (equal arg '(4))
+             (kill-buffer (window-buffer other-window)))
+           (if (not (equal arg 0))
+               (delete-window other-window)
+             (delete-window (selected-window))
+             (select-window other-window))))))
+
+;;;###autoload
+(defun windmove-delete-left (&optional arg)
+  "Delete the window to the left of the current one.
+If prefix ARG is `C-u', delete the selected window and
+select the window that was to the left of the current one."
+  (interactive "P")
+  (windmove-delete-in-direction 'left arg))
+
+;;;###autoload
+(defun windmove-delete-up (&optional arg)
+  "Delete the window above the current one.
+If prefix ARG is `C-u', delete the selected window and
+select the window that was above the current one."
+  (interactive "P")
+  (windmove-delete-in-direction 'up arg))
+
+;;;###autoload
+(defun windmove-delete-right (&optional arg)
+  "Delete the window to the right of the current one.
+If prefix ARG is `C-u', delete the selected window and
+select the window that was to the right of the current one."
+  (interactive "P")
+  (windmove-delete-in-direction 'right arg))
+
+;;;###autoload
+(defun windmove-delete-down (&optional arg)
+  "Delete the window below the current one.
+If prefix ARG is `C-u', delete the selected window and
+select the window that was below the current one."
+  (interactive "P")
+  (windmove-delete-in-direction 'down arg))
+
+;;;###autoload
+(defun windmove-delete-default-keybindings (&optional prefix modifiers)
+  "Set up keybindings for directional window deletion.
+Keys are bound to commands that delete windows in the specified
+direction.  Keybindings are of the form PREFIX MODIFIERS-{left,right,up,down},
+where PREFIX is a prefix key and MODIFIERS is either a list of modifiers or
+a single modifier.  Default value of PREFIX is `C-x' and MODIFIERS is `shift'."
+  (interactive)
+  (unless prefix (setq prefix '(?\C-x)))
+  (unless (listp prefix) (setq prefix (list prefix)))
+  (unless modifiers (setq modifiers '(shift)))
+  (unless (listp modifiers) (setq modifiers (list modifiers)))
+  (global-set-key (vector prefix (append modifiers '(left)))  
'windmove-delete-left)
+  (global-set-key (vector prefix (append modifiers '(right))) 
'windmove-delete-right)
+  (global-set-key (vector prefix (append modifiers '(up)))    
'windmove-delete-up)
+  (global-set-key (vector prefix (append modifiers '(down)))  
'windmove-delete-down))
+
+
+;;; Directional window swap states
+
+(defun windmove-swap-states-in-direction (dir)
+  "Swap the states of the selected window and the window at direction DIR.
+When `windmove-wrap-around' is non-nil, takes the window
+from the opposite side of the frame."
+  (let ((other-window (window-in-direction dir nil nil nil
+                                           windmove-wrap-around t)))
+    (cond ((or (null other-window) (window-minibuffer-p other-window))
+           (user-error "No window %s from selected window" dir))
+          (t
+           (window-swap-states nil other-window)))))
+
+;;;###autoload
+(defun windmove-swap-states-left ()
+  "Swap the states with the window on the left from the current one."
+  (interactive)
+  (windmove-swap-states-in-direction 'left))
+
+;;;###autoload
+(defun windmove-swap-states-up ()
+  "Swap the states with the window above from the current one."
+  (interactive)
+  (windmove-swap-states-in-direction 'up))
+
+;;;###autoload
+(defun windmove-swap-states-down ()
+  "Swap the states with the window below from the current one."
+  (interactive)
+  (windmove-swap-states-in-direction 'down))
+
+;;;###autoload
+(defun windmove-swap-states-right ()
+  "Swap the states with the window on the right from the current one."
+  (interactive)
+  (windmove-swap-states-in-direction 'right))
+
+;;;###autoload
+(defun windmove-swap-states-default-keybindings (&optional modifiers)
+  "Set up keybindings for directional window swap states.
+Keys are bound to commands that swap the states of the selected window
+with the window in the specified direction.  Keybindings are of the form
+MODIFIERS-{left,right,up,down}, where MODIFIERS is either a list of modifiers
+or a single modifier.  Default value of MODIFIERS is `shift-super'."
+  (interactive)
+  (unless modifiers (setq modifiers '(shift super)))
+  (unless (listp modifiers) (setq modifiers (list modifiers)))
+  (global-set-key (vector (append modifiers '(left)))  
'windmove-swap-states-left)
+  (global-set-key (vector (append modifiers '(right))) 
'windmove-swap-states-right)
+  (global-set-key (vector (append modifiers '(up)))    
'windmove-swap-states-up)
+  (global-set-key (vector (append modifiers '(down)))  
'windmove-swap-states-down))
 
+
 (provide 'windmove)
 
 ;;; windmove.el ends here
diff --git a/lisp/window.el b/lisp/window.el
index bcd4fa2..b769be0 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1,6 +1,6 @@
 ;;; window.el --- GNU Emacs window commands aside from those written in C  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 1985, 1989, 1992-1994, 2000-2018 Free Software
+;; Copyright (C) 1985, 1989, 1992-1994, 2000-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Maintainer: address@hidden
@@ -509,11 +509,14 @@ child if WINDOW is a horizontal combination."
       (window-left-child window)
     (window-top-child window)))
 
-(defun window-combinations (window &optional horizontal)
+(defun window-combinations (window &optional horizontal ignore-fixed)
   "Return largest number of windows vertically arranged within WINDOW.
 WINDOW must be a valid window and defaults to the selected one.
 If HORIZONTAL is non-nil, return the largest number of
-windows horizontally arranged within WINDOW."
+windows horizontally arranged within WINDOW.
+
+Optional argument IGNORE-FIXED, if non-nil, means to ignore
+fixed-size windows in the calculation."
   (setq window (window-normalize-window window))
   (cond
    ((window-live-p window)
@@ -527,9 +530,10 @@ windows horizontally arranged within WINDOW."
     (let ((child (window-child window))
          (count 0))
       (while child
-       (setq count
-             (+ (window-combinations child horizontal)
-                count))
+       (unless (and ignore-fixed (window-size-fixed-p child horizontal))
+         (setq count
+               (+ (window-combinations child horizontal ignore-fixed)
+                  count)))
        (setq child (window-right child)))
       count))
    (t
@@ -538,9 +542,10 @@ windows horizontally arranged within WINDOW."
     (let ((child (window-child window))
          (count 1))
       (while child
-       (setq count
-             (max (window-combinations child horizontal)
-                  count))
+       (unless (and ignore-fixed (window-size-fixed-p child horizontal))
+         (setq count
+               (max (window-combinations child horizontal ignore-fixed)
+                    count)))
        (setq child (window-right child)))
       count))))
 
@@ -571,23 +576,25 @@ FRAME.
 
 Optional argument MINIBUF t means run FUN on FRAME's minibuffer
 window even if it isn't active.  MINIBUF nil or omitted means run
-FUN on FRAME's minibuffer window only if it's active.  In both
-cases the minibuffer window must be part of FRAME.  MINIBUF
+FUN on FRAME's minibuffer window only if it's active.  In either
+case the minibuffer window must be part of FRAME.  MINIBUF
 neither nil nor t means never run FUN on the minibuffer window.
 
 This function performs a pre-order, depth-first traversal of the
 window tree.  If FUN changes the window tree, the result is
 unpredictable."
-  (setq frame (window-normalize-frame frame))
-  (walk-window-tree-1 fun (frame-root-window frame) any)
-  (when (memq minibuf '(nil t))
+  (let ((root (frame-root-window frame))
+        (mini (minibuffer-window frame)))
+    (setq frame (window-normalize-frame frame))
+    (unless (eq root mini)
+      (walk-window-tree-1 fun root any))
     ;; Run FUN on FRAME's minibuffer window if requested.
-    (let ((minibuffer-window (minibuffer-window frame)))
-      (when (and (window-live-p minibuffer-window)
-                (eq (window-frame minibuffer-window) frame)
-                (or (eq minibuf t)
-                    (minibuffer-window-active-p minibuffer-window)))
-       (funcall fun minibuffer-window)))))
+    (when (and (window-live-p mini)
+              (eq (window-frame mini) frame)
+              (or (eq minibuf t)
+                  (and (not minibuf)
+                        (minibuffer-window-active-p mini))))
+       (funcall fun mini))))
 
 (defun walk-window-subtree (fun &optional window any)
   "Run function FUN on the subtree of windows rooted at WINDOW.
@@ -700,8 +707,7 @@ failed."
        (set-window-parameter window 'window-atom 'main))
       (set-window-parameter new 'window-atom side)
       ;; Display BUFFER in NEW and return NEW.
-      (window--display-buffer
-       buffer new 'window alist display-buffer-mark-dedicated))))
+      (window--display-buffer buffer new 'window alist))))
 
 (defun window--atom-check-1 (window)
   "Subroutine of `window--atom-check'."
@@ -958,7 +964,11 @@ and may be called only if no window on SIDE exists yet."
         ;; window and not make a new parent window unless needed.
         (window-combination-resize 'side)
         (window-combination-limit nil)
-        (window (split-window-no-error next-to nil on-side)))
+        (window (split-window-no-error next-to nil on-side))
+         (alist (if (assq 'dedicated alist)
+                    alist
+                  (cons `(dedicated . ,(or display-buffer-mark-dedicated 
'side))
+                        alist))))
     (when window
       ;; Initialize `window-side' parameter of new window to SIDE and
       ;; make that parameter persistent.
@@ -985,7 +995,7 @@ and may be called only if no window on SIDE exists yet."
       (with-current-buffer buffer
         (setq window--sides-shown t))
       ;; Install BUFFER in new window and return WINDOW.
-      (window--display-buffer buffer window 'window alist 'side))))
+      (window--display-buffer buffer window 'window alist))))
 
 (defun display-buffer-in-side-window (buffer alist)
   "Display BUFFER in a side window of the selected frame.
@@ -1019,10 +1029,7 @@ nor installs any other window parameters unless they 
have been
 explicitly provided via a `window-parameters' entry in ALIST."
   (let* ((side (or (cdr (assq 'side alist)) 'bottom))
          (slot (or (cdr (assq 'slot alist)) 0))
-         (left-or-right (memq side '(left right)))
-         ;; Softly dedicate window to BUFFER unless
-         ;; `display-buffer-mark-dedicated' already asks for it.
-         (dedicated (or display-buffer-mark-dedicated 'side)))
+         (left-or-right (memq side '(left right))))
     (cond
      ((not (memq side '(top bottom left right)))
       (error "Invalid side %s specified" side))
@@ -1055,7 +1062,11 @@ explicitly provided via a `window-parameters' entry in 
ALIST."
                  ((eq side 'bottom) 3))
                 window-sides-slots))
            (window--sides-inhibit-check t)
-          window this-window this-slot prev-window next-window
+           (alist (if (assq 'dedicated alist)
+                      alist
+                    (cons `(dedicated . ,(or display-buffer-mark-dedicated 
'side))
+                          alist)))
+           window this-window this-slot prev-window next-window
           best-window best-slot abs-slot)
 
       (cond
@@ -1113,8 +1124,7 @@ explicitly provided via a `window-parameters' entry in 
ALIST."
                 ;; Reuse `this-window'.
                  (with-current-buffer buffer
                    (setq window--sides-shown t))
-                (window--display-buffer
-                  buffer this-window 'reuse alist dedicated))
+                (window--display-buffer buffer this-window 'reuse alist))
            (and (or (not max-slots) (< slots max-slots))
                 (or (and next-window
                          ;; Make new window before `next-window'.
@@ -1131,8 +1141,7 @@ explicitly provided via a `window-parameters' entry in 
ALIST."
                   (set-window-parameter window 'window-slot slot)
                    (with-current-buffer buffer
                      (setq window--sides-shown t))
-                  (window--display-buffer
-                    buffer window 'window alist dedicated))
+                  (window--display-buffer buffer window 'window alist))
            (and best-window
                 ;; Reuse `best-window'.
                 (progn
@@ -1141,7 +1150,7 @@ explicitly provided via a `window-parameters' entry in 
ALIST."
                    (with-current-buffer buffer
                      (setq window--sides-shown t))
                    (window--display-buffer
-                   buffer best-window 'reuse alist dedicated)))))))))
+                    buffer best-window 'reuse alist)))))))))
 
 (defun window-toggle-side-windows (&optional frame)
   "Toggle display of side windows on specified FRAME.
@@ -2041,6 +2050,8 @@ doc-string of `window-resizable'."
 ;; Aliases of functions defined in window.c.
 (defalias 'window-height 'window-total-height)
 (defalias 'window-width 'window-body-width)
+(defalias 'window-pixel-width-before-size-change 'window-old-pixel-width)
+(defalias 'window-pixel-height-before-size-change 'window-old-pixel-height)
 
 (defun window-full-height-p (&optional window)
   "Return t if WINDOW is as high as its containing frame.
@@ -2742,7 +2753,7 @@ as small) as possible, but don't signal an error."
       ;; Sanitize DELTA.
       (cond
        ((<= (+ height delta) 0)
-       (setq delta (- (frame-char-height (window-frame window)) height)))
+       (setq delta (- (frame-char-height frame) height)))
        ((> delta min-delta)
        (setq delta min-delta)))
 
@@ -2757,20 +2768,19 @@ as small) as possible, but don't signal an error."
        ;; The following routine catches the case where we want to resize
        ;; a minibuffer-only frame.
        (when (resize-mini-window-internal window)
-         (window--pixel-to-total frame)
-         (run-window-configuration-change-hook frame))))))
+         (window--pixel-to-total frame))))))
 
 (defun window--resize-apply-p (frame &optional horizontal)
   "Return t when a window on FRAME shall be resized vertically.
 Optional argument HORIZONTAL non-nil means return t when a window
 shall be resized horizontally."
-(catch 'apply
+  (catch 'apply
     (walk-window-tree
      (lambda (window)
        (unless (= (window-new-pixel window)
                  (window-size window horizontal t))
         (throw 'apply t)))
-     frame t)
+     frame t t)
     nil))
 
 (defun window-resize (window delta &optional horizontal ignore pixelwise)
@@ -2856,9 +2866,7 @@ instead."
        (window--resize-siblings window delta horizontal ignore))
       (when (window--resize-apply-p frame horizontal)
        (if (window-resize-apply frame horizontal)
-           (progn
-             (window--pixel-to-total frame horizontal)
-             (run-window-configuration-change-hook frame))
+           (window--pixel-to-total frame horizontal)
          (error "Failed to apply resizing %s" window))))
      (t
       (error "Cannot resize window %s" window)))))
@@ -3373,6 +3381,12 @@ routines."
         pixel-delta
        (/ pixel-delta (frame-char-height frame)))))
 
+(defun window--resize-mini-frame (frame)
+  "Resize minibuffer-only frame FRAME."
+  (if (functionp resize-mini-frames)
+      (funcall resize-mini-frames frame)
+    (fit-frame-to-buffer frame)))
+
 (defun window--sanitize-window-sizes (horizontal)
   "Assert that all windows on selected frame are large enough.
 If necessary and possible, make sure that every window on frame
@@ -3392,7 +3406,8 @@ may happen when the FRAME is not large enough to 
accommodate it."
         (when (> delta 0)
           (if (window-resizable-p window delta horizontal nil t)
               (window-resize window delta horizontal nil t)
-            (setq value nil))))))
+            (setq value nil)))))
+     nil nil 'nomini)
     value))
 
 (defun adjust-window-trailing-edge (window delta &optional horizontal 
pixelwise)
@@ -3577,9 +3592,7 @@ move it as far as possible in the desired direction."
        ;; Don't report an error in the standard case.
        (when (window--resize-apply-p frame horizontal)
          (if (window-resize-apply frame horizontal)
-             (progn
-               (window--pixel-to-total frame horizontal)
-               (run-window-configuration-change-hook frame))
+             (window--pixel-to-total frame horizontal)
            ;; But do report an error if applying the changes fails.
            (error "Failed adjusting window %s" window))))))))
 
@@ -4110,7 +4123,6 @@ that is its frame's root window."
          ;; `delete-window-internal' has selected a window that should
          ;; not be selected, fix this here.
          (other-window -1 frame))
-       (run-window-configuration-change-hook frame)
        (window--check frame)
        ;; Always return nil.
        nil))))
@@ -4173,7 +4185,8 @@ any window whose `no-delete-other-windows' parameter is 
non-nil."
                        (and (not (window-parameter other 'window-side))
                             (window-parameter
                              other 'no-delete-other-windows)))
-               (throw 'tag nil))))
+               (throw 'tag nil)))
+           nil nil 'nomini)
           t)
         (setq main (window-main-window frame)))
        (t
@@ -4196,7 +4209,6 @@ any window whose `no-delete-other-windows' parameter is 
non-nil."
       ;; If WINDOW is the main window of its frame do nothing.
       (unless (eq window main)
        (delete-other-windows-internal window main)
-       (run-window-configuration-change-hook frame)
        (window--check frame))
       ;; Always return nil.
       nil)))
@@ -4278,7 +4290,7 @@ WINDOW must be a live window and defaults to the selected 
one."
                        (list (copy-marker start)
                              (copy-marker
                               ;; Preserve window-point-insertion-type
-                              ;; (Bug#12588).
+                              ;; (Bug#12855).
                               point window-point-insertion-type)))))
          (set-window-prev-buffers
           window (cons entry (window-prev-buffers window)))))
@@ -4691,6 +4703,8 @@ displayed there."
 BUFFER-OR-NAME may be a buffer or the name of an existing buffer
 and defaults to the current buffer.
 
+Interactively, prompt for the buffer.
+
 The following non-nil values of the optional argument FRAME
 have special meanings:
 
@@ -4707,10 +4721,26 @@ have special meanings:
 Any other value of FRAME means consider all windows on all
 frames.
 
-When a window showing BUFFER-OR-NAME is dedicated and the only
-window of its frame, that frame is deleted when there are other
-frames left."
-  (interactive "BDelete windows on (buffer):\nP")
+Interactively, FRAME is the prefix argument, so you can
+use \\[universal-argument] 0 to specify all windows only on
+the current terminal's frames.
+
+If a frame's root window shows the buffer specified by
+BUFFER-OR-NAME and is dedicated to that buffer and that frame
+does not host the active minibuffer window and there is at least
+one other frame on that frame's terminal, delete that frame.
+Otherwise, do not delete a frame's root window if it shows the
+buffer specified by BUFFER-OR-NAME and do not delete any frame's
+main window showing that buffer either.  Rather, in any such
+case, call `switch-to-prev-buffer' to show another buffer in that
+window and make sure the window is no more dedicated to its
+buffer.
+
+If the buffer specified by BUFFER-OR-NAME is shown in a
+minibuffer window, do nothing for that window.  For any window
+that does not show that buffer, remove the buffer from that
+window's lists of previous and next buffers."
+  (interactive "bDelete windows on (buffer):\nP")
   (let ((buffer (window-normalize-buffer buffer-or-name))
        ;; Handle the "inverted" meaning of the FRAME argument wrt other
        ;; `window-list-1' based function.
@@ -4893,7 +4923,7 @@ BUFFER-OR-NAME.  Optional argument FRAME is handled as by
 
 This function calls `quit-window' on all candidate windows
 showing BUFFER-OR-NAME."
-  (interactive "BQuit windows on (buffer):\nP")
+  (interactive "bQuit windows on (buffer):\nP")
   (let ((buffer (window-normalize-buffer buffer-or-name))
        ;; Handle the "inverted" meaning of the FRAME argument wrt other
        ;; `window-list-1' based function.
@@ -4904,6 +4934,24 @@ showing BUFFER-OR-NAME."
        ;; If a window doesn't show BUFFER, unrecord BUFFER in it.
        (unrecord-window-buffer window buffer)))))
 
+(defun window--combination-resizable (parent &optional horizontal)
+  "Return number of pixels recoverable from height of window PARENT.
+PARENT must be a vertical (horizontal if HORIZONTAL is non-nil)
+window combination.  The return value is the sum of the pixel
+heights of all non-fixed height child windows of PARENT divided
+by their number plus 1.  If HORIZONTAL is non-nil, return the sum
+of the pixel widths of all non-fixed width child windows of
+PARENT divided by their number plus 1."
+  (let ((sibling (window-child parent))
+       (number 0)
+       (size 0))
+    (while sibling
+      (unless (window-size-fixed-p sibling horizontal)
+       (setq number (1+ number))
+       (setq size (+ (window-size sibling horizontal t) size)))
+      (setq sibling (window-next-sibling sibling)))
+    (/ size (1+ number))))
+
 (defun split-window (&optional window size side pixelwise)
   "Make a new window adjacent to WINDOW.
 WINDOW must be a valid window and defaults to the selected one.
@@ -5041,8 +5089,7 @@ frame.  The selected window is not changed by this 
function."
                    ;; average size of a window in its combination.
                    (max (min (- parent-pixel-size
                                 (window-min-size parent horizontal nil t))
-                             (/ parent-pixel-size
-                                (1+ (window-combinations parent horizontal))))
+                             (window--combination-resizable parent horizontal))
                         (window-min-pixel-size))
                  ;; Else try to give the new window half the size
                  ;; of WINDOW (plus an eventual odd pixel).
@@ -5127,7 +5174,7 @@ frame.  The selected window is not changed by this 
function."
               (pixel-size (/ (float new-pixel-size)
                              (if new-parent old-pixel-size parent-pixel-size)))
               (new-parent 0.5)
-              (resize (/ 1.0 (1+ (window-combinations parent horizontal))))
+              (resize (/ 1.0 (1+ (window-combinations parent horizontal t))))
               (t (/ (window-normal-size window horizontal) 2.0))))
 
        (if resize
@@ -5184,7 +5231,6 @@ frame.  The selected window is not changed by this 
function."
          (unless size
             (window--sanitize-window-sizes horizontal))
 
-         (run-window-configuration-change-hook frame)
          (run-window-scroll-functions new)
          (window--check frame)
          ;; Always return the new window.
@@ -5317,11 +5363,12 @@ is non-nil)."
         (total-sum parent-size)
         failed size sub-total sub-delta sub-amount rest)
     (while sub
-      (setq number-of-children (1+ number-of-children))
-      (when (window-size-fixed-p sub horizontal)
-       (setq total-sum
-             (- total-sum (window-size sub horizontal t)))
-       (set-window-new-normal sub 'ignore))
+      (if (window-size-fixed-p sub horizontal)
+          (progn
+            (setq total-sum
+                 (- total-sum (window-size sub horizontal t)))
+           (set-window-new-normal sub 'ignore))
+        (setq number-of-children (1+ number-of-children)))
       (setq sub (window-right sub)))
 
     (setq failed t)
@@ -5346,16 +5393,16 @@ is non-nil)."
            (set-window-new-normal sub 'skip)))
        (setq sub (window-right sub))))
 
-    ;; How can we be sure that `number-of-children' is NOT zero here ?
-    (setq rest (% total-sum number-of-children))
-    ;; Fix rounding by trying to enlarge non-stuck windows by one line
-    ;; (column) until `rest' is zero.
-    (setq sub first)
-    (while (and sub (> rest 0))
-      (unless (window--resize-child-windows-skip-p window)
-       (set-window-new-pixel sub (min rest char-size) t)
-       (setq rest (- rest char-size)))
-      (setq sub (window-right sub)))
+    (when (> number-of-children 0)
+      (setq rest (% total-sum number-of-children))
+      ;; Fix rounding by trying to enlarge non-stuck windows by one line
+      ;; (column) until `rest' is zero.
+      (setq sub first)
+      (while (and sub (> rest 0))
+        (unless (window--resize-child-windows-skip-p window)
+         (set-window-new-pixel sub (min rest char-size) t)
+         (setq rest (- rest char-size)))
+        (setq sub (window-right sub))))
 
     ;; Fix rounding by trying to enlarge stuck windows by one line
     ;; (column) until `rest' equals zero.
@@ -5414,15 +5461,13 @@ window."
     (balance-windows-1 window)
     (when (window--resize-apply-p frame)
       (window-resize-apply frame)
-      (window--pixel-to-total frame)
-      (run-window-configuration-change-hook frame))
+      (window--pixel-to-total frame))
     ;; Balance horizontally.
     (window--resize-reset (window-frame window) t)
     (balance-windows-1 window t)
     (when (window--resize-apply-p frame t)
       (window-resize-apply frame t)
-      (window--pixel-to-total frame t)
-      (run-window-configuration-change-hook frame))))
+      (window--pixel-to-total frame t))))
 
 (defun window-fixed-size-p (&optional window direction)
   "Return t if WINDOW cannot be resized in DIRECTION.
@@ -5562,7 +5607,7 @@ specific buffers."
                                            (window-prev-buffers window)))))
         (head
          `(,type
-            ,@(unless (window-next-sibling window) `((last . t)))
+            ,@(unless (window-next-sibling window) '((last . t)))
             (pixel-width . ,(window-pixel-width window))
             (pixel-height . ,(window-pixel-height window))
             (total-width . ,(window-total-width window))
@@ -5889,29 +5934,34 @@ value can be also stored on disk and read back in a new 
session."
   "Put window state STATE into WINDOW.
 STATE should be the state of a window returned by an earlier
 invocation of `window-state-get'.  Optional argument WINDOW must
-specify a valid window and defaults to the selected one.  If
-WINDOW is not live, replace WINDOW by a live one before putting
-STATE into it.
+specify a valid window.  If WINDOW is not a live window,
+replace WINDOW by a new live window created on the same frame.
+If WINDOW is nil, create a new window before putting STATE into it.
 
 Optional argument IGNORE non-nil means ignore minimum window
 sizes and fixed size restrictions.  IGNORE equal `safe' means
 windows can get as small as `window-safe-min-height' and
 `window-safe-min-width'."
   (setq window-state-put-stale-windows nil)
-  (setq window (window-normalize-window window))
 
-  ;; When WINDOW is internal, reduce it to a live one to put STATE into,
-  ;; see Bug#16793.
+  ;; When WINDOW is internal or nil, reduce it to a live one,
+  ;; then create a new window on the same frame to put STATE into.
   (unless (window-live-p window)
     (let ((root window))
-      (setq window (catch 'live
-                     (walk-window-subtree
-                      (lambda (window)
-                        (when (and (window-live-p window)
-                                   (not (window-parameter window 
'window-side)))
-                          (throw 'live window)))
-                      root)))
-      (delete-other-windows-internal window root)))
+      (setq window (if root
+                       (catch 'live
+                         (walk-window-subtree
+                          (lambda (window)
+                            (when (and (window-live-p window)
+                                       (not (window-parameter
+                                             window 'window-side)))
+                              (throw 'live window)))
+                          root))
+                     (selected-window)))
+      (delete-other-windows-internal window root)
+      ;; Create a new window to replace the existing one.
+      (setq window (prog1 (split-window window)
+                     (delete-window window)))))
 
   (set-window-dedicated-p window nil)
 
@@ -6067,23 +6117,26 @@ not resized by this function."
 
 (defun display-buffer-record-window (type window buffer)
   "Record information for window used by `display-buffer'.
+WINDOW is the window used for or created by a buffer display
+action function.  BUFFER is the buffer to display.  Note that
+this function must be called before BUFFER is explicitly made
+WINDOW's buffer (although WINDOW may show BUFFER already).
+
 TYPE specifies the type of the calling operation and must be one
-of the symbols `reuse' (when WINDOW existed already and was
-reused for displaying BUFFER), `window' (when WINDOW was created
-on an already existing frame), or `frame' (when WINDOW was
-created on a new frame).  WINDOW is the window used for or created
-by the `display-buffer' routines.  BUFFER is the buffer that
-shall be displayed.
-
-This function installs or updates the quit-restore parameter of
-WINDOW.  The quit-restore parameter is a list of four elements:
-The first element is one of the symbols `window', `frame', `same' or
-`other'.  The second element is either one of the symbols `window'
-or `frame' or a list whose elements are the buffer previously
-shown in the window, that buffer's window start and window point,
-and the window's height.  The third element is the window
-selected at the time the parameter was created.  The fourth
-element is BUFFER."
+of the symbols 'reuse' (meaning that WINDOW exists already and
+will be used for displaying BUFFER), 'window' (WINDOW was created
+on an already existing frame) or 'frame' (WINDOW was created on a
+new frame).
+
+This function installs or updates the 'quit-restore' parameter of
+WINDOW.  The 'quit-restore' parameter is a list of four elements:
+The first element is one of the symbols 'window', 'frame', 'same'
+or 'other'.  The second element is either one of the symbols
+'window' or 'frame' or a list whose elements are the buffer
+previously shown in the window, that buffer's window start and
+window point, and the window's height.  The third element is the
+window selected at the time the parameter was created.  The
+fourth element is BUFFER."
   (cond
    ((eq type 'reuse)
     (if (eq (window-buffer window) buffer)
@@ -6104,7 +6157,7 @@ element is BUFFER."
         (list 'other
               ;; A quadruple of WINDOW's buffer, start, point and height.
               (list (current-buffer) (window-start window)
-                    ;; Preserve window-point-insertion-type (Bug#12588).
+                    ;; Preserve window-point-insertion-type (Bug#12855).
                     (copy-marker
                      (window-point window) window-point-insertion-type)
                     (if (window-combined-p window)
@@ -6652,7 +6705,7 @@ split."
                                   (unless (or (eq w window)
                                               (window-dedicated-p w))
                                     (throw 'done nil)))
-                                frame)
+                                frame nil 'nomini)
               t)))
         (not (window-minibuffer-p window))
         (let ((split-height-threshold 0))
@@ -6742,20 +6795,51 @@ window is larger than WINDOW."
            (/ (- (window-total-height window) (window-total-height)) 2))
         (error nil))))))
 
-(defun window--display-buffer (buffer window type &optional alist dedicated)
+(defun window--display-buffer (buffer window type &optional alist)
   "Display BUFFER in WINDOW.
-TYPE must be one of the symbols `reuse', `window' or `frame' and
-is passed unaltered to `display-buffer-record-window'.  ALIST is
-the alist argument of `display-buffer'.  Set `window-dedicated-p'
-to DEDICATED if non-nil.  Return WINDOW if BUFFER and WINDOW are
-live."
+WINDOW must be a live window chosen by a buffer display action
+function for showing BUFFER.  TYPE tells whether WINDOW existed
+already before that action function was called or is a new window
+created by that function.  ALIST is a buffer display action alist
+as compiled by `display-buffer'.
+
+TYPE must be one of the following symbols: 'reuse' (which means
+WINDOW existed before the call of `display-buffer' and may
+already show BUFFER or not), 'window' (WINDOW was created on an
+existing frame) or 'frame' (WINDOW was created on a new frame).
+TYPE is passed unaltered to `display-buffer-record-window'.
+
+Handle WINDOW's dedicated flag as follows: If WINDOW already
+shows BUFFER, leave it alone.  Otherwise, if ALIST contains a
+'dedicated' entry and WINDOW is either new or that entry's value
+equals 'side', set WINDOW's dedicated flag to the value of that
+entry.  Otherwise, if WINDOW is new and the value of
+'display-buffer-mark-dedicated' is non-nil, set WINDOW's
+dedicated flag to that value.  In any other case, reset WINDOW's
+dedicated flag to nil.
+
+Return WINDOW if BUFFER and WINDOW are live."
   (when (and (buffer-live-p buffer) (window-live-p window))
     (display-buffer-record-window type window buffer)
     (unless (eq buffer (window-buffer window))
+      ;; Unless WINDOW already shows BUFFER reset its dedicated flag.
       (set-window-dedicated-p window nil)
       (set-window-buffer window buffer))
-    (when dedicated
-      (set-window-dedicated-p window dedicated))
+    (let ((alist-dedicated (assq 'dedicated alist)))
+      ;; Maybe dedicate WINDOW to BUFFER if asked for.
+      (cond
+       ;; Don't dedicate WINDOW if it is dedicated because it shows
+       ;; BUFFER already or it is reused and is not a side window.
+       ((or (window-dedicated-p window)
+            (and (eq type 'reuse) (not (eq (cdr alist-dedicated) 'side)))))
+       ;; Otherwise, if ALIST contains a 'dedicated' entry, use that
+       ;; entry's value (which may be nil).
+       (alist-dedicated
+        (set-window-dedicated-p window (cdr alist-dedicated)))
+       ;; Otherwise, if 'display-buffer-mark-dedicated' is non-nil,
+       ;; use that.
+       (display-buffer-mark-dedicated
+        (set-window-dedicated-p window display-buffer-mark-dedicated))))
     (when (memq type '(window frame))
       (set-window-prev-buffers window nil))
     (let ((quit-restore (window-parameter window 'quit-restore))
@@ -6767,7 +6851,11 @@ live."
        ((or (eq type 'frame)
            (and (eq (car quit-restore) 'same)
                 (eq (nth 1 quit-restore) 'frame)))
-       ;; Adjust size of frame if asked for.
+       ;; A window that never showed another buffer but BUFFER ever
+        ;; since it was created on a new frame.
+        ;;
+        ;; Adjust size of frame if asked for.  We probably should do
+        ;; that only for a single window frame.
        (cond
         ((not size))
         ((consp size)
@@ -6786,7 +6874,10 @@ live."
        ((or (eq type 'window)
            (and (eq (car quit-restore) 'same)
                 (eq (nth 1 quit-restore) 'window)))
-       ;; Adjust height of window if asked for.
+       ;; A window that never showed another buffer but BUFFER ever
+        ;; since it was created on an existing frame.
+        ;;
+        ;; Adjust width and/or height of window if asked for.
        (cond
         ((not height))
         ((numberp height)
@@ -6882,31 +6973,41 @@ The actual non-nil value of this variable will be 
copied to the
   "Custom type for `display-buffer' actions.")
 
 (defvar display-buffer-overriding-action '(nil . nil)
-  "User-defined overriding action to perform to display a buffer.
-This action overrides all the other actions in the action variables
-and arguments passed to `display-buffer'.
-Value should be a cons cell (FUNCTION . ALIST), where FUNCTION is
-a function or a list of functions.  Each function should accept
-two arguments: a buffer to display and an alist similar to ALIST.
-The default value is empty.
-See `display-buffer' for details.")
+  "Overriding action for buffer display.
+This action overrides all the other actions in the action
+variables and arguments passed to `display-buffer'.  The value
+should be a cons cell (FUNCTIONS . ALIST), where FUNCTIONS is a
+function or a list of functions.  Each function should accept two
+arguments: a buffer to display and an alist similar to ALIST.
+See `display-buffer' for details.
+
+This variable is not intended for user customization.  Lisp
+programs should never set this variable permanently but may bind
+it around calls of buffer display functions like `display-buffer'
+or `pop-to-buffer'.  Since such a binding will affect any nested
+buffer display requests, this variable should be used with utmost
+care.")
 (put 'display-buffer-overriding-action 'risky-local-variable t)
 
 (defcustom display-buffer-alist nil
   "Alist of user-defined conditional actions for `display-buffer'.
-Its value takes effect before `display-buffer-base-action'
-and `display-buffer-fallback-action', but after
+Its value takes effect before processing the ACTION argument of
+`display-buffer' and before `display-buffer-base-action' and
+`display-buffer-fallback-action', but after
 `display-buffer-overriding-action', which see.
-If non-nil, this is a list of elements (CONDITION . ACTION), where:
+
+If non-nil, this is an alist of elements (CONDITION . ACTION),
+where:
 
  CONDITION is either a regexp matching buffer names, or a
   function that takes two arguments - a buffer name and the
   ACTION argument of `display-buffer' - and returns a boolean.
 
- ACTION is a cons cell (FUNCTION . ALIST), where FUNCTION is a
-  function or a list of functions.  Each such function should
-  accept two arguments: a buffer to display and an alist of the
-  same form as ALIST.  See `display-buffer' for details.
+ ACTION is a cons cell (FUNCTIONS . ALIST), where FUNCTIONS is an
+  action function or a list of action functions and ALIST is an
+  action alist.  Each such action function should accept two
+  arguments: a buffer to display and an alist of the same form as
+  ALIST.  See `display-buffer' for details.
 
 `display-buffer' scans this alist until it either finds a
 matching regular expression or the function specified by a
@@ -6926,11 +7027,12 @@ associated action to the list of actions it will try."
 This is the default action used by `display-buffer' if no other
 actions are specified or all fail, before falling back on
 `display-buffer-fallback-action'.
-It should be a cons cell (FUNCTION . ALIST), where FUNCTION is a
-function or a list of functions.  Each function should accept two
-arguments: a buffer to display and an alist similar to ALIST.
-The default value is empty.
-See `display-buffer' for details."
+
+It should be a cons cell (FUNCTIONS . ALIST), where FUNCTIONS is
+an action function or a list of action functions and ALIST is an
+action alist.  Each such action function should accept two
+arguments: a buffer to display and an alist of the same form as
+ALIST.  See `display-buffer' for details."
   :type display-buffer--action-custom-type
   :risky t
   :version "24.1"
@@ -6946,17 +7048,20 @@ See `display-buffer' for details."
      display-buffer-pop-up-frame))
   "Default fallback action for `display-buffer'.
 This is the action used by `display-buffer' if no other actions
-specified, e.g. by the user options `display-buffer-alist' or
-`display-buffer-base-action', or they all fail.  See `display-buffer'.")
+have been specified, for example, by the user options
+`display-buffer-alist' or `display-buffer-base-action', or they
+all fail.  It should never be set by programs or users.  See
+`display-buffer'.")
 (put 'display-buffer-fallback-action 'risky-local-variable t)
 
 (defun display-buffer-assq-regexp (buffer-name alist action)
   "Retrieve ALIST entry corresponding to BUFFER-NAME.
-This returns the cdr of the ALIST entry if either its key is a
-string that matches BUFFER-NAME, as reported by `string-match-p';
-or if the key is a function that returns a non-nil when called
-with 3 arguments: the ALIST key, BUFFER-NAME, and ACTION.
-ACTION should have the form of the action argument passed to `display-buffer'."
+This returns the cdr of the alist entry ALIST if either its key
+is a string that matches BUFFER-NAME, as reported by
+`string-match-p'; or if the key is a function that returns
+non-nil when called with three arguments: the ALIST key,
+BUFFER-NAME and ACTION.  ACTION should have the form of the
+action argument passed to `display-buffer'."
   (catch 'match
     (dolist (entry alist)
       (let ((key (car entry)))
@@ -6985,100 +7090,99 @@ fails, call `display-buffer-pop-up-frame'.")
 
 (defun display-buffer (buffer-or-name &optional action frame)
   "Display BUFFER-OR-NAME in some window, without selecting it.
-BUFFER-OR-NAME must be a buffer or the name of an existing
-buffer.  Return the window chosen for displaying BUFFER-OR-NAME,
-or nil if no such window is found.
-
-Optional argument ACTION, if non-nil, should specify a display
-action.  Its form is described below.
-
-Optional argument FRAME, if non-nil, acts like an additional
-ALIST entry (reusable-frames . FRAME) to the action list of ACTION,
-specifying the frame(s) to search for a window that is already
-displaying the buffer.  See `display-buffer-reuse-window'.
-
-If ACTION is non-nil, it should have the form (FUNCTION . ALIST),
-where FUNCTION is either a function or a list of functions, and
-ALIST is an arbitrary association list (alist).
-
-Each such function should accept two arguments: the buffer to
-display and an alist.  Based on those arguments, it should
-display the buffer and return the window.  If the caller is
-prepared to handle the case of not displaying the buffer
-and returning nil from `display-buffer' it should pass
-\(allow-no-window . t) as an element of the ALIST.
-
-The `display-buffer' function builds a function list and an alist
-by combining the functions and alists specified in
+BUFFER-OR-NAME must be a buffer or a string naming a live buffer.
+Return the window chosen for displaying that buffer, or nil if no
+such window is found.
+
+Optional argument ACTION, if non-nil, should specify a buffer
+display action of the form (FUNCTIONS . ALIST).  FUNCTIONS is
+either an \"action function\" or a possibly empty list of action
+functions.  ALIST is a possibly empty \"action alist\".
+
+An action function is a function that accepts two arguments: the
+buffer to display and an action alist.  Based on those arguments,
+it should try to display the buffer in a window and return that
+window.  An action alist is an association list mapping symbols
+to values.  Action functions use the action alist passed to them
+to fine-tune their behaviors.
+
+`display-buffer' builds a list of action functions and an action
+alist by combining any action functions and alists specified by
 `display-buffer-overriding-action', `display-buffer-alist', the
 ACTION argument, `display-buffer-base-action', and
 `display-buffer-fallback-action' (in order).  Then it calls each
 function in the combined function list in turn, passing the
-buffer as the first argument and the combined alist as the second
-argument, until one of the functions returns non-nil.
-
-If ACTION is nil, the function list and the alist are built using
-only the other variables mentioned above.
-
-Available action functions include:
- `display-buffer-same-window'
- `display-buffer-reuse-window'
- `display-buffer-pop-up-frame'
- `display-buffer-in-child-frame'
- `display-buffer-pop-up-window'
- `display-buffer-in-previous-window'
- `display-buffer-use-some-window'
- `display-buffer-use-some-frame'
-
-Recognized alist entries include:
-
- `inhibit-same-window' -- A non-nil value prevents the same
-                          window from being used for display.
-
- `inhibit-switch-frame' -- A non-nil value prevents any other
-                           frame from being raised or selected,
-                           even if the window is displayed there.
-
- `reusable-frames' -- Value specifies frame(s) to search for a
-                      window that already displays the buffer.
-                      See `display-buffer-reuse-window'.
-
- `pop-up-frame-parameters' -- Value specifies an alist of frame
-                              parameters to give a new frame, if
-                              one is created.
-
- `window-height' -- Value specifies either an integer (the number
-    of lines of a new window), a floating point number (the
-    fraction of a new window with respect to the height of the
-    frame's root window) or a function to be called with one
-    argument - a new window.  The function is supposed to adjust
-    the height of the window; its return value is ignored.
-    Suitable functions are `shrink-window-if-larger-than-buffer'
-    and `fit-window-to-buffer'.
-
- `window-width' -- Value specifies either an integer (the number
-    of columns of a new window), a floating point number (the
-    fraction of a new window with respect to the width of the
-    frame's root window) or a function to be called with one
-    argument - a new window.  The function is supposed to adjust
-    the width of the window; its return value is ignored.
-
- `allow-no-window' -- A non-nil value indicates readiness for the case
-    of not displaying the buffer and FUNCTION can safely return
-    a non-window value to suppress displaying.
-
- `preserve-size' -- Value should be either (t . nil) to
-    preserve the width of the window, (nil . t) to preserve its
-    height or (t . t) to preserve both.
-
- `window-parameters' -- Value specifies an alist of window
-                        parameters to give the chosen window.
-
-The ACTION argument to `display-buffer' can also have a non-nil
-and non-list value.  This means to display the buffer in a window
-other than the selected one, even if it is already displayed in
-the selected window.  If called interactively with a prefix
-argument, ACTION is t."
+buffer as the first argument and the combined action alist as the
+second argument, until one of the functions returns non-nil.
+
+Action functions and the action they try to perform are:
+ `display-buffer-same-window' -- Use the selected window.
+ `display-buffer-reuse-window' -- Use a window already showing
+    the buffer.
+ `display-buffer-in-previous-window' -- Use a window that did
+    show the buffer before.
+ `display-buffer-use-some-window' -- Use some existing window.
+ `display-buffer-pop-up-window' -- Pop up a new window.
+ `display-buffer-below-selected' -- Use or pop up a window below
+    the selected one.
+ `display-buffer-at-bottom' -- Use or pop up a window at the
+    bottom of the selected frame.
+ `display-buffer-pop-up-frame' -- Show the buffer on a new frame.
+ `display-buffer-in-child-frame' -- Show the buffer in a
+    child frame.
+ `display-buffer-no-window' -- Do not display the buffer and
+    have `display-buffer' return nil immediately.
+
+Action alist entries are:
+ 'inhibit-same-window' -- A non-nil value prevents the same
+    window from being used for display.
+ 'inhibit-switch-frame' -- A non-nil value prevents any frame
+    used for showing the buffer from being raised or selected.
+ 'reusable-frames' -- The value specifies the set of frames to
+    search for a window that already displays the buffer.
+    Possible values are nil (the selected frame), t (any live
+    frame), visible (any visible frame), 0 (any visible or
+    iconified frame) or an existing live frame.
+ 'pop-up-frame-parameters' -- The value specifies an alist of
+    frame parameters to give a new frame, if one is created.
+ 'window-height' -- The value specifies the desired height of the
+    window chosen and is either an integer (the total height of
+    the window), a floating point number (the fraction of its
+    total height with respect to the total height of the frame's
+    root window) or a function to be called with one argument -
+    the chosen window.  The function is supposed to adjust the
+    height of the window; its return value is ignored.  Suitable
+    functions are `shrink-window-if-larger-than-buffer' and
+    `fit-window-to-buffer'.
+ 'window-width' -- The value specifies the desired width of the
+    window chosen and is either an integer (the total width of
+    the window), a floating point number (the fraction of its
+    total width with respect to the width of the frame's root
+    window) or a function to be called with one argument - the
+    chosen window.  The function is supposed to adjust the width
+    of the window; its return value is ignored.
+ 'preserve-size' -- The value should be either (t . nil) to
+    preserve the width of the chosen window, (nil . t) to
+    preserve its height or (t . t) to preserve its height and
+    width in future changes of the window configuration.
+ 'window-parameters' -- The value specifies an alist of window
+    parameters to give the chosen window.
+ 'allow-no-window' -- A non-nil value means that `display-buffer'
+    may not display the buffer and return nil immediately.
+
+The entries 'window-height', 'window-width' and 'preserve-size'
+are applied only when the window used for displaying the buffer
+never showed another buffer before.
+
+The ACTION argument can also have a non-nil and non-list value.
+This means to display the buffer in a window other than the
+selected one, even if it is already displayed in the selected
+window.  If called interactively with a prefix argument, ACTION
+is t.  Non-interactive calls should always supply a list or nil.
+
+The optional third argument FRAME, if non-nil, acts like a
+\(reusable-frames . FRAME) entry appended to the action alist
+specified by the ACTION argument."
   (interactive (list (read-buffer "Display buffer: " (other-buffer))
                     (if current-prefix-arg t)))
   (let ((buffer (if (bufferp buffer-or-name)
@@ -7130,15 +7234,16 @@ on all the frames on the current terminal, skipping the 
selected
 window; if that fails, it pops up a new frame.
 This uses the function `display-buffer' as a subroutine; see
 its documentation for additional customization information."
-  (interactive "BDisplay buffer in other frame: ")
+  (interactive "bDisplay buffer in other frame: ")
   (display-buffer buffer display-buffer--other-frame-action t))
 
 ;;; `display-buffer' action functions:
 
 (defun display-buffer-use-some-frame (buffer alist)
-  "Display BUFFER in an existing frame that meets a predicate
-\(by default any frame other than the current frame).  If
-successful, return the window used; otherwise return nil.
+  "Display BUFFER in an existing frame that meets a predicate.
+The default predicate is to use any frame other than the selected
+frame.  If successful, return the window used; otherwise return
+nil.
 
 If ALIST has a non-nil `inhibit-switch-frame' entry, avoid
 raising the frame.
@@ -7151,21 +7256,19 @@ predicate.
 If ALIST has a non-nil `inhibit-same-window' entry, avoid using
 the currently selected window (only useful with a frame-predicate
 that allows the selected frame)."
-  (let* ((predicate (or (cdr (assq 'frame-predicate alist))
-                        (lambda (frame)
-                          (and
-                           (not (eq frame (selected-frame)))
-                           (not (window-dedicated-p
-                                 (or
-                                  (get-lru-window frame)
-                                  (frame-first-window frame)))))
-                          )))
+  (let* ((predicate
+          (or (cdr (assq 'frame-predicate alist))
+              (lambda (frame)
+                (and (not (eq frame (selected-frame)))
+                     (get-lru-window frame)))))
          (frame (car (filtered-frame-list predicate)))
-         (window (and frame (get-lru-window frame nil (cdr (assq 
'inhibit-same-window alist))))))
+         (window
+          (and frame
+               (get-lru-window
+                frame nil (cdr (assq 'inhibit-same-window alist))))))
     (when window
       (prog1
-          (window--display-buffer
-           buffer window 'frame alist display-buffer-mark-dedicated)
+          (window--display-buffer buffer window 'reuse alist)
         (unless (cdr (assq 'inhibit-switch-frame alist))
           (window--maybe-raise-frame frame))))))
 
@@ -7330,8 +7433,7 @@ new frame."
               (with-current-buffer buffer
                 (setq frame (funcall fun)))
               (setq window (frame-selected-window frame)))
-      (prog1 (window--display-buffer
-             buffer window 'frame alist display-buffer-mark-dedicated)
+      (prog1 (window--display-buffer buffer window 'frame alist)
        (unless (cdr (assq 'inhibit-switch-frame alist))
          (window--maybe-raise-frame frame))))))
 
@@ -7360,8 +7462,7 @@ raising the frame."
                                (window--try-to-split-window
                                 (get-lru-window frame t) alist))))
 
-      (prog1 (window--display-buffer
-             buffer window 'window alist display-buffer-mark-dedicated)
+      (prog1 (window--display-buffer buffer window 'window alist)
        (unless (cdr (assq 'inhibit-switch-frame alist))
          (window--maybe-raise-frame (window-frame window)))))))
 
@@ -7409,7 +7510,7 @@ be added to ALIST."
         (parent (or (assq 'parent-frame parameters)
                      (selected-frame)))
          (share (assq 'share-child-frame parameters))
-         share1 frame window)
+         share1 frame window type)
     (with-current-buffer buffer
       (when (frame-live-p parent)
         (catch 'frame
@@ -7422,12 +7523,14 @@ be added to ALIST."
                 (throw 'frame t))))))
 
       (if frame
-          (setq window (frame-selected-window frame))
+          (progn
+            (setq window (frame-selected-window frame))
+            (setq type 'reuse))
         (setq frame (make-frame parameters))
-        (setq window (frame-selected-window frame))))
+        (setq window (frame-selected-window frame))
+        (setq type 'frame)))
 
-    (prog1 (window--display-buffer
-           buffer window 'frame alist display-buffer-mark-dedicated)
+    (prog1 (window--display-buffer buffer window type alist)
       (unless (cdr (assq 'inhibit-switch-frame alist))
        (window--maybe-raise-frame frame)))))
 
@@ -7437,22 +7540,43 @@ If there is a window below the selected one and that 
window
 already displays BUFFER, use that window.  Otherwise, try to
 create a new window below the selected one and show BUFFER there.
 If that attempt fails as well and there is a non-dedicated window
-below the selected one, use that window."
-  (let (window)
+below the selected one, use that window.
+
+If ALIST contains a 'window-min-height' entry, this function
+ensures that the window used is or can become at least as high as
+specified by that entry's value.  Note that such an entry alone
+will not resize the window per se.  In order to do that, ALIST
+must also contain a 'window-height' entry with the same value."
+  (let ((min-height (cdr (assq 'window-min-height alist)))
+       window)
     (or (and (setq window (window-in-direction 'below))
-            (eq buffer (window-buffer window))
+             (eq buffer (window-buffer window))
+            (or (not (numberp min-height))
+                (>= (window-height window) min-height)
+                ;; 'window--display-buffer' can resize this window if
+                ;; and only if it has a 'quit-restore' parameter
+                ;; certifying that it always showed BUFFER before.
+                (let ((height (window-height window))
+                      (quit-restore (window-parameter window 'quit-restore)))
+                  (and quit-restore
+                       (eq (nth 1 quit-restore) 'window)
+                       (window-resizable-p window (- min-height height)))))
             (window--display-buffer buffer window 'reuse alist))
        (and (not (frame-parameter nil 'unsplittable))
-            (let ((split-height-threshold 0)
+             (or (not (numberp min-height))
+                (window-sizable-p nil (- min-height)))
+             (let ((split-height-threshold 0)
                   split-width-threshold)
-              (setq window (window--try-to-split-window
+               (setq window (window--try-to-split-window
                              (selected-window) alist)))
-            (window--display-buffer
-             buffer window 'window alist display-buffer-mark-dedicated))
+             (window--display-buffer buffer window 'window alist))
        (and (setq window (window-in-direction 'below))
-            (not (window-dedicated-p window))
-            (window--display-buffer
-             buffer window 'reuse alist display-buffer-mark-dedicated)))))
+             (not (window-dedicated-p window))
+            (or (not (numberp min-height))
+                ;; A window that showed another buffer before cannot
+                ;; be resized.
+                (>= (window-height window) min-height))
+            (window--display-buffer buffer window 'reuse alist)))))
 
 (defun display-buffer--maybe-at-bottom (buffer alist)
   (let ((alist (append alist `(,(if temp-buffer-resize-mode
@@ -7484,21 +7608,13 @@ selected frame."
         (setq bottom-window window))))
      nil nil 'nomini)
     (or (and bottom-window-shows-buffer
-            (window--display-buffer
-             buffer bottom-window 'reuse alist display-buffer-mark-dedicated))
-       (and (not (frame-parameter nil 'unsplittable))
-            (let (split-width-threshold)
-              (setq window (window--try-to-split-window bottom-window alist)))
-            (window--display-buffer
-             buffer window 'window alist display-buffer-mark-dedicated))
+            (window--display-buffer buffer bottom-window 'reuse alist))
        (and (not (frame-parameter nil 'unsplittable))
             (setq window (split-window-no-error (window-main-window)))
-            (window--display-buffer
-             buffer window 'window alist display-buffer-mark-dedicated))
+            (window--display-buffer buffer window 'window alist))
        (and (setq window bottom-window)
             (not (window-dedicated-p window))
-            (window--display-buffer
-             buffer window 'reuse alist display-buffer-mark-dedicated)))))
+            (window--display-buffer buffer window 'reuse alist)))))
 
 (defun display-buffer-in-previous-window (buffer alist)
   "Display BUFFER in a window previously showing it.
@@ -7547,7 +7663,8 @@ above, even if that window never showed BUFFER before."
     ;; anything we found so far.
     (when (and (setq window (cdr (assq 'previous-window alist)))
               (window-live-p window)
-              (not (window-dedicated-p window)))
+              (or (eq buffer (window-buffer window))
+                   (not (window-dedicated-p window))))
       (if (eq window (selected-window))
          (unless inhibit-same-window
            (setq second-best-window window))
@@ -7717,7 +7834,9 @@ position in the selected window.
 
 This variable is ignored if the buffer is already displayed in
 the selected window or never appeared in it before, or if
-`switch-to-buffer' calls `pop-to-buffer' to display the buffer."
+`switch-to-buffer' calls `pop-to-buffer' to display the buffer,
+or non-nil `switch-to-buffer-obey-display-actions' displays it
+in another window."
   :type '(choice
          (const :tag "Never" nil)
          (const :tag "If already displayed elsewhere" already-displayed)
@@ -7752,6 +7871,16 @@ FORCE-SAME-WINDOW is non-nil."
   :group 'windows
   :version "25.1")
 
+(defcustom switch-to-buffer-obey-display-actions nil
+  "If non-nil, `switch-to-buffer' runs `pop-to-buffer-same-window' instead.
+This means that when switching the buffer it respects display actions
+specified by `display-buffer-overriding-action', `display-buffer-alist'
+and other display related variables.  So `switch-to-buffer' will display
+the buffer in the window specified by the rules from these variables."
+  :type 'boolean
+  :group 'windows
+  :version "27.1")
+
 (defun switch-to-buffer (buffer-or-name &optional norecord force-same-window)
   "Display buffer BUFFER-OR-NAME in the selected window.
 
@@ -7784,59 +7913,83 @@ displaying it the most recently selected one.
 If optional argument FORCE-SAME-WINDOW is non-nil, the buffer
 must be displayed in the selected window when called
 non-interactively; if that is impossible, signal an error rather
-than calling `pop-to-buffer'.
+than calling `pop-to-buffer'.  It has no effect when the option
+`switch-to-buffer-obey-display-actions' is non-nil.
 
 The option `switch-to-buffer-preserve-window-point' can be used
 to make the buffer appear at its last position in the selected
 window.
 
+If the option `switch-to-buffer-obey-display-actions' is non-nil,
+run the function `pop-to-buffer-same-window' instead.
+This may display the buffer in another window as specified by
+`display-buffer-overriding-action', `display-buffer-alist' and
+other display related variables.  If this results in displaying
+the buffer in the selected window, window start and point are adjusted
+as prescribed by the option `switch-to-buffer-preserve-window-point'.
+Otherwise, these are left alone.
+
 Return the buffer switched to."
   (interactive
    (let ((force-same-window
-          (cond
-           ((window-minibuffer-p) nil)
-           ((not (eq (window-dedicated-p) t)) 'force-same-window)
-           ((pcase switch-to-buffer-in-dedicated-window
-              (`nil (user-error
-                     "Cannot switch buffers in a dedicated window"))
-              (`prompt
-               (if (y-or-n-p
-                    (format "Window is dedicated to %s; undedicate it"
-                            (window-buffer)))
-                   (progn
-                     (set-window-dedicated-p nil nil)
-                     'force-same-window)
-                 (user-error
-                  "Cannot switch buffers in a dedicated window")))
-              (`pop nil)
-              (_ (set-window-dedicated-p nil nil) 'force-same-window))))))
+          (unless switch-to-buffer-obey-display-actions
+            (cond
+             ((window-minibuffer-p) nil)
+             ((not (eq (window-dedicated-p) t)) 'force-same-window)
+             ((pcase switch-to-buffer-in-dedicated-window
+                ('nil (user-error
+                       "Cannot switch buffers in a dedicated window"))
+                ('prompt
+                 (if (y-or-n-p
+                      (format "Window is dedicated to %s; undedicate it"
+                              (window-buffer)))
+                     (progn
+                       (set-window-dedicated-p nil nil)
+                       'force-same-window)
+                   (user-error
+                    "Cannot switch buffers in a dedicated window")))
+                ('pop nil)
+                (_ (set-window-dedicated-p nil nil) 'force-same-window)))))))
      (list (read-buffer-to-switch "Switch to buffer: ") nil 
force-same-window)))
-  (let ((buffer (window-normalize-buffer-to-switch-to buffer-or-name)))
+  (let ((buffer (window-normalize-buffer-to-switch-to buffer-or-name))
+        (set-window-start-and-point (not 
switch-to-buffer-obey-display-actions)))
     (cond
      ;; Don't call set-window-buffer if it's not needed since it
      ;; might signal an error (e.g. if the window is dedicated).
-     ((eq buffer (window-buffer)))
-     ((window-minibuffer-p)
+     ((and (eq buffer (window-buffer))
+           ;; pop-to-buffer-same-window might decide to display
+           ;; the same buffer in another window
+           (not switch-to-buffer-obey-display-actions)))
+     ((and (window-minibuffer-p)
+           (not switch-to-buffer-obey-display-actions))
       (if force-same-window
           (user-error "Cannot switch buffers in minibuffer window")
         (pop-to-buffer buffer norecord)))
-     ((eq (window-dedicated-p) t)
+     ((and (eq (window-dedicated-p) t)
+           (not switch-to-buffer-obey-display-actions))
       (if force-same-window
           (user-error "Cannot switch buffers in a dedicated window")
         (pop-to-buffer buffer norecord)))
      (t
-      (let* ((entry (assq buffer (window-prev-buffers)))
-            (displayed (and (eq switch-to-buffer-preserve-window-point
-                                'already-displayed)
-                            (get-buffer-window buffer 0))))
-       (set-window-buffer nil buffer)
-       (when (and entry
-                  (or (eq switch-to-buffer-preserve-window-point t)
-                      displayed))
-         ;; Try to restore start and point of buffer in the selected
-         ;; window (Bug#4041).
-         (set-window-start (selected-window) (nth 1 entry) t)
-         (set-window-point nil (nth 2 entry))))))
+      (when switch-to-buffer-obey-display-actions
+        (let ((selected-window (selected-window)))
+          (pop-to-buffer-same-window buffer norecord)
+          (when (eq (selected-window) selected-window)
+            (setq set-window-start-and-point t))))
+
+      (when set-window-start-and-point
+        (let* ((entry (assq buffer (window-prev-buffers)))
+              (displayed (and (eq switch-to-buffer-preserve-window-point
+                                  'already-displayed)
+                              (get-buffer-window buffer 0))))
+         (set-window-buffer nil buffer)
+         (when (and entry
+                    (or (eq switch-to-buffer-preserve-window-point t)
+                        displayed))
+           ;; Try to restore start and point of buffer in the selected
+           ;; window (Bug#4041).
+           (set-window-start (selected-window) (nth 1 entry) t)
+           (set-window-point nil (nth 2 entry)))))))
 
     (unless norecord
       (select-window (selected-window)))
@@ -8090,10 +8243,13 @@ Return 0 otherwise."
 (defun fit-frame-to-buffer (&optional frame max-height min-height max-width 
min-width only)
   "Adjust size of FRAME to display the contents of its buffer exactly.
 FRAME can be any live frame and defaults to the selected one.
-Fit only if FRAME's root window is live.  MAX-HEIGHT, MIN-HEIGHT,
-MAX-WIDTH and MIN-WIDTH specify bounds on the new total size of
-FRAME's root window.  MIN-HEIGHT and MIN-WIDTH default to the values of
-`window-min-height' and `window-min-width' respectively.
+Fit only if FRAME's root window is live.
+
+MAX-HEIGHT, MIN-HEIGHT, MAX-WIDTH and MIN-WIDTH specify bounds on
+the new total size of FRAME's root window.  MIN-HEIGHT and
+MIN-WIDTH default to the values of `window-min-height' and
+`window-min-width' respectively.  These arguments are specified
+in the canonical character width and height of FRAME.
 
 If the optional argument ONLY is `vertically', resize the frame
 vertically only.  If ONLY is `horizontally', resize the frame
@@ -9327,7 +9483,6 @@ displaying that processes's buffer."
                 (set-process-window-size process (cdr size) (car size))))))))))
 
 (add-hook 'window-configuration-change-hook 'window--adjust-process-windows)
-
 
 ;; Some of these are in tutorial--default-keys, so update that if you
 ;; change these.
diff --git a/lisp/winner.el b/lisp/winner.el
index 5e13a37..7a5f0df 100644
--- a/lisp/winner.el
+++ b/lisp/winner.el
@@ -1,6 +1,6 @@
 ;;; winner.el --- Restore old window configurations
 
-;; Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1997-1998, 2001-2019 Free Software Foundation, Inc.
 
 ;; Author: Ivar Rummelhoff <address@hidden>
 ;; Created: 27 Feb 1997
diff --git a/lisp/woman.el b/lisp/woman.el
index 238a7d3..39d9b80 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -1,6 +1,6 @@
 ;;; woman.el --- browse UN*X manual pages `wo (without) man'
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Francis J. Wright <address@hidden>
 ;; Maintainer: address@hidden
@@ -2010,10 +2010,8 @@ Optional argument REDRAW, if non-nil, forces mode line 
to be updated."
 ;;   (after Man-bgproc-sentinel-advice activate)
 ;;   ;; Terminates man processing
 ;;   "Report formatting time."
-;;   (let* ((time (current-time))
-;;      (time (+ (* (- (car time) (car WoMan-Man-start-time)) 65536)
-;;               (- (cadr time) (cadr WoMan-Man-start-time)))))
-;;     (message "Man formatting done in %d seconds" time)))
+;;   (message "Man formatting done in %s seconds"
+;;            (float-time (time-since WoMan-Man-start-time))))
 
 
 ;;; Buffer handling:
@@ -2078,7 +2076,7 @@ alist in `woman-buffer-alist' and return nil."
   (char-to-string woman-escaped-escape-char)
   "Internal string representation of escaped escape characters.")
 
-(defconst woman-unpadded-space-char ?\^]
+(defconst woman-unpadded-space-char ?\^\]
   ;; An arbitrary unused control character
   "Internal character representation of unpadded space characters.")
 (defconst woman-unpadded-space-string
@@ -2626,7 +2624,7 @@ If DELETE is non-nil then delete from point."
        (t                              ; Ignore -- leave in buffer
         ;; This does not work too well, but it's only for debugging!
         (skip-chars-forward "^ \t")
-        (if (looking-at "[ \t]*\\{") (search-forward "\\}"))
+        (if (looking-at "[ \t]*{") (search-forward "}"))
         (forward-line 1))))
 
 ;; request is not used dynamically by any callees.
@@ -2638,7 +2636,7 @@ If DELETE is non-nil then delete from point."
     ;; Ignore -- leave in buffer
     ;; This does not work too well, but it's only for debugging!
     (skip-chars-forward "^ \t")
-    (if (looking-at "[ \t]*\\{") (search-forward "\\}"))
+    (if (looking-at "[ \t]*{") (search-forward "}"))
     (forward-line 1)))
 
 (defun woman0-so ()
@@ -3270,7 +3268,7 @@ If optional arg CONCAT is non-nil then join arguments."
     (while
        ;; Find font requests, paragraph macros and font escapes:
        (re-search-forward
-        "^[.'][ \t]*\\(\\(\\ft\\)\\|\\(.P\\)\\)\\|\\(\\\\f\\)" nil 1)
+        "^[.'][ \t]*\\(\\(ft\\)\\|\\(.P\\)\\)\\|\\(\\\\f\\)" nil 1)
       (let (font beg notfont fescape)
        ;; Match font indicator and leave point at end of sequence:
        (cond ((match-beginning 2)
@@ -3513,7 +3511,7 @@ The expression may be an argument in quotes."
   (let ((value (if (looking-at "[+-]") 0 (woman-parse-numeric-value)))
        op)
     (while (cond
-           ((looking-at "[+-/*%]")     ; arithmetic operators
+           ((looking-at "[+/*%-]")     ; arithmetic operators
             (forward-char)
             (setq op (intern-soft (match-string 0)))
             (setq value (funcall op value (woman-parse-numeric-value))))
diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el
index 080cd4d..e4e2dec 100644
--- a/lisp/x-dnd.el
+++ b/lisp/x-dnd.el
@@ -1,6 +1,6 @@
 ;;; x-dnd.el --- drag and drop support for X
 
-;; Copyright (C) 2004-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 ;; Author: Jan Djärv <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/lisp/xdg.el b/lisp/xdg.el
index f818324..e5a3de4 100644
--- a/lisp/xdg.el
+++ b/lisp/xdg.el
@@ -1,6 +1,6 @@
 ;;; xdg.el --- XDG specification and standard support -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Mark Oteiza <address@hidden>
 ;; Created: 27 January 2017
@@ -117,7 +117,7 @@ file:///foo/bar.jpg"
 (defun xdg--substitute-home-env (str)
   (if (file-name-absolute-p str) str
     (save-match-data
-      (and (string-match "^$HOME/" str)
+      (and (string-match "^\\$HOME/" str)
            (replace-match "~/" t nil str 0)))))
 
 (defun xdg--user-dirs-parse-line ()
diff --git a/lisp/xml.el b/lisp/xml.el
index 6ce944c..2337952 100644
--- a/lisp/xml.el
+++ b/lisp/xml.el
@@ -1,6 +1,6 @@
 ;;; xml.el --- XML parser -*- lexical-binding: t -*-
 
-;; Copyright (C) 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Emmanuel Briot  <address@hidden>
 ;; Maintainer: Mark A. Hershberger <address@hidden>
@@ -176,11 +176,11 @@ See also `xml-get-attribute-or-nil'."
 
 ;; [4] NameStartChar
 ;; See the definition of word syntax in `xml-syntax-table'.
-(defconst xml-name-start-char-re (concat "[[:word:]:_]"))
+(defconst xml-name-start-char-re "[[:word:]:_]")
 
 ;; [4a] NameChar ::= NameStartChar | "-" | "." | [0-9] | #xB7
 ;;                 | [#x0300-#x036F] | [#x203F-#x2040]
-(defconst xml-name-char-re (concat "[-0-9.[:word:]:_·̀-ͯ‿-⁀]"))
+(defconst xml-name-char-re "[[:word:]:_.0-9\u00B7\u0300-\u036F\u203F\u2040-]")
 
 ;; [5] Name     ::= NameStartChar (NameChar)*
 (defconst xml-name-re (concat xml-name-start-char-re xml-name-char-re "*"))
diff --git a/lisp/xt-mouse.el b/lisp/xt-mouse.el
index da4af32..5ff7182 100644
--- a/lisp/xt-mouse.el
+++ b/lisp/xt-mouse.el
@@ -1,6 +1,6 @@
 ;;; xt-mouse.el --- support the mouse when emacs run in an xterm -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 1994, 2000-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 2000-2019 Free Software Foundation, Inc.
 
 ;; Author: Per Abrahamsen <address@hidden>
 ;; Keywords: mouse, terminals
@@ -123,20 +123,7 @@ http://invisible-island.net/xterm/ctlseqs/ctlseqs.html)."
                      (terminal-parameter nil 'xterm-mouse-y))))
   pos)
 
-(defun xterm-mouse-truncate-wrap (f)
-  "Truncate with wrap-around."
-  (condition-case nil
-      ;; First try the built-in truncate, in case there's no overflow.
-      (truncate f)
-    ;; In case of overflow, do wraparound by hand.
-    (range-error
-     ;; In our case, we wrap around every 3 days or so, so if we assume
-     ;; a maximum of 65536 wraparounds, we're safe for a couple years.
-     ;; Using a power of 2 makes rounding errors less likely.
-     (let* ((maxwrap (* 65536 2048))
-            (dbig (truncate (/ f maxwrap)))
-            (fdiff (- f (* 1.0 maxwrap dbig))))
-       (+ (truncate fdiff) (* maxwrap dbig))))))
+(define-obsolete-function-alias 'xterm-mouse-truncate-wrap 'truncate "27.1")
 
 (defcustom xterm-mouse-utf-8 nil
   "Non-nil if UTF-8 coordinates should be used to read mouse coordinates.
@@ -256,18 +243,17 @@ which is the \"1006\" extension implemented in Xterm >= 
277."
              (y    (nth 2 click))
              ;; Emulate timestamp information.  This is accurate enough
              ;; for default value of mouse-1-click-follows-link (450msec).
-             (timestamp (xterm-mouse-truncate-wrap
-                         (* 1000
-                            (- (float-time)
-                               (or xt-mouse-epoch
-                                   (setq xt-mouse-epoch (float-time)))))))
+            (timestamp (if (not xt-mouse-epoch)
+                           (progn (setq xt-mouse-epoch (float-time)) 0)
+                         (car (encode-time (time-since xt-mouse-epoch)
+                                           1000))))
              (w (window-at x y))
              (ltrb (window-edges w))
              (left (nth 0 ltrb))
              (top (nth 1 ltrb))
              (posn (if w
-                                (posn-at-x-y (- x left) (- y top) w t)
-                              (append (list nil 'menu-bar)
+                      (posn-at-x-y (- x left) (- y top) w t)
+                    (append (list nil 'menu-bar)
                              (nthcdr 2 (posn-at-x-y x y)))))
              (event (list type posn)))
         (setcar (nthcdr 3 posn) timestamp)
diff --git a/lisp/xwidget.el b/lisp/xwidget.el
index 3bf65d0..662a854 100644
--- a/lisp/xwidget.el
+++ b/lisp/xwidget.el
@@ -1,6 +1,6 @@
 ;;; xwidget.el --- api functions for xwidgets  -*- lexical-binding: t -*-
 ;;
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 ;;
 ;; Author: Joakim Verona (address@hidden)
 ;;
diff --git a/lwlib/ChangeLog.1 b/lwlib/ChangeLog.1
index 375ab2e..e8f2210 100644
--- a/lwlib/ChangeLog.1
+++ b/lwlib/ChangeLog.1
@@ -1964,7 +1964,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1995-1999, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1995-1999, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/lwlib/Makefile.in b/lwlib/Makefile.in
index ed71270..e1d9287 100644
--- a/lwlib/Makefile.in
+++ b/lwlib/Makefile.in
@@ -1,7 +1,7 @@
 ### @configure_input@
 
 # Copyright (C) 1992, 1993 Lucid, Inc.
-# Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 #
 # This file is part of the Lucid Widget Library.
 #
diff --git a/lwlib/deps.mk b/lwlib/deps.mk
index 675832e..f5097ea 100644
--- a/lwlib/deps.mk
+++ b/lwlib/deps.mk
@@ -1,7 +1,7 @@
 ### deps.mk --- lwlib/Makefile fragment for GNU Emacs
 
 # Copyright (C) 1992, 1993 Lucid, Inc.
-# Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 #
 # This file is part of the Lucid Widget Library.
 #
diff --git a/lwlib/lwlib-Xaw.c b/lwlib/lwlib-Xaw.c
index bc1c18d..24b31fc 100644
--- a/lwlib/lwlib-Xaw.c
+++ b/lwlib/lwlib-Xaw.c
@@ -1,7 +1,7 @@
 /* The lwlib interface to Athena widgets.
 
 Copyright (C) 1993 Chuck Thompson <address@hidden>
-Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/lwlib-Xlw.c b/lwlib/lwlib-Xlw.c
index bcbc7e9..621d1e7 100644
--- a/lwlib/lwlib-Xlw.c
+++ b/lwlib/lwlib-Xlw.c
@@ -1,7 +1,7 @@
 /* The lwlib interface to "xlwmenu" menus.
 
 Copyright (C) 1992 Lucid, Inc.
-Copyright (C) 1994, 2000-2018 Free Software Foundation, Inc.
+Copyright (C) 1994, 2000-2019 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/lwlib-Xm.c b/lwlib/lwlib-Xm.c
index 43db998..b6d21a6 100644
--- a/lwlib/lwlib-Xm.c
+++ b/lwlib/lwlib-Xm.c
@@ -1,6 +1,6 @@
 /* The lwlib interface to Motif widgets.
 
-Copyright (C) 1994-1997, 1999-2018 Free Software Foundation, Inc.
+Copyright (C) 1994-1997, 1999-2019 Free Software Foundation, Inc.
 Copyright (C) 1992 Lucid, Inc.
 
 This file is part of the Lucid Widget Library.
diff --git a/lwlib/lwlib-int.h b/lwlib/lwlib-int.h
index 73c9a88..e21fa1f 100644
--- a/lwlib/lwlib-int.h
+++ b/lwlib/lwlib-int.h
@@ -1,6 +1,6 @@
 /*
 Copyright (C) 1992 Lucid, Inc.
-Copyright (C) 2000-2018 Free Software Foundation, Inc.
+Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/lwlib-utils.c b/lwlib/lwlib-utils.c
index 5e579d1..7c60bdb 100644
--- a/lwlib/lwlib-utils.c
+++ b/lwlib/lwlib-utils.c
@@ -1,7 +1,7 @@
 /* Defines some widget utility functions.
 
 Copyright (C) 1992 Lucid, Inc.
-Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/lwlib-widget.h b/lwlib/lwlib-widget.h
index 6805d68..4b842d5 100644
--- a/lwlib/lwlib-widget.h
+++ b/lwlib/lwlib-widget.h
@@ -1,6 +1,6 @@
 /*
 Copyright (C) 1992, 1993 Lucid, Inc.
-Copyright (C) 1994, 1999-2018 Free Software Foundation, Inc.
+Copyright (C) 1994, 1999-2019 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c
index 4bb5e4a..8142d92 100644
--- a/lwlib/lwlib.c
+++ b/lwlib/lwlib.c
@@ -1,7 +1,7 @@
 /* A general interface to the widgets of different toolkits.
 
 Copyright (C) 1992, 1993 Lucid, Inc.
-Copyright (C) 1994-1996, 1999-2018 Free Software Foundation, Inc.
+Copyright (C) 1994-1996, 1999-2019 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/lwlib.h b/lwlib/lwlib.h
index 41d3e01..c0f20ae 100644
--- a/lwlib/lwlib.h
+++ b/lwlib/lwlib.h
@@ -1,6 +1,6 @@
 /*
 Copyright (C) 1992, 1993 Lucid, Inc.
-Copyright (C) 1994, 1999-2018 Free Software Foundation, Inc.
+Copyright (C) 1994, 1999-2019 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/xlwmenu.c b/lwlib/xlwmenu.c
index 20a868d..07ad29e 100644
--- a/lwlib/xlwmenu.c
+++ b/lwlib/xlwmenu.c
@@ -1,7 +1,7 @@
 /* Implements a lightweight menubar widget.
 
 Copyright (C) 1992 Lucid, Inc.
-Copyright (C) 1994-1995, 1997, 1999-2018 Free Software Foundation, Inc.
+Copyright (C) 1994-1995, 1997, 1999-2019 Free Software Foundation, Inc.
 
 This file is part of the Lucid Widget Library.
 
diff --git a/lwlib/xlwmenu.h b/lwlib/xlwmenu.h
index a5cea0c..c37c83a 100644
--- a/lwlib/xlwmenu.h
+++ b/lwlib/xlwmenu.h
@@ -1,6 +1,6 @@
 /* Interface of a lightweight menubar widget.
 
-Copyright (C) 2002-2018 Free Software Foundation, Inc.
+Copyright (C) 2002-2019 Free Software Foundation, Inc.
 Copyright (C) 1992 Lucid, Inc.
 
 This file is part of the Lucid Widget Library.
diff --git a/lwlib/xlwmenuP.h b/lwlib/xlwmenuP.h
index 4f35d60..610f83a 100644
--- a/lwlib/xlwmenuP.h
+++ b/lwlib/xlwmenuP.h
@@ -1,6 +1,6 @@
 /* Internals of a lightweight menubar widget.
 
-Copyright (C) 2002-2018 Free Software Foundation, Inc.
+Copyright (C) 2002-2019 Free Software Foundation, Inc.
 Copyright (C) 1992 Lucid, Inc.
 
 This file is part of the Lucid Widget Library.
diff --git a/m4/00gnulib.m4 b/m4/00gnulib.m4
index bd24796..e3e0fb6 100644
--- a/m4/00gnulib.m4
+++ b/m4/00gnulib.m4
@@ -1,5 +1,5 @@
 # 00gnulib.m4 serial 3
-dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/__inline.m4 b/m4/__inline.m4
index 3d0c479..e1aa310 100644
--- a/m4/__inline.m4
+++ b/m4/__inline.m4
@@ -1,5 +1,5 @@
 # Test for __inline keyword
-dnl Copyright 2017-2018 Free Software Foundation, Inc.
+dnl Copyright 2017-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/absolute-header.m4 b/m4/absolute-header.m4
index 4e67e5f..a8f2cba 100644
--- a/m4/absolute-header.m4
+++ b/m4/absolute-header.m4
@@ -1,5 +1,5 @@
 # absolute-header.m4 serial 16
-dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/acl.m4 b/m4/acl.m4
index b64aa84..5234a80 100644
--- a/m4/acl.m4
+++ b/m4/acl.m4
@@ -1,7 +1,7 @@
 # acl.m4 - check for access control list (ACL) primitives
 # serial 23
 
-# Copyright (C) 2002, 2004-2018 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2004-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/alloca.m4 b/m4/alloca.m4
index b9d94e8..29bd289 100644
--- a/m4/alloca.m4
+++ b/m4/alloca.m4
@@ -1,5 +1,5 @@
-# alloca.m4 serial 14
-dnl Copyright (C) 2002-2004, 2006-2007, 2009-2018 Free Software Foundation,
+# alloca.m4 serial 15
+dnl Copyright (C) 2002-2004, 2006-2007, 2009-2019 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -37,6 +37,13 @@ AC_DEFUN([gl_FUNC_ALLOCA],
   fi
   AC_SUBST([ALLOCA_H])
   AM_CONDITIONAL([GL_GENERATE_ALLOCA_H], [test -n "$ALLOCA_H"])
+
+  if test $ac_cv_working_alloca_h = yes; then
+    HAVE_ALLOCA_H=1
+  else
+    HAVE_ALLOCA_H=0
+  fi
+  AC_SUBST([HAVE_ALLOCA_H])
 ])
 
 # Prerequisites of lib/alloca.c.
diff --git a/m4/builtin-expect.m4 b/m4/builtin-expect.m4
index a1eaf96..b65fbf8 100644
--- a/m4/builtin-expect.m4
+++ b/m4/builtin-expect.m4
@@ -1,6 +1,6 @@
 dnl Check for __builtin_expect.
 
-dnl Copyright 2016-2018 Free Software Foundation, Inc.
+dnl Copyright 2016-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/byteswap.m4 b/m4/byteswap.m4
index c64238f..05fc6cd 100644
--- a/m4/byteswap.m4
+++ b/m4/byteswap.m4
@@ -1,5 +1,5 @@
 # byteswap.m4 serial 4
-dnl Copyright (C) 2005, 2007, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/c-strtod.m4 b/m4/c-strtod.m4
deleted file mode 100644
index 9282cee..0000000
--- a/m4/c-strtod.m4
+++ /dev/null
@@ -1,76 +0,0 @@
-# c-strtod.m4 serial 16
-
-# Copyright (C) 2004-2006, 2009-2018 Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# Written by Paul Eggert.
-
-AC_DEFUN([gl_C99_STRTOLD],
-[
-  AC_CACHE_CHECK([whether strtold conforms to C99],
-    [gl_cv_func_c99_strtold],
-    [AC_LINK_IFELSE(
-       [AC_LANG_PROGRAM(
-          [[/* On HP-UX before 11.23, strtold returns a struct instead of
-                long double.  Reject implementations like that, by requiring
-                compatibility with the C99 prototype.  */
-             #include <stdlib.h>
-             static long double (*p) (char const *, char **) = strtold;
-             static long double
-             test (char const *nptr, char **endptr)
-             {
-               long double r;
-               r = strtold (nptr, endptr);
-               return r;
-             }]],
-           [[return test ("1.0", NULL) != 1 || p ("1.0", NULL) != 1;]])],
-       [gl_cv_func_c99_strtold=yes],
-       [gl_cv_func_c99_strtold=no])])
-  if test $gl_cv_func_c99_strtold = yes; then
-    AC_DEFINE([HAVE_C99_STRTOLD], [1], [Define to 1 if strtold conforms to 
C99.])
-  fi
-])
-
-dnl Prerequisites of lib/c-strtod.c.
-AC_DEFUN([gl_C_STRTOD],
-[
-  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
-  AC_CHECK_HEADERS_ONCE([xlocale.h])
-  dnl We can't use AC_CHECK_FUNC here, because strtod_l() is defined as a
-  dnl static inline function when compiling for Android 7.1 or older.
-  AC_CACHE_CHECK([for strtod_l], [gl_cv_func_strtod_l],
-    [AC_LINK_IFELSE(
-       [AC_LANG_PROGRAM(
-          [[#include <stdlib.h>
-            #include <locale.h>
-            #if HAVE_XLOCALE_H
-            # include <xlocale.h>
-            #endif
-            locale_t loc;
-          ]],
-          [[char *end;
-            return strtod_l("0",&end,loc) < 0.0;
-          ]])
-       ],
-       [gl_cv_func_strtod_l=yes],
-       [gl_cv_func_strtod_l=no])
-    ])
-  if test $gl_cv_func_strtod_l = yes; then
-    HAVE_STRTOD_L=1
-  else
-    HAVE_STRTOD_L=0
-  fi
-  AC_DEFINE_UNQUOTED([HAVE_STRTOD_L], [$HAVE_STRTOD_L],
-    [Define to 1 if the system has the 'strtod_l' function.])
-])
-
-dnl Prerequisites of lib/c-strtold.c.
-AC_DEFUN([gl_C_STRTOLD],
-[
-  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-  AC_REQUIRE([gl_C99_STRTOLD])
-  AC_CHECK_FUNCS([strtold_l])
-])
diff --git a/m4/clock_time.m4 b/m4/clock_time.m4
index 47791f9..8f7a7fc 100644
--- a/m4/clock_time.m4
+++ b/m4/clock_time.m4
@@ -1,5 +1,5 @@
 # clock_time.m4 serial 10
-dnl Copyright (C) 2002-2006, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/close-stream.m4 b/m4/close-stream.m4
index c9bf62e..5d31221 100644
--- a/m4/close-stream.m4
+++ b/m4/close-stream.m4
@@ -1,5 +1,5 @@
 #serial 4
-dnl Copyright (C) 2006-2007, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/count-leading-zeros.m4 b/m4/count-leading-zeros.m4
index 99ffdb2..efe31f9 100644
--- a/m4/count-leading-zeros.m4
+++ b/m4/count-leading-zeros.m4
@@ -1,5 +1,5 @@
 # count-leading-zeros.m4 serial 2
-dnl Copyright (C) 2012-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/count-one-bits.m4 b/m4/count-one-bits.m4
index dead235..b4721b5 100644
--- a/m4/count-one-bits.m4
+++ b/m4/count-one-bits.m4
@@ -1,5 +1,5 @@
 # count-one-bits.m4 serial 3
-dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/count-trailing-zeros.m4 b/m4/count-trailing-zeros.m4
index 2bb9767..94a8f7f 100644
--- a/m4/count-trailing-zeros.m4
+++ b/m4/count-trailing-zeros.m4
@@ -1,5 +1,5 @@
 # count-trailing-zeros.m4
-dnl Copyright (C) 2013-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2013-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/d-type.m4 b/m4/d-type.m4
index ab6463d..4ca56d6 100644
--- a/m4/d-type.m4
+++ b/m4/d-type.m4
@@ -5,7 +5,7 @@ dnl
 dnl Check whether struct dirent has a member named d_type.
 dnl
 
-# Copyright (C) 1997, 1999-2004, 2006, 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 1997, 1999-2004, 2006, 2009-2019 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/dirent_h.m4 b/m4/dirent_h.m4
index b054a92..732aa55 100644
--- a/m4/dirent_h.m4
+++ b/m4/dirent_h.m4
@@ -1,5 +1,5 @@
 # dirent_h.m4 serial 16
-dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/dirfd.m4 b/m4/dirfd.m4
index 48589b9..5c75869 100644
--- a/m4/dirfd.m4
+++ b/m4/dirfd.m4
@@ -2,7 +2,7 @@
 
 dnl Find out how to get the file descriptor associated with an open DIR*.
 
-# Copyright (C) 2001-2006, 2008-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2006, 2008-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/dup2.m4 b/m4/dup2.m4
index c785d37..b314247 100644
--- a/m4/dup2.m4
+++ b/m4/dup2.m4
@@ -1,5 +1,5 @@
 #serial 25
-dnl Copyright (C) 2002, 2005, 2007, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005, 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/eealloc.m4 b/m4/eealloc.m4
index a5a4e26..2a4b120 100644
--- a/m4/eealloc.m4
+++ b/m4/eealloc.m4
@@ -1,5 +1,5 @@
 # eealloc.m4 serial 3
-dnl Copyright (C) 2003, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/environ.m4 b/m4/environ.m4
index acee536..c1a6fa3 100644
--- a/m4/environ.m4
+++ b/m4/environ.m4
@@ -1,5 +1,5 @@
 # environ.m4 serial 7
-dnl Copyright (C) 2001-2004, 2006-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2004, 2006-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/errno_h.m4 b/m4/errno_h.m4
index 9dbdedd..2388854 100644
--- a/m4/errno_h.m4
+++ b/m4/errno_h.m4
@@ -1,9 +1,11 @@
-# errno_h.m4 serial 12
-dnl Copyright (C) 2004, 2006, 2008-2018 Free Software Foundation, Inc.
+# errno_h.m4 serial 13
+dnl Copyright (C) 2004, 2006, 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
+AC_PREREQ([2.61])
+
 AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
 [
   AC_REQUIRE([AC_PROG_CC])
@@ -129,9 +131,3 @@ yes
     AC_SUBST($1[_VALUE])
   fi
 ])
-
-dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
-dnl Remove this when we can assume autoconf >= 2.61.
-m4_ifdef([AC_COMPUTE_INT], [], [
-  AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
-])
diff --git a/m4/euidaccess.m4 b/m4/euidaccess.m4
index 8a56282..8e840e6 100644
--- a/m4/euidaccess.m4
+++ b/m4/euidaccess.m4
@@ -1,5 +1,5 @@
 # euidaccess.m4 serial 15
-dnl Copyright (C) 2002-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/execinfo.m4 b/m4/execinfo.m4
index c39231d..b291c0a 100644
--- a/m4/execinfo.m4
+++ b/m4/execinfo.m4
@@ -1,6 +1,6 @@
 # Check for GNU-style execinfo.h.
 
-dnl Copyright 2012-2018 Free Software Foundation, Inc.
+dnl Copyright 2012-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/explicit_bzero.m4 b/m4/explicit_bzero.m4
index ba0eefe..1357b59 100644
--- a/m4/explicit_bzero.m4
+++ b/m4/explicit_bzero.m4
@@ -1,4 +1,4 @@
-dnl Copyright 2017-2018 Free Software Foundation, Inc.
+dnl Copyright 2017-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/extensions.m4 b/m4/extensions.m4
index 71a854f..fd1ce81 100644
--- a/m4/extensions.m4
+++ b/m4/extensions.m4
@@ -1,7 +1,7 @@
 # serial 18  -*- Autoconf -*-
 # Enable extensions on systems that normally disable them.
 
-# Copyright (C) 2003, 2006-2018 Free Software Foundation, Inc.
+# Copyright (C) 2003, 2006-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4
index 3661cbd..ec9f221 100644
--- a/m4/extern-inline.m4
+++ b/m4/extern-inline.m4
@@ -1,6 +1,6 @@
 dnl 'extern inline' a la ISO C99.
 
-dnl Copyright 2012-2018 Free Software Foundation, Inc.
+dnl Copyright 2012-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/faccessat.m4 b/m4/faccessat.m4
index eb6df9a..6c7d79b 100644
--- a/m4/faccessat.m4
+++ b/m4/faccessat.m4
@@ -1,7 +1,7 @@
 # serial 8
 # See if we need to provide faccessat replacement.
 
-dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/fcntl.m4 b/m4/fcntl.m4
index 46b2445..e409e96 100644
--- a/m4/fcntl.m4
+++ b/m4/fcntl.m4
@@ -1,5 +1,5 @@
 # fcntl.m4 serial 9
-dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4
index 9fd3ab1..a86fdae 100644
--- a/m4/fcntl_h.m4
+++ b/m4/fcntl_h.m4
@@ -1,6 +1,6 @@
 # serial 15
 # Configure fcntl.h.
-dnl Copyright (C) 2006-2007, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/fdatasync.m4 b/m4/fdatasync.m4
deleted file mode 100644
index fd8e432..0000000
--- a/m4/fdatasync.m4
+++ /dev/null
@@ -1,32 +0,0 @@
-# fdatasync.m4 serial 4
-dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-AC_DEFUN([gl_FUNC_FDATASYNC],
-[
-  AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
-
-  dnl Using AC_CHECK_FUNCS_ONCE would break our subsequent AC_SEARCH_LIBS
-  AC_CHECK_DECLS_ONCE([fdatasync])
-  LIB_FDATASYNC=
-  AC_SUBST([LIB_FDATASYNC])
-
-  if test $ac_cv_have_decl_fdatasync = no; then
-    HAVE_DECL_FDATASYNC=0
-    dnl Mac OS X 10.7 has fdatasync but does not declare it.
-    AC_CHECK_FUNCS([fdatasync])
-    if test $ac_cv_func_fdatasync = no; then
-      HAVE_FDATASYNC=0
-    fi
-  else
-    dnl Solaris <= 2.6 has fdatasync() in libposix4.
-    dnl Solaris 7..10 has it in librt.
-    gl_saved_libs=$LIBS
-    AC_SEARCH_LIBS([fdatasync], [rt posix4],
-                   [test "$ac_cv_search_fdatasync" = "none required" ||
-                    LIB_FDATASYNC=$ac_cv_search_fdatasync])
-    LIBS=$gl_saved_libs
-  fi
-])
diff --git a/m4/fdopendir.m4 b/m4/fdopendir.m4
index df44d5e..b2b3b03 100644
--- a/m4/fdopendir.m4
+++ b/m4/fdopendir.m4
@@ -1,7 +1,7 @@
-# serial 10
+# serial 11
 # See if we need to provide fdopendir.
 
-dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -45,10 +45,12 @@ DIR *fdopendir (int);
          [gl_cv_func_fdopendir_works=yes],
          [gl_cv_func_fdopendir_works=no],
          [case "$host_os" in
-                    # Guess yes on glibc systems.
-            *-gnu*) gl_cv_func_fdopendir_works="guessing yes" ;;
-                    # If we don't know, assume the worst.
-            *)      gl_cv_func_fdopendir_works="guessing no" ;;
+                     # Guess yes on glibc systems.
+            *-gnu*)  gl_cv_func_fdopendir_works="guessing yes" ;;
+                     # Guess yes on musl systems.
+            *-musl*) gl_cv_func_fdopendir_works="guessing yes" ;;
+                     # If we don't know, assume the worst.
+            *)       gl_cv_func_fdopendir_works="guessing no" ;;
           esac
          ])])
     case "$gl_cv_func_fdopendir_works" in
diff --git a/m4/filemode.m4 b/m4/filemode.m4
index dd649a4..c086c68 100644
--- a/m4/filemode.m4
+++ b/m4/filemode.m4
@@ -1,5 +1,5 @@
 # filemode.m4 serial 8
-dnl Copyright (C) 2002, 2005-2006, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2006, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/flexmember.m4 b/m4/flexmember.m4
index db93cf3..1347068 100644
--- a/m4/flexmember.m4
+++ b/m4/flexmember.m4
@@ -1,7 +1,7 @@
 # serial 5
 # Check for flexible array member support.
 
-# Copyright (C) 2006, 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2009-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/fpending.m4 b/m4/fpending.m4
index c897073..402ec40 100644
--- a/m4/fpending.m4
+++ b/m4/fpending.m4
@@ -1,6 +1,6 @@
 # serial 22
 
-# Copyright (C) 2000-2001, 2004-2018 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2004-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/fpieee.m4 b/m4/fpieee.m4
index b58840f..ea1d5da 100644
--- a/m4/fpieee.m4
+++ b/m4/fpieee.m4
@@ -1,5 +1,5 @@
 # fpieee.m4 serial 2  -*- coding: utf-8 -*-
-dnl Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/fstatat.m4 b/m4/fstatat.m4
index ac353bf..489a55a 100644
--- a/m4/fstatat.m4
+++ b/m4/fstatat.m4
@@ -1,5 +1,5 @@
 # fstatat.m4 serial 4
-dnl Copyright (C) 2004-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2004-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/fsusage.m4 b/m4/fsusage.m4
index aab4024..a283f64 100644
--- a/m4/fsusage.m4
+++ b/m4/fsusage.m4
@@ -1,7 +1,7 @@
-# serial 33
+# serial 34
 # Obtaining file system usage information.
 
-# Copyright (C) 1997-1998, 2000-2001, 2003-2018 Free Software Foundation, Inc.
+# Copyright (C) 1997-1998, 2000-2001, 2003-2019 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -199,14 +199,14 @@ int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 
32 ? -1 : 1];
       ac_fsusage_space=yes
       AC_DEFINE([STAT_STATFS2_BSIZE], [1],
         [Define if statfs takes 2 args and struct statfs has a field named 
f_bsize.
-         (4.3BSD, SunOS 4, HP-UX, AIX PS/2)])
+         (4.3BSD, SunOS 4, HP-UX)])
     fi
   fi
 
   if test $ac_fsusage_space = no; then
     # SVR3
     # (Solaris already handled above.)
-    AC_CACHE_CHECK([for four-argument statfs (AIX-3.2.5, SVR3)],
+    AC_CACHE_CHECK([for four-argument statfs (SVR3)],
       [fu_cv_sys_stat_statfs4],
       [AC_RUN_IFELSE([AC_LANG_SOURCE([[
 #include <sys/types.h>
@@ -224,7 +224,7 @@ int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 
32 ? -1 : 1];
     if test $fu_cv_sys_stat_statfs4 = yes; then
       ac_fsusage_space=yes
       AC_DEFINE([STAT_STATFS4], [1],
-        [Define if statfs takes 4 args.  (SVR3, Dynix, old Irix, old AIX, 
Dolphin)])
+        [Define if statfs takes 4 args.  (SVR3, old Irix)])
     fi
   fi
 
@@ -263,41 +263,6 @@ int check_f_blocks_size[sizeof fsd.f_blocks * CHAR_BIT <= 
32 ? -1 : 1];
     fi
   fi
 
-  if test $ac_fsusage_space = no; then
-    # Ultrix
-    AC_CACHE_CHECK([for two-argument statfs with struct fs_data (Ultrix)],
-      [fu_cv_sys_stat_fs_data],
-      [AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <sys/types.h>
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#ifdef HAVE_SYS_MOUNT_H
-#include <sys/mount.h>
-#endif
-#ifdef HAVE_SYS_FS_TYPES_H
-#include <sys/fs_types.h>
-#endif
-  int
-  main ()
-  {
-    struct fs_data fsd;
-    /* Ultrix's statfs returns 1 for success,
-       0 for not mounted, -1 for failure.  */
-    return statfs (".", &fsd) != 1;
-  }]])],
-         [fu_cv_sys_stat_fs_data=yes],
-         [fu_cv_sys_stat_fs_data=no],
-         [fu_cv_sys_stat_fs_data=no])
-      ])
-    if test $fu_cv_sys_stat_fs_data = yes; then
-      ac_fsusage_space=yes
-      AC_DEFINE([STAT_STATFS2_FS_DATA], [1],
-        [Define if statfs takes 2 args and the second argument has
-         type struct fs_data.  (Ultrix)])
-    fi
-  fi
-
   AS_IF([test $ac_fsusage_space = yes], [$1], [$2])
 
 ])
@@ -337,6 +302,6 @@ choke -- this is a workaround for a Sun-specific problem
 # Prerequisites of lib/fsusage.c not done by gl_FILE_SYSTEM_USAGE.
 AC_DEFUN([gl_PREREQ_FSUSAGE_EXTRA],
 [
-  AC_CHECK_HEADERS([dustat.h sys/fs/s5param.h sys/statfs.h])
+  AC_CHECK_HEADERS([sys/fs/s5param.h sys/statfs.h])
   gl_STATFS_TRUNCATES
 ])
diff --git a/m4/fsync.m4 b/m4/fsync.m4
index d7fa8cc..1b94a25 100644
--- a/m4/fsync.m4
+++ b/m4/fsync.m4
@@ -1,5 +1,5 @@
 # fsync.m4 serial 2
-dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/getdtablesize.m4 b/m4/getdtablesize.m4
index 4cc1a8f..96aa241 100644
--- a/m4/getdtablesize.m4
+++ b/m4/getdtablesize.m4
@@ -1,5 +1,5 @@
 # getdtablesize.m4 serial 7
-dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/getgroups.m4 b/m4/getgroups.m4
index d382402..c93447b 100644
--- a/m4/getgroups.m4
+++ b/m4/getgroups.m4
@@ -1,9 +1,9 @@
-# serial 20
+# serial 22
 
 dnl From Jim Meyering.
 dnl A wrapper around AC_FUNC_GETGROUPS.
 
-# Copyright (C) 1996-1997, 1999-2004, 2008-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-1997, 1999-2004, 2008-2019 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -34,7 +34,7 @@ AC_DEFUN([AC_FUNC_GETGROUPS],
       [AC_RUN_IFELSE(
          [AC_LANG_PROGRAM(
             [AC_INCLUDES_DEFAULT],
-            [[/* On Ultrix 4.3, getgroups (0, 0) always fails.  */
+            [[/* On NeXTstep 3.2, getgroups (0, 0) always fails.  */
               return getgroups (0, 0) == -1;]])
          ],
          [ac_cv_func_getgroups_works=yes],
@@ -42,6 +42,8 @@ AC_DEFUN([AC_FUNC_GETGROUPS],
          [case "$host_os" in # ((
                            # Guess yes on glibc systems.
             *-gnu* | gnu*) ac_cv_func_getgroups_works="guessing yes" ;;
+                           # Guess yes on musl systems.
+            *-musl*)       ac_cv_func_getgroups_works="guessing yes" ;;
                            # If we don't know, assume the worst.
             *)             ac_cv_func_getgroups_works="guessing no" ;;
           esac
@@ -95,6 +97,8 @@ AC_DEFUN([gl_FUNC_GETGROUPS],
           [case "$host_os" in
                             # Guess yes on glibc systems.
              *-gnu* | gnu*) gl_cv_func_getgroups_works="guessing yes" ;;
+                            # Guess yes on musl systems.
+             *-musl*)       gl_cv_func_getgroups_works="guessing yes" ;;
                             # If we don't know, assume the worst.
              *)             gl_cv_func_getgroups_works="guessing no" ;;
            esac
diff --git a/m4/getloadavg.m4 b/m4/getloadavg.m4
index c9f5a6d..333ced7 100644
--- a/m4/getloadavg.m4
+++ b/m4/getloadavg.m4
@@ -1,6 +1,6 @@
 # Check for getloadavg.
 
-# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2018 Free Software
+# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2019 Free Software
 # Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
diff --git a/m4/getopt.m4 b/m4/getopt.m4
index 0496250..5991bf8 100644
--- a/m4/getopt.m4
+++ b/m4/getopt.m4
@@ -1,5 +1,5 @@
 # getopt.m4 serial 46
-dnl Copyright (C) 2002-2006, 2008-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/gettime.m4 b/m4/gettime.m4
index 671b70d..60d8ea1 100644
--- a/m4/gettime.m4
+++ b/m4/gettime.m4
@@ -1,5 +1,5 @@
 # gettime.m4 serial 9
-dnl Copyright (C) 2002, 2004-2006, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004-2006, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4
index 198695e..5e2ef6f 100644
--- a/m4/gettimeofday.m4
+++ b/m4/gettimeofday.m4
@@ -1,6 +1,6 @@
-# serial 25
+# serial 26
 
-# Copyright (C) 2001-2003, 2005, 2007, 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2003, 2005, 2007, 2009-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -105,6 +105,8 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
       case "$host_os" in
                        # Guess all is fine on glibc systems.
         *-gnu* | gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;;
+                       # Guess all is fine on musl systems.
+        *-musl*)       gl_cv_func_gettimeofday_clobber="guessing no" ;;
                        # Guess no on native Windows.
         mingw*)        gl_cv_func_gettimeofday_clobber="guessing no" ;;
                        # If we don't know, assume the worst.
diff --git a/m4/glibc21.m4 b/m4/glibc21.m4
index 126aa1a..0ab0f23 100644
--- a/m4/glibc21.m4
+++ b/m4/glibc21.m4
@@ -1,5 +1,5 @@
 # glibc21.m4 serial 5
-dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2018 Free Software Foundation,
+dnl Copyright (C) 2000-2002, 2004, 2008, 2010-2019 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 5f07855..57b94ed 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -1,9 +1,11 @@
-# gnulib-common.m4 serial 39
-dnl Copyright (C) 2007-2018 Free Software Foundation, Inc.
+# gnulib-common.m4 serial 44
+dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
+AC_PREREQ([2.62])
+
 # gl_COMMON
 # is expanded unconditionally through gnulib-tool magic.
 AC_DEFUN([gl_COMMON], [
@@ -14,12 +16,18 @@ AC_DEFUN([gl_COMMON], [
 AC_DEFUN([gl_COMMON_BODY], [
   AH_VERBATIM([_Noreturn],
 [/* The _Noreturn keyword of C11.  */
-#if ! (defined _Noreturn \
-       || (defined __STDC_VERSION__ && 201112 <= __STDC_VERSION__))
-# if (3 <= __GNUC__ || (__GNUC__ == 2 && 8 <= __GNUC_MINOR__) \
-      || 0x5110 <= __SUNPRO_C)
+#ifndef _Noreturn
+# if (defined __cplusplus \
+      && ((201103 <= __cplusplus && !(__GNUC__ == 4 && __GNUC_MINOR__ == 7)) \
+          || (defined _MSC_VER && 1900 <= _MSC_VER)))
+#  define _Noreturn [[noreturn]]
+# elif ((!defined __cplusplus || defined __clang__) \
+        && (201112 <= (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0)  \
+            || 4 < __GNUC__ + (7 <= __GNUC_MINOR__)))
+   /* _Noreturn works as-is.  */
+# elif 2 < __GNUC__ + (8 <= __GNUC_MINOR__) || 0x5110 <= __SUNPRO_C
 #  define _Noreturn __attribute__ ((__noreturn__))
-# elif defined _MSC_VER && 1200 <= _MSC_VER
+# elif 1200 <= (defined _MSC_VER ? _MSC_VER : 0)
 #  define _Noreturn __declspec (noreturn)
 # else
 #  define _Noreturn
@@ -80,6 +88,33 @@ AC_DEFUN([gl_COMMON_BODY], [
 # define _GL_ATTRIBUTE_MALLOC /* empty */
 #endif
 ])
+  AH_VERBATIM([async_safe],
+[/* The _GL_ASYNC_SAFE marker should be attached to functions that are
+   signal handlers (for signals other than SIGABRT, SIGPIPE) or can be
+   invoked from such signal handlers.  Such functions have some restrictions:
+     * All functions that it calls should be marked _GL_ASYNC_SAFE as well,
+       or should be listed as async-signal-safe in POSIX
+       
<http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04>
+       section 2.4.3.  Note that malloc(), sprintf(), and fwrite(), in
+       particular, are NOT async-signal-safe.
+     * All memory locations (variables and struct fields) that these functions
+       access must be marked 'volatile'.  This holds for both read and write
+       accesses.  Otherwise the compiler might optimize away stores to and
+       reads from such locations that occur in the program, depending on its
+       data flow analysis.  For example, when the program contains a loop
+       that is intended to inspect a variable set from within a signal handler
+           while (!signal_occurred)
+             ;
+       the compiler is allowed to transform this into an endless loop if the
+       variable 'signal_occurred' is not declared 'volatile'.
+   Additionally, recall that:
+     * A signal handler should not modify errno (except if it is a handler
+       for a fatal signal and ends by raising the same signal again, thus
+       provoking the termination of the process).  If it invokes a function
+       that may clobber errno, it needs to save and restore the value of
+       errno.  */
+#define _GL_ASYNC_SAFE
+])
   dnl Preparation for running test programs:
   dnl Tell glibc to write diagnostics from -D_FORTIFY_SOURCE=2 to stderr, not
   dnl to /dev/tty, so they can be redirected to log files.  Such diagnostics
@@ -214,13 +249,6 @@ AC_DEFUN([gl_FEATURES_H],
   AC_SUBST([HAVE_FEATURES_H])
 ])
 
-# m4_foreach_w
-# is a backport of autoconf-2.59c's m4_foreach_w.
-# Remove this macro when we can assume autoconf >= 2.60.
-m4_ifndef([m4_foreach_w],
-  [m4_define([m4_foreach_w],
-    [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
-
 # AS_VAR_IF(VAR, VALUE, [IF-MATCH], [IF-NOT-MATCH])
 # ----------------------------------------------------
 # Backport of autoconf-2.63b's macro.
@@ -233,7 +261,6 @@ m4_ifndef([AS_VAR_IF],
 # Modifies the value of the shell variable CC in an attempt to make $CC
 # understand ISO C99 source code.
 # This is like AC_PROG_CC_C99, except that
-# - AC_PROG_CC_C99 did not exist in Autoconf versions < 2.60,
 # - AC_PROG_CC_C99 does not mix well with AC_PROG_CC_STDC
 #   <https://lists.gnu.org/r/bug-gnulib/2011-09/msg00367.html>,
 #   but many more packages use AC_PROG_CC_STDC than AC_PROG_CC_C99
@@ -322,25 +349,6 @@ Amsterdam
   AC_SUBST([RANLIB])
 ])
 
-# AC_PROG_MKDIR_P
-# is a backport of autoconf-2.60's AC_PROG_MKDIR_P, with a fix
-# for interoperability with automake-1.9.6 from autoconf-2.62.
-# Remove this macro when we can assume autoconf >= 2.62 or
-# autoconf >= 2.60 && automake >= 1.10.
-# AC_AUTOCONF_VERSION was introduced in 2.62, so use that as the witness.
-m4_ifndef([AC_AUTOCONF_VERSION],[
-m4_ifdef([AC_PROG_MKDIR_P], [
-  dnl For automake-1.9.6 && autoconf < 2.62: Ensure MKDIR_P is AC_SUBSTed.
-  m4_define([AC_PROG_MKDIR_P],
-    m4_defn([AC_PROG_MKDIR_P])[
-    AC_SUBST([MKDIR_P])])], [
-  dnl For autoconf < 2.60: Backport of AC_PROG_MKDIR_P.
-  AC_DEFUN_ONCE([AC_PROG_MKDIR_P],
-    [AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
-     MKDIR_P='$(mkdir_p)'
-     AC_SUBST([MKDIR_P])])])
-])
-
 # AC_C_RESTRICT
 # This definition is copied from post-2.69 Autoconf and overrides the
 # AC_C_RESTRICT macro from autoconf 2.60..2.69.  It can be removed
@@ -414,61 +422,3 @@ AC_DEFUN([gl_CACHE_VAL_SILENT],
 # AS_VAR_COPY was added in autoconf 2.63b
 m4_define_default([AS_VAR_COPY],
 [AS_LITERAL_IF([$1[]$2], [$1=$$2], [eval $1=\$$2])])
-
-# AC_PROG_SED was added in autoconf 2.59b
-m4_ifndef([AC_PROG_SED],
-[AC_DEFUN([AC_PROG_SED],
-[AC_CACHE_CHECK([for a sed that does not truncate output], ac_cv_path_SED,
-    [dnl ac_script should not contain more than 99 commands (for HP-UX sed),
-     dnl but more than about 7000 bytes, to catch a limit in Solaris 8 
/usr/ucb/sed.
-     
ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
-     for ac_i in 1 2 3 4 5 6 7; do
-       ac_script="$ac_script$as_nl$ac_script"
-     done
-     echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
-     AS_UNSET([ac_script])
-     if test -z "$SED"; then
-       ac_path_SED_found=false
-       _AS_PATH_WALK([], [
-         for ac_prog in sed gsed; do
-           for ac_exec_ext in '' $ac_executable_extensions; do
-             ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
-             AS_EXECUTABLE_P(["$ac_path_SED"]) || continue
-             case `"$ac_path_SED" --version 2>&1` in
-               *GNU*) ac_cv_path_SED=$ac_path_SED ac_path_SED_found=:;;
-               *)
-                 ac_count=0
-                 _AS_ECHO_N([0123456789]) >conftest.in
-                 while :
-                 do
-                   cat conftest.in conftest.in >conftest.tmp
-                   mv conftest.tmp conftest.in
-                   cp conftest.in conftest.nl
-                   echo >> conftest.nl
-                   "$ac_path_SED" -f conftest.sed <conftest.nl >conftest.out 
2>/dev/null || break
-                   diff conftest.out conftest.nl >/dev/null 2>&1 || break
-                   ac_count=`expr $ac_count + 1`
-                   if test $ac_count -gt ${ac_path_SED_max-0}; then
-                     # Best so far, but keep looking for better
-                     ac_cv_path_SED=$ac_path_SED
-                     ac_path_SED_max=$ac_count
-                   fi
-                   test $ac_count -gt 10 && break
-                 done
-                 rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-             esac
-             $ac_path_SED_found && break 3
-           done
-         done])
-       if test -z "$ac_cv_path_SED"; then
-         AC_ERROR([no acceptable sed could be found in \$PATH])
-       fi
-     else
-       ac_cv_path_SED=$SED
-     fi
-    ])
- SED="$ac_cv_path_SED"
- AC_SUBST([SED])dnl
- rm -f conftest.sed
-])
-])
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 74f2817..f25a0e4 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -1,5 +1,5 @@
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
-# Copyright (C) 2002-2018 Free Software Foundation, Inc.
+# Copyright (C) 2002-2019 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -81,7 +81,6 @@ AC_DEFUN([gl_EARLY],
   # Code from module faccessat:
   # Code from module fcntl:
   # Code from module fcntl-h:
-  # Code from module fdatasync:
   # Code from module fdopendir:
   # Code from module filemode:
   # Code from module filevercmp:
@@ -210,7 +209,6 @@ AC_DEFUN([gl_INIT],
   gl_SHA512
   gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE
   gl_DIRENT_H
-  AC_REQUIRE([gl_C99_STRTOLD])
   gl_FUNC_DUP2
   if test $HAVE_DUP2 = 0 || test $REPLACE_DUP2 = 1; then
     AC_LIBOBJ([dup2])
@@ -241,11 +239,6 @@ AC_DEFUN([gl_INIT],
   fi
   gl_FCNTL_MODULE_INDICATOR([fcntl])
   gl_FCNTL_H
-  gl_FUNC_FDATASYNC
-  if test $HAVE_FDATASYNC = 0; then
-    AC_LIBOBJ([fdatasync])
-  fi
-  gl_UNISTD_MODULE_INDICATOR([fdatasync])
   gl_FUNC_FDOPENDIR
   if test $HAVE_FDOPENDIR = 0 || test $REPLACE_FDOPENDIR = 1; then
     AC_LIBOBJ([fdopendir])
@@ -436,7 +429,6 @@ AC_DEFUN([gl_INIT],
   gl_gnulib_enabled_37f71b604aa9c54446783d80f42fe547=false
   gl_gnulib_enabled_cloexec=false
   gl_gnulib_enabled_dirfd=false
-  gl_gnulib_enabled_dosname=false
   gl_gnulib_enabled_euidaccess=false
   gl_gnulib_enabled_getdtablesize=false
   gl_gnulib_enabled_getgroups=false
@@ -485,12 +477,6 @@ AC_DEFUN([gl_INIT],
       gl_gnulib_enabled_dirfd=true
     fi
   }
-  func_gl_gnulib_m4code_dosname ()
-  {
-    if ! $gl_gnulib_enabled_dosname; then
-      gl_gnulib_enabled_dosname=true
-    fi
-  }
   func_gl_gnulib_m4code_euidaccess ()
   {
     if ! $gl_gnulib_enabled_euidaccess; then
@@ -631,9 +617,6 @@ AC_DEFUN([gl_INIT],
     func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b
   fi
   if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
-    func_gl_gnulib_m4code_dosname
-  fi
-  if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
     func_gl_gnulib_m4code_euidaccess
   fi
   if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
@@ -652,9 +635,6 @@ AC_DEFUN([gl_INIT],
     func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b
   fi
   if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then
-    func_gl_gnulib_m4code_dosname
-  fi
-  if test $HAVE_FSTATAT = 0 || test $REPLACE_FSTATAT = 1; then
     func_gl_gnulib_m4code_03e0aaad4cb89ca757653bd367a6ccb7
   fi
   if test $REPLACE_GETOPT = 1; then
@@ -663,16 +643,13 @@ AC_DEFUN([gl_INIT],
   if test $NEED_LOCALTIME_BUFFER = 1; then
     func_gl_gnulib_m4code_2049e887c7e5308faad27b3f894bb8c9
   fi
-  if test $REPLACE_LSTAT = 1; then
-    func_gl_gnulib_m4code_dosname
+  if test $REPLACE_MKTIME = 1; then
+    func_gl_gnulib_m4code_21ee726a3540c09237a8e70c0baf7467
   fi
   if test $HAVE_READLINKAT = 0; then
     func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b
   fi
   if test $HAVE_READLINKAT = 0; then
-    func_gl_gnulib_m4code_dosname
-  fi
-  if test $HAVE_READLINKAT = 0; then
     func_gl_gnulib_m4code_03e0aaad4cb89ca757653bd367a6ccb7
   fi
   if test $ac_use_included_regex = yes; then
@@ -692,7 +669,6 @@ AC_DEFUN([gl_INIT],
   AM_CONDITIONAL([gl_GNULIB_ENABLED_37f71b604aa9c54446783d80f42fe547], 
[$gl_gnulib_enabled_37f71b604aa9c54446783d80f42fe547])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_cloexec], [$gl_gnulib_enabled_cloexec])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_dirfd], [$gl_gnulib_enabled_dirfd])
-  AM_CONDITIONAL([gl_GNULIB_ENABLED_dosname], [$gl_gnulib_enabled_dosname])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_euidaccess], 
[$gl_gnulib_enabled_euidaccess])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_getdtablesize], 
[$gl_gnulib_enabled_getdtablesize])
   AM_CONDITIONAL([gl_GNULIB_ENABLED_getgroups], [$gl_gnulib_enabled_getgroups])
@@ -897,7 +873,6 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/faccessat.c
   lib/fcntl.c
   lib/fcntl.in.h
-  lib/fdatasync.c
   lib/fdopendir.c
   lib/filemode.c
   lib/filemode.h
@@ -1023,7 +998,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/alloca.m4
   m4/builtin-expect.m4
   m4/byteswap.m4
-  m4/c-strtod.m4
   m4/clock_time.m4
   m4/close-stream.m4
   m4/count-leading-zeros.m4
@@ -1045,7 +1019,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/fcntl-o.m4
   m4/fcntl.m4
   m4/fcntl_h.m4
-  m4/fdatasync.m4
   m4/fdopendir.m4
   m4/filemode.m4
   m4/flexmember.m4
diff --git a/m4/group-member.m4 b/m4/group-member.m4
index 2a14dcf..77d389d 100644
--- a/m4/group-member.m4
+++ b/m4/group-member.m4
@@ -1,6 +1,6 @@
 # serial 14
 
-# Copyright (C) 1999-2001, 2003-2007, 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 1999-2001, 2003-2007, 2009-2019 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/ieee754-h.m4 b/m4/ieee754-h.m4
index bf7c332..b8b9d5d 100644
--- a/m4/ieee754-h.m4
+++ b/m4/ieee754-h.m4
@@ -1,6 +1,6 @@
 # Configure ieee754-h module
 
-dnl Copyright 2018 Free Software Foundation, Inc.
+dnl Copyright 2018-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/include_next.m4 b/m4/include_next.m4
index a363cb0..86eb2c9 100644
--- a/m4/include_next.m4
+++ b/m4/include_next.m4
@@ -1,5 +1,5 @@
 # include_next.m4 serial 24
-dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/inttypes.m4 b/m4/inttypes.m4
index d756f01..c58a1be 100644
--- a/m4/inttypes.m4
+++ b/m4/inttypes.m4
@@ -1,5 +1,5 @@
 # inttypes.m4 serial 27
-dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/largefile.m4 b/m4/largefile.m4
index bec7cd1..1938188 100644
--- a/m4/largefile.m4
+++ b/m4/largefile.m4
@@ -1,6 +1,6 @@
 # Enable large files on systems where this is not the default.
 
-# Copyright 1992-1996, 1998-2018 Free Software Foundation, Inc.
+# Copyright 1992-1996, 1998-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/limits-h.m4 b/m4/limits-h.m4
index 3a2cd91..68f724c 100644
--- a/m4/limits-h.m4
+++ b/m4/limits-h.m4
@@ -1,6 +1,6 @@
 dnl Check whether limits.h has needed features.
 
-dnl Copyright 2016-2018 Free Software Foundation, Inc.
+dnl Copyright 2016-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/localtime-buffer.m4 b/m4/localtime-buffer.m4
index 4b3ec57..6d99828 100644
--- a/m4/localtime-buffer.m4
+++ b/m4/localtime-buffer.m4
@@ -1,5 +1,5 @@
 # localtime-buffer.m4 serial 1
-dnl Copyright (C) 2017-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2017-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/longlong.m4 b/m4/longlong.m4
index 27e6326..08d0e36 100644
--- a/m4/longlong.m4
+++ b/m4/longlong.m4
@@ -1,14 +1,15 @@
-# longlong.m4 serial 17
-dnl Copyright (C) 1999-2007, 2009-2018 Free Software Foundation, Inc.
+# longlong.m4 serial 18
+dnl Copyright (C) 1999-2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
 
 dnl From Paul Eggert.
 
+AC_PREREQ([2.62])
+
 # Define HAVE_LONG_LONG_INT if 'long long int' works.
-# This fixes a bug in Autoconf 2.61, and can be faster
-# than what's in Autoconf 2.62 through 2.68.
+# This can be faster than what's in Autoconf 2.62 through 2.68.
 
 # Note: If the type 'long long int' exists but is only 32 bits large
 # (as on some very old compilers), HAVE_LONG_LONG_INT will not be
@@ -56,8 +57,7 @@ AC_DEFUN([AC_TYPE_LONG_LONG_INT],
 ])
 
 # Define HAVE_UNSIGNED_LONG_LONG_INT if 'unsigned long long int' works.
-# This fixes a bug in Autoconf 2.61, and can be faster
-# than what's in Autoconf 2.62 through 2.68.
+# This can be faster than what's in Autoconf 2.62 through 2.68.
 
 # Note: If the type 'unsigned long long int' exists but is only 32 bits
 # large (as on some very old compilers), AC_TYPE_UNSIGNED_LONG_LONG_INT
diff --git a/m4/lstat.m4 b/m4/lstat.m4
index 3694e4c..ace1638 100644
--- a/m4/lstat.m4
+++ b/m4/lstat.m4
@@ -1,6 +1,6 @@
 # serial 32
 
-# Copyright (C) 1997-2001, 2003-2018 Free Software Foundation, Inc.
+# Copyright (C) 1997-2001, 2003-2019 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4
index d831ed2..e0488a5 100644
--- a/m4/manywarnings.m4
+++ b/m4/manywarnings.m4
@@ -1,5 +1,5 @@
 # manywarnings.m4 serial 17
-dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/mbstate_t.m4 b/m4/mbstate_t.m4
index 004aa0d..f669753 100644
--- a/m4/mbstate_t.m4
+++ b/m4/mbstate_t.m4
@@ -1,5 +1,5 @@
 # mbstate_t.m4 serial 13
-dnl Copyright (C) 2000-2002, 2008-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2000-2002, 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/md5.m4 b/m4/md5.m4
index 5f64f6e..59140f5 100644
--- a/m4/md5.m4
+++ b/m4/md5.m4
@@ -1,5 +1,5 @@
 # md5.m4 serial 14
-dnl Copyright (C) 2002-2006, 2008-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/memrchr.m4 b/m4/memrchr.m4
index a036b39..e907590 100644
--- a/m4/memrchr.m4
+++ b/m4/memrchr.m4
@@ -1,5 +1,5 @@
 # memrchr.m4 serial 10
-dnl Copyright (C) 2002-2003, 2005-2007, 2009-2018 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2019 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/m4/minmax.m4 b/m4/minmax.m4
index 5e88508..1e0d30b 100644
--- a/m4/minmax.m4
+++ b/m4/minmax.m4
@@ -1,5 +1,5 @@
 # minmax.m4 serial 4
-dnl Copyright (C) 2005, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/mkostemp.m4 b/m4/mkostemp.m4
index 245598e..56f566c 100644
--- a/m4/mkostemp.m4
+++ b/m4/mkostemp.m4
@@ -1,5 +1,5 @@
 # mkostemp.m4 serial 2
-dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/mktime.m4 b/m4/mktime.m4
index 4b3e399..a86e1ee 100644
--- a/m4/mktime.m4
+++ b/m4/mktime.m4
@@ -1,5 +1,5 @@
 # serial 30
-dnl Copyright (C) 2002-2003, 2005-2007, 2009-2018 Free Software Foundation,
+dnl Copyright (C) 2002-2003, 2005-2007, 2009-2019 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
diff --git a/m4/mode_t.m4 b/m4/mode_t.m4
index 83e276c..ba840dc 100644
--- a/m4/mode_t.m4
+++ b/m4/mode_t.m4
@@ -1,5 +1,5 @@
 # mode_t.m4 serial 2
-dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/multiarch.m4 b/m4/multiarch.m4
index 38a11cc..d48316e 100644
--- a/m4/multiarch.m4
+++ b/m4/multiarch.m4
@@ -1,5 +1,5 @@
 # multiarch.m4 serial 7
-dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/nocrash.m4 b/m4/nocrash.m4
index 4914007..4d9f022 100644
--- a/m4/nocrash.m4
+++ b/m4/nocrash.m4
@@ -1,5 +1,5 @@
 # nocrash.m4 serial 5
-dnl Copyright (C) 2005, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/nstrftime.m4 b/m4/nstrftime.m4
index bbb1f05..546c240 100644
--- a/m4/nstrftime.m4
+++ b/m4/nstrftime.m4
@@ -1,6 +1,6 @@
 # serial 34
 
-# Copyright (C) 1996-1997, 1999-2007, 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-1997, 1999-2007, 2009-2019 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/off_t.m4 b/m4/off_t.m4
index f4d5787..711a2d4 100644
--- a/m4/off_t.m4
+++ b/m4/off_t.m4
@@ -1,5 +1,5 @@
 # off_t.m4 serial 1
-dnl Copyright (C) 2012-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2012-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/open-cloexec.m4 b/m4/open-cloexec.m4
index a272784..52498d9 100644
--- a/m4/open-cloexec.m4
+++ b/m4/open-cloexec.m4
@@ -1,6 +1,6 @@
 # Test whether O_CLOEXEC is defined.
 
-dnl Copyright 2017-2018 Free Software Foundation, Inc.
+dnl Copyright 2017-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/open.m4 b/m4/open.m4
index 8b3d402..5d73f4d 100644
--- a/m4/open.m4
+++ b/m4/open.m4
@@ -1,5 +1,5 @@
 # open.m4 serial 15
-dnl Copyright (C) 2007-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/pipe2.m4 b/m4/pipe2.m4
index c081b44..03008eb 100644
--- a/m4/pipe2.m4
+++ b/m4/pipe2.m4
@@ -1,5 +1,5 @@
 # pipe2.m4 serial 2
-dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/pselect.m4 b/m4/pselect.m4
index 5cd1e04..5c72b69 100644
--- a/m4/pselect.m4
+++ b/m4/pselect.m4
@@ -1,5 +1,5 @@
 # pselect.m4 serial 7
-dnl Copyright (C) 2011-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4
index 585b80a..cadc239 100644
--- a/m4/pthread_sigmask.m4
+++ b/m4/pthread_sigmask.m4
@@ -1,5 +1,5 @@
 # pthread_sigmask.m4 serial 16
-dnl Copyright (C) 2011-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/putenv.m4 b/m4/putenv.m4
index f2a76b2..342ba26 100644
--- a/m4/putenv.m4
+++ b/m4/putenv.m4
@@ -1,5 +1,5 @@
-# putenv.m4 serial 22
-dnl Copyright (C) 2002-2018 Free Software Foundation, Inc.
+# putenv.m4 serial 23
+dnl Copyright (C) 2002-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -36,6 +36,8 @@ AC_DEFUN([gl_FUNC_PUTENV],
              [case "$host_os" in
                                # Guess yes on glibc systems.
                 *-gnu* | gnu*) gl_cv_func_svid_putenv="guessing yes" ;;
+                               # Guess yes on musl systems.
+                *-musl*)       gl_cv_func_svid_putenv="guessing yes" ;;
                                # Guess no on native Windows.
                 mingw*)        gl_cv_func_svid_putenv="guessing no" ;;
                                # If we don't know, assume the worst.
diff --git a/m4/readlink.m4 b/m4/readlink.m4
index 4d0ab48..2d76815 100644
--- a/m4/readlink.m4
+++ b/m4/readlink.m4
@@ -1,5 +1,5 @@
 # readlink.m4 serial 14
-dnl Copyright (C) 2003, 2007, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/readlinkat.m4 b/m4/readlinkat.m4
index b3e447c..b63f213 100644
--- a/m4/readlinkat.m4
+++ b/m4/readlinkat.m4
@@ -1,7 +1,7 @@
 # serial 5
 # See if we need to provide readlinkat replacement.
 
-dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/regex.m4 b/m4/regex.m4
index 055d71b..35119c5 100644
--- a/m4/regex.m4
+++ b/m4/regex.m4
@@ -1,6 +1,6 @@
-# serial 67
+# serial 68
 
-# Copyright (C) 1996-2001, 2003-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-2001, 2003-2019 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -213,6 +213,17 @@ AC_DEFUN([gl_REGEX],
             if (! REG_STARTEND)
               result |= 64;
 
+            /* Matching with the compiled form of this regexp would provoke
+               an assertion failure prior to glibc-2.28:
+                 regexec.c:1375: pop_fail_stack: Assertion 'num >= 0' failed
+               With glibc-2.28, compilation fails and reports the invalid
+               back reference.  */
+            re_set_syntax (RE_SYNTAX_POSIX_EGREP);
+            memset (&regex, 0, sizeof regex);
+            s = re_compile_pattern ("0|()0|\\1|0", 10, &regex);
+            if (!s || strcmp (s, "Invalid back reference"))
+              result |= 64;
+
 #if 0
             /* It would be nice to reject hosts whose regoff_t values are too
                narrow (including glibc on hosts with 64-bit ptrdiff_t and
diff --git a/m4/sha1.m4 b/m4/sha1.m4
index 99006f7..bb74fc7 100644
--- a/m4/sha1.m4
+++ b/m4/sha1.m4
@@ -1,5 +1,5 @@
 # sha1.m4 serial 12
-dnl Copyright (C) 2002-2006, 2008-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2006, 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sha256.m4 b/m4/sha256.m4
index cdc656a..929583d 100644
--- a/m4/sha256.m4
+++ b/m4/sha256.m4
@@ -1,5 +1,5 @@
 # sha256.m4 serial 8
-dnl Copyright (C) 2005, 2008-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2005, 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sha512.m4 b/m4/sha512.m4
index ac5257c..d5f5594 100644
--- a/m4/sha512.m4
+++ b/m4/sha512.m4
@@ -1,5 +1,5 @@
 # sha512.m4 serial 9
-dnl Copyright (C) 2005-2006, 2008-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2006, 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sig2str.m4 b/m4/sig2str.m4
index b175706..0474d51 100644
--- a/m4/sig2str.m4
+++ b/m4/sig2str.m4
@@ -1,5 +1,5 @@
 # serial 7
-dnl Copyright (C) 2002, 2005-2006, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2005-2006, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/signal_h.m4 b/m4/signal_h.m4
index 394b91d..3acec64 100644
--- a/m4/signal_h.m4
+++ b/m4/signal_h.m4
@@ -1,5 +1,5 @@
 # signal_h.m4 serial 18
-dnl Copyright (C) 2007-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/socklen.m4 b/m4/socklen.m4
index fa79b07..deb5135 100644
--- a/m4/socklen.m4
+++ b/m4/socklen.m4
@@ -1,5 +1,5 @@
 # socklen.m4 serial 11
-dnl Copyright (C) 2005-2007, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/ssize_t.m4 b/m4/ssize_t.m4
index 0977f20..38bcee1 100644
--- a/m4/ssize_t.m4
+++ b/m4/ssize_t.m4
@@ -1,5 +1,5 @@
 # ssize_t.m4 serial 5 (gettext-0.18.2)
-dnl Copyright (C) 2001-2003, 2006, 2010-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2001-2003, 2006, 2010-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/st_dm_mode.m4 b/m4/st_dm_mode.m4
index 0fa7afa..283981f 100644
--- a/m4/st_dm_mode.m4
+++ b/m4/st_dm_mode.m4
@@ -1,6 +1,6 @@
 # serial 6
 
-# Copyright (C) 1998-1999, 2001, 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 1998-1999, 2001, 2009-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/stat-time.m4 b/m4/stat-time.m4
index d0d17ed..1685788 100644
--- a/m4/stat-time.m4
+++ b/m4/stat-time.m4
@@ -1,6 +1,6 @@
 # Checks for stat-related time functions.
 
-# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2018 Free Software
+# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2019 Free Software
 # Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
diff --git a/m4/std-gnu11.m4 b/m4/std-gnu11.m4
index c85ac43..23e7f75 100644
--- a/m4/std-gnu11.m4
+++ b/m4/std-gnu11.m4
@@ -7,7 +7,7 @@
 # or later is installed everywhere a Gnulib program might be developed.
 
 
-# Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -70,7 +70,7 @@ _AS_ECHO_LOG([checking for _AC_LANG compiler version])
 set X $ac_compile
 ac_compiler=$[2]
 for ac_option in --version -v -V -qversion -version; do
-  _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
+  m4_ifdef([_AC_DO_LIMIT],[_AC_DO_LIMIT],[_AC_DO])([$ac_compiler $ac_option 
>&AS_MESSAGE_LOG_FD])
 done
 
 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
@@ -135,7 +135,7 @@ _AS_ECHO_LOG([checking for _AC_LANG compiler version])
 set X $ac_compile
 ac_compiler=$[2]
 for ac_option in --version -v -V -qversion; do
-  _AC_DO_LIMIT([$ac_compiler $ac_option >&AS_MESSAGE_LOG_FD])
+  m4_ifdef([_AC_DO_LIMIT],[_AC_DO_LIMIT],[_AC_DO])([$ac_compiler $ac_option 
>&AS_MESSAGE_LOG_FD])
 done
 
 m4_expand_once([_AC_COMPILER_EXEEXT])[]dnl
diff --git a/m4/stdalign.m4 b/m4/stdalign.m4
index c74fe9b..601fd21 100644
--- a/m4/stdalign.m4
+++ b/m4/stdalign.m4
@@ -1,6 +1,6 @@
 # Check for stdalign.h that conforms to C11.
 
-dnl Copyright 2011-2018 Free Software Foundation, Inc.
+dnl Copyright 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/stddef_h.m4 b/m4/stddef_h.m4
index 07b040a..979e3cf 100644
--- a/m4/stddef_h.m4
+++ b/m4/stddef_h.m4
@@ -1,6 +1,6 @@
 dnl A placeholder for <stddef.h>, for platforms that have issues.
 # stddef_h.m4 serial 6
-dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/stdint.m4 b/m4/stdint.m4
index 38dbbed..11d8e8e 100644
--- a/m4/stdint.m4
+++ b/m4/stdint.m4
@@ -1,5 +1,5 @@
-# stdint.m4 serial 52
-dnl Copyright (C) 2001-2018 Free Software Foundation, Inc.
+# stdint.m4 serial 53
+dnl Copyright (C) 2001-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -7,6 +7,8 @@ dnl with or without modifications, as long as this notice is 
preserved.
 dnl From Paul Eggert and Bruno Haible.
 dnl Test whether <stdint.h> is supported or must be substituted.
 
+AC_PREREQ([2.61])
+
 AC_DEFUN_ONCE([gl_STDINT_H],
 [
   AC_PREREQ([2.59])dnl
@@ -540,9 +542,3 @@ AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
     BITSIZEOF_WINT_T=32
   fi
 ])
-
-dnl Autoconf >= 2.61 has AC_COMPUTE_INT built-in.
-dnl Remove this when we can assume autoconf >= 2.61.
-m4_ifdef([AC_COMPUTE_INT], [], [
-  AC_DEFUN([AC_COMPUTE_INT], [_AC_COMPUTE_INT([$2],[$1],[$3],[$4])])
-])
diff --git a/m4/stdio_h.m4 b/m4/stdio_h.m4
index 0debe69..6c9c104 100644
--- a/m4/stdio_h.m4
+++ b/m4/stdio_h.m4
@@ -1,5 +1,5 @@
 # stdio_h.m4 serial 49
-dnl Copyright (C) 2007-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/stdlib_h.m4 b/m4/stdlib_h.m4
index 49dc5d5..6121602 100644
--- a/m4/stdlib_h.m4
+++ b/m4/stdlib_h.m4
@@ -1,5 +1,5 @@
-# stdlib_h.m4 serial 45
-dnl Copyright (C) 2007-2018 Free Software Foundation, Inc.
+# stdlib_h.m4 serial 48
+dnl Copyright (C) 2007-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -23,10 +23,10 @@ AC_DEFUN([gl_STDLIB_H],
 # include <random.h>
 #endif
     ]], [_Exit atoll canonicalize_file_name getloadavg getsubopt grantpt
-    initstate initstate_r mkdtemp mkostemp mkostemps mkstemp mkstemps
+    initstate initstate_r mbtowc mkdtemp mkostemp mkostemps mkstemp mkstemps
     posix_openpt ptsname ptsname_r qsort_r random random_r reallocarray
     realpath rpmatch secure_getenv setenv setstate setstate_r srandom
-    srandom_r strtod strtoll strtoull unlockpt unsetenv])
+    srandom_r strtod strtold strtoll strtoull unlockpt unsetenv])
 ])
 
 AC_DEFUN([gl_STDLIB_MODULE_INDICATOR],
@@ -68,6 +68,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   GNULIB_SECURE_GETENV=0; AC_SUBST([GNULIB_SECURE_GETENV])
   GNULIB_SETENV=0;        AC_SUBST([GNULIB_SETENV])
   GNULIB_STRTOD=0;        AC_SUBST([GNULIB_STRTOD])
+  GNULIB_STRTOLD=0;       AC_SUBST([GNULIB_STRTOLD])
   GNULIB_STRTOLL=0;       AC_SUBST([GNULIB_STRTOLL])
   GNULIB_STRTOULL=0;      AC_SUBST([GNULIB_STRTOULL])
   GNULIB_SYSTEM_POSIX=0;  AC_SUBST([GNULIB_SYSTEM_POSIX])
@@ -81,7 +82,9 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_DECL_GETLOADAVG=1;    AC_SUBST([HAVE_DECL_GETLOADAVG])
   HAVE_GETSUBOPT=1;          AC_SUBST([HAVE_GETSUBOPT])
   HAVE_GRANTPT=1;            AC_SUBST([HAVE_GRANTPT])
+  HAVE_INITSTATE=1;          AC_SUBST([HAVE_INITSTATE])
   HAVE_DECL_INITSTATE=1;     AC_SUBST([HAVE_DECL_INITSTATE])
+  HAVE_MBTOWC=1;             AC_SUBST([HAVE_MBTOWC])
   HAVE_MKDTEMP=1;            AC_SUBST([HAVE_MKDTEMP])
   HAVE_MKOSTEMP=1;           AC_SUBST([HAVE_MKOSTEMP])
   HAVE_MKOSTEMPS=1;          AC_SUBST([HAVE_MKOSTEMPS])
@@ -100,8 +103,10 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_SECURE_GETENV=1;      AC_SUBST([HAVE_SECURE_GETENV])
   HAVE_SETENV=1;             AC_SUBST([HAVE_SETENV])
   HAVE_DECL_SETENV=1;        AC_SUBST([HAVE_DECL_SETENV])
+  HAVE_SETSTATE=1;           AC_SUBST([HAVE_SETSTATE])
   HAVE_DECL_SETSTATE=1;      AC_SUBST([HAVE_DECL_SETSTATE])
   HAVE_STRTOD=1;             AC_SUBST([HAVE_STRTOD])
+  HAVE_STRTOLD=1;            AC_SUBST([HAVE_STRTOLD])
   HAVE_STRTOLL=1;            AC_SUBST([HAVE_STRTOLL])
   HAVE_STRTOULL=1;           AC_SUBST([HAVE_STRTOULL])
   HAVE_STRUCT_RANDOM_DATA=1; AC_SUBST([HAVE_STRUCT_RANDOM_DATA])
@@ -110,6 +115,7 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   HAVE_DECL_UNSETENV=1;      AC_SUBST([HAVE_DECL_UNSETENV])
   REPLACE_CALLOC=0;          AC_SUBST([REPLACE_CALLOC])
   REPLACE_CANONICALIZE_FILE_NAME=0;  AC_SUBST([REPLACE_CANONICALIZE_FILE_NAME])
+  REPLACE_INITSTATE=0;       AC_SUBST([REPLACE_INITSTATE])
   REPLACE_MALLOC=0;          AC_SUBST([REPLACE_MALLOC])
   REPLACE_MBTOWC=0;          AC_SUBST([REPLACE_MBTOWC])
   REPLACE_MKSTEMP=0;         AC_SUBST([REPLACE_MKSTEMP])
@@ -117,11 +123,14 @@ AC_DEFUN([gl_STDLIB_H_DEFAULTS],
   REPLACE_PTSNAME_R=0;       AC_SUBST([REPLACE_PTSNAME_R])
   REPLACE_PUTENV=0;          AC_SUBST([REPLACE_PUTENV])
   REPLACE_QSORT_R=0;         AC_SUBST([REPLACE_QSORT_R])
+  REPLACE_RANDOM=0;          AC_SUBST([REPLACE_RANDOM])
   REPLACE_RANDOM_R=0;        AC_SUBST([REPLACE_RANDOM_R])
   REPLACE_REALLOC=0;         AC_SUBST([REPLACE_REALLOC])
   REPLACE_REALPATH=0;        AC_SUBST([REPLACE_REALPATH])
   REPLACE_SETENV=0;          AC_SUBST([REPLACE_SETENV])
+  REPLACE_SETSTATE=0;        AC_SUBST([REPLACE_SETSTATE])
   REPLACE_STRTOD=0;          AC_SUBST([REPLACE_STRTOD])
+  REPLACE_STRTOLD=0;         AC_SUBST([REPLACE_STRTOLD])
   REPLACE_UNSETENV=0;        AC_SUBST([REPLACE_UNSETENV])
   REPLACE_WCTOMB=0;          AC_SUBST([REPLACE_WCTOMB])
 ])
diff --git a/m4/stpcpy.m4 b/m4/stpcpy.m4
index e431fd8..7af2e81 100644
--- a/m4/stpcpy.m4
+++ b/m4/stpcpy.m4
@@ -1,5 +1,5 @@
 # stpcpy.m4 serial 8
-dnl Copyright (C) 2002, 2007, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/string_h.m4 b/m4/string_h.m4
index 97c80dc..0c0e3a7 100644
--- a/m4/string_h.m4
+++ b/m4/string_h.m4
@@ -1,6 +1,6 @@
 # Configure a GNU-like replacement for <string.h>.
 
-# Copyright (C) 2007-2018 Free Software Foundation, Inc.
+# Copyright (C) 2007-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/strtoimax.m4 b/m4/strtoimax.m4
index d3259f3..9632279 100644
--- a/m4/strtoimax.m4
+++ b/m4/strtoimax.m4
@@ -1,5 +1,5 @@
 # strtoimax.m4 serial 15
-dnl Copyright (C) 2002-2004, 2006, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2004, 2006, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/strtoll.m4 b/m4/strtoll.m4
index 5f34852..3ba7e22 100644
--- a/m4/strtoll.m4
+++ b/m4/strtoll.m4
@@ -1,5 +1,5 @@
 # strtoll.m4 serial 7
-dnl Copyright (C) 2002, 2004, 2006, 2008-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2004, 2006, 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/symlink.m4 b/m4/symlink.m4
index afaa941..508e94d 100644
--- a/m4/symlink.m4
+++ b/m4/symlink.m4
@@ -1,7 +1,7 @@
 # serial 8
 # See if we need to provide symlink replacement.
 
-dnl Copyright (C) 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sys_select_h.m4 b/m4/sys_select_h.m4
index 8e9eff4..918212a 100644
--- a/m4/sys_select_h.m4
+++ b/m4/sys_select_h.m4
@@ -1,5 +1,5 @@
 # sys_select_h.m4 serial 20
-dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sys_socket_h.m4 b/m4/sys_socket_h.m4
index f210378..1ea7b0b 100644
--- a/m4/sys_socket_h.m4
+++ b/m4/sys_socket_h.m4
@@ -1,5 +1,5 @@
 # sys_socket_h.m4 serial 23
-dnl Copyright (C) 2005-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2005-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4
index 52f06aa..361ac3f 100644
--- a/m4/sys_stat_h.m4
+++ b/m4/sys_stat_h.m4
@@ -1,5 +1,5 @@
 # sys_stat_h.m4 serial 31   -*- Autoconf -*-
-dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/sys_time_h.m4 b/m4/sys_time_h.m4
index d7e9268..3d9233a 100644
--- a/m4/sys_time_h.m4
+++ b/m4/sys_time_h.m4
@@ -1,7 +1,7 @@
 # Configure a replacement for <sys/time.h>.
 # serial 9
 
-# Copyright (C) 2007, 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 2007, 2009-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/sys_types_h.m4 b/m4/sys_types_h.m4
index 2debfb0..be06559 100644
--- a/m4/sys_types_h.m4
+++ b/m4/sys_types_h.m4
@@ -1,5 +1,5 @@
 # sys_types_h.m4 serial 9
-dnl Copyright (C) 2011-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/tempname.m4 b/m4/tempname.m4
index ed813f1..664a632 100644
--- a/m4/tempname.m4
+++ b/m4/tempname.m4
@@ -1,6 +1,6 @@
 #serial 5
 
-# Copyright (C) 2006-2007, 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 2006-2007, 2009-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/time_h.m4 b/m4/time_h.m4
index ad6f2f5..f08f29b 100644
--- a/m4/time_h.m4
+++ b/m4/time_h.m4
@@ -1,6 +1,6 @@
 # Configure a more-standard replacement for <time.h>.
 
-# Copyright (C) 2000-2001, 2003-2007, 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2019 Free Software Foundation, Inc.
 
 # serial 11
 
diff --git a/m4/time_r.m4 b/m4/time_r.m4
index daf4bba..5caeca7 100644
--- a/m4/time_r.m4
+++ b/m4/time_r.m4
@@ -1,6 +1,6 @@
 dnl Reentrant time functions: localtime_r, gmtime_r.
 
-dnl Copyright (C) 2003, 2006-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2006-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/time_rz.m4 b/m4/time_rz.m4
index 5555706..5564559 100644
--- a/m4/time_rz.m4
+++ b/m4/time_rz.m4
@@ -1,6 +1,6 @@
 dnl Time zone functions: tzalloc, localtime_rz, etc.
 
-dnl Copyright (C) 2015-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2015-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/timegm.m4 b/m4/timegm.m4
index 46f599c..d9d40de 100644
--- a/m4/timegm.m4
+++ b/m4/timegm.m4
@@ -1,5 +1,5 @@
 # timegm.m4 serial 12
-dnl Copyright (C) 2003, 2007, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2007, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/timer_time.m4 b/m4/timer_time.m4
index d5c35c5..2c9b93c 100644
--- a/m4/timer_time.m4
+++ b/m4/timer_time.m4
@@ -1,5 +1,5 @@
 # timer_time.m4 serial 3
-dnl Copyright (C) 2011-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2011-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/timespec.m4 b/m4/timespec.m4
index accabf9..3db9943 100644
--- a/m4/timespec.m4
+++ b/m4/timespec.m4
@@ -1,6 +1,6 @@
 #serial 15
 
-# Copyright (C) 2000-2001, 2003-2007, 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 2000-2001, 2003-2007, 2009-2019 Free Software Foundation, Inc.
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/tm_gmtoff.m4 b/m4/tm_gmtoff.m4
index 56c48a6..31b841f 100644
--- a/m4/tm_gmtoff.m4
+++ b/m4/tm_gmtoff.m4
@@ -1,5 +1,5 @@
 # tm_gmtoff.m4 serial 3
-dnl Copyright (C) 2002, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2002, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index 3ba64da..a04055d 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,5 +1,5 @@
 # unistd_h.m4 serial 74
-dnl Copyright (C) 2006-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2006-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/unlocked-io.m4 b/m4/unlocked-io.m4
index 7e46367..ea55a1a 100644
--- a/m4/unlocked-io.m4
+++ b/m4/unlocked-io.m4
@@ -1,6 +1,6 @@
 # unlocked-io.m4 serial 15
 
-# Copyright (C) 1998-2006, 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 1998-2006, 2009-2019 Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
diff --git a/m4/utimbuf.m4 b/m4/utimbuf.m4
index a014351..a950aa9 100644
--- a/m4/utimbuf.m4
+++ b/m4/utimbuf.m4
@@ -1,6 +1,6 @@
 # serial 9
 
-# Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2018 Free Software
+# Copyright (C) 1998-2001, 2003-2004, 2007, 2009-2019 Free Software
 # Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
diff --git a/m4/utimens.m4 b/m4/utimens.m4
index 9a4db07..dda86b0 100644
--- a/m4/utimens.m4
+++ b/m4/utimens.m4
@@ -1,4 +1,4 @@
-dnl Copyright (C) 2003-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/utimes.m4 b/m4/utimes.m4
index f62d5f8..5806d8f 100644
--- a/m4/utimes.m4
+++ b/m4/utimes.m4
@@ -1,7 +1,7 @@
 # Detect some bugs in glibc's implementation of utimes.
-# serial 5
+# serial 6
 
-dnl Copyright (C) 2003-2005, 2009-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2003-2005, 2009-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
@@ -143,9 +143,11 @@ main ()
        [gl_cv_func_working_utimes=yes],
        [gl_cv_func_working_utimes=no],
        [case "$host_os" in
-                  # Guess no on native Windows.
-          mingw*) gl_cv_func_working_utimes="guessing no" ;;
-          *)      gl_cv_func_working_utimes="guessing no" ;;
+                   # Guess yes on musl systems.
+          *-musl*) gl_cv_func_working_utimes="guessing yes" ;;
+                   # Guess no on native Windows.
+          mingw*)  gl_cv_func_working_utimes="guessing no" ;;
+          *)       gl_cv_func_working_utimes="guessing no" ;;
         esac
        ])
     ])
diff --git a/m4/vararrays.m4 b/m4/vararrays.m4
index 17563b5..98a4ef0 100644
--- a/m4/vararrays.m4
+++ b/m4/vararrays.m4
@@ -4,7 +4,7 @@
 
 # From Paul Eggert
 
-# Copyright (C) 2001, 2009-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2009-2019 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
diff --git a/m4/warnings.m4 b/m4/warnings.m4
index 07edda1..235cac6 100644
--- a/m4/warnings.m4
+++ b/m4/warnings.m4
@@ -1,5 +1,5 @@
 # warnings.m4 serial 14
-dnl Copyright (C) 2008-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/m4/wchar_t.m4 b/m4/wchar_t.m4
index 83bc3d5..5db5815 100644
--- a/m4/wchar_t.m4
+++ b/m4/wchar_t.m4
@@ -1,5 +1,5 @@
 # wchar_t.m4 serial 4 (gettext-0.18.2)
-dnl Copyright (C) 2002-2003, 2008-2018 Free Software Foundation, Inc.
+dnl Copyright (C) 2002-2003, 2008-2019 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
 dnl with or without modifications, as long as this notice is preserved.
diff --git a/make-dist b/make-dist
index bafcae3..4e18d77 100755
--- a/make-dist
+++ b/make-dist
@@ -1,7 +1,7 @@
 #!/bin/sh
 ### make-dist: create an Emacs distribution tar file from current srcdir
 
-## Copyright (C) 1995, 1997-1998, 2000-2018 Free Software Foundation,
+## Copyright (C) 1995, 1997-1998, 2000-2019 Free Software Foundation,
 ## Inc.
 
 ## This file is part of GNU Emacs.
@@ -222,18 +222,23 @@ if [ $check = yes ]; then
 
   error=no
 
+  temp_el=/tmp/make-dist.tmp.$$
+  temp_elc=$temp_el.1
+  temp_elelc=$temp_el.2
+  temp_elcel=$temp_el.3
+
   ls -1 lisp/[a-zA-Z]*.el lisp/[a-z]*/[a-zA-Z0-9]*.el \
        lisp/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el \
-       lisp/[a-z]*/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el > /tmp/el
+       lisp/[a-z]*/[a-z]*/[a-z]*/[a-zA-Z0-9]*.el > $temp_el
 
   ls -1 lisp/[a-zA-Z]*.elc lisp/[a-z]*/[a-zA-Z0-9]*.elc \
        lisp/[a-z]*/[a-z]*/[a-zA-Z0-9]*.elc \
-       lisp/[a-z]*/[a-z]*/[a-z]*/[a-zA-Z0-9]*.elc > /tmp/elc
+       lisp/[a-z]*/[a-z]*/[a-z]*/[a-zA-Z0-9]*.elc > $temp_elc
 
   ## Check for .elc files with no corresponding .el file.
-  sed 's/\.el$/.elc/' /tmp/el > /tmp/elelc
+  sed 's/\.el$/.elc/' $temp_el > $temp_elelc
 
-  bogosities=`comm -13 /tmp/elelc /tmp/elc`
+  bogosities=`comm -13 $temp_elelc $temp_elc`
   if [ x"${bogosities}" != x"" ]; then
     error=yes
     echo "The following .elc files have no corresponding .el files:"
@@ -241,15 +246,15 @@ if [ $check = yes ]; then
   fi
 
   ### Check for .el files with no corresponding .elc file.
-  sed 's/\.elc$/.el/' /tmp/elc > /tmp/elcel
-  losers=`comm -23 /tmp/el /tmp/elcel`
+  sed 's/\.elc$/.el/' $temp_elc > $temp_elcel
+  losers=`comm -23 $temp_el $temp_elcel`
 
   bogosities=
   while read elc; do
       el=`echo $elc | sed 's/c$//'`
       [ -r $el ] || continue
       [ $elc -nt $el ] || bogosities="$bogosities $elc"
-  done < /tmp/elc
+  done < $temp_elc
 
   if [ x"${bogosities}" != x"" ]; then
       error=yes
@@ -257,11 +262,11 @@ if [ $check = yes ]; then
       echo "${bogosities}"
   fi
 
-  rm -f /tmp/el /tmp/elc /tmp/elcel /tmp/elelc
+  rm -f $temp_el*
 
   bogosities=
   for file in $losers; do
-    grep -q "no-byte-compile: t" $file && continue
+    grep -q "^;.*no-byte-compile: t" $file && continue
     case $file in
       site-init.el | site-load.el | site-start.el | default.el) continue ;;
     esac
@@ -278,7 +283,7 @@ if [ $check = yes ]; then
 
   ## This is only a crude check, eg it does not handle .info
   ## files with multiple .texi source files.
-  find doc -name '*.texi' > /tmp/el
+  find doc -name '*.texi' > $temp_el
 
   bogosities=
   while read texi; do
@@ -287,9 +292,9 @@ if [ $check = yes ]; then
       info=info/$info
       [ -r $info ] || continue
       [ $info -nt $texi ] || bogosities="$bogosities $info"
-  done < /tmp/el
+  done < $temp_el
 
-  rm -f /tmp/el
+  rm -f $temp_el
 
   if [ x"${bogosities}" != x"" ]; then
     error=yes
@@ -334,10 +339,6 @@ if [ $update = yes ]; then
   echo "Running autoreconf"
   autoreconf -i -I m4 || { x=$?; echo Autoreconf FAILED! >&2; exit $x; }
 
-  ## Make sure src/stamp-h.in is newer than configure.ac.
-  rm -f src/stamp-h.in
-  echo timestamp > src/stamp-h.in
-
   if [ "$make_info" = yes ] ; then
     echo "Updating Info files"
     make info
@@ -353,11 +354,61 @@ if [ $update = yes ]; then
   $EMACS -batch -f batch-byte-recompile-directory lisp
 fi                              # $update = yes
 
+if [ "$changelog" = yes ] && [ -r .git ]; then
+  top_level_ChangeLog=ChangeLog
+else
+  top_level_ChangeLog=
+fi
+
+# Files to distribute that might not be under version control.
+# Don't distribute site-init.el, site-load.el, or default.el.
+possibly_non_vc_files="
+  $top_level_ChangeLog
+  MANIFEST aclocal.m4 configure
+  admin/charsets/jisx2131-filter
+  src/config.in src/dmpstruct.h src/emacs-module.h
+  src/fingerprint.c
+"$(
+  find admin doc etc lisp \
+    \( -name '*.el' -o -name '*.elc' -o -name '*.map' -o -name '*.stamp' \
+       -o -name '*.texi' -o -name '*.tex' -o -name '*.txt' \) \
+    ! -name 'site-init*' ! -name 'site-load*' ! -name 'default*'
+) || exit
+
+if [ $with_info = yes ]; then
+  info_files="info/dir $(echo info/*.info)" || exit
+else
+  info_files=
+fi
+
 echo "Creating staging directory: '${tempparent}'"
 
 mkdir ${tempparent} || exit
 tempdir="${tempparent}/${emacsname}"
 
+manifest=MANIFEST
+
+[ -f $manifest ] || manifest=${tempparent}/MANIFEST
+
+# If Git is in use update the file MANIFEST, which can substitute for
+# 'git ls-files' later (e.g., after extraction from a tarball).
+# Otherwise, rely on the existing MANIFEST, which should be maintained some
+# other way when adding or deleting a distributed file while not using Git.
+# TODO: maybe this should ignore $update, and always update MANIFEST
+# if .git is present.
+if ( [ $update = yes ] || [ ! -f $manifest ] ) && [ -r .git ]; then
+  echo "Updating $manifest"
+  if [ $with_tests = yes ]; then
+    git ls-files > $manifest
+  else
+    git ls-files | grep -v '^test' >$manifest
+  fi || exit
+  printf '%s\n' $possibly_non_vc_files $info_files >>$manifest || exit
+  sort -u -o $manifest $manifest || exit
+fi
+
+<$manifest || exit
+
 ### This trap ensures that the staging directory will be cleaned up even
 ### when the script is interrupted in mid-career.
 if [ "${clean_up}" = yes ]; then
@@ -365,304 +416,66 @@ if [ "${clean_up}" = yes ]; then
 fi
 
 echo "Creating top directory: '${tempdir}'"
-mkdir ${tempdir} || exit
+if [ $verbose = yes ] && (mkdir --verbose ${tempdir}) >/dev/null 2>&1; then
+  mkdir_verbose='mkdir --verbose'
+else
+  mkdir $tempdir || exit
+  mkdir_verbose=mkdir
+fi
+
+# file_to_skip is normally empty to link every file,
+# but it can be 'ChangeLog' if we do not want to link the
+# top-level ChangeLog.
+file_to_skip=
 
-top_level_ChangeLog=
 if [ "$changelog" = yes ]; then
   if test -r .git; then
     ## When making a release or pretest the ChangeLog should already
     ## have been created and edited as needed.  Don't ignore it.
-    if test -r ChangeLog; then
+    if [ -r ChangeLog ] && [ ! -L ChangeLog ]; then
       echo "Using existing top-level ChangeLog"
-      top_level_ChangeLog=ChangeLog
     else
       echo "Making top-level ChangeLog"
       make ChangeLog CHANGELOG=${tempdir}/ChangeLog || \
         { x=$?; echo "make ChangeLog FAILED (try --no-changelog?)" >&2; exit 
$x; }
+      file_to_skip=ChangeLog
     fi
   else
     echo "No repository, so omitting top-level ChangeLog"
   fi
 fi
 
-### We copy in the top-level files before creating the subdirectories in
-### hopes that this will make the top-level files appear first in the
-### tar file; this means that people can start reading the INSTALL and
-### README while the rest of the tar file is still unpacking.  Whoopee.
-echo "Making links to top-level files"
-top_level='
-  INSTALL README BUGS
-  ChangeLog.*[0-9] Makefile.in autogen.sh configure configure.ac
-  config.bat make-dist .dir-locals.el
-  aclocal.m4 CONTRIBUTE
-'
-ln $top_level $top_level_ChangeLog $tempdir || exit
-
 echo "Creating subdirectories"
-for subdir in site-lisp \
-             leim leim/CXTERM-DIC leim/MISC-DIC leim/SKK-DIC \
-             build-aux \
-             src src/bitmaps lib lib-src oldXMenu lwlib \
-             nt nt/inc nt/inc/sys nt/inc/arpa nt/inc/netinet nt/icons \
-             `find etc lisp admin test -type d` \
-             doc doc/emacs doc/misc doc/man doc/lispref doc/lispintro \
-             info m4 modules msdos \
-             nextstep nextstep/templates \
-             nextstep/Cocoa nextstep/Cocoa/Emacs.base \
-             nextstep/Cocoa/Emacs.base/Contents \
-             nextstep/Cocoa/Emacs.base/Contents/Resources \
-             nextstep/GNUstep \
-             nextstep/GNUstep/Emacs.base \
-             nextstep/GNUstep/Emacs.base/Resources
-do
-
-  if [ "$with_tests" != "yes" ]; then
-    case $subdir in
-        test*) continue ;;
-    esac
-  fi
-
-  ## site-lisp for in-place installs (?).
-  [ "$subdir" = "site-lisp" ] || [ -d "$subdir" ] || \
-      echo "WARNING: $subdir not found, making anyway"
-  [ "$verbose" = "yes" ] && echo "  ${tempdir}/${subdir}"
-  mkdir ${tempdir}/${subdir} || exit
-done
-
-echo "Making links to 'lisp' and its subdirectories"
-files=`find lisp \( -name '*.el' -o -name '*.elc' -o -name 'ChangeLog*' \
- -o -name 'README' \)` || exit
+MANIFEST_subdir_sed='
+  $a\
+'$tempdir'/info\
+'$tempdir'/site-lisp
+  s,[^/]*$,,
+  s,/$,,
+  /^$/d
+  s,^,'$tempdir'/,
+'
+tempsubdirs=$(sed "$MANIFEST_subdir_sed" $manifest | sort -u)
+$mkdir_verbose -p $tempsubdirs || exit
 
-### Don't distribute site-init.el, site-load.el, or default.el.
-for file in lisp/Makefile.in $files; do
+echo "Making links to files"
+while read file; do
   case $file in
-    */site-init*|*/site-load*|*/default*) continue ;;
-  esac
-  ln $file $tempdir/$file || exit
-done
-
-echo "Making links to 'leim' and its subdirectories"
-(cd leim &&
- ln ChangeLog.*[0-9] README ../${tempdir}/leim &&
- ln CXTERM-DIC/README CXTERM-DIC/*.tit ../${tempdir}/leim/CXTERM-DIC &&
- ln SKK-DIC/README SKK-DIC/SKK-JISYO.L ../${tempdir}/leim/SKK-DIC &&
- ln MISC-DIC/README MISC-DIC/*.* ../${tempdir}/leim/MISC-DIC &&
- ln Makefile.in ../${tempdir}/leim/Makefile.in &&
- ln leim-ext.el ../${tempdir}/leim/leim-ext.el &&
-:) || exit
-
-## FIXME Can we not just use the "find -type f" method for this one?
-echo "Making links to 'build-aux'"
-(cd build-aux &&
- ln config.guess config.sub msys-to-w32 ../${tempdir}/build-aux &&
- ln gitlog-to-changelog gitlog-to-emacslog ../${tempdir}/build-aux &&
- ln install-sh move-if-change ../${tempdir}/build-aux &&
- ln update-copyright update-subdirs ../${tempdir}/build-aux &&
- ln dir_top make-info-dir ../${tempdir}/build-aux &&
-:) || exit
-
-echo "Making links to 'src'"
-### Don't distribute the configured versions of
-### config.in, paths.in, buildobj.h, or Makefile.in.
-(cd src &&
- ln [a-zA-Z]*.[chm] ../${tempdir}/src &&
- ln [a-zA-Z]*.in ../${tempdir}/src &&
- ln deps.mk ../${tempdir}/src &&
- ln README ChangeLog.*[0-9] ../${tempdir}/src &&
- ln .gdbinit .dbxinit ../${tempdir}/src &&
- cd ../${tempdir}/src &&
- rm -f globals.h config.h epaths.h Makefile buildobj.h &&
-:) || exit
-
-echo "Making links to 'src/bitmaps'"
-(cd src/bitmaps &&
- ln README *.xbm ../../${tempdir}/src/bitmaps &&
-:) || exit
-
-echo "Making links to 'lib'"
-(cd lib &&
- ln [a-zA-Z_]*.[ch] ../${tempdir}/lib &&
- ln gnulib.mk.in Makefile.in ../${tempdir}/lib &&
- cd ../${tempdir}/lib &&
- script='/[*]/d; s/\.in\.h$/.h/' &&
- rm -f `ls *.in.h | sed "$script"` &&
-:) || exit
-
-echo "Making links to 'lib-src'"
-(cd lib-src &&
- ln [a-zA-Z]*.[ch] ../${tempdir}/lib-src &&
- ln ChangeLog.*[0-9] Makefile.in README ../${tempdir}/lib-src &&
- ln rcs2log ../${tempdir}/lib-src &&
-:) || exit
-
-echo "Making links to 'm4'"
-(cd m4 &&
- ln *.m4 ../${tempdir}/m4 &&
-:) || exit
-
-echo "Making links to 'modules'"
-(cd modules &&
- ln *.py ../${tempdir}/modules &&
-:) || exit
-
-echo "Making links to 'nt'"
-(cd nt &&
- ln emacs-x86.manifest emacs-x64.manifest ../${tempdir}/nt &&
- ln [a-z]*.bat [a-z]*.[ch] ../${tempdir}/nt &&
- ln *.in gnulib-cfg.mk ../${tempdir}/nt &&
- ln mingw-cfg.site epaths.nt INSTALL.W64 ../${tempdir}/nt &&
- ln ChangeLog.*[0-9] INSTALL README README.W32 ../${tempdir}/nt &&
-:) || exit
-
-echo "Making links to 'nt/inc' and its subdirectories"
-for f in `find nt/inc -type f -name '[a-z]*.h'`; do
-  ln $f $tempdir/$f || exit
-done
-
-echo "Making links to 'nt/icons'"
-(cd nt/icons &&
- ln README [a-z]*.ico ../../${tempdir}/nt/icons &&
- ln [a-z]*.cur ../../${tempdir}/nt/icons &&
-:) || exit
-
-echo "Making links to 'msdos'"
-(cd msdos &&
- ln ChangeLog.*[0-9] INSTALL README emacs.ico emacs.pif ../${tempdir}/msdos &&
- ln depfiles.bat inttypes.h ../${tempdir}/msdos &&
- ln mainmake.v2 sed*.inp ../${tempdir}/msdos &&
-:) || exit
-
-echo "Making links to 'nextstep'"
-(cd nextstep &&
- ln ChangeLog.*[0-9] README INSTALL Makefile.in ../${tempdir}/nextstep &&
-:) || exit
-
-echo "Making links to 'nextstep/templates'"
-(cd nextstep/templates &&
- ln Emacs.desktop.in Info-gnustep.plist.in Info.plist.in InfoPlist.strings.in \
-   ../../${tempdir}/nextstep/templates &&
-:) || exit
-
-echo "Making links to 'nextstep/Cocoa/Emacs.base/Contents'"
-(cd nextstep/Cocoa/Emacs.base/Contents &&
- ln PkgInfo ../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents &&
-:) || exit
-
-echo "Making links to 'nextstep/Cocoa/Emacs.base/Contents/Resources'"
-(cd nextstep/Cocoa/Emacs.base/Contents/Resources &&
- ln Credits.html *.icns \
-   ../../../../../${tempdir}/nextstep/Cocoa/Emacs.base/Contents/Resources &&
-:) || exit
-
-echo "Making links to 'nextstep/GNUstep/Emacs.base/Resources'"
-(cd nextstep/GNUstep/Emacs.base/Resources &&
- ln README emacs.tiff \
-   ../../../../${tempdir}/nextstep/GNUstep/Emacs.base/Resources &&
-:) || exit
-
-echo "Making links to 'oldXMenu'"
-(cd oldXMenu &&
- ln *.[ch] *.in *.mk ../${tempdir}/oldXMenu &&
- ln README ChangeLog.*[0-9] ../${tempdir}/oldXMenu &&
-:) || exit
-
-echo "Making links to 'lwlib'"
-(cd lwlib &&
- ln *.[ch] *.in *.mk ../${tempdir}/lwlib &&
- ln README ChangeLog.*[0-9] ../${tempdir}/lwlib &&
-:) || exit
-
-## It is important to distribute admin/ because it contains sources
-## for generated lisp/international/uni-*.el files.
-echo "Making links to 'admin' and its subdirectories"
-for f in `find admin -type f`; do
-  case $f in
-    */Makefile) [ -f $f.in ] && continue ;;
-  esac
-  ln $f $tempdir/$f || exit
-done
-
-if [ "$with_tests" = "yes" ]; then
-  echo "Making links to 'test' and its subdirectories"
-  for f in `find test -type f ! -name '*.log' ! -name a.out \
-             ! -name '*.so' ! -name '*.dll' ! -name '*.o'
-  `; do
-    case $f in
-        */Makefile) [ -f $f.in ] && continue ;;
-    esac
-    ln $f $tempdir/$f || exit
-  done
-fi
-
-echo "Making links to 'etc' and its subdirectories"
-for f in `find etc -type f`; do
-  case $f in
-    etc/DOC*|etc/*.pyc) continue ;;
-    ## Arguably we should not exclude *.ps.
-    etc/refcards/*.aux|etc/refcards/*.dvi|etc/refcards/*.log|etc/refcards/*.ps)
-      continue ;;
+    MANIFEST) ln $manifest $tempdir/MANIFEST || exit ;;
+    $file_to_skip) continue ;;
+    *) ln $file $tempdir/$file || exit ;;
   esac
-  ln $f $tempdir/$f || exit
-done
-
-if [ "$with_info" = "yes" ]; then
-  echo "Making links to 'info'"
-  ln `find info -type f -print` ${tempdir}/info || exit
-fi
-
-echo "Making links to 'doc/emacs'"
-(cd doc/emacs &&
- ln *.texi *.in ChangeLog.*[0-9] ../../${tempdir}/doc/emacs &&
-:) || exit
-
-echo "Making links to 'doc/misc'"
-(cd doc/misc &&
- ln *.texi *.tex *.in gnus-news.el ChangeLog.*[0-9] \
-   ../../${tempdir}/doc/misc &&
-:) || exit
-
-echo "Making links to 'doc/lispref'"
-(cd doc/lispref &&
- ln *.texi *.in README ChangeLog.*[0-9] ../../${tempdir}/doc/lispref &&
- ln spellfile ../../${tempdir}/doc/lispref &&
- ln two-volume.make two-volume-cross-refs.txt ../../${tempdir}/doc/lispref &&
-:) || exit
-
-echo "Making links to 'doc/lispintro'"
-(cd doc/lispintro &&
- ln *.texi *.in *.eps *.pdf ../../${tempdir}/doc/lispintro &&
- ln README ChangeLog.*[0-9] ../../${tempdir}/doc/lispintro &&
- cd ../../${tempdir}/doc/lispintro &&
-:) || exit
-
-echo "Making links to 'doc/man'"
-(cd doc/man &&
- ln *.*[0-9] *.in ../../${tempdir}/doc/man &&
- cd ../../${tempdir}/doc/man &&
- rm -f emacs.1 &&
-:) || exit
-
-### It would be nice if they could all be symlinks to top-level copy, but
-### you're not supposed to have any symlinks in distribution tar files.
-echo "Making sure copying notices are all copies of 'COPYING'"
-for subdir in . etc leim lib lib-src lisp lwlib msdos nt src; do
-  rm -f ${tempdir}/${subdir}/COPYING || exit
-  cp COPYING ${tempdir}/${subdir} || exit
-done
+done <$manifest
 
 if [ "${newer}" ]; then
   printf '%s\n' "Removing files older than $newer"
   ## We remove .elc files unconditionally, on the theory that anyone picking
   ## up an incremental distribution already has a running Emacs to byte-compile
   ## them with.
-  find ${tempparent} \( -name '*.elc' -o ! -newer ${newer} \) \
+  find ${tempdir} \( -name '*.elc' -o ! -newer ${newer} \) \
     -exec rm -f {} \; || exit
 fi
 
-## Don't distribute backups, autosaves, etc.
-echo "Removing unwanted files"
-find ${tempparent} \( -name '*~' -o -name '#*#' -o -name '.*ignore' -o -name 
'=*' -o -name 'TAGS' \) -exec rm -f {} \; || exit
-
 if [ "${make_tar}" = yes ]; then
   echo "Looking for $default_gzip"
   found=0
@@ -685,7 +498,7 @@ if [ "${make_tar}" = yes ]; then
   esac
   echo "Creating tar file"
   taropt='--numeric-owner --owner=0 --group=0 --mode=go+u,go-w'
-  tar --sort=name -cf /dev/null $tempparent/$emacsname/src/lisp.h 2>/tmp/out &&
+  tar --sort=name -cf /dev/null $tempdir/src/lisp.h 2>/dev/null &&
     taropt="$taropt --sort=name"
   [ "$verbose" = "yes" ] && taropt="$taropt --verbose"
 
@@ -693,7 +506,7 @@ if [ "${make_tar}" = yes ]; then
    case $default_gzip in
      cat) tar $taropt -cf - $emacsname;;
      *) if tar $taropt -cf /dev/null --use-compress-program="$default_gzip" \
-              $emacsname/src/lisp.h
+              $emacsname/src/lisp.h > /dev/null 2>&1
        then
          tar $taropt -cf - --use-compress-program="$default_gzip" $emacsname
        else
@@ -704,9 +517,12 @@ if [ "${make_tar}" = yes ]; then
   ) >$emacsname.tar$gzip_extension || exit
 fi
 
+## Why are we deleting the staging directory if clean_up is no?
 if [ "${clean_up}" != yes ]; then
   (cd ${tempparent} && mv ${emacsname} ..) &&
   rm -rf ${tempparent}
 fi
 
-### make-dist ends here
+# Local Variables:
+# sh-basic-offset: 2
+# End:
diff --git a/modules/modhelp.py b/modules/modhelp.py
index f307dd4..e1c5a91 100755
--- a/modules/modhelp.py
+++ b/modules/modhelp.py
@@ -2,7 +2,7 @@
 
 # Module helper script.
 
-# Copyright 2015-2018 Free Software Foundation, Inc.
+# Copyright 2015-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/msdos/ChangeLog.1 b/msdos/ChangeLog.1
index 603f507..fa3477f 100644
--- a/msdos/ChangeLog.1
+++ b/msdos/ChangeLog.1
@@ -1550,7 +1550,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1994-1999, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1994-1999, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/msdos/INSTALL b/msdos/INSTALL
index 3707f43..daae992 100644
--- a/msdos/INSTALL
+++ b/msdos/INSTALL
@@ -1,6 +1,6 @@
 GNU Emacs Installation Guide for the DJGPP (a.k.a. MS-DOS) port
 
-Copyright (C) 1992, 1994, 1996-1997, 2000-2018 Free Software Foundation,
+Copyright (C) 1992, 1994, 1996-1997, 2000-2019 Free Software Foundation,
 Inc.
 See the end of the file for license conditions.
 
diff --git a/msdos/README b/msdos/README
index d1c2fda..75ae2c0 100644
--- a/msdos/README
+++ b/msdos/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
@@ -10,7 +10,7 @@ The files emacs.ico and emacs.pif are for using the DJGPP 
version on
 Windows 3.X.  Since these are binary files, their copyright notice is
 reproduced here:
 
-# Copyright (C) 1993, 2002-2018 Free Software Foundation, Inc.
+# Copyright (C) 1993, 2002-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/autogen/Makefile.in b/msdos/autogen/Makefile.in
index dae66e8..5d6ff70 100644
--- a/msdos/autogen/Makefile.in
+++ b/msdos/autogen/Makefile.in
@@ -1,7 +1,7 @@
 # Makefile.in generated by automake 1.11.1 from Makefile.am.
 # @configure_input@
 
-# Copyright (C) 1994-2009, 2013-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-2009, 2013-2019 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -13,7 +13,7 @@
 
 @SET_MAKE@
 
-# Copyright (C) 2002-2018 Free Software Foundation, Inc.
+# Copyright (C) 2002-2019 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@
 # Generated by gnulib-tool.
 # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib 
--m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux 
--avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix 
--avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die 
--avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select 
--avoid=sigprocmask --avoid=sys_types --avoid=threadlib 
--makefile-name=gnulib.mk --conditional-dependencies --no-libtool 
--macro-prefix=gl [...]
 
-# Copyright (C) 2002-2018 Free Software Foundation, Inc.
+# Copyright (C) 2002-2019 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/msdos/autogen/config.in b/msdos/autogen/config.in
index 3784897..6a18ff9 100644
--- a/msdos/autogen/config.in
+++ b/msdos/autogen/config.in
@@ -2,7 +2,7 @@
 
 /* GNU Emacs site configuration template file.
 
-Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2018 Free Software
+Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/msdos/depfiles.bat b/msdos/depfiles.bat
index 5330f2b..e99c967 100644
--- a/msdos/depfiles.bat
+++ b/msdos/depfiles.bat
@@ -1,7 +1,7 @@
 @echo off
 rem   ----------------------------------------------------------------------
 rem   Auxiliary script for MSDOS, run by ../config.bat
-rem   Copyright (C) 2011-2018 Free Software Foundation, Inc.
+rem   Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 rem   This file is part of GNU Emacs.
 
diff --git a/msdos/inttypes.h b/msdos/inttypes.h
index 7df4f6f..5c073fc 100644
--- a/msdos/inttypes.h
+++ b/msdos/inttypes.h
@@ -1,6 +1,6 @@
 /* Replacement inttypes.h file for building GNU Emacs on MS-DOS with DJGPP.
 
-Copyright (C) 2011-2018 Free Software Foundation, Inc.
+Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/msdos/mainmake.v2 b/msdos/mainmake.v2
index 9be2f6e..08086d6 100644
--- a/msdos/mainmake.v2
+++ b/msdos/mainmake.v2
@@ -1,6 +1,6 @@
 # Top-level Makefile for Emacs under MS-DOS/DJGPP v2.0 or higher. 
-*-makefile-*-
 
-# Copyright (C) 1996-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/msdos/sed1v2.inp b/msdos/sed1v2.inp
index 8505656..9edd4d4 100644
--- a/msdos/sed1v2.inp
+++ b/msdos/sed1v2.inp
@@ -2,7 +2,7 @@
 # Configuration script for src/Makefile under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1996-1997, 1999-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996-1997, 1999-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sed1x.inp b/msdos/sed1x.inp
index 14d0e48..23aa28e 100644
--- a/msdos/sed1x.inp
+++ b/msdos/sed1x.inp
@@ -2,7 +2,7 @@
 # Extra configuration script for src/makefile for DesqView/X
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1994-1997, 1999-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994-1997, 1999-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sed2v2.inp b/msdos/sed2v2.inp
index d654405..39cffdb 100644
--- a/msdos/sed2v2.inp
+++ b/msdos/sed2v2.inp
@@ -2,7 +2,7 @@
 # Configuration script for src/config.h under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1993-1997, 1999-2000, 2002-2018 Free Software
+# Copyright (C) 1993-1997, 1999-2000, 2002-2019 Free Software
 # Foundation, Inc.
 #
 # This file is part of GNU Emacs.
@@ -27,7 +27,7 @@
 #ifndef MSDOS\
 #define MSDOS\
 #endif
-/^#undef COPYRIGHT *$/s/^.*$/#define COPYRIGHT "Copyright (C) 2018 Free 
Software Foundation, Inc."/
+/^#undef COPYRIGHT *$/s/^.*$/#define COPYRIGHT "Copyright (C) 2019 Free 
Software Foundation, Inc."/
 /^#undef DIRECTORY_SEP *$/s!^.*$!#define DIRECTORY_SEP '/'!
 /^#undef DOS_NT *$/s/^.*$/#define DOS_NT/
 /^#undef FLOAT_CHECK_DOMAIN *$/s/^.*$/#define FLOAT_CHECK_DOMAIN/
diff --git a/msdos/sed2x.inp b/msdos/sed2x.inp
index 7b0f706..695c0b2 100644
--- a/msdos/sed2x.inp
+++ b/msdos/sed2x.inp
@@ -2,7 +2,7 @@
 # Extra configuration script for src/config.h for DesqView/X
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sed3v2.inp b/msdos/sed3v2.inp
index 8311d08..952481f 100644
--- a/msdos/sed3v2.inp
+++ b/msdos/sed3v2.inp
@@ -2,7 +2,7 @@
 # Configuration script for lib-src/makefile under DJGPP v2
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1996, 1998, 2000-2018 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1998, 2000-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sed4.inp b/msdos/sed4.inp
index 8e96168..520df66 100644
--- a/msdos/sed4.inp
+++ b/msdos/sed4.inp
@@ -2,7 +2,7 @@
 # Configuration script for src/paths.h
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sed5x.inp b/msdos/sed5x.inp
index 5d99006..bb8fe9b 100644
--- a/msdos/sed5x.inp
+++ b/msdos/sed5x.inp
@@ -2,7 +2,7 @@
 # Configuration script for oldxmenu/makefile for DesqView/X
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+# Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sed6.inp b/msdos/sed6.inp
index 1dbb2df..c1b5b16 100644
--- a/msdos/sed6.inp
+++ b/msdos/sed6.inp
@@ -3,7 +3,7 @@
 # doc/lispintro/Makefile, and doc/misc/Makefile under DJGPP v2.x
 # ---------------------------------------------------------------------------
 #
-# Copyright (C) 1997, 2000-2018 Free Software Foundation, Inc.
+# Copyright (C) 1997, 2000-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sedadmin.inp b/msdos/sedadmin.inp
index 111b5e2..bd63fe5 100644
--- a/msdos/sedadmin.inp
+++ b/msdos/sedadmin.inp
@@ -2,7 +2,7 @@
 # Configuration script for admin/unidata/Makefile under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 2014-2018 Free Software Foundation, Inc.
+# Copyright (C) 2014-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sedalloc.inp b/msdos/sedalloc.inp
index cdd1d56..6721196 100644
--- a/msdos/sedalloc.inp
+++ b/msdos/sedalloc.inp
@@ -2,7 +2,7 @@
 # Configuration script for SYSTEM_MALLOC/REL_ALLOC in src/config.h
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 2008-2018 Free Software Foundation, Inc.
+# Copyright (C) 2008-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sedleim.inp b/msdos/sedleim.inp
index 8435432..9384eca 100644
--- a/msdos/sedleim.inp
+++ b/msdos/sedleim.inp
@@ -2,7 +2,7 @@
 # Configuration script for leim/Makefile under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 1999-2018 Free Software Foundation, Inc.
+# Copyright (C) 1999-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sedlibcf.inp b/msdos/sedlibcf.inp
index c743159..5785a61 100644
--- a/msdos/sedlibcf.inp
+++ b/msdos/sedlibcf.inp
@@ -5,7 +5,7 @@
 # files whose names are invalid on DOS 8+3 filesystems.
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 2011-2018 Free Software Foundation, Inc.
+# Copyright (C) 2011-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sedlibmk.inp b/msdos/sedlibmk.inp
index 9b66a4c..df9e8d3 100644
--- a/msdos/sedlibmk.inp
+++ b/msdos/sedlibmk.inp
@@ -2,7 +2,7 @@
 # Configuration script for lib/Makefile under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 2011-2018 Free Software Foundation, Inc.
+# Copyright (C) 2011-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/msdos/sedlisp.inp b/msdos/sedlisp.inp
index 0fcef03..dc17740 100644
--- a/msdos/sedlisp.inp
+++ b/msdos/sedlisp.inp
@@ -2,7 +2,7 @@
 # Configuration script for lisp/Makefile under DJGPP v2.x
 # ----------------------------------------------------------------------
 #
-# Copyright (C) 2000-2018 Free Software Foundation, Inc.
+# Copyright (C) 2000-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
diff --git a/nextstep/ChangeLog.1 b/nextstep/ChangeLog.1
index af3680c..dbbe23f 100644
--- a/nextstep/ChangeLog.1
+++ b/nextstep/ChangeLog.1
@@ -312,7 +312,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2008-2018 Free Software Foundation, Inc.
+  Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/nextstep/INSTALL b/nextstep/INSTALL
index 64f8f8f..f287eb7 100644
--- a/nextstep/INSTALL
+++ b/nextstep/INSTALL
@@ -1,4 +1,4 @@
-Copyright (C) 2008-2018 Free Software Foundation, Inc.
+Copyright (C) 2008-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
@@ -45,6 +45,35 @@ files will be installed under whatever 'prefix' is set to 
(defaults to
 require 'sudo' for "make install").
 
 
+Targeting different macOS versions
+----------------------------------
+
+The Emacs build process automatically enables or disables macOS
+features according to the version of macOS it is being built on.  It
+is possible to override this automatic configuration if you are
+targeting a different version of macOS, or wish to build one
+executable that is able to enable or disable features at run-time.
+
+To build a version compatible with an older version of macOS use this
+flag:
+
+  -DMAC_OS_X_VERSION_MIN_REQUIRED=x
+
+and to build for a newer version of macOS:
+
+  -DMAC_OS_X_VERSION_MAX_ALLOWED=x
+
+For example, to enable run-time checks for features available between
+macOS 10.6, and 10.12 inclusive:
+
+  ./configure --with-ns CFLAGS="-DMAC_OS_X_VERSION_MIN_REQUIRED=1060 \
+    -DMAC_OS_X_VERSION_MAX_ALLOWED=101200 -g3 -O2"
+
+The macOS version numbers are formatted as 10x0 for macOS up to 10.10,
+and 10xx00 for macOS 10.10 and above.  A full list is provided in
+/usr/include/AvailabilityMacros.h.
+
+
 Installation
 ------------
 
diff --git a/nextstep/Makefile.in b/nextstep/Makefile.in
index cb69898..4eda9f4 100644
--- a/nextstep/Makefile.in
+++ b/nextstep/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-## Copyright (C) 2012-2018 Free Software Foundation, Inc.
+## Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ## This file is part of GNU Emacs.
 
@@ -44,7 +44,7 @@ ns_check_file = @ns_appdir@/@ns_check_file@
 
 .PHONY: all
 
-all: ${ns_appdir} ${ns_appbindir}/Emacs
+all: ${ns_appdir} ${ns_appbindir}/Emacs ${ns_appbindir}/emacs.pdmp
 
 ${ns_check_file} ${ns_appdir}: ${srcdir}/${ns_appsrc} ${ns_appsrc}
        rm -rf ${ns_appdir}
@@ -63,6 +63,10 @@ ${ns_appbindir}/Emacs: ${ns_appdir} ${ns_check_file} 
../src/emacs${EXEEXT}
        ${MKDIR_P} ${ns_appbindir}
        cp -f ../src/emacs${EXEEXT} $@
 
+${ns_appbindir}/emacs.pdmp: ${ns_appdir} ${ns_check_file} 
../src/emacs${EXEEXT}.pdmp
+       ${MKDIR_P} ${ns_appbindir}
+       cp -f ../src/emacs${EXEEXT}.pdmp $@
+
 .PHONY: FORCE
 
 ../src/emacs${EXEEXT}: FORCE
@@ -81,6 +85,7 @@ links: ../src/emacs${EXEEXT}
        ln -s $(top_srcdir_abs)/info ${ns_appdir}/Contents/Resources
        ${MKDIR_P} ${ns_appbindir}
        ln -s $(abs_top_builddir)/src/emacs${EXEEXT} ${ns_appbindir}/Emacs
+       ln -s $(abs_top_builddir)/src/emacs${EXEEXT}.pdmp ${ns_appbindir}/
        ln -s $(abs_top_builddir)/lib-src ${ns_appbindir}/bin
        ln -s $(abs_top_builddir)/lib-src ${ns_appbindir}/libexec
        ${MKDIR_P} ${ns_appdir}/Contents/Resources/etc
diff --git a/nextstep/README b/nextstep/README
index 66426f7..83e21e6 100644
--- a/nextstep/README
+++ b/nextstep/README
@@ -105,7 +105,7 @@ future development.
 
 
 ----------------------------------------------------------------------
-Copyright 2008-2018 Free Software Foundation, Inc.
+Copyright 2008-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nextstep/templates/Info.plist.in b/nextstep/templates/Info.plist.in
index 406d6f7..c1e50a8 100644
--- a/nextstep/templates/Info.plist.in
+++ b/nextstep/templates/Info.plist.in
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!--
-Copyright (C) 2008-2018 Free Software Foundation, Inc.
+Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/ChangeLog.1 b/nt/ChangeLog.1
index 48171af..59b3822 100644
--- a/nt/ChangeLog.1
+++ b/nt/ChangeLog.1
@@ -3548,7 +3548,7 @@
 ;; add-log-time-zone-rule: t
 ;; End:
 
-  Copyright (C) 1995-1999, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1995-1999, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/nt/INSTALL b/nt/INSTALL
index 6706942..3e617f2 100644
--- a/nt/INSTALL
+++ b/nt/INSTALL
@@ -1,7 +1,7 @@
                    Building and Installing Emacs on MS-Windows
                           using the MSYS and MinGW tools
 
-  Copyright (C) 2013-2018 Free Software Foundation, Inc.
+  Copyright (C) 2013-2019 Free Software Foundation, Inc.
   See the end of the file for license conditions.
 
 The MSYS/MinGW build described here is supported on versions of
diff --git a/nt/INSTALL.W64 b/nt/INSTALL.W64
index c3aa85e..994c567 100644
--- a/nt/INSTALL.W64
+++ b/nt/INSTALL.W64
@@ -1,7 +1,7 @@
          Building and Installing Emacs on 64-bit MS-Windows
                      using MSYS2 and MinGW-w64
 
-  Copyright (c) 2015-2018 Free Software Foundation, Inc.
+  Copyright (c) 2015-2019 Free Software Foundation, Inc.
   See the end of the file for license conditions.
 
 This document describes how to compile a 64-bit GNU Emacs using MSYS2
diff --git a/nt/Makefile.in b/nt/Makefile.in
index 0b2e72e..36e5243 100644
--- a/nt/Makefile.in
+++ b/nt/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 2013-2018 Free Software Foundation, Inc.
+# Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
diff --git a/nt/README b/nt/README
index c75e369..de68162 100644
--- a/nt/README
+++ b/nt/README
@@ -1,6 +1,6 @@
             Emacs for Windows NT/2000 and Windows 95/98/ME
 
-  Copyright (C) 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 2001-2019 Free Software Foundation, Inc.
   See the end of the file for license conditions.
 
   This directory contains support for compiling and running GNU Emacs on
diff --git a/nt/README.W32 b/nt/README.W32
index f0147b4..0fac1c3 100644
--- a/nt/README.W32
+++ b/nt/README.W32
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
                Emacs version 27.0.50 for MS-Windows
diff --git a/nt/addpm.c b/nt/addpm.c
index 2132020..f71ce5f 100644
--- a/nt/addpm.c
+++ b/nt/addpm.c
@@ -1,5 +1,5 @@
 /* Add entries to the GNU Emacs Program Manager folder.
-   Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/cmdproxy.c b/nt/cmdproxy.c
index 82d3d8b..0b72bcd 100644
--- a/nt/cmdproxy.c
+++ b/nt/cmdproxy.c
@@ -1,5 +1,5 @@
 /* Proxy shell designed for use with Emacs on Windows 95 and NT.
-   Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 
    Accepts subset of Unix sh(1) command-line options, for compatibility
    with elisp code written for Unix.  When possible, executes external
diff --git a/nt/configure.bat b/nt/configure.bat
index 708ff43..09a3594 100755
--- a/nt/configure.bat
+++ b/nt/configure.bat
@@ -1,7 +1,7 @@
 @echo off
 rem   ----------------------------------------------------------------------
 rem   This was the old configuration script for MS Windows operating systems
-rem   Copyright (C) 1999-2018 Free Software Foundation, Inc.
+rem   Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 rem   This file is part of GNU Emacs.
 
diff --git a/nt/ddeclient.c b/nt/ddeclient.c
index 221e182..e441700 100644
--- a/nt/ddeclient.c
+++ b/nt/ddeclient.c
@@ -1,5 +1,5 @@
 /* Simple client interface to DDE servers.
-   Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/emacs.rc.in b/nt/emacs.rc.in
index 1cf40ba..71346db 100644
--- a/nt/emacs.rc.in
+++ b/nt/emacs.rc.in
@@ -31,7 +31,7 @@ BEGIN
            VALUE "FileDescription", "GNU Emacs: The extensible 
self-documenting text editor\0"
            VALUE "FileVersion", "@address@hidden"
            VALUE "InternalName", "Emacs\0"
-           VALUE "LegalCopyright", "Copyright (C) 2001-2018\0"
+           VALUE "LegalCopyright", "Copyright (C) 2001-2019\0"
            VALUE "OriginalFilename", "emacs.exe"
            VALUE "ProductName", "Emacs\0"
            VALUE "ProductVersion", "@address@hidden"
diff --git a/nt/emacsclient.rc.in b/nt/emacsclient.rc.in
index 770f665..fac7f66 100644
--- a/nt/emacsclient.rc.in
+++ b/nt/emacsclient.rc.in
@@ -25,7 +25,7 @@ BEGIN
            VALUE "FileDescription", "GNU EmacsClient: Client for the 
extensible self-documenting text editor\0"
            VALUE "FileVersion", "@address@hidden"
            VALUE "InternalName", "EmacsClient\0"
-           VALUE "LegalCopyright", "Copyright (C) 2001-2018\0"
+           VALUE "LegalCopyright", "Copyright (C) 2001-2019\0"
            VALUE "OriginalFilename", "emacsclientw.exe"
            VALUE "ProductName", "EmacsClient\0"
            VALUE "ProductVersion", "@address@hidden"
diff --git a/nt/epaths.nt b/nt/epaths.nt
index 393af21..152184c 100644
--- a/nt/epaths.nt
+++ b/nt/epaths.nt
@@ -12,7 +12,7 @@
    the host system (e.g., i686-pc-mingw32), and @SRC@ by the root of
    the Emacs source tree used to build Emacs.  */
 /*
-Copyright (C) 1993, 1995, 1997, 1999, 2001-2018 Free Software
+Copyright (C) 1993, 1995, 1997, 1999, 2001-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/nt/gnulib-cfg.mk b/nt/gnulib-cfg.mk
index 21d4233..09cd582 100644
--- a/nt/gnulib-cfg.mk
+++ b/nt/gnulib-cfg.mk
@@ -1,6 +1,6 @@
 # Configurations for ../lib/gnulib.mk.
 #
-# Copyright 2017-2018 Free Software Foundation, Inc.
+# Copyright 2017-2019 Free Software Foundation, Inc.
 #
 # This file is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
diff --git a/nt/icons/README b/nt/icons/README
index a82e04f..86765f9 100644
--- a/nt/icons/README
+++ b/nt/icons/README
@@ -2,13 +2,13 @@ COPYRIGHT AND LICENSE INFORMATION FOR IMAGE FILES
 
 File: emacs.ico
 Author: Kentaro Ohkouchi <address@hidden>
-Copyright (C) 2008-2018 Free Software Foundation, Inc.
+Copyright (C) 2008-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later
 
 
 File: emacs22.ico
 Author: Andrew Zhilin
-Copyright (C) 2005-2018 Free Software Foundation, Inc.
+Copyright (C) 2005-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
 
 
@@ -17,7 +17,7 @@ Files: gnu2a32.ico gnu2a32t.ico gnu2b48.ico gnu2b48t.ico
        gnu5w32.ico gnu5w32t.ico gnu6w48.ico gnu6w48t.ico
        gnu7.ico    gnu8.ico     gnu9.ico
 Author: Rob Davenport <rgd at bigfoot.com>
-Copyright (C) 1999, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1999, 2001-2019 Free Software Foundation, Inc.
 License: GNU General Public License version 3 or later (see COPYING)
 
   <http://users.adelphia.net/~rob.davenport/gnuicons.html>
diff --git a/nt/inc/grp.h b/nt/inc/grp.h
index db40862..e78a63e 100644
--- a/nt/inc/grp.h
+++ b/nt/inc/grp.h
@@ -1,6 +1,6 @@
 /* Replacement grp.h file for building GNU Emacs on Windows.
 
-Copyright (C) 2003-2018 Free Software Foundation, Inc.
+Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/inttypes.h b/nt/inc/inttypes.h
index ac09ae5..ae76b8c 100644
--- a/nt/inc/inttypes.h
+++ b/nt/inc/inttypes.h
@@ -1,6 +1,6 @@
 /* Replacement inttypes.h file for building GNU Emacs on Windows with MSVC.
 
-Copyright (C) 2011-2018 Free Software Foundation, Inc.
+Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/langinfo.h b/nt/inc/langinfo.h
index 99773a2..6c4959e 100644
--- a/nt/inc/langinfo.h
+++ b/nt/inc/langinfo.h
@@ -1,6 +1,6 @@
 /* Replacement langinfo.h file for building GNU Emacs on Windows.
 
-Copyright (C) 2006-2018 Free Software Foundation, Inc.
+Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -27,6 +27,7 @@ enum {
   DAY_1, DAY_2, DAY_3, DAY_4, DAY_5, DAY_6, DAY_7,
   MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7, MON_8, MON_9, MON_10,
   MON_11, MON_12,
+  _NL_PAPER_WIDTH, _NL_PAPER_HEIGHT,
 
   /* Number of enumerated values.  */
   _NL_NUM
@@ -55,6 +56,9 @@ enum {
 #define MON_11 MON_11
 #define MON_12 MON_12
 
+#define _NL_PAPER_WIDTH  _NL_PAPER_WIDTH
+#define _NL_PAPER_HEIGHT _NL_PAPER_HEIGHT
+
 extern char *nl_langinfo (nl_item);
 
 #endif /* _LANGINFO_H */
diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h
index e4dec04..7de94ca 100644
--- a/nt/inc/ms-w32.h
+++ b/nt/inc/ms-w32.h
@@ -1,6 +1,6 @@
 /* System description file for Windows NT.
 
-Copyright (C) 1993-1995, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1993-1995, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -311,7 +311,7 @@ extern int execve (const char *, char * const *, char * 
const *);
 #else
 extern intptr_t execve (const char *, char * const *, char * const *);
 #endif
-#define fdatasync _commit
+#define tcdrain _commit
 #define fdopen   _fdopen
 #define fsync    _commit
 #define ftruncate _chsize
diff --git a/nt/inc/nl_types.h b/nt/inc/nl_types.h
index 38082d9..a13309b 100644
--- a/nt/inc/nl_types.h
+++ b/nt/inc/nl_types.h
@@ -1,6 +1,6 @@
 /* Replacement nl_types.h file for building GNU Emacs on Windows.
 
-Copyright (C) 2006-2018 Free Software Foundation, Inc.
+Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/stdint.h b/nt/inc/stdint.h
index 38fd4d0..cb7b9f7 100644
--- a/nt/inc/stdint.h
+++ b/nt/inc/stdint.h
@@ -1,6 +1,6 @@
 /* Replacement stdint.h file for building GNU Emacs on Windows.
 
-Copyright (C) 2011-2018 Free Software Foundation, Inc.
+Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/sys/resource.h b/nt/inc/sys/resource.h
index 5c4f792..c565055 100644
--- a/nt/inc/sys/resource.h
+++ b/nt/inc/sys/resource.h
@@ -1,6 +1,6 @@
 /* A limited emulation of sys/resource.h.
 
-Copyright (C) 2016-2018 Free Software Foundation, Inc.
+Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/sys/socket.h b/nt/inc/sys/socket.h
index de282c4..6d26ff9 100644
--- a/nt/inc/sys/socket.h
+++ b/nt/inc/sys/socket.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/sys/stat.h b/nt/inc/sys/stat.h
index 0b1f9bc..31ad872 100644
--- a/nt/inc/sys/stat.h
+++ b/nt/inc/sys/stat.h
@@ -1,7 +1,7 @@
 /* sys/stat.h supplied with MSVCRT uses too narrow data types for
    inode and user/group id, so we replace them with our own.
 
-Copyright (C) 2008-2018 Free Software Foundation, Inc.
+Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/inc/sys/wait.h b/nt/inc/sys/wait.h
index 9c86eb8..0b756a3 100644
--- a/nt/inc/sys/wait.h
+++ b/nt/inc/sys/wait.h
@@ -1,6 +1,6 @@
 /* A limited emulation of sys/wait.h on Posix systems.
 
-Copyright (C) 2012-2018 Free Software Foundation, Inc.
+Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/mingw-cfg.site b/nt/mingw-cfg.site
index d9a8240..4df2049 100644
--- a/nt/mingw-cfg.site
+++ b/nt/mingw-cfg.site
@@ -109,6 +109,7 @@ gl_cv_func_pthread_sigmask_return_works=yes
 gl_cv_func_pthread_sigmask_unblock_works="not relevant"
 # Implemented in w32proc.c
 emacs_cv_langinfo_codeset=yes
+emacs_cv_langinfo__nl_paper_width=yes
 # Declared in ms-w32.h
 ac_cv_have_decl_alarm=yes
 # Avoid including the gnulib dup2 module
diff --git a/nt/preprep.c b/nt/preprep.c
index 8979e33..f0f6273 100644
--- a/nt/preprep.c
+++ b/nt/preprep.c
@@ -1,5 +1,5 @@
 /* Pre-process emacs.exe for profiling by MSVC.
-   Copyright (C) 1999, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/nt/runemacs.c b/nt/runemacs.c
index 46e467e..34833e9 100644
--- a/nt/runemacs.c
+++ b/nt/runemacs.c
@@ -1,6 +1,6 @@
 /* runemacs --- Simple program to start Emacs with its console window hidden.
 
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/oldXMenu/Activate.c b/oldXMenu/Activate.c
index 8a35e6e..a0d1f70 100644
--- a/oldXMenu/Activate.c
+++ b/oldXMenu/Activate.c
@@ -3,7 +3,7 @@
 #include "copyright.h"
 
 /*
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/oldXMenu/ChangeLog.1 b/oldXMenu/ChangeLog.1
index 44387d1..0e76897 100644
--- a/oldXMenu/ChangeLog.1
+++ b/oldXMenu/ChangeLog.1
@@ -712,7 +712,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993-1999, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1993-1999, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/oldXMenu/Create.c b/oldXMenu/Create.c
index c60bc5f..2ea84e9 100644
--- a/oldXMenu/Create.c
+++ b/oldXMenu/Create.c
@@ -3,7 +3,7 @@
 #include "copyright.h"
 
 /*
-Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/oldXMenu/FindSel.c b/oldXMenu/FindSel.c
index 2b3d281..af08410 100644
--- a/oldXMenu/FindSel.c
+++ b/oldXMenu/FindSel.c
@@ -3,7 +3,7 @@
 #include "copyright.h"
 
 /*
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/oldXMenu/Internal.c b/oldXMenu/Internal.c
index 912cb7d..074e4f9 100644
--- a/oldXMenu/Internal.c
+++ b/oldXMenu/Internal.c
@@ -3,7 +3,7 @@
 #include "copyright.h"
 
 /*
-Copyright (C) 1993, 1996, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1993, 1996, 2001-2019 Free Software Foundation, Inc.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/oldXMenu/Makefile.in b/oldXMenu/Makefile.in
index 211bac9..db76e74 100644
--- a/oldXMenu/Makefile.in
+++ b/oldXMenu/Makefile.in
@@ -15,7 +15,7 @@
 ## without express or implied warranty.
 
 
-## Copyright (C) 2001-2018 Free Software Foundation, Inc.
+## Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ## This program is free software: you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
diff --git a/oldXMenu/deps.mk b/oldXMenu/deps.mk
index 55d0243..f5e3a25 100644
--- a/oldXMenu/deps.mk
+++ b/oldXMenu/deps.mk
@@ -15,7 +15,7 @@
 ## without express or implied warranty.
 
 
-## Copyright (C) 2001-2018 Free Software Foundation, Inc.
+## Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 ## This program is free software: you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
diff --git a/oldXMenu/insque.c b/oldXMenu/insque.c
index 1a77906..4732bce 100644
--- a/oldXMenu/insque.c
+++ b/oldXMenu/insque.c
@@ -1,5 +1,5 @@
 /*
-Copyright (C) 1993-1998, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1993-1998, 2001-2019 Free Software Foundation, Inc.
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
diff --git a/src/.gdbinit b/src/.gdbinit
index 1c68908..57843f2 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -1,4 +1,4 @@
-# Copyright (C) 1992-1998, 2000-2018 Free Software Foundation, Inc.
+# Copyright (C) 1992-1998, 2000-2019 Free Software Foundation, Inc.
 #
 # This file is part of GNU Emacs.
 #
@@ -1231,24 +1231,12 @@ show environment TERM
 # terminate_due_to_signal when an assertion failure is non-fatal.
 break terminate_due_to_signal
 
-# x_error_quitter is defined only on X.  But window-system is set up
-# only at run time, during Emacs startup, so we need to defer setting
-# the breakpoint.  init_sys_modes is the first function called on
-# every platform after init_display, where window-system is set.
-tbreak init_sys_modes
-commands
-  silent
-  xsymname globals.f_Vinitial_window_system
-  xgetptr $symname
-  set $tem = (struct Lisp_String *) $ptr
-  set $tem = (char *) $tem->u.s.data
-  # If we are running in synchronous mode, we want a chance to look
-  # around before Emacs exits.  Perhaps we should put the break
-  # somewhere else instead...
-  if $tem[0] == 'x' && $tem[1] == '\0'
-    break x_error_quitter
-  end
-  continue
+# x_error_quitter is defined only if defined_HAVE_X_WINDOWS.
+# If we are running in synchronous mode, we want a chance to look
+# around before Emacs exits.  Perhaps we should put the break
+# somewhere else instead...
+if defined_HAVE_X_WINDOWS
+  break x_error_quitter
 end
 
 
diff --git a/src/ChangeLog.1 b/src/ChangeLog.1
index a4271ef..171ce7b 100644
--- a/src/ChangeLog.1
+++ b/src/ChangeLog.1
@@ -3521,7 +3521,7 @@
        * minibuf.c: Don't allow entry to minibuffer
        while minibuffer is selected.
 
-    Copyright (C) 1985-1986, 2001-2018 Free Software Foundation, Inc.
+    Copyright (C) 1985-1986, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.10 b/src/ChangeLog.10
index a0b718f..cab6101 100644
--- a/src/ChangeLog.10
+++ b/src/ChangeLog.10
@@ -27912,7 +27912,7 @@ See ChangeLog.9 for earlier changes.
 ;; add-log-time-zone-rule: t
 ;; End:
 
-    Copyright (C) 2001-2018 Free Software Foundation, Inc.
+    Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.11 b/src/ChangeLog.11
index 3c028ca..46ab8b9 100644
--- a/src/ChangeLog.11
+++ b/src/ChangeLog.11
@@ -23186,7 +23186,7 @@
        Delete argument prop_index.
        (font_property_table): Change arguments to validator.  Change Callers.
        (font_lispy_object): Delete.
-       (font_at): Use font_find_object instead fo font_lispy_object.
+       (font_at): Use font_find_object instead of font_lispy_object.
 
 2008-02-01  Kenichi Handa  <address@hidden>
 
@@ -31385,7 +31385,7 @@ See ChangeLog.10 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2007-2018 Free Software Foundation, Inc.
+  Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.12 b/src/ChangeLog.12
index e7a313a..3b39728 100644
--- a/src/ChangeLog.12
+++ b/src/ChangeLog.12
@@ -22936,7 +22936,7 @@ See ChangeLog.11 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2011-2018 Free Software Foundation, Inc.
+  Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.13 b/src/ChangeLog.13
index 31e0130..4d7dab5 100644
--- a/src/ChangeLog.13
+++ b/src/ChangeLog.13
@@ -17905,7 +17905,7 @@ See ChangeLog.12 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2011-2018 Free Software Foundation, Inc.
+  Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.2 b/src/ChangeLog.2
index 18cd95f..8199351 100644
--- a/src/ChangeLog.2
+++ b/src/ChangeLog.2
@@ -4771,7 +4771,7 @@
 
 See ChangeLog.1 for earlier changes.
 
-    Copyright (C) 1986-1988, 2001-2018 Free Software Foundation, Inc.
+    Copyright (C) 1986-1988, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.3 b/src/ChangeLog.3
index c232ee0..051c70f 100644
--- a/src/ChangeLog.3
+++ b/src/ChangeLog.3
@@ -16503,7 +16503,7 @@ See ChangeLog.2 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.4 b/src/ChangeLog.4
index adc29b2..ab2807c 100644
--- a/src/ChangeLog.4
+++ b/src/ChangeLog.4
@@ -5135,7 +5135,7 @@
        (BSTRING): Deleted because they are stubs to the memory funcs.
        (memmove): Defined as safe_bcopy since memcpy is not safe.
        (HAVE_X_WINDOWS): Does not conditionally define anything any more.
-       Added support fo the GNU C compiler bundled with R3V7.
+       Added support for the GNU C compiler bundled with R3V7.
 
 1993-07-26  Richard Stallman  (address@hidden)
 
@@ -6906,7 +6906,7 @@ See ChangeLog.3 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.5 b/src/ChangeLog.5
index 4fa493e..1ab7773 100644
--- a/src/ChangeLog.5
+++ b/src/ChangeLog.5
@@ -7148,7 +7148,7 @@ See ChangeLog.4 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1994-1995, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1994-1995, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.6 b/src/ChangeLog.6
index 0a9417df..fdaa010 100644
--- a/src/ChangeLog.6
+++ b/src/ChangeLog.6
@@ -5358,7 +5358,7 @@ See ChangeLog.5 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1995-1996, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1995-1996, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.7 b/src/ChangeLog.7
index cef477a..50c7480 100644
--- a/src/ChangeLog.7
+++ b/src/ChangeLog.7
@@ -11091,7 +11091,7 @@ See ChangeLog.6 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 1997-1998, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1997-1998, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.8 b/src/ChangeLog.8
index be2791c..e1a45b0 100644
--- a/src/ChangeLog.8
+++ b/src/ChangeLog.8
@@ -13979,7 +13979,7 @@
 
 See ChangeLog.7 for earlier changes.
 
-  Copyright (C) 1999, 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 1999, 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/ChangeLog.9 b/src/ChangeLog.9
index 71aba18..fbc1fd1 100644
--- a/src/ChangeLog.9
+++ b/src/ChangeLog.9
@@ -13294,7 +13294,7 @@ See ChangeLog.8 for earlier changes.
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2001-2018 Free Software Foundation, Inc.
+  Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/src/Makefile.in b/src/Makefile.in
index 2dba102..dee3a53 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2018 Free Software
+# Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2019 Free Software
 # Foundation, Inc.
 
 # This file is part of GNU Emacs.
@@ -54,8 +54,6 @@ lwlibdir = ../lwlib
 # Configuration files for .o files to depend on.
 config_h = config.h $(srcdir)/conf_post.h
 
-bootstrap_exe = ../src/bootstrap-emacs$(EXEEXT)
-
 ## ns-app if HAVE_NS, else empty.
 OTHER_FILES = @OTHER_FILES@
 
@@ -127,7 +125,8 @@ address@hidden@ @LIBJPEG@ @LIBPNG@ @LIBGIF@ @LIBXPM@
 
 address@hidden@
 address@hidden@
-LIBX_EXTRA=-lX11 $(XCB_LIBS) $(XFT_LIBS)
address@hidden@
+LIBX_EXTRA=-lX11 $(XCB_LIBS) $(XFT_LIBS) $(XRENDER_LIBS)
 
 FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
 FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
@@ -141,7 +140,6 @@ M17N_FLT_LIBS = @M17N_FLT_LIBS@
 address@hidden@
 address@hidden@
 address@hidden@
address@hidden@
 address@hidden@
 
 DBUS_CFLAGS = @DBUS_CFLAGS@
@@ -332,7 +330,7 @@ BUILD_DETAILS = @BUILD_DETAILS@
 
 UNEXEC_OBJ = @UNEXEC_OBJ@
 
address@hidden@
address@hidden@
 
 # 'make' verbosity.
 AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
@@ -357,6 +355,15 @@ am__v_at_ = $(address@hidden@)
 am__v_at_0 = @
 am__v_at_1 =
 
+bootstrap_exe = ../src/bootstrap-emacs$(EXEEXT)
+ifeq ($(DUMPING),pdumper)
+bootstrap_pdmp := bootstrap-emacs.pdmp # Keep in sync with loadup.el
+pdmp := emacs.pdmp
+else
+bootstrap_pdmp :=
+pdmp :=
+endif
+
 # Flags that might be in WARN_CFLAGS but are not valid for Objective C.
 NON_OBJC_CFLAGS = -Wignored-attributes -Wignored-qualifiers -Wopenmp-simd
 
@@ -395,7 +402,7 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o 
$(XMENU_OBJ) window.o \
        bignum.o buffer.o filelock.o insdel.o marker.o \
        minibuf.o fileio.o dired.o \
        cmds.o casetab.o casefiddle.o indent.o search.o regex-emacs.o undo.o \
-       alloc.o data.o doc.o editfns.o callint.o \
+       alloc.o pdumper.o data.o doc.o editfns.o callint.o \
        eval.o floatfns.o fns.o font.o print.o lread.o $(MODULES_OBJ) \
        syntax.o $(UNEXEC_OBJ) bytecode.o \
        process.o gnutls.o callproc.o \
@@ -446,9 +453,17 @@ address@hidden@
 ALLOBJS = $(FIRSTFILE_OBJ) $(VMLIMIT_OBJ) $(obj) $(otherobj)
 
 # Must be first, before dep inclusion!
-all: emacs$(EXEEXT) $(OTHER_FILES)
+all: emacs$(EXEEXT) $(pdmp) $(OTHER_FILES)
 .PHONY: all
 
+dmpstruct_headers=$(srcdir)/lisp.h $(srcdir)/buffer.h \
+       $(srcdir)/intervals.h $(srcdir)/charset.h $(srcdir)/bignum.h
+pdumper.o: dmpstruct.h
+dmpstruct.h: $(srcdir)/dmpstruct.awk
+dmpstruct.h: $(libsrc)/make-fingerprint$(EXEEXT) $(dmpstruct_headers)
+       $(AM_V_GEN)POSIXLY_CORRECT=1 awk -f $(srcdir)/dmpstruct.awk \
+               $(dmpstruct_headers) > $@
+
 AUTO_DEPEND = @AUTO_DEPEND@
 DEPDIR = deps
 ifeq ($(AUTO_DEPEND),yes)
@@ -496,7 +511,7 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) 
$(LIBIMAGE) \
    $(LIBX_OTHER) $(LIBSOUND) \
    $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_ACL) $(LIB_CLOCK_GETTIME) \
    $(WEBKIT_LIBS) \
-   $(LIB_EACCESS) $(LIB_FDATASYNC) $(LIB_TIMER_TIME) $(DBUS_LIBS) \
+   $(LIB_EACCESS) $(LIB_TIMER_TIME) $(DBUS_LIBS) \
    $(LIB_EXECINFO) $(XRANDR_LIBS) $(XINERAMA_LIBS) $(XFIXES_LIBS) \
    $(XDBE_LIBS) \
    $(LIBXML2_LIBS) $(LIBGPM) $(LIBS_SYSTEM) $(CAIRO_LIBS) \
@@ -506,12 +521,12 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) 
$(LIBIMAGE) \
    $(NOTIFY_LIBS) $(LIB_MATH) $(LIBZ) $(LIBMODULES) $(LIBSYSTEMD_LIBS) \
    $(JSON_LIBS) $(GMP_LIB)
 
-## FORCE it so that admin/unidata can decide whether these files
-## are up-to-date.  Although since charprop depends on bootstrap-emacs,
-## and emacs (which recreates bootstrap-emacs) depends on charprop,
-## in practice this rule was always run anyway.
-$(srcdir)/macuvs.h $(lispsource)/international/charprop.el: \
-  bootstrap-emacs$(EXEEXT) FORCE
+## FORCE it so that admin/unidata can decide whether this file is
+## up-to-date.  Although since charprop depends on bootstrap-emacs,
+## and emacs depends on charprop, in practice this rule was always run
+## anyway.
+$(lispsource)/international/charprop.el: \
+  FORCE | bootstrap-emacs$(EXEEXT) $(bootstrap_pdmp)
        $(MAKE) -C ../admin/unidata all EMACS="../$(bootstrap_exe)"
 
 ## We require charprop.el to exist before ucs-normalize.el is
@@ -542,14 +557,20 @@ ${lispintdir}/characters.elc: ${charscript:.el=.elc}
 emacs$(EXEEXT): temacs$(EXEEXT) \
                 lisp.mk $(etc)/DOC $(lisp) \
                 $(lispsource)/international/charprop.el ${charsets}
-ifeq ($(CANNOT_DUMP),yes)
-       ln -f temacs$(EXEEXT) $@
-else
-       LC_ALL=C $(RUN_TEMACS) -batch $(BUILD_DETAILS) -l loadup dump
+ifeq ($(DUMPING),unexec)
+       LC_ALL=C $(RUN_TEMACS) -batch $(BUILD_DETAILS) -l loadup --temacs=dump
   ifneq ($(PAXCTL_dumped),)
-       $(PAXCTL_dumped) $@
+             $(PAXCTL_dumped) emacs$(EXEEXT)
   endif
-       ln -f $@ bootstrap-emacs$(EXEEXT)
+       cp -f $@ bootstrap-emacs$(EXEEXT)
+else
+       rm -f $@ && cp -f temacs$(EXEEXT) $@
+endif
+
+ifeq ($(DUMPING),pdumper)
+$(pdmp): emacs$(EXEEXT)
+       LC_ALL=C $(RUN_TEMACS) -batch $(BUILD_DETAILS) -l loadup --temacs=pdump
+       cp -f $@ $(bootstrap_pdmp)
 endif
 
 ## We run make-docfile twice because the command line may get too long
@@ -602,16 +623,30 @@ LIBEGNU_ARCHIVE = $(lib)/lib$(if $(HYBRID_MALLOC),e)gnu.a
 $(LIBEGNU_ARCHIVE): $(config_h)
        $(MAKE) -C $(lib) all
 
+EMACS_DEPS_PRE=$(LIBXMENU) $(ALLOBJS)
+EMACS_DEPS_POST=$(LIBEGNU_ARCHIVE) $(EMACSRES) ${charsets} ${charscript}
+BUILD_EMACS_PRE=$(AM_V_CCLD)$(CC) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
+         -o $@ $(ALLOBJS)
+BUILD_EMACS_POST=$(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES)
+
+## We hash this file to generate the build fingerprint
+temacs.in$(EXEEXT): $(EMACS_DEPS_PRE) fingerprint-dummy.o $(EMACS_DEPS_POST)
+       $(BUILD_EMACS_PRE) fingerprint-dummy.o $(BUILD_EMACS_POST)
+
+$(libsrc)/make-fingerprint$(EXEEXT): $(libsrc)/make-fingerprint.c 
$(lib)/libgnu.a
+       $(MAKE) -C $(libsrc) make-fingerprint$(EXEEXT)
+
+fingerprint.c: temacs.in$(EXEEXT) $(libsrc)/make-fingerprint$(EXEEXT)
+       $(libsrc)/make-fingerprint$(EXEEXT) temacs.in$(EXEEXT) > fingerprint.c
+
 ## We have to create $(etc) here because init_cmdargs tests its
 ## existence when setting Vinstallation_directory (FIXME?).
 ## This goes on to affect various things, and the emacs binary fails
 ## to start if Vinstallation_directory has the wrong value.
-temacs$(EXEEXT): $(LIBXMENU) $(ALLOBJS) \
-                $(LIBEGNU_ARCHIVE) $(EMACSRES) ${charsets} ${charscript}
-       $(AM_V_CCLD)$(CC) $(ALL_CFLAGS) $(TEMACS_LDFLAGS) $(LDFLAGS) \
-         -o temacs $(ALLOBJS) $(LIBEGNU_ARCHIVE) $(W32_RES_LINK) $(LIBES)
+temacs$(EXEEXT): $(EMACS_DEPS_PRE) fingerprint.o $(EMACS_DEPS_POST)
+       $(BUILD_EMACS_PRE) fingerprint.o $(BUILD_EMACS_POST)
        $(MKDIR_P) $(etc)
-ifneq ($(CANNOT_DUMP),yes)
+ifeq ($(DUMPING),unexec)
   ifneq ($(PAXCTL_notdumped),)
        $(PAXCTL_notdumped) $@
   endif
@@ -638,7 +673,7 @@ emacs.res: FORCE
        $(MAKE) -C ../nt ../src/emacs.res
 
 .PHONY: ns-app
-ns-app: emacs$(EXEEXT)
+ns-app: emacs$(EXEEXT) $(pdmp)
        $(MAKE) -C ../nextstep all
 
 .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
@@ -646,13 +681,17 @@ ns-app: emacs$(EXEEXT)
 
 mostlyclean:
        rm -f temacs$(EXEEXT) core ./*.core \#* ./*.o
+       rm -f temacs.in$(EXEEXT) fingerprint.c dmpstruct.h
+       rm -f emacs.pdmp
        rm -f ../etc/DOC
-       rm -f bootstrap-emacs$(EXEEXT) emacs-$(version)$(EXEEXT)
+       rm -f bootstrap-emacs$(EXEEXT) $(bootstrap_pdmp)
+       rm -f emacs-$(version)$(EXEEXT)
        rm -f buildobj.h
        rm -f globals.h gl-stamp
        rm -f ./*.res ./*.tmp
 clean: mostlyclean
-       rm -f emacs-*.*.*[0-9]$(EXEEXT) emacs$(EXEEXT) $(DEPDIR)/*
+       rm -f emacs-*.*.*[0-9]$(EXEEXT) emacs-*.*.*[0-9].pdmp
+       rm -f emacs$(EXEEXT) $(DEPDIR)/*
 
 ## bootstrap-clean is used to clean up just before a bootstrap.
 ## It should remove all files generated during a compilation/bootstrap,
@@ -682,7 +721,10 @@ ETAGS = ../lib-src/etags${EXEEXT}
 ${ETAGS}: FORCE
        ${MAKE} -C ../lib-src $(notdir $@)
 
-ctagsfiles1 = $(wildcard ${srcdir}/*.[hc])
+# Remove macuvs.h and fingerprint.c since they'd cause `src/emacs`
+# to be built before we can get TAGS.
+ctagsfiles1 = $(filter-out ${srcdir}/macuvs.h ${srcdir}/fingerprint.c, \
+                           $(wildcard ${srcdir}/*.[hc]))
 ctagsfiles2 = $(wildcard ${srcdir}/*.m)
 
 ## In out-of-tree builds, TAGS are generated in the build dir, like
@@ -732,7 +774,7 @@ tags: TAGS ../lisp/TAGS $(lwlibdir)/TAGS
 ## but now that we require GNU make, we can simply specify
 ## bootstrap-emacs$(EXEEXT) as an order-only prerequisite.
 
-%.elc: %.el | bootstrap-emacs$(EXEEXT)
+%.elc: %.el | bootstrap-emacs$(EXEEXT) $(bootstrap_pdmp)
        @$(MAKE) -C ../lisp EMACS="$(bootstrap_exe)" THEFILE=$< $<c
 
 ## VCSWITNESS points to the file that holds info about the current checkout.
@@ -740,24 +782,35 @@ tags: TAGS ../lisp/TAGS $(lwlibdir)/TAGS
 ## If empty it is ignored; the parent makefile can set it to some other value.
 VCSWITNESS =
 
-$(lispsource)/loaddefs.el: $(VCSWITNESS) | bootstrap-emacs$(EXEEXT)
+$(lispsource)/loaddefs.el: $(VCSWITNESS) | \
+               bootstrap-emacs$(EXEEXT) $(bootstrap_pdmp)
        $(MAKE) -C ../lisp autoloads EMACS="$(bootstrap_exe)"
 
 ## Dump an Emacs executable named bootstrap-emacs containing the
 ## files from loadup.el in source form.
+
 bootstrap-emacs$(EXEEXT): temacs$(EXEEXT)
        $(MAKE) -C ../lisp update-subdirs
-ifeq ($(CANNOT_DUMP),yes)
-       ln -f temacs$(EXEEXT) $@
-else
-       $(RUN_TEMACS) --batch $(BUILD_DETAILS) --load loadup bootstrap
+ifeq ($(DUMPING),unexec)
+       $(RUN_TEMACS) --batch $(BUILD_DETAILS) -l loadup --temacs=bootstrap
   ifneq ($(PAXCTL_dumped),)
        $(PAXCTL_dumped) emacs$(EXEEXT)
   endif
-       mv -f emacs$(EXEEXT) $@
+       mv -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT)
+       @: Compile some files earlier to speed up further compilation.
+       $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)"
+else
+       @: In the pdumper case, make compile-first after the dump
+       cp -f temacs$(EXEEXT) bootstrap-emacs$(EXEEXT)
 endif
+
+ifeq ($(DUMPING),pdumper)
+$(bootstrap_pdmp): bootstrap-emacs$(EXEEXT)
+       rm -f $@
+       $(RUN_TEMACS) --batch $(BUILD_DETAILS) -l loadup --temacs=pbootstrap
        @: Compile some files earlier to speed up further compilation.
        $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)"
+endif
 
 ### Flymake support (for C only)
 check-syntax:
diff --git a/src/README b/src/README
index 9ac9216..9a267af 100644
--- a/src/README
+++ b/src/README
@@ -1,4 +1,4 @@
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 
diff --git a/src/alloc.c b/src/alloc.c
index f37d7d4..035b458 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1,6 +1,6 @@
 /* Storage allocation and gc for GNU Emacs Lisp interpreter.
 
-Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2018 Free Software
+Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -44,6 +44,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "keyboard.h"
 #include "frame.h"
 #include "blockinput.h"
+#include "pdumper.h"
 #include "termhooks.h"         /* For struct terminal.  */
 #ifdef HAVE_WINDOW_SYSTEM
 #include TERM_HEADER
@@ -65,16 +66,13 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 # include <malloc.h>
 #endif
 
-#if (defined ENABLE_CHECKING                   \
-     && defined HAVE_VALGRIND_VALGRIND_H       \
-     && !defined USE_VALGRIND)
+#if defined HAVE_VALGRIND_VALGRIND_H && !defined USE_VALGRIND
 # define USE_VALGRIND 1
 #endif
 
 #if USE_VALGRIND
 #include <valgrind/valgrind.h>
 #include <valgrind/memcheck.h>
-static bool valgrind_p;
 #endif
 
 /* GC_CHECK_MARKED_OBJECTS means do sanity checks on allocated objects.
@@ -105,24 +103,12 @@ static bool valgrind_p;
 #include "w32heap.h"   /* for sbrk */
 #endif
 
-#if defined GNU_LINUX && !defined CANNOT_DUMP
-/* The address where the heap starts.  */
-void *
-my_heap_start (void)
-{
-  static void *start;
-  if (! start)
-    start = sbrk (0);
-  return start;
-}
-#endif
-
 #ifdef DOUG_LEA_MALLOC
 
 /* Specify maximum number of areas to mmap.  It would be nice to use a
    value that explicitly means "no limit".  */
 
-#define MMAP_MAX_AREAS 100000000
+# define MMAP_MAX_AREAS 100000000
 
 /* A pointer to the memory allocated that copies that static data
    inside glibc's malloc.  */
@@ -138,9 +124,9 @@ malloc_initialize_hook (void)
 
   if (! initialized)
     {
-#ifdef GNU_LINUX
+# ifdef GNU_LINUX
       my_heap_start ();
-#endif
+# endif
       malloc_using_checking = getenv ("MALLOC_CHECK_") != NULL;
     }
   else
@@ -182,7 +168,7 @@ voidfuncptr __MALLOC_HOOK_VOLATILE __malloc_initialize_hook 
EXTERNALLY_VISIBLE
 
 #endif
 
-#if defined DOUG_LEA_MALLOC || !defined CANNOT_DUMP
+#if defined DOUG_LEA_MALLOC || defined HAVE_UNEXEC
 
 /* Allocator-related actions to do just before and after unexec.  */
 
@@ -194,9 +180,6 @@ alloc_unexec_pre (void)
   if (!malloc_state_ptr)
     fatal ("malloc_get_state: %s", strerror (errno));
 # endif
-# ifdef HYBRID_MALLOC
-  bss_sbrk_did_unexec = true;
-# endif
 }
 
 void
@@ -205,22 +188,33 @@ alloc_unexec_post (void)
 # ifdef DOUG_LEA_MALLOC
   free (malloc_state_ptr);
 # endif
-# ifdef HYBRID_MALLOC
-  bss_sbrk_did_unexec = false;
-# endif
 }
+
+# ifdef GNU_LINUX
+
+/* The address where the heap starts.  */
+void *
+my_heap_start (void)
+{
+  static void *start;
+  if (! start)
+    start = sbrk (0);
+  return start;
+}
+# endif
+
 #endif
 
 /* Mark, unmark, query mark bit of a Lisp string.  S must be a pointer
    to a struct Lisp_String.  */
 
-#define MARK_STRING(S)         ((S)->u.s.size |= ARRAY_MARK_FLAG)
-#define UNMARK_STRING(S)       ((S)->u.s.size &= ~ARRAY_MARK_FLAG)
-#define STRING_MARKED_P(S)     (((S)->u.s.size & ARRAY_MARK_FLAG) != 0)
+#define XMARK_STRING(S)                ((S)->u.s.size |= ARRAY_MARK_FLAG)
+#define XUNMARK_STRING(S)      ((S)->u.s.size &= ~ARRAY_MARK_FLAG)
+#define XSTRING_MARKED_P(S)    (((S)->u.s.size & ARRAY_MARK_FLAG) != 0)
 
-#define VECTOR_MARK(V)         ((V)->header.size |= ARRAY_MARK_FLAG)
-#define VECTOR_UNMARK(V)       ((V)->header.size &= ~ARRAY_MARK_FLAG)
-#define VECTOR_MARKED_P(V)     (((V)->header.size & ARRAY_MARK_FLAG) != 0)
+#define XMARK_VECTOR(V)                ((V)->header.size |= ARRAY_MARK_FLAG)
+#define XUNMARK_VECTOR(V)      ((V)->header.size &= ~ARRAY_MARK_FLAG)
+#define XVECTOR_MARKED_P(V)    (((V)->header.size & ARRAY_MARK_FLAG) != 0)
 
 /* Default value of gc_cons_threshold (see below).  */
 
@@ -231,26 +225,40 @@ struct emacs_globals globals;
 
 /* Number of bytes of consing done since the last gc.  */
 
-EMACS_INT consing_since_gc;
+byte_ct consing_since_gc;
 
 /* Similar minimum, computed from Vgc_cons_percentage.  */
 
-EMACS_INT gc_relative_threshold;
-
-/* Minimum number of bytes of consing since GC before next GC,
-   when memory is full.  */
+byte_ct gc_relative_threshold;
 
-EMACS_INT memory_full_cons_threshold;
+#ifdef HAVE_PDUMPER
+/* Number of finalizers run: used to loop over GC until we stop
+   generating garbage.  */
+int number_finalizers_run;
+#endif
 
 /* True during GC.  */
 
 bool gc_in_progress;
 
+/* Type of object counts reported by GC.  Unlike byte_ct, this can be
+   signed, e.g., it is less than 2**31 on a typical 32-bit machine.  */
+
+typedef intptr_t object_ct;
+
 /* Number of live and free conses etc.  */
 
-static EMACS_INT total_conses, total_symbols, total_buffers;
-static EMACS_INT total_free_conses, total_free_symbols;
-static EMACS_INT total_free_floats, total_floats;
+static struct gcstat
+{
+  object_ct total_conses, total_free_conses;
+  object_ct total_symbols, total_free_symbols;
+  object_ct total_strings, total_free_strings;
+  byte_ct total_string_bytes;
+  object_ct total_vectors, total_vector_slots, total_free_vector_slots;
+  object_ct total_floats, total_free_floats;
+  object_ct total_intervals, total_free_intervals;
+  object_ct total_buffers;
+} gcstat;
 
 /* Points to memory space allocated as "spare", to be freed if we run
    out of memory.  We keep one large block, four cons-blocks, and
@@ -370,6 +378,27 @@ static void compact_small_strings (void);
 static void free_large_strings (void);
 extern Lisp_Object which_symbols (Lisp_Object, EMACS_INT) EXTERNALLY_VISIBLE;
 
+/* Forward declare mark accessor functions: they're used all over the
+   place.  */
+
+inline static bool vector_marked_p (const struct Lisp_Vector *v);
+inline static void set_vector_marked (struct Lisp_Vector *v);
+
+inline static bool vectorlike_marked_p (const union vectorlike_header *v);
+inline static void set_vectorlike_marked (union vectorlike_header *v);
+
+inline static bool cons_marked_p (const struct Lisp_Cons *c);
+inline static void set_cons_marked (struct Lisp_Cons *c);
+
+inline static bool string_marked_p (const struct Lisp_String *s);
+inline static void set_string_marked (struct Lisp_String *s);
+
+inline static bool symbol_marked_p (const struct Lisp_Symbol *s);
+inline static void set_symbol_marked (struct Lisp_Symbol *s);
+
+inline static bool interval_marked_p (INTERVAL i);
+inline static void set_interval_marked (INTERVAL i);
+
 /* When scanning the C stack for live Lisp objects, Emacs keeps track of
    what memory allocated via lisp_malloc and lisp_align_malloc is intended
    for what purpose.  This enumeration specifies the type of memory.  */
@@ -395,7 +424,10 @@ enum mem_type
 /* A unique object in pure space used to make some Lisp objects
    on free lists recognizable in O(1).  */
 
-static Lisp_Object Vdead;
+#ifndef ENABLE_CHECKING
+static
+#endif
+Lisp_Object Vdead;
 #define DEADP(x) EQ (x, Vdead)
 
 #ifdef GC_MALLOC_CHECK
@@ -473,30 +505,21 @@ static struct mem_node *mem_find (void *);
 #endif
 
 /* Addresses of staticpro'd variables.  Initialize it to a nonzero
-   value; otherwise some compilers put it into BSS.  */
+   value if we might unexec; otherwise some compilers put it into
+   BSS.  */
 
-enum { NSTATICS = 2048 };
-static Lisp_Object *staticvec[NSTATICS] = {&Vpurify_flag};
+Lisp_Object const *staticvec[NSTATICS]
+#ifdef HAVE_UNEXEC
+= {&Vpurify_flag}
+#endif
+  ;
 
 /* Index of next unused slot in staticvec.  */
 
-static int staticidx;
+int staticidx;
 
 static void *pure_alloc (size_t, int);
 
-/* True if N is a power of 2.  N should be positive.  */
-
-#define POWER_OF_2(n) (((n) & ((n) - 1)) == 0)
-
-/* Return X rounded to the next multiple of Y.  Y should be positive,
-   and Y - 1 + X should not overflow.  Arguments should not have side
-   effects, as they are evaluated more than once.  Tune for Y being a
-   power of 2.  */
-
-#define ROUNDUP(x, y) (POWER_OF_2 (y)                                  \
-                      ? ((y) - 1 + (x)) & ~ ((y) - 1)                  \
-                      : ((y) - 1 + (x)) - ((y) - 1 + (x)) % (y))
-
 /* Return PTR rounded up to the next multiple of ALIGNMENT.  */
 
 static void *
@@ -566,18 +589,18 @@ mmap_lisp_allowed_p (void)
      over our address space.  We also can't use mmap for lisp objects
      if we might dump: unexec doesn't preserve the contents of mmapped
      regions.  */
-  return pointers_fit_in_lispobj_p () && !might_dump;
+  return pointers_fit_in_lispobj_p () && !will_dump_with_unexec_p ();
 }
 #endif
 
 /* Head of a circularly-linked list of extant finalizers. */
-static struct Lisp_Finalizer finalizers;
+struct Lisp_Finalizer finalizers;
 
 /* Head of a circularly-linked list of finalizers that must be invoked
    because we deemed them unreachable.  This list must be global, and
    not a local inside garbage_collect_1, in case we GC again while
    running finalizers.  */
-static struct Lisp_Finalizer doomed_finalizers;
+struct Lisp_Finalizer doomed_finalizers;
 
 
 /************************************************************************
@@ -926,6 +949,8 @@ xfree (void *block)
 {
   if (!block)
     return;
+  if (pdumper_object_p (block))
+    return;
   MALLOC_BLOCK_INPUT;
   free (block);
   MALLOC_UNBLOCK_INPUT;
@@ -1148,6 +1173,9 @@ lisp_malloc (size_t nbytes, enum mem_type type)
 static void
 lisp_free (void *block)
 {
+  if (pdumper_object_p (block))
+    return;
+
   MALLOC_BLOCK_INPUT;
   free (block);
 #ifndef GC_MALLOC_CHECK
@@ -1167,9 +1195,9 @@ verify (POWER_OF_2 (BLOCK_ALIGN));
 
 /* Use aligned_alloc if it or a simple substitute is available.
    Aligned allocation is incompatible with unexmacosx.c, so don't use
-   it on Darwin unless CANNOT_DUMP.  */
+   it on Darwin if HAVE_UNEXEC.  */
 
-#if !defined DARWIN_OS || defined CANNOT_DUMP
+#if ! (defined DARWIN_OS && defined HAVE_UNEXEC)
 # if (defined HAVE_ALIGNED_ALLOC                                       \
       || (defined HYBRID_MALLOC                                                
\
          ? defined HAVE_POSIX_MEMALIGN                                 \
@@ -1513,10 +1541,6 @@ static struct interval_block *interval_block;
 
 static int interval_block_index = INTERVAL_BLOCK_SIZE;
 
-/* Number of free and live intervals.  */
-
-static EMACS_INT total_free_intervals, total_intervals;
-
 /* List of free intervals.  */
 
 static INTERVAL interval_free_list;
@@ -1545,7 +1569,7 @@ make_interval (void)
          newi->next = interval_block;
          interval_block = newi;
          interval_block_index = 0;
-         total_free_intervals += INTERVAL_BLOCK_SIZE;
+         gcstat.total_free_intervals += INTERVAL_BLOCK_SIZE;
        }
       val = &interval_block->intervals[interval_block_index++];
     }
@@ -1554,7 +1578,7 @@ make_interval (void)
 
   consing_since_gc += sizeof (struct interval);
   intervals_consed++;
-  total_free_intervals--;
+  gcstat.total_free_intervals--;
   RESET_INTERVAL (val);
   val->gcmarkbit = 0;
   return val;
@@ -1564,22 +1588,23 @@ make_interval (void)
 /* Mark Lisp objects in interval I.  */
 
 static void
-mark_interval (INTERVAL i, void *dummy)
+mark_interval_tree_1 (INTERVAL i, void *dummy)
 {
   /* Intervals should never be shared.  So, if extra internal checking is
      enabled, GC aborts if it seems to have visited an interval twice.  */
-  eassert (!i->gcmarkbit);
-  i->gcmarkbit = 1;
+  eassert (!interval_marked_p (i));
+  set_interval_marked (i);
   mark_object (i->plist);
 }
 
 /* Mark the interval tree rooted in I.  */
 
-#define MARK_INTERVAL_TREE(i)                                  \
-  do {                                                         \
-    if (i && !i->gcmarkbit)                                    \
-      traverse_intervals_noorder (i, mark_interval, NULL);     \
-  } while (0)
+static void
+mark_interval_tree (INTERVAL i)
+{
+  if (i && !interval_marked_p (i))
+    traverse_intervals_noorder (i, mark_interval_tree_1, NULL);
+}
 
 /***********************************************************************
                          String Allocation
@@ -1729,14 +1754,6 @@ static struct string_block *string_blocks;
 
 static struct Lisp_String *string_free_list;
 
-/* Number of live and free Lisp_Strings.  */
-
-static EMACS_INT total_strings, total_free_strings;
-
-/* Number of bytes used by live strings.  */
-
-static EMACS_INT total_string_bytes;
-
 /* Given a pointer to a Lisp_String S which is on the free-list
    string_free_list, return a pointer to its successor in the
    free-list.  */
@@ -1797,7 +1814,7 @@ static char const 
string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] =
 #define GC_STRING_EXTRA (GC_STRING_OVERRUN_COOKIE_SIZE)
 
 /* Exact bound on the number of bytes in a string, not counting the
-   terminating null.  A string cannot contain more bytes than
+   terminating NUL.  A string cannot contain more bytes than
    STRING_BYTES_BOUND, nor can it be so long that the size_t
    arithmetic in allocate_string_data would overflow while it is
    calculating a value to be passed to malloc.  */
@@ -1815,7 +1832,9 @@ static void
 init_strings (void)
 {
   empty_unibyte_string = make_pure_string ("", 0, 0, 0);
+  staticpro (&empty_unibyte_string);
   empty_multibyte_string = make_pure_string ("", 0, 0, 1);
+  staticpro (&empty_multibyte_string);
 }
 
 
@@ -1944,7 +1963,7 @@ allocate_string (void)
          string_free_list = ptr_bounds_clip (s, sizeof *s);
        }
 
-      total_free_strings += STRING_BLOCK_SIZE;
+      gcstat.total_free_strings += STRING_BLOCK_SIZE;
     }
 
   check_string_free_list ();
@@ -1955,8 +1974,8 @@ allocate_string (void)
 
   MALLOC_UNBLOCK_INPUT;
 
-  --total_free_strings;
-  ++total_strings;
+  gcstat.total_free_strings--;
+  gcstat.total_strings++;
   ++strings_consed;
   consing_since_gc += sizeof *s;
 
@@ -2091,8 +2110,8 @@ sweep_strings (void)
   struct string_block *live_blocks = NULL;
 
   string_free_list = NULL;
-  total_strings = total_free_strings = 0;
-  total_string_bytes = 0;
+  gcstat.total_strings = gcstat.total_free_strings = 0;
+  gcstat.total_string_bytes = 0;
 
   /* Scan strings_blocks, free Lisp_Strings that aren't marked.  */
   for (b = string_blocks; b; b = next)
@@ -2109,16 +2128,16 @@ sweep_strings (void)
          if (s->u.s.data)
            {
              /* String was not on free-list before.  */
-             if (STRING_MARKED_P (s))
+             if (XSTRING_MARKED_P (s))
                {
                  /* String is live; unmark it and its intervals.  */
-                 UNMARK_STRING (s);
+                 XUNMARK_STRING (s);
 
                  /* Do not use string_(set|get)_intervals here.  */
                  s->u.s.intervals = balance_intervals (s->u.s.intervals);
 
-                 ++total_strings;
-                 total_string_bytes += STRING_BYTES (s);
+                 gcstat.total_strings++;
+                 gcstat.total_string_bytes += STRING_BYTES (s);
                }
              else
                {
@@ -2158,14 +2177,14 @@ sweep_strings (void)
       /* Free blocks that contain free Lisp_Strings only, except
         the first two of them.  */
       if (nfree == STRING_BLOCK_SIZE
-         && total_free_strings > STRING_BLOCK_SIZE)
+         && gcstat.total_free_strings > STRING_BLOCK_SIZE)
        {
          lisp_free (b);
          string_free_list = free_list_before;
        }
       else
        {
-         total_free_strings += nfree;
+         gcstat.total_free_strings += nfree;
          b->next = live_blocks;
          live_blocks = b;
        }
@@ -2398,6 +2417,8 @@ make_uninit_bool_vector (EMACS_INT nbits)
   EMACS_INT needed_elements = ((bool_header_size - header_size + word_bytes
                                + word_size - 1)
                               / word_size);
+  if (PTRDIFF_MAX < needed_elements)
+    memory_full (SIZE_MAX);
   struct Lisp_Bool_Vector *p
     = (struct Lisp_Bool_Vector *) allocate_vector (needed_elements);
   XSETVECTOR (val, p);
@@ -2612,7 +2633,8 @@ make_formatted_string (char *buf, const char *format, ...)
    &= ~((bits_word) 1 << ((n) % BITS_PER_BITS_WORD)))
 
 #define FLOAT_BLOCK(fptr) \
-  ((struct float_block *) (((uintptr_t) (fptr)) & ~(BLOCK_ALIGN - 1)))
+  (eassert (!pdumper_object_p (fptr)),                                  \
+   ((struct float_block *) (((uintptr_t) (fptr)) & ~(BLOCK_ALIGN - 1))))
 
 #define FLOAT_INDEX(fptr) \
   ((((uintptr_t) (fptr)) & (BLOCK_ALIGN - 1)) / sizeof (struct Lisp_Float))
@@ -2625,13 +2647,13 @@ struct float_block
   struct float_block *next;
 };
 
-#define FLOAT_MARKED_P(fptr) \
+#define XFLOAT_MARKED_P(fptr) \
   GETMARKBIT (FLOAT_BLOCK (fptr), FLOAT_INDEX ((fptr)))
 
-#define FLOAT_MARK(fptr) \
+#define XFLOAT_MARK(fptr) \
   SETMARKBIT (FLOAT_BLOCK (fptr), FLOAT_INDEX ((fptr)))
 
-#define FLOAT_UNMARK(fptr) \
+#define XFLOAT_UNMARK(fptr) \
   UNSETMARKBIT (FLOAT_BLOCK (fptr), FLOAT_INDEX ((fptr)))
 
 /* Current float_block.  */
@@ -2670,7 +2692,7 @@ make_float (double float_value)
          memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
          float_block = new;
          float_block_index = 0;
-         total_free_floats += FLOAT_BLOCK_SIZE;
+         gcstat.total_free_floats += FLOAT_BLOCK_SIZE;
        }
       XSETFLOAT (val, &float_block->floats[float_block_index]);
       float_block_index++;
@@ -2679,10 +2701,10 @@ make_float (double float_value)
   MALLOC_UNBLOCK_INPUT;
 
   XFLOAT_INIT (val, float_value);
-  eassert (!FLOAT_MARKED_P (XFLOAT (val)));
+  eassert (!XFLOAT_MARKED_P (XFLOAT (val)));
   consing_since_gc += sizeof (struct Lisp_Float);
   floats_consed++;
-  total_free_floats--;
+  gcstat.total_free_floats--;
   return val;
 }
 
@@ -2704,7 +2726,8 @@ make_float (double float_value)
    / (sizeof (struct Lisp_Cons) * CHAR_BIT + 1))
 
 #define CONS_BLOCK(fptr) \
-  ((struct cons_block *) ((uintptr_t) (fptr) & ~(BLOCK_ALIGN - 1)))
+  (eassert (!pdumper_object_p (fptr)),                                  \
+   ((struct cons_block *) ((uintptr_t) (fptr) & ~(BLOCK_ALIGN - 1))))
 
 #define CONS_INDEX(fptr) \
   (((uintptr_t) (fptr) & (BLOCK_ALIGN - 1)) / sizeof (struct Lisp_Cons))
@@ -2717,15 +2740,20 @@ struct cons_block
   struct cons_block *next;
 };
 
-#define CONS_MARKED_P(fptr) \
+#define XCONS_MARKED_P(fptr) \
   GETMARKBIT (CONS_BLOCK (fptr), CONS_INDEX ((fptr)))
 
-#define CONS_MARK(fptr) \
+#define XMARK_CONS(fptr) \
   SETMARKBIT (CONS_BLOCK (fptr), CONS_INDEX ((fptr)))
 
-#define CONS_UNMARK(fptr) \
+#define XUNMARK_CONS(fptr) \
   UNSETMARKBIT (CONS_BLOCK (fptr), CONS_INDEX ((fptr)))
 
+/* Minimum number of bytes of consing since GC before next GC,
+   when memory is full.  */
+
+byte_ct const memory_full_cons_threshold = sizeof (struct cons_block);
+
 /* Current cons_block.  */
 
 static struct cons_block *cons_block;
@@ -2747,7 +2775,7 @@ free_cons (struct Lisp_Cons *ptr)
   ptr->u.s.car = Vdead;
   cons_free_list = ptr;
   consing_since_gc -= sizeof *ptr;
-  total_free_conses++;
+  gcstat.total_free_conses++;
 }
 
 DEFUN ("cons", Fcons, Scons, 2, 2, 0,
@@ -2767,13 +2795,26 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
     {
       if (cons_block_index == CONS_BLOCK_SIZE)
        {
+         /* Maximum number of conses that should be active at any
+            given time, so that list lengths fit into a ptrdiff_t and
+            into a fixnum.  */
+         ptrdiff_t max_conses = min (PTRDIFF_MAX, MOST_POSITIVE_FIXNUM);
+
+         /* This check is typically optimized away, as a runtime
+            check is needed only on weird platforms where a count of
+            distinct conses might not fit.  */
+         if (max_conses < INTPTR_MAX / sizeof (struct Lisp_Cons)
+             && (max_conses - CONS_BLOCK_SIZE
+                 < gcstat.total_free_conses + gcstat.total_conses))
+           memory_full (sizeof (struct cons_block));
+
          struct cons_block *new
            = lisp_align_malloc (sizeof *new, MEM_TYPE_CONS);
          memset (new->gcmarkbits, 0, sizeof new->gcmarkbits);
          new->next = cons_block;
          cons_block = new;
          cons_block_index = 0;
-         total_free_conses += CONS_BLOCK_SIZE;
+         gcstat.total_free_conses += CONS_BLOCK_SIZE;
        }
       XSETCONS (val, &cons_block->conses[cons_block_index]);
       cons_block_index++;
@@ -2783,9 +2824,9 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
 
   XSETCAR (val, car);
   XSETCDR (val, cdr);
-  eassert (!CONS_MARKED_P (XCONS (val)));
+  eassert (!XCONS_MARKED_P (XCONS (val)));
   consing_since_gc += sizeof (struct Lisp_Cons);
-  total_free_conses--;
+  gcstat.total_free_conses--;
   cons_cells_consed++;
   return val;
 }
@@ -2823,50 +2864,57 @@ list3 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object 
arg3)
   return Fcons (arg1, Fcons (arg2, Fcons (arg3, Qnil)));
 }
 
-
 Lisp_Object
 list4 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4)
 {
   return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4, Qnil))));
 }
 
-
 Lisp_Object
-list5 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4, 
Lisp_Object arg5)
+list5 (Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3, Lisp_Object arg4,
+       Lisp_Object arg5)
 {
   return Fcons (arg1, Fcons (arg2, Fcons (arg3, Fcons (arg4,
                                                       Fcons (arg5, Qnil)))));
 }
 
-/* Make a list of COUNT Lisp_Objects, where ARG is the
-   first one.  Allocate conses from pure space if TYPE
-   is CONSTYPE_PURE, or allocate as usual if type is CONSTYPE_HEAP.  */
-
-Lisp_Object
-listn (enum constype type, ptrdiff_t count, Lisp_Object arg, ...)
+/* Make a list of COUNT Lisp_Objects, where ARG is the first one.
+   Use CONS to construct the pairs.  AP has any remaining args.  */
+static Lisp_Object
+cons_listn (ptrdiff_t count, Lisp_Object arg,
+           Lisp_Object (*cons) (Lisp_Object, Lisp_Object), va_list ap)
 {
-  Lisp_Object (*cons) (Lisp_Object, Lisp_Object);
-  switch (type)
-    {
-    case CONSTYPE_PURE: cons = pure_cons; break;
-    case CONSTYPE_HEAP: cons = Fcons; break;
-    default: emacs_abort ();
-    }
-
   eassume (0 < count);
   Lisp_Object val = cons (arg, Qnil);
   Lisp_Object tail = val;
-
-  va_list ap;
-  va_start (ap, arg);
   for (ptrdiff_t i = 1; i < count; i++)
     {
       Lisp_Object elem = cons (va_arg (ap, Lisp_Object), Qnil);
       XSETCDR (tail, elem);
       tail = elem;
     }
+  return val;
+}
+
+/* Make a list of COUNT Lisp_Objects, where ARG1 is the first one.  */
+Lisp_Object
+listn (ptrdiff_t count, Lisp_Object arg1, ...)
+{
+  va_list ap;
+  va_start (ap, arg1);
+  Lisp_Object val = cons_listn (count, arg1, Fcons, ap);
   va_end (ap);
+  return val;
+}
 
+/* Make a pure list of COUNT Lisp_Objects, where ARG1 is the first one.  */
+Lisp_Object
+pure_listn (ptrdiff_t count, Lisp_Object arg1, ...)
+{
+  va_list ap;
+  va_start (ap, arg1);
+  Lisp_Object val = cons_listn (count, arg1, pure_cons, ap);
+  va_end (ap);
   return val;
 }
 
@@ -3035,14 +3083,6 @@ static struct large_vector *large_vectors;
 
 Lisp_Object zero_vector;
 
-/* Number of live vectors.  */
-
-static EMACS_INT total_vectors;
-
-/* Total size of live and free vectors, in Lisp_Object units.  */
-
-static EMACS_INT total_vector_slots, total_free_vector_slots;
-
 /* Common shortcut to setup vector on a free list.  */
 
 static void
@@ -3057,7 +3097,7 @@ setup_on_free_list (struct Lisp_Vector *v, ptrdiff_t 
nbytes)
   eassert (vindex < VECTOR_MAX_FREE_LIST_INDEX);
   set_next_vector (v, vector_free_lists[vindex]);
   vector_free_lists[vindex] = v;
-  total_free_vector_slots += nbytes / word_size;
+  gcstat.total_free_vector_slots += nbytes / word_size;
 }
 
 /* Get a new vector block.  */
@@ -3083,6 +3123,7 @@ static void
 init_vectors (void)
 {
   zero_vector = make_pure_vector (0);
+  staticpro (&zero_vector);
 }
 
 /* Allocate vector from a vector block.  */
@@ -3104,7 +3145,7 @@ allocate_vector_from_block (ptrdiff_t nbytes)
     {
       vector = vector_free_lists[index];
       vector_free_lists[index] = next_vector (vector);
-      total_free_vector_slots -= nbytes / word_size;
+      gcstat.total_free_vector_slots -= nbytes / word_size;
       return vector;
     }
 
@@ -3118,7 +3159,7 @@ allocate_vector_from_block (ptrdiff_t nbytes)
        /* This vector is larger than requested.  */
        vector = vector_free_lists[index];
        vector_free_lists[index] = next_vector (vector);
-       total_free_vector_slots -= nbytes / word_size;
+       gcstat.total_free_vector_slots -= nbytes / word_size;
 
        /* Excess bytes are used for the smaller vector,
           which should be set on an appropriate free list.  */
@@ -3153,17 +3194,17 @@ allocate_vector_from_block (ptrdiff_t nbytes)
 
 /* Return the memory footprint of V in bytes.  */
 
-static ptrdiff_t
-vector_nbytes (struct Lisp_Vector *v)
+ptrdiff_t
+vectorlike_nbytes (const union vectorlike_header *hdr)
 {
-  ptrdiff_t size = v->header.size & ~ARRAY_MARK_FLAG;
+  ptrdiff_t size = hdr->size & ~ARRAY_MARK_FLAG;
   ptrdiff_t nwords;
 
   if (size & PSEUDOVECTOR_FLAG)
     {
-      if (PSEUDOVECTOR_TYPEP (&v->header, PVEC_BOOL_VECTOR))
+      if (PSEUDOVECTOR_TYPEP (hdr, PVEC_BOOL_VECTOR))
         {
-          struct Lisp_Bool_Vector *bv = (struct Lisp_Bool_Vector *) v;
+          struct Lisp_Bool_Vector *bv = (struct Lisp_Bool_Vector *) hdr;
          ptrdiff_t word_bytes = (bool_vector_words (bv->size)
                                  * sizeof (bits_word));
          ptrdiff_t boolvec_bytes = bool_header_size + word_bytes;
@@ -3249,7 +3290,8 @@ sweep_vectors (void)
   struct large_vector *lv, **lvprev = &large_vectors;
   struct Lisp_Vector *vector, *next;
 
-  total_vectors = total_vector_slots = total_free_vector_slots = 0;
+  gcstat.total_vectors = 0;
+  gcstat.total_vector_slots = gcstat.total_free_vector_slots = 0;
   memset (vector_free_lists, 0, sizeof (vector_free_lists));
 
   /* Looking through vector blocks.  */
@@ -3261,12 +3303,12 @@ sweep_vectors (void)
       for (vector = (struct Lisp_Vector *) block->data;
           VECTOR_IN_BLOCK (vector, block); vector = next)
        {
-         if (VECTOR_MARKED_P (vector))
+         if (XVECTOR_MARKED_P (vector))
            {
-             VECTOR_UNMARK (vector);
-             total_vectors++;
+             XUNMARK_VECTOR (vector);
+             gcstat.total_vectors++;
              ptrdiff_t nbytes = vector_nbytes (vector);
-             total_vector_slots += nbytes / word_size;
+             gcstat.total_vector_slots += nbytes / word_size;
              next = ADVANCE (vector, nbytes);
            }
          else
@@ -3284,7 +3326,7 @@ sweep_vectors (void)
                  total_bytes += nbytes;
                  next = ADVANCE (next, nbytes);
                }
-             while (VECTOR_IN_BLOCK (next, block) && !VECTOR_MARKED_P (next));
+             while (VECTOR_IN_BLOCK (next, block) && !vector_marked_p (next));
 
              eassert (total_bytes % roundup_size == 0);
 
@@ -3315,15 +3357,14 @@ sweep_vectors (void)
   for (lv = large_vectors; lv; lv = *lvprev)
     {
       vector = large_vector_vec (lv);
-      if (VECTOR_MARKED_P (vector))
+      if (XVECTOR_MARKED_P (vector))
        {
-         VECTOR_UNMARK (vector);
-         total_vectors++;
-         if (vector->header.size & PSEUDOVECTOR_FLAG)
-            total_vector_slots += vector_nbytes (vector) / word_size;
-         else
-           total_vector_slots
-             += header_size / word_size + vector->header.size;
+         XUNMARK_VECTOR (vector);
+         gcstat.total_vectors++;
+         gcstat.total_vector_slots
+           += (vector->header.size & PSEUDOVECTOR_FLAG
+               ? vector_nbytes (vector) / word_size
+               : header_size / word_size + vector->header.size);
          lvprev = &lv->next;
        }
       else
@@ -3334,70 +3375,72 @@ sweep_vectors (void)
     }
 }
 
+/* Maximum number of elements in a vector.  This is a macro so that it
+   can be used in an integer constant expression.  */
+
+#define VECTOR_ELTS_MAX \
+  ((ptrdiff_t) \
+   min (((min (PTRDIFF_MAX, SIZE_MAX) - header_size - large_vector_offset) \
+        / word_size), \
+       MOST_POSITIVE_FIXNUM))
+
 /* Value is a pointer to a newly allocated Lisp_Vector structure
-   with room for LEN Lisp_Objects.  */
+   with room for LEN Lisp_Objects.  LEN must be positive and
+   at most VECTOR_ELTS_MAX.  */
 
 static struct Lisp_Vector *
 allocate_vectorlike (ptrdiff_t len)
 {
-  if (len == 0)
-    return XVECTOR (zero_vector);
-  else
-    {
-      size_t nbytes = header_size + len * word_size;
-      struct Lisp_Vector *p;
+  eassert (0 < len && len <= VECTOR_ELTS_MAX);
+  ptrdiff_t nbytes = header_size + len * word_size;
+  struct Lisp_Vector *p;
 
-      MALLOC_BLOCK_INPUT;
+  MALLOC_BLOCK_INPUT;
 
 #ifdef DOUG_LEA_MALLOC
-      if (!mmap_lisp_allowed_p ())
-        mallopt (M_MMAP_MAX, 0);
+  if (!mmap_lisp_allowed_p ())
+    mallopt (M_MMAP_MAX, 0);
 #endif
 
-      if (nbytes <= VBLOCK_BYTES_MAX)
-       p = allocate_vector_from_block (vroundup (nbytes));
-      else
-       {
-         struct large_vector *lv
-           = lisp_malloc ((large_vector_offset + header_size
-                           + len * word_size),
-                          MEM_TYPE_VECTORLIKE);
-         lv->next = large_vectors;
-         large_vectors = lv;
-         p = large_vector_vec (lv);
-       }
+  if (nbytes <= VBLOCK_BYTES_MAX)
+    p = allocate_vector_from_block (vroundup (nbytes));
+  else
+    {
+      struct large_vector *lv = lisp_malloc (large_vector_offset + nbytes,
+                                            MEM_TYPE_VECTORLIKE);
+      lv->next = large_vectors;
+      large_vectors = lv;
+      p = large_vector_vec (lv);
+    }
 
 #ifdef DOUG_LEA_MALLOC
-      if (!mmap_lisp_allowed_p ())
-        mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
+  if (!mmap_lisp_allowed_p ())
+    mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);
 #endif
 
-      if (find_suspicious_object_in_range (p, (char *) p + nbytes))
-        emacs_abort ();
+  if (find_suspicious_object_in_range (p, (char *) p + nbytes))
+    emacs_abort ();
 
-      consing_since_gc += nbytes;
-      vector_cells_consed += len;
+  consing_since_gc += nbytes;
+  vector_cells_consed += len;
 
-      MALLOC_UNBLOCK_INPUT;
+  MALLOC_UNBLOCK_INPUT;
 
-      return ptr_bounds_clip (p, nbytes);
-    }
+  return ptr_bounds_clip (p, nbytes);
 }
 
 
 /* Allocate a vector with LEN slots.  */
 
 struct Lisp_Vector *
-allocate_vector (EMACS_INT len)
+allocate_vector (ptrdiff_t len)
 {
-  struct Lisp_Vector *v;
-  ptrdiff_t nbytes_max = min (PTRDIFF_MAX, SIZE_MAX);
-
-  if (min ((nbytes_max - header_size) / word_size, MOST_POSITIVE_FIXNUM) < len)
+  if (len == 0)
+    return XVECTOR (zero_vector);
+  if (VECTOR_ELTS_MAX < len)
     memory_full (SIZE_MAX);
-  v = allocate_vectorlike (len);
-  if (len)
-    v->header.size = len;
+  struct Lisp_Vector *v = allocate_vectorlike (len);
+  v->header.size = len;
   return v;
 }
 
@@ -3408,14 +3451,16 @@ struct Lisp_Vector *
 allocate_pseudovector (int memlen, int lisplen,
                       int zerolen, enum pvec_type tag)
 {
-  struct Lisp_Vector *v = allocate_vectorlike (memlen);
-
   /* Catch bogus values.  */
+  enum { size_max = (1 << PSEUDOVECTOR_SIZE_BITS) - 1 };
+  enum { rest_max = (1 << PSEUDOVECTOR_REST_BITS) - 1 };
+  verify (size_max + rest_max <= VECTOR_ELTS_MAX);
   eassert (0 <= tag && tag <= PVEC_FONT);
   eassert (0 <= lisplen && lisplen <= zerolen && zerolen <= memlen);
-  eassert (memlen - lisplen <= (1 << PSEUDOVECTOR_REST_BITS) - 1);
-  eassert (lisplen <= PSEUDOVECTOR_SIZE_MASK);
+  eassert (lisplen <= size_max);
+  eassert (memlen <= size_max + rest_max);
 
+  struct Lisp_Vector *v = allocate_vectorlike (memlen);
   /* Only the first LISPLEN slots will be traced normally by the GC.  */
   memclear (v->contents, zerolen * word_size);
   XSETPVECTYPESIZE (v, tag, lisplen, memlen - lisplen);
@@ -3488,9 +3533,18 @@ DEFUN ("make-vector", Fmake_vector, Smake_vector, 2, 2, 
0,
 See also the function `vector'.  */)
   (Lisp_Object length, Lisp_Object init)
 {
-  CHECK_FIXNAT (length);
-  struct Lisp_Vector *p = allocate_vector (XFIXNAT (length));
-  for (ptrdiff_t i = 0; i < XFIXNAT (length); i++)
+  CHECK_TYPE (FIXNATP (length) && XFIXNAT (length) <= PTRDIFF_MAX,
+             Qwholenump, length);
+  return make_vector (XFIXNAT (length), init);
+}
+
+/* Return a new vector of length LENGTH with each element being INIT.  */
+
+Lisp_Object
+make_vector (ptrdiff_t length, Lisp_Object init)
+{
+  struct Lisp_Vector *p = allocate_vector (length);
+  for (ptrdiff_t i = 0; i < length; i++)
     p->contents[i] = init;
   return make_lisp_ptr (p, Lisp_Vectorlike);
 }
@@ -3644,7 +3698,7 @@ Its value is void, and its function definition and 
property list are nil.  */)
          new->next = symbol_block;
          symbol_block = new;
          symbol_block_index = 0;
-         total_free_symbols += SYMBOL_BLOCK_SIZE;
+         gcstat.total_free_symbols += SYMBOL_BLOCK_SIZE;
        }
       XSETSYMBOL (val, &symbol_block->symbols[symbol_block_index]);
       symbol_block_index++;
@@ -3655,7 +3709,7 @@ Its value is void, and its function definition and 
property list are nil.  */)
   init_symbol (val, name);
   consing_since_gc += sizeof (struct Lisp_Symbol);
   symbols_consed++;
-  total_free_symbols--;
+  gcstat.total_free_symbols--;
   return val;
 }
 
@@ -3829,7 +3883,7 @@ mark_finalizer_list (struct Lisp_Finalizer *head)
        finalizer != head;
        finalizer = finalizer->next)
     {
-      VECTOR_MARK (finalizer);
+      set_vectorlike_marked (&finalizer->header);
       mark_object (finalizer->function);
     }
 }
@@ -3846,7 +3900,8 @@ queue_doomed_finalizers (struct Lisp_Finalizer *dest,
   while (finalizer != src)
     {
       struct Lisp_Finalizer *next = finalizer->next;
-      if (!VECTOR_MARKED_P (finalizer) && !NILP (finalizer->function))
+      if (!vectorlike_marked_p (&finalizer->header)
+          && !NILP (finalizer->function))
         {
           unchain_finalizer (finalizer);
           finalizer_insert (dest, finalizer);
@@ -3867,6 +3922,9 @@ static void
 run_finalizer_function (Lisp_Object function)
 {
   ptrdiff_t count = SPECPDL_INDEX ();
+#ifdef HAVE_PDUMPER
+  ++number_finalizers_run;
+#endif
 
   specbind (Qinhibit_quit, Qt);
   internal_condition_case_1 (call0, function, Qt, run_finalizer_handler);
@@ -3911,6 +3969,126 @@ FUNCTION.  FUNCTION will be run once per finalizer 
object.  */)
 
 
 /************************************************************************
+                         Mark bit access functions
+ ************************************************************************/
+
+/* With the rare exception of functions implementing block-based
+   allocation of various types, you should not directly test or set GC
+   mark bits on objects.  Some objects might live in special memory
+   regions (e.g., a dump image) and might store their mark bits
+   elsewhere.  */
+
+static bool
+vector_marked_p (const struct Lisp_Vector *v)
+{
+  if (pdumper_object_p (v))
+    {
+      /* Look at cold_start first so that we don't have to fault in
+         the vector header just to tell that it's a bool vector.  */
+      if (pdumper_cold_object_p (v))
+        {
+          eassert (PSEUDOVECTOR_TYPE (v) == PVEC_BOOL_VECTOR);
+          return true;
+        }
+      return pdumper_marked_p (v);
+    }
+  return XVECTOR_MARKED_P (v);
+}
+
+static void
+set_vector_marked (struct Lisp_Vector *v)
+{
+  if (pdumper_object_p (v))
+    {
+      eassert (PSEUDOVECTOR_TYPE (v) != PVEC_BOOL_VECTOR);
+      pdumper_set_marked (v);
+    }
+  else
+    XMARK_VECTOR (v);
+}
+
+static bool
+vectorlike_marked_p (const union vectorlike_header *header)
+{
+  return vector_marked_p ((const struct Lisp_Vector *) header);
+}
+
+static void
+set_vectorlike_marked (union vectorlike_header *header)
+{
+  set_vector_marked ((struct Lisp_Vector *) header);
+}
+
+static bool
+cons_marked_p (const struct Lisp_Cons *c)
+{
+  return pdumper_object_p (c)
+    ? pdumper_marked_p (c)
+    : XCONS_MARKED_P (c);
+}
+
+static void
+set_cons_marked (struct Lisp_Cons *c)
+{
+  if (pdumper_object_p (c))
+    pdumper_set_marked (c);
+  else
+    XMARK_CONS (c);
+}
+
+static bool
+string_marked_p (const struct Lisp_String *s)
+{
+  return pdumper_object_p (s)
+    ? pdumper_marked_p (s)
+    : XSTRING_MARKED_P (s);
+}
+
+static void
+set_string_marked (struct Lisp_String *s)
+{
+  if (pdumper_object_p (s))
+    pdumper_set_marked (s);
+  else
+    XMARK_STRING (s);
+}
+
+static bool
+symbol_marked_p (const struct Lisp_Symbol *s)
+{
+  return pdumper_object_p (s)
+    ? pdumper_marked_p (s)
+    : s->u.s.gcmarkbit;
+}
+
+static void
+set_symbol_marked (struct Lisp_Symbol *s)
+{
+  if (pdumper_object_p (s))
+    pdumper_set_marked (s);
+  else
+    s->u.s.gcmarkbit = true;
+}
+
+static bool
+interval_marked_p (INTERVAL i)
+{
+  return pdumper_object_p (i)
+    ? pdumper_marked_p (i)
+    : i->gcmarkbit;
+}
+
+static void
+set_interval_marked (INTERVAL i)
+{
+  if (pdumper_object_p (i))
+    pdumper_set_marked (i);
+  else
+    i->gcmarkbit = true;
+}
+
+
+/************************************************************************
                           Memory Full Handling
  ************************************************************************/
 
@@ -3926,7 +4104,7 @@ void
 memory_full (size_t nbytes)
 {
   /* Do not go into hysterics merely because a large request failed.  */
-  bool enough_free_memory = 0;
+  bool enough_free_memory = false;
   if (SPARE_MEMORY < nbytes)
     {
       void *p;
@@ -3936,21 +4114,17 @@ memory_full (size_t nbytes)
       if (p)
        {
          free (p);
-         enough_free_memory = 1;
+         enough_free_memory = true;
        }
       MALLOC_UNBLOCK_INPUT;
     }
 
   if (! enough_free_memory)
     {
-      int i;
-
       Vmemory_full = Qt;
 
-      memory_full_cons_threshold = sizeof (struct cons_block);
-
       /* The first time we get here, free the spare memory.  */
-      for (i = 0; i < ARRAYELTS (spare_memory); i++)
+      for (int i = 0; i < ARRAYELTS (spare_memory); i++)
        if (spare_memory[i])
          {
            if (i == 0)
@@ -4608,14 +4782,29 @@ static void
 mark_maybe_object (Lisp_Object obj)
 {
 #if USE_VALGRIND
-  if (valgrind_p)
-    VALGRIND_MAKE_MEM_DEFINED (&obj, sizeof (obj));
+  VALGRIND_MAKE_MEM_DEFINED (&obj, sizeof (obj));
 #endif
 
   if (FIXNUMP (obj))
     return;
 
   void *po = XPNTR (obj);
+
+  /* If the pointer is in the dumped image and the dump has a record
+     of the object starting at the place where the pointer points, we
+     definitely have an object.  If the pointer is in the dumped image
+     and the dump has no idea what the pointer is pointing at, we
+     definitely _don't_ have an object.  */
+  if (pdumper_object_p (po))
+    {
+      /* Don't use pdumper_object_p_precise here! It doesn't check the
+         tag bits. OBJ here might be complete garbage, so we need to
+         verify both the pointer and the tag.  */
+      if (XTYPE (obj) == pdumper_find_object_type (po))
+        mark_object (obj);
+      return;
+    }
+
   struct mem_node *m = mem_find (po);
 
   if (m != MEM_NIL)
@@ -4655,9 +4844,9 @@ mark_maybe_object (Lisp_Object obj)
 }
 
 void
-mark_maybe_objects (Lisp_Object *array, ptrdiff_t nelts)
+mark_maybe_objects (Lisp_Object const *array, ptrdiff_t nelts)
 {
-  for (Lisp_Object *lim = array + nelts; array < lim; array++)
+  for (Lisp_Object const *lim = array + nelts; array < lim; array++)
     mark_maybe_object (*array);
 }
 
@@ -4685,9 +4874,8 @@ mark_maybe_pointer (void *p)
 {
   struct mem_node *m;
 
-#if USE_VALGRIND
-  if (valgrind_p)
-    VALGRIND_MAKE_MEM_DEFINED (&p, sizeof (p));
+#ifdef USE_VALGRIND
+  VALGRIND_MAKE_MEM_DEFINED (&p, sizeof (p));
 #endif
 
   if (sizeof (Lisp_Object) == sizeof (void *) || !HAVE_MODULES)
@@ -4702,6 +4890,17 @@ mark_maybe_pointer (void *p)
       p = (void *) ((uintptr_t) p & ~((1 << GCTYPEBITS) - 1));
     }
 
+  if (pdumper_object_p (p))
+    {
+      enum Lisp_Type type = pdumper_find_object_type (p);
+      if (type != PDUMPER_NO_OBJECT)
+        mark_object ((type == Lisp_Symbol)
+                     ? make_lisp_symbol(p)
+                     : make_lisp_ptr(p, type));
+      /* See mark_maybe_object for why we can confidently return.  */
+      return;
+    }
+
   m = mem_find (p);
   if (m != MEM_NIL)
     {
@@ -4759,15 +4958,15 @@ mark_maybe_pointer (void *p)
    or END+OFFSET..START.  */
 
 static void ATTRIBUTE_NO_SANITIZE_ADDRESS
-mark_memory (void *start, void *end)
+mark_memory (void const *start, void const *end)
 {
-  char *pp;
+  char const *pp;
 
   /* Make START the pointer to the start of the memory region,
      if it isn't already.  */
   if (end < start)
     {
-      void *tem = start;
+      void const *tem = start;
       start = end;
       end = tem;
     }
@@ -4783,7 +4982,7 @@ mark_memory (void *start, void *end)
      {
        Lisp_Object obj = build_string ("test");
        struct Lisp_String *s = XSTRING (obj);
-       Fgarbage_collect ();
+       garbage_collect ();
        fprintf (stderr, "test '%s'\n", s->u.s.data);
        return Qnil;
      }
@@ -4792,14 +4991,14 @@ mark_memory (void *start, void *end)
      away.  The only reference to the life string is through the
      pointer `s'.  */
 
-  for (pp = start; (void *) pp < end; pp += GC_POINTER_ALIGNMENT)
+  for (pp = start; (void const *) pp < end; pp += GC_POINTER_ALIGNMENT)
     {
-      mark_maybe_pointer (*(void **) pp);
+      mark_maybe_pointer (*(void *const *) pp);
 
       verify (alignof (Lisp_Object) % GC_POINTER_ALIGNMENT == 0);
       if (alignof (Lisp_Object) == GC_POINTER_ALIGNMENT
          || (uintptr_t) pp % alignof (Lisp_Object) == 0)
-       mark_maybe_object (*(Lisp_Object *) pp);
+       mark_maybe_object (*(Lisp_Object const *) pp);
     }
 }
 
@@ -5001,7 +5200,7 @@ typedef union
    from the stack start.  */
 
 void
-mark_stack (char *bottom, char *end)
+mark_stack (char const *bottom, char const *end)
 {
   /* This assumes that the stack is a contiguous region in memory.  If
      that's not the case, something has to be done here to iterate
@@ -5058,6 +5257,12 @@ valid_pointer_p (void *p)
     return p ? -1 : 0;
 
   int fd[2];
+  static int under_rr_state;
+
+  if (!under_rr_state)
+    under_rr_state = getenv ("RUNNING_UNDER_RR") ? -1 : 1;
+  if (under_rr_state < 0)
+    return under_rr_state;
 
   /* Obviously, we cannot just access it (we would SEGV trying), so we
      trick the o/s to tell us whether p is a valid pointer.
@@ -5097,6 +5302,9 @@ valid_lisp_object_p (Lisp_Object obj)
   if (p == &buffer_defaults || p == &buffer_local_symbols)
     return 2;
 
+  if (pdumper_object_p (p))
+    return pdumper_object_p_precise (p) ? 1 : 0;
+
   struct mem_node *m = mem_find (p);
 
   if (m == MEM_NIL)
@@ -5149,7 +5357,8 @@ valid_lisp_object_p (Lisp_Object obj)
 
 /* Allocate room for SIZE bytes from pure Lisp storage and return a
    pointer to it.  TYPE is the Lisp type for which the memory is
-   allocated.  TYPE < 0 means it's not used for a Lisp object.  */
+   allocated.  TYPE < 0 means it's not used for a Lisp object,
+   and that the result should have an alignment of -TYPE.  */
 
 static void *
 pure_alloc (size_t size, int type)
@@ -5168,8 +5377,11 @@ pure_alloc (size_t size, int type)
     {
       /* Allocate space for a non-Lisp object from the end of the free
         space.  */
-      pure_bytes_used_non_lisp += size;
-      result = purebeg + pure_size - pure_bytes_used_non_lisp;
+      ptrdiff_t unaligned_non_lisp = pure_bytes_used_non_lisp + size;
+      char *unaligned = purebeg + pure_size - unaligned_non_lisp;
+      int decr = (intptr_t) unaligned & (-1 - type);
+      pure_bytes_used_non_lisp = unaligned_non_lisp + decr;
+      result = unaligned - decr;
     }
   pure_bytes_used = pure_bytes_used_lisp + pure_bytes_used_non_lisp;
 
@@ -5188,7 +5400,7 @@ pure_alloc (size_t size, int type)
 }
 
 
-#ifndef CANNOT_DUMP
+#ifdef HAVE_UNEXEC
 
 /* Print a warning if PURESIZE is too small.  */
 
@@ -5306,7 +5518,7 @@ make_pure_c_string (const char *data, ptrdiff_t nchars)
   Lisp_Object string;
   struct Lisp_String *s = pure_alloc (sizeof *s, Lisp_String);
   s->u.s.size = nchars;
-  s->u.s.size_byte = -1;
+  s->u.s.size_byte = -2;
   s->u.s.data = (unsigned char *) data;
   s->u.s.intervals = NULL;
   XSETSTRING (string, s);
@@ -5356,7 +5568,8 @@ make_pure_bignum (struct Lisp_Bignum *value)
   struct Lisp_Bignum *b = pure_alloc (sizeof *b, Lisp_Vectorlike);
   XSETPVECTYPESIZE (b, PVEC_BIGNUM, 0, VECSIZE (struct Lisp_Bignum));
 
-  pure_limbs = pure_alloc (nbytes, -1);
+  int limb_alignment = alignof (mp_limb_t);
+  pure_limbs = pure_alloc (nbytes, - limb_alignment);
   for (i = 0; i < nlimbs; ++i)
     pure_limbs[i] = mpz_getlimbn (value->value, i);
 
@@ -5533,8 +5746,10 @@ purecopy (Lisp_Object obj)
    VARADDRESS.  */
 
 void
-staticpro (Lisp_Object *varaddress)
+staticpro (Lisp_Object const *varaddress)
 {
+  for (int i = 0; i < staticidx; i++)
+    eassert (staticvec[i] != varaddress);
   if (staticidx >= NSTATICS)
     fatal ("NSTATICS too small; try increasing and recompiling Emacs.");
   staticvec[staticidx++] = varaddress;
@@ -5556,28 +5771,29 @@ inhibit_garbage_collection (void)
   return count;
 }
 
-/* Used to avoid possible overflows when
-   converting from C to Lisp integers.  */
+/* Return the number of bytes in N objects each of size S, guarding
+   against overflow if size_t is narrower than byte_ct.  */
 
-static Lisp_Object
-bounded_number (EMACS_INT number)
+static byte_ct
+object_bytes (object_ct n, size_t s)
 {
-  return make_fixnum (min (MOST_POSITIVE_FIXNUM, number));
+  byte_ct b = s;
+  return n * b;
 }
 
 /* Calculate total bytes of live objects.  */
 
-static size_t
+static byte_ct
 total_bytes_of_live_objects (void)
 {
-  size_t tot = 0;
-  tot += total_conses  * sizeof (struct Lisp_Cons);
-  tot += total_symbols * sizeof (struct Lisp_Symbol);
-  tot += total_string_bytes;
-  tot += total_vector_slots * word_size;
-  tot += total_floats  * sizeof (struct Lisp_Float);
-  tot += total_intervals * sizeof (struct interval);
-  tot += total_strings * sizeof (struct Lisp_String);
+  byte_ct tot = 0;
+  tot += object_bytes (gcstat.total_conses, sizeof (struct Lisp_Cons));
+  tot += object_bytes (gcstat.total_symbols, sizeof (struct Lisp_Symbol));
+  tot += gcstat.total_string_bytes;
+  tot += object_bytes (gcstat.total_vector_slots, word_size);
+  tot += object_bytes (gcstat.total_floats, sizeof (struct Lisp_Float));
+  tot += object_bytes (gcstat.total_intervals, sizeof (struct interval));
+  tot += object_bytes (gcstat.total_strings, sizeof (struct Lisp_String));
   return tot;
 }
 
@@ -5598,7 +5814,7 @@ compact_font_cache_entry (Lisp_Object entry)
 
       /* Consider OBJ if it is (font-spec . [font-entity font-entity ...]).  */
       if (CONSP (obj) && GC_FONT_SPEC_P (XCAR (obj))
-         && !VECTOR_MARKED_P (GC_XFONT_SPEC (XCAR (obj)))
+         && !vectorlike_marked_p (&GC_XFONT_SPEC (XCAR (obj))->header)
          /* Don't use VECTORP here, as that calls ASIZE, which could
             hit assertion violation during GC.  */
          && (VECTORLIKEP (XCDR (obj))
@@ -5614,7 +5830,8 @@ compact_font_cache_entry (Lisp_Object entry)
             {
               Lisp_Object objlist;
 
-              if (VECTOR_MARKED_P (GC_XFONT_ENTITY (AREF (obj_cdr, i))))
+              if (vectorlike_marked_p (
+                    &GC_XFONT_ENTITY (AREF (obj_cdr, i))->header))
                 break;
 
               objlist = AREF (AREF (obj_cdr, i), FONT_OBJLIST_INDEX);
@@ -5624,7 +5841,7 @@ compact_font_cache_entry (Lisp_Object entry)
                   struct font *font = GC_XFONT_OBJECT (val);
 
                   if (!NILP (AREF (val, FONT_TYPE_INDEX))
-                      && VECTOR_MARKED_P(font))
+                      && vectorlike_marked_p(&font->header))
                     break;
                 }
               if (CONSP (objlist))
@@ -5693,7 +5910,7 @@ compact_undo_list (Lisp_Object list)
     {
       if (CONSP (XCAR (tail))
          && MARKERP (XCAR (XCAR (tail)))
-         && !VECTOR_MARKED_P (XMARKER (XCAR (XCAR (tail)))))
+         && !vectorlike_marked_p (&XMARKER (XCAR (XCAR (tail)))->header))
        *prev = XCDR (tail);
       else
        prev = xcdr_addr (tail);
@@ -5726,29 +5943,122 @@ mark_pinned_symbols (void)
     }
 }
 
-/* Subroutine of Fgarbage_collect that does most of the work.  It is a
-   separate function so that we could limit mark_stack in searching
-   the stack frames below this function, thus avoiding the rare cases
-   where mark_stack finds values that look like live Lisp objects on
-   portions of stack that couldn't possibly contain such live objects.
-   For more details of this, see the discussion at
-   https://lists.gnu.org/r/emacs-devel/2014-05/msg00270.html.  */
-static Lisp_Object
-garbage_collect_1 (void *end)
+static void
+visit_vectorlike_root (struct gc_root_visitor visitor,
+                       struct Lisp_Vector *ptr,
+                       enum gc_root_type type)
+{
+  ptrdiff_t size = ptr->header.size;
+  ptrdiff_t i;
+
+  if (size & PSEUDOVECTOR_FLAG)
+    size &= PSEUDOVECTOR_SIZE_MASK;
+  for (i = 0; i < size; i++)
+    visitor.visit (&ptr->contents[i], type, visitor.data);
+}
+
+static void
+visit_buffer_root (struct gc_root_visitor visitor,
+                   struct buffer *buffer,
+                   enum gc_root_type type)
+{
+  /* Buffers that are roots don't have intervals, an undo list, or
+     other constructs that real buffers have.  */
+  eassert (buffer->base_buffer == NULL);
+  eassert (buffer->overlays_before == NULL);
+  eassert (buffer->overlays_after == NULL);
+
+  /* Visit the buffer-locals.  */
+  visit_vectorlike_root (visitor, (struct Lisp_Vector *) buffer, type);
+}
+
+/* Visit GC roots stored in the Emacs data section.  Used by both core
+   GC and by the portable dumping code.
+
+   There are other GC roots of course, but these roots are dynamic
+   runtime data structures that pdump doesn't care about and so we can
+   continue to mark those directly in garbage_collect_1.  */
+void
+visit_static_gc_roots (struct gc_root_visitor visitor)
+{
+  visit_buffer_root (visitor,
+                     &buffer_defaults,
+                     GC_ROOT_BUFFER_LOCAL_DEFAULT);
+  visit_buffer_root (visitor,
+                     &buffer_local_symbols,
+                     GC_ROOT_BUFFER_LOCAL_NAME);
+
+  for (int i = 0; i < ARRAYELTS (lispsym); i++)
+    {
+      Lisp_Object sptr = builtin_lisp_symbol (i);
+      visitor.visit (&sptr, GC_ROOT_C_SYMBOL, visitor.data);
+    }
+
+  for (int i = 0; i < staticidx; i++)
+    visitor.visit (staticvec[i], GC_ROOT_STATICPRO, visitor.data);
+}
+
+static void
+mark_object_root_visitor (Lisp_Object const *root_ptr,
+                          enum gc_root_type type,
+                          void *data)
+{
+  mark_object (*root_ptr);
+}
+
+/* List of weak hash tables we found during marking the Lisp heap.
+   Will be NULL on entry to garbage_collect_1 and after it
+   returns.  */
+static struct Lisp_Hash_Table *weak_hash_tables;
+
+NO_INLINE /* For better stack traces */
+static void
+mark_and_sweep_weak_table_contents (void)
+{
+  struct Lisp_Hash_Table *h;
+  bool marked;
+
+  /* Mark all keys and values that are in use.  Keep on marking until
+     there is no more change.  This is necessary for cases like
+     value-weak table A containing an entry X -> Y, where Y is used in a
+     key-weak table B, Z -> Y.  If B comes after A in the list of weak
+     tables, X -> Y might be removed from A, although when looking at B
+     one finds that it shouldn't.  */
+  do
+    {
+      marked = false;
+      for (h = weak_hash_tables; h; h = h->next_weak)
+        marked |= sweep_weak_table (h, false);
+    }
+  while (marked);
+
+  /* Remove hash table entries that aren't used.  */
+  while (weak_hash_tables)
+    {
+      h = weak_hash_tables;
+      weak_hash_tables = h->next_weak;
+      h->next_weak = NULL;
+      sweep_weak_table (h, true);
+    }
+}
+
+/* Subroutine of Fgarbage_collect that does most of the work.  */
+static bool
+garbage_collect_1 (struct gcstat *gcst)
 {
   struct buffer *nextb;
   char stack_top_variable;
-  ptrdiff_t i;
   bool message_p;
   ptrdiff_t count = SPECPDL_INDEX ();
   struct timespec start;
-  Lisp_Object retval = Qnil;
-  size_t tot_before = 0;
+  byte_ct tot_before = 0;
+
+  eassert (weak_hash_tables == NULL);
 
   /* Can't GC if pure storage overflowed because we can't determine
      if something is a pure object or not.  */
   if (pure_bytes_used_before_overflow)
-    return Qnil;
+    return false;
 
   /* Record this function, so it appears on the profiler's backtraces.  */
   record_in_backtrace (QAutomatic_GC, 0, 0);
@@ -5784,7 +6094,7 @@ garbage_collect_1 (void *end)
 #if MAX_SAVE_STACK > 0
   if (NILP (Vpurify_flag))
     {
-      char *stack;
+      char const *stack;
       ptrdiff_t stack_size;
       if (&stack_top_variable < stack_bottom)
        {
@@ -5820,14 +6130,8 @@ garbage_collect_1 (void *end)
 
   /* Mark all the special slots that serve as the roots of accessibility.  */
 
-  mark_buffer (&buffer_defaults);
-  mark_buffer (&buffer_local_symbols);
-
-  for (i = 0; i < ARRAYELTS (lispsym); i++)
-    mark_object (builtin_lisp_symbol (i));
-
-  for (i = 0; i < staticidx; i++)
-    mark_object (*staticvec[i]);
+  struct gc_root_visitor visitor = { .visit = mark_object_root_visitor };
+  visit_static_gc_roots (visitor);
 
   mark_pinned_objects ();
   mark_pinned_symbols ();
@@ -5872,11 +6176,11 @@ garbage_collect_1 (void *end)
   queue_doomed_finalizers (&doomed_finalizers, &finalizers);
   mark_finalizer_list (&doomed_finalizers);
 
-  gc_sweep ();
+  /* Must happen after all other marking and before gc_sweep.  */
+  mark_and_sweep_weak_table_contents ();
+  eassert (weak_hash_tables == NULL);
 
-  /* Clear the mark bits that we set in certain root slots.  */
-  VECTOR_UNMARK (&buffer_defaults);
-  VECTOR_UNMARK (&buffer_local_symbols);
+  gc_sweep ();
 
   unmark_main_thread ();
 
@@ -5898,10 +6202,10 @@ garbage_collect_1 (void *end)
       tot *= XFLOAT_DATA (Vgc_cons_percentage);
       if (0 < tot)
        {
-         if (tot < TYPE_MAXIMUM (EMACS_INT))
+         if (tot < UINTPTR_MAX)
            gc_relative_threshold = tot;
          else
-           gc_relative_threshold = TYPE_MAXIMUM (EMACS_INT);
+           gc_relative_threshold = UINTPTR_MAX;
        }
     }
 
@@ -5915,40 +6219,7 @@ garbage_collect_1 (void *end)
 
   unbind_to (count, Qnil);
 
-  Lisp_Object total[] = {
-    list4 (Qconses, make_fixnum (sizeof (struct Lisp_Cons)),
-          bounded_number (total_conses),
-          bounded_number (total_free_conses)),
-    list4 (Qsymbols, make_fixnum (sizeof (struct Lisp_Symbol)),
-          bounded_number (total_symbols),
-          bounded_number (total_free_symbols)),
-    list4 (Qstrings, make_fixnum (sizeof (struct Lisp_String)),
-          bounded_number (total_strings),
-          bounded_number (total_free_strings)),
-    list3 (Qstring_bytes, make_fixnum (1),
-          bounded_number (total_string_bytes)),
-    list3 (Qvectors,
-          make_fixnum (header_size + sizeof (Lisp_Object)),
-          bounded_number (total_vectors)),
-    list4 (Qvector_slots, make_fixnum (word_size),
-          bounded_number (total_vector_slots),
-          bounded_number (total_free_vector_slots)),
-    list4 (Qfloats, make_fixnum (sizeof (struct Lisp_Float)),
-          bounded_number (total_floats),
-          bounded_number (total_free_floats)),
-    list4 (Qintervals, make_fixnum (sizeof (struct interval)),
-          bounded_number (total_intervals),
-          bounded_number (total_free_intervals)),
-    list3 (Qbuffers, make_fixnum (sizeof (struct buffer)),
-          bounded_number (total_buffers)),
-
-#ifdef DOUG_LEA_MALLOC
-    list4 (Qheap, make_fixnum (1024),
-          bounded_number ((mallinfo ().uordblks + 1023) >> 10),
-          bounded_number ((mallinfo ().fordblks + 1023) >> 10)),
-#endif
-  };
-  retval = CALLMANY (Flist, total);
+  *gcst = gcstat;
 
   /* GC is complete: now we can run our finalizer callbacks.  */
   run_finalizers (&doomed_finalizers);
@@ -5973,14 +6244,19 @@ garbage_collect_1 (void *end)
   /* Collect profiling data.  */
   if (profiler_memory_running)
     {
-      size_t swept = 0;
-      size_t tot_after = total_bytes_of_live_objects ();
-      if (tot_before > tot_after)
-       swept = tot_before - tot_after;
-      malloc_probe (swept);
+      byte_ct tot_after = total_bytes_of_live_objects ();
+      byte_ct swept = tot_before <= tot_after ? 0 : tot_before - tot_after;
+      malloc_probe (min (swept, SIZE_MAX));
     }
 
-  return retval;
+  return true;
+}
+
+void
+garbage_collect (void)
+{
+  struct gcstat gcst;
+  garbage_collect_1 (&gcst);
 }
 
 DEFUN ("garbage-collect", Fgarbage_collect, Sgarbage_collect, 0, 0, "",
@@ -5997,16 +6273,49 @@ where each entry has the form (NAME SIZE USED FREE), 
where:
   to return them to the OS).
 However, if there was overflow in pure space, `garbage-collect'
 returns nil, because real GC can't be done.
-See Info node `(elisp)Garbage Collection'.  */
-       attributes: noinline)
+See Info node `(elisp)Garbage Collection'.  */)
   (void)
 {
   ptrdiff_t count = SPECPDL_INDEX ();
-  void *end;
+  struct gcstat gcst;
   specbind (Qsymbols_with_pos_enabled, Qnil);
-  SET_STACK_TOP_ADDRESS (&end);
-  /* return garbage_collect_1 (end); */
-  return unbind_to (count, garbage_collect_1 (end));
+  if (!garbage_collect_1 (&gcst))
+    return unbind_to (count, Qnil);
+
+  Lisp_Object total[] = {
+    list4 (Qconses, make_fixnum (sizeof (struct Lisp_Cons)),
+          make_int (gcst.total_conses),
+          make_int (gcst.total_free_conses)),
+    list4 (Qsymbols, make_fixnum (sizeof (struct Lisp_Symbol)),
+          make_int (gcst.total_symbols),
+          make_int (gcst.total_free_symbols)),
+    list4 (Qstrings, make_fixnum (sizeof (struct Lisp_String)),
+          make_int (gcst.total_strings),
+          make_int (gcst.total_free_strings)),
+    list3 (Qstring_bytes, make_fixnum (1),
+          make_int (gcst.total_string_bytes)),
+    list3 (Qvectors,
+          make_fixnum (header_size + sizeof (Lisp_Object)),
+          make_int (gcst.total_vectors)),
+    list4 (Qvector_slots, make_fixnum (word_size),
+          make_int (gcst.total_vector_slots),
+          make_int (gcst.total_free_vector_slots)),
+    list4 (Qfloats, make_fixnum (sizeof (struct Lisp_Float)),
+          make_int (gcst.total_floats),
+          make_int (gcst.total_free_floats)),
+    list4 (Qintervals, make_fixnum (sizeof (struct interval)),
+          make_int (gcst.total_intervals),
+          make_int (gcst.total_free_intervals)),
+    list3 (Qbuffers, make_fixnum (sizeof (struct buffer)),
+          make_int (gcst.total_buffers)),
+
+#ifdef DOUG_LEA_MALLOC
+    list4 (Qheap, make_fixnum (1024),
+          make_int ((mallinfo ().uordblks + 1023) >> 10),
+          make_int ((mallinfo ().fordblks + 1023) >> 10)),
+#endif
+  };
+  return unbind_to (count, CALLMANY (Flist, total));
 }
 
 /* Mark Lisp objects in glyph matrix MATRIX.  Currently the
@@ -6029,7 +6338,7 @@ mark_glyph_matrix (struct glyph_matrix *matrix)
 
            for (; glyph < end_glyph; ++glyph)
              if (STRINGP (glyph->object)
-                 && !STRING_MARKED_P (XSTRING (glyph->object)))
+                 && !string_marked_p (XSTRING (glyph->object)))
                mark_object (glyph->object);
          }
       }
@@ -6046,13 +6355,18 @@ static int last_marked_index;
 ptrdiff_t mark_object_loop_halt EXTERNALLY_VISIBLE;
 
 static void
-mark_vectorlike (struct Lisp_Vector *ptr)
+mark_vectorlike (union vectorlike_header *header)
 {
+  struct Lisp_Vector *ptr = (struct Lisp_Vector *) header;
   ptrdiff_t size = ptr->header.size;
   ptrdiff_t i;
 
-  eassert (!VECTOR_MARKED_P (ptr));
-  VECTOR_MARK (ptr);           /* Else mark it.  */
+  eassert (!vector_marked_p (ptr));
+
+  /* Bool vectors have a different case in mark_object.  */
+  eassert (PSEUDOVECTOR_TYPE (ptr) != PVEC_BOOL_VECTOR);
+
+  set_vector_marked (ptr); /* Else mark it.  */
   if (size & PSEUDOVECTOR_FLAG)
     size &= PSEUDOVECTOR_SIZE_MASK;
 
@@ -6075,18 +6389,18 @@ mark_char_table (struct Lisp_Vector *ptr, enum 
pvec_type pvectype)
   /* Consult the Lisp_Sub_Char_Table layout before changing this.  */
   int i, idx = (pvectype == PVEC_SUB_CHAR_TABLE ? SUB_CHAR_TABLE_OFFSET : 0);
 
-  eassert (!VECTOR_MARKED_P (ptr));
-  VECTOR_MARK (ptr);
+  eassert (!vector_marked_p (ptr));
+  set_vector_marked (ptr);
   for (i = idx; i < size; i++)
     {
       Lisp_Object val = ptr->contents[i];
 
-      if (FIXNUMP (val) || (BARE_SYMBOL_P (val)
-                            && XBARE_SYMBOL (val)->u.s.gcmarkbit))
+      if (FIXNUMP (val) ||
+          (BARE_SYMBOL_P (val) && symbol_marked_p (XBARE_SYMBOL (val))))
        continue;
       if (SUB_CHAR_TABLE_P (val))
        {
-         if (! VECTOR_MARKED_P (XVECTOR (val)))
+         if (! vector_marked_p (XVECTOR (val)))
            mark_char_table (XVECTOR (val), PVEC_SUB_CHAR_TABLE);
        }
       else
@@ -6100,7 +6414,7 @@ mark_compiled (struct Lisp_Vector *ptr)
 {
   int i, size = ptr->header.size & PSEUDOVECTOR_SIZE_MASK;
 
-  VECTOR_MARK (ptr);
+  set_vector_marked (ptr);
   for (i = 0; i < size; i++)
     if (i != COMPILED_CONSTANTS)
       mark_object (ptr->contents[i]);
@@ -6112,12 +6426,12 @@ mark_compiled (struct Lisp_Vector *ptr)
 static void
 mark_overlay (struct Lisp_Overlay *ptr)
 {
-  for (; ptr && !VECTOR_MARKED_P (ptr); ptr = ptr->next)
+  for (; ptr && !vectorlike_marked_p (&ptr->header); ptr = ptr->next)
     {
-      VECTOR_MARK (ptr);
+      set_vectorlike_marked (&ptr->header);
       /* These two are always markers and can be marked fast.  */
-      VECTOR_MARK (XMARKER (ptr->start));
-      VECTOR_MARK (XMARKER (ptr->end));
+      set_vectorlike_marked (&XMARKER (ptr->start)->header);
+      set_vectorlike_marked (&XMARKER (ptr->end)->header);
       mark_object (ptr->plist);
     }
 }
@@ -6128,11 +6442,11 @@ static void
 mark_buffer (struct buffer *buffer)
 {
   /* This is handled much like other pseudovectors...  */
-  mark_vectorlike ((struct Lisp_Vector *) buffer);
+  mark_vectorlike (&buffer->header);
 
   /* ...but there are some buffer-specific things.  */
 
-  MARK_INTERVAL_TREE (buffer_intervals (buffer));
+  mark_interval_tree (buffer_intervals (buffer));
 
   /* For now, we just don't mark the undo_list.  It's done later in
      a special way just before the sweep phase, and after stripping
@@ -6142,7 +6456,8 @@ mark_buffer (struct buffer *buffer)
   mark_overlay (buffer->overlays_after);
 
   /* If this is an indirect buffer, mark its base buffer.  */
-  if (buffer->base_buffer && !VECTOR_MARKED_P (buffer->base_buffer))
+  if (buffer->base_buffer &&
+      !vectorlike_marked_p (&buffer->base_buffer->header))
     mark_buffer (buffer->base_buffer);
 }
 
@@ -6161,8 +6476,8 @@ mark_face_cache (struct face_cache *c)
 
          if (face)
            {
-             if (face->font && !VECTOR_MARKED_P (face->font))
-               mark_vectorlike ((struct Lisp_Vector *) face->font);
+             if (face->font && !vectorlike_marked_p (&face->font->header))
+               mark_vectorlike (&face->font->header);
 
              for (j = 0; j < LFACE_VECTOR_SIZE; ++j)
                mark_object (face->lface[j]);
@@ -6193,7 +6508,7 @@ mark_discard_killed_buffers (Lisp_Object list)
 {
   Lisp_Object tail, *prev = &list;
 
-  for (tail = list; CONSP (tail) && !CONS_MARKED_P (XCONS (tail));
+  for (tail = list; CONSP (tail) && !cons_marked_p (XCONS (tail));
        tail = XCDR (tail))
     {
       Lisp_Object tem = XCAR (tail);
@@ -6203,7 +6518,7 @@ mark_discard_killed_buffers (Lisp_Object list)
        *prev = XCDR (tail);
       else
        {
-         CONS_MARK (XCONS (tail));
+         set_cons_marked (XCONS (tail));
          mark_object (XCAR (tail));
          prev = xcdr_addr (tail);
        }
@@ -6212,6 +6527,72 @@ mark_discard_killed_buffers (Lisp_Object list)
   return list;
 }
 
+static void
+mark_frame (struct Lisp_Vector *ptr)
+{
+  struct frame *f = (struct frame *) ptr;
+  mark_vectorlike (&ptr->header);
+  mark_face_cache (f->face_cache);
+#ifdef HAVE_WINDOW_SYSTEM
+  if (FRAME_WINDOW_P (f) && FRAME_X_OUTPUT (f))
+    {
+      struct font *font = FRAME_FONT (f);
+
+      if (font && !vectorlike_marked_p (&font->header))
+        mark_vectorlike (&font->header);
+    }
+#endif
+}
+
+static void
+mark_window (struct Lisp_Vector *ptr)
+{
+  struct window *w = (struct window *) ptr;
+
+  mark_vectorlike (&ptr->header);
+
+  /* Mark glyph matrices, if any.  Marking window
+     matrices is sufficient because frame matrices
+     use the same glyph memory.  */
+  if (w->current_matrix)
+    {
+      mark_glyph_matrix (w->current_matrix);
+      mark_glyph_matrix (w->desired_matrix);
+    }
+
+  /* Filter out killed buffers from both buffer lists
+     in attempt to help GC to reclaim killed buffers faster.
+     We can do it elsewhere for live windows, but this is the
+     best place to do it for dead windows.  */
+  wset_prev_buffers
+    (w, mark_discard_killed_buffers (w->prev_buffers));
+  wset_next_buffers
+    (w, mark_discard_killed_buffers (w->next_buffers));
+}
+
+static void
+mark_hash_table (struct Lisp_Vector *ptr)
+{
+  struct Lisp_Hash_Table *h = (struct Lisp_Hash_Table *) ptr;
+
+  mark_vectorlike (&h->header);
+  mark_object (h->test.name);
+  mark_object (h->test.user_hash_function);
+  mark_object (h->test.user_cmp_function);
+  /* If hash table is not weak, mark all keys and values.  For weak
+     tables, mark only the vector and not its contents --- that's what
+     makes it weak.  */
+  if (NILP (h->weak))
+    mark_object (h->key_and_value);
+  else
+    {
+      eassert (h->next_weak == NULL);
+      h->next_weak = weak_hash_tables;
+      weak_hash_tables = h;
+      set_vector_marked (XVECTOR (h->key_and_value));
+    }
+}
+
 /* Determine type of generic Lisp_Object and mark it accordingly.
 
    This function implements a straightforward depth-first marking
@@ -6226,7 +6607,7 @@ mark_object (Lisp_Object arg)
   register Lisp_Object obj;
   void *po;
 #if GC_CHECK_MARKED_OBJECTS
-  struct mem_node *m;
+  struct mem_node *m = NULL;
 #endif
   ptrdiff_t cdr_count = 0;
 
@@ -6249,6 +6630,12 @@ mark_object (Lisp_Object arg)
      structure allocated from the heap.  */
 #define CHECK_ALLOCATED()                      \
   do {                                         \
+    if (pdumper_object_p(po))                   \
+      {                                         \
+        if (!pdumper_object_p_precise (po))     \
+          emacs_abort ();                       \
+        break;                                  \
+      }                                         \
     m = mem_find (po);                         \
     if (m == MEM_NIL)                          \
       emacs_abort ();                          \
@@ -6258,6 +6645,8 @@ mark_object (Lisp_Object arg)
      function LIVEP.  */
 #define CHECK_LIVE(LIVEP)                      \
   do {                                         \
+    if (pdumper_object_p(po))                   \
+      break;                                    \
     if (!LIVEP (m, po))                                \
       emacs_abort ();                          \
   } while (0)
@@ -6292,11 +6681,11 @@ mark_object (Lisp_Object arg)
     case Lisp_String:
       {
        register struct Lisp_String *ptr = XSTRING (obj);
-       if (STRING_MARKED_P (ptr))
-         break;
+        if (string_marked_p (ptr))
+          break;
        CHECK_ALLOCATED_AND_LIVE (live_string_p);
-       MARK_STRING (ptr);
-       MARK_INTERVAL_TREE (ptr->u.s.intervals);
+        set_string_marked (ptr);
+        mark_interval_tree (ptr->u.s.intervals);
 #ifdef GC_CHECK_STRING_BYTES
        /* Check that the string size recorded in the string is the
           same as the one recorded in the sdata structure.  */
@@ -6309,22 +6698,25 @@ mark_object (Lisp_Object arg)
       {
        register struct Lisp_Vector *ptr = XVECTOR (obj);
 
-       if (VECTOR_MARKED_P (ptr))
+       if (vector_marked_p (ptr))
          break;
 
-#if GC_CHECK_MARKED_OBJECTS
-       m = mem_find (po);
-       if (m == MEM_NIL && !SUBRP (obj) && !main_thread_p (po))
-         emacs_abort ();
+#ifdef GC_CHECK_MARKED_OBJECTS
+        if (!pdumper_object_p(po))
+          {
+           m = mem_find (po);
+            if (m == MEM_NIL && !SUBRP (obj) && !main_thread_p (po))
+             emacs_abort ();
+          }
 #endif /* GC_CHECK_MARKED_OBJECTS */
 
         enum pvec_type pvectype
           = PSEUDOVECTOR_TYPE (ptr);
 
-       if (pvectype != PVEC_SUBR
-           && pvectype != PVEC_BUFFER
-           && !main_thread_p (po))
-         CHECK_LIVE (live_vector_p);
+        if (pvectype != PVEC_SUBR &&
+            pvectype != PVEC_BUFFER &&
+            !main_thread_p (po))
+          CHECK_LIVE (live_vector_p);
 
        switch (pvectype)
          {
@@ -6340,77 +6732,28 @@ mark_object (Lisp_Object arg)
            }
 #endif /* GC_CHECK_MARKED_OBJECTS */
            mark_buffer ((struct buffer *) ptr);
-           break;
-
-         case PVEC_COMPILED:
-           /* Although we could treat this just like a vector, mark_compiled
-              returns the COMPILED_CONSTANTS element, which is marked at the
-              next iteration of goto-loop here.  This is done to avoid a few
-              recursive calls to mark_object.  */
-           obj = mark_compiled (ptr);
-           if (!NILP (obj))
-             goto loop;
-           break;
-
-         case PVEC_FRAME:
-           {
-             struct frame *f = (struct frame *) ptr;
-
-             mark_vectorlike (ptr);
-             mark_face_cache (f->face_cache);
-#ifdef HAVE_WINDOW_SYSTEM
-             if (FRAME_WINDOW_P (f) && FRAME_X_OUTPUT (f))
-               {
-                 struct font *font = FRAME_FONT (f);
-
-                 if (font && !VECTOR_MARKED_P (font))
-                   mark_vectorlike ((struct Lisp_Vector *) font);
-               }
-#endif
-           }
-           break;
-
-         case PVEC_WINDOW:
-           {
-             struct window *w = (struct window *) ptr;
-
-             mark_vectorlike (ptr);
-
-             /* Mark glyph matrices, if any.  Marking window
-                matrices is sufficient because frame matrices
-                use the same glyph memory.  */
-             if (w->current_matrix)
-               {
-                 mark_glyph_matrix (w->current_matrix);
-                 mark_glyph_matrix (w->desired_matrix);
-               }
-
-             /* Filter out killed buffers from both buffer lists
-                in attempt to help GC to reclaim killed buffers faster.
-                We can do it elsewhere for live windows, but this is the
-                best place to do it for dead windows.  */
-             wset_prev_buffers
-               (w, mark_discard_killed_buffers (w->prev_buffers));
-             wset_next_buffers
-               (w, mark_discard_killed_buffers (w->next_buffers));
-           }
-           break;
+            break;
+
+          case PVEC_COMPILED:
+            /* Although we could treat this just like a vector, mark_compiled
+               returns the COMPILED_CONSTANTS element, which is marked at the
+               next iteration of goto-loop here.  This is done to avoid a few
+               recursive calls to mark_object.  */
+            obj = mark_compiled (ptr);
+            if (!NILP (obj))
+              goto loop;
+            break;
+
+          case PVEC_FRAME:
+            mark_frame (ptr);
+            break;
+
+          case PVEC_WINDOW:
+            mark_window (ptr);
+            break;
 
          case PVEC_HASH_TABLE:
-           {
-             struct Lisp_Hash_Table *h = (struct Lisp_Hash_Table *) ptr;
-
-             mark_vectorlike (ptr);
-             mark_object (h->test.name);
-             mark_object (h->test.user_hash_function);
-             mark_object (h->test.user_cmp_function);
-             /* If hash table is not weak, mark all keys and values.
-                For weak tables, mark only the vector.  */
-             if (NILP (h->weak))
-               mark_object (h->key_and_value);
-             else
-               VECTOR_MARK (XVECTOR (h->key_and_value));
-           }
+            mark_hash_table (ptr);
            break;
 
          case PVEC_CHAR_TABLE:
@@ -6418,7 +6761,17 @@ mark_object (Lisp_Object arg)
            mark_char_table (ptr, (enum pvec_type) pvectype);
            break;
 
-         case PVEC_OVERLAY:
+          case PVEC_BOOL_VECTOR:
+            /* bool vectors in a dump are permanently "marked", since
+               they're in the old section and don't have mark bits.
+               If we're looking at a dumped bool vector, we should
+               have aborted above when we called vector_marked_p(), so
+               we should never get here.  */
+            eassert (!pdumper_object_p (ptr));
+            set_vector_marked (ptr);
+            break;
+
+          case PVEC_OVERLAY:
            mark_overlay (XOVERLAY (obj));
            break;
 
@@ -6431,7 +6784,7 @@ mark_object (Lisp_Object arg)
          default:
            /* A regular vector, or a pseudovector needing no special
               treatment.  */
-           mark_vectorlike (ptr);
+           mark_vectorlike (&ptr->header);
          }
       }
       break;
@@ -6440,10 +6793,10 @@ mark_object (Lisp_Object arg)
       {
        struct Lisp_Symbol *ptr = XSYMBOL (obj);
       nextsym:
-       if (ptr->u.s.gcmarkbit)
-         break;
-       CHECK_ALLOCATED_AND_LIVE_SYMBOL ();
-       ptr->u.s.gcmarkbit = 1;
+        if (symbol_marked_p (ptr))
+          break;
+        CHECK_ALLOCATED_AND_LIVE_SYMBOL ();
+        set_symbol_marked(ptr);
        /* Attempt to catch bogus objects.  */
        eassert (valid_lisp_object_p (ptr->u.s.function));
        mark_object (ptr->u.s.function);
@@ -6470,8 +6823,8 @@ mark_object (Lisp_Object arg)
          default: emacs_abort ();
          }
        if (!PURE_P (XSTRING (ptr->u.s.name)))
-         MARK_STRING (XSTRING (ptr->u.s.name));
-       MARK_INTERVAL_TREE (string_intervals (ptr->u.s.name));
+          set_string_marked (XSTRING (ptr->u.s.name));
+        mark_interval_tree (string_intervals (ptr->u.s.name));
        /* Inner loop to mark next symbol in this bucket, if any.  */
        po = ptr = ptr->u.s.next;
        if (ptr)
@@ -6482,10 +6835,10 @@ mark_object (Lisp_Object arg)
     case Lisp_Cons:
       {
        struct Lisp_Cons *ptr = XCONS (obj);
-       if (CONS_MARKED_P (ptr))
+       if (cons_marked_p (ptr))
          break;
        CHECK_ALLOCATED_AND_LIVE (live_cons_p);
-       CONS_MARK (ptr);
+        set_cons_marked (ptr);
        /* If the cdr is nil, avoid recursion for the car.  */
        if (NILP (ptr->u.s.u.cdr))
          {
@@ -6503,7 +6856,12 @@ mark_object (Lisp_Object arg)
 
     case Lisp_Float:
       CHECK_ALLOCATED_AND_LIVE (live_float_p);
-      FLOAT_MARK (XFLOAT (obj));
+      /* Do not mark floats stored in a dump image: these floats are
+         "cold" and do not have mark bits.  */
+      if (pdumper_object_p (XFLOAT (obj)))
+        eassert (pdumper_cold_object_p (XFLOAT (obj)));
+      else if (!XFLOAT_MARKED_P (XFLOAT (obj)))
+        XFLOAT_MARK (XFLOAT (obj));
       break;
 
     case_Lisp_Int:
@@ -6517,6 +6875,7 @@ mark_object (Lisp_Object arg)
 #undef CHECK_ALLOCATED
 #undef CHECK_ALLOCATED_AND_LIVE
 }
+
 /* Mark the Lisp pointers in the terminal objects.
    Called by Fgarbage_collect.  */
 
@@ -6533,13 +6892,11 @@ mark_terminals (void)
         gets marked.  */
       mark_image_cache (t->image_cache);
 #endif /* HAVE_WINDOW_SYSTEM */
-      if (!VECTOR_MARKED_P (t))
-       mark_vectorlike ((struct Lisp_Vector *)t);
+      if (!vectorlike_marked_p (&t->header))
+       mark_vectorlike (&t->header);
     }
 }
 
-
-
 /* Value is non-zero if OBJ will survive the current GC because it's
    either marked or does not need to be marked to survive.  */
 
@@ -6551,27 +6908,29 @@ survives_gc_p (Lisp_Object obj)
   switch (XTYPE (obj))
     {
     case_Lisp_Int:
-      survives_p = 1;
+      survives_p = true;
       break;
 
     case Lisp_Symbol:
-      survives_p = XSYMBOL (obj)->u.s.gcmarkbit;
+      survives_p = symbol_marked_p (XSYMBOL (obj));
       break;
 
     case Lisp_String:
-      survives_p = STRING_MARKED_P (XSTRING (obj));
+      survives_p = string_marked_p (XSTRING (obj));
       break;
 
     case Lisp_Vectorlike:
-      survives_p = SUBRP (obj) || VECTOR_MARKED_P (XVECTOR (obj));
+      survives_p = SUBRP (obj) || vector_marked_p (XVECTOR (obj));
       break;
 
     case Lisp_Cons:
-      survives_p = CONS_MARKED_P (XCONS (obj));
+      survives_p = cons_marked_p (XCONS (obj));
       break;
 
     case Lisp_Float:
-      survives_p = FLOAT_MARKED_P (XFLOAT (obj));
+      survives_p =
+        XFLOAT_MARKED_P (XFLOAT (obj)) ||
+        pdumper_object_p (XFLOAT (obj));
       break;
 
     default:
@@ -6588,14 +6947,13 @@ NO_INLINE /* For better stack traces */
 static void
 sweep_conses (void)
 {
-  struct cons_block *cblk;
   struct cons_block **cprev = &cons_block;
   int lim = cons_block_index;
-  EMACS_INT num_free = 0, num_used = 0;
+  object_ct num_free = 0, num_used = 0;
 
   cons_free_list = 0;
 
-  for (cblk = cons_block; cblk; cblk = *cprev)
+  for (struct cons_block *cblk; (cblk = *cprev); )
     {
       int i = 0;
       int this_free = 0;
@@ -6626,7 +6984,7 @@ sweep_conses (void)
                 {
                  struct Lisp_Cons *acons
                    = ptr_bounds_copy (&cblk->conses[pos], cblk);
-                 if (!CONS_MARKED_P (acons))
+                 if (!XCONS_MARKED_P (acons))
                     {
                       this_free++;
                       cblk->conses[pos].u.s.u.chain = cons_free_list;
@@ -6636,7 +6994,7 @@ sweep_conses (void)
                   else
                     {
                       num_used++;
-                     CONS_UNMARK (acons);
+                     XUNMARK_CONS (acons);
                     }
                 }
             }
@@ -6659,29 +7017,27 @@ sweep_conses (void)
           cprev = &cblk->next;
         }
     }
-  total_conses = num_used;
-  total_free_conses = num_free;
+  gcstat.total_conses = num_used;
+  gcstat.total_free_conses = num_free;
 }
 
 NO_INLINE /* For better stack traces */
 static void
 sweep_floats (void)
 {
-  register struct float_block *fblk;
   struct float_block **fprev = &float_block;
-  register int lim = float_block_index;
-  EMACS_INT num_free = 0, num_used = 0;
+  int lim = float_block_index;
+  object_ct num_free = 0, num_used = 0;
 
   float_free_list = 0;
 
-  for (fblk = float_block; fblk; fblk = *fprev)
+  for (struct float_block *fblk; (fblk = *fprev); )
     {
-      register int i;
       int this_free = 0;
-      for (i = 0; i < lim; i++)
+      for (int i = 0; i < lim; i++)
        {
          struct Lisp_Float *afloat = ptr_bounds_copy (&fblk->floats[i], fblk);
-         if (!FLOAT_MARKED_P (afloat))
+         if (!XFLOAT_MARKED_P (afloat))
            {
              this_free++;
              fblk->floats[i].u.chain = float_free_list;
@@ -6690,7 +7046,7 @@ sweep_floats (void)
          else
            {
              num_used++;
-             FLOAT_UNMARK (afloat);
+             XFLOAT_UNMARK (afloat);
            }
        }
       lim = FLOAT_BLOCK_SIZE;
@@ -6710,27 +7066,25 @@ sweep_floats (void)
           fprev = &fblk->next;
         }
     }
-  total_floats = num_used;
-  total_free_floats = num_free;
+  gcstat.total_floats = num_used;
+  gcstat.total_free_floats = num_free;
 }
 
 NO_INLINE /* For better stack traces */
 static void
 sweep_intervals (void)
 {
-  register struct interval_block *iblk;
   struct interval_block **iprev = &interval_block;
-  register int lim = interval_block_index;
-  EMACS_INT num_free = 0, num_used = 0;
+  int lim = interval_block_index;
+  object_ct num_free = 0, num_used = 0;
 
   interval_free_list = 0;
 
-  for (iblk = interval_block; iblk; iblk = *iprev)
+  for (struct interval_block *iblk; (iblk = *iprev); )
     {
-      register int i;
       int this_free = 0;
 
-      for (i = 0; i < lim; i++)
+      for (int i = 0; i < lim; i++)
         {
           if (!iblk->intervals[i].gcmarkbit)
             {
@@ -6761,8 +7115,8 @@ sweep_intervals (void)
           iprev = &iblk->next;
         }
     }
-  total_intervals = num_used;
-  total_free_intervals = num_free;
+  gcstat.total_intervals = num_used;
+  gcstat.total_free_intervals = num_free;
 }
 
 NO_INLINE /* For better stack traces */
@@ -6772,7 +7126,7 @@ sweep_symbols (void)
   struct symbol_block *sblk;
   struct symbol_block **sprev = &symbol_block;
   int lim = symbol_block_index;
-  EMACS_INT num_free = 0, num_used = ARRAYELTS (lispsym);
+  object_ct num_free = 0, num_used = ARRAYELTS (lispsym);
 
   symbol_free_list = NULL;
 
@@ -6830,8 +7184,8 @@ sweep_symbols (void)
           sprev = &sblk->next;
         }
     }
-  total_symbols = num_used;
-  total_free_symbols = num_free;
+  gcstat.total_symbols = num_used;
+  gcstat.total_free_symbols = num_free;
 }
 
 /* Remove BUFFER's markers that are due to be swept.  This is needed since
@@ -6842,7 +7196,7 @@ unchain_dead_markers (struct buffer *buffer)
   struct Lisp_Marker *this, **prev = &BUF_MARKERS (buffer);
 
   while ((this = *prev))
-    if (VECTOR_MARKED_P (this))
+    if (vectorlike_marked_p (&this->header))
       prev = &this->next;
     else
       {
@@ -6855,22 +7209,23 @@ NO_INLINE /* For better stack traces */
 static void
 sweep_buffers (void)
 {
-  register struct buffer *buffer, **bprev = &all_buffers;
+  struct buffer *buffer, **bprev = &all_buffers;
 
-  total_buffers = 0;
+  gcstat.total_buffers = 0;
   for (buffer = all_buffers; buffer; buffer = *bprev)
-    if (!VECTOR_MARKED_P (buffer))
+    if (!vectorlike_marked_p (&buffer->header))
       {
         *bprev = buffer->next;
         lisp_free (buffer);
       }
     else
       {
-        VECTOR_UNMARK (buffer);
+        if (!pdumper_object_p (buffer))
+          XUNMARK_VECTOR (buffer);
         /* Do not use buffer_(set|get)_intervals here.  */
         buffer->text->intervals = balance_intervals (buffer->text->intervals);
         unchain_dead_markers (buffer);
-        total_buffers++;
+       gcstat.total_buffers++;
         bprev = &buffer->next;
       }
 }
@@ -6879,10 +7234,6 @@ sweep_buffers (void)
 static void
 gc_sweep (void)
 {
-  /* Remove or mark entries in weak hash tables.
-     This must be done before any object is unmarked.  */
-  sweep_weak_hash_tables ();
-
   sweep_strings ();
   check_string_bytes (!noninteractive);
   sweep_conses ();
@@ -6891,6 +7242,7 @@ gc_sweep (void)
   sweep_symbols ();
   sweep_buffers ();
   sweep_vectors ();
+  pdumper_clear_marks ();
   check_string_bytes (!noninteractive);
 }
 
@@ -6958,14 +7310,13 @@ Frames, windows, buffers, and subprocesses count as 
vectors
   (but the contents of a buffer's text do not count here).  */)
   (void)
 {
-  return listn (CONSTYPE_HEAP, 7,
-               bounded_number (cons_cells_consed),
-               bounded_number (floats_consed),
-               bounded_number (vector_cells_consed),
-               bounded_number (symbols_consed),
-               bounded_number (string_chars_consed),
-               bounded_number (intervals_consed),
-               bounded_number (strings_consed));
+  return  list (make_int (cons_cells_consed),
+               make_int (floats_consed),
+               make_int (vector_cells_consed),
+               make_int (symbols_consed),
+               make_int (string_chars_consed),
+               make_int (intervals_consed),
+               make_int (strings_consed));
 }
 
 static bool
@@ -7143,19 +7494,34 @@ verify_alloca (void)
 
 /* Initialization.  */
 
+static void init_alloc_once_for_pdumper (void);
+
 void
 init_alloc_once (void)
 {
+  gc_cons_threshold = GC_DEFAULT_THRESHOLD;
   /* Even though Qt's contents are not set up, its address is known.  */
   Vpurify_flag = Qt;
 
-  purebeg = PUREBEG;
-  pure_size = PURESIZE;
+  PDUMPER_REMEMBER_SCALAR (buffer_defaults.header);
+  PDUMPER_REMEMBER_SCALAR (buffer_local_symbols.header);
+
+  /* Call init_alloc_once_for_pdumper now so we run mem_init early.
+     Keep in mind that when we reload from a dump, we'll run _only_
+     init_alloc_once_for_pdumper and not init_alloc_once at all.  */
+  pdumper_do_now_and_after_load (init_alloc_once_for_pdumper);
 
   verify_alloca ();
-  init_finalizer_list (&finalizers);
-  init_finalizer_list (&doomed_finalizers);
 
+  init_strings ();
+  init_vectors ();
+}
+
+static void
+init_alloc_once_for_pdumper (void)
+{
+  purebeg = PUREBEG;
+  pure_size = PURESIZE;
   mem_init ();
   Vdead = make_pure_string ("DEAD", 4, 4, 0);
 
@@ -7164,11 +7530,11 @@ init_alloc_once (void)
   mallopt (M_MMAP_THRESHOLD, 64 * 1024);  /* Mmap threshold.  */
   mallopt (M_MMAP_MAX, MMAP_MAX_AREAS);   /* Max. number of mmap'ed areas.  */
 #endif
-  init_strings ();
-  init_vectors ();
 
+
+  init_finalizer_list (&finalizers);
+  init_finalizer_list (&doomed_finalizers);
   refill_memory_reserve ();
-  gc_cons_threshold = GC_DEFAULT_THRESHOLD;
 }
 
 void
@@ -7176,10 +7542,6 @@ init_alloc (void)
 {
   Vgc_elapsed = make_float (0.0);
   gcs_done = 0;
-
-#if USE_VALGRIND
-  valgrind_p = RUNNING_ON_VALGRIND != 0;
-#endif
 }
 
 void
@@ -7248,8 +7610,10 @@ do hash-consing of the objects allocated to pure space.  
*/);
   /* We build this in advance because if we wait until we need it, we might
      not be able to allocate the memory to hold it.  */
   Vmemory_signal_data
-    = listn (CONSTYPE_PURE, 2, Qerror,
-            build_pure_c_string ("Memory exhausted--use M-x save-some-buffers 
then exit and restart Emacs"));
+    = pure_list (Qerror,
+                build_pure_c_string ("Memory exhausted--use"
+                                     " M-x save-some-buffers then"
+                                     " exit and restart Emacs"));
 
   DEFVAR_LISP ("memory-full", Vmemory_full,
               doc: /* Non-nil means Emacs cannot get much more Lisp memory.  
*/);
@@ -7302,6 +7666,12 @@ than 2**N, where N is this variable's value.  N should 
be nonnegative.  */);
   defsubr (&Ssuspicious_object);
 }
 
+#ifdef HAVE_X_WINDOWS
+enum defined_HAVE_X_WINDOWS { defined_HAVE_X_WINDOWS = true };
+#else
+enum defined_HAVE_X_WINDOWS { defined_HAVE_X_WINDOWS = false };
+#endif
+
 /* When compiled with GCC, GDB might say "No enum type named
    pvec_type" if we don't have at least one symbol with that type, and
    then xbacktrace could fail.  Similarly for the other enums and
@@ -7320,5 +7690,6 @@ union
   enum MAX_ALLOCA MAX_ALLOCA;
   enum More_Lisp_Bits More_Lisp_Bits;
   enum pvec_type pvec_type;
+  enum defined_HAVE_X_WINDOWS defined_HAVE_X_WINDOWS;
 } const EXTERNALLY_VISIBLE gdb_make_enums_visible = {0};
 #endif /* __GNUC__ */
diff --git a/src/atimer.c b/src/atimer.c
index 505f6bc..8387b8a 100644
--- a/src/atimer.c
+++ b/src/atimer.c
@@ -1,5 +1,5 @@
 /* Asynchronous timers.
-   Copyright (C) 2000-2018 Free Software Foundation, Inc.
+   Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -28,7 +28,10 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 #ifdef HAVE_TIMERFD
 #include <errno.h>
-# include <sys/timerfd.h>
+#include <sys/timerfd.h>
+# ifdef CYGWIN
+# include <sys/utsname.h>
+# endif
 #endif
 
 #ifdef MSDOS
@@ -557,13 +560,28 @@ Return t if all self-tests are passed, nil otherwise.  */)
 
 #endif /* ENABLE_CHECKING */
 
+/* Cygwin has the timerfd interface starting with release 3.0.0, but
+   it is buggy until release 3.0.2. */
+#ifdef HAVE_TIMERFD
+static bool
+have_buggy_timerfd (void)
+{
+# ifdef CYGWIN
+  struct utsname name;
+  return uname (&name) < 0 || strverscmp (name.release, "3.0.2") < 0;
+# else
+  return false;
+# endif
+}
+#endif
+
 void
 init_atimer (void)
 {
 #ifdef HAVE_ITIMERSPEC
 # ifdef HAVE_TIMERFD
   /* Until this feature is considered stable, you can ask to not use it.  */
-  timerfd = (egetenv ("EMACS_IGNORE_TIMERFD") ? -1 :
+  timerfd = (egetenv ("EMACS_IGNORE_TIMERFD") || have_buggy_timerfd () ? -1 :
             timerfd_create (CLOCK_REALTIME, TFD_NONBLOCK | TFD_CLOEXEC));
 # endif
   if (timerfd < 0)
@@ -584,6 +602,7 @@ init_atimer (void)
   sigaction (SIGALRM, &action, 0);
 
 #ifdef ENABLE_CHECKING
-  defsubr (&Sdebug_timer_check);
+  if (!initialized)
+    defsubr (&Sdebug_timer_check);
 #endif
 }
diff --git a/src/atimer.h b/src/atimer.h
index 2c917a0..dbc9d56 100644
--- a/src/atimer.h
+++ b/src/atimer.h
@@ -1,5 +1,5 @@
 /* Asynchronous timers.
-   Copyright (C) 2000-2018 Free Software Foundation, Inc.
+   Copyright (C) 2000-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/bidi.c b/src/bidi.c
index a53a229..c530d49 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1,6 +1,6 @@
 /* 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-2019 Free Software Foundation, Inc.
 
 Author: Eli Zaretskii <address@hidden>
 
@@ -2335,7 +2335,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it)
                      and make it L right away, to avoid the
                      potentially costly loop below.  This is
                      important when the buffer has a long series of
-                     control characters, like binary nulls, and no
+                     control characters, like binary NULs, and no
                      R2L characters at all.  */
                   && new_level == 0
                   && !bidi_explicit_dir_char (bidi_it->ch)
@@ -2993,7 +2993,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it)
        }
       /* The next two "else if" clauses are shortcuts for the
         important special case when we have a long sequence of
-        neutral or WEAK_BN characters, such as whitespace or nulls or
+        neutral or WEAK_BN characters, such as whitespace or NULs or
         other control characters, on the base embedding level of the
         paragraph, and that sequence goes all the way to the end of
         the paragraph and follows a character whose resolved
diff --git a/src/bignum.c b/src/bignum.c
index e3db037..4118601 100644
--- a/src/bignum.c
+++ b/src/bignum.c
@@ -1,6 +1,6 @@
 /* Big numbers for Emacs.
 
-Copyright 2018 Free Software Foundation, Inc.
+Copyright 2018-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -271,7 +271,7 @@ bignum_to_uintmax (Lisp_Object x)
 
 /* Yield an upper bound on the buffer size needed to contain a C
    string representing the NUM in base BASE.  This includes any
-   preceding '-' and the terminating null.  */
+   preceding '-' and the terminating NUL.  */
 static ptrdiff_t
 mpz_bufsize (mpz_t const num, int base)
 {
@@ -336,7 +336,7 @@ bignum_to_string (Lisp_Object num, int base)
 
 /* Create a bignum by scanning NUM, with digits in BASE.
    NUM must consist of an optional '-', a nonempty sequence
-   of base-BASE digits, and a terminating null byte, and
+   of base-BASE digits, and a terminating NUL byte, and
    the represented number must not be in fixnum range.  */
 
 Lisp_Object
diff --git a/src/bignum.h b/src/bignum.h
index fd035e6..4c670bd 100644
--- a/src/bignum.h
+++ b/src/bignum.h
@@ -1,6 +1,6 @@
 /* Big numbers for Emacs.
 
-Copyright 2018 Free Software Foundation, Inc.
+Copyright 2018-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/blockinput.h b/src/blockinput.h
index 2739050..cd2eddb 100644
--- a/src/blockinput.h
+++ b/src/blockinput.h
@@ -1,5 +1,5 @@
 /* blockinput.h - interface to blocking complicated interrupt-driven input.
-   Copyright (C) 1989, 1993, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1989, 1993, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/buffer.c b/src/buffer.c
index ac2de7d..7c4691e 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1,6 +1,6 @@
 /* Buffer manipulation primitives for GNU Emacs.
 
-Copyright (C) 1985-1989, 1993-1995, 1997-2018 Free Software Foundation,
+Copyright (C) 1985-1989, 1993-1995, 1997-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -37,6 +37,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "window.h"
 #include "commands.h"
 #include "character.h"
+#include "coding.h"
 #include "buffer.h"
 #include "region-cache.h"
 #include "indent.h"
@@ -44,6 +45,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "keymap.h"
 #include "frame.h"
 #include "xwidget.h"
+#include "pdumper.h"
 
 #ifdef WINDOWSNT
 #include "w32heap.h"           /* for mmap_* */
@@ -466,7 +468,7 @@ See also `find-buffer-visiting'.  */)
   filename = Fexpand_file_name (filename, Qnil);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (filename, Qget_file_buffer);
   if (!NILP (handler))
     {
@@ -529,6 +531,8 @@ even if it is dead.  The return value is never nil.  */)
   /* No one shows us now.  */
   b->window_count = 0;
 
+  memset (&b->local_flags, 0, sizeof (b->local_flags));
+
   BUF_GAP_SIZE (b) = 20;
   block_input ();
   /* We allocate extra 1-byte at the tail and keep it always '\0' for
@@ -580,6 +584,11 @@ even if it is dead.  The return value is never nil.  */)
   set_string_intervals (name, NULL);
   bset_name (b, name);
 
+  if (STRINGP (Vcode_conversion_workbuf_name)
+      && strncmp (SSDATA (name), SSDATA (Vcode_conversion_workbuf_name),
+                 SBYTES (Vcode_conversion_workbuf_name)) == 0)
+    b->inhibit_buffer_hooks = true;
+
   bset_undo_list (b, SREF (name, 0) != ' ' ? Qnil : Qt);
 
   reset_buffer (b);
@@ -592,7 +601,7 @@ even if it is dead.  The return value is never nil.  */)
   XSETBUFFER (buffer, b);
   Vbuffer_alist = nconc2 (Vbuffer_alist, list1 (Fcons (name, buffer)));
   /* And run buffer-list-update-hook.  */
-  if (!NILP (Vrun_hooks))
+  if (!NILP (Vrun_hooks) && !b->inhibit_buffer_hooks)
     call1 (Vrun_hooks, Qbuffer_list_update_hook);
 
   return buffer;
@@ -781,6 +790,8 @@ CLONE nil means the indirect buffer's state is reset to 
default values.  */)
   /* Always -1 for an indirect buffer.  */
   b->window_count = -1;
 
+  memset (&b->local_flags, 0, sizeof (b->local_flags));
+
   b->pt = b->base_buffer->pt;
   b->begv = b->base_buffer->begv;
   b->zv = b->base_buffer->zv;
@@ -1408,7 +1419,7 @@ state of the current buffer.  Use with care.  */)
                 /* If SAVE_MODIFF == auto_save_modified == MODIFF,
                    we can either decrease SAVE_MODIFF and auto_save_modified
                    or increase MODIFF.  */
-                : MODIFF++);
+                : modiff_incr (&MODIFF));
 
   return flag;
 }
@@ -1417,11 +1428,11 @@ DEFUN ("buffer-modified-tick", Fbuffer_modified_tick, 
Sbuffer_modified_tick,
        0, 1, 0,
        doc: /* Return BUFFER's tick counter, incremented for each change in 
text.
 Each buffer has a tick counter which is incremented each time the
-text in that buffer is changed.  It wraps around occasionally.
-No argument or nil as argument means use current buffer as BUFFER.  */)
-  (register Lisp_Object buffer)
+text in that buffer is changed.  No argument or nil as argument means
+use current buffer as BUFFER.  */)
+  (Lisp_Object buffer)
 {
-  return make_fixnum (BUF_MODIFF (decode_buffer (buffer)));
+  return modiff_to_integer (BUF_MODIFF (decode_buffer (buffer)));
 }
 
 DEFUN ("buffer-chars-modified-tick", Fbuffer_chars_modified_tick,
@@ -1434,9 +1445,9 @@ values returned by two individual calls of 
`buffer-chars-modified-tick',
 you can tell whether a character change occurred in that buffer in
 between these calls.  No argument or nil as argument means use current
 buffer as BUFFER.  */)
-  (register Lisp_Object buffer)
+  (Lisp_Object buffer)
 {
-  return make_fixnum (BUF_CHARS_MODIFF (decode_buffer (buffer)));
+  return modiff_to_integer (BUF_CHARS_MODIFF (decode_buffer (buffer)));
 }
 
 DEFUN ("rename-buffer", Frename_buffer, Srename_buffer, 1, 2,
@@ -1488,7 +1499,7 @@ This does not change the name of the visited file (if 
any).  */)
     call0 (intern ("rename-auto-save-file"));
 
   /* Run buffer-list-update-hook.  */
-  if (!NILP (Vrun_hooks))
+  if (!NILP (Vrun_hooks) && !current_buffer->inhibit_buffer_hooks)
     call1 (Vrun_hooks, Qbuffer_list_update_hook);
 
   /* Refetch since that last call may have done GC.  */
@@ -1701,10 +1712,13 @@ cleaning up all windows currently displaying the buffer 
to be killed. */)
 
     /* First run the query functions; if any query is answered no,
        don't kill the buffer.  */
-    tem = CALLN (Frun_hook_with_args_until_failure,
-                Qkill_buffer_query_functions);
-    if (NILP (tem))
-      return unbind_to (count, Qnil);
+    if (!b->inhibit_buffer_hooks)
+      {
+       tem = CALLN (Frun_hook_with_args_until_failure,
+                    Qkill_buffer_query_functions);
+       if (NILP (tem))
+         return unbind_to (count, Qnil);
+      }
 
     /* Query if the buffer is still modified.  */
     if (INTERACTIVE && !NILP (BVAR (b, filename))
@@ -1721,7 +1735,8 @@ cleaning up all windows currently displaying the buffer 
to be killed. */)
       return unbind_to (count, Qt);
 
     /* Then run the hooks.  */
-    run_hook (Qkill_buffer_hook);
+    if (!b->inhibit_buffer_hooks)
+      run_hook (Qkill_buffer_hook);
     unbind_to (count, Qnil);
   }
 
@@ -1923,7 +1938,7 @@ cleaning up all windows currently displaying the buffer 
to be killed. */)
   bset_undo_list (b, Qnil);
 
   /* Run buffer-list-update-hook.  */
-  if (!NILP (Vrun_hooks))
+  if (!NILP (Vrun_hooks) && !b->inhibit_buffer_hooks)
     call1 (Vrun_hooks, Qbuffer_list_update_hook);
 
   return Qt;
@@ -1965,7 +1980,7 @@ record_buffer (Lisp_Object buffer)
   fset_buried_buffer_list (f, Fdelq (buffer, f->buried_buffer_list));
 
   /* Run buffer-list-update-hook.  */
-  if (!NILP (Vrun_hooks))
+  if (!NILP (Vrun_hooks) && !XBUFFER (buffer)->inhibit_buffer_hooks)
     call1 (Vrun_hooks, Qbuffer_list_update_hook);
 }
 
@@ -2004,7 +2019,7 @@ DEFUN ("bury-buffer-internal", Fbury_buffer_internal, 
Sbury_buffer_internal,
     (f, Fcons (buffer, Fdelq (buffer, f->buried_buffer_list)));
 
   /* Run buffer-list-update-hook.  */
-  if (!NILP (Vrun_hooks))
+  if (!NILP (Vrun_hooks) && !XBUFFER (buffer)->inhibit_buffer_hooks)
     call1 (Vrun_hooks, Qbuffer_list_update_hook);
 
   return Qnil;
@@ -2370,9 +2385,12 @@ results, see Info node `(elisp)Swapping Text'.  */)
   bset_point_before_scroll (current_buffer, Qnil);
   bset_point_before_scroll (other_buffer, Qnil);
 
-  current_buffer->text->modiff++;        other_buffer->text->modiff++;
-  current_buffer->text->chars_modiff++;          
other_buffer->text->chars_modiff++;
-  current_buffer->text->overlay_modiff++; other_buffer->text->overlay_modiff++;
+  modiff_incr (&current_buffer->text->modiff);
+  modiff_incr (&other_buffer->text->modiff);
+  modiff_incr (&current_buffer->text->chars_modiff);
+  modiff_incr (&other_buffer->text->chars_modiff);
+  modiff_incr (&current_buffer->text->overlay_modiff);
+  modiff_incr (&other_buffer->text->overlay_modiff);
   current_buffer->text->beg_unchanged = current_buffer->text->gpt;
   current_buffer->text->end_unchanged = current_buffer->text->gpt;
   other_buffer->text->beg_unchanged = other_buffer->text->gpt;
@@ -3908,7 +3926,7 @@ modify_overlay (struct buffer *buf, ptrdiff_t start, 
ptrdiff_t end)
 
   bset_redisplay (buf);
 
-  ++BUF_OVERLAY_MODIFF (buf);
+  modiff_incr (&BUF_OVERLAY_MODIFF (buf));
 }
 
 /* Remove OVERLAY from LIST.  */
@@ -5001,24 +5019,37 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes)
 void
 enlarge_buffer_text (struct buffer *b, ptrdiff_t delta)
 {
-  void *p;
-  ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1
-                     + delta);
   block_input ();
+  void *p;
+  unsigned char *old_beg = b->text->beg;
+  ptrdiff_t old_nbytes =
+    BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1;
+  ptrdiff_t new_nbytes = old_nbytes + delta;
+
+  if (pdumper_object_p (old_beg))
+    b->text->beg = NULL;
+  else
+    old_beg = NULL;
+
 #if defined USE_MMAP_FOR_BUFFERS
-  p = mmap_realloc ((void **) &b->text->beg, nbytes);
+  p = mmap_realloc ((void **) &b->text->beg, new_nbytes);
 #elif defined REL_ALLOC
-  p = r_re_alloc ((void **) &b->text->beg, nbytes);
+  p = r_re_alloc ((void **) &b->text->beg, new_nbytes);
 #else
-  p = xrealloc (b->text->beg, nbytes);
+  p = xrealloc (b->text->beg, new_nbytes);
 #endif
 
   if (p == NULL)
     {
+      if (old_beg)
+        b->text->beg = old_beg;
       unblock_input ();
-      memory_full (nbytes);
+      memory_full (new_nbytes);
     }
 
+  if (old_beg)
+    memcpy (p, old_beg, min (old_nbytes, new_nbytes));
+
   BUF_BEG_ADDR (b) = p;
   unblock_input ();
 }
@@ -5031,13 +5062,16 @@ free_buffer_text (struct buffer *b)
 {
   block_input ();
 
+  if (!pdumper_object_p (b->text->beg))
+    {
 #if defined USE_MMAP_FOR_BUFFERS
-  mmap_free ((void **) &b->text->beg);
+      mmap_free ((void **) &b->text->beg);
 #elif defined REL_ALLOC
-  r_alloc_free ((void **) &b->text->beg);
+      r_alloc_free ((void **) &b->text->beg);
 #else
-  xfree (b->text->beg);
+      xfree (b->text->beg);
 #endif
+    }
 
   BUF_BEG_ADDR (b) = NULL;
   unblock_input ();
@@ -5048,14 +5082,25 @@ free_buffer_text (struct buffer *b)
 /***********************************************************************
                            Initialization
  ***********************************************************************/
-
 void
 init_buffer_once (void)
 {
+  /* TODO: clean up the buffer-local machinery.  Right now,
+     we have:
+
+     buffer_defaults: default values of buffer-locals
+     buffer_local_flags: metadata
+     buffer_permanent_local_flags: metadata
+     buffer_local_symbols: metadata
+
+     There must be a simpler way to store the metadata.
+  */
+
   int idx;
 
   /* Items flagged permanent get an explicit permanent-local property
      added in bindings.el, for clarity.  */
+  PDUMPER_REMEMBER_SCALAR (buffer_permanent_local_flags);
   memset (buffer_permanent_local_flags, 0, sizeof 
buffer_permanent_local_flags);
 
   /* 0 means not a lisp var, -1 means always local, else mask.  */
@@ -5144,10 +5189,15 @@ init_buffer_once (void)
   XSETFASTINT (BVAR (&buffer_local_flags, extra_line_spacing), idx); ++idx;
   XSETFASTINT (BVAR (&buffer_local_flags, cursor_in_non_selected_windows), 
idx); ++idx;
 
+  /* buffer_local_flags contains no pointers, so it's safe to treat it
+     as a blob for pdumper.  */
+  PDUMPER_REMEMBER_SCALAR (buffer_local_flags);
+
   /* Need more room? */
   if (idx >= MAX_PER_BUFFER_VARS)
     emacs_abort ();
   last_per_buffer_idx = idx;
+  PDUMPER_REMEMBER_SCALAR (last_per_buffer_idx);
 
   /* Make sure all markable slots in buffer_defaults
      are initialized reasonably, so mark_buffer won't choke.  */
@@ -5242,7 +5292,9 @@ init_buffer_once (void)
 
   Vbuffer_alist = Qnil;
   current_buffer = 0;
+  pdumper_remember_lv_ptr_raw (&current_buffer, Lisp_Vectorlike);
   all_buffers = 0;
+  pdumper_remember_lv_ptr_raw (&all_buffers, Lisp_Vectorlike);
 
   QSFundamental = build_pure_c_string ("Fundamental");
 
@@ -5266,14 +5318,12 @@ init_buffer_once (void)
 }
 
 void
-init_buffer (int initialized)
+init_buffer (void)
 {
-  char *pwd;
   Lisp_Object temp;
-  ptrdiff_t len;
 
 #ifdef USE_MMAP_FOR_BUFFERS
-  if (initialized)
+  if (dumped_with_unexec_p ())
     {
       struct buffer *b;
 
@@ -5314,9 +5364,6 @@ init_buffer (int initialized)
          eassert (b->text->beg != NULL);
        }
     }
-#else  /* not USE_MMAP_FOR_BUFFERS */
-  /* Avoid compiler warnings.  */
-  (void) initialized;
 #endif /* USE_MMAP_FOR_BUFFERS */
 
   AUTO_STRING (scratch, "*scratch*");
@@ -5324,7 +5371,7 @@ init_buffer (int initialized)
   if (NILP (BVAR (&buffer_defaults, enable_multibyte_characters)))
     Fset_buffer_multibyte (Qnil);
 
-  pwd = emacs_get_current_dir_name ();
+  char const *pwd = emacs_wd;
 
   if (!pwd)
     {
@@ -5336,22 +5383,16 @@ init_buffer (int initialized)
     {
       /* Maybe this should really use some standard subroutine
          whose definition is filename syntax dependent.  */
-      len = strlen (pwd);
-      if (!(IS_DIRECTORY_SEP (pwd[len - 1])))
-        {
-          /* Grow buffer to add directory separator and '\0'.  */
-          pwd = realloc (pwd, len + 2);
-          if (!pwd)
-            fatal ("get_current_dir_name: %s\n", strerror (errno));
-          pwd[len] = DIRECTORY_SEP;
-          pwd[len + 1] = '\0';
-          len++;
-        }
+      ptrdiff_t len = strlen (pwd);
+      bool add_slash = ! IS_DIRECTORY_SEP (pwd[len - 1]);
 
       /* At this moment, we still don't know how to decode the directory
          name.  So, we keep the bytes in unibyte form so that file I/O
          routines correctly get the original bytes.  */
-      bset_directory (current_buffer, make_unibyte_string (pwd, len));
+      Lisp_Object dirname = make_unibyte_string (pwd, len + add_slash);
+      if (add_slash)
+       SSET (dirname, len, DIRECTORY_SEP);
+      bset_directory (current_buffer, dirname);
 
       /* Add /: to the front of the name
          if it would otherwise be treated as magic.  */
@@ -5372,8 +5413,6 @@ init_buffer (int initialized)
 
   temp = get_minibuffer (0);
   bset_directory (XBUFFER (temp), BVAR (current_buffer, directory));
-
-  free (pwd);
 }
 
 /* Similar to defvar_lisp but define a variable whose value is the
@@ -5420,8 +5459,7 @@ void
 syms_of_buffer (void)
 {
   staticpro (&last_overlay_modification_hooks);
-  last_overlay_modification_hooks
-    = Fmake_vector (make_fixnum (10), Qnil);
+  last_overlay_modification_hooks = make_nil_vector (10);
 
   staticpro (&QSFundamental);
   staticpro (&Vbuffer_alist);
@@ -5459,7 +5497,7 @@ syms_of_buffer (void)
               Qoverwrite_mode_binary));
 
   Fput (Qprotected_field, Qerror_conditions,
-       listn (CONSTYPE_PURE, 2, Qprotected_field, Qerror));
+       pure_list (Qprotected_field, Qerror));
   Fput (Qprotected_field, Qerror_message,
        build_pure_c_string ("Attempt to modify a protected field"));
 
@@ -5706,8 +5744,8 @@ visual lines rather than logical lines.  See the 
documentation of
   DEFVAR_PER_BUFFER ("default-directory", &BVAR (current_buffer, directory),
                     Qstringp,
                     doc: /* Name of default directory of current buffer.
-It should be a directory name (as opposed to a directory file-name).
-On GNU and Unix systems, directory names end in a slash `/'.
+It should be an absolute directory name; on GNU and Unix systems,
+these names start with `/' or `~' and end with `/'.
 To interactively change the default directory, use command `cd'. */);
 
   DEFVAR_PER_BUFFER ("auto-fill-function", &BVAR (current_buffer, 
auto_fill_function),
@@ -6228,9 +6266,11 @@ The function `kill-all-local-variables' runs this before 
doing anything else.  *
 
   DEFVAR_LISP ("buffer-list-update-hook", Vbuffer_list_update_hook,
               doc: /* Hook run when the buffer list changes.
-Functions running this hook are, `get-buffer-create',
-`make-indirect-buffer', `rename-buffer', `kill-buffer',
-`bury-buffer-internal' and `select-window'.  */);
+Functions (implicitly) running this hook are `get-buffer-create',
+`make-indirect-buffer', `rename-buffer', `kill-buffer', `bury-buffer'
+and `select-window'.  Functions run by this hook should avoid calling
+`select-window' with a nil NORECORD argument or `with-temp-buffer'
+since either may lead to infinite recursion.  */);
   Vbuffer_list_update_hook = Qnil;
   DEFSYM (Qbuffer_list_update_hook, "buffer-list-update-hook");
 
diff --git a/src/buffer.h b/src/buffer.h
index 4ea7fa6..63b1621 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -1,6 +1,6 @@
 /* Header file for the buffer manipulation primitives.
 
-Copyright (C) 1985-1986, 1993-1995, 1997-2018 Free Software Foundation,
+Copyright (C) 1985-1986, 1993-1995, 1997-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -422,20 +422,20 @@ struct buffer_text
     ptrdiff_t gpt_byte;                /* Byte pos of gap in buffer.  */
     ptrdiff_t z_byte;          /* Byte pos of end of buffer.  */
     ptrdiff_t gap_size;                /* Size of buffer's gap.  */
-    EMACS_INT modiff;          /* This counts buffer-modification events
+    modiff_count modiff;       /* This counts buffer-modification events
                                   for this buffer.  It is incremented for
                                   each such event, and never otherwise
                                   changed.  */
-    EMACS_INT chars_modiff;    /* This is modified with character change
+    modiff_count chars_modiff; /* This is modified with character change
                                   events for this buffer.  It is set to
                                   modiff for each such event, and never
                                   otherwise changed.  */
-    EMACS_INT save_modiff;     /* Previous value of modiff, as of last
+    modiff_count save_modiff;  /* Previous value of modiff, as of last
                                   time buffer visited or saved a file.  */
 
-    EMACS_INT overlay_modiff;  /* Counts modifications to overlays.  */
+    modiff_count overlay_modiff; /* Counts modifications to overlays.  */
 
-    EMACS_INT compact;         /* Set to modiff each time when compact_buffer
+    modiff_count compact;      /* Set to modiff each time when compact_buffer
                                   is called for this buffer.  */
 
     /* Minimum value of GPT - BEG since last redisplay that finished.  */
@@ -446,12 +446,12 @@ struct buffer_text
 
     /* MODIFF as of last redisplay that finished; if it matches MODIFF,
        beg_unchanged and end_unchanged contain no useful information.  */
-    EMACS_INT unchanged_modified;
+    modiff_count unchanged_modified;
 
     /* BUF_OVERLAY_MODIFF of current buffer, as of last redisplay that
        finished; if it matches BUF_OVERLAY_MODIFF, beg_unchanged and
        end_unchanged contain no useful information.  */
-    EMACS_INT overlay_unchanged_modified;
+    modiff_count overlay_unchanged_modified;
 
     /* Properties of this buffer's text.  */
     INTERVAL intervals;
@@ -812,11 +812,11 @@ struct buffer
   off_t modtime_size;
 
   /* The value of text->modiff at the last auto-save.  */
-  EMACS_INT auto_save_modified;
+  modiff_count auto_save_modified;
 
   /* The value of text->modiff at the last display error.
      Redisplay of this buffer is inhibited until it changes again.  */
-  EMACS_INT display_error_modiff;
+  modiff_count display_error_modiff;
 
   /* The time at which we detected a failure to auto-save,
      Or 0 if we didn't have a failure.  */
@@ -855,6 +855,13 @@ struct buffer
   /* Non-zero whenever the narrowing is changed in this buffer.  */
   bool_bf clip_changed : 1;
 
+  /* Non-zero for internally used temporary buffers that don't need to
+     run hooks kill-buffer-hook, buffer-list-update-hook, and
+     kill-buffer-query-functions.  This is used in coding.c to avoid
+     slowing down en/decoding when there are a lot of these hooks
+     defined.  */
+  bool_bf inhibit_buffer_hooks : 1;
+
   /* List of overlays that end at or before the current center,
      in order of end-position.  */
   struct Lisp_Overlay *overlays_before;
diff --git a/src/bytecode.c b/src/bytecode.c
index 40389e0..4097779 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -1,5 +1,5 @@
 /* Execution of byte code produced by bytecomp.el.
-   Copyright (C) 1985-1988, 1993, 2000-2018 Free Software Foundation,
+   Copyright (C) 1985-1988, 1993, 2000-2019 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
@@ -1398,10 +1398,11 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object 
vector, Lisp_Object maxdepth,
               search as the jump table.  */
             Lisp_Object jmp_table = POP;
            if (BYTE_CODE_SAFE && !HASH_TABLE_P (jmp_table))
-             emacs_abort ();
+              emacs_abort ();
             Lisp_Object v1 = POP;
             ptrdiff_t i;
             struct Lisp_Hash_Table *h = XHASH_TABLE (jmp_table);
+            hash_rehash_if_needed (h);
 
             /* h->count is a faster approximation for HASH_TABLE_SIZE (h)
                here. */
@@ -1494,13 +1495,9 @@ If a symbol has a property named `byte-code-meter' whose 
value is an
 integer, it is incremented each time that symbol's function is called.  */);
 
   byte_metering_on = false;
-  Vbyte_code_meter = Fmake_vector (make_fixnum (256), make_fixnum (0));
+  Vbyte_code_meter = make_nil_vector (256);
   DEFSYM (Qbyte_code_meter, "byte-code-meter");
-  {
-    int i = 256;
-    while (i--)
-      ASET (Vbyte_code_meter, i,
-           Fmake_vector (make_fixnum (256), make_fixnum (0)));
-  }
+  for (int i = 0; i < 256; i++)
+    ASET (Vbyte_code_meter, i, make_vector (256, make_fixnum (0)));
 #endif
 }
diff --git a/src/callint.c b/src/callint.c
index 81efb26..88a3c34 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -1,5 +1,5 @@
 /* Call a Lisp function interactively.
-   Copyright (C) 1985-1986, 1993-1995, 1997, 2000-2018 Free Software
+   Copyright (C) 1985-1986, 1993-1995, 1997, 2000-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -572,7 +572,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
            /* If the key sequence ends with a down-event,
               discard the following up-event.  */
            Lisp_Object teml
-             = Faref (args[i], make_fixnum (XFIXNUM (Flength (args[i])) - 1));
+             = Faref (args[i], make_fixnum (ASIZE (args[i]) - 1));
            if (CONSP (teml))
              teml = XCAR (teml);
            if (SYMBOLP (teml))
@@ -589,7 +589,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
        case 'U':               /* Up event from last k or K.  */
          if (!NILP (up_event))
            {
-             args[i] = Fmake_vector (make_fixnum (1), up_event);
+             args[i] = make_vector (1, up_event);
              up_event = Qnil;
              visargs[i] = Fkey_description (args[i], Qnil);
            }
@@ -714,7 +714,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
        default:
          {
            /* How many bytes are left unprocessed in the specs string?
-              (Note that this excludes the trailing null byte.)  */
+              (Note that this excludes the trailing NUL byte.)  */
            ptrdiff_t bytes_left = string_len - (tem - string);
            unsigned letter;
 
@@ -814,11 +814,11 @@ syms_of_callint (void)
   callint_message = Qnil;
   staticpro (&callint_message);
 
-  preserved_fns = listn (CONSTYPE_PURE, 4,
-                        intern_c_string ("region-beginning"),
-                        intern_c_string ("region-end"),
-                        intern_c_string ("point"),
-                        intern_c_string ("mark"));
+  preserved_fns = pure_list (intern_c_string ("region-beginning"),
+                            intern_c_string ("region-end"),
+                            intern_c_string ("point"),
+                            intern_c_string ("mark"));
+  staticpro (&preserved_fns);
 
   DEFSYM (Qlist, "list");
   DEFSYM (Qlet, "let");
diff --git a/src/callproc.c b/src/callproc.c
index a2cfd2e..a3d0960 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -1,6 +1,6 @@
 /* Synchronous subprocess invocation for GNU Emacs.
 
-Copyright (C) 1985-1988, 1993-1995, 1999-2018 Free Software Foundation,
+Copyright (C) 1985-1988, 1993-1995, 1999-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -237,7 +237,7 @@ DESTINATION can also have the form (REAL-BUFFER 
STDERR-FILE); in that case,
  t (mix it with ordinary output), or a file name string.
 
 Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted.
-Remaining arguments are strings passed as command arguments to PROGRAM.
+Remaining arguments ARGS are strings passed as command arguments to PROGRAM.
 
 If executable PROGRAM can't be found as an executable, `call-process'
 signals a Lisp error.  `call-process' reports errors in execution of
@@ -643,19 +643,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int 
filefd,
 #endif
 
       unblock_child_signal (&oldset);
-
-#ifdef DARWIN_OS
-      /* Darwin doesn't let us run setsid after a vfork, so use
-         TIOCNOTTY when necessary. */
-      int j = emacs_open (DEV_TTY, O_RDWR, 0);
-      if (j >= 0)
-        {
-          ioctl (j, TIOCNOTTY, 0);
-          emacs_close (j);
-        }
-#else
-      setsid ();
-#endif
+      dissociate_controlling_tty ();
 
       /* Emacs ignores SIGPIPE, but the child should not.  */
       signal (SIGPIPE, SIG_DFL);
@@ -1045,7 +1033,8 @@ STDERR-FILE may be nil (discard standard error output),
 t (mix it with ordinary output), or a file name string.
 
 Sixth arg DISPLAY non-nil means redisplay buffer as output is inserted.
-Remaining args are passed to PROGRAM at startup as command args.
+Remaining arguments ARGS are passed to PROGRAM at startup as command-line
+arguments.
 
 If BUFFER is 0, `call-process-region' returns immediately with value nil.
 Otherwise it waits for PROGRAM to terminate
@@ -1600,9 +1589,7 @@ init_callproc (void)
        }
     }
 
-#ifndef CANNOT_DUMP
-  if (initialized)
-#endif
+  if (!will_dump_p ())
     {
       tempdir = Fdirectory_file_name (Vexec_directory);
       if (! file_accessible_directory_p (tempdir))
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 95857d6..3f407ea 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -1,7 +1,7 @@
 /* -*- coding: utf-8 -*- */
 /* GNU Emacs case conversion functions.
 
-Copyright (C) 1985, 1994, 1997-1999, 2001-2018 Free Software Foundation,
+Copyright (C) 1985, 1994, 1997-1999, 2001-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/casetab.c b/src/casetab.c
index 0e742de..b3ee24c 100644
--- a/src/casetab.c
+++ b/src/casetab.c
@@ -1,5 +1,5 @@
 /* GNU Emacs routines to deal with case tables.
-   Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 Author: Howard Gayle
 
diff --git a/src/category.c b/src/category.c
index d6ccde5..132fae9 100644
--- a/src/category.c
+++ b/src/category.c
@@ -1,6 +1,6 @@
 /* GNU Emacs routines to deal with category tables.
 
-Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
   2005, 2006, 2007, 2008, 2009, 2010, 2011
   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -42,15 +42,6 @@ bset_category_table (struct buffer *b, Lisp_Object val)
   b->category_table_ = val;
 }
 
-/* The version number of the latest category table.  Each category
-   table has a unique version number.  It is assigned a new number
-   also when it is modified.  When a regular expression is compiled
-   into the struct re_pattern_buffer, the version number of the
-   category table (of the current buffer) at that moment is also
-   embedded in the structure.
-
-   For the moment, we are not using this feature.  */
-static int category_table_version;
 
 /* Category set staff.  */
 
@@ -271,8 +262,7 @@ DEFUN ("make-category-table", Fmake_category_table, 
Smake_category_table,
   set_char_table_defalt (val, MAKE_CATEGORY_SET);
   for (i = 0; i < (1 << CHARTAB_SIZE_BITS_0); i++)
     set_char_table_contents (val, i, MAKE_CATEGORY_SET);
-  Fset_char_table_extra_slot (val, make_fixnum (0),
-                             Fmake_vector (make_fixnum (95), Qnil));
+  Fset_char_table_extra_slot (val, make_fixnum (0), make_nil_vector (95));
   return val;
 }
 
@@ -446,7 +436,7 @@ init_category_once (void)
   /* Set a category set which contains nothing to the default.  */
   set_char_table_defalt (Vstandard_category_table, MAKE_CATEGORY_SET);
   Fset_char_table_extra_slot (Vstandard_category_table, make_fixnum (0),
-                             Fmake_vector (make_fixnum (95), Qnil));
+                             make_nil_vector (95));
 }
 
 void
@@ -513,6 +503,4 @@ See the documentation of the variable 
`word-combining-categories'.  */);
   defsubr (&Schar_category_set);
   defsubr (&Scategory_set_mnemonics);
   defsubr (&Smodify_category_entry);
-
-  category_table_version = 0;
 }
diff --git a/src/ccl.c b/src/ccl.c
index 31d0a28..ec108e3 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -1,5 +1,5 @@
 /* CCL (Code Conversion Language) interpreter.
-   Copyright (C) 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2019 Free Software Foundation, Inc.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
      2005, 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
@@ -2275,7 +2275,7 @@ void
 syms_of_ccl (void)
 {
   staticpro (&Vccl_program_table);
-  Vccl_program_table = Fmake_vector (make_fixnum (32), Qnil);
+  Vccl_program_table = make_nil_vector (32);
 
   DEFSYM (Qccl, "ccl");
   DEFSYM (Qcclp, "cclp");
@@ -2291,7 +2291,7 @@ syms_of_ccl (void)
 
   DEFVAR_LISP ("code-conversion-map-vector", Vcode_conversion_map_vector,
               doc: /* Vector of code conversion maps.  */);
-  Vcode_conversion_map_vector = Fmake_vector (make_fixnum (16), Qnil);
+  Vcode_conversion_map_vector = make_nil_vector (16);
 
   DEFVAR_LISP ("font-ccl-encoder-alist", Vfont_ccl_encoder_alist,
               doc: /* Alist of fontname patterns vs corresponding CCL program.
diff --git a/src/character.c b/src/character.c
index 0b14e47..d14d0df 100644
--- a/src/character.c
+++ b/src/character.c
@@ -1,6 +1,6 @@
 /* Basic character support.
 
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 Copyright (C) 1995, 1997, 1998, 2001 Electrotechnical Laboratory, JAPAN.
   Licensed to the Free Software Foundation.
 Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
@@ -1124,7 +1124,7 @@ syms_of_character (void)
 Vector recording all translation tables ever defined.
 Each element is a pair (SYMBOL . TABLE) relating the table to the
 symbol naming it.  The ID of a translation table is an index into this vector. 
 */);
-  Vtranslation_table_vector = Fmake_vector (make_fixnum (16), Qnil);
+  Vtranslation_table_vector = make_nil_vector (16);
 
   DEFVAR_LISP ("auto-fill-chars", Vauto_fill_chars,
               doc: /*
diff --git a/src/charset.c b/src/charset.c
index c1a2378..c0700f9 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1,6 +1,6 @@
 /* Basic character set support.
 
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
   2005, 2006, 2007, 2008, 2009, 2010, 2011
@@ -39,6 +39,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "coding.h"
 #include "buffer.h"
 #include "sysstdio.h"
+#include "pdumper.h"
 
 /*** GENERAL NOTES on CODED CHARACTER SETS (CHARSETS) ***
 
@@ -61,8 +62,7 @@ Lisp_Object Vcharset_hash_table;
 
 /* Table of struct charset.  */
 struct charset *charset_table;
-
-static ptrdiff_t charset_table_size;
+int charset_table_size;
 static int charset_table_used;
 
 /* Special charsets corresponding to symbols.  */
@@ -261,7 +261,7 @@ load_charset_map (struct charset *charset, struct 
charset_map_entries *entries,
                {
                  int n = CODE_POINT_TO_INDEX (charset, max_code) + 1;
 
-                 vec = Fmake_vector (make_fixnum (n), make_fixnum (-1));
+                 vec = make_vector (n, make_fixnum (-1));
                  set_charset_attr (charset, charset_decoder, vec);
                }
              else
@@ -851,12 +851,14 @@ usage: (define-charset-internal ...)  */)
   bool new_definition_p;
   int nchars;
 
+  memset (&charset, 0, sizeof (charset));
+
   if (nargs != charset_arg_max)
     Fsignal (Qwrong_number_of_arguments,
             Fcons (intern ("define-charset-internal"),
                    make_fixnum (nargs)));
 
-  attrs = Fmake_vector (make_fixnum (charset_attr_max), Qnil);
+  attrs = make_nil_vector (charset_attr_max);
 
   CHECK_SYMBOL (args[charset_arg_name]);
   ASET (attrs, charset_name, args[charset_arg_name]);
@@ -1142,9 +1144,9 @@ usage: (define-charset-internal ...)  */)
          struct charset *new_table =
            xpalloc (0, &new_size, 1,
                     min (INT_MAX, MOST_POSITIVE_FIXNUM),
-                    sizeof *charset_table);
-         memcpy (new_table, charset_table, old_size * sizeof *new_table);
-         charset_table = new_table;
+                     sizeof *charset_table);
+          memcpy (new_table, charset_table, old_size * sizeof *new_table);
+          charset_table = new_table;
          charset_table_size = new_size;
          /* FIXME: This leaks memory, as the old charset_table becomes
             unreachable.  If the old charset table is charset_table_init
@@ -1173,8 +1175,7 @@ usage: (define-charset-internal ...)  */)
       ISO_CHARSET_TABLE (charset.dimension, charset.iso_chars_96,
                         charset.iso_final) = id;
       if (new_definition_p)
-       Viso_2022_charset_list = nconc2 (Viso_2022_charset_list,
-                                        list1 (make_fixnum (id)));
+       Viso_2022_charset_list = nconc2 (Viso_2022_charset_list, list1i (id));
       if (ISO_CHARSET_TABLE (1, 0, 'J') == id)
        charset_jisx0201_roman = id;
       else if (ISO_CHARSET_TABLE (2, 0, '@') == id)
@@ -1194,15 +1195,14 @@ usage: (define-charset-internal ...)  */)
        emacs_mule_bytes[charset.emacs_mule_id] = charset.dimension + 2;
       if (new_definition_p)
        Vemacs_mule_charset_list = nconc2 (Vemacs_mule_charset_list,
-                                          list1 (make_fixnum (id)));
+                                          list1i (id));
     }
 
   if (new_definition_p)
     {
       Vcharset_list = Fcons (args[charset_arg_name], Vcharset_list);
       if (charset.supplementary_p)
-       Vcharset_ordered_list = nconc2 (Vcharset_ordered_list,
-                                       list1 (make_fixnum (id)));
+       Vcharset_ordered_list = nconc2 (Vcharset_ordered_list, list1i (id));
       else
        {
          Lisp_Object tail;
@@ -1219,7 +1219,7 @@ usage: (define-charset-internal ...)  */)
                                           Vcharset_ordered_list);
          else if (NILP (tail))
            Vcharset_ordered_list = nconc2 (Vcharset_ordered_list,
-                                           list1 (make_fixnum (id)));
+                                           list1i (id));
          else
            {
              val = Fcons (XCAR (tail), XCDR (tail));
@@ -1276,8 +1276,7 @@ define_charset_internal (Lisp_Object name,
   args[charset_arg_unify_map] = Qnil;
 
   args[charset_arg_plist] =
-    listn (CONSTYPE_HEAP, 14,
-          QCname,
+     list (QCname,
           args[charset_arg_name],
           intern_c_string (":dimension"),
           args[charset_arg_dimension],
@@ -1563,7 +1562,7 @@ only `ascii', `eight-bit-control', and 
`eight-bit-graphic'.  */)
 
   from_byte = CHAR_TO_BYTE (from);
 
-  charsets = Fmake_vector (make_fixnum (charset_table_used), Qnil);
+  charsets = make_nil_vector (charset_table_used);
   while (1)
     {
       find_charsets_in_text (BYTE_POS_ADDR (from_byte), stop - from,
@@ -1594,18 +1593,14 @@ If STR is unibyte, the returned list may contain
 only `ascii', `eight-bit-control', and `eight-bit-graphic'. */)
   (Lisp_Object str, Lisp_Object table)
 {
-  Lisp_Object charsets;
-  int i;
-  Lisp_Object val;
-
   CHECK_STRING (str);
 
-  charsets = Fmake_vector (make_fixnum (charset_table_used), Qnil);
+  Lisp_Object charsets = make_nil_vector (charset_table_used);
   find_charsets_in_text (SDATA (str), SCHARS (str), SBYTES (str),
                         charsets, table,
                         STRING_MULTIBYTE (str));
-  val = Qnil;
-  for (i = charset_table_used - 1; i >= 0; i--)
+  Lisp_Object val = Qnil;
+  for (int i = charset_table_used - 1; i >= 0; i--)
     if (!NILP (AREF (charsets, i)))
       val = Fcons (CHARSET_NAME (charset_table + i), val);
   return val;
@@ -2182,7 +2177,7 @@ usage: (set-charset-priority &rest charsets)  */)
        }
     }
   Vcharset_non_preferred_head = old_list;
-  Vcharset_ordered_list = CALLN (Fnconc, Fnreverse (new_head), old_list);
+  Vcharset_ordered_list = nconc2 (Fnreverse (new_head), old_list);
 
   charset_ordered_list_tick++;
 
@@ -2246,8 +2241,7 @@ Return the sorted list.  CHARSETS is modified by side 
effects.
 See also `charset-priority-list' and `set-charset-priority'.  */)
      (Lisp_Object charsets)
 {
-  Lisp_Object len = Flength (charsets);
-  ptrdiff_t n = XFIXNAT (len), i, j;
+  ptrdiff_t n = list_length (charsets), i, j;
   int done;
   Lisp_Object tail, elt, attrs;
   struct charset_sort_data *sort_data;
@@ -2321,19 +2315,28 @@ init_charset_once (void)
   for (i = 0; i < ISO_MAX_DIMENSION; i++)
     for (j = 0; j < ISO_MAX_CHARS; j++)
       for (k = 0; k < ISO_MAX_FINAL; k++)
-       iso_charset_table[i][j][k] = -1;
+        iso_charset_table[i][j][k] = -1;
+
+  PDUMPER_REMEMBER_SCALAR (iso_charset_table);
 
   for (i = 0; i < 256; i++)
     emacs_mule_charset[i] = -1;
 
+  PDUMPER_REMEMBER_SCALAR (emacs_mule_charset);
+
   charset_jisx0201_roman = -1;
+  PDUMPER_REMEMBER_SCALAR (charset_jisx0201_roman);
+
   charset_jisx0208_1978 = -1;
+  PDUMPER_REMEMBER_SCALAR (charset_jisx0208_1978);
+
   charset_jisx0208 = -1;
+  PDUMPER_REMEMBER_SCALAR (charset_jisx0208);
+
   charset_ksc5601 = -1;
+  PDUMPER_REMEMBER_SCALAR (charset_ksc5601);
 }
 
-#ifdef emacs
-
 /* Allocate an initial charset table that is large enough to handle
    Emacs while it is bootstrapping.  As of September 2011, the size
    needs to be at least 166; make it a bit bigger to allow for future
@@ -2372,7 +2375,9 @@ syms_of_charset (void)
 
   charset_table = charset_table_init;
   charset_table_size = ARRAYELTS (charset_table_init);
+  PDUMPER_REMEMBER_SCALAR (charset_table_size);
   charset_table_used = 0;
+  PDUMPER_REMEMBER_SCALAR (charset_table_used);
 
   defsubr (&Scharsetp);
   defsubr (&Smap_charset_chars);
@@ -2418,21 +2423,30 @@ the value may be a list of mnemonics.  */);
 
   charset_ascii
     = define_charset_internal (Qascii, 1, "\x00\x7F\0\0\0\0\0",
-                              0, 127, 'B', -1, 0, 1, 0, 0);
+                               0, 127, 'B', -1, 0, 1, 0, 0);
+  PDUMPER_REMEMBER_SCALAR (charset_ascii);
+
   charset_iso_8859_1
     = define_charset_internal (Qiso_8859_1, 1, "\x00\xFF\0\0\0\0\0",
-                              0, 255, -1, -1, -1, 1, 0, 0);
+                               0, 255, -1, -1, -1, 1, 0, 0);
+  PDUMPER_REMEMBER_SCALAR (charset_iso_8859_1);
+
   charset_unicode
     = define_charset_internal (Qunicode, 3, "\x00\xFF\x00\xFF\x00\x10\0",
-                              0, MAX_UNICODE_CHAR, -1, 0, -1, 1, 0, 0);
+                               0, MAX_UNICODE_CHAR, -1, 0, -1, 1, 0, 0);
+  PDUMPER_REMEMBER_SCALAR (charset_unicode);
+
   charset_emacs
     = define_charset_internal (Qemacs, 3, "\x00\xFF\x00\xFF\x00\x3F\0",
-                              0, MAX_5_BYTE_CHAR, -1, 0, -1, 1, 1, 0);
+                               0, MAX_5_BYTE_CHAR, -1, 0, -1, 1, 1, 0);
+  PDUMPER_REMEMBER_SCALAR (charset_emacs);
+
   charset_eight_bit
     = define_charset_internal (Qeight_bit, 1, "\x80\xFF\0\0\0\0\0",
                               128, 255, -1, 0, -1, 0, 1,
-                              MAX_5_BYTE_CHAR + 1);
+                               MAX_5_BYTE_CHAR + 1);
+  PDUMPER_REMEMBER_SCALAR (charset_eight_bit);
+
   charset_unibyte = charset_iso_8859_1;
+  PDUMPER_REMEMBER_SCALAR (charset_unibyte);
 }
-
-#endif /* emacs */
diff --git a/src/charset.h b/src/charset.h
index 7b85a1a..7042a71 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -1,5 +1,5 @@
 /* Header for charset handler.
-   Copyright (C) 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2019 Free Software Foundation, Inc.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
      2005, 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
@@ -248,6 +248,7 @@ extern Lisp_Object Vcharset_hash_table;
 
 /* Table of struct charset.  */
 extern struct charset *charset_table;
+extern int charset_table_size;
 
 #define CHARSET_FROM_ID(id) (charset_table + (id))
 
diff --git a/src/chartab.c b/src/chartab.c
index 3d38b3c..16017f4 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -125,7 +125,7 @@ the char-table has no extra slot.  */)
     }
 
   size = CHAR_TABLE_STANDARD_SLOTS + n_extras;
-  vector = Fmake_vector (make_fixnum (size), init);
+  vector = make_vector (size, init);
   XSETPVECTYPE (XVECTOR (vector), PVEC_CHAR_TABLE);
   set_char_table_parent (vector, Qnil);
   set_char_table_purpose (vector, purpose);
@@ -184,16 +184,13 @@ copy_sub_char_table (Lisp_Object table)
 Lisp_Object
 copy_char_table (Lisp_Object table)
 {
-  Lisp_Object copy;
   int size = PVSIZE (table);
-  int i;
-
-  copy = Fmake_vector (make_fixnum (size), Qnil);
+  Lisp_Object copy = make_nil_vector (size);
   XSETPVECTYPE (XVECTOR (copy), PVEC_CHAR_TABLE);
   set_char_table_defalt (copy, XCHAR_TABLE (table)->defalt);
   set_char_table_parent (copy, XCHAR_TABLE (table)->parent);
   set_char_table_purpose (copy, XCHAR_TABLE (table)->purpose);
-  for (i = 0; i < chartab_size[0]; i++)
+  for (int i = 0; i < chartab_size[0]; i++)
     set_char_table_contents
       (copy, i,
        (SUB_CHAR_TABLE_P (XCHAR_TABLE (table)->contents[i])
@@ -201,7 +198,7 @@ copy_char_table (Lisp_Object table)
        : XCHAR_TABLE (table)->contents[i]));
   set_char_table_ascii (copy, char_table_ascii (copy));
   size -= CHAR_TABLE_STANDARD_SLOTS;
-  for (i = 0; i < size; i++)
+  for (int i = 0; i < size; i++)
     set_char_table_extras (copy, i, XCHAR_TABLE (table)->extras[i]);
 
   XSETCHAR_TABLE (copy, XCHAR_TABLE (copy));
@@ -1249,7 +1246,7 @@ uniprop_encode_value_numeric (Lisp_Object table, 
Lisp_Object value)
     set_char_table_extras (table, 4,
                           CALLN (Fvconcat,
                                  XCHAR_TABLE (table)->extras[4],
-                                 Fmake_vector (make_fixnum (1), value)));
+                                 make_vector (1, value)));
   return make_fixnum (i);
 }
 
diff --git a/src/cm.c b/src/cm.c
index e936c9f..71cc947 100644
--- a/src/cm.c
+++ b/src/cm.c
@@ -1,5 +1,5 @@
 /* Cursor motion subroutines for GNU Emacs.
-   Copyright (C) 1985, 1995, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1995, 2001-2019 Free Software Foundation, Inc.
     based primarily on public domain code written by Chris Torek
 
 This file is part of GNU Emacs.
diff --git a/src/cm.h b/src/cm.h
index 67515c3..2f6e6ad 100644
--- a/src/cm.h
+++ b/src/cm.h
@@ -1,5 +1,5 @@
 /* Cursor motion calculation definitions for GNU Emacs
-   Copyright (C) 1985, 1989, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1989, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/cmds.c b/src/cmds.c
index 1616efb..9f3c861 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -1,6 +1,6 @@
 /* Simple built-in editing commands.
 
-Copyright (C) 1985, 1993-1998, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1985, 1993-1998, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -121,28 +121,36 @@ it as a line moved across, even though there is no next 
line to
 go to its beginning.  */)
   (Lisp_Object n)
 {
-  ptrdiff_t opoint = PT, pos, pos_byte, shortage, count;
+  ptrdiff_t opoint = PT, pos, pos_byte, count;
+  bool excessive = false;
 
   if (NILP (n))
     count = 1;
   else
     {
-      CHECK_FIXNUM (n);
-      count = XFIXNUM (n);
+      CHECK_INTEGER (n);
+      if (FIXNUMP (n)
+         && -BUF_BYTES_MAX <= XFIXNUM (n) && XFIXNUM (n) <= BUF_BYTES_MAX)
+       count = XFIXNUM (n);
+      else
+       {
+         count = !NILP (Fnatnump (n)) ? BUF_BYTES_MAX : -BUF_BYTES_MAX;
+         excessive = true;
+       }
     }
 
-  shortage = scan_newline_from_point (count, &pos, &pos_byte);
+  ptrdiff_t counted = scan_newline_from_point (count, &pos, &pos_byte);
 
   SET_PT_BOTH (pos, pos_byte);
 
-  if (shortage > 0
-      && (count <= 0
-         || (ZV > BEGV
-             && PT != opoint
-             && (FETCH_BYTE (PT_BYTE - 1) != '\n'))))
-    shortage--;
-
-  return make_fixnum (count <= 0 ? - shortage : shortage);
+  ptrdiff_t shortage = count - (count <= 0) - counted;
+  if (shortage != 0)
+    shortage -= (count <= 0 ? -1
+                 : (BEGV < ZV && PT != opoint
+                    && FETCH_BYTE (PT_BYTE - 1) != '\n'));
+  return (excessive
+         ? CALLN (Fplus, make_fixnum (shortage - count), n)
+         : make_fixnum (shortage));
 }
 
 DEFUN ("beginning-of-line", Fbeginning_of_line, Sbeginning_of_line, 0, 1, "^p",
@@ -260,11 +268,10 @@ because it respects values of `delete-active-region' and 
`overwrite-mode'.  */)
   return Qnil;
 }
 
-/* Note that there's code in command_loop_1 which typically avoids
-   calling this.  */
-DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 
1, "p",
+DEFUN ("self-insert-command", Fself_insert_command, Sself_insert_command, 1, 2,
+       "(list (prefix-numeric-value current-prefix-arg) last-command-event)",
        doc: /* Insert the character you type.
-Whichever character you type to run this command is inserted.
+Whichever character C you type to run this command is inserted.
 The numeric prefix argument N says how many times to repeat the insertion.
 Before insertion, `expand-abbrev' is executed if the inserted character does
 not have word syntax and the previous character in the buffer does.
@@ -272,10 +279,14 @@ After insertion, `internal-auto-fill' is called if
 `auto-fill-function' is non-nil and if the `auto-fill-chars' table has
 a non-nil value for the inserted character.  At the end, it runs
 `post-self-insert-hook'.  */)
-  (Lisp_Object n)
+  (Lisp_Object n, Lisp_Object c)
 {
   CHECK_FIXNUM (n);
 
+  /* Backward compatibility.  */
+  if (NILP (c))
+    c = last_command_event;
+
   if (XFIXNUM (n) < 0)
     error ("Negative repetition argument %"pI"d", XFIXNUM (n));
 
@@ -283,11 +294,11 @@ a non-nil value for the inserted character.  At the end, 
it runs
     call0 (Qundo_auto_amalgamate);
 
   /* Barf if the key that invoked this was not a character.  */
-  if (!CHARACTERP (last_command_event))
+  if (!CHARACTERP (c))
     bitch_at_user ();
   else {
     int character = translate_char (Vtranslation_table_for_input,
-                                   XFIXNUM (last_command_event));
+                                   XFIXNUM (c));
     int val = internal_self_insert (character, XFIXNAT (n));
     if (val == 2)
       Fset (Qundo_auto__this_command_amalgamating, Qnil);
@@ -412,7 +423,7 @@ internal_self_insert (int c, EMACS_INT n)
                  : UNIBYTE_TO_CHAR (XFIXNAT (Fprevious_char ())))
          == Sword))
     {
-      EMACS_INT modiff = MODIFF;
+      modiff_count modiff = MODIFF;
       Lisp_Object sym;
 
       sym = call0 (Qexpand_abbrev);
diff --git a/src/coding.c b/src/coding.c
index 966492a..e351cc7 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -1,5 +1,5 @@
 /* Coding system handler (conversion, detection, etc).
-   Copyright (C) 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2019 Free Software Foundation, Inc.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
      2005, 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
@@ -298,6 +298,7 @@ encode_coding_XXX (struct coding_system *coding)
 #include "composite.h"
 #include "coding.h"
 #include "termhooks.h"
+#include "pdumper.h"
 
 Lisp_Object Vcoding_system_hash_table;
 
@@ -307,16 +308,12 @@ Lisp_Object Vcoding_system_hash_table;
    file and process), not for in-buffer or Lisp string encoding.  */
 static Lisp_Object system_eol_type;
 
-#ifdef emacs
-
 /* Coding-systems are handed between Emacs Lisp programs and C internal
    routines by the following three variables.  */
 /* Coding system to be used to encode text for terminal display when
    terminal coding system is nil.  */
 struct coding_system safe_terminal_coding;
 
-#endif /* emacs */
-
 /* Two special coding systems.  */
 static Lisp_Object Vsjis_coding_system;
 static Lisp_Object Vbig5_coding_system;
@@ -617,23 +614,7 @@ inhibit_flag (int encoded_flag, bool var)
   do {                                                 \
     (attrs) = CODING_ID_ATTRS ((coding)->id);          \
     (charset_list) = CODING_ATTR_CHARSET_LIST (attrs); \
-  } while (0)
-
-static void
-CHECK_FIXNAT_CAR (Lisp_Object x)
-{
-  Lisp_Object tmp = XCAR (x);
-  CHECK_FIXNAT (tmp);
-  XSETCAR (x, tmp);
-}
-
-static void
-CHECK_FIXNAT_CDR (Lisp_Object x)
-{
-  Lisp_Object tmp = XCDR (x);
-  CHECK_FIXNAT (tmp);
-  XSETCDR (x, tmp);
-}
+  } while (false)
 
 /* True if CODING's destination can be grown.  */
 
@@ -4611,8 +4592,7 @@ detect_coding_sjis (struct coding_system *coding,
   int max_first_byte_of_2_byte_code;
 
   CODING_GET_INFO (coding, attrs, charset_list);
-  max_first_byte_of_2_byte_code
-    = (XFIXNUM (Flength (charset_list)) > 3 ? 0xFC : 0xEF);
+  max_first_byte_of_2_byte_code = list_length (charset_list) <= 3 ? 0xEF : 
0xFC;
 
   detect_info->checked |= CATEGORY_MASK_SJIS;
   /* A coding system of this category is always ASCII compatible.  */
@@ -5739,7 +5719,7 @@ setup_coding_system (Lisp_Object coding_system, struct 
coding_system *coding)
       coding->common_flags |= CODING_REQUIRE_DETECTION_MASK;
       coding->spec.undecided.inhibit_nbd
        = (encode_inhibit_flag
-          (AREF (attrs, coding_attr_undecided_inhibit_null_byte_detection)));
+          (AREF (attrs, coding_attr_undecided_inhibit_nul_byte_detection)));
       coding->spec.undecided.inhibit_ied
        = (encode_inhibit_flag
           (AREF (attrs, coding_attr_undecided_inhibit_iso_escape_detection)));
@@ -6534,9 +6514,9 @@ detect_coding (struct coding_system *coding)
     {
       int c, i;
       struct coding_detection_info detect_info;
-      bool null_byte_found = 0, eight_bit_found = 0;
+      bool nul_byte_found = 0, eight_bit_found = 0;
       bool inhibit_nbd = inhibit_flag (coding->spec.undecided.inhibit_nbd,
-                                      inhibit_null_byte_detection);
+                                      inhibit_nul_byte_detection);
       bool inhibit_ied = inhibit_flag (coding->spec.undecided.inhibit_ied,
                                       inhibit_iso_escape_detection);
       bool prefer_utf_8 = coding->spec.undecided.prefer_utf_8;
@@ -6549,7 +6529,7 @@ detect_coding (struct coding_system *coding)
          if (c & 0x80)
            {
              eight_bit_found = 1;
-             if (null_byte_found)
+             if (nul_byte_found)
                break;
            }
          else if (c < 0x20)
@@ -6564,7 +6544,7 @@ detect_coding (struct coding_system *coding)
                      if (! (detect_info.rejected & CATEGORY_MASK_ISO_7_ELSE))
                        {
                          /* We didn't find an 8-bit code.  We may
-                            have found a null-byte, but it's very
+                            have found a NUL-byte, but it's very
                             rare that a binary file conforms to
                             ISO-2022.  */
                          src = src_end;
@@ -6576,7 +6556,7 @@ detect_coding (struct coding_system *coding)
                }
              else if (! c && !inhibit_nbd)
                {
-                 null_byte_found = 1;
+                 nul_byte_found = 1;
                  if (eight_bit_found)
                    break;
                }
@@ -6608,7 +6588,7 @@ detect_coding (struct coding_system *coding)
            coding->head_ascii++;
        }
 
-      if (null_byte_found || eight_bit_found
+      if (nul_byte_found || eight_bit_found
          || coding->head_ascii < coding->src_bytes
          || detect_info.found)
        {
@@ -6626,7 +6606,7 @@ detect_coding (struct coding_system *coding)
              }
          else
            {
-             if (null_byte_found)
+             if (nul_byte_found)
                {
                  detect_info.checked |= ~CATEGORY_MASK_UTF_16;
                  detect_info.rejected |= ~CATEGORY_MASK_UTF_16;
@@ -6699,7 +6679,7 @@ detect_coding (struct coding_system *coding)
              else
                found = CODING_ID_NAME (this->id);
            }
-         else if (null_byte_found)
+         else if (nul_byte_found)
            found = Qno_conversion;
          else if ((detect_info.rejected & CATEGORY_MASK_ANY)
                   == CATEGORY_MASK_ANY)
@@ -7805,7 +7785,7 @@ encode_coding (struct coding_system *coding)
 
 
 /* Name (or base name) of work buffer for code conversion.  */
-static Lisp_Object Vcode_conversion_workbuf_name;
+Lisp_Object Vcode_conversion_workbuf_name;
 
 /* A working buffer used by the top level conversion.  Once it is
    created, it is never destroyed.  It has the name
@@ -7817,43 +7797,6 @@ static Lisp_Object Vcode_conversion_reused_workbuf;
 /* True iff Vcode_conversion_reused_workbuf is already in use.  */
 static bool reused_workbuf_in_use;
 
-
-/* Return a working buffer of code conversion.  MULTIBYTE specifies the
-   multibyteness of returning buffer.  */
-
-static Lisp_Object
-make_conversion_work_buffer (bool multibyte)
-{
-  Lisp_Object name, workbuf;
-  struct buffer *current;
-
-  if (reused_workbuf_in_use)
-    {
-      name = Fgenerate_new_buffer_name (Vcode_conversion_workbuf_name, Qnil);
-      workbuf = Fget_buffer_create (name);
-    }
-  else
-    {
-      reused_workbuf_in_use = 1;
-      if (NILP (Fbuffer_live_p (Vcode_conversion_reused_workbuf)))
-       Vcode_conversion_reused_workbuf
-         = Fget_buffer_create (Vcode_conversion_workbuf_name);
-      workbuf = Vcode_conversion_reused_workbuf;
-    }
-  current = current_buffer;
-  set_buffer_internal (XBUFFER (workbuf));
-  /* We can't allow modification hooks to run in the work buffer.  For
-     instance, directory_files_internal assumes that file decoding
-     doesn't compile new regexps.  */
-  Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt);
-  Ferase_buffer ();
-  bset_undo_list (current_buffer, Qt);
-  bset_enable_multibyte_characters (current_buffer, multibyte ? Qt : Qnil);
-  set_buffer_internal (current);
-  return workbuf;
-}
-
-
 static void
 code_conversion_restore (Lisp_Object arg)
 {
@@ -7877,9 +7820,39 @@ code_conversion_save (bool with_work_buf, bool multibyte)
   Lisp_Object workbuf = Qnil;
 
   if (with_work_buf)
-    workbuf = make_conversion_work_buffer (multibyte);
+    {
+      if (reused_workbuf_in_use)
+       {
+         Lisp_Object name
+           = Fgenerate_new_buffer_name (Vcode_conversion_workbuf_name, Qnil);
+         workbuf = Fget_buffer_create (name);
+       }
+      else
+       {
+         if (NILP (Fbuffer_live_p (Vcode_conversion_reused_workbuf)))
+           Vcode_conversion_reused_workbuf
+             = Fget_buffer_create (Vcode_conversion_workbuf_name);
+         workbuf = Vcode_conversion_reused_workbuf;
+       }
+    }
   record_unwind_protect (code_conversion_restore,
                         Fcons (Fcurrent_buffer (), workbuf));
+  if (!NILP (workbuf))
+    {
+      struct buffer *current = current_buffer;
+      set_buffer_internal (XBUFFER (workbuf));
+      /* We can't allow modification hooks to run in the work buffer.  For
+        instance, directory_files_internal assumes that file decoding
+        doesn't compile new regexps.  */
+      Fset (Fmake_local_variable (Qinhibit_modification_hooks), Qt);
+      Ferase_buffer ();
+      bset_undo_list (current_buffer, Qt);
+      bset_enable_multibyte_characters (current_buffer, multibyte ? Qt : Qnil);
+      if (EQ (workbuf, Vcode_conversion_reused_workbuf))
+       reused_workbuf_in_use = 1;
+      set_buffer_internal (current);
+    }
+
   return workbuf;
 }
 
@@ -8468,7 +8441,7 @@ from_unicode (Lisp_Object str)
 Lisp_Object
 from_unicode_buffer (const wchar_t *wstr)
 {
-  /* We get one of the two final null bytes for free.  */
+  /* We get one of the two final NUL bytes for free.  */
   ptrdiff_t len = 1 + sizeof (wchar_t) * wcslen (wstr);
   AUTO_STRING_WITH_LEN (str, (char *) wstr, len);
   return from_unicode (str);
@@ -8481,7 +8454,7 @@ to_unicode (Lisp_Object str, Lisp_Object *buf)
   /* We need to make another copy (in addition to the one made by
      code_convert_string_norecord) to ensure that the final string is
      _doubly_ zero terminated --- that is, that the string is
-     terminated by two zero bytes and one utf-16le null character.
+     terminated by two zero bytes and one utf-16le NUL character.
      Because strings are already terminated with a single zero byte,
      we just add one additional zero. */
   str = make_uninit_string (SBYTES (*buf) + 1);
@@ -8494,7 +8467,6 @@ to_unicode (Lisp_Object str, Lisp_Object *buf)
 #endif /* WINDOWSNT || CYGWIN */
 
 
-#ifdef emacs
 /*** 8. Emacs Lisp library functions ***/
 
 DEFUN ("coding-system-p", Fcoding_system_p, Scoding_system_p, 1, 1, 0,
@@ -8598,7 +8570,7 @@ detect_coding_system (const unsigned char *src,
   ptrdiff_t id;
   struct coding_detection_info detect_info;
   enum coding_category base_category;
-  bool null_byte_found = 0, eight_bit_found = 0;
+  bool nul_byte_found = 0, eight_bit_found = 0;
 
   if (NILP (coding_system))
     coding_system = Qundecided;
@@ -8625,7 +8597,7 @@ detect_coding_system (const unsigned char *src,
       struct coding_system *this UNINIT;
       int c, i;
       bool inhibit_nbd = inhibit_flag (coding.spec.undecided.inhibit_nbd,
-                                      inhibit_null_byte_detection);
+                                      inhibit_nul_byte_detection);
       bool inhibit_ied = inhibit_flag (coding.spec.undecided.inhibit_ied,
                                       inhibit_iso_escape_detection);
       bool prefer_utf_8 = coding.spec.undecided.prefer_utf_8;
@@ -8637,7 +8609,7 @@ detect_coding_system (const unsigned char *src,
          if (c & 0x80)
            {
              eight_bit_found = 1;
-             if (null_byte_found)
+             if (nul_byte_found)
                break;
            }
          else if (c < 0x20)
@@ -8652,7 +8624,7 @@ detect_coding_system (const unsigned char *src,
                      if (! (detect_info.rejected & CATEGORY_MASK_ISO_7_ELSE))
                        {
                          /* We didn't find an 8-bit code.  We may
-                            have found a null-byte, but it's very
+                            have found a NUL-byte, but it's very
                             rare that a binary file confirm to
                             ISO-2022.  */
                          src = src_end;
@@ -8664,7 +8636,7 @@ detect_coding_system (const unsigned char *src,
                }
              else if (! c && !inhibit_nbd)
                {
-                 null_byte_found = 1;
+                 nul_byte_found = 1;
                  if (eight_bit_found)
                    break;
                }
@@ -8675,7 +8647,7 @@ detect_coding_system (const unsigned char *src,
            coding.head_ascii++;
        }
 
-      if (null_byte_found || eight_bit_found
+      if (nul_byte_found || eight_bit_found
          || coding.head_ascii < coding.src_bytes
          || detect_info.found)
        {
@@ -8690,7 +8662,7 @@ detect_coding_system (const unsigned char *src,
              }
          else
            {
-             if (null_byte_found)
+             if (nul_byte_found)
                {
                  detect_info.checked |= ~CATEGORY_MASK_UTF_16;
                  detect_info.rejected |= ~CATEGORY_MASK_UTF_16;
@@ -8737,24 +8709,24 @@ detect_coding_system (const unsigned char *src,
        }
 
       if ((detect_info.rejected & CATEGORY_MASK_ANY) == CATEGORY_MASK_ANY
-         || null_byte_found)
+         || nul_byte_found)
        {
          detect_info.found = CATEGORY_MASK_RAW_TEXT;
          id = CODING_SYSTEM_ID (Qno_conversion);
-         val = list1 (make_fixnum (id));
+         val = list1i (id);
        }
       else if (! detect_info.rejected && ! detect_info.found)
        {
          detect_info.found = CATEGORY_MASK_ANY;
          id = coding_categories[coding_category_undecided].id;
-         val = list1 (make_fixnum (id));
+         val = list1i (id);
        }
       else if (highest)
        {
          if (detect_info.found)
            {
              detect_info.found = 1 << category;
-             val = list1 (make_fixnum (this->id));
+             val = list1i (this->id);
            }
          else
            for (i = 0; i < coding_category_raw_text; i++)
@@ -8762,7 +8734,7 @@ detect_coding_system (const unsigned char *src,
                {
                  detect_info.found = 1 << coding_priorities[i];
                  id = coding_categories[coding_priorities[i]].id;
-                 val = list1 (make_fixnum (id));
+                 val = list1i (id);
                  break;
                }
        }
@@ -8779,7 +8751,7 @@ detect_coding_system (const unsigned char *src,
                  found |= 1 << category;
                  id = coding_categories[category].id;
                  if (id >= 0)
-                   val = list1 (make_fixnum (id));
+                   val = list1i (id);
                }
            }
          for (i = coding_category_raw_text - 1; i >= 0; i--)
@@ -8804,7 +8776,7 @@ detect_coding_system (const unsigned char *src,
            this = coding_categories + coding_category_utf_8_sig;
          else
            this = coding_categories + coding_category_utf_8_nosig;
-         val = list1 (make_fixnum (this->id));
+         val = list1i (this->id);
        }
     }
   else if (base_category == coding_category_utf_16_auto)
@@ -8821,13 +8793,13 @@ detect_coding_system (const unsigned char *src,
            this = coding_categories + coding_category_utf_16_be_nosig;
          else
            this = coding_categories + coding_category_utf_16_le_nosig;
-         val = list1 (make_fixnum (this->id));
+         val = list1i (this->id);
        }
     }
   else
     {
       detect_info.found = 1 << XFIXNUM (CODING_ATTR_CATEGORY (attrs));
-      val = list1 (make_fixnum (coding.id));
+      val = list1i (coding.id);
     }
 
   /* Then, detect eol-format if necessary.  */
@@ -8839,7 +8811,7 @@ detect_coding_system (const unsigned char *src,
       {
        if (detect_info.found & ~CATEGORY_MASK_UTF_16)
          {
-           if (null_byte_found)
+           if (nul_byte_found)
              normal_eol = EOL_SEEN_LF;
            else
              normal_eol = detect_eol (coding.source, src_bytes,
@@ -9226,22 +9198,22 @@ to the string and treated as in `substring'.  */)
 
 DEFUN ("check-coding-systems-region", Fcheck_coding_systems_region,
        Scheck_coding_systems_region, 3, 3, 0,
-       doc: /* Check if the region is encodable by coding systems.
+       doc: /* Check if text between START and END is encodable by 
CODING-SYSTEM-LIST.
 
 START and END are buffer positions specifying the region.
 CODING-SYSTEM-LIST is a list of coding systems to check.
 
-The value is an alist ((CODING-SYSTEM POS0 POS1 ...) ...), where
-CODING-SYSTEM is a member of CODING-SYSTEM-LIST and can't encode the
-whole region, POS0, POS1, ... are buffer positions where non-encodable
-characters are found.
-
 If all coding systems in CODING-SYSTEM-LIST can encode the region, the
-value is nil.
+function returns nil.
+
+If some of the coding systems cannot encode the whole region, value is
+an alist, each element of which has the form (CODING-SYSTEM POS1 POS2 ...),
+which means that CODING-SYSTEM cannot encode the text at buffer positions
+POS1, POS2, ...
 
 START may be a string.  In that case, check if the string is
-encodable, and the value contains indices to the string instead of
-buffer positions.  END is ignored.
+encodable, and the value contains character indices into the string
+instead of buffer positions.  END is ignored in this case.
 
 If the current buffer (or START if it is a string) is unibyte, the value
 is nil.  */)
@@ -9770,7 +9742,7 @@ DEFUN ("set-terminal-coding-system-internal", 
Fset_terminal_coding_system_intern
   tset_charset_list
     (term, (terminal_coding->common_flags & CODING_REQUIRE_ENCODING_MASK
            ? coding_charset_list (terminal_coding)
-           : list1 (make_fixnum (charset_ascii))));
+           : list1i (charset_ascii)));
   return Qnil;
 }
 
@@ -10062,36 +10034,28 @@ DEFUN ("define-coding-system-internal", 
Fdefine_coding_system_internal,
 usage: (define-coding-system-internal ...)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
-  Lisp_Object name;
-  Lisp_Object spec_vec;                /* [ ATTRS ALIASE EOL_TYPE ] */
-  Lisp_Object attrs;           /* Vector of attributes.  */
-  Lisp_Object eol_type;
-  Lisp_Object aliases;
-  Lisp_Object coding_type, charset_list, safe_charsets;
   enum coding_category category;
-  Lisp_Object tail, val;
   int max_charset_id = 0;
-  int i;
 
   if (nargs < coding_arg_max)
     goto short_args;
 
-  attrs = Fmake_vector (make_fixnum (coding_attr_last_index), Qnil);
+  Lisp_Object attrs = make_nil_vector (coding_attr_last_index);
 
-  name = args[coding_arg_name];
+  Lisp_Object name = args[coding_arg_name];
   CHECK_SYMBOL (name);
   ASET (attrs, coding_attr_base_name, name);
 
-  val = args[coding_arg_mnemonic];
+  Lisp_Object val = args[coding_arg_mnemonic];
   if (! STRINGP (val))
     CHECK_CHARACTER (val);
   ASET (attrs, coding_attr_mnemonic, val);
 
-  coding_type = args[coding_arg_coding_type];
+  Lisp_Object coding_type = args[coding_arg_coding_type];
   CHECK_SYMBOL (coding_type);
   ASET (attrs, coding_attr_type, coding_type);
 
-  charset_list = args[coding_arg_charset_list];
+  Lisp_Object charset_list = args[coding_arg_charset_list];
   if (SYMBOLP (charset_list))
     {
       if (EQ (charset_list, Qiso_2022))
@@ -10106,7 +10070,7 @@ usage: (define-coding-system-internal ...)  */)
            error ("Invalid charset-list");
          charset_list = Vemacs_mule_charset_list;
        }
-      for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
+      for (Lisp_Object tail = charset_list; CONSP (tail); tail = XCDR (tail))
        {
          if (! RANGED_FIXNUMP (0, XCAR (tail), INT_MAX - 1))
            error ("Invalid charset-list");
@@ -10117,7 +10081,7 @@ usage: (define-coding-system-internal ...)  */)
   else
     {
       charset_list = Fcopy_sequence (charset_list);
-      for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
+      for (Lisp_Object tail = charset_list; CONSP (tail); tail = XCDR (tail))
        {
          struct charset *charset;
 
@@ -10138,9 +10102,9 @@ usage: (define-coding-system-internal ...)  */)
     }
   ASET (attrs, coding_attr_charset_list, charset_list);
 
-  safe_charsets = make_uninit_string (max_charset_id + 1);
+  Lisp_Object safe_charsets = make_uninit_string (max_charset_id + 1);
   memset (SDATA (safe_charsets), 255, max_charset_id + 1);
-  for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
+  for (Lisp_Object tail = charset_list; CONSP (tail); tail = XCDR (tail))
     SSET (safe_charsets, XFIXNAT (XCAR (tail)), 0);
   ASET (attrs, coding_attr_safe_charsets, safe_charsets);
 
@@ -10194,9 +10158,9 @@ usage: (define-coding-system-internal ...)  */)
         If Nth element is a list of charset IDs, N is the first byte
         of one of them.  The list is sorted by dimensions of the
         charsets.  A charset of smaller dimension comes first. */
-      val = Fmake_vector (make_fixnum (256), Qnil);
+      val = make_nil_vector (256);
 
-      for (tail = charset_list; CONSP (tail); tail = XCDR (tail))
+      for (Lisp_Object tail = charset_list; CONSP (tail); tail = XCDR (tail))
        {
          struct charset *charset = CHARSET_FROM_ID (XFIXNAT (XCAR (tail)));
          int dim = CHARSET_DIMENSION (charset);
@@ -10205,7 +10169,7 @@ usage: (define-coding-system-internal ...)  */)
          if (CHARSET_ASCII_COMPATIBLE_P (charset))
            ASET (attrs, coding_attr_ascii_compat, Qt);
 
-         for (i = charset->code_space[idx];
+         for (int i = charset->code_space[idx];
               i <= charset->code_space[idx + 1]; i++)
            {
              Lisp_Object tmp, tmp2;
@@ -10265,7 +10229,7 @@ usage: (define-coding-system-internal ...)  */)
 
       val = args[coding_arg_ccl_valids];
       valids = Fmake_string (make_fixnum (256), make_fixnum (0), Qnil);
-      for (tail = val; CONSP (tail); tail = XCDR (tail))
+      for (Lisp_Object tail = val; CONSP (tail); tail = XCDR (tail))
        {
          int from, to;
 
@@ -10279,18 +10243,12 @@ usage: (define-coding-system-internal ...)  */)
          else
            {
              CHECK_CONS (val);
-             CHECK_FIXNAT_CAR (val);
-             CHECK_FIXNUM_CDR (val);
-             if (XFIXNUM (XCAR (val)) > 255)
-               args_out_of_range_3 (XCAR (val),
-                                    make_fixnum (0), make_fixnum (255));
+             CHECK_RANGED_INTEGER (XCAR (val), 0, 255);
              from = XFIXNUM (XCAR (val));
-             if (! (from <= XFIXNUM (XCDR (val)) && XFIXNUM (XCDR (val)) <= 
255))
-               args_out_of_range_3 (XCDR (val),
-                                    XCAR (val), make_fixnum (255));
+             CHECK_RANGED_INTEGER (XCDR (val), from, 255);
              to = XFIXNUM (XCDR (val));
            }
-         for (i = from; i <= to; i++)
+         for (int i = from; i <= to; i++)
            SSET (valids, i, 1);
        }
       ASET (attrs, coding_attr_ccl_valids, valids);
@@ -10344,7 +10302,7 @@ usage: (define-coding-system-internal ...)  */)
 
       initial = Fcopy_sequence (args[coding_arg_iso2022_initial]);
       CHECK_VECTOR (initial);
-      for (i = 0; i < 4; i++)
+      for (int i = 0; i < 4; i++)
        {
          val = AREF (initial, i);
          if (! NILP (val))
@@ -10362,28 +10320,24 @@ usage: (define-coding-system-internal ...)  */)
 
       reg_usage = args[coding_arg_iso2022_reg_usage];
       CHECK_CONS (reg_usage);
-      CHECK_FIXNUM_CAR (reg_usage);
-      CHECK_FIXNUM_CDR (reg_usage);
+      CHECK_FIXNUM (XCAR (reg_usage));
+      CHECK_FIXNUM (XCDR (reg_usage));
 
       request = Fcopy_sequence (args[coding_arg_iso2022_request]);
-      for (tail = request; CONSP (tail); tail = XCDR (tail))
+      for (Lisp_Object tail = request; CONSP (tail); tail = XCDR (tail))
        {
          int id;
-         Lisp_Object tmp1;
 
          val = XCAR (tail);
          CHECK_CONS (val);
-         tmp1 = XCAR (val);
-         CHECK_CHARSET_GET_ID (tmp1, id);
-         CHECK_FIXNAT_CDR (val);
-         if (XFIXNUM (XCDR (val)) >= 4)
-           error ("Invalid graphic register number: %"pI"d", XFIXNUM (XCDR 
(val)));
+         CHECK_CHARSET_GET_ID (XCAR (val), id);
+         CHECK_RANGED_INTEGER (XCDR (val), 0, 3);
          XSETCAR (val, make_fixnum (id));
        }
 
       flags = args[coding_arg_iso2022_flags];
       CHECK_FIXNAT (flags);
-      i = XFIXNUM (flags) & INT_MAX;
+      int i = XFIXNUM (flags) & INT_MAX;
       if (EQ (args[coding_arg_charset_list], Qiso_2022))
        i |= CODING_ISO_FLAG_FULL_SUPPORT;
       flags = make_fixnum (i);
@@ -10426,14 +10380,11 @@ usage: (define-coding-system-internal ...)  */)
     }
   else if (EQ (coding_type, Qshift_jis))
     {
-
-      struct charset *charset;
-
-      if (XFIXNUM (Flength (charset_list)) != 3
-         && XFIXNUM (Flength (charset_list)) != 4)
+      ptrdiff_t charset_list_len = list_length (charset_list);
+      if (charset_list_len != 3 && charset_list_len != 4)
        error ("There should be three or four charsets");
 
-      charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list)));
+      struct charset *charset = CHARSET_FROM_ID (XFIXNUM (XCAR 
(charset_list)));
       if (CHARSET_DIMENSION (charset) != 1)
        error ("Dimension of charset %s is not one",
               SDATA (SYMBOL_NAME (CHARSET_NAME (charset))));
@@ -10468,7 +10419,7 @@ usage: (define-coding-system-internal ...)  */)
     {
       struct charset *charset;
 
-      if (XFIXNUM (Flength (charset_list)) != 2)
+      if (list_length (charset_list) != 2)
        error ("There should be just two charsets");
 
       charset = CHARSET_FROM_ID (XFIXNUM (XCAR (charset_list)));
@@ -10520,8 +10471,8 @@ usage: (define-coding-system-internal ...)  */)
     {
       if (nargs < coding_arg_undecided_max)
        goto short_args;
-      ASET (attrs, coding_attr_undecided_inhibit_null_byte_detection,
-           args[coding_arg_undecided_inhibit_null_byte_detection]);
+      ASET (attrs, coding_attr_undecided_inhibit_nul_byte_detection,
+           args[coding_arg_undecided_inhibit_nul_byte_detection]);
       ASET (attrs, coding_attr_undecided_inhibit_iso_escape_detection,
            args[coding_arg_undecided_inhibit_iso_escape_detection]);
       ASET (attrs, coding_attr_undecided_prefer_utf_8,
@@ -10542,19 +10493,19 @@ usage: (define-coding-system-internal ...)  */)
               Fcons (CODING_ATTR_ASCII_COMPAT (attrs),
                      CODING_ATTR_PLIST (attrs))));
 
-  eol_type = args[coding_arg_eol_type];
+  Lisp_Object eol_type = args[coding_arg_eol_type];
   if (! NILP (eol_type)
       && ! EQ (eol_type, Qunix)
       && ! EQ (eol_type, Qdos)
       && ! EQ (eol_type, Qmac))
     error ("Invalid eol-type");
 
-  aliases = list1 (name);
+  Lisp_Object aliases = list1 (name);
 
   if (NILP (eol_type))
     {
       eol_type = make_subsidiaries (name);
-      for (i = 0; i < 3; i++)
+      for (int i = 0; i < 3; i++)
        {
          Lisp_Object this_spec, this_name, this_aliases, this_eol_type;
 
@@ -10575,7 +10526,7 @@ usage: (define-coding-system-internal ...)  */)
        }
     }
 
-  spec_vec = make_uninit_vector (3);
+  Lisp_Object spec_vec = make_uninit_vector (3);
   ASET (spec_vec, 0, attrs);
   ASET (spec_vec, 1, aliases);
   ASET (spec_vec, 2, eol_type);
@@ -10587,12 +10538,9 @@ usage: (define-coding-system-internal ...)  */)
     Vcoding_system_alist = Fcons (Fcons (Fsymbol_name (name), Qnil),
                                  Vcoding_system_alist);
 
-  {
-    int id = coding_categories[category].id;
-
-    if (id < 0 || EQ (name, CODING_ID_NAME (id)))
+  int id = coding_categories[category].id;
+  if (id < 0 || EQ (name, CODING_ID_NAME (id)))
       setup_coding_system (name, &coding_categories[category]);
-  }
 
   return Qnil;
 
@@ -10769,8 +10717,6 @@ coding system whose eol-type is N.  */)
   return make_fixnum (n);
 }
 
-#endif /* emacs */
-
 
 /*** 9. Post-amble ***/
 
@@ -10785,6 +10731,9 @@ init_coding_once (void)
       coding_priorities[i] = i;
     }
 
+  PDUMPER_REMEMBER_SCALAR (coding_categories);
+  PDUMPER_REMEMBER_SCALAR (coding_priorities);
+
   /* ISO2022 specific initialize routine.  */
   for (i = 0; i < 0x20; i++)
     iso_code_class[i] = ISO_control_0;
@@ -10804,6 +10753,8 @@ init_coding_once (void)
   iso_code_class[ISO_CODE_SS3] = ISO_single_shift_3;
   iso_code_class[ISO_CODE_CSI] = ISO_control_sequence_introducer;
 
+  PDUMPER_REMEMBER_SCALAR (iso_code_class);
+
   for (i = 0; i < 256; i++)
     {
       emacs_mule_bytes[i] = 1;
@@ -10812,9 +10763,11 @@ init_coding_once (void)
   emacs_mule_bytes[EMACS_MULE_LEADING_CODE_PRIVATE_12] = 3;
   emacs_mule_bytes[EMACS_MULE_LEADING_CODE_PRIVATE_21] = 4;
   emacs_mule_bytes[EMACS_MULE_LEADING_CODE_PRIVATE_22] = 4;
+
+  PDUMPER_REMEMBER_SCALAR (emacs_mule_bytes);
 }
 
-#ifdef emacs
+static void reset_coding_after_pdumper_load (void);
 
 void
 syms_of_coding (void)
@@ -10835,6 +10788,7 @@ syms_of_coding (void)
   Vcode_conversion_workbuf_name = build_pure_c_string (" 
*code-conversion-work*");
 
   reused_workbuf_in_use = 0;
+  PDUMPER_REMEMBER_SCALAR (reused_workbuf_in_use);
 
   DEFSYM (Qcharset, "charset");
   DEFSYM (Qtarget_idx, "target-idx");
@@ -10870,6 +10824,7 @@ syms_of_coding (void)
   DEFSYM (Qundecided, "undecided");
   DEFSYM (Qno_conversion, "no-conversion");
   DEFSYM (Qraw_text, "raw-text");
+  DEFSYM (Qus_ascii, "us-ascii");
 
   DEFSYM (Qiso_2022, "iso-2022");
 
@@ -10894,7 +10849,7 @@ syms_of_coding (void)
   /* Error signaled when there's a problem with detecting a coding system.  */
   DEFSYM (Qcoding_system_error, "coding-system-error");
   Fput (Qcoding_system_error, Qerror_conditions,
-       listn (CONSTYPE_PURE, 2, Qcoding_system_error, Qerror));
+       pure_list (Qcoding_system_error, Qerror));
   Fput (Qcoding_system_error, Qerror_message,
        build_pure_c_string ("Invalid coding system"));
 
@@ -10915,8 +10870,7 @@ syms_of_coding (void)
   DEFSYM (QCpre_write_conversion, ":pre-write-conversion");
   DEFSYM (QCascii_compatible_p, ":ascii-compatible-p");
 
-  Vcoding_category_table
-    = Fmake_vector (make_fixnum (coding_category_max), Qnil);
+  Vcoding_category_table = make_nil_vector (coding_category_max);
   staticpro (&Vcoding_category_table);
   /* Followings are target of code detection.  */
   ASET (Vcoding_category_table, coding_category_iso_7,
@@ -11220,7 +11174,7 @@ a coding system of ISO 2022 variant which has a flag
 `accept-latin-extra-code' t (e.g. iso-latin-1) on reading a file
 or reading output of a subprocess.
 Only 128th through 159th elements have a meaning.  */);
-  Vlatin_extra_code_table = Fmake_vector (make_fixnum (256), Qnil);
+  Vlatin_extra_code_table = make_nil_vector (256);
 
   DEFVAR_LISP ("select-safe-coding-system-function",
               Vselect_safe_coding_system_function,
@@ -11273,18 +11227,18 @@ to explicitly specify some coding system that doesn't 
use ISO-2022
 escape sequence (e.g., `latin-1') on reading by 
\\[universal-coding-system-argument].  */);
   inhibit_iso_escape_detection = 0;
 
-  DEFVAR_BOOL ("inhibit-null-byte-detection",
-              inhibit_null_byte_detection,
-              doc: /* If non-nil, Emacs ignores null bytes on code detection.
+  DEFVAR_BOOL ("inhibit-nul-byte-detection",
+              inhibit_nul_byte_detection,
+              doc: /* If non-nil, Emacs ignores NUL bytes on code detection.
 By default, Emacs treats it as binary data, and does not attempt to
 decode it.  The effect is as if you specified `no-conversion' for
 reading that text.
 
-Set this to non-nil when a regular text happens to include null bytes.
-Examples are Index nodes of Info files and null-byte delimited output
-from GNU Find and GNU Grep.  Emacs will then ignore the null bytes and
+Set this to non-nil when a regular text happens to include NUL bytes.
+Examples are Index nodes of Info files and NUL-byte delimited output
+from GNU Find and GNU Grep.  Emacs will then ignore the NUL bytes and
 decode text as usual.  */);
-  inhibit_null_byte_detection = 0;
+  inhibit_nul_byte_detection = 0;
 
   DEFVAR_BOOL ("disable-ascii-optimization", disable_ascii_optimization,
               doc: /* If non-nil, Emacs does not optimize code decoder for 
ASCII files.
@@ -11337,13 +11291,13 @@ internal character representation.  */);
   /* This is already set.
      plist[7] = args[coding_arg_ascii_compatible_p] = Qt; */
   plist[8] = intern_c_string (":charset-list");
-  plist[9] = args[coding_arg_charset_list] = Fcons (Qascii, Qnil);
+  plist[9] = args[coding_arg_charset_list] = list1 (Qascii);
   plist[11] = args[coding_arg_for_unibyte] = Qnil;
   plist[13] = build_pure_c_string ("No conversion on encoding, "
                                   "automatic conversion on decoding.");
   plist[15] = args[coding_arg_eol_type] = Qnil;
   args[coding_arg_plist] = CALLMANY (Flist, plist);
-  args[coding_arg_undecided_inhibit_null_byte_detection] = make_fixnum (0);
+  args[coding_arg_undecided_inhibit_nul_byte_detection] = make_fixnum (0);
   args[coding_arg_undecided_inhibit_iso_escape_detection] = make_fixnum (0);
   Fdefine_coding_system_internal (coding_arg_undecided_max, args);
 
@@ -11358,5 +11312,32 @@ internal character representation.  */);
   system_eol_type = Qunix;
 #endif
   staticpro (&system_eol_type);
+
+  pdumper_do_now_and_after_load (reset_coding_after_pdumper_load);
+}
+
+static void
+reset_coding_after_pdumper_load (void)
+{
+  if (!dumped_with_pdumper_p ())
+    return;
+  for (struct coding_system *this = &coding_categories[0];
+       this < &coding_categories[coding_category_max];
+       ++this)
+    {
+      int id = this->id;
+      if (id >= 0)
+        {
+          /* Need to rebuild the coding system object because we
+             persisted it as a scalar and it's full of gunk that's now
+             invalid.  */
+          memset (this, 0, sizeof (*this));
+          setup_coding_system (CODING_ID_NAME (id), this);
+        }
+    }
+  /* In temacs the below is done by mule-conf.el, because we need to
+     define us-ascii first.  But in dumped Emacs us-ascii is restored
+     by the above loop, and mule-conf.el will not be loaded, so we set
+     it up now; otherwise safe_terminal_coding will remain zeroed.  */
+  Fset_safe_terminal_coding_system_internal (Qus_ascii);
 }
-#endif /* emacs */
diff --git a/src/coding.h b/src/coding.h
index d2cf4d8..0c03d1a 100644
--- a/src/coding.h
+++ b/src/coding.h
@@ -1,5 +1,5 @@
 /* Header for coding system handler.
-   Copyright (C) 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2019 Free Software Foundation, Inc.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
      2005, 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
@@ -82,7 +82,7 @@ enum define_coding_ccl_arg_index
 
 enum define_coding_undecided_arg_index
   {
-    coding_arg_undecided_inhibit_null_byte_detection = coding_arg_max,
+    coding_arg_undecided_inhibit_nul_byte_detection = coding_arg_max,
     coding_arg_undecided_inhibit_iso_escape_detection,
     coding_arg_undecided_prefer_utf_8,
     coding_arg_undecided_max
@@ -97,6 +97,8 @@ enum define_coding_undecided_arg_index
 
 extern Lisp_Object Vcoding_system_hash_table;
 
+/* Name (or base name) of work buffer for code conversion.  */
+extern Lisp_Object Vcode_conversion_workbuf_name;
 
 /* Enumeration of index to an attribute vector of a coding system.  */
 
@@ -137,7 +139,7 @@ enum coding_attr_index
 
     coding_attr_emacs_mule_full,
 
-    coding_attr_undecided_inhibit_null_byte_detection,
+    coding_attr_undecided_inhibit_nul_byte_detection,
     coding_attr_undecided_inhibit_iso_escape_detection,
     coding_attr_undecided_prefer_utf_8,
 
@@ -351,7 +353,7 @@ struct emacs_mule_spec
 
 struct undecided_spec
 {
-  /* Inhibit null byte detection.  1 means always inhibit,
+  /* Inhibit NUL byte detection.  1 means always inhibit,
      -1 means do not inhibit, 0 means rely on user variable.  */
   int inhibit_nbd;
 
@@ -450,7 +452,7 @@ struct coding_system
 
   unsigned char *safe_charsets;
 
-  /* How may heading bytes we can skip for decoding.  This is set to
+  /* How many heading bytes we can skip for decoding.  This is set to
      -1 in setup_coding_system, and updated by detect_coding.  So,
      when this is equal to the byte length of the text being
      converted, we can skip the actual conversion process except for
@@ -762,15 +764,10 @@ surrogates_to_codepoint (int low, int high)
 
 extern Lisp_Object preferred_coding_system (void);
 
-
-#ifdef emacs
-
 /* Coding system to be used to encode text for terminal display when
    terminal coding system is nil.  */
 extern struct coding_system safe_terminal_coding;
 
-#endif
-
 extern char emacs_mule_bytes[256];
 
 INLINE_HEADER_END
diff --git a/src/commands.h b/src/commands.h
index a741da1..1ea6ab6 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -1,5 +1,5 @@
 /* Definitions needed by most editing commands.
-   Copyright (C) 1985, 1994, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1994, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/composite.c b/src/composite.c
index 39c54fc..c426cbb 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -1,5 +1,5 @@
 /* Composite sequence support.
-   Copyright (C) 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2019 Free Software Foundation, Inc.
    Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 
2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H14PRO021
@@ -216,7 +216,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, 
ptrdiff_t nchars,
      COMPONENTS (converted to a vector COMPONENTS-VEC) or, if it is
      nil, vector of characters in the composition range.  */
   if (FIXNUMP (components))
-    key = Fmake_vector (make_fixnum (1), components);
+    key = make_vector (1, components);
   else if (STRINGP (components) || CONSP (components))
     key = Fvconcat (1, &components);
   else if (VECTORP (components))
@@ -654,27 +654,23 @@ Lisp_Object
 composition_gstring_put_cache (Lisp_Object gstring, ptrdiff_t len)
 {
   struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table);
-  EMACS_UINT hash;
-  Lisp_Object header, copy;
-  ptrdiff_t i;
-
-  header = LGSTRING_HEADER (gstring);
-  hash = h->test.hashfn (&h->test, header);
+  hash_rehash_if_needed (h);
+  Lisp_Object header = LGSTRING_HEADER (gstring);
+  EMACS_UINT hash = h->test.hashfn (&h->test, header);
   if (len < 0)
     {
-      ptrdiff_t j, glyph_len = LGSTRING_GLYPH_LEN (gstring);
-      for (j = 0; j < glyph_len; j++)
-       if (NILP (LGSTRING_GLYPH (gstring, j)))
+      ptrdiff_t glyph_len = LGSTRING_GLYPH_LEN (gstring);
+      for (len = 0; len < glyph_len; len++)
+       if (NILP (LGSTRING_GLYPH (gstring, len)))
          break;
-      len = j;
     }
 
-  copy = Fmake_vector (make_fixnum (len + 2), Qnil);
+  Lisp_Object copy = make_nil_vector (len + 2);
   LGSTRING_SET_HEADER (copy, Fcopy_sequence (header));
-  for (i = 0; i < len; i++)
+  for (ptrdiff_t i = 0; i < len; i++)
     LGSTRING_SET_GLYPH (copy, i, Fcopy_sequence (LGSTRING_GLYPH (gstring, i)));
-  i = hash_put (h, LGSTRING_HEADER (copy), copy, hash);
-  LGSTRING_SET_ID (copy, make_fixnum (i));
+  ptrdiff_t id = hash_put (h, LGSTRING_HEADER (copy), copy, hash);
+  LGSTRING_SET_ID (copy, make_fixnum (id));
   return copy;
 }
 
@@ -1759,7 +1755,7 @@ should be ignored.  */)
     return gstring;
 
   if (LGSTRING_GLYPH_LEN (gstring_work) < topos - frompos)
-    gstring_work = Fmake_vector (make_fixnum (topos - frompos + 2), Qnil);
+    gstring_work = make_nil_vector (topos - frompos + 2);
   LGSTRING_SET_HEADER (gstring_work, header);
   LGSTRING_SET_ID (gstring_work, Qnil);
   fill_gstring_body (gstring_work);
@@ -1917,9 +1913,9 @@ syms_of_composite (void)
   staticpro (&gstring_work_headers);
   gstring_work_headers = make_uninit_vector (8);
   for (i = 0; i < 8; i++)
-    ASET (gstring_work_headers, i, Fmake_vector (make_fixnum (i + 2), Qnil));
+    ASET (gstring_work_headers, i, make_nil_vector (i + 2));
   staticpro (&gstring_work);
-  gstring_work = Fmake_vector (make_fixnum (10), Qnil);
+  gstring_work = make_nil_vector (10);
 
   /* Text property `composition' should be nonsticky by default.  */
   Vtext_property_default_nonsticky
diff --git a/src/composite.h b/src/composite.h
index 8039113..8675163 100644
--- a/src/composite.h
+++ b/src/composite.h
@@ -1,5 +1,5 @@
 /* Header for composite sequence handler.
-   Copyright (C) 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2019 Free Software Foundation, Inc.
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 
2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H14PRO021
@@ -274,7 +274,7 @@ enum lglyph_indices
     LGLYPH_SIZE
   };
 
-#define LGLYPH_NEW() Fmake_vector (make_fixnum (LGLYPH_SIZE), Qnil)
+#define LGLYPH_NEW() make_nil_vector (LGLYPH_SIZE)
 #define LGLYPH_FROM(g) XFIXNUM (AREF ((g), LGLYPH_IX_FROM))
 #define LGLYPH_TO(g) XFIXNUM (AREF ((g), LGLYPH_IX_TO))
 #define LGLYPH_CHAR(g) XFIXNUM (AREF ((g), LGLYPH_IX_CHAR))
diff --git a/src/conf_post.h b/src/conf_post.h
index 2f8b264..f8254cf 100644
--- a/src/conf_post.h
+++ b/src/conf_post.h
@@ -1,6 +1,6 @@
 /* conf_post.h --- configure.ac includes this via AH_BOTTOM
 
-Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2018 Free Software
+Copyright (C) 1988, 1993-1994, 1999-2002, 2004-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -92,13 +92,11 @@ typedef bool bool_bf;
 # define ADDRESS_SANITIZER false
 #endif
 
-#ifdef DARWIN_OS
-#if defined emacs && !defined CANNOT_DUMP
-#define malloc unexec_malloc
-#define realloc unexec_realloc
-#define free unexec_free
+#if defined DARWIN_OS && defined emacs && defined HAVE_UNEXEC
+# define malloc unexec_malloc
+# define realloc unexec_realloc
+# define free unexec_free
 #endif
-#endif  /* DARWIN_OS */
 
 /* If HYBRID_MALLOC is defined (e.g., on Cygwin), emacs will use
    gmalloc before dumping and the system malloc after dumping.
@@ -299,8 +297,10 @@ extern int emacs_setenv_TZ (char const *);
 
 #if 3 <= __GNUC__
 # define ATTRIBUTE_MALLOC __attribute__ ((__malloc__))
+# define ATTRIBUTE_SECTION(name) __attribute__((section (name)))
 #else
 # define ATTRIBUTE_MALLOC
+#define ATTRIBUTE_SECTION(name)
 #endif
 
 #if __has_attribute (alloc_size)
diff --git a/src/cygw32.c b/src/cygw32.c
index 78bb16c..fb2fa03 100644
--- a/src/cygw32.c
+++ b/src/cygw32.c
@@ -1,5 +1,5 @@
 /* Cygwin support routines.
-   Copyright (C) 2011-2018 Free Software Foundation, Inc.
+   Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/cygw32.h b/src/cygw32.h
index ec6b264..33ddf88 100644
--- a/src/cygw32.h
+++ b/src/cygw32.h
@@ -1,5 +1,5 @@
 /* Header for Cygwin support routines.
-   Copyright (C) 2011-2018 Free Software Foundation, Inc.
+   Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/data.c b/src/data.c
index b437048..2ae5063 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1,5 +1,5 @@
 /* Primitive operations on Lisp data types for GNU Emacs Lisp interpreter.
-   Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2018 Free Software
+   Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -268,11 +268,13 @@ for example, (type-of 1) returns `integer'.  */)
           }
         case PVEC_MODULE_FUNCTION:
           return Qmodule_function;
+        case PVEC_XWIDGET:
+          return Qxwidget;
+        case PVEC_XWIDGET_VIEW:
+          return Qxwidget_view;
         /* "Impossible" cases.  */
        case PVEC_MISC_PTR:
-        case PVEC_XWIDGET:
         case PVEC_OTHER:
-        case PVEC_XWIDGET_VIEW:
         case PVEC_SUB_CHAR_TABLE:
         case PVEC_FREE: ;
         }
@@ -824,7 +826,9 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
   register Lisp_Object function;
   CHECK_SYMBOL (symbol);
   /* Perhaps not quite the right error signal, but seems good enough.  */
-  if (NILP (symbol))
+  if (NILP (symbol) && !NILP (definition))
+    /* There are so many other ways to shoot oneself in the foot, I don't
+       think this one little sanity check is worth its cost, but anyway.  */
     xsignal1 (Qsetting_constant, symbol);
 
   function = XSYMBOL (symbol)->u.s.function;
@@ -866,7 +870,7 @@ The return value is undefined.  */)
 
   {
     bool autoload = AUTOLOADP (definition);
-    if (NILP (Vpurify_flag) || !autoload)
+    if (!will_dump_p () || !autoload)
       { /* Only add autoload entries after dumping, because the ones before are
           not useful and else we get loads of them from the loaddefs.el.  */
 
@@ -1042,14 +1046,12 @@ chain of aliases, signal a 
`cyclic-variable-indirection' error.  */)
    swap_in_symval_forwarding for that.  */
 
 Lisp_Object
-do_symval_forwarding (register union Lisp_Fwd *valcontents)
+do_symval_forwarding (union Lisp_Fwd *valcontents)
 {
-  register Lisp_Object val;
   switch (XFWDTYPE (valcontents))
     {
     case Lisp_Fwd_Int:
-      XSETINT (val, *XFIXNUMFWD (valcontents)->intvar);
-      return val;
+      return make_int (*XFIXNUMFWD (valcontents)->intvar);
 
     case Lisp_Fwd_Bool:
       return (*XBOOLFWD (valcontents)->boolvar ? Qt : Qnil);
@@ -1085,7 +1087,7 @@ do_symval_forwarding (register union Lisp_Fwd 
*valcontents)
 void
 wrong_choice (Lisp_Object choice, Lisp_Object wrong)
 {
-  ptrdiff_t i = 0, len = XFIXNUM (Flength (choice));
+  ptrdiff_t i = 0, len = list_length (choice);
   Lisp_Object obj, *args;
   AUTO_STRING (one_of, "One of ");
   AUTO_STRING (comma, ", ");
@@ -1140,8 +1142,13 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, 
register Lisp_Object newva
   switch (XFWDTYPE (valcontents))
     {
     case Lisp_Fwd_Int:
-      CHECK_FIXNUM (newval);
-      *XFIXNUMFWD (valcontents)->intvar = XFIXNUM (newval);
+      {
+       intmax_t i;
+       CHECK_INTEGER (newval);
+       if (! integer_to_intmax (newval, &i))
+         xsignal1 (Qoverflow_error, newval);
+       *XFIXNUMFWD (valcontents)->intvar = i;
+      }
       break;
 
     case Lisp_Fwd_Bool:
@@ -1890,7 +1897,7 @@ The function `default-value' gets the default value and 
`set-default' sets it.
 {
   struct Lisp_Symbol *sym;
   struct Lisp_Buffer_Local_Value *blv = NULL;
-  union Lisp_Val_Fwd valcontents;
+  union Lisp_Val_Fwd valcontents UNINIT;
   bool forwarded UNINIT;
 
   CHECK_SYMBOL (variable);
@@ -1957,7 +1964,7 @@ Instead, use `add-hook' and specify t for the LOCAL 
argument.  */)
 {
   Lisp_Object tem;
   bool forwarded UNINIT;
-  union Lisp_Val_Fwd valcontents;
+  union Lisp_Val_Fwd valcontents UNINIT;
   struct Lisp_Symbol *sym;
   struct Lisp_Buffer_Local_Value *blv = NULL;
 
@@ -2022,6 +2029,16 @@ Instead, use `add-hook' and specify t for the LOCAL 
argument.  */)
        (current_buffer,
         Fcons (Fcons (variable, XCDR (blv->defcell)),
                BVAR (current_buffer, local_var_alist)));
+
+      /* If the symbol forwards into a C variable, then load the binding
+         for this buffer now, to preserve the invariant that forwarded
+         variables must always hold the value corresponding to the
+         current buffer (they are swapped eagerly).
+         Otherwise, if C code modifies the variable before we load the
+         binding in, then that new value would clobber the default binding
+         the next time we unload it.  See bug#34318.  */
+      if (blv->fwd)
+        swap_in_symval_forwarding (sym, blv);
     }
 
   return variable;
@@ -2476,14 +2493,14 @@ emacs_mpz_mul (mpz_t rop, mpz_t const op1, mpz_t const 
op2)
 }
 
 static void
-emacs_mpz_mul_2exp (mpz_t rop, mpz_t const op1, mp_bitcnt_t op2)
+emacs_mpz_mul_2exp (mpz_t rop, mpz_t const op1, EMACS_INT op2)
 {
   /* Fudge factor derived from GMP 6.1.2, to avoid an abort in
      mpz_mul_2exp (look for the '+ 1' in its source code).  */
   enum { mul_2exp_extra_limbs = 1 };
   enum { lim = min (NLIMBS_LIMIT, GMP_NLIMBS_MAX - mul_2exp_extra_limbs) };
 
-  mp_bitcnt_t op2limbs = op2 / GMP_NUMB_BITS;
+  EMACS_INT op2limbs = op2 / GMP_NUMB_BITS;
   if (lim - emacs_mpz_size (op1) < op2limbs)
     overflow_error ();
   mpz_mul_2exp (rop, op1, op2);
@@ -2717,7 +2734,7 @@ cons_to_unsigned (Lisp_Object c, uintmax_t max)
   else
     {
       Lisp_Object hi = CONSP (c) ? XCAR (c) : c;
-      valid = integer_to_uintmax (hi, &val);
+      valid = INTEGERP (hi) && integer_to_uintmax (hi, &val);
 
       if (valid && CONSP (c))
        {
@@ -2778,7 +2795,7 @@ cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max)
   else
     {
       Lisp_Object hi = CONSP (c) ? XCAR (c) : c;
-      valid = integer_to_intmax (hi, &val);
+      valid = INTEGERP (hi) && integer_to_intmax (hi, &val);
 
       if (valid && CONSP (c))
        {
@@ -3022,7 +3039,7 @@ arith_driver (enum arithop code, ptrdiff_t nargs, 
Lisp_Object *args,
        /* Set ACCUM to the next operation's result if it fits,
           else exit the loop.  */
        bool overflow = false;
-       intmax_t a;
+       intmax_t a UNINIT;
        switch (code)
          {
          case Aadd : overflow = INT_ADD_WRAPV (accum, next, &a); break;
@@ -3313,12 +3330,21 @@ If COUNT is negative, shifting is actually to the right.
 In this case, the sign bit is duplicated.  */)
   (Lisp_Object value, Lisp_Object count)
 {
-  /* The negative of the minimum value of COUNT that fits into a fixnum,
-     such that mpz_fdiv_q_exp supports -COUNT.  */
-  EMACS_INT minus_count_min = min (-MOST_NEGATIVE_FIXNUM,
-                                  TYPE_MAXIMUM (mp_bitcnt_t));
   CHECK_INTEGER (value);
-  CHECK_RANGED_INTEGER (count, - minus_count_min, TYPE_MAXIMUM (mp_bitcnt_t));
+  CHECK_INTEGER (count);
+
+  if (! FIXNUMP (count))
+    {
+      if (EQ (value, make_fixnum (0)))
+       return value;
+      if (mpz_sgn (XBIGNUM (count)->value) < 0)
+       {
+         EMACS_INT v = (FIXNUMP (value) ? XFIXNUM (value)
+                        : mpz_sgn (XBIGNUM (value)->value));
+         return make_fixnum (v < 0 ? -1 : 0);
+       }
+      overflow_error ();
+    }
 
   if (XFIXNUM (count) <= 0)
     {
@@ -3337,7 +3363,11 @@ In this case, the sign bit is duplicated.  */)
 
   mpz_t *zval = bignum_integer (&mpz[0], value);
   if (XFIXNUM (count) < 0)
-    mpz_fdiv_q_2exp (mpz[0], *zval, - XFIXNUM (count));
+    {
+      if (TYPE_MAXIMUM (mp_bitcnt_t) < - XFIXNUM (count))
+       return make_fixnum (mpz_sgn (*zval) < 0 ? -1 : 0);
+      mpz_fdiv_q_2exp (mpz[0], *zval, - XFIXNUM (count));
+    }
   else
     emacs_mpz_mul_2exp (mpz[0], *zval, XFIXNUM (count));
   return make_integer_mpz ();
@@ -3998,8 +4028,8 @@ syms_of_data (void)
   DEFSYM (Qsymbol_with_pos, "symbol-with-pos");
   DEFSYM (Qoverlay, "overlay");
   DEFSYM (Qfinalizer, "finalizer");
-#ifdef HAVE_MODULES
   DEFSYM (Qmodule_function, "module-function");
+#ifdef HAVE_MODULES
   DEFSYM (Quser_ptr, "user-ptr");
 #endif
   DEFSYM (Qfloat, "float");
@@ -4022,6 +4052,8 @@ syms_of_data (void)
   DEFSYM (Qfont_entity, "font-entity");
   DEFSYM (Qfont_object, "font-object");
   DEFSYM (Qterminal, "terminal");
+  DEFSYM (Qxwidget, "xwidget");
+  DEFSYM (Qxwidget_view, "xwidget-view");
 
   DEFSYM (Qdefun, "defun");
 
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 9bc344e..0afae6b 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -1,5 +1,5 @@
 /* Elisp bindings for D-Bus.
-   Copyright (C) 2007-2018 Free Software Foundation, Inc.
+   Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -1423,7 +1423,7 @@ usage: (dbus-message-internal &rest REST)  */)
   for (; count < nargs; ++count)
     {
       dtype = XD_OBJECT_TO_DBUS_TYPE (args[count]);
-      if (XD_DBUS_TYPE_P (args[count]))
+      if (count + 1 < nargs && XD_DBUS_TYPE_P (args[count]))
        {
          XD_DEBUG_VALID_LISP_OBJECT_P (args[count]);
          XD_DEBUG_VALID_LISP_OBJECT_P (args[count+1]);
@@ -1831,6 +1831,8 @@ be called when the D-Bus reply message arrives.  */);
   xd_registered_buses = Qnil;
   staticpro (&xd_registered_buses);
 
+  // TODO: reset buses on dump load
+
   Fprovide (intern_c_string ("dbusbind"), Qnil);
 
 }
diff --git a/src/decompress.c b/src/decompress.c
index 2836338..e66e479 100644
--- a/src/decompress.c
+++ b/src/decompress.c
@@ -1,5 +1,5 @@
 /* Interface to zlib.
-   Copyright (C) 2013-2018 Free Software Foundation, Inc.
+   Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/deps.mk b/src/deps.mk
index f202d0e..2cdeba8 100644
--- a/src/deps.mk
+++ b/src/deps.mk
@@ -1,6 +1,6 @@
 ### deps.mk --- src/Makefile fragment for GNU Emacs
 
-## Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2018 Free Software
+## Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2019 Free Software
 ## Foundation, Inc.
 
 ## This file is part of GNU Emacs.
diff --git a/src/dired.c b/src/dired.c
index 7ad401c..4937582 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -1,5 +1,5 @@
 /* Lisp functions for making directory listings.
-   Copyright (C) 1985-1986, 1993-1994, 1999-2018 Free Software
+   Copyright (C) 1985-1986, 1993-1994, 1999-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -236,6 +236,9 @@ directory_files_internal (Lisp_Object directory, 
Lisp_Object full,
 #endif
     ;
 
+  if (!NILP (match))
+    CHECK_STRING (match);
+
   /* Loop reading directory entries.  */
   for (struct dirent *dp; (dp = read_dirent (d, directory)); )
     {
@@ -333,7 +336,7 @@ If NOSORT is non-nil, the list is not sorted--its order is 
unpredictable.
   directory = Fexpand_file_name (directory, Qnil);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (directory, Qdirectory_files);
   if (!NILP (handler))
     return call5 (handler, Qdirectory_files, directory,
@@ -368,7 +371,7 @@ which see.  */)
   directory = Fexpand_file_name (directory, Qnil);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (directory, 
Qdirectory_files_and_attributes);
   if (!NILP (handler))
     return call6 (handler, Qdirectory_files_and_attributes,
@@ -403,13 +406,13 @@ is matched against file and directory names relative to 
DIRECTORY.  */)
   directory = Fexpand_file_name (directory, Qnil);
 
   /* If the directory name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (directory, Qfile_name_completion);
   if (!NILP (handler))
     return call4 (handler, Qfile_name_completion, file, directory, predicate);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (file, Qfile_name_completion);
   if (!NILP (handler))
     return call4 (handler, Qfile_name_completion, file, directory, predicate);
@@ -431,13 +434,13 @@ is matched against file and directory names relative to 
DIRECTORY.  */)
   directory = Fexpand_file_name (directory, Qnil);
 
   /* If the directory name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (directory, Qfile_name_all_completions);
   if (!NILP (handler))
     return call3 (handler, Qfile_name_all_completions, file, directory);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (file, Qfile_name_all_completions);
   if (!NILP (handler))
     return call3 (handler, Qfile_name_all_completions, file, directory);
@@ -901,11 +904,12 @@ so last access time will always be midnight of that day.  
*/)
     return Qnil;
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (filename, Qfile_attributes);
   if (!NILP (handler))
-    { /* Only pass the extra arg if it is used to help backward compatibility
-        with old file handlers which do not implement the new arg.  --Stef  */
+    { /* Only pass the extra arg if it is used to help backward
+        compatibility with old file name handlers which do not
+        implement the new arg.  --Stef */
       if (NILP (id_format))
        return call2 (handler, Qfile_attributes, filename);
       else
@@ -926,7 +930,7 @@ file_attributes (int fd, char const *name,
   struct stat s;
 
   /* An array to hold the mode string generated by filemodestring,
-     including its terminating space and null byte.  */
+     including its terminating space and NUL byte.  */
   char modes[sizeof "-rwxr-xr-x "];
 
   char *uname = NULL, *gname = NULL;
diff --git a/src/dispextern.h b/src/dispextern.h
index 579665c..1a53656 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1,6 +1,6 @@
 /* Interface definitions for display code.
 
-Copyright (C) 1985, 1993-1994, 1997-2018 Free Software Foundation, Inc.
+Copyright (C) 1985, 1993-1994, 1997-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -31,6 +31,9 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <X11/Intrinsic.h>
 #endif /* USE_X_TOOLKIT */
 
+#ifdef HAVE_XRENDER
+# include <X11/extensions/Xrender.h>
+#endif
 #else /* !HAVE_X_WINDOWS */
 
 /* X-related stuff used by non-X gui code.  */
@@ -74,10 +77,13 @@ typedef HDC XImagePtr_or_DC;
 
 #ifdef HAVE_NS
 #include "nsgui.h"
+#define FACE_COLOR_TO_PIXEL(face_color, frame) 
ns_color_index_to_rgba(face_color, frame)
 /* Following typedef needed to accommodate the MSDOS port, believe it or not.  
*/
 typedef struct ns_display_info Display_Info;
 typedef Pixmap XImagePtr;
 typedef XImagePtr XImagePtr_or_DC;
+#else
+#define FACE_COLOR_TO_PIXEL(face_color, frame) face_color
 #endif
 
 #ifdef HAVE_WINDOW_SYSTEM
@@ -1931,7 +1937,7 @@ struct bidi_string_data {
   Lisp_Object lstring;         /* Lisp string to reorder, or nil */
   const unsigned char *s;      /* string data, or NULL if reordering buffer */
   ptrdiff_t schars;            /* the number of characters in the string,
-                                  excluding the terminating null */
+                                  excluding the terminating NUL */
   ptrdiff_t bufpos;            /* buffer position of lstring, or 0 if N/A */
   bool_bf from_disp_str : 1;   /* True means the string comes from a
                                   display property */
@@ -2932,33 +2938,9 @@ struct redisplay_interface
 
 #ifdef HAVE_WINDOW_SYSTEM
 
-/* Each image format (JPEG, TIFF, ...) supported is described by
-   a structure of the type below.  */
-
-struct image_type
-{
-  /* Index of a symbol uniquely identifying the image type, e.g., 'jpeg'.  */
-  int type;
-
-  /* Check that SPEC is a valid image specification for the given
-     image type.  Value is true if SPEC is valid.  */
-  bool (* valid_p) (Lisp_Object spec);
-
-  /* Load IMG which is used on frame F from information contained in
-     IMG->spec.  Value is true if successful.  */
-  bool (* load) (struct frame *f, struct image *img);
-
-  /* Free resources of image IMG which is used on frame F.  */
-  void (* free) (struct frame *f, struct image *img);
-
-  /* Initialization function (used for dynamic loading of image
-     libraries on Windows), or NULL if none.  */
-  bool (* init) (void);
-
-  /* Next in list of all supported image types.  */
-  struct image_type *next;
-};
-
+# if defined USE_CAIRO || defined HAVE_XRENDER || defined HAVE_NS || defined 
HAVE_NTGUI
+#  define HAVE_NATIVE_SCALING
+# endif
 
 /* Structure describing an image.  Specific image formats like XBM are
    converted into this form, so that display only has to deal with
@@ -2975,7 +2957,6 @@ struct image
 
 #ifdef USE_CAIRO
   void *cr_data;
-  void *cr_data2;
 #endif
 #ifdef HAVE_X_WINDOWS
   /* X images of the image, corresponding to the above Pixmaps.
@@ -2983,6 +2964,11 @@ struct image
      and the latter is outdated.  NULL means the X image has been
      synchronized to Pixmap.  */
   XImagePtr ximg, mask_img;
+
+# ifdef HAVE_NATIVE_SCALING
+  /* Picture versions of pixmap and mask for compositing.  */
+  Picture picture, mask_picture;
+# endif
 #endif
 
   /* Colors allocated for this image, if any.  Allocated via xmalloc.  */
diff --git a/src/dispnew.c b/src/dispnew.c
index 8742d58..ccb08ec 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -1,6 +1,6 @@
 /* Updating of data structures for redisplay.
 
-Copyright (C) 1985-1988, 1993-1995, 1997-2018 Free Software Foundation,
+Copyright (C) 1985-1988, 1993-1995, 1997-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -42,6 +42,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "systime.h"
 #include "tparam.h"
 #include "xwidget.h"
+#include "pdumper.h"
 
 #ifdef HAVE_WINDOW_SYSTEM
 #include TERM_HEADER
@@ -766,7 +767,7 @@ clear_current_matrices (register struct frame *f)
     clear_glyph_matrix (XWINDOW (f->menu_bar_window)->current_matrix);
 #endif
 
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
   /* Clear the matrix of the tool-bar window, if any.  */
   if (WINDOWP (f->tool_bar_window))
     clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix);
@@ -791,7 +792,7 @@ clear_desired_matrices (register struct frame *f)
     clear_glyph_matrix (XWINDOW (f->menu_bar_window)->desired_matrix);
 #endif
 
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
   if (WINDOWP (f->tool_bar_window))
     clear_glyph_matrix (XWINDOW (f->tool_bar_window)->desired_matrix);
 #endif
@@ -2105,7 +2106,7 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
   }
 #endif
 
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
   {
     /* Allocate/ reallocate matrices of the tool bar window.  If we
        don't have a tool bar window yet, make one.  */
@@ -2187,7 +2188,7 @@ free_glyphs (struct frame *f)
        }
 #endif
 
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
       /* Free the tool bar window and its glyph matrices.  */
       if (!NILP (f->tool_bar_window))
        {
@@ -3081,7 +3082,7 @@ update_frame (struct frame *f, bool force_p, bool 
inhibit_hairy_id_p)
        update_window (XWINDOW (f->menu_bar_window), true);
 #endif
 
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
       /* Update the tool-bar window, if present.  */
       if (WINDOWP (f->tool_bar_window))
        {
@@ -3388,7 +3389,7 @@ update_window (struct window *w, bool force_p)
 {
   struct glyph_matrix *desired_matrix = w->desired_matrix;
   bool paused_p;
-  int preempt_count = baud_rate / 2400 + 1;
+  int preempt_count = clip_to_bounds (1, baud_rate / 2400 + 1, INT_MAX);
   struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
 #ifdef GLYPH_DEBUG
   /* Check that W's frame doesn't have glyph matrices.  */
@@ -4484,16 +4485,13 @@ update_frame_1 (struct frame *f, bool force_p, bool 
inhibit_id_p,
   struct glyph_matrix *desired_matrix = f->desired_matrix;
   int i;
   bool pause_p;
-  int preempt_count = baud_rate / 2400 + 1;
+  int preempt_count = clip_to_bounds (1, baud_rate / 2400 + 1, INT_MAX);
 
   eassert (current_matrix && desired_matrix);
 
   if (baud_rate != FRAME_COST_BAUD_RATE (f))
     calculate_costs (f);
 
-  if (preempt_count <= 0)
-    preempt_count = 1;
-
   if (!force_p && detect_input_pending_ignore_squeezables ())
     {
       pause_p = 1;
@@ -5099,13 +5097,15 @@ update_frame_line (struct frame *f, int vpos, bool 
updating_menu_p)
  ***********************************************************************/
 
 /* Determine what's under window-relative pixel position (*X, *Y).
-   Return the OBJECT (string or buffer) that's there.
+   Return the object (string or buffer) that's there.
    Return in *POS the position in that object.
    Adjust *X and *Y to character positions.
+   If an image is shown at the specified position, return
+   in *OBJECT its image-spec.
    Return in *DX and *DY the pixel coordinates of the click,
-   relative to the top left corner of OBJECT, or relative to
+   relative to the top left corner of object, or relative to
    the top left corner of the character glyph at (*X, *Y)
-   if OBJECT is nil.
+   if the object at (*X, *Y) is nil.
    Return WIDTH and HEIGHT of the object at (*X, *Y), or zero
    if the coordinates point to an empty area of the display.  */
 
@@ -5938,7 +5938,7 @@ pass nil for VARIABLE.  */)
       || n + 20 < ASIZE (state) / 2)
     /* Add 20 extra so we grow it less often.  */
     {
-      state = Fmake_vector (make_fixnum (n + 20), Qlambda);
+      state = make_vector (n + 20, Qlambda);
       if (! NILP (variable))
        Fset (variable, state);
       else
@@ -5985,12 +5985,24 @@ pass nil for VARIABLE.  */)
                            Initialization
 ***********************************************************************/
 
+static void
+init_faces_initial (void)
+{
+  /* For the initial frame, we don't have any way of knowing what
+     are the foreground and background colors of the terminal.  */
+  struct frame *sf = SELECTED_FRAME ();
+
+  FRAME_FOREGROUND_PIXEL (sf) = FACE_TTY_DEFAULT_FG_COLOR;
+  FRAME_BACKGROUND_PIXEL (sf) = FACE_TTY_DEFAULT_BG_COLOR;
+  call0 (intern ("tty-set-up-initial-frame-faces"));
+}
+
 /* Initialization done when Emacs fork is started, before doing stty.
    Determine terminal type and set terminal_driver.  Then invoke its
    decoding routine to set up variables in the terminal package.  */
 
-void
-init_display (void)
+static void
+init_display_interactive (void)
 {
   char *terminal_type;
 
@@ -6010,9 +6022,7 @@ init_display (void)
      with.  Otherwise newly opened tty frames will not resize
      automatically. */
 #ifdef SIGWINCH
-#ifndef CANNOT_DUMP
-  if (initialized)
-#endif /* CANNOT_DUMP */
+  if (!will_dump_p ())
     {
       struct sigaction action;
       emacs_sigaction_init (&action, deliver_window_change_signal);
@@ -6022,10 +6032,21 @@ init_display (void)
 
   /* If running as a daemon, no need to initialize any frames/terminal,
      except on Windows, where we at least want to initialize it.  */
-#ifndef WINDOWSNT
   if (IS_DAEMON)
+    {
+      /* Pdump'ed Emacs doesn't record the initial frame from temacs,
+        so the non-basic faces realized for that frame in temacs
+        aren't in emacs.  This causes errors when users try to
+        customize those faces in their init file.  The call to
+        init_faces_initial will realize these faces now.  (Non-daemon
+        Emacs does this either near the end of this function or when
+        the GUI frame is created.)  */
+      if (dumped_with_pdumper_p ())
+        init_faces_initial ();
+#ifndef WINDOWSNT
       return;
 #endif
+    }
 
   /* If the user wants to use a window system, we shouldn't bother
      initializing the terminal.  This is especially important when the
@@ -6076,11 +6097,7 @@ init_display (void)
 #endif /* HAVE_NTGUI */
 
 #ifdef HAVE_NS
-  if (!inhibit_window_system
-#ifndef CANNOT_DUMP
-     && initialized
-#endif
-      )
+  if (!inhibit_window_system && !will_dump_p ())
     {
       Vinitial_window_system = Qns;
       Vwindow_system_version = make_fixnum (10);
@@ -6168,22 +6185,23 @@ init_display (void)
 
   calculate_costs (XFRAME (selected_frame));
 
-  /* Set up faces of the initial terminal frame of a dumped Emacs.  */
-  if (initialized
-      && !noninteractive
-      && NILP (Vinitial_window_system))
-    {
-      /* For the initial frame, we don't have any way of knowing what
-        are the foreground and background colors of the terminal.  */
-      struct frame *sf = SELECTED_FRAME ();
+  /* Set up faces of the initial terminal frame.  */
+  if (initialized && !noninteractive && NILP (Vinitial_window_system))
+    init_faces_initial ();
+}
 
-      FRAME_FOREGROUND_PIXEL (sf) = FACE_TTY_DEFAULT_FG_COLOR;
-      FRAME_BACKGROUND_PIXEL (sf) = FACE_TTY_DEFAULT_BG_COLOR;
-      call0 (intern ("tty-set-up-initial-frame-faces"));
+void
+init_display (void)
+{
+  if (noninteractive)
+    {
+      if (dumped_with_pdumper_p ())
+        init_faces_initial ();
     }
+  else
+    init_display_interactive ();
 }
 
-
 
 /***********************************************************************
                           Blinking cursor
@@ -6218,6 +6236,8 @@ WINDOW nil or omitted means report on the selected 
window.  */)
                            Initialization
  ***********************************************************************/
 
+static void syms_of_display_for_pdumper (void);
+
 void
 syms_of_display (void)
 {
@@ -6236,7 +6256,7 @@ syms_of_display (void)
   defsubr (&Sdump_redisplay_history);
 #endif
 
-  frame_and_buffer_state = Fmake_vector (make_fixnum (20), Qlambda);
+  frame_and_buffer_state = make_vector (20, Qlambda);
   staticpro (&frame_and_buffer_state);
 
   /* This is the "purpose" slot of a display table.  */
@@ -6325,11 +6345,12 @@ See `buffer-display-table' for more information.  */);
      beginning of the next redisplay).  */
   redisplay_dont_pause = true;
 
-#ifdef CANNOT_DUMP
-  if (noninteractive)
-#endif
-    {
-      Vinitial_window_system = Qnil;
-      Vwindow_system_version = Qnil;
-    }
+  pdumper_do_now_and_after_load (syms_of_display_for_pdumper);
+}
+
+static void
+syms_of_display_for_pdumper (void)
+{
+  Vinitial_window_system = Qnil;
+  Vwindow_system_version = Qnil;
 }
diff --git a/src/disptab.h b/src/disptab.h
index c8de011..f7a1628 100644
--- a/src/disptab.h
+++ b/src/disptab.h
@@ -1,5 +1,5 @@
 /* Things for GLYPHS and glyph tables.
-   Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/dmpstruct.awk b/src/dmpstruct.awk
new file mode 100755
index 0000000..55626cf
--- /dev/null
+++ b/src/dmpstruct.awk
@@ -0,0 +1,45 @@
+# Copyright (C) 2018-2019 Free Software Foundation, Inc.
+#
+# This file is part of GNU Emacs.
+#
+# GNU Emacs is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or (at
+# your option) any later version.
+#
+# GNU Emacs is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+BEGIN {
+  print "/* Generated by dmpstruct.awk */"
+  print "#ifndef EMACS_DMPSTRUCT_H"
+  print "#define EMACS_DMPSTRUCT_H"
+  struct_name = ""
+  tmpfile = "dmpstruct.tmp"
+}
+# Match a type followed by optional syntactic whitespace
+/^(enum|struct|union) [a-zA-Z0-9_]+([\t ]|\/\*.*\*\/)*$/ {
+  struct_name = $2
+  close (tmpfile)
+}
+/^(enum|struct|union) [a-zA-Z0-9_]+([\t ]|\/\*.*\*\/)*$/, /^(  )?};$/ {
+  print $0 > tmpfile
+}
+/^(  )?} *(GCALIGNED_STRUCT)? *;$/ {
+  if (struct_name != "") {
+    fflush (tmpfile)
+    cmd = "../lib-src/make-fingerprint -r " tmpfile
+    cmd | getline hash
+    close (cmd)
+    printf "#define HASH_%s_%.10s\n", struct_name, hash
+    struct_name = ""
+  }
+}
+END {
+  print "#endif /* EMACS_DMPSTRUCT_H */"
+}
diff --git a/src/doc.c b/src/doc.c
index 3437346..372e376 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -1,6 +1,6 @@
 /* Record indices of function doc strings stored in a file. -*- coding: utf-8 
-*-
 
-Copyright (C) 1985-1986, 1993-1995, 1997-2018 Free Software Foundation,
+Copyright (C) 1985-1986, 1993-1995, 1997-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -118,17 +118,15 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool 
definition)
   Lisp_Object docdir
     = NILP (tem) ? ENCODE_FILE (Vdoc_directory) : empty_unibyte_string;
   ptrdiff_t docdir_sizemax = SBYTES (docdir) + 1;
-#ifndef CANNOT_DUMP
-  docdir_sizemax = max (docdir_sizemax, sizeof sibling_etc);
-#endif
+  if (will_dump_p ())
+    docdir_sizemax = max (docdir_sizemax, sizeof sibling_etc);
   name = SAFE_ALLOCA (docdir_sizemax + SBYTES (file));
   lispstpcpy (lispstpcpy (name, docdir), file);
 
   fd = emacs_open (name, O_RDONLY, 0);
   if (fd < 0)
     {
-#ifndef CANNOT_DUMP
-      if (!NILP (Vpurify_flag))
+      if (will_dump_p ())
        {
          /* Preparing to dump; DOC file is probably not installed.
             So check in ../etc.  */
@@ -136,7 +134,6 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool 
definition)
 
          fd = emacs_open (name, O_RDONLY, 0);
        }
-#endif
       if (fd < 0)
        {
          if (errno == EMFILE || errno == ENFILE)
@@ -236,7 +233,7 @@ get_doc_string (Lisp_Object filepos, bool unibyte, bool 
definition)
     }
 
   /* Scan the text and perform quoting with ^A (char code 1).
-     ^A^A becomes ^A, ^A0 becomes a null char, and ^A_ becomes a ^_.  */
+     ^A^A becomes ^A, ^A0 becomes a NUL char, and ^A_ becomes a ^_.  */
   from = get_doc_string_buffer + offset;
   to = get_doc_string_buffer + offset;
   while (from != p)
@@ -545,12 +542,7 @@ the same file name is found in the `doc-directory'.  */)
 
   CHECK_STRING (filename);
 
-  if
-#ifndef CANNOT_DUMP
-    (!NILP (Vpurify_flag))
-#else /* CANNOT_DUMP */
-      (0)
-#endif /* CANNOT_DUMP */
+  if (will_dump_p ())
     {
       dirname = sibling_etc;
       dirlen = sizeof sibling_etc - 1;
diff --git a/src/doprnt.c b/src/doprnt.c
index f194b43..5fb7063 100644
--- a/src/doprnt.c
+++ b/src/doprnt.c
@@ -1,7 +1,7 @@
 /* Output like sprintf to a buffer of specified size.    -*- coding: utf-8 -*-
    Also takes args differently: pass one pointer to the end
    of the format string in addition to the format string itself.
-   Copyright (C) 1985, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -35,7 +35,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
      sequence.
 
    . It accepts a pointer to the end of the format string, so the format string
-     could include embedded null characters.
+     could include embedded NUL characters.
 
    . It signals an error if the length of the formatted string is about to
      overflow ptrdiff_t or size_t, to avoid producing strings longer than what
@@ -123,7 +123,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
    to fit and return BUFSIZE - 1; if this truncates a multibyte
    sequence, store '\0' into the sequence's first byte.
    Returns the number of bytes stored into BUFFER, excluding
-   the terminating null byte.  Output is always null-terminated.
+   the terminating NUL byte.  Output is always NUL-terminated.
    String arguments are passed as C strings.
    Integers are passed as C integers.  */
 
diff --git a/src/dosfns.c b/src/dosfns.c
index c159b26..47c5450 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -1,6 +1,6 @@
 /* MS-DOS specific Lisp utilities.  Coded by Manabu Higashida, 1991.
    Major changes May-July 1993 Morten Welinder (only 10% original code left)
-   Copyright (C) 1991, 1993, 1996-1998, 2001-2018 Free Software
+   Copyright (C) 1991, 1993, 1996-1998, 2001-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/dosfns.h b/src/dosfns.h
index 0e108fd..35b91be 100644
--- a/src/dosfns.h
+++ b/src/dosfns.h
@@ -2,7 +2,7 @@
    Coded by Manabu Higashida, 1991.
    Modified by Morten Welinder, 1993-1994.
 
-Copyright (C) 1991, 1994-1995, 1997, 1999, 2001-2018 Free Software
+Copyright (C) 1991, 1994-1995, 1997, 1999, 2001-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/dynlib.c b/src/dynlib.c
index d40aa67..8780445 100644
--- a/src/dynlib.c
+++ b/src/dynlib.c
@@ -1,6 +1,6 @@
 /* Portable API for dynamic loading.
 
-Copyright 2015-2018 Free Software Foundation, Inc.
+Copyright 2015-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/dynlib.h b/src/dynlib.h
index eebd2bd..168ddbc 100644
--- a/src/dynlib.h
+++ b/src/dynlib.h
@@ -1,6 +1,6 @@
 /* Portable API for dynamic loading.
 
-Copyright 2015-2018 Free Software Foundation, Inc.
+Copyright 2015-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/editfns.c b/src/editfns.c
index e995b38..bfffadc 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -1,6 +1,6 @@
 /* Lisp functions pertaining to editing.                 -*- coding: utf-8 -*-
 
-Copyright (C) 1985-1987, 1989, 1993-2018 Free Software Foundation, Inc.
+Copyright (C) 1985-1987, 1989, 1993-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -47,6 +47,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "composite.h"
 #include "intervals.h"
 #include "ptr-bounds.h"
+#include "systime.h"
 #include "character.h"
 #include "buffer.h"
 #include "window.h"
@@ -668,7 +669,7 @@ Field boundaries are not noticed if 
`inhibit-field-text-motion' is non-nil.  */)
     /* It is possible that NEW_POS is not within the same field as
        OLD_POS; try to move NEW_POS so that it is.  */
     {
-      ptrdiff_t shortage;
+      ptrdiff_t counted;
       Lisp_Object field_bound;
 
       if (fwd)
@@ -691,8 +692,8 @@ Field boundaries are not noticed if 
`inhibit-field-text-motion' is non-nil.  */)
                 there's an intervening newline or not.  */
              || (find_newline (XFIXNAT (new_pos), -1,
                                XFIXNAT (field_bound), -1,
-                               fwd ? -1 : 1, &shortage, NULL, 1),
-                 shortage != 0)))
+                               fwd ? -1 : 1, &counted, NULL, 1),
+                 counted == 0)))
        /* Constrain NEW_POS to FIELD_BOUND.  */
        new_pos = field_bound;
 
@@ -1176,6 +1177,24 @@ Value is a fixnum, if it's small enough, otherwise a 
bignum.  */)
   return INT_TO_INTEGER (uid);
 }
 
+DEFUN ("group-name", Fgroup_name, Sgroup_name, 1, 1, 0,
+       doc: /* Return the name of the group whose numeric group ID is GID.
+The argument GID should be an integer or a float.
+Return nil if a group with such GID does not exists or is not known.  */)
+  (Lisp_Object gid)
+{
+  struct group *gr;
+  gid_t id;
+
+  if (!NUMBERP (gid) && !CONSP (gid))
+    error ("Invalid GID specification");
+  CONS_TO_INTEGER (gid, gid_t, id);
+  block_input ();
+  gr = getgrgid (id);
+  unblock_input ();
+  return gr ? build_string (gr->gr_name) : Qnil;
+}
+
 DEFUN ("group-gid", Fgroup_gid, Sgroup_gid, 0, 0, 0,
        doc: /* Return the effective gid of Emacs.
 Value is a fixnum, if it's small enough, otherwise a bignum.  */)
@@ -1242,7 +1261,7 @@ name, or nil if there is no such user.  */)
   /* Substitute the login name for the &, upcasing the first character.  */
   if (q)
     {
-      Lisp_Object login = Fuser_login_name (make_fixnum (pw->pw_uid));
+      Lisp_Object login = Fuser_login_name (INT_TO_INTEGER (pw->pw_uid));
       USE_SAFE_ALLOCA;
       char *r = SAFE_ALLOCA (strlen (p) + SBYTES (login) + 1);
       memcpy (r, p, q - p);
@@ -1453,7 +1472,8 @@ called interactively, INHERIT is t.  */)
   CHECK_CHARACTER (character);
   if (NILP (count))
     XSETFASTINT (count, 1);
-  CHECK_FIXNUM (count);
+  else
+    CHECK_FIXNUM (count);
   c = XFIXNAT (character);
 
   if (!NILP (BVAR (current_buffer, enable_multibyte_characters)))
@@ -1891,6 +1911,7 @@ determines whether case is significant or ignored.  */)
 
 #undef ELEMENT
 #undef EQUAL
+#define USE_HEURISTIC
 
 /* Counter used to rarely_quit in replace-buffer-contents.  */
 static unsigned short rbc_quitcounter;
@@ -1913,30 +1934,53 @@ static unsigned short rbc_quitcounter;
   /* Bit vectors recording for each character whether it was deleted
      or inserted.  */                           \
   unsigned char *deletions;                     \
-  unsigned char *insertions;
+  unsigned char *insertions;                   \
+  struct timespec time_limit;                  \
+  unsigned int early_abort_tests;
 
 #define NOTE_DELETE(ctx, xoff) set_bit ((ctx)->deletions, (xoff))
 #define NOTE_INSERT(ctx, yoff) set_bit ((ctx)->insertions, (yoff))
+#define EARLY_ABORT(ctx) compareseq_early_abort (ctx)
 
 struct context;
 static void set_bit (unsigned char *, OFFSET);
 static bool bit_is_set (const unsigned char *, OFFSET);
 static bool buffer_chars_equal (struct context *, OFFSET, OFFSET);
+static bool compareseq_early_abort (struct context *);
 
 #include "minmax.h"
 #include "diffseq.h"
 
 DEFUN ("replace-buffer-contents", Freplace_buffer_contents,
-       Sreplace_buffer_contents, 1, 1, "bSource buffer: ",
+       Sreplace_buffer_contents, 1, 3, "bSource buffer: ",
        doc: /* Replace accessible portion of current buffer with that of 
SOURCE.
 SOURCE can be a buffer or a string that names a buffer.
 Interactively, prompt for SOURCE.
+
 As far as possible the replacement is non-destructive, i.e. existing
 buffer contents, markers, properties, and overlays in the current
 buffer stay intact.
-Warning: this function can be slow if there's a large number of small
-differences between the two buffers.  */)
-  (Lisp_Object source)
+
+Because this function can be very slow if there is a large number of
+differences between the two buffers, there are two optional arguments
+mitigating this issue.
+
+The MAX-SECS argument, if given, defines a hard limit on the time used
+for comparing the buffers.  If it takes longer than MAX-SECS, the
+function falls back to a plain `delete-region' and
+`insert-buffer-substring'.  (Note that the checks are not performed
+too evenly over time, so in some cases it may run a bit longer than
+allowed).
+
+The optional argument MAX-COSTS defines the quality of the difference
+computation.  If the actual costs exceed this limit, heuristics are
+used to provide a faster but suboptimal solution.  The default value
+is 1000000.
+
+This function returns t if a non-destructive replacement could be
+performed.  Otherwise, i.e., if MAX-SECS was exceeded, it returns
+nil.  */)
+  (Lisp_Object source, Lisp_Object max_secs, Lisp_Object max_costs)
 {
   struct buffer *a = current_buffer;
   Lisp_Object source_buffer = Fget_buffer (source);
@@ -1961,15 +2005,18 @@ differences between the two buffers.  */)
      empty.  */
 
   if (a_empty && b_empty)
-    return Qnil;
+    return Qt;
 
   if (a_empty)
-    return Finsert_buffer_substring (source, Qnil, Qnil);
+    {
+      Finsert_buffer_substring (source, Qnil, Qnil);
+      return Qt;
+    }
 
   if (b_empty)
     {
       del_range_both (BEGV, BEGV_BYTE, ZV, ZV_BYTE, true);
-      return Qnil;
+      return Qt;
     }
 
   ptrdiff_t count = SPECPDL_INDEX ();
@@ -1983,6 +2030,23 @@ differences between the two buffers.  */)
   ptrdiff_t *buffer;
   USE_SAFE_ALLOCA;
   SAFE_NALLOCA (buffer, 2, diags);
+
+  if (NILP (max_costs))
+    XSETFASTINT (max_costs, 1000000);
+  else
+    CHECK_FIXNUM (max_costs);
+
+  struct timespec time_limit = make_timespec (0, -1);
+  if (!NILP (max_secs))
+    {
+      struct timespec
+       tlim = timespec_add (current_timespec (),
+                            lisp_time_argument (max_secs)),
+       tmax = make_timespec (TYPE_MAXIMUM (time_t), TIMESPEC_HZ - 1);
+      if (timespec_cmp (tlim, tmax) < 0)
+       time_limit = tlim;
+    }
+
   /* Micro-optimization: Casting to size_t generates much better
      code.  */
   ptrdiff_t del_bytes = (size_t) size_a / CHAR_BIT + 1;
@@ -1998,17 +2062,25 @@ differences between the two buffers.  */)
     .insertions = SAFE_ALLOCA (ins_bytes),
     .fdiag = buffer + size_b + 1,
     .bdiag = buffer + diags + size_b + 1,
-    /* FIXME: Find a good number for .too_expensive.  */
-    .too_expensive = 1000000,
+    .heuristic = true,
+    .too_expensive = XFIXNUM (max_costs),
+    .time_limit = time_limit,
+    .early_abort_tests = 0
   };
   memclear (ctx.deletions, del_bytes);
   memclear (ctx.insertions, ins_bytes);
+
   /* compareseq requires indices to be zero-based.  We add BEGV back
      later.  */
   bool early_abort = compareseq (0, size_a, 0, size_b, false, &ctx);
-  /* Since we didn’t define EARLY_ABORT, we should never abort
-     early.  */
-  eassert (! early_abort);
+
+  if (early_abort)
+    {
+      del_range (min_a, ZV);
+      Finsert_buffer_substring (source, Qnil,Qnil);
+      SAFE_FREE_UNBIND_TO (count, Qnil);
+      return Qnil;
+    }
 
   rbc_quitcounter = 0;
 
@@ -2070,6 +2142,7 @@ differences between the two buffers.  */)
       --i;
       --j;
     }
+
   SAFE_FREE_UNBIND_TO (count, Qnil);
   rbc_quitcounter = 0;
 
@@ -2079,7 +2152,7 @@ differences between the two buffers.  */)
       update_compositions (BEGV, ZV, CHECK_INSIDE);
     }
 
-  return Qnil;
+  return Qt;
 }
 
 static void
@@ -2146,6 +2219,14 @@ buffer_chars_equal (struct context *ctx,
     == BUF_FETCH_MULTIBYTE_CHAR (ctx->buffer_b, bpos_b);
 }
 
+static bool
+compareseq_early_abort (struct context *ctx)
+{
+  if (ctx->time_limit.tv_nsec < 0)
+    return false;
+  return timespec_cmp (ctx->time_limit, current_timespec ()) < 0;
+}
+
 
 static void
 subst_char_in_region_unwind (Lisp_Object arg)
@@ -2272,10 +2353,11 @@ Both characters must have the same length of multi-byte 
form.  */)
 
              if (! NILP (noundo))
                {
-                 if (MODIFF - 1 == SAVE_MODIFF)
-                   SAVE_MODIFF++;
-                 if (MODIFF - 1 == BUF_AUTOSAVE_MODIFF (current_buffer))
-                   BUF_AUTOSAVE_MODIFF (current_buffer)++;
+                 modiff_count m = MODIFF;
+                 if (SAVE_MODIFF == m - 1)
+                   SAVE_MODIFF = m;
+                 if (BUF_AUTOSAVE_MODIFF (current_buffer) == m - 1)
+                   BUF_AUTOSAVE_MODIFF (current_buffer) = m;
                }
 
              /* The before-change-function may have moved the gap
@@ -2303,7 +2385,7 @@ Both characters must have the same length of multi-byte 
form.  */)
              /* replace_range is less efficient, because it moves the gap,
                 but it handles combining correctly.  */
              replace_range (pos, pos + 1, string,
-                            0, 0, 1, 0);
+                            false, false, true, false);
              pos_byte_next = CHAR_TO_BYTE (pos);
              if (pos_byte_next > pos_byte)
                /* Before combining happened.  We should not increment
@@ -2414,60 +2496,53 @@ From START to END, translate characters according to 
TABLE.
 TABLE is a string or a char-table; the Nth character in it is the
 mapping for the character with code N.
 It returns the number of characters changed.  */)
-  (Lisp_Object start, Lisp_Object end, register Lisp_Object table)
+  (Lisp_Object start, Lisp_Object end, Lisp_Object table)
 {
-  register unsigned char *tt;  /* Trans table. */
-  register int nc;             /* New character. */
-  int cnt;                     /* Number of changes made. */
-  ptrdiff_t size;              /* Size of translate table. */
-  ptrdiff_t pos, pos_byte, end_pos;
+  int translatable_chars = MAX_CHAR + 1;
   bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
   bool string_multibyte UNINIT;
 
   validate_region (&start, &end);
-  if (CHAR_TABLE_P (table))
-    {
-      if (! EQ (XCHAR_TABLE (table)->purpose, Qtranslation_table))
-       error ("Not a translation table");
-      size = MAX_CHAR;
-      tt = NULL;
-    }
-  else
+  if (STRINGP (table))
     {
-      CHECK_STRING (table);
-
-      if (! multibyte && (SCHARS (table) < SBYTES (table)))
+      if (! multibyte)
        table = string_make_unibyte (table);
-      string_multibyte = SCHARS (table) < SBYTES (table);
-      size = SBYTES (table);
-      tt = SDATA (table);
+      translatable_chars = min (translatable_chars, SBYTES (table));
+      string_multibyte = STRING_MULTIBYTE (table);
     }
+  else if (! (CHAR_TABLE_P (table)
+             && EQ (XCHAR_TABLE (table)->purpose, Qtranslation_table)))
+    error ("Not a translation table");
 
-  pos = XFIXNUM (start);
-  pos_byte = CHAR_TO_BYTE (pos);
-  end_pos = XFIXNUM (end);
+  ptrdiff_t pos = XFIXNUM (start);
+  ptrdiff_t pos_byte = CHAR_TO_BYTE (pos);
+  ptrdiff_t end_pos = XFIXNUM (end);
   modify_text (pos, end_pos);
 
-  cnt = 0;
-  for (; pos < end_pos; )
+  ptrdiff_t characters_changed = 0;
+
+  while (pos < end_pos)
     {
       unsigned char *p = BYTE_POS_ADDR (pos_byte);
       unsigned char *str UNINIT;
       unsigned char buf[MAX_MULTIBYTE_LENGTH];
-      int len, str_len;
-      int oc;
-      Lisp_Object val;
+      int len, oc;
 
       if (multibyte)
        oc = STRING_CHAR_AND_LENGTH (p, len);
       else
        oc = *p, len = 1;
-      if (oc < size)
+      if (oc < translatable_chars)
        {
-         if (tt)
+         int nc; /* New character.  */
+         int str_len;
+         Lisp_Object val;
+
+         if (STRINGP (table))
            {
              /* Reload as signal_after_change in last iteration may GC.  */
-             tt = SDATA (table);
+             unsigned char *tt = SDATA (table);
+
              if (string_multibyte)
                {
                  str = tt + string_char_to_byte (table, oc);
@@ -2516,7 +2591,8 @@ It returns the number of characters changed.  */)
                  /* This is less efficient, because it moves the gap,
                     but it should handle multibyte characters correctly.  */
                  string = make_multibyte_string ((char *) str, 1, str_len);
-                 replace_range (pos, pos + 1, string, 1, 0, 1, 0);
+                 replace_range (pos, pos + 1, string,
+                                true, false, true, false);
                  len = str_len;
                }
              else
@@ -2527,12 +2603,10 @@ It returns the number of characters changed.  */)
                  signal_after_change (pos, 1, 1);
                  update_compositions (pos, pos + 1, CHECK_BORDER);
                }
-             ++cnt;
+             characters_changed++;
            }
          else if (nc < 0)
            {
-             Lisp_Object string;
-
              if (CONSP (val))
                {
                  val = check_translation (pos, pos_byte, end_pos, val);
@@ -2549,18 +2623,14 @@ It returns the number of characters changed.  */)
              else
                len = 1;
 
-             if (VECTORP (val))
-               {
-                 string = Fconcat (1, &val);
-               }
-             else
-               {
-                 string = Fmake_string (make_fixnum (1), val, Qnil);
-               }
-             replace_range (pos, pos + len, string, 1, 0, 1, 0);
+             Lisp_Object string
+               = (VECTORP (val)
+                  ? Fconcat (1, &val)
+                  : Fmake_string (make_fixnum (1), val, Qnil));
+             replace_range (pos, pos + len, string, true, false, true, false);
              pos_byte += SBYTES (string);
              pos += SCHARS (string);
-             cnt += SCHARS (string);
+             characters_changed += SCHARS (string);
              end_pos += SCHARS (string) - len;
              continue;
            }
@@ -2569,7 +2639,7 @@ It returns the number of characters changed.  */)
       pos++;
     }
 
-  return make_fixnum (cnt);
+  return make_fixnum (characters_changed);
 }
 
 DEFUN ("delete-region", Fdelete_region, Sdelete_region, 2, 2, "r",
@@ -2766,6 +2836,25 @@ usage: (save-restriction &rest BODY)  */)
   return unbind_to (count, val);
 }
 
+/* i18n (internationalization).  */
+
+DEFUN ("ngettext", Fngettext, Sngettext, 3, 3, 0,
+       doc: /* Return the translation of MSGID (plural MSGID_PLURAL) depending 
on N.
+MSGID is the singular form of the string to be converted;
+use it as the key for the search in the translation catalog.
+MSGID_PLURAL is the plural form.  Use N to select the proper translation.
+If no message catalog is found, MSGID is returned if N is equal to 1,
+otherwise MSGID_PLURAL.  */)
+  (Lisp_Object msgid, Lisp_Object msgid_plural, Lisp_Object n)
+{
+  CHECK_STRING (msgid);
+  CHECK_STRING (msgid_plural);
+  CHECK_INTEGER (n);
+
+  /* Placeholder implementation until we get our act together.  */
+  return EQ (n, make_fixnum (1)) ? msgid : msgid_plural;
+}
+
 DEFUN ("message", Fmessage, Smessage, 1, MANY, 0,
        doc: /* Display a message at the bottom of the screen.
 The message also goes into the `*Messages*' buffer, if `message-log-max'
@@ -2919,8 +3008,8 @@ the next available argument, or the argument explicitly 
specified:
 
 %s means print a string argument.  Actually, prints any object, with `princ'.
 %d means print as signed number in decimal.
-%o means print as unsigned number in octal.
-%x means print as unsigned number in hex.
+%o means print a number in octal.
+%x means print a number in hex.
 %X is like %x, but uses upper case.
 %e means print a number in exponential notation.
 %f means print a number in decimal-point notation.
@@ -2931,6 +3020,8 @@ the next available argument, or the argument explicitly 
specified:
 %S means print any object as an s-expression (using `prin1').
 
 The argument used for %d, %o, %x, %e, %f, %g or %c must be a number.
+%o, %x, and %X treat arguments as unsigned if `binary-as-unsigned' is t
+  (this is experimental; email address@hidden if you need it).
 Use %% to put a single % into the output.
 
 A %-sequence other than %% may contain optional field number, flag,
@@ -3014,7 +3105,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
                              : FLT_RADIX == 16 ? 4
                              : -1)),
 
-   /* Maximum number of bytes (including terminating null) generated
+   /* Maximum number of bytes (including terminating NUL) generated
       by any format, if precision is no more than USEFUL_PRECISION_MAX.
       On all practical hosts, %Lf is the worst case.  */
    SPRINTF_BUFSIZE = (sizeof "-." + (LDBL_MAX_10_EXP + 1)
@@ -3447,7 +3538,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
 
                  bool format_as_long_double = false;
                  double darg;
-                 long double ldarg;
+                 long double ldarg UNINIT;
 
                  if (FLOATP (arg))
                    darg = XFLOAT_DATA (arg);
@@ -4413,17 +4504,13 @@ functions if all the text being accessed has this 
property.  */);
               binary_as_unsigned,
               doc: /* Non-nil means `format' %x and %o treat integers as 
unsigned.
 This has machine-dependent results.  Nil means to treat integers as
-signed, which is portable; for example, if N is a negative integer,
-(read (format "#x%x") N) returns N only when this variable is nil.
+signed, which is portable and is the default; for example, if N is a
+negative integer, (read (format "#x%x" N)) returns N only when this
+variable is nil.
 
 This variable is experimental; email address@hidden if you need
 it to be non-nil.  */);
-  /* For now, default to true if bignums exist, false in traditional Emacs.  */
-#ifdef lisp_h_FIXNUMP
   binary_as_unsigned = false;
-#else
-  binary_as_unsigned = true;
-#endif
 
   defsubr (&Spropertize);
   defsubr (&Schar_equal);
@@ -4486,7 +4573,10 @@ it to be non-nil.  */);
   defsubr (&Sinsert_char);
   defsubr (&Sinsert_byte);
 
+  defsubr (&Sngettext);
+
   defsubr (&Suser_login_name);
+  defsubr (&Sgroup_name);
   defsubr (&Suser_real_login_name);
   defsubr (&Suser_uid);
   defsubr (&Suser_real_uid);
diff --git a/src/emacs-icon.h b/src/emacs-icon.h
index b9bf73f..a8fa3df 100644
--- a/src/emacs-icon.h
+++ b/src/emacs-icon.h
@@ -1,7 +1,7 @@
 /* XPM */
 /* Emacs icon
 
-Copyright (C) 2008-2018 Free Software Foundation, Inc.
+Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 Author: Kentaro Ohkouchi <address@hidden>
         Nicolas Petton <address@hidden>
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 0dcd7f0..2bb1062 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -1,6 +1,6 @@
 /* emacs-module.c - Module loading and runtime implementation
 
-Copyright (C) 2015-2018 Free Software Foundation, Inc.
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -25,6 +25,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <stddef.h>
 #include <stdint.h>
 #include <stdio.h>
+#include <stdlib.h>
 
 #include "lisp.h"
 #include "dynlib.h"
@@ -65,18 +66,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "w32term.h"
 #endif
 
-/* True if Lisp_Object and emacs_value have the same representation.
-   This is typically true unless WIDE_EMACS_INT.  In practice, having
-   the same sizes and alignments and maximums should be a good enough
-   proxy for equality of representation.  */
-enum
-  {
-    plain_values
-      = (sizeof (Lisp_Object) == sizeof (emacs_value)
-        && alignof (Lisp_Object) == alignof (emacs_value)
-        && INTPTR_MAX == EMACS_INT_MAX)
-  };
-
 /* Function prototype for the module init function.  */
 typedef int (*emacs_init_function) (struct emacs_runtime *);
 
@@ -87,6 +76,43 @@ typedef int (*emacs_init_function) (struct emacs_runtime *);
 typedef void (*emacs_finalizer_function) (void *);
 
 
+/* Memory management.  */
+
+/* An `emacs_value' is just a pointer to a structure holding an
+   internal Lisp object.  */
+struct emacs_value_tag { Lisp_Object v; };
+
+/* Local value objects use a simple fixed-sized block allocation
+   scheme without explicit deallocation.  All local values are
+   deallocated when the lifetime of their environment ends.  Keep
+   track of a current frame from which new values are allocated,
+   appending further dynamically-allocated frames if necessary.  */
+
+enum { value_frame_size = 512 };
+
+/* A block from which `emacs_value' object can be allocated.  */
+struct emacs_value_frame
+{
+  /* Storage for values.  */
+  struct emacs_value_tag objects[value_frame_size];
+
+  /* Index of the next free value in `objects'.  */
+  int offset;
+
+  /* Pointer to next frame, if any.  */
+  struct emacs_value_frame *next;
+};
+
+/* A structure that holds an initial frame (so that the first local
+   values require no dynamic allocation) and keeps track of the
+   current frame.  */
+static struct emacs_value_storage
+{
+  struct emacs_value_frame initial;
+  struct emacs_value_frame *current;
+} global_storage;
+
+
 /* Private runtime and environment members.  */
 
 /* The private part of an environment stores the current non local exit state
@@ -99,12 +125,9 @@ struct emacs_env_private
   /* Dedicated storage for non-local exit symbol and data so that
      storage is always available for them, even in an out-of-memory
      situation.  */
-  Lisp_Object non_local_exit_symbol, non_local_exit_data;
+  struct emacs_value_tag non_local_exit_symbol, non_local_exit_data;
 
-  /* List of values allocated from this environment.  The code uses
-     this only if the user gave the -module-assertions command-line
-     option.  */
-  Lisp_Object values;
+  struct emacs_value_storage storage;
 };
 
 /* The private parts of an `emacs_runtime' object contain the initial
@@ -118,6 +141,7 @@ struct emacs_runtime_private
 /* Forward declarations.  */
 
 static Lisp_Object value_to_lisp (emacs_value);
+static emacs_value allocate_emacs_value (emacs_env *, struct 
emacs_value_storage *, Lisp_Object);
 static emacs_value lisp_to_value (emacs_env *, Lisp_Object);
 static enum emacs_funcall_exit module_non_local_exit_check (emacs_env *);
 static void module_assert_thread (void);
@@ -139,16 +163,7 @@ static void module_non_local_exit_throw_1 (emacs_env *,
 static void module_out_of_memory (emacs_env *);
 static void module_reset_handlerlist (struct handler **);
 
-/* We used to return NULL when emacs_value was a different type from
-   Lisp_Object, but nowadays we just use Qnil instead.  Although they
-   happen to be the same thing in the current implementation, module
-   code should not assume this.  */
-verify (NIL_IS_ZERO);
-static emacs_value const module_nil = 0;
-
 static bool module_assertions = false;
-static emacs_env *global_env;
-static struct emacs_env_private global_env_private;
 
 /* Convenience macros for non-local exit handling.  */
 
@@ -293,7 +308,7 @@ module_get_environment (struct emacs_runtime *ert)
 static emacs_value
 module_make_global_ref (emacs_env *env, emacs_value ref)
 {
-  MODULE_FUNCTION_BEGIN (module_nil);
+  MODULE_FUNCTION_BEGIN (NULL);
   struct Lisp_Hash_Table *h = XHASH_TABLE (Vmodule_refs_hash);
   Lisp_Object new_obj = value_to_lisp (ref);
   EMACS_UINT hashcode;
@@ -313,7 +328,7 @@ module_make_global_ref (emacs_env *env, emacs_value ref)
       hash_put (h, new_obj, make_fixed_natnum (1), hashcode);
     }
 
-  return lisp_to_value (module_assertions ? global_env : env, new_obj);
+  return allocate_emacs_value (env, &global_storage, new_obj);
 }
 
 static void
@@ -341,23 +356,16 @@ module_free_global_ref (emacs_env *env, emacs_value ref)
 
   if (module_assertions)
     {
-      Lisp_Object globals = global_env_private.values;
-      Lisp_Object prev = Qnil;
       ptrdiff_t count = 0;
-      for (Lisp_Object tail = globals; CONSP (tail);
-           tail = XCDR (tail))
+      for (struct emacs_value_frame *frame = &global_storage.initial;
+           frame != NULL; frame = frame->next)
         {
-          emacs_value global = xmint_pointer (XCAR (tail));
-          if (global == ref)
+          for (int i = 0; i < frame->offset; ++i)
             {
-              if (NILP (prev))
-                global_env_private.values = XCDR (globals);
-              else
-                XSETCDR (prev, XCDR (tail));
-              return;
+              if (&frame->objects[i] == ref)
+                return;
+              ++count;
             }
-          ++count;
-          prev = tail;
         }
       module_abort ("Global value was not found in list of %"pD"d globals",
                     count);
@@ -388,9 +396,8 @@ module_non_local_exit_get (emacs_env *env, emacs_value 
*sym, emacs_value *data)
   struct emacs_env_private *p = env->private_members;
   if (p->pending_non_local_exit != emacs_funcall_exit_return)
     {
-      /* FIXME: lisp_to_value can exit non-locally.  */
-      *sym = lisp_to_value (env, p->non_local_exit_symbol);
-      *data = lisp_to_value (env, p->non_local_exit_data);
+      *sym = &p->non_local_exit_symbol;
+      *data = &p->non_local_exit_data;
     }
   return p->pending_non_local_exit;
 }
@@ -434,7 +441,7 @@ module_make_function (emacs_env *env, ptrdiff_t min_arity, 
ptrdiff_t max_arity,
                      emacs_subr subr, const char *documentation,
                      void *data)
 {
-  MODULE_FUNCTION_BEGIN (module_nil);
+  MODULE_FUNCTION_BEGIN (NULL);
 
   if (! (0 <= min_arity
         && (max_arity < 0
@@ -467,7 +474,7 @@ static emacs_value
 module_funcall (emacs_env *env, emacs_value fun, ptrdiff_t nargs,
                emacs_value args[])
 {
-  MODULE_FUNCTION_BEGIN (module_nil);
+  MODULE_FUNCTION_BEGIN (NULL);
 
   /* Make a new Lisp_Object array starting with the function as the
      first arg, because that's what Ffuncall takes.  */
@@ -488,14 +495,14 @@ module_funcall (emacs_env *env, emacs_value fun, 
ptrdiff_t nargs,
 static emacs_value
 module_intern (emacs_env *env, const char *name)
 {
-  MODULE_FUNCTION_BEGIN (module_nil);
+  MODULE_FUNCTION_BEGIN (NULL);
   return lisp_to_value (env, intern (name));
 }
 
 static emacs_value
 module_type_of (emacs_env *env, emacs_value value)
 {
-  MODULE_FUNCTION_BEGIN (module_nil);
+  MODULE_FUNCTION_BEGIN (NULL);
   return lisp_to_value (env, Ftype_of (value_to_lisp (value)));
 }
 
@@ -528,7 +535,7 @@ module_extract_integer (emacs_env *env, emacs_value n)
 static emacs_value
 module_make_integer (emacs_env *env, intmax_t n)
 {
-  MODULE_FUNCTION_BEGIN (module_nil);
+  MODULE_FUNCTION_BEGIN (NULL);
   return lisp_to_value (env, make_int (n));
 }
 
@@ -544,7 +551,7 @@ module_extract_float (emacs_env *env, emacs_value f)
 static emacs_value
 module_make_float (emacs_env *env, double d)
 {
-  MODULE_FUNCTION_BEGIN (module_nil);
+  MODULE_FUNCTION_BEGIN (NULL);
   return lisp_to_value (env, make_float (d));
 }
 
@@ -581,10 +588,10 @@ module_copy_string_contents (emacs_env *env, emacs_value 
value, char *buffer,
 static emacs_value
 module_make_string (emacs_env *env, const char *str, ptrdiff_t length)
 {
-  MODULE_FUNCTION_BEGIN (module_nil);
+  MODULE_FUNCTION_BEGIN (NULL);
   if (! (0 <= length && length <= STRING_BYTES_BOUND))
     overflow_error ();
-  /* FIXME: AUTO_STRING_WITH_LEN requires STR to be null-terminated,
+  /* FIXME: AUTO_STRING_WITH_LEN requires STR to be NUL-terminated,
      but we shouldn't require that.  */
   AUTO_STRING_WITH_LEN (lstr, str, length);
   return lisp_to_value (env,
@@ -594,7 +601,7 @@ module_make_string (emacs_env *env, const char *str, 
ptrdiff_t length)
 static emacs_value
 module_make_user_ptr (emacs_env *env, emacs_finalizer_function fin, void *ptr)
 {
-  MODULE_FUNCTION_BEGIN (module_nil);
+  MODULE_FUNCTION_BEGIN (NULL);
   return lisp_to_value (env, make_user_ptr (fin, ptr));
 }
 
@@ -656,7 +663,7 @@ module_vec_set (emacs_env *env, emacs_value vec, ptrdiff_t 
i, emacs_value val)
 static emacs_value
 module_vec_get (emacs_env *env, emacs_value vec, ptrdiff_t i)
 {
-  MODULE_FUNCTION_BEGIN (module_nil);
+  MODULE_FUNCTION_BEGIN (NULL);
   Lisp_Object lvec = value_to_lisp (vec);
   check_vec_index (lvec, i);
   return lisp_to_value (env, AREF (lvec, i));
@@ -671,13 +678,21 @@ module_vec_size (emacs_env *env, emacs_value vec)
   return ASIZE (lvec);
 }
 
-/* This function should return true if and only if maybe_quit would do
-   anything.  */
+/* This function should return true if and only if maybe_quit would
+   quit.  */
 static bool
 module_should_quit (emacs_env *env)
 {
   MODULE_FUNCTION_BEGIN_NO_CATCH (false);
-  return (! NILP (Vquit_flag) && NILP (Vinhibit_quit)) || pending_signals;
+  return QUITP;
+}
+
+static enum emacs_process_input_result
+module_process_input (emacs_env *env)
+{
+  MODULE_FUNCTION_BEGIN (emacs_process_input_quit);
+  maybe_quit ();
+  return emacs_process_input_continue;
 }
 
 
@@ -691,9 +706,11 @@ module_signal_or_throw (struct emacs_env_private *env)
     case emacs_funcall_exit_return:
       return;
     case emacs_funcall_exit_signal:
-      xsignal (env->non_local_exit_symbol, env->non_local_exit_data);
+      xsignal (value_to_lisp (&env->non_local_exit_symbol),
+               value_to_lisp (&env->non_local_exit_data));
     case emacs_funcall_exit_throw:
-      Fthrow (env->non_local_exit_symbol, env->non_local_exit_data);
+      Fthrow (value_to_lisp (&env->non_local_exit_symbol),
+              value_to_lisp (&env->non_local_exit_data));
     default:
       eassume (false);
     }
@@ -769,17 +786,12 @@ funcall_module (Lisp_Object function, ptrdiff_t nargs, 
Lisp_Object *arglist)
   record_unwind_protect_ptr (finalize_environment_unwind, env);
 
   USE_SAFE_ALLOCA;
-  ATTRIBUTE_MAY_ALIAS emacs_value *args;
-  if (plain_values && ! module_assertions)
-    /* FIXME: The cast below is incorrect because the argument array
-       is not declared as const, so module functions can modify it.
-       Either declare it as const, or remove this branch.  */
-    args = (emacs_value *) arglist;
-  else
+  emacs_value *args = nargs > 0 ? SAFE_ALLOCA (nargs * sizeof *args) : NULL;
+  for (ptrdiff_t i = 0; i < nargs; ++i)
     {
-      args = SAFE_ALLOCA (nargs * sizeof *args);
-      for (ptrdiff_t i = 0; i < nargs; i++)
-       args[i] = lisp_to_value (env, arglist[i]);
+      args[i] = lisp_to_value (env, arglist[i]);
+      if (! args[i])
+       memory_full (sizeof *args[i]);
     }
 
   emacs_value ret = func->subr (env, nargs, args, func->data);
@@ -859,8 +871,8 @@ module_non_local_exit_signal_1 (emacs_env *env, Lisp_Object 
sym,
   if (p->pending_non_local_exit == emacs_funcall_exit_return)
     {
       p->pending_non_local_exit = emacs_funcall_exit_signal;
-      p->non_local_exit_symbol = sym;
-      p->non_local_exit_data = data;
+      p->non_local_exit_symbol.v = sym;
+      p->non_local_exit_data.v = data;
     }
 }
 
@@ -872,8 +884,8 @@ module_non_local_exit_throw_1 (emacs_env *env, Lisp_Object 
tag,
   if (p->pending_non_local_exit == emacs_funcall_exit_return)
     {
       p->pending_non_local_exit = emacs_funcall_exit_throw;
-      p->non_local_exit_symbol = tag;
-      p->non_local_exit_data = value;
+      p->non_local_exit_symbol.v = tag;
+      p->non_local_exit_data.v = value;
     }
 }
 
@@ -890,54 +902,8 @@ module_out_of_memory (emacs_env *env)
 
 /* Value conversion.  */
 
-/* We represent Lisp objects differently depending on whether the user
-   gave -module-assertions.  If assertions are disabled, emacs_value
-   objects are Lisp_Objects cast to emacs_value.  If assertions are
-   enabled, emacs_value objects are pointers to Lisp_Object objects
-   allocated from the free store; they are never freed, which ensures
-   that their addresses are unique and can be used for liveness
-   checking.  */
-
-/* Unique Lisp_Object used to mark those emacs_values which are really
-   just containers holding a Lisp_Object that does not fit as an emacs_value,
-   either because it is an integer out of range, or is not properly aligned.
-   Used only if !plain_values.  */
-static Lisp_Object ltv_mark;
-
-/* Convert V to the corresponding internal object O, such that
-   V == lisp_to_value_bits (O).  Never fails.  */
-static Lisp_Object
-value_to_lisp_bits (emacs_value v)
-{
-  if (plain_values || USE_LSB_TAG)
-    return XPL (v);
-
-  /* With wide EMACS_INT and when tag bits are the most significant,
-     reassembling integers differs from reassembling pointers in two
-     ways.  First, save and restore the least-significant bits of the
-     integer, not the most-significant bits.  Second, sign-extend the
-     integer when restoring, but zero-extend pointers because that
-     makes TAG_PTR faster.  */
-
-  intptr_t i = (intptr_t) v;
-  EMACS_UINT tag = i & ((1 << GCTYPEBITS) - 1);
-  EMACS_UINT untagged = i - tag;
-  switch (tag)
-    {
-    case_Lisp_Int:
-      {
-       bool negative = tag & 1;
-       EMACS_UINT sign_extension
-         = negative ? VALMASK & ~(INTPTR_MAX >> INTTYPEBITS): 0;
-       uintptr_t u = i;
-       intptr_t all_but_sign = u >> GCTYPEBITS;
-       untagged = sign_extension + all_but_sign;
-       break;
-      }
-    }
-
-  return XIL ((tag << VALBITS) + untagged);
-}
+/* Convert an `emacs_value' to the corresponding internal object.
+   Never fails.  */
 
 /* If V was computed from lisp_to_value (O), then return O.
    Exits non-locally only if the stack overflows.  */
@@ -948,91 +914,134 @@ value_to_lisp (emacs_value v)
     {
       /* Check the liveness of the value by iterating over all live
          environments.  */
-      void *vptr = v;
-      ATTRIBUTE_MAY_ALIAS Lisp_Object *optr = vptr;
       ptrdiff_t num_environments = 0;
       ptrdiff_t num_values = 0;
       for (Lisp_Object environments = Vmodule_environments;
            CONSP (environments); environments = XCDR (environments))
         {
           emacs_env *env = xmint_pointer (XCAR (environments));
-          for (Lisp_Object values = env->private_members->values;
-               CONSP (values); values = XCDR (values))
+          struct emacs_env_private *priv = env->private_members;
+          /* The value might be one of the nonlocal exit values.  Note
+             that we don't check whether a nonlocal exit is currently
+             pending, because the module might have cleared the flag
+             in the meantime.  */
+          if (&priv->non_local_exit_symbol == v
+              || &priv->non_local_exit_data == v)
+            goto ok;
+          for (struct emacs_value_frame *frame = &priv->storage.initial;
+               frame != NULL; frame = frame->next)
             {
-              Lisp_Object *p = xmint_pointer (XCAR (values));
-              if (p == optr)
-                return *p;
-              ++num_values;
+              for (int i = 0; i < frame->offset; ++i)
+                {
+                  if (&frame->objects[i] == v)
+                    goto ok;
+                  ++num_values;
+                }
             }
           ++num_environments;
         }
+      /* Also check global values.  */
+      for (struct emacs_value_frame *frame = &global_storage.initial;
+           frame != NULL; frame = frame->next)
+        {
+          for (int i = 0; i < frame->offset; ++i)
+            {
+              if (&frame->objects[i] == v)
+                goto ok;
+              ++num_values;
+            }
+        }
       module_abort (("Emacs value not found in %"pD"d values "
                     "of %"pD"d environments"),
                     num_values, num_environments);
     }
 
-  Lisp_Object o = value_to_lisp_bits (v);
-  if (! plain_values && CONSP (o) && EQ (XCDR (o), ltv_mark))
-    o = XCAR (o);
-  return o;
+ ok: return v->v;
 }
 
-/* Attempt to convert O to an emacs_value.  Do not do any checking
-   or allocate any storage; the caller should prevent or detect
-   any resulting bit pattern that is not a valid emacs_value.  */
+/* Convert an internal object to an `emacs_value'.  Allocate storage
+   from the environment; return NULL if allocation fails.  */
 static emacs_value
-lisp_to_value_bits (Lisp_Object o)
+lisp_to_value (emacs_env *env, Lisp_Object o)
 {
-  if (plain_values || USE_LSB_TAG)
-    return XLP (o);
+  struct emacs_env_private *p = env->private_members;
+  if (p->pending_non_local_exit != emacs_funcall_exit_return)
+    return NULL;
+  return allocate_emacs_value (env, &p->storage, o);
+}
 
-  /* Compress O into the space of a pointer, possibly losing information.  */
-  EMACS_UINT u = XLI (o);
-  if (FIXNUMP (o))
-    {
-      uintptr_t i = (u << VALBITS) + XTYPE (o);
-      return (emacs_value) i;
-    }
-  else
+/* Must be called for each frame before it can be used for allocation.  */
+static void
+initialize_frame (struct emacs_value_frame *frame)
+{
+  frame->offset = 0;
+  frame->next = NULL;
+}
+
+/* Must be called for any storage object before it can be used for
+   allocation.  */
+static void
+initialize_storage (struct emacs_value_storage *storage)
+{
+  initialize_frame (&storage->initial);
+  storage->current = &storage->initial;
+}
+
+/* Must be called for any initialized storage object before its
+   lifetime ends.  Free all dynamically-allocated frames.  */
+static void
+finalize_storage (struct emacs_value_storage *storage)
+{
+  struct emacs_value_frame *next = storage->initial.next;
+  while (next != NULL)
     {
-      char *p = XLP (o);
-      void *v = p - (u & ~VALMASK) + XTYPE (o);
-      return v;
+      struct emacs_value_frame *current = next;
+      next = current->next;
+      free (current);
     }
 }
 
-/* Convert O to an emacs_value.  Allocate storage if needed; this can
-   signal if memory is exhausted.  Must be an injective function.  */
+/* Allocate a new value from STORAGE and stores OBJ in it.  Return
+   NULL if allocation fails and use ENV for non local exit reporting.  */
 static emacs_value
-lisp_to_value (emacs_env *env, Lisp_Object o)
+allocate_emacs_value (emacs_env *env, struct emacs_value_storage *storage,
+                     Lisp_Object obj)
 {
-  if (module_assertions)
+  eassert (storage->current);
+  eassert (storage->current->offset < value_frame_size);
+  eassert (! storage->current->next);
+  if (storage->current->offset == value_frame_size - 1)
     {
-      /* Add the new value to the list of values allocated from this
-         environment.  The value is actually a pointer to the
-         Lisp_Object cast to emacs_value.  We make a copy of the
-         object on the free store to guarantee unique addresses.  */
-      ATTRIBUTE_MAY_ALIAS Lisp_Object *optr = xmalloc (sizeof o);
-      *optr = o;
-      void *vptr = optr;
-      ATTRIBUTE_MAY_ALIAS emacs_value ret = vptr;
-      struct emacs_env_private *priv = env->private_members;
-      priv->values = Fcons (make_mint_ptr (ret), priv->values);
-      return ret;
+      storage->current->next = malloc (sizeof *storage->current->next);
+      if (! storage->current->next)
+        {
+          module_out_of_memory (env);
+          return NULL;
+        }
+      initialize_frame (storage->current->next);
+      storage->current = storage->current->next;
     }
+  emacs_value value = storage->current->objects + storage->current->offset;
+  value->v = obj;
+  ++storage->current->offset;
+  return value;
+}
 
-  emacs_value v = lisp_to_value_bits (o);
-
-  if (! EQ (o, value_to_lisp_bits (v)))
+/* Mark all objects allocated from local environments so that they
+   don't get garbage-collected.  */
+void
+mark_modules (void)
+{
+  for (Lisp_Object tem = Vmodule_environments; CONSP (tem); tem = XCDR (tem))
     {
-      /* Package the incompressible object pointer inside a pair
-        that is compressible.  */
-      Lisp_Object pair = Fcons (o, ltv_mark);
-      v = (emacs_value) ((intptr_t) XCONS (pair) + Lisp_Cons);
+      emacs_env *env = xmint_pointer (XCAR (tem));
+      struct emacs_env_private *priv = env->private_members;
+      for (struct emacs_value_frame *frame = &priv->storage.initial;
+          frame != NULL;
+          frame = frame->next)
+        for (int i = 0; i < frame->offset; ++i)
+          mark_object (frame->objects[i].v);
     }
-
-  eassert (EQ (o, value_to_lisp (v)));
-  return v;
 }
 
 
@@ -1051,7 +1060,7 @@ initialize_environment (emacs_env *env, struct 
emacs_env_private *priv)
       env = xmalloc (sizeof *env);
 
   priv->pending_non_local_exit = emacs_funcall_exit_return;
-  priv->values = priv->non_local_exit_symbol = priv->non_local_exit_data = 
Qnil;
+  initialize_storage (&priv->storage);
   env->size = sizeof *env;
   env->private_members = priv;
   env->make_global_ref = module_make_global_ref;
@@ -1082,6 +1091,7 @@ initialize_environment (emacs_env *env, struct 
emacs_env_private *priv)
   env->vec_get = module_vec_get;
   env->vec_size = module_vec_size;
   env->should_quit = module_should_quit;
+  env->process_input = module_process_input;
   Vmodule_environments = Fcons (make_mint_ptr (env), Vmodule_environments);
   return env;
 }
@@ -1091,11 +1101,9 @@ initialize_environment (emacs_env *env, struct 
emacs_env_private *priv)
 static void
 finalize_environment (emacs_env *env)
 {
+  finalize_storage (&env->private_members->storage);
   eassert (xmint_pointer (XCAR (Vmodule_environments)) == env);
   Vmodule_environments = XCDR (Vmodule_environments);
-  if (module_assertions)
-    /* There is always at least the global environment.  */
-    eassert (CONSP (Vmodule_environments));
 }
 
 static void
@@ -1113,20 +1121,6 @@ finalize_runtime_unwind (void *raw_ert)
   finalize_environment (ert->private_members->env);
 }
 
-void
-mark_modules (void)
-{
-  for (Lisp_Object tail = Vmodule_environments; CONSP (tail);
-       tail = XCDR (tail))
-    {
-      emacs_env *env = xmint_pointer (XCAR (tail));
-      struct emacs_env_private *priv = env->private_members;
-      mark_object (priv->non_local_exit_symbol);
-      mark_object (priv->non_local_exit_data);
-      mark_object (priv->values);
-    }
-}
-
 
 /* Non-local exit handling.  */
 
@@ -1166,8 +1160,7 @@ init_module_assertions (bool enable)
   /* If enabling module assertions, use a hidden environment for
      storing the globals.  This environment is never freed.  */
   module_assertions = enable;
-  if (enable)
-    global_env = initialize_environment (NULL, &global_env_private);
+  initialize_storage (&global_storage);
 }
 
 static _Noreturn void
@@ -1190,10 +1183,6 @@ module_abort (const char *format, ...)
 void
 syms_of_module (void)
 {
-  if (!plain_values)
-    ltv_mark = Fcons (Qnil, Qnil);
-  eassert (NILP (value_to_lisp (module_nil)));
-
   DEFSYM (Qmodule_refs_hash, "module-refs-hash");
   DEFVAR_LISP ("module-refs-hash", Vmodule_refs_hash,
               doc: /* Module global reference table.  */);
@@ -1222,42 +1211,38 @@ syms_of_module (void)
 
   DEFSYM (Qmodule_load_failed, "module-load-failed");
   Fput (Qmodule_load_failed, Qerror_conditions,
-        listn (CONSTYPE_PURE, 2, Qmodule_load_failed, Qerror));
+       pure_list (Qmodule_load_failed, Qerror));
   Fput (Qmodule_load_failed, Qerror_message,
         build_pure_c_string ("Module load failed"));
 
   DEFSYM (Qmodule_open_failed, "module-open-failed");
   Fput (Qmodule_open_failed, Qerror_conditions,
-        listn (CONSTYPE_PURE, 3,
-               Qmodule_open_failed, Qmodule_load_failed, Qerror));
+       pure_list (Qmodule_open_failed, Qmodule_load_failed, Qerror));
   Fput (Qmodule_open_failed, Qerror_message,
         build_pure_c_string ("Module could not be opened"));
 
   DEFSYM (Qmodule_not_gpl_compatible, "module-not-gpl-compatible");
   Fput (Qmodule_not_gpl_compatible, Qerror_conditions,
-        listn (CONSTYPE_PURE, 3,
-               Qmodule_not_gpl_compatible, Qmodule_load_failed, Qerror));
+       pure_list (Qmodule_not_gpl_compatible, Qmodule_load_failed, Qerror));
   Fput (Qmodule_not_gpl_compatible, Qerror_message,
         build_pure_c_string ("Module is not GPL compatible"));
 
   DEFSYM (Qmissing_module_init_function, "missing-module-init-function");
   Fput (Qmissing_module_init_function, Qerror_conditions,
-        listn (CONSTYPE_PURE, 3,
-               Qmissing_module_init_function, Qmodule_load_failed, Qerror));
+       pure_list (Qmissing_module_init_function, Qmodule_load_failed,
+                  Qerror));
   Fput (Qmissing_module_init_function, Qerror_message,
         build_pure_c_string ("Module does not export an "
                              "initialization function"));
 
   DEFSYM (Qmodule_init_failed, "module-init-failed");
   Fput (Qmodule_init_failed, Qerror_conditions,
-        listn (CONSTYPE_PURE, 3,
-               Qmodule_init_failed, Qmodule_load_failed, Qerror));
+       pure_list (Qmodule_init_failed, Qmodule_load_failed, Qerror));
   Fput (Qmodule_init_failed, Qerror_message,
         build_pure_c_string ("Module initialization failed"));
 
   DEFSYM (Qinvalid_arity, "invalid-arity");
-  Fput (Qinvalid_arity, Qerror_conditions,
-        listn (CONSTYPE_PURE, 2, Qinvalid_arity, Qerror));
+  Fput (Qinvalid_arity, Qerror_conditions, pure_list (Qinvalid_arity, Qerror));
   Fput (Qinvalid_arity, Qerror_message,
         build_pure_c_string ("Invalid function arity"));
 
diff --git a/src/emacs-module.h.in b/src/emacs-module.h.in
index 8e0b42a..009d158 100644
--- a/src/emacs-module.h.in
+++ b/src/emacs-module.h.in
@@ -1,6 +1,6 @@
 /* emacs-module.h - GNU Emacs module API.
 
-Copyright (C) 2015-2018 Free Software Foundation, Inc.
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -47,7 +47,7 @@ extern "C" {
 #endif
 
 /* Current environment.  */
-typedef struct emacs_env_26 emacs_env;
+typedef struct emacs_env_27 emacs_env;
 
 /* Opaque pointer representing an Emacs Lisp value.
    BEWARE: Do not assume NULL is a valid value!  */
@@ -83,6 +83,16 @@ enum emacs_funcall_exit
   emacs_funcall_exit_throw = 2
 };
 
+/* Possible return values for emacs_env.process_input.  */
+enum emacs_process_input_result
+{
+  /* Module code may continue  */
+  emacs_process_input_continue = 0,
+
+  /* Module code should return control to Emacs as soon as possible.  */
+  emacs_process_input_quit = 1
+};
+
 struct emacs_env_25
 {
 @module_env_snippet_25@
@@ -95,6 +105,15 @@ struct emacs_env_26
 @module_env_snippet_26@
 };
 
+struct emacs_env_27
+{
address@hidden@
+
address@hidden@
+
address@hidden@
+};
+
 /* Every module should define a function as follows.  */
 extern int emacs_module_init (struct emacs_runtime *ert)
   EMACS_NOEXCEPT
diff --git a/src/emacs.c b/src/emacs.c
index 07df191..68835ca 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1,6 +1,6 @@
 /* Fully extensible Emacs, running on Unix, intended for GNU.
 
-Copyright (C) 1985-1987, 1993-1995, 1997-1999, 2001-2018 Free Software
+Copyright (C) 1985-1987, 1993-1995, 1997-1999, 2001-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -118,6 +118,9 @@ extern char etext;
 #include <sys/resource.h>
 #endif
 
+#include "pdumper.h"
+#include "epaths.h"
+
 static const char emacs_version[] = PACKAGE_VERSION;
 static const char emacs_copyright[] = COPYRIGHT;
 static const char emacs_bugreport[] = PACKAGE_BUGREPORT;
@@ -130,19 +133,9 @@ Lisp_Object empty_unibyte_string, empty_multibyte_string;
 Lisp_Object Vlibrary_cache;
 #endif
 
-/* Set after Emacs has started up the first time.
-   Prevents reinitialization of the Lisp world and keymaps
-   on subsequent starts.  */
+struct gflags gflags;
 bool initialized;
 
-#ifndef CANNOT_DUMP
-/* Set to true if this instance of Emacs might dump.  */
-# ifndef DOUG_LEA_MALLOC
-static
-# endif
-bool might_dump;
-#endif
-
 /* If true, Emacs should not attempt to use a window-specific code,
    but instead should use the virtual terminal under which it was started.  */
 bool inhibit_window_system;
@@ -156,7 +149,7 @@ bool running_asynch_code;
 bool display_arg;
 #endif
 
-#if defined GNU_LINUX && !defined CANNOT_DUMP
+#if defined GNU_LINUX && defined HAVE_UNEXEC
 /* The gap between BSS end and heap start as far as we can tell.  */
 static uprintmax_t heap_bss_diff;
 #endif
@@ -204,6 +197,9 @@ HANDLE w32_daemon_event;
 char **initial_argv;
 int initial_argc;
 
+/* The name of the working directory, or NULL if this info is unavailable.  */
+char const *emacs_wd;
+
 static void sort_args (int argc, char **argv);
 static void syms_of_emacs (void);
 
@@ -235,6 +231,11 @@ Initialization options:\n\
 --module-assertions         assert behavior of dynamic modules\n\
 ",
 #endif
+#ifdef HAVE_PDUMPER
+    "\
+--dump-file FILE            read dumped state from FILE\n\
+",
+#endif
     "\
 --no-build-details          do not add build details such as time stamps\n\
 --no-desktop                do not load a saved desktop\n\
@@ -406,7 +407,7 @@ terminate_due_to_signal (int sig, int backtrace_limit)
 /* Code for dealing with Lisp access to the Unix command line.  */
 
 static void
-init_cmdargs (int argc, char **argv, int skip_args, char *original_pwd)
+init_cmdargs (int argc, char **argv, int skip_args, char const *original_pwd)
 {
   int i;
   Lisp_Object name, dir, handler;
@@ -516,8 +517,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char 
*original_pwd)
              etc_exists = Ffile_exists_p (tem);
              if (!NILP (etc_exists))
                {
-                 Vinstallation_directory
-                   = Ffile_name_as_directory (dir);
+                  Vinstallation_directory = Ffile_name_as_directory (dir);
                  break;
                }
            }
@@ -542,8 +542,7 @@ init_cmdargs (int argc, char **argv, int skip_args, char 
*original_pwd)
              if (!NILP (etc_exists))
                {
                  tem = Fexpand_file_name (build_string (".."), dir);
-                 Vinstallation_directory
-                   = Ffile_name_as_directory (tem);
+                  Vinstallation_directory = Ffile_name_as_directory (tem);
                  break;
                }
            }
@@ -674,6 +673,160 @@ close_output_streams (void)
     _exit (EXIT_FAILURE);
 }
 
+#ifdef HAVE_PDUMPER
+
+static const char *
+dump_error_to_string (enum pdumper_load_result result)
+{
+  switch (result)
+    {
+    case PDUMPER_LOAD_SUCCESS:
+      return "success";
+    case PDUMPER_LOAD_OOM:
+      return "out of memory";
+    case PDUMPER_NOT_LOADED:
+      return "not loaded";
+    case PDUMPER_LOAD_FILE_NOT_FOUND:
+      return "could not open file";
+    case PDUMPER_LOAD_BAD_FILE_TYPE:
+      return "not a dump file";
+    case PDUMPER_LOAD_FAILED_DUMP:
+      return "dump file is result of failed dump attempt";
+    case PDUMPER_LOAD_VERSION_MISMATCH:
+      return "not built for this Emacs executable";
+    default:
+      return "generic error";
+    }
+}
+
+static enum pdumper_load_result
+load_pdump (int argc, char **argv)
+{
+  const char *const suffix = ".pdmp";
+  enum pdumper_load_result result;
+#ifdef WINDOWSNT
+  size_t argv0_len;
+#endif
+
+  /* TODO: maybe more thoroughly scrub process environment in order to
+     make this use case (loading a pdumper image in an unexeced emacs)
+     possible?  Right now, we assume that things we don't touch are
+     zero-initialized, and in an unexeced Emacs, this assumption
+     doesn't hold.  */
+  if (initialized)
+    fatal ("cannot load pdumper image in unexeced Emacs");
+
+  /* Look for an explicitly-specified dump file.  */
+  const char *path_exec = PATH_EXEC;
+  char *dump_file = NULL;
+  int skip_args = 0;
+  while (skip_args < argc - 1)
+    {
+      if (argmatch (argv, argc, "-dump-file", "--dump-file", 6,
+                   &dump_file, &skip_args)
+         || argmatch (argv, argc, "--", NULL, 2, NULL, &skip_args))
+       break;
+      skip_args++;
+    }
+
+  result = PDUMPER_NOT_LOADED;
+  if (dump_file)
+    {
+      result = pdumper_load (dump_file);
+
+      if (result != PDUMPER_LOAD_SUCCESS)
+        fatal ("could not load dump file \"%s\": %s",
+               dump_file, dump_error_to_string (result));
+      else
+        goto out;
+    }
+
+  /* Look for a dump file in the same directory as the executable; it
+     should have the same basename.  */
+
+  dump_file = alloca (strlen (argv[0]) + strlen (suffix) + 1);
+#ifdef DOS_NT
+  /* Remove the .exe extension if present.  */
+  argv0_len = strlen (argv[0]);
+  if (argv0_len >= 4 && c_strcasecmp (argv[0] + argv0_len - 4, ".exe") == 0)
+    sprintf (dump_file, "%.*s%s", (int)(argv0_len - 4), argv[0], suffix);
+  else
+#endif
+  sprintf (dump_file, "%s%s", argv[0], suffix);
+
+  result = pdumper_load (dump_file);
+  if (result == PDUMPER_LOAD_SUCCESS)
+    goto out;
+
+  if (result != PDUMPER_LOAD_FILE_NOT_FOUND)
+    fatal ("could not load dump file \"%s\": %s",
+           dump_file, dump_error_to_string (result));
+
+#ifdef WINDOWSNT
+  /* On MS-Windows, PATH_EXEC normally starts with a literal
+     "%emacs_dir%", so it will never work without some tweaking.  */
+  path_exec = w32_relocate (path_exec);
+#endif
+
+  /* Look for "emacs.pdmp" in PATH_EXEC.  We hardcode "emacs" in
+     "emacs.pdmp" so that the Emacs binary still works if the user
+     copies and renames it.  */
+  const char *argv0_base = "emacs";
+  dump_file = alloca (strlen (path_exec)
+                      + 1
+                      + strlen (argv0_base)
+                      + strlen (suffix)
+                      + 1);
+  sprintf (dump_file, "%s%c%s%s",
+           path_exec, DIRECTORY_SEP, argv0_base, suffix);
+  result = pdumper_load (dump_file);
+  if (result == PDUMPER_LOAD_SUCCESS)
+    goto out;
+
+  if (result == PDUMPER_LOAD_FILE_NOT_FOUND)
+    {
+      /* Finally, look for basename(argv[0])+".pdmp" in PATH_EXEC.
+        This way, they can rename both the executable and its pdump
+        file in PATH_EXEC, and have several Emacs configurations in
+        the same versioned libexec subdirectory.  */
+      char *p, *last_sep = NULL;
+      for (p = argv[0]; *p; p++)
+       {
+         if (IS_DIRECTORY_SEP (*p))
+           last_sep = p;
+       }
+      argv0_base = last_sep ? last_sep + 1 : argv[0];
+      dump_file = alloca (strlen (path_exec)
+                         + 1
+                         + strlen (argv0_base)
+                         + strlen (suffix)
+                         + 1);
+#ifdef DOS_NT
+      argv0_len = strlen (argv0_base);
+      if (argv0_len >= 4
+         && c_strcasecmp (argv0_base + argv0_len - 4, ".exe") == 0)
+       sprintf (dump_file, "%s%c%.*s%s", path_exec, DIRECTORY_SEP,
+                (int)(argv0_len - 4), argv0_base, suffix);
+      else
+#endif
+      sprintf (dump_file, "%s%c%s%s",
+              path_exec, DIRECTORY_SEP, argv0_base, suffix);
+      result = pdumper_load (dump_file);
+    }
+
+  if (result != PDUMPER_LOAD_SUCCESS)
+    {
+      if (result != PDUMPER_LOAD_FILE_NOT_FOUND)
+       fatal ("could not load dump file \"%s\": %s",
+              dump_file, dump_error_to_string (result));
+      dump_file = NULL;
+    }
+
+ out:
+  return result;
+}
+#endif /* HAVE_PDUMPER */
+
 /* ARGSUSED */
 int
 main (int argc, char **argv)
@@ -683,8 +836,6 @@ main (int argc, char **argv)
   void *stack_bottom_variable;
 
   bool do_initial_setlocale;
-  bool dumping;
-  int skip_args = 0;
   bool no_loadup = false;
   char *junk = 0;
   char *dname_arg = 0;
@@ -694,56 +845,99 @@ main (int argc, char **argv)
   char *ch_to_dir = 0;
 
   /* If we use --chdir, this records the original directory.  */
-  char *original_pwd = 0;
+  char const *original_pwd = 0;
 
   /* Record (approximately) where the stack begins.  */
   stack_bottom = (char *) &stack_bottom_variable;
 
-#ifndef CANNOT_DUMP
-  dumping = !initialized && (strcmp (argv[argc - 1], "dump") == 0
-                            || strcmp (argv[argc - 1], "bootstrap") == 0);
-#else
-  dumping = false;
+  const char *dump_mode = NULL;
+  int skip_args = 0;
+  char *temacs = NULL;
+  while (skip_args < argc - 1)
+    {
+      if (argmatch (argv, argc, "-temacs", "--temacs", 8, &temacs, &skip_args)
+         || argmatch (argv, argc, "--", NULL, 2, NULL, &skip_args))
+       break;
+      skip_args++;
+    }
+#ifdef HAVE_PDUMPER
+  bool attempt_load_pdump = false;
 #endif
 
-  /* True if address randomization interferes with memory allocation.  */
-# ifdef __PPC64__
-  bool disable_aslr = true;
-# else
-  bool disable_aslr = dumping;
-# endif
-
-  if (disable_aslr && disable_address_randomization ()
-      && !getenv ("EMACS_HEAP_EXEC"))
+  /* Look for this argument first, before any heap allocation, so we
+     can set heap flags properly if we're going to unexec.  */
+  if (!initialized && temacs)
     {
-      /* Set this so the personality will be reverted before execs
-        after this one, and to work around an re-exec loop on buggy
-        kernels (Bug#32083).  */
-      xputenv ("EMACS_HEAP_EXEC=true");
-
-      /* Address randomization was enabled, but is now disabled.
-        Re-execute Emacs to get a clean slate.  */
-      execvp (argv[0], argv);
-
-      /* If the exec fails, warn and then try anyway.  */
-      perror (argv[0]);
+#ifdef HAVE_UNEXEC
+      if (strcmp (temacs, "dump") == 0 ||
+          strcmp (temacs, "bootstrap") == 0)
+        gflags.will_dump_with_unexec_ = true;
+#endif
+#ifdef HAVE_PDUMPER
+      if (strcmp (temacs, "pdump") == 0 ||
+          strcmp (temacs, "pbootstrap") == 0)
+        gflags.will_dump_with_pdumper_ = true;
+#endif
+#if defined HAVE_PDUMPER || defined HAVE_UNEXEC
+      if (strcmp (temacs, "bootstrap") == 0 ||
+          strcmp (temacs, "pbootstrap") == 0)
+        gflags.will_bootstrap_ = true;
+      gflags.will_dump_ =
+        will_dump_with_pdumper_p () ||
+        will_dump_with_unexec_p ();
+      if (will_dump_p ())
+        dump_mode = temacs;
+#endif
+      if (!dump_mode)
+        fatal ("Invalid temacs mode '%s'", temacs);
+    }
+  else if (temacs)
+    {
+      fatal ("--temacs not supported for unexeced emacs");
+    }
+  else
+    {
+      eassert (!temacs);
+#ifndef HAVE_UNEXEC
+      eassert (!initialized);
+#endif
+#ifdef HAVE_PDUMPER
+      if (!initialized)
+       attempt_load_pdump = true;
+#endif
     }
 
-#ifndef CANNOT_DUMP
-  might_dump = !initialized;
+#ifdef HAVE_UNEXEC
+  if (!will_dump_with_unexec_p ())
+    gflags.will_not_unexec_ = true;
+#endif
 
-# ifdef GNU_LINUX
-  if (!initialized)
+#ifdef WINDOWSNT
+  /* Grab our malloc arena space now, before anything important
+     happens.  This relies on the static heap being needed only in
+     temacs and only if we are going to dump with unexec.  */
+  bool use_dynamic_heap = true;
+  if (temacs)
     {
-      char *heap_start = my_heap_start ();
-      heap_bss_diff = heap_start - max (my_endbss, my_endbss_static);
+      char *temacs_str = NULL, *p;
+      for (p = argv[0]; (p = strstr (p, "temacs")) != NULL; p++)
+       temacs_str = p;
+      if (temacs_str != NULL
+         && (temacs_str == argv[0] || IS_DIRECTORY_SEP (temacs_str[-1])))
+       {
+         /* Note that gflags are set at this point only if we have been
+            called with the --temacs=METHOD option.  We assume here that
+            temacs is always called that way, otherwise the functions
+            that rely on gflags, like will_dump_with_pdumper_p below,
+            will not do their job.  */
+         use_dynamic_heap = will_dump_with_pdumper_p ();
+       }
     }
-# endif
+  init_heap (use_dynamic_heap);
 #endif
-
 #if defined WINDOWSNT || defined HAVE_NTGUI
   /* Set global variables used to detect Windows version.  Do this as
-     early as possible.  (unexw32.c calls this function as well, but
+     early as possible.  (w32proc.c calls this function as well, but
      the additional call here is harmless.) */
   cache_system_info ();
 #ifdef WINDOWSNT
@@ -754,17 +948,35 @@ main (int argc, char **argv)
   /* Initialize the codepage for file names, needed to decode
      non-ASCII file names during startup.  */
   w32_init_file_name_codepage ();
+  /* Initialize the startup directory, needed for emacs_wd below.  */
+  w32_init_current_directory ();
 #endif
   w32_init_main_thread ();
 #endif
 
+#ifdef HAVE_PDUMPER
+  if (attempt_load_pdump)
+    load_pdump (argc, argv);
+#endif
+
+  argc = maybe_disable_address_randomization (
+    will_dump_with_unexec_p (), argc, argv);
+
+#if defined GNU_LINUX && defined HAVE_UNEXEC
+  if (!initialized)
+    {
+      char *heap_start = my_heap_start ();
+      heap_bss_diff = heap_start - max (my_endbss, my_endbss_static);
+    }
+#endif
+
 #ifdef RUN_TIME_REMAP
   if (initialized)
     run_time_remap (argv[0]);
 #endif
 
 /* If using unexmacosx.c (set by s/darwin.h), we must do this. */
-#if defined DARWIN_OS && !defined CANNOT_DUMP
+#if defined DARWIN_OS && defined HAVE_UNEXEC
   if (!initialized)
     unexec_init_emacs_zone ();
 #endif
@@ -776,6 +988,7 @@ main (int argc, char **argv)
   argc = 0;
   while (argv[argc]) argc++;
 
+  skip_args = 0;
   if (argmatch (argv, argc, "-version", "--version", 3, NULL, &skip_args))
     {
       const char *version, *copyright;
@@ -815,6 +1028,12 @@ main (int argc, char **argv)
       exit (0);
     }
 
+  emacs_wd = emacs_get_current_dir_name ();
+#ifdef HAVE_PDUMPER
+  if (dumped_with_pdumper_p ())
+    pdumper_record_wd (emacs_wd);
+#endif
+
   if (argmatch (argv, argc, "-chdir", "--chdir", 4, &ch_to_dir, &skip_args))
     {
 #ifdef WINDOWSNT
@@ -825,13 +1044,18 @@ main (int argc, char **argv)
       filename_from_ansi (ch_to_dir, newdir);
       ch_to_dir = newdir;
 #endif
-      original_pwd = emacs_get_current_dir_name ();
       if (chdir (ch_to_dir) != 0)
         {
           fprintf (stderr, "%s: Can't chdir to %s: %s\n",
                    argv[0], ch_to_dir, strerror (errno));
           exit (1);
         }
+      original_pwd = emacs_wd;
+#ifdef WINDOWSNT
+      /* Reinitialize Emacs's notion of the startup directory.  */
+      w32_init_current_directory ();
+#endif
+      emacs_wd = emacs_get_current_dir_name ();
     }
 
 #if defined (HAVE_SETRLIMIT) && defined (RLIMIT_STACK) && !defined (CYGWIN)
@@ -859,10 +1083,7 @@ main (int argc, char **argv)
          frames.  */
       int extra = (30 * 1000) * 50;
 
-      bool try_to_grow_stack = true;
-#ifndef CANNOT_DUMP
-      try_to_grow_stack = !noninteractive || initialized;
-#endif
+      bool try_to_grow_stack = !noninteractive || initialized;
 
       if (try_to_grow_stack)
        {
@@ -1193,17 +1414,15 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
 
 #if defined HAVE_PTHREAD && !defined SYSTEM_MALLOC \
   && !defined DOUG_LEA_MALLOC && !defined HYBRID_MALLOC
-# ifndef CANNOT_DUMP
   /* Do not make gmalloc thread-safe when creating bootstrap-emacs, as
      that causes an infinite recursive loop with FreeBSD.  See
      Bug#14569.  The part of this bug involving Cygwin is no longer
      relevant, now that Cygwin defines HYBRID_MALLOC.  */
-  if (!noninteractive || initialized)
-# endif
+  if (!noninteractive || !will_dump_p ())
     malloc_enable_thread ();
 #endif
 
-  init_signals (dumping);
+  init_signals ();
 
   noninteractive1 = noninteractive;
 
@@ -1213,7 +1432,7 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
     {
       init_alloc_once ();
       init_threads_once ();
-      init_obarray ();
+      init_obarray_once ();
       init_eval_once ();
       init_charset_once ();
       init_coding_once ();
@@ -1235,7 +1454,7 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
       /* Call syms_of_keyboard before init_window_once because
         keyboard sets up symbols that include some face names that
         the X support will want to use.  This can happen when
-        CANNOT_DUMP is defined.  */
+        Emacs starts up from scratch (e.g., temacs).  */
       syms_of_keyboard ();
 
       /* Called before syms_of_fileio, because it sets up Qerror_condition.  */
@@ -1251,7 +1470,7 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
       /* Before init_window_once, because it sets up the
         Vcoding_system_hash_table.  */
       syms_of_coding ();       /* This should be after syms_of_fileio.  */
-
+      init_frame_once ();       /* Before init_window_once.  */
       init_window_once ();     /* Init the window system.  */
 #ifdef HAVE_WINDOW_SYSTEM
       init_fringe_once ();     /* Swap bitmaps if necessary.  */
@@ -1274,6 +1493,11 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
   running_asynch_code = 0;
   init_random ();
 
+#ifdef HAVE_PDUMPER
+  if (dumped_with_pdumper_p ())
+    init_xfaces ();
+#endif
+
 #if defined HAVE_JSON && !defined WINDOWSNT
   init_json ();
 #endif
@@ -1291,7 +1515,7 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
   bool module_assertions
     = argmatch (argv, argc, "-module-assertions", "--module-assertions", 15,
                 NULL, &skip_args);
-  if (dumping && module_assertions)
+  if (will_dump_p () && module_assertions)
     {
       fputs ("Module assertions are not supported during dumping\n", stderr);
       exit (1);
@@ -1310,21 +1534,21 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
     {
 #ifdef NS_IMPL_COCOA
       /* Started from GUI? */
-      /* FIXME: Do the right thing if getenv returns NULL, or if
+      /* FIXME: Do the right thing if get_homedir returns "", or if
          chdir fails.  */
       if (! inhibit_window_system && ! isatty (STDIN_FILENO) && ! ch_to_dir)
-        chdir (getenv ("HOME"));
+        chdir (get_homedir ());
       if (skip_args < argc)
         {
           if (!strncmp (argv[skip_args], "-psn", 4))
             {
               skip_args += 1;
-              if (! ch_to_dir) chdir (getenv ("HOME"));
+              if (! ch_to_dir) chdir (get_homedir ());
             }
           else if (skip_args+1 < argc && !strncmp (argv[skip_args+1], "-psn", 
4))
             {
               skip_args += 2;
-              if (! ch_to_dir) chdir (getenv ("HOME"));
+              if (! ch_to_dir) chdir (get_homedir ());
             }
         }
 #endif  /* COCOA */
@@ -1428,7 +1652,7 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
   /* egetenv is a pretty low-level facility, which may get called in
      many circumstances; it seems flimsy to put off initializing it
      until calling init_callproc.  Do not do it when dumping.  */
-  if (! dumping)
+  if (!will_dump_p ())
     set_initial_environment ();
 
 #ifdef WINDOWSNT
@@ -1442,7 +1666,7 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
      variables from the parent process without modifications from
      Emacs.  */
   init_environment (argv);
-  init_ntproc (dumping); /* must precede init_editfns.  */
+  init_ntproc (will_dump_p ()); /* must precede init_editfns.  */
 #endif
 
   /* AIX crashes are reported in system versions 3.2.3 and 3.2.4
@@ -1454,7 +1678,7 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
 #endif
 
   /* Init buffer storage and default directory of main buffer.  */
-  init_buffer (initialized);
+  init_buffer ();
 
   init_callproc_1 ();  /* Must precede init_cmdargs and init_sys_modes.  */
 
@@ -1629,6 +1853,7 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
 
       syms_of_threads ();
       syms_of_profiler ();
+      syms_of_pdumper ();
 
 #ifdef HAVE_JSON
       syms_of_json ();
@@ -1659,7 +1884,7 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
   init_charset ();
 
   /* This calls putenv and so must precede init_process_emacs.  */
-  init_timefns (dumping);
+  init_timefns ();
 
   /* This sets Voperating_system_release, which init_process_emacs uses.  */
   init_editfns ();
@@ -1678,10 +1903,9 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
   init_process_emacs (sockfd);
 
   init_keyboard ();    /* This too must precede init_sys_modes.  */
-  if (!noninteractive)
-    init_display ();   /* Determine terminal type.  Calls init_sys_modes.  */
+  init_display ();     /* Determine terminal type.  Calls init_sys_modes.  */
 #if HAVE_W32NOTIFY
-  else
+  if (noninteractive)
     init_crit ();      /* w32notify.c needs this in batch mode.  */
 #endif /* HAVE_W32NOTIFY */
   init_xdisp ();
@@ -1725,7 +1949,10 @@ Using an Emacs configured with --with-x-toolkit=lucid 
does not have this problem
     moncontrol (0);
 #endif
 
-  initialized = 1;
+  initialized = true;
+
+  if (dump_mode)
+    Vdump_mode = build_string (dump_mode);
 
   /* Enter editor command loop.  This never returns.  */
   Frecursive_edit ();
@@ -1815,6 +2042,12 @@ static const struct standard_args standard_args[] =
   { "-color", "--color", 5, 0},
   { "-no-splash", "--no-splash", 3, 0 },
   { "-no-desktop", "--no-desktop", 3, 0 },
+  /* The following two must be just above the file-name args, to get
+     them out of our way, but without mixing them with file names.  */
+  { "-temacs", "--temacs", 1, 1 },
+#ifdef HAVE_PDUMPER
+  { "-dump-file", "--dump-file", 1, 1 },
+#endif
 #ifdef HAVE_NS
   { "-NSAutoLaunch", 0, 5, 1 },
   { "-NXAutoLaunch", 0, 5, 1 },
@@ -2154,7 +2387,7 @@ shut_down_emacs (int sig, Lisp_Object stuff)
 
 
 
-#ifndef CANNOT_DUMP
+#ifdef HAVE_UNEXEC
 
 #include "unexec.h"
 
@@ -2175,13 +2408,16 @@ You must run Emacs in batch mode in order to dump it.  
*/)
   if (! noninteractive)
     error ("Dumping Emacs works only in batch mode");
 
-  if (!might_dump)
-    error ("Emacs can be dumped only once");
+  if (dumped_with_unexec_p ())
+    error ("Emacs can be dumped using unexec only once");
 
-#if defined GNU_LINUX && !defined CANNOT_DUMP
+  if (definitely_will_not_unexec_p ())
+    error ("This Emacs instance was not started in temacs mode");
+
+# if defined GNU_LINUX && defined HAVE_UNEXEC
 
   /* Warn if the gap between BSS end and heap start is larger than this.  */
-# define MAX_HEAP_BSS_DIFF (1024*1024)
+#  define MAX_HEAP_BSS_DIFF (1024 * 1024)
 
   if (heap_bss_diff > MAX_HEAP_BSS_DIFF)
     {
@@ -2194,7 +2430,7 @@ You must run Emacs in batch mode in order to dump it.  */)
       fprintf (stderr, "exec-shield in etc/PROBLEMS for more information.\n");
       fprintf (stderr, "**************************************************\n");
     }
-#endif /* GNU_LINUX */
+# endif
 
   /* Bind `command-line-processed' to nil before dumping,
      so that the dumped Emacs will process its command line
@@ -2218,7 +2454,7 @@ You must run Emacs in batch mode in order to dump it.  */)
   tem = Vpurify_flag;
   Vpurify_flag = Qnil;
 
-#ifdef HYBRID_MALLOC
+# ifdef HYBRID_MALLOC
   {
     static char const fmt[] = "%d of %d static heap bytes used";
     char buf[sizeof fmt + 2 * (INT_STRLEN_BOUND (int) - 2)];
@@ -2227,18 +2463,21 @@ You must run Emacs in batch mode in order to dump it.  
*/)
     /* Don't log messages, because at this point buffers cannot be created.  */
     message1_nolog (buf);
   }
-#endif
+# endif
 
   fflush_unlocked (stdout);
   /* Tell malloc where start of impure now is.  */
   /* Also arrange for warnings when nearly out of space.  */
-#if !defined SYSTEM_MALLOC && !defined HYBRID_MALLOC
-#ifndef WINDOWSNT
+# if !defined SYSTEM_MALLOC && !defined HYBRID_MALLOC && !defined WINDOWSNT
   /* On Windows, this was done before dumping, and that once suffices.
      Meanwhile, my_edata is not valid on Windows.  */
   memory_warnings (my_edata, malloc_warning);
-#endif /* not WINDOWSNT */
-#endif /* not SYSTEM_MALLOC and not HYBRID_MALLOC */
+# endif
+
+  struct gflags old_gflags = gflags;
+  gflags.will_dump_ = false;
+  gflags.will_dump_with_unexec_ = false;
+  gflags.dumped_with_unexec_ = true;
 
   alloc_unexec_pre ();
 
@@ -2246,19 +2485,22 @@ You must run Emacs in batch mode in order to dump it.  
*/)
 
   alloc_unexec_post ();
 
-#ifdef WINDOWSNT
+  gflags = old_gflags;
+
+# ifdef WINDOWSNT
   Vlibrary_cache = Qnil;
-#endif
-#ifdef HAVE_WINDOW_SYSTEM
+# endif
+# ifdef HAVE_WINDOW_SYSTEM
   reset_image_types ();
-#endif
+# endif
 
   Vpurify_flag = tem;
 
   return unbind_to (count, Qnil);
 }
 
-#endif /* not CANNOT_DUMP */
+#endif
+
 
 #if HAVE_SETLOCALE
 /* Recover from setlocale (LC_ALL, "").  */
@@ -2397,7 +2639,7 @@ decode_env_path (const char *evarname, const char 
*defalt, bool empty)
              }
          }
        else if (cnv_result != 0 && d > path_utf8)
-         d[-1] = '\0'; /* remove last semi-colon and null-terminate PATH */
+         d[-1] = '\0'; /* remove last semi-colon and NUL-terminate PATH */
       } while (q);
       path_copy = path_utf8;
 #else  /* MSDOS */
@@ -2546,7 +2788,7 @@ syms_of_emacs (void)
   DEFSYM (Qkill_emacs, "kill-emacs");
   DEFSYM (Qkill_emacs_hook, "kill-emacs-hook");
 
-#ifndef CANNOT_DUMP
+#ifdef HAVE_UNEXEC
   defsubr (&Sdump_emacs);
 #endif
 
@@ -2594,7 +2836,7 @@ Don't rely on it for testing whether a feature you want 
to use is available.  */
   Vsystem_configuration_features = build_string (EMACS_CONFIG_FEATURES);
 
   DEFVAR_BOOL ("noninteractive", noninteractive1,
-              doc: /* Non-nil means Emacs is running without interactive 
terminal.  */);
+               doc: /* Non-nil means Emacs is running without interactive 
terminal.  */);
 
   DEFVAR_LISP ("kill-emacs-hook", Vkill_emacs_hook,
               doc: /* Hook run when `kill-emacs' is called.
@@ -2679,6 +2921,9 @@ component .BUILD is present.  This is now stored 
separately in
               doc: /* Address of mailing list for GNU Emacs bugs.  */);
   Vreport_emacs_bug_address = build_string (emacs_bugreport);
 
+  DEFVAR_LISP ("dump-mode", Vdump_mode,
+               doc: /* Non-nil when Emacs is dumping itself.  */);
+
   DEFVAR_LISP ("dynamic-library-alist", Vdynamic_library_alist,
     doc: /* Alist of dynamic libraries vs external files implementing them.
 Each element is a list (LIBRARY FILE...), where the car is a symbol
diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c
index e404729..6b2b4f7 100644
--- a/src/emacsgtkfixed.c
+++ b/src/emacsgtkfixed.c
@@ -1,7 +1,7 @@
 /* A Gtk Widget that inherits GtkFixed, but can be shrunk.
 This file is only use when compiling with Gtk+ 3.
 
-Copyright (C) 2011-2018 Free Software Foundation, Inc.
+Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/emacsgtkfixed.h b/src/emacsgtkfixed.h
index 738a3fc..2f01328 100644
--- a/src/emacsgtkfixed.h
+++ b/src/emacsgtkfixed.h
@@ -1,7 +1,7 @@
 /* A Gtk Widget that inherits GtkFixed, but can be shrunk.
 This file is only use when compiling with Gtk+ 3.
 
-Copyright (C) 2011-2018 Free Software Foundation, Inc.
+Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/epaths.in b/src/epaths.in
index 4a91acd..5fe35b6 100644
--- a/src/epaths.in
+++ b/src/epaths.in
@@ -1,6 +1,6 @@
 /* Hey Emacs, this is -*- C -*- code!  */
 /*
-Copyright (C) 1993, 1995, 1997, 1999, 2001-2018 Free Software
+Copyright (C) 1993, 1995, 1997, 1999, 2001-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/eval.c b/src/eval.c
index a51d0c9..49d6460 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1,6 +1,6 @@
 /* Evaluator for GNU Emacs Lisp interpreter.
 
-Copyright (C) 1985-1987, 1993-1995, 1999-2018 Free Software Foundation,
+Copyright (C) 1985-1987, 1993-1995, 1999-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -29,6 +29,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "keyboard.h"
 #include "dispextern.h"
 #include "buffer.h"
+#include "pdumper.h"
 
 /* CACHEABLE is ordinarily nothing, except it is 'volatile' if
    necessary to cajole GCC into not warning incorrectly that a
@@ -39,10 +40,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 # define CACHEABLE /* empty */
 #endif
 
-/* Chain of condition and catch handlers currently in effect.  */
-
-/* struct handler *handlerlist; */
-
 /* Non-nil means record all fset's and provide's, to be undone
    if the file being autoloaded is not fully loaded.
    They are recorded by being consed onto the front of Vautoload_queue:
@@ -55,26 +52,6 @@ Lisp_Object Vautoload_queue;
    is shutting down.  */
 Lisp_Object Vrun_hooks;
 
-/* The commented-out variables below are macros defined in thread.h.  */
-
-/* Current number of specbindings allocated in specpdl, not counting
-   the dummy entry specpdl[-1].  */
-
-/* ptrdiff_t specpdl_size; */
-
-/* Pointer to beginning of specpdl.  A dummy entry specpdl[-1] exists
-   only so that its address can be taken.  */
-
-/* union specbinding *specpdl; */
-
-/* Pointer to first unused element in specpdl.  */
-
-/* union specbinding *specpdl_ptr; */
-
-/* Depth in Lisp evaluations and function calls.  */
-
-/* static EMACS_INT lisp_eval_depth; */
-
 /* The value of num_nonmacro_input_events as of the last time we
    started to enter the debugger.  If we decide to enter the debugger
    again when this is still equal to num_nonmacro_input_events, then we
@@ -82,17 +59,13 @@ Lisp_Object Vrun_hooks;
    signal the error instead of entering an infinite loop of debugger
    invocations.  */
 
-static EMACS_INT when_entered_debugger;
+static intmax_t when_entered_debugger;
 
 /* The function from which the last `signal' was called.  Set in
    Fsignal.  */
 /* FIXME: We should probably get rid of this!  */
 Lisp_Object Vsignaling_function;
 
-/* If non-nil, Lisp code must not be run since some part of Emacs is in
-   an inconsistent state.  Currently unused.  */
-Lisp_Object inhibit_lisp_code;
-
 /* These would ordinarily be static, but they need to be visible to GDB.  */
 bool backtrace_p (union specbinding *) EXTERNALLY_VISIBLE;
 Lisp_Object *backtrace_args (union specbinding *) EXTERNALLY_VISIBLE;
@@ -202,7 +175,7 @@ set_backtrace_debug_on_exit (union specbinding *pdl, bool 
doe)
 
 bool
 backtrace_p (union specbinding *pdl)
-{ return pdl >= specpdl; }
+{ return specpdl ? pdl >= specpdl : false; }
 
 static bool
 backtrace_thread_p (struct thread_state *tstate, union specbinding *pdl)
@@ -211,6 +184,12 @@ backtrace_thread_p (struct thread_state *tstate, union 
specbinding *pdl)
 union specbinding *
 backtrace_top (void)
 {
+  /* This is so "xbacktrace" doesn't crash in pdumped Emacs if they
+     invoke the command before init_eval_once_for_pdumper initializes
+     specpdl machinery.  See also backtrace_p above.  */
+  if (!specpdl)
+    return NULL;
+
   union specbinding *pdl = specpdl_ptr - 1;
   while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE)
     pdl--;
@@ -235,6 +214,8 @@ backtrace_next (union specbinding *pdl)
   return pdl;
 }
 
+static void init_eval_once_for_pdumper (void);
+
 static union specbinding *
 backtrace_thread_next (struct thread_state *tstate, union specbinding *pdl)
 {
@@ -247,18 +228,21 @@ backtrace_thread_next (struct thread_state *tstate, union 
specbinding *pdl)
 void
 init_eval_once (void)
 {
-  enum { size = 50 };
-  union specbinding *pdlvec = xmalloc ((size + 1) * sizeof *specpdl);
-  specpdl_size = size;
-  specpdl = specpdl_ptr = pdlvec + 1;
   /* Don't forget to update docs (lispref node "Local Variables").  */
   max_specpdl_size = 1300; /* 1000 is not enough for CEDET's c-by.el.  */
   max_lisp_eval_depth = 800;
-
   Vrun_hooks = Qnil;
+  pdumper_do_now_and_after_load (init_eval_once_for_pdumper);
 }
 
-/* static struct handler handlerlist_sentinel; */
+static void
+init_eval_once_for_pdumper (void)
+{
+  enum { size = 50 };
+  union specbinding *pdlvec = malloc ((size + 1) * sizeof *specpdl);
+  specpdl_size = size;
+  specpdl = specpdl_ptr = pdlvec + 1;
+}
 
 void
 init_eval (void)
@@ -281,13 +265,23 @@ init_eval (void)
   when_entered_debugger = -1;
 }
 
+/* Ensure that *M is at least A + B if possible, or is its maximum
+   value otherwise.  */
+
+static void
+max_ensure_room (intmax_t *m, intmax_t a, intmax_t b)
+{
+  intmax_t sum = INT_ADD_WRAPV (a, b, &sum) ? INTMAX_MAX : sum;
+  *m = max (*m, sum);
+}
+
 /* Unwind-protect function used by call_debugger.  */
 
 static void
 restore_stack_limits (Lisp_Object data)
 {
-  max_specpdl_size = XFIXNUM (XCAR (data));
-  max_lisp_eval_depth = XFIXNUM (XCDR (data));
+  integer_to_intmax (XCAR (data), &max_specpdl_size);
+  integer_to_intmax (XCDR (data), &max_lisp_eval_depth);
 }
 
 static void grow_specpdl (void);
@@ -300,21 +294,19 @@ call_debugger (Lisp_Object arg)
   bool debug_while_redisplaying;
   ptrdiff_t count = SPECPDL_INDEX ();
   Lisp_Object val;
-  EMACS_INT old_depth = max_lisp_eval_depth;
+  intmax_t old_depth = max_lisp_eval_depth;
   /* Do not allow max_specpdl_size less than actual depth (Bug#16603).  */
-  EMACS_INT old_max = max (max_specpdl_size, count);
+  intmax_t old_max = max (max_specpdl_size, count);
 
   /* The previous value of 40 is too small now that the debugger
      prints using cl-prin1 instead of prin1.  Printing lists nested 8
      deep (which is the value of print-level used in the debugger)
      currently requires 77 additional frames.  See bug#31919.  */
-  if (lisp_eval_depth + 100 > max_lisp_eval_depth)
-    max_lisp_eval_depth = lisp_eval_depth + 100;
+  max_ensure_room (&max_lisp_eval_depth, lisp_eval_depth, 100);
 
   /* While debugging Bug#16603, previous value of 100 was found
      too small to avoid specpdl overflow in the debugger itself.  */
-  if (max_specpdl_size - 200 < count)
-    max_specpdl_size = count + 200;
+  max_ensure_room (&max_specpdl_size, count, 200);
 
   if (old_max == count)
     {
@@ -325,8 +317,7 @@ call_debugger (Lisp_Object arg)
 
   /* Restore limits after leaving the debugger.  */
   record_unwind_protect (restore_stack_limits,
-                        Fcons (make_fixnum (old_max),
-                               make_fixnum (old_depth)));
+                        Fcons (make_int (old_max), make_int (old_depth)));
 
 #ifdef HAVE_WINDOW_SYSTEM
   if (display_hourglass_p)
@@ -951,16 +942,15 @@ usage: (let VARLIST BODY...)  */)
   (Lisp_Object args)
 {
   Lisp_Object *temps, tem, lexenv;
-  Lisp_Object elt, varlist;
+  Lisp_Object elt;
   ptrdiff_t count = SPECPDL_INDEX ();
   ptrdiff_t argnum;
   USE_SAFE_ALLOCA;
 
-  varlist = XCAR (args);
-  CHECK_LIST (varlist);
+  Lisp_Object varlist = XCAR (args);
 
   /* Make space to hold the values to give the bound variables.  */
-  EMACS_INT varlist_len = XFIXNAT (Flength (varlist));
+  EMACS_INT varlist_len = list_length (varlist);
   SAFE_ALLOCA_LISP (temps, varlist_len);
   ptrdiff_t nvars = varlist_len;
 
@@ -1572,10 +1562,7 @@ process_quit_flag (void)
    If quit-flag is set to `kill-emacs' the SIGINT handler has received
    a request to exit Emacs when it is safe to do.
 
-   When not quitting, process any pending signals.
-
-   If you change this function, also adapt module_should_quit in
-   emacs-module.c.  */
+   When not quitting, process any pending signals.  */
 
 void
 maybe_quit (void)
@@ -1654,11 +1641,8 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object 
data, bool keyboard_quit)
       && specpdl_ptr < specpdl + specpdl_size)
     {
       /* Edebug takes care of restoring these variables when it exits.  */
-      if (lisp_eval_depth + 20 > max_lisp_eval_depth)
-       max_lisp_eval_depth = lisp_eval_depth + 20;
-
-      if (SPECPDL_INDEX () + 40 > max_specpdl_size)
-       max_specpdl_size = SPECPDL_INDEX () + 40;
+      max_ensure_room (&max_lisp_eval_depth, lisp_eval_depth, 20);
+      max_ensure_room (&max_specpdl_size, SPECPDL_INDEX (), 40);
 
       call2 (Vsignal_hook_function, error_symbol, data);
     }
@@ -2085,7 +2069,7 @@ it defines a macro.  */)
 
   /* This is to make sure that loadup.el gives a clear picture
      of what files are preloaded and when.  */
-  if (! NILP (Vpurify_flag))
+  if (will_dump_p () && !will_bootstrap_p ())
     error ("Attempt to autoload %s while preparing to dump",
           SDATA (SYMBOL_NAME (funname)));
 
@@ -2256,21 +2240,22 @@ eval_sub (Lisp_Object form)
   /* Optimize for no indirection.  */
   fun = original_fun;
   if (!SYMBOLP (fun))
-    fun = Ffunction (Fcons (fun, Qnil));
+    fun = Ffunction (list1 (fun));
   else if (!NILP (fun) && (fun = XSYMBOL (fun)->u.s.function, SYMBOLP (fun)))
     fun = indirect_function (fun);
 
   if (SUBRP (fun))
     {
       Lisp_Object args_left = original_args;
-      Lisp_Object numargs = Flength (args_left);
+      ptrdiff_t numargs = list_length (args_left);
 
       check_cons_list ();
 
-      if (XFIXNUM (numargs) < XSUBR (fun)->min_args
+      if (numargs < XSUBR (fun)->min_args
          || (XSUBR (fun)->max_args >= 0
-             && XSUBR (fun)->max_args < XFIXNUM (numargs)))
-       xsignal2 (Qwrong_number_of_arguments, original_fun, numargs);
+             && XSUBR (fun)->max_args < numargs))
+       xsignal2 (Qwrong_number_of_arguments, original_fun,
+                 make_fixnum (numargs));
 
       else if (XSUBR (fun)->max_args == UNEVALLED)
        val = (XSUBR (fun)->function.aUNEVALLED) (args_left);
@@ -2281,9 +2266,9 @@ eval_sub (Lisp_Object form)
          ptrdiff_t argnum = 0;
          USE_SAFE_ALLOCA;
 
-         SAFE_ALLOCA_LISP (vals, XFIXNUM (numargs));
+         SAFE_ALLOCA_LISP (vals, numargs);
 
-         while (CONSP (args_left) && argnum < XFIXNUM (numargs))
+         while (CONSP (args_left) && argnum < numargs)
            {
              Lisp_Object arg = XCAR (args_left);
              args_left = XCDR (args_left);
@@ -2313,7 +2298,7 @@ eval_sub (Lisp_Object form)
              args_left = Fcdr (args_left);
            }
 
-         set_backtrace_args (specpdl + count, argvals, XFIXNUM (numargs));
+         set_backtrace_args (specpdl + count, argvals, numargs);
 
          switch (i)
            {
@@ -2417,16 +2402,13 @@ Thus, (apply \\='+ 1 2 \\='(3 4)) returns 10.
 usage: (apply FUNCTION &rest ARGUMENTS)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
-  ptrdiff_t i, numargs, funcall_nargs;
-  register Lisp_Object *funcall_args = NULL;
-  register Lisp_Object spread_arg = args[nargs - 1];
+  ptrdiff_t i, funcall_nargs;
+  Lisp_Object *funcall_args = NULL;
+  Lisp_Object spread_arg = args[nargs - 1];
   Lisp_Object fun = args[0];
-  Lisp_Object retval;
   USE_SAFE_ALLOCA;
 
-  CHECK_LIST (spread_arg);
-
-  numargs = XFIXNUM (Flength (spread_arg));
+  ptrdiff_t numargs = list_length (spread_arg);
 
   if (numargs == 0)
     return Ffuncall (nargs - 1, args);
@@ -2476,7 +2458,7 @@ usage: (apply FUNCTION &rest ARGUMENTS)  */)
       spread_arg = XCDR (spread_arg);
     }
 
-  retval = Ffuncall (funcall_nargs, funcall_args);
+  Lisp_Object retval = Ffuncall (funcall_nargs, funcall_args);
 
   SAFE_FREE ();
   return retval;
@@ -2974,25 +2956,22 @@ funcall_subr (struct Lisp_Subr *subr, ptrdiff_t 
numargs, Lisp_Object *args)
 static Lisp_Object
 apply_lambda (Lisp_Object fun, Lisp_Object args, ptrdiff_t count)
 {
-  Lisp_Object args_left;
-  ptrdiff_t i;
-  EMACS_INT numargs;
   Lisp_Object *arg_vector;
   Lisp_Object tem;
   USE_SAFE_ALLOCA;
 
-  numargs = XFIXNAT (Flength (args));
+  ptrdiff_t numargs = list_length (args);
   SAFE_ALLOCA_LISP (arg_vector, numargs);
-  args_left = args;
+  Lisp_Object args_left = args;
 
-  for (i = 0; i < numargs; )
+  for (ptrdiff_t i = 0; i < numargs; i++)
     {
       tem = Fcar (args_left), args_left = Fcdr (args_left);
       tem = eval_sub (tem);
-      arg_vector[i++] = tem;
+      arg_vector[i] = tem;
     }
 
-  set_backtrace_args (specpdl + count, arg_vector, i);
+  set_backtrace_args (specpdl + count, arg_vector, numargs);
   tem = funcall_lambda (fun, numargs, arg_vector);
 
   check_cons_list ();
@@ -3705,7 +3684,7 @@ backtrace_frame_apply (Lisp_Object function, union 
specbinding *pdl)
 
   Lisp_Object flags = Qnil;
   if (backtrace_debug_on_exit (pdl))
-    flags = Fcons (QCdebug_on_exit, Fcons (Qt, Qnil));
+    flags = list2 (QCdebug_on_exit, Qt);
 
   if (backtrace_nargs (pdl) == UNEVALLED)
     return call4 (function, Qnil, backtrace_function (pdl), *backtrace_args 
(pdl), flags);
@@ -4008,7 +3987,7 @@ mark_specpdl (union specbinding *first, union specbinding 
*ptr)
   for (pdl = first; pdl != ptr; pdl++)
     {
       switch (pdl->kind)
-       {
+        {
        case SPECPDL_UNWIND:
          mark_object (specpdl_arg (pdl));
          break;
@@ -4045,7 +4024,7 @@ mark_specpdl (union specbinding *first, union specbinding 
*ptr)
 
        case SPECPDL_UNWIND_PTR:
        case SPECPDL_UNWIND_INT:
-       case SPECPDL_UNWIND_VOID:
+        case SPECPDL_UNWIND_VOID:
          break;
 
        default:
@@ -4231,8 +4210,6 @@ alist of active lexical bindings.  */);
   staticpro (&Vsignaling_function);
   Vsignaling_function = Qnil;
 
-  inhibit_lisp_code = Qnil;
-
   DEFSYM (Qcatch_all_memory_full, "catch-all-memory-full");
   Funintern (Qcatch_all_memory_full, Qnil);
 
diff --git a/src/fileio.c b/src/fileio.c
index 7fb8658..4ee125d 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -1,6 +1,6 @@
 /* File IO for GNU Emacs.
 
-Copyright (C) 1985-1988, 1993-2018 Free Software Foundation, Inc.
+Copyright (C) 1985-1988, 1993-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -96,6 +96,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <acl.h>
 #include <allocator.h>
 #include <careadlinkat.h>
+#include <dosname.h>
 #include <fsusage.h>
 #include <stat-time.h>
 #include <tempname.h>
@@ -346,7 +347,7 @@ Given a Unix syntax file name, returns a string ending in 
slash.  */)
   CHECK_STRING (filename);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (filename, Qfile_name_directory);
   if (!NILP (handler))
     {
@@ -441,7 +442,7 @@ or the entire name if it contains no slash.  */)
   CHECK_STRING (filename);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (filename, Qfile_name_nondirectory);
   if (!NILP (handler))
     {
@@ -472,7 +473,7 @@ DEFUN ("unhandled-file-name-directory", 
Funhandled_file_name_directory,
        Sunhandled_file_name_directory, 1, 1, 0,
        doc: /* Return a directly usable directory name somehow associated with 
FILENAME.
 A `directly usable' directory name is one that may be used without the
-intervention of any file handler.
+intervention of any file name handler.
 If FILENAME is a directly usable file itself, return
 \(file-name-as-directory FILENAME).
 If FILENAME refers to a file which is not accessible from a local process,
@@ -484,7 +485,7 @@ get a current directory to run processes in.  */)
   Lisp_Object handler;
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (filename, Qunhandled_file_name_directory);
   if (!NILP (handler))
     {
@@ -546,7 +547,7 @@ is already present.  */)
   CHECK_STRING (file);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (file, Qfile_name_as_directory);
   if (!NILP (handler))
     {
@@ -637,7 +638,7 @@ In Unix-syntax, this function just removes the final slash. 
 */)
   CHECK_STRING (directory);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (directory, Qdirectory_file_name);
   if (!NILP (handler))
     {
@@ -789,7 +790,7 @@ the root directory.  */)
   CHECK_STRING (name);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (name, Qexpand_file_name);
   if (!NILP (handler))
     {
@@ -1093,23 +1094,11 @@ the root directory.  */)
        {
          Lisp_Object tem;
 
-         if (!(newdir = egetenv ("HOME")))
-           newdir = newdirlim = "";
+         newdir = get_homedir ();
          nm++;
-#ifdef WINDOWSNT
-         if (newdir[0])
-           {
-             char newdir_utf8[MAX_UTF8_PATH];
-
-             filename_from_ansi (newdir, newdir_utf8);
-             tem = make_unibyte_string (newdir_utf8, strlen (newdir_utf8));
-             newdir = SSDATA (tem);
-           }
-         else
-#endif
-           tem = build_string (newdir);
+         tem = build_string (newdir);
          newdirlim = newdir + SBYTES (tem);
-         /* `egetenv' may return a unibyte string, which will bite us
+         /* get_homedir may return a unibyte string, which will bite us
             if we expect the directory to be multibyte.  */
          if (multibyte && !STRING_MULTIBYTE (tem))
            {
@@ -1458,7 +1447,7 @@ the root directory.  */)
   }
 
   /* Again look to see if the file name has special constructs in it
-     and perhaps call the corresponding file handler.  This is needed
+     and perhaps call the corresponding file name handler.  This is needed
      for filenames such as "/foo/../address@hidden:/bar/../baz".  Expanding
      the ".." component gives us "/address@hidden:/bar/../baz" which needs
      to be expanded again.  */
@@ -1637,8 +1626,7 @@ See also the function `substitute-in-file-name'.")
 }
 #endif
 
-/* If /~ or // appears, discard everything through first slash.  */
-static bool
+bool
 file_name_absolute_p (const char *filename)
 {
   return
@@ -1650,6 +1638,102 @@ file_name_absolute_p (const char *filename)
      );
 }
 
+/* Put into BUF the concatenation of DIR and FILE, with an intervening
+   directory separator if needed.  Return a pointer to the NUL byte
+   at the end of the concatenated string.  */
+char *
+splice_dir_file (char *buf, char const *dir, char const *file)
+{
+  char *e = stpcpy (buf, dir);
+  *e = DIRECTORY_SEP;
+  e += ! (buf < e && IS_DIRECTORY_SEP (e[-1]));
+  return stpcpy (e, file);
+}
+
+/* Get the home directory, an absolute file name.  Return the empty
+   string on failure.  The returned value does not survive garbage
+   collection, calls to this function, or calls to the getpwnam class
+   of functions.  */
+char const *
+get_homedir (void)
+{
+  char const *home = egetenv ("HOME");
+
+#ifdef WINDOWSNT
+  /* getpw* functions return UTF-8 encoded file names, whereas egetenv
+     returns strings in locale encoding, so we need to convert for
+     consistency.  */
+  static char homedir_utf8[MAX_UTF8_PATH];
+  if (home)
+    {
+      filename_from_ansi (home, homedir_utf8);
+      home = homedir_utf8;
+    }
+#endif
+
+  if (!home)
+    {
+      static char const *userenv[] = {"LOGNAME", "USER"};
+      struct passwd *pw = NULL;
+      for (int i = 0; i < ARRAYELTS (userenv); i++)
+       {
+         char *user = egetenv (userenv[i]);
+         if (user)
+           {
+             pw = getpwnam (user);
+             if (pw)
+               break;
+           }
+       }
+      if (!pw)
+       pw = getpwuid (getuid ());
+      if (pw)
+       home = pw->pw_dir;
+      if (!home)
+       return "";
+    }
+#ifdef DOS_NT
+  /* If home is a drive-relative directory, expand it.  */
+  if (IS_DRIVE (*home)
+      && IS_DEVICE_SEP (home[1])
+      && !IS_DIRECTORY_SEP (home[2]))
+    {
+# ifdef WINDOWSNT
+      static char hdir[MAX_UTF8_PATH];
+# else
+      static char hdir[MAXPATHLEN];
+# endif
+      if (!getdefdir (c_toupper (*home) - 'A' + 1, hdir))
+       {
+         hdir[0] = c_toupper (*home);
+         hdir[1] = ':';
+         hdir[2] = '/';
+         hdir[3] = '\0';
+       }
+      if (home[2])
+       {
+         size_t homelen = strlen (hdir);
+         if (!IS_DIRECTORY_SEP (hdir[homelen - 1]))
+           strcat (hdir, "/");
+         strcat (hdir, home + 2);
+       }
+      home = hdir;
+    }
+#endif
+  if (IS_ABSOLUTE_FILE_NAME (home))
+    return home;
+  if (!emacs_wd)
+    error ("$HOME is relative to unknown directory");
+  static char *ahome;
+  static ptrdiff_t ahomesize;
+  ptrdiff_t ahomelenbound = strlen (emacs_wd) + 1 + strlen (home) + 1;
+  if (ahomesize <= ahomelenbound)
+    ahome = xpalloc (ahome, &ahomesize, ahomelenbound + 1 - ahomesize, -1, 1);
+  splice_dir_file (ahome, emacs_wd, home);
+  return ahome;
+}
+
+/* If /~ or // appears, discard everything through first slash.  */
 static char *
 search_embedded_absfilename (char *nm, char *endp)
 {
@@ -1716,7 +1800,7 @@ those `/' is discarded.  */)
   multibyte = STRING_MULTIBYTE (filename);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (filename, Qsubstitute_in_file_name);
   if (!NILP (handler))
     {
@@ -1930,7 +2014,7 @@ permissions.  */)
   newname = expand_cp_target (file, newname);
 
   /* If the input file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (file, Qcopy_file);
   /* Likewise for output file name.  */
   if (NILP (handler))
@@ -2291,7 +2375,7 @@ The arg must be a string.  */)
   filename = Fexpand_file_name (filename, Qnil);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (filename, Qfile_name_case_insensitive_p);
   if (!NILP (handler))
     return call2 (handler, Qfile_name_case_insensitive_p, filename);
@@ -2352,7 +2436,7 @@ This is what happens in interactive use with M-x.  */)
     newname = expand_cp_target (Fdirectory_file_name (file), newname);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (file, Qrename_file);
   if (NILP (handler))
     handler = Ffind_file_name_handler (newname, Qrename_file);
@@ -2454,14 +2538,14 @@ This is what happens in interactive use with M-x.  */)
   newname = expand_cp_target (file, newname);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (file, Qadd_name_to_file);
   if (!NILP (handler))
     return call4 (handler, Qadd_name_to_file, file,
                  newname, ok_if_already_exists);
 
   /* If the new name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (newname, Qadd_name_to_file);
   if (!NILP (handler))
     return call4 (handler, Qadd_name_to_file, file,
@@ -2514,7 +2598,7 @@ This happens for interactive use with M-x.  */)
   linkname = expand_cp_target (target, linkname);
 
   /* If the new link name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (linkname, Qmake_symbolic_link);
   if (!NILP (handler))
     return call4 (handler, Qmake_symbolic_link, target,
@@ -2569,7 +2653,7 @@ Use `file-symlink-p' to test for such links.  */)
   absname = Fexpand_file_name (filename, Qnil);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (absname, Qfile_exists_p);
   if (!NILP (handler))
     {
@@ -2597,7 +2681,7 @@ purpose, though.)  */)
   absname = Fexpand_file_name (filename, Qnil);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (absname, Qfile_executable_p);
   if (!NILP (handler))
     return call2 (handler, Qfile_executable_p, absname);
@@ -2619,7 +2703,7 @@ See also `file-exists-p' and `file-attributes'.  */)
   absname = Fexpand_file_name (filename, Qnil);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (absname, Qfile_readable_p);
   if (!NILP (handler))
     return call2 (handler, Qfile_readable_p, absname);
@@ -2640,7 +2724,7 @@ DEFUN ("file-writable-p", Ffile_writable_p, 
Sfile_writable_p, 1, 1, 0,
   absname = Fexpand_file_name (filename, Qnil);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (absname, Qfile_writable_p);
   if (!NILP (handler))
     return call2 (handler, Qfile_writable_p, absname);
@@ -2682,7 +2766,7 @@ If there is no error, returns nil.  */)
   CHECK_STRING (string);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (absname, Qaccess_file);
   if (!NILP (handler))
     return call3 (handler, Qaccess_file, absname, string);
@@ -2730,7 +2814,7 @@ This function does not check whether the link target 
exists.  */)
   filename = Fexpand_file_name (filename, Qnil);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (filename, Qfile_symlink_p);
   if (!NILP (handler))
     return call2 (handler, Qfile_symlink_p, filename);
@@ -2749,7 +2833,7 @@ See `file-symlink-p' to distinguish symlinks.  */)
   Lisp_Object absname = expand_and_dir_to_file (filename);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   Lisp_Object handler = Ffind_file_name_handler (absname, Qfile_directory_p);
   if (!NILP (handler))
     return call2 (handler, Qfile_directory_p, absname);
@@ -2818,7 +2902,7 @@ really is a readable and searchable directory.  */)
   absname = Fexpand_file_name (filename, Qnil);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (absname, Qfile_accessible_directory_p);
   if (!NILP (handler))
     {
@@ -2909,7 +2993,7 @@ See `file-symlink-p' to distinguish symlinks.  */)
   Lisp_Object absname = expand_and_dir_to_file (filename);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   Lisp_Object handler = Ffind_file_name_handler (absname, Qfile_regular_p);
   if (!NILP (handler))
     return call2 (handler, Qfile_regular_p, absname);
@@ -2952,7 +3036,7 @@ or if SELinux is disabled, or if Emacs lacks SELinux 
support.  */)
   Lisp_Object absname = expand_and_dir_to_file (filename);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   Lisp_Object handler = Ffind_file_name_handler (absname,
                                                 Qfile_selinux_context);
   if (!NILP (handler))
@@ -3014,7 +3098,7 @@ or if Emacs was not compiled with SELinux support.  */)
   absname = Fexpand_file_name (filename, BVAR (current_buffer, directory));
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (absname, Qset_file_selinux_context);
   if (!NILP (handler))
     return call3 (handler, Qset_file_selinux_context, absname, context);
@@ -3084,7 +3168,7 @@ was unable to determine the ACL entries.  */)
   Lisp_Object absname = expand_and_dir_to_file (filename);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   Lisp_Object handler = Ffind_file_name_handler (absname, Qfile_acl);
   if (!NILP (handler))
     return call2 (handler, Qfile_acl, absname);
@@ -3139,7 +3223,7 @@ support.  */)
   absname = Fexpand_file_name (filename, BVAR (current_buffer, directory));
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (absname, Qset_file_acl);
   if (!NILP (handler))
     return call3 (handler, Qset_file_acl, absname, acl_string);
@@ -3181,7 +3265,7 @@ Return nil, if file does not exist or is not accessible.  
*/)
   Lisp_Object absname = expand_and_dir_to_file (filename);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   Lisp_Object handler = Ffind_file_name_handler (absname, Qfile_modes);
   if (!NILP (handler))
     return call2 (handler, Qfile_modes, absname);
@@ -3211,7 +3295,7 @@ symbolic notation, like the `chmod' command from GNU 
Coreutils.  */)
   CHECK_FIXNUM (mode);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (absname, Qset_file_modes);
   if (!NILP (handler))
     return call3 (handler, Qset_file_modes, absname, mode);
@@ -3278,7 +3362,7 @@ Use the current time if TIMESTAMP is nil.  TIMESTAMP is 
in the format of
   absname = Fexpand_file_name (filename, BVAR (current_buffer, directory));
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (absname, Qset_file_times);
   if (!NILP (handler))
     return call3 (handler, Qset_file_times, absname, timestamp);
@@ -3326,7 +3410,7 @@ otherwise, if FILE2 does not exist, the answer is t.  */)
   Lisp_Object absname2 = expand_and_dir_to_file (file2);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   Lisp_Object handler = Ffind_file_name_handler (absname1,
                                                 Qfile_newer_than_file_p);
   if (NILP (handler))
@@ -3602,7 +3686,7 @@ by calling `format-decode', which see.  */)
   coding_system = Qnil;
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (filename, Qinsert_file_contents);
   if (!NILP (handler))
     {
@@ -4534,7 +4618,7 @@ by calling `format-decode', which see.  */)
          ptrdiff_t opoint = PT;
          ptrdiff_t opoint_byte = PT_BYTE;
          ptrdiff_t oinserted = ZV - BEGV;
-         EMACS_INT ochars_modiff = CHARS_MODIFF;
+         modiff_count ochars_modiff = CHARS_MODIFF;
 
          TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
          insval = call3 (Qformat_decode,
@@ -4574,7 +4658,7 @@ by calling `format-decode', which see.  */)
              ptrdiff_t opoint = PT;
              ptrdiff_t opoint_byte = PT_BYTE;
              ptrdiff_t oinserted = ZV - BEGV;
-             EMACS_INT ochars_modiff = CHARS_MODIFF;
+             modiff_count ochars_modiff = CHARS_MODIFF;
 
              TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
              insval = call1 (XCAR (p), make_fixnum (oinserted));
@@ -4770,7 +4854,7 @@ choose_write_coding_system (Lisp_Object start, 
Lisp_Object end, Lisp_Object file
   val = coding_inherit_eol_type (val, eol_parent);
   setup_coding_system (val, coding);
 
-  if (!STRINGP (start) && !NILP (BVAR (current_buffer, selective_display)))
+  if (!STRINGP (start) && EQ (Qt, BVAR (current_buffer, selective_display)))
     coding->mode |= CODING_MODE_SELECTIVE_DISPLAY;
   return val;
 }
@@ -4873,7 +4957,7 @@ write_region (Lisp_Object start, Lisp_Object end, 
Lisp_Object filename,
   annotations = Qnil;
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (filename, Qwrite_region);
   /* If FILENAME has no handler, see if VISIT has one.  */
   if (NILP (handler) && STRINGP (visit))
@@ -5433,7 +5517,7 @@ See Info node `(elisp)Modification Time' for more 
details.  */)
   if (b->modtime.tv_nsec == UNKNOWN_MODTIME_NSECS) return Qt;
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   handler = Ffind_file_name_handler (BVAR (b, filename),
                                     Qverify_visited_file_modtime);
   if (!NILP (handler))
@@ -5499,7 +5583,7 @@ in `current-time' or an integer flag as returned by 
`visited-file-modtime'.  */)
       filename = Fexpand_file_name (BVAR (current_buffer, filename), Qnil);
 
       /* If the file name has special constructs in it,
-        call the corresponding file handler.  */
+        call the corresponding file name handler.  */
       handler = Ffind_file_name_handler (filename, Qset_visited_file_modtime);
       if (!NILP (handler))
        /* The handler can find the file name the same way we did.  */
@@ -5622,8 +5706,9 @@ A non-nil CURRENT-ONLY argument means save only current 
buffer.  */)
   bool old_message_p = 0;
   struct auto_save_unwind auto_save_unwind;
 
-  if (max_specpdl_size < specpdl_size + 40)
-    max_specpdl_size = specpdl_size + 40;
+  intmax_t sum = INT_ADD_WRAPV (specpdl_size, 40, &sum) ? INTMAX_MAX : sum;
+  if (max_specpdl_size < sum)
+    max_specpdl_size = sum;
 
   if (minibuf_level)
     no_message = Qt;
@@ -5917,7 +6002,7 @@ If the underlying system call fails, value is nil.  */)
   Lisp_Object encoded = ENCODE_FILE (Fexpand_file_name (filename, Qnil));
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   Lisp_Object handler = Ffind_file_name_handler (encoded, Qfile_system_info);
   if (!NILP (handler))
     {
diff --git a/src/filelock.c b/src/filelock.c
index d33063c..5cec199 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -1,6 +1,6 @@
 /* Lock files for editing.
 
-Copyright (C) 1985-1987, 1993-1994, 1996, 1998-2018 Free Software
+Copyright (C) 1985-1987, 1993-1994, 1996, 1998-2019 Free Software
 Foundation, Inc.
 
 Author: Richard King
@@ -171,13 +171,10 @@ get_boot_time (void)
     }
 
 #if defined (BOOT_TIME)
-#ifndef CANNOT_DUMP
-  /* The utmp routines maintain static state.
-     Don't touch that state unless we are initialized,
-     since it might not survive dumping.  */
-  if (! initialized)
+  /* The utmp routines maintain static state.  Don't touch that state
+     if we are going to dump, since it might not survive dumping.  */
+  if (will_dump_p ())
     return boot_time;
-#endif /* not CANNOT_DUMP */
 
   /* Try to get boot time from utmp before wtmp,
      since utmp is typically much smaller than wtmp.
@@ -299,7 +296,7 @@ typedef struct
 
 /* Write the name of the lock file for FNAME into LOCKNAME.  Length
    will be that of FNAME plus two more for the leading ".#", plus one
-   for the null.  */
+   for the NUL.  */
 #define MAKE_LOCK_NAME(lockname, fname) \
   (lockname = SAFE_ALLOCA (SBYTES (fname) + 2 + 1), \
    fill_in_lock_file_name (lockname, fname))
@@ -666,7 +663,7 @@ lock_file (Lisp_Object fn)
   /* Don't do locking while dumping Emacs.
      Uncompressing wtmp files uses call-process, which does not work
      in an uninitialized Emacs.  */
-  if (! NILP (Vpurify_flag))
+  if (will_dump_p ())
     return;
 
   orig_fn = fn;
diff --git a/nt/inc/nl_types.h b/src/fingerprint-dummy.c
similarity index 67%
copy from nt/inc/nl_types.h
copy to src/fingerprint-dummy.c
index 38082d9..1603519 100644
--- a/nt/inc/nl_types.h
+++ b/src/fingerprint-dummy.c
@@ -1,6 +1,6 @@
-/* Replacement nl_types.h file for building GNU Emacs on Windows.
+/* Dummy fingerprint
 
-Copyright (C) 2006-2018 Free Software Foundation, Inc.
+Copyright (C) 2016, 2018-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -15,11 +15,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#ifndef _NL_TYPES_H
-#define _NL_TYPES_H
+#include "fingerprint.h"
 
-typedef int nl_item;
-
-#endif /* _NL_TYPES_H */
+/* Dummy fingerprint to use as hash input.  */
+const uint8_t fingerprint[32] = { 0 };
diff --git a/src/mini-gmp-emacs.c b/src/fingerprint.h
similarity index 53%
copy from src/mini-gmp-emacs.c
copy to src/fingerprint.h
index 7a1b7ab..913b668 100644
--- a/src/mini-gmp-emacs.c
+++ b/src/fingerprint.h
@@ -1,6 +1,6 @@
-/* Tailor mini-gmp.c for GNU Emacs
+/* Header file for the Emacs build fingerprint.
 
-Copyright 2018 Free Software Foundation, Inc.
+Copyright (C) 2016, 2018-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -15,18 +15,17 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See 
the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#include <config.h>
+#ifndef EMACS_FINGERPRINT_H
+#define EMACS_FINGERPRINT_H
 
-#include <stddef.h>
+#include <stdint.h>
 
-/* Pacify GCC -Wsuggest-attribute=malloc.  */
-static void *gmp_default_alloc (size_t) ATTRIBUTE_MALLOC;
+/* We generate fingerprint.c and fingerprint.o from all the sources in
+   Emacs.  This way, we have a unique value that we can use to pair
+   data files (like a portable dump image) with a specific build of
+   Emacs.  */
+extern const uint8_t fingerprint[32];
 
-/* Pacify GCC -Wunused-variable for variables used only in 'assert' calls.  */
-#if defined NDEBUG && GNUC_PREREQ (4, 6, 0)
-# pragma GCC diagnostic ignored "-Wunused-variable"
 #endif
-
-#include "mini-gmp.c"
diff --git a/src/firstfile.c b/src/firstfile.c
index b0dd30c..f1cb418 100644
--- a/src/firstfile.c
+++ b/src/firstfile.c
@@ -1,5 +1,5 @@
 /* Mark beginning of data space to dump as pure, for GNU Emacs.
-   Copyright (C) 1997, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1997, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/floatfns.c b/src/floatfns.c
index 9003925..a913aad 100644
--- a/src/floatfns.c
+++ b/src/floatfns.c
@@ -1,6 +1,6 @@
 /* Primitive operations on floating point for GNU Emacs Lisp interpreter.
 
-Copyright (C) 1988, 1993-1994, 1999, 2001-2018 Free Software Foundation,
+Copyright (C) 1988, 1993-1994, 1999, 2001-2019 Free Software Foundation,
 Inc.
 
 Author: Wolfgang Rupprecht (according to ack.texi)
@@ -306,27 +306,22 @@ This is the same as the exponent of a float.  */)
   if (FLOATP (arg))
     {
       double f = XFLOAT_DATA (arg);
-
       if (f == 0)
-       value = MOST_NEGATIVE_FIXNUM;
-      else if (isfinite (f))
-       {
-         int ivalue;
-         frexp (f, &ivalue);
-         value = ivalue - 1;
-       }
-      else
-       value = MOST_POSITIVE_FIXNUM;
+       return make_float (-HUGE_VAL);
+      if (!isfinite (f))
+       return f < 0 ? make_float (-f) : arg;
+      int ivalue;
+      frexp (f, &ivalue);
+      value = ivalue - 1;
     }
-  else if (BIGNUMP (arg))
+  else if (!FIXNUMP (arg))
     value = mpz_sizeinbase (XBIGNUM (arg)->value, 2) - 1;
   else
     {
-      eassert (FIXNUMP (arg));
-      EMACS_INT i = eabs (XFIXNUM (arg));
-      value = (i == 0
-              ? MOST_NEGATIVE_FIXNUM
-              : EMACS_UINT_WIDTH - 1 - ecount_leading_zeros (i));
+      EMACS_INT i = XFIXNUM (arg);
+      if (i == 0)
+       return make_float (-HUGE_VAL);
+      value = EMACS_UINT_WIDTH - 1 - ecount_leading_zeros (eabs (i));
     }
 
   return make_fixnum (value);
diff --git a/src/fns.c b/src/fns.c
index b5bf6ae..b2810b5 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1,6 +1,6 @@
 /* Random utility Lisp functions.
 
-Copyright (C) 1985-1987, 1993-1995, 1997-2018 Free Software Foundation,
+Copyright (C) 1985-1987, 1993-1995, 1997-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -91,56 +91,60 @@ See Info node `(elisp)Random Numbers' for more details.  */)
 
 /* Random data-structure functions.  */
 
+/* Return LIST's length.  Signal an error if LIST is not a proper list.  */
+
+ptrdiff_t
+list_length (Lisp_Object list)
+{
+  intptr_t i = 0;
+  FOR_EACH_TAIL (list)
+    i++;
+  CHECK_LIST_END (list, list);
+  return i;
+}
+
+
 DEFUN ("length", Flength, Slength, 1, 1, 0,
        doc: /* Return the length of vector, list or string SEQUENCE.
 A byte-code function object is also allowed.
 If the string contains multibyte characters, this is not necessarily
 the number of bytes in the string; it is the number of characters.
 To get the number of bytes, use `string-bytes'.  */)
-  (register Lisp_Object sequence)
+  (Lisp_Object sequence)
 {
-  register Lisp_Object val;
+  EMACS_INT val;
 
   if (STRINGP (sequence))
-    XSETFASTINT (val, SCHARS (sequence));
+    val = SCHARS (sequence);
   else if (VECTORP (sequence))
-    XSETFASTINT (val, ASIZE (sequence));
+    val = ASIZE (sequence);
   else if (CHAR_TABLE_P (sequence))
-    XSETFASTINT (val, MAX_CHAR);
+    val = MAX_CHAR;
   else if (BOOL_VECTOR_P (sequence))
-    XSETFASTINT (val, bool_vector_size (sequence));
+    val = bool_vector_size (sequence);
   else if (COMPILEDP (sequence) || RECORDP (sequence))
-    XSETFASTINT (val, PVSIZE (sequence));
+    val = PVSIZE (sequence);
   else if (CONSP (sequence))
-    {
-      intptr_t i = 0;
-      FOR_EACH_TAIL (sequence)
-       i++;
-      CHECK_LIST_END (sequence, sequence);
-      if (MOST_POSITIVE_FIXNUM < i)
-       error ("List too long");
-      val = make_fixnum (i);
-    }
+    val = list_length (sequence);
   else if (NILP (sequence))
-    XSETFASTINT (val, 0);
+    val = 0;
   else
     wrong_type_argument (Qsequencep, sequence);
 
-  return val;
+  return make_fixnum (val);
 }
 
 DEFUN ("safe-length", Fsafe_length, Ssafe_length, 1, 1, 0,
        doc: /* Return the length of a list, but avoid error or infinite loop.
 This function never gets an error.  If LIST is not really a list,
 it returns 0.  If LIST is circular, it returns an integer that is at
-least the number of distinct elements.
-Value is a fixnum, if it's small enough, otherwise a bignum.  */)
+least the number of distinct elements.  */)
   (Lisp_Object list)
 {
   intptr_t len = 0;
   FOR_EACH_TAIL_SAFE (list)
     len++;
-  return INT_TO_INTEGER (len);
+  return make_fixnum (len);
 }
 
 DEFUN ("proper-list-p", Fproper_list_p, Sproper_list_p, 1, 1, 0,
@@ -160,8 +164,6 @@ A proper list is neither circular nor dotted (i.e., its 
last cdr is nil).  */
     }
   if (!NILP (last_tail))
     return Qnil;
-  if (MOST_POSITIVE_FIXNUM < len)
-    xsignal0 (Qoverflow_error);
   return make_fixnum (len);
 }
 
@@ -410,7 +412,7 @@ Symbols are also allowed; their print names are used 
instead.  */)
 
   while ((cmp = filevercmp (p1, p2)) == 0)
     {
-      /* If the strings are identical through their first null bytes,
+      /* If the strings are identical through their first NUL bytes,
         skip past identical prefixes and try again.  */
       ptrdiff_t size = strlen (p1) + 1;
       p1 += size;
@@ -732,7 +734,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args,
   if (target_type == Lisp_Cons)
     val = Fmake_list (make_fixnum (result_len), Qnil);
   else if (target_type == Lisp_Vectorlike)
-    val = Fmake_vector (make_fixnum (result_len), Qnil);
+    val = make_nil_vector (result_len);
   else if (some_multibyte)
     val = make_uninit_multibyte_string (result_len, result_len_byte);
   else
@@ -1957,24 +1959,15 @@ See also the function `nreverse', which is used more 
often.  */)
 static Lisp_Object
 sort_list (Lisp_Object list, Lisp_Object predicate)
 {
-  Lisp_Object front, back;
-  Lisp_Object len, tem;
-  EMACS_INT length;
-
-  front = list;
-  len = Flength (list);
-  length = XFIXNUM (len);
+  ptrdiff_t length = list_length (list);
   if (length < 2)
     return list;
 
-  XSETINT (len, (length / 2) - 1);
-  tem = Fnthcdr (len, list);
-  back = Fcdr (tem);
+  Lisp_Object tem = Fnthcdr (make_fixnum (length / 2 - 1), list);
+  Lisp_Object back = Fcdr (tem);
   Fsetcdr (tem, Qnil);
 
-  front = Fsort (front, predicate);
-  back = Fsort (back, predicate);
-  return merge (front, back, predicate);
+  return merge (Fsort (list, predicate), Fsort (back, predicate), predicate);
 }
 
 /* Using PRED to compare, return whether A and B are in order.
@@ -2090,7 +2083,7 @@ the second.  */)
   else if (VECTORP (seq))
     sort_vector (seq, predicate);
   else if (!NILP (seq))
-    wrong_type_argument (Qsequencep, seq);
+    wrong_type_argument (Qlist_or_vector_p, seq);
   return seq;
 }
 
@@ -2962,7 +2955,7 @@ suppressed.  */)
 
       /* This is to make sure that loadup.el gives a clear picture
         of what files are preloaded and when.  */
-      if (! NILP (Vpurify_flag))
+      if (will_dump_p () && !will_bootstrap_p ())
        error ("(require %s) while preparing to dump",
               SDATA (SYMBOL_NAME (feature)));
 
@@ -3113,8 +3106,9 @@ ITEM should be one of the following:
 
 `months', returning a 12-element vector of month names (locale items MON_n);
 
-`paper', returning a list (WIDTH HEIGHT) for the default paper size,
-  both measured in millimeters (locale items PAPER_WIDTH, PAPER_HEIGHT).
+`paper', returning a list of 2 integers (WIDTH HEIGHT) for the default
+  paper size, both measured in millimeters (locale items _NL_PAPER_WIDTH,
+  _NL_PAPER_HEIGHT).
 
 If the system can't provide such information through a call to
 `nl_langinfo', or if ITEM isn't from the list above, return nil.
@@ -3131,10 +3125,10 @@ The data read from the system are decoded using 
`locale-coding-system'.  */)
       str = nl_langinfo (CODESET);
       return build_string (str);
     }
-#ifdef DAY_1
-  else if (EQ (item, Qdays))   /* e.g. for calendar-day-name-array */
+# ifdef DAY_1
+  if (EQ (item, Qdays))  /* E.g., for calendar-day-name-array.  */
     {
-      Lisp_Object v = Fmake_vector (make_fixnum (7), Qnil);
+      Lisp_Object v = make_nil_vector (7);
       const int days[7] = {DAY_1, DAY_2, DAY_3, DAY_4, DAY_5, DAY_6, DAY_7};
       int i;
       synchronize_system_time_locale ();
@@ -3149,16 +3143,15 @@ The data read from the system are decoded using 
`locale-coding-system'.  */)
        }
       return v;
     }
-#endif /* DAY_1 */
-#ifdef MON_1
-  else if (EQ (item, Qmonths)) /* e.g. for calendar-month-name-array */
+# endif
+# ifdef MON_1
+  if (EQ (item, Qmonths))  /* E.g., for calendar-month-name-array.  */
     {
-      Lisp_Object v = Fmake_vector (make_fixnum (12), Qnil);
+      Lisp_Object v = make_nil_vector (12);
       const int months[12] = {MON_1, MON_2, MON_3, MON_4, MON_5, MON_6, MON_7,
                              MON_8, MON_9, MON_10, MON_11, MON_12};
-      int i;
       synchronize_system_time_locale ();
-      for (i = 0; i < 12; i++)
+      for (int i = 0; i < 12; i++)
        {
          str = nl_langinfo (months[i]);
          AUTO_STRING (val, str);
@@ -3167,13 +3160,12 @@ The data read from the system are decoded using 
`locale-coding-system'.  */)
        }
       return v;
     }
-#endif /* MON_1 */
-/* LC_PAPER stuff isn't defined as accessible in glibc as of 2.3.1,
-   but is in the locale files.  This could be used by ps-print.  */
-#ifdef PAPER_WIDTH
-  else if (EQ (item, Qpaper))
-    return list2i (nl_langinfo (PAPER_WIDTH), nl_langinfo (PAPER_HEIGHT));
-#endif /* PAPER_WIDTH */
+# endif
+# ifdef HAVE_LANGINFO__NL_PAPER_WIDTH
+  if (EQ (item, Qpaper))
+    return list2i ((intptr_t) nl_langinfo (_NL_PAPER_WIDTH),
+                  (intptr_t) nl_langinfo (_NL_PAPER_HEIGHT));
+# endif
 #endif /* HAVE_LANGINFO_CODESET*/
   return Qnil;
 }
@@ -3662,10 +3654,6 @@ base64_decode_1 (const char *from, char *to, ptrdiff_t 
length,
    if a `:linear-search t' argument is given to make-hash-table.  */
 
 
-/* The list of all weak hash tables.  Don't staticpro this one.  */
-
-static struct Lisp_Hash_Table *weak_hash_tables;
-
 
 /***********************************************************************
                               Utilities
@@ -3880,7 +3868,7 @@ hashfn_eq (struct hash_table_test *ht, Lisp_Object key)
    `equal' to compare keys.  The hash code returned is guaranteed to fit
    in a Lisp integer.  */
 
-static EMACS_UINT
+EMACS_UINT
 hashfn_equal (struct hash_table_test *ht, Lisp_Object key)
 {
   return sxhash (key, 0);
@@ -3890,7 +3878,7 @@ hashfn_equal (struct hash_table_test *ht, Lisp_Object key)
    `eql' to compare keys.  The hash code returned is guaranteed to fit
    in a Lisp integer.  */
 
-static EMACS_UINT
+EMACS_UINT
 hashfn_eql (struct hash_table_test *ht, Lisp_Object key)
 {
   return ((FLOATP (key) || BIGNUMP (key))
@@ -3994,10 +3982,11 @@ make_hash_table (struct hash_table_test test, EMACS_INT 
size,
   h->rehash_threshold = rehash_threshold;
   h->rehash_size = rehash_size;
   h->count = 0;
-  h->key_and_value = Fmake_vector (make_fixnum (2 * size), Qnil);
-  h->hash = Fmake_vector (make_fixnum (size), Qnil);
-  h->next = Fmake_vector (make_fixnum (size), make_fixnum (-1));
-  h->index = Fmake_vector (make_fixnum (index_size), make_fixnum (-1));
+  h->key_and_value = make_nil_vector (2 * size);
+  h->hash = make_nil_vector (size);
+  h->next = make_vector (size, make_fixnum (-1));
+  h->index = make_vector (index_size, make_fixnum (-1));
+  h->next_weak = NULL;
   h->pure = pure;
 
   /* Set up the free list.  */
@@ -4009,13 +3998,6 @@ make_hash_table (struct hash_table_test test, EMACS_INT 
size,
   eassert (HASH_TABLE_P (table));
   eassert (XHASH_TABLE (table) == h);
 
-  /* Maybe add this hash table to the list of all weak hash tables.  */
-  if (! NILP (weak))
-    {
-      h->next_weak = weak_hash_tables;
-      weak_hash_tables = h;
-    }
-
   return table;
 }
 
@@ -4037,13 +4019,6 @@ copy_hash_table (struct Lisp_Hash_Table *h1)
   h2->index = Fcopy_sequence (h1->index);
   XSET_HASH_TABLE (table, h2);
 
-  /* Maybe add this hash table to the list of all weak hash tables.  */
-  if (!NILP (h2->weak))
-    {
-      h2->next_weak = h1->next_weak;
-      h1->next_weak = h2;
-    }
-
   return table;
 }
 
@@ -4092,8 +4067,7 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
       set_hash_key_and_value (h, larger_vector (h->key_and_value,
                                                2 * (new_size - old_size), -1));
       set_hash_hash (h, larger_vector (h->hash, new_size - old_size, -1));
-      set_hash_index (h, Fmake_vector (make_fixnum (index_size),
-                                      make_fixnum (-1)));
+      set_hash_index (h, make_vector (index_size, make_fixnum (-1)));
       set_hash_next (h, larger_vecalloc (h->next, new_size - old_size, -1));
 
       /* Update the free list.  Do it so that new entries are added at
@@ -4130,6 +4104,43 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h)
     }
 }
 
+void
+hash_table_rehash (struct Lisp_Hash_Table *h)
+{
+  ptrdiff_t size = HASH_TABLE_SIZE (h);
+
+  /* Recompute the actual hash codes for each entry in the table.
+     Order is still invalid.  */
+  for (ptrdiff_t i = 0; i < size; ++i)
+    if (!NILP (HASH_HASH (h, i)))
+      {
+        Lisp_Object key = HASH_KEY (h, i);
+        EMACS_UINT hash_code = h->test.hashfn (&h->test, key);
+        set_hash_hash_slot (h, i, make_fixnum (hash_code));
+      }
+
+  /* Reset the index so that any slot we don't fill below is marked
+     invalid.  */
+  Ffillarray (h->index, make_fixnum (-1));
+
+  /* Rebuild the collision chains.  */
+  for (ptrdiff_t i = 0; i < size; ++i)
+    if (!NILP (HASH_HASH (h, i)))
+      {
+        EMACS_UINT hash_code = XUFIXNUM (HASH_HASH (h, i));
+        ptrdiff_t start_of_bucket = hash_code % ASIZE (h->index);
+        set_hash_next_slot (h, i, HASH_INDEX (h, start_of_bucket));
+        set_hash_index_slot (h, start_of_bucket, i);
+        eassert (HASH_NEXT (h, i) != i); /* Stop loops.  */
+      }
+
+  /* Finally, mark the hash table as having a valid hash order.
+     Do this last so that if we're interrupted, we retry on next
+     access. */
+  eassert (h->count < 0);
+  h->count = -h->count;
+  eassert (!hash_rehash_needed_p (h));
+}
 
 /* Lookup KEY in hash table H.  If HASH is non-null, return in *HASH
    the hash code of KEY.  Value is the index of the entry in H
@@ -4143,6 +4154,8 @@ hash_lookup (struct Lisp_Hash_Table *h, Lisp_Object key, 
EMACS_UINT *hash)
 
   if (SYMBOL_WITH_POS_P (key))
       key = SYMBOL_WITH_POS_SYM (key);
+  hash_rehash_if_needed (h);
+
   hash_code = h->test.hashfn (&h->test, key);
   eassert ((hash_code & ~INTMASK) == 0);
   if (hash)
@@ -4171,6 +4184,8 @@ hash_put (struct Lisp_Hash_Table *h, Lisp_Object key, 
Lisp_Object value,
 {
   ptrdiff_t start_of_bucket, i;
 
+  hash_rehash_if_needed (h);
+
   eassert ((hash & ~INTMASK) == 0);
 
   /* Increment count after resizing because resizing may fail.  */
@@ -4204,6 +4219,8 @@ hash_remove_from_table (struct Lisp_Hash_Table *h, 
Lisp_Object key)
   ptrdiff_t start_of_bucket = hash_code % ASIZE (h->index);
   ptrdiff_t prev = -1;
 
+  hash_rehash_if_needed (h);
+
   for (ptrdiff_t i = HASH_INDEX (h, start_of_bucket);
        0 <= i;
        i = HASH_NEXT (h, i))
@@ -4272,7 +4289,7 @@ hash_clear (struct Lisp_Hash_Table *h)
    !REMOVE_ENTRIES_P means mark entries that are in use.  Value is
    true if anything was marked.  */
 
-static bool
+bool
 sweep_weak_table (struct Lisp_Hash_Table *h, bool remove_entries_p)
 {
   ptrdiff_t n = gc_asize (h->index);
@@ -4280,12 +4297,14 @@ sweep_weak_table (struct Lisp_Hash_Table *h, bool 
remove_entries_p)
 
   for (ptrdiff_t bucket = 0; bucket < n; ++bucket)
     {
-      /* Follow collision chain, removing entries that
-        don't survive this garbage collection.  */
+      /* Follow collision chain, removing entries that don't survive
+         this garbage collection.  It's okay if hash_rehash_needed_p
+         (h) is true, since we're operating entirely on the cached
+         hash values. */
       ptrdiff_t prev = -1;
       ptrdiff_t next;
       for (ptrdiff_t i = HASH_INDEX (h, bucket); 0 <= i; i = next)
-       {
+        {
          bool key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i));
          bool value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i));
          bool remove_p;
@@ -4320,10 +4339,11 @@ sweep_weak_table (struct Lisp_Hash_Table *h, bool 
remove_entries_p)
                  /* Clear key, value, and hash.  */
                  set_hash_key_slot (h, i, Qnil);
                  set_hash_value_slot (h, i, Qnil);
-                 set_hash_hash_slot (h, i, Qnil);
+                  set_hash_hash_slot (h, i, Qnil);
 
-                 h->count--;
-               }
+                  eassert (h->count != 0);
+                  h->count += h->count > 0 ? -1 : 1;
+                }
              else
                {
                  prev = i;
@@ -4337,13 +4357,13 @@ sweep_weak_table (struct Lisp_Hash_Table *h, bool 
remove_entries_p)
                  if (!key_known_to_survive_p)
                    {
                      mark_object (HASH_KEY (h, i));
-                     marked = 1;
+                      marked = true;
                    }
 
                  if (!value_known_to_survive_p)
                    {
                      mark_object (HASH_VALUE (h, i));
-                     marked = 1;
+                      marked = true;
                    }
                }
            }
@@ -4353,55 +4373,6 @@ sweep_weak_table (struct Lisp_Hash_Table *h, bool 
remove_entries_p)
   return marked;
 }
 
-/* Remove elements from weak hash tables that don't survive the
-   current garbage collection.  Remove weak tables that don't survive
-   from Vweak_hash_tables.  Called from gc_sweep.  */
-
-NO_INLINE /* For better stack traces */
-void
-sweep_weak_hash_tables (void)
-{
-  struct Lisp_Hash_Table *h, *used, *next;
-  bool marked;
-
-  /* Mark all keys and values that are in use.  Keep on marking until
-     there is no more change.  This is necessary for cases like
-     value-weak table A containing an entry X -> Y, where Y is used in a
-     key-weak table B, Z -> Y.  If B comes after A in the list of weak
-     tables, X -> Y might be removed from A, although when looking at B
-     one finds that it shouldn't.  */
-  do
-    {
-      marked = 0;
-      for (h = weak_hash_tables; h; h = h->next_weak)
-       {
-         if (h->header.size & ARRAY_MARK_FLAG)
-           marked |= sweep_weak_table (h, 0);
-       }
-    }
-  while (marked);
-
-  /* Remove tables and entries that aren't used.  */
-  for (h = weak_hash_tables, used = NULL; h; h = next)
-    {
-      next = h->next_weak;
-
-      if (h->header.size & ARRAY_MARK_FLAG)
-       {
-         /* TABLE is marked as used.  Sweep its contents.  */
-         if (h->count > 0)
-           sweep_weak_table (h, 1);
-
-         /* Add table to the list of used weak hash tables.  */
-         h->next_weak = used;
-         used = h;
-       }
-    }
-
-  weak_hash_tables = used;
-}
-
-
 
 /***********************************************************************
                        Hash Code Computation
@@ -4952,13 +4923,7 @@ DEFUN ("secure-hash-algorithms", Fsecure_hash_algorithms,
        doc: /* Return a list of all the supported `secure_hash' algorithms. */)
   (void)
 {
-  return listn (CONSTYPE_HEAP, 6,
-                Qmd5,
-                Qsha1,
-                Qsha224,
-                Qsha256,
-                Qsha384,
-                Qsha512);
+  return list (Qmd5, Qsha1, Qsha224, Qsha256, Qsha384, Qsha512);
 }
 
 /* Extract data from a string or a buffer. SPEC is a list of
@@ -5008,7 +4973,8 @@ extract_data_from_object (Lisp_Object spec,
        }
 
       if (STRING_MULTIBYTE (object))
-       object = code_convert_string (object, coding_system, Qnil, 1, 0, 1);
+       object = code_convert_string (object, coding_system,
+                                     Qnil, true, false, true);
 
       ptrdiff_t size = SCHARS (object), start_char, end_char;
       validate_subarray (object, start, end, size, &start_char, &end_char);
@@ -5063,7 +5029,7 @@ extract_data_from_object (Lisp_Object spec,
            coding_system = Vcoding_system_for_write;
          else
            {
-             bool force_raw_text = 0;
+             bool force_raw_text = false;
 
              coding_system = BVAR (XBUFFER (object), 
buffer_file_coding_system);
              if (NILP (coding_system)
@@ -5071,14 +5037,15 @@ extract_data_from_object (Lisp_Object spec,
                {
                  coding_system = Qnil;
                  if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
-                   force_raw_text = 1;
+                   force_raw_text = true;
                }
 
              if (NILP (coding_system) && !NILP (Fbuffer_file_name (object)))
                {
                  /* Check file-coding-system-alist.  */
                  Lisp_Object val = CALLN (Ffind_operation_coding_system,
-                                          Qwrite_region, start, end,
+                                          Qwrite_region,
+                                          make_fixnum (b), make_fixnum (e),
                                           Fbuffer_file_name (object));
                  if (CONSP (val) && !NILP (XCDR (val)))
                    coding_system = XCDR (val);
@@ -5114,14 +5081,15 @@ extract_data_from_object (Lisp_Object spec,
            }
        }
 
-      object = make_buffer_string (b, e, 0);
+      object = make_buffer_string (b, e, false);
       set_buffer_internal (prev);
       /* Discard the unwind protect for recovering the current
         buffer.  */
       specpdl_ptr--;
 
       if (STRING_MULTIBYTE (object))
-       object = code_convert_string (object, coding_system, Qnil, 1, 0, 0);
+       object = code_convert_string (object, coding_system,
+                                     Qnil, true, false, false);
       *start_byte = 0;
       *end_byte = SBYTES (object);
     }
@@ -5308,6 +5276,7 @@ disregarding any coding systems.  If nil, use the current 
buffer.  */ )
 }
 
 
+
 void
 syms_of_fns (void)
 {
@@ -5391,6 +5360,7 @@ Used by `featurep' and `require', and altered by 
`provide'.  */);
   DEFSYM (Qsubfeatures, "subfeatures");
   DEFSYM (Qfuncall, "funcall");
   DEFSYM (Qplistp, "plistp");
+  DEFSYM (Qlist_or_vector_p, "list-or-vector-p");
 
 #ifdef HAVE_LANGINFO_CODESET
   DEFSYM (Qcodeset, "codeset");
@@ -5406,7 +5376,7 @@ invoked by mouse clicks and mouse menu items.
 
 On some platforms, file selection dialogs are also enabled if this is
 non-nil.  */);
-  use_dialog_box = 1;
+  use_dialog_box = true;
 
   DEFVAR_BOOL ("use-file-dialog", use_file_dialog,
     doc: /* Non-nil means mouse commands use a file dialog to ask for files.
@@ -5414,7 +5384,7 @@ This applies to commands from menus and tool bar buttons 
even when
 they are initiated from the keyboard.  If `use-dialog-box' is nil,
 that disables the use of a file dialog, regardless of the value of
 this variable.  */);
-  use_file_dialog = 1;
+  use_file_dialog = true;
 
   defsubr (&Sidentity);
   defsubr (&Srandom);
diff --git a/src/font.c b/src/font.c
index 799d5db..5ca89c9 100644
--- a/src/font.c
+++ b/src/font.c
@@ -1,6 +1,6 @@
 /* font.c -- "Font" primitives.
 
-Copyright (C) 2006-2018 Free Software Foundation, Inc.
+Copyright (C) 2006-2019 Free Software Foundation, Inc.
 Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
   National Institute of Advanced Industrial Science and Technology (AIST)
   Registration Number H13PRO009
@@ -38,6 +38,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "fontset.h"
 #include "font.h"
 #include "termhooks.h"
+#include "pdumper.h"
 
 #ifdef HAVE_WINDOW_SYSTEM
 #include TERM_HEADER
@@ -374,10 +375,10 @@ font_style_to_value (enum font_property_index prop, 
Lisp_Object val,
       if (! noerror)
        return -1;
       eassert (len < 255);
-      elt = Fmake_vector (make_fixnum (2), make_fixnum (100));
+      elt = make_vector (2, make_fixnum (100));
       ASET (elt, 1, val);
       ASET (font_style_table, prop - FONT_WEIGHT_INDEX,
-           CALLN (Fvconcat, table, Fmake_vector (make_fixnum (1), elt)));
+           CALLN (Fvconcat, table, make_vector (1, elt)));
       return (100 << 8) | (i << 4);
     }
   else
@@ -1006,7 +1007,7 @@ font_expand_wildcards (Lisp_Object *field, int n)
 }
 
 
-/* Parse NAME (null terminated) as XLFD and store information in FONT
+/* Parse NAME (NUL terminated) as XLFD and store information in FONT
    (font-spec or font-entity).  Size property of FONT is set as
    follows:
        specified XLFD fields           FONT property
@@ -1352,7 +1353,7 @@ font_unparse_xlfd (Lisp_Object font, int pixel_size, char 
*name, int nbytes)
   return len < nbytes ? len : -1;
 }
 
-/* Parse NAME (null terminated) and store information in FONT
+/* Parse NAME (NUL terminated) and store information in FONT
    (font-spec or font-entity).  NAME is supplied in either the
    Fontconfig or GTK font name format.  If NAME is successfully
    parsed, return 0.  Otherwise return -1.
@@ -1724,7 +1725,7 @@ font_unparse_fcname (Lisp_Object font, int pixel_size, 
char *name, int nbytes)
 
 #endif
 
-/* Parse NAME (null terminated) and store information in FONT
+/* Parse NAME (NUL terminated) and store information in FONT
    (font-spec or font-entity).  If NAME is successfully parsed, return
    0.  Otherwise return -1.  */
 
@@ -2035,7 +2036,7 @@ font_otf_DeviceTable (OTF_DeviceTable *device_table)
 Lisp_Object
 font_otf_ValueRecord (int value_format, OTF_ValueRecord *value_record)
 {
-  Lisp_Object val = Fmake_vector (make_fixnum (8), Qnil);
+  Lisp_Object val = make_nil_vector (8);
 
   if (value_format & OTF_XPlacement)
     ASET (val, 0, make_fixnum (value_record->XPlacement));
@@ -2059,9 +2060,7 @@ font_otf_ValueRecord (int value_format, OTF_ValueRecord 
*value_record)
 Lisp_Object
 font_otf_Anchor (OTF_Anchor *anchor)
 {
-  Lisp_Object val;
-
-  val = Fmake_vector (make_fixnum (anchor->AnchorFormat + 1), Qnil);
+  Lisp_Object val = make_nil_vector (anchor->AnchorFormat + 1);
   ASET (val, 0, make_fixnum (anchor->XCoordinate));
   ASET (val, 1, make_fixnum (anchor->YCoordinate));
   if (anchor->AnchorFormat == 2)
@@ -2176,13 +2175,12 @@ font_score (Lisp_Object entity, Lisp_Object *spec_prop)
 static Lisp_Object
 font_vconcat_entity_vectors (Lisp_Object list)
 {
-  EMACS_INT nargs = XFIXNAT (Flength (list));
+  ptrdiff_t nargs = list_length (list);
   Lisp_Object *args;
   USE_SAFE_ALLOCA;
   SAFE_ALLOCA_LISP (args, nargs);
-  ptrdiff_t i;
 
-  for (i = 0; i < nargs; i++, list = XCDR (list))
+  for (ptrdiff_t i = 0; i < nargs; i++, list = XCDR (list))
     args[i] = XCAR (list);
   Lisp_Object result = Fvconcat (nargs, args);
   SAFE_FREE ();
@@ -2783,7 +2781,7 @@ font_list_entities (struct frame *f, Lisp_Object spec)
          {
            Lisp_Object copy;
 
-           val = driver_list->driver->list (f, scratch_font_spec);
+           val = (driver_list->driver->list) (f, scratch_font_spec);
            /* We put zero_vector in the font-cache to indicate that
               no fonts matching SPEC were found on the system.
               Failure to have this indication in the font cache can
@@ -3243,7 +3241,7 @@ font_find_for_lface (struct frame *f, Lisp_Object *attrs, 
Lisp_Object spec, int
 
       if (! NILP (alters))
        {
-         EMACS_INT alterslen = XFIXNAT (Flength (alters));
+         EMACS_INT alterslen = list_length (alters);
          SAFE_ALLOCA_LISP (family, alterslen + 2);
          for (i = 0; CONSP (alters); i++, alters = XCDR (alters))
            family[i] = XCAR (alters);
@@ -5170,14 +5168,13 @@ If the named font is not yet loaded, return nil.  */)
 static Lisp_Object
 build_style_table (const struct table_entry *entry, int nelement)
 {
-  int i, j;
-  Lisp_Object table, elt;
-
-  table = make_uninit_vector (nelement);
-  for (i = 0; i < nelement; i++)
+  Lisp_Object table = make_uninit_vector (nelement);
+  for (int i = 0; i < nelement; i++)
     {
-      for (j = 0; entry[i].names[j]; j++);
-      elt = Fmake_vector (make_fixnum (j + 1), Qnil);
+      int j;
+      for (j = 0; entry[i].names[j]; j++)
+       continue;
+      Lisp_Object elt = make_nil_vector (j + 1);
       ASET (elt, 0, make_fixnum (entry[i].numeric));
       for (j = 0; entry[i].names[j]; j++)
        ASET (elt, j + 1, intern_c_string (entry[i].names[j]));
@@ -5313,9 +5310,10 @@ syms_of_font (void)
   sort_shift_bits[FONT_SIZE_INDEX] = 16;
   sort_shift_bits[FONT_WIDTH_INDEX] = 23;
   /* Note that the other elements in sort_shift_bits are not used.  */
+  PDUMPER_REMEMBER_SCALAR (sort_shift_bits);
 
-  staticpro (&font_charset_alist);
   font_charset_alist = Qnil;
+  staticpro (&font_charset_alist);
 
   DEFSYM (Qopentype, "opentype");
 
@@ -5353,13 +5351,13 @@ syms_of_font (void)
 
   DEFSYM (QCuser_spec, ":user-spec");
 
-  staticpro (&scratch_font_spec);
   scratch_font_spec = Ffont_spec (0, NULL);
-  staticpro (&scratch_font_prefer);
+  staticpro (&scratch_font_spec);
   scratch_font_prefer = Ffont_spec (0, NULL);
+  staticpro (&scratch_font_prefer);
 
+  Vfont_log_deferred = make_nil_vector (3);
   staticpro (&Vfont_log_deferred);
-  Vfont_log_deferred = Fmake_vector (make_fixnum (3), Qnil);
 
 #if 0
 #ifdef HAVE_LIBOTF
diff --git a/src/font.h b/src/font.h
index 1741b3f..3720650 100644
--- a/src/font.h
+++ b/src/font.h
@@ -1,5 +1,5 @@
 /* font.h -- Interface definition for font handling.
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006-2019 Free Software Foundation, Inc.
    Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H13PRO009
@@ -284,7 +284,7 @@ struct font
   /* By which pixel size the font is opened.  */
   int pixel_size;
 
-  /* Height of the font.  On X window, this is the same as
+  /* Height of the font.  On X window system, this is the same as
      (font->ascent + font->descent).  */
   int height;
 
@@ -293,7 +293,7 @@ struct font
   int space_width;
 
   /* Average width of glyphs in the font.  If the font itself doesn't
-     have that information but has glyphs of ASCII characters, the
+     have that information, but has glyphs of ASCII characters, the
      value is the average width of those glyphs.  Otherwise, the value
      is 0.  */
   int average_width;
@@ -576,8 +576,8 @@ struct font_driver
      cons whose cdr part is the actual cache area.  */
   Lisp_Object (*get_cache) (struct frame *f);
 
-  /* List fonts exactly matching with FONT_SPEC on FRAME.  The value
-     is a list of font-entities.  The font properties to be considered
+  /* List fonts exactly matching FONT_SPEC on FRAME.  The value is
+     a list of font-entities.  The font properties to be considered
      are: :foundry, :family, :adstyle, :registry, :script, :lang, and
      :otf.  See the function `font-spec' for their meanings.  Note
      that the last three properties are stored in FONT_EXTRA_INDEX
@@ -593,20 +593,20 @@ struct font_driver
      The `open' method of the same font-backend is called with one of
      the returned font-entities.  If the backend needs additional
      information to be used in `open' method, this method can add any
-     Lispy value by the property :font-entity to the entities.
+     Lispy value using the property :font-entity to the entities.
 
      This and the following `match' are the only APIs that allocate
      font-entities.  */
   Lisp_Object (*list) (struct frame *frame, Lisp_Object font_spec);
 
-  /* Return a font-entity most closely matching with FONT_SPEC on
-     FRAME.  Which font property to consider, and how to calculate the
-     closeness is determined by the font backend, thus
+  /* Return a font-entity most closely matching FONT_SPEC on FRAME.
+     Which font property to consider, and how to calculate the
+     closeness, is determined by the font backend, thus
      `face-font-selection-order' is ignored here.
 
-     The properties that the font-entity has is the same as `list'
-     method.  */
-  Lisp_Object (*match) (struct frame *f, Lisp_Object spec);
+     The properties that the font-entity has are the same as described
+     for the `list' method above.  */
+  Lisp_Object (*match) (struct frame *f, Lisp_Object font_spec);
 
   /* Optional.
      List available families.  The value is a list of family names
@@ -630,7 +630,7 @@ struct font_driver
   void (*prepare_face) (struct frame *f, struct face *face);
 
   /* Optional.
-     Done FACE for displaying characters by FACE->font on frame F.  */
+     Done with FACE for displaying characters by FACE->font on frame F.  */
   void (*done_face) (struct frame *f, struct face *face);
 
   /* Optional.
@@ -662,8 +662,8 @@ struct font_driver
 
   /* Optional.
      Store bitmap data for glyph-code CODE of FONT in BITMAP.  It is
-     intended that this method is called from the other font-driver
-     for actual drawing.  */
+     intended that this method is called from other font-driver
+     methods for actual drawing.  */
   int (*get_bitmap) (struct font *font, unsigned code,
                      struct font_bitmap *bitmap,
                      int bits_per_pixel);
@@ -677,13 +677,16 @@ struct font_driver
   /* Optional.
      Get coordinates of the INDEXth anchor point of the glyph whose
      code is CODE.  Store the coordinates in *X and *Y.  Return 0 if
-     the operations was successful.  Otherwise return -1.  */
+     the operation was successful.  Otherwise return -1.  */
   int (*anchor_point) (struct font *font, unsigned code, int index,
                        int *x, int *y);
 
   /* Optional.
      Return a list describing which scripts/languages FONT
-     supports by which GSUB/GPOS features of OpenType tables.  */
+     supports by which GSUB/GPOS features of OpenType tables.
+     The list should be of the form (GSUB GPOS), where both
+     GSUB and GPOS are lists of the form
+     ((SCRIPT (LANGSYS FEATURE ...) ...) ...)  */
   Lisp_Object (*otf_capability) (struct font *font);
 
   /* Optional.
@@ -707,17 +710,16 @@ struct font_driver
 
   /* Optional.
      Make the font driver ready for frame F.  Usually this function
-     makes some data specific to F and stores it in F by calling
-     font_put_frame_data ().  */
+     makes some data specific to F and stores it in F's font_data
+     member by calling font_put_frame_data.  */
   int (*start_for_frame) (struct frame *f);
 
   /* Optional.
-     End using the driver for frame F.  Usually this function free
-     some data stored for F.  */
+     End using the driver for frame F.  Usually this function frees
+     some font data stored in frame F's font_data member.  */
   int (*end_for_frame) (struct frame *f);
 
   /* Optional.
-
      Shape text in GSTRING.  See the docstring of
      `composition-get-gstring' for the format of GSTRING.  If the
      (N+1)th element of GSTRING is nil, input of shaping is from the
@@ -728,19 +730,17 @@ struct font_driver
      output glyphs (M) are more than the input glyphs (N), (N+1)th
      through (M)th elements of GSTRING are updated possibly by making
      a new glyph object and storing it in GSTRING.  If (M) is greater
-     than the length of GSTRING, nil should be return.  In that case,
-     this function is called again with the larger GSTRING.  */
+     than the length of GSTRING, this method should return nil.  In
+     that case, the method is called again with a larger GSTRING.  */
   Lisp_Object (*shape) (Lisp_Object lgstring);
 
   /* Optional.
-
      If FONT is usable on frame F, return 0.  Otherwise return -1.
      This method is used only for debugging.  If this method is NULL,
      Emacs assumes that the font is usable on any frame.  */
   int (*check) (struct frame *f, struct font *font);
 
   /* Optional.
-
      Return the number of variation glyphs of character C supported by
      FONT.  VARIATIONS is an array of 256 elements.  If the variation
      selector N (1..256) defines a glyph, that glyph code is stored in
@@ -748,24 +748,27 @@ struct font_driver
   int (*get_variation_glyphs) (struct font *font,
                                int c, unsigned variations[256]);
 
+  /* Optional.
+     Set attributes of FONT according to PROPERTIES.
+     PROPERTIES is an alist of pairs (KEY . VALUE) that specifies
+     font properties.  This method should use font-put to set
+     properties of FONT supported by the font driver.
+     See font_filter_properties for more details.  */
   void (*filter_properties) (Lisp_Object font, Lisp_Object properties);
 
   /* Optional.
-
      Return non-zero if FONT_OBJECT can be used as a (cached) font
      for ENTITY on frame F.  */
   bool (*cached_font_ok) (struct frame *f,
                           Lisp_Object font_object,
                           Lisp_Object entity);
 
-  /* Optional
-
-     Return non-nil if the driver support rendering of combining
+  /* Optional.
+     Return non-nil if the driver supports rendering of combining
      characters for FONT according to Unicode combining class.  */
   Lisp_Object (*combining_capability) (struct font *font);
 
-  /* Optional
-
+  /* Optional.
      Called when frame F is double-buffered and its size changes; Xft
      relies on this hook to throw away its old XftDraw (which won't
      work after the size change) and get a new one.  */
diff --git a/src/fontset.c b/src/fontset.c
index 1f877eb..2729fae 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -1,6 +1,6 @@
 /* Fontset handler.
 
-Copyright (C) 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 2001-2019 Free Software Foundation, Inc.
 Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
   2005, 2006, 2007, 2008, 2009, 2010, 2011
   National Institute of Advanced Industrial Science and Technology (AIST)
@@ -39,6 +39,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include TERM_HEADER
 #endif /* HAVE_WINDOW_SYSTEM */
 #include "font.h"
+#include "pdumper.h"
 
 /* FONTSET
 
@@ -281,10 +282,10 @@ set_fontset_fallback (Lisp_Object fontset, Lisp_Object 
fallback)
   ASET ((rfont_def), 3, make_fixnum (score))
 #define RFONT_DEF_NEW(rfont_def, font_def)             \
   do {                                                 \
-    (rfont_def) = Fmake_vector (make_fixnum (4), Qnil);        \
-    ASET ((rfont_def), 1, (font_def));                 \
-    RFONT_DEF_SET_SCORE ((rfont_def), 0);              \
-  } while (0)
+    (rfont_def) = make_nil_vector (4);                 \
+    ASET (rfont_def, 1, font_def);                     \
+    RFONT_DEF_SET_SCORE (rfont_def, 0);                        \
+  } while (false)
 
 
 /* Return the element of FONTSET for the character C.  If FONTSET is a
@@ -327,11 +328,8 @@ fontset_ref (Lisp_Object fontset, int c)
 #define FONTSET_ADD(fontset, range, elt, add)                          \
   (NILP (add)                                                          \
    ? (NILP (range)                                                     \
-      ? (set_fontset_fallback                                          \
-        (fontset, Fmake_vector (make_fixnum (1), (elt))))              \
-      : ((void)                                                                
\
-        Fset_char_table_range (fontset, range,                         \
-                               Fmake_vector (make_fixnum (1), elt))))  \
+      ? set_fontset_fallback (fontset, make_vector (1, elt))           \
+      : (void) Fset_char_table_range (fontset, range, make_vector (1, elt))) \
    : fontset_add ((fontset), (range), (elt), (add)))
 
 static void
@@ -340,7 +338,7 @@ fontset_add (Lisp_Object fontset, Lisp_Object range, 
Lisp_Object elt, Lisp_Objec
   Lisp_Object args[2];
   int idx = (EQ (add, Qappend) ? 0 : 1);
 
-  args[1 - idx] = Fmake_vector (make_fixnum (1), elt);
+  args[1 - idx] = make_vector (1, elt);
 
   if (CONSP (range))
     {
@@ -701,7 +699,6 @@ fontset_find_font (Lisp_Object fontset, int c, struct face 
*face,
        {
          /* We found a font.  Open it and insert a new element for
             that font in VEC.  */
-         Lisp_Object new_vec;
          int j;
 
          font_object = font_open_for_lface (f, font_entity, face->lface,
@@ -711,7 +708,7 @@ fontset_find_font (Lisp_Object fontset, int c, struct face 
*face,
          RFONT_DEF_NEW (rfont_def, font_def);
          RFONT_DEF_SET_OBJECT (rfont_def, font_object);
          RFONT_DEF_SET_SCORE (rfont_def, RFONT_DEF_SCORE (rfont_def));
-         new_vec = Fmake_vector (make_fixnum (ASIZE (vec) + 1), Qnil);
+         Lisp_Object new_vec = make_nil_vector (ASIZE (vec) + 1);
          found_index++;
          for (j = 0; j < found_index; j++)
            ASET (new_vec, j, AREF (vec, j));
@@ -2062,9 +2059,7 @@ Lisp_Object dump_fontset (Lisp_Object) EXTERNALLY_VISIBLE;
 Lisp_Object
 dump_fontset (Lisp_Object fontset)
 {
-  Lisp_Object vec;
-
-  vec = Fmake_vector (make_fixnum (3), Qnil);
+  Lisp_Object vec = make_nil_vector (3);
   ASET (vec, 0, FONTSET_ID (fontset));
 
   if (BASE_FONTSET_P (fontset))
@@ -2122,7 +2117,7 @@ syms_of_fontset (void)
   Vcached_fontset_data = Qnil;
   staticpro (&Vcached_fontset_data);
 
-  Vfontset_table = Fmake_vector (make_fixnum (32), Qnil);
+  Vfontset_table = make_nil_vector (32);
   staticpro (&Vfontset_table);
 
   Vdefault_fontset = Fmake_char_table (Qfontset, Qnil);
@@ -2133,6 +2128,7 @@ syms_of_fontset (void)
      build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"));
   ASET (Vfontset_table, 0, Vdefault_fontset);
   next_fontset_id = 1;
+  PDUMPER_REMEMBER_SCALAR (next_fontset_id);
 
   auto_fontset_alist = Qnil;
   staticpro (&auto_fontset_alist);
diff --git a/src/fontset.h b/src/fontset.h
index a010ff8..40650e8 100644
--- a/src/fontset.h
+++ b/src/fontset.h
@@ -1,5 +1,5 @@
 /* Header for fontset handler.
-   Copyright (C) 1998, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1998, 2001-2019 Free Software Foundation, Inc.
    Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
      2005, 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
diff --git a/src/frame.c b/src/frame.c
index 4371ef7..d0c7714 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1,6 +1,6 @@
 /* Generic frame functions.
 
-Copyright (C) 1993-1995, 1997, 1999-2018 Free Software Foundation, Inc.
+Copyright (C) 1993-1995, 1997, 1999-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -53,11 +53,14 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #ifdef USE_X_TOOLKIT
 #include "widget.h"
 #endif
+#include "pdumper.h"
 
 /* The currently selected frame.  */
-
 Lisp_Object selected_frame;
 
+/* The selected frame the last time window change functions were run.  */
+Lisp_Object old_selected_frame;
+
 /* A frame which is not just a mini-buffer, or NULL if there are no such
    frames.  This is usually the most recent such frame that was selected.  */
 
@@ -67,7 +70,7 @@ static struct frame *last_nonminibuf_frame;
 bool frame_garbaged;
 
 /* The default tool bar height for future frames.  */
-#if defined USE_GTK || defined HAVE_NS
+#ifdef HAVE_EXT_TOOL_BAR
 enum { frame_default_tool_bar_height = 0 };
 #else
 int frame_default_tool_bar_height;
@@ -160,10 +163,8 @@ frame_size_history_add (struct frame *f, Lisp_Object 
fun_symbol,
             Fcons (list4
                    (frame, fun_symbol,
                     ((width > 0)
-                     ? list4 (make_fixnum (FRAME_TEXT_WIDTH (f)),
-                              make_fixnum (FRAME_TEXT_HEIGHT (f)),
-                              make_fixnum (width),
-                              make_fixnum (height))
+                     ? list4i (FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f),
+                               width, height)
                      : Qnil),
                     rest),
                    XCDR (frame_size_history)));
@@ -711,7 +712,7 @@ adjust_frame_size (struct frame *f, int new_width, int 
new_height, int inhibit,
       if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
        FrameCols (FRAME_TTY (f)) = new_cols;
 
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
       if (WINDOWP (f->tool_bar_window))
        {
          XWINDOW (f->tool_bar_window)->pixel_width = new_windows_width;
@@ -741,8 +742,8 @@ adjust_frame_size (struct frame *f, int new_width, int 
new_height, int inhibit,
 
   frame_size_history_add
     (f, Qadjust_frame_size_3, new_text_width, new_text_height,
-     list4 (make_fixnum (old_pixel_width), make_fixnum (old_pixel_height),
-           make_fixnum (new_pixel_width), make_fixnum (new_pixel_height)));
+     list4i (old_pixel_width, old_pixel_height,
+            new_pixel_width, new_pixel_height));
 
   /* Assign new sizes.  */
   FRAME_TEXT_WIDTH (f) = new_text_width;
@@ -847,7 +848,7 @@ make_frame (bool mini_p)
   f->no_accept_focus = false;
   f->z_group = z_group_none;
   f->tooltip = false;
-#if ! defined (USE_GTK) && ! defined (HAVE_NS)
+#ifndef HAVE_EXT_TOOL_BAR
   f->last_tool_bar_item = -1;
 #endif
 #ifdef NS_IMPL_COCOA
@@ -855,7 +856,8 @@ make_frame (bool mini_p)
   f->ns_transparent_titlebar = false;
 #endif
 #endif
-
+  /* This one should never be zero.  */
+  f->change_stamp = 1;
   root_window = make_window ();
   rw = XWINDOW (root_window);
   if (mini_p)
@@ -1048,10 +1050,7 @@ make_initial_frame (void)
   Lisp_Object frame;
 
   eassert (initial_kboard);
-
-  /* The first call must initialize Vframe_list.  */
-  if (! (NILP (Vframe_list) || CONSP (Vframe_list)))
-    Vframe_list = Qnil;
+  eassert (NILP (Vframe_list) || CONSP (Vframe_list));
 
   terminal = init_initial_terminal ();
 
@@ -1451,7 +1450,8 @@ This function returns FRAME, or nil if FRAME has been 
deleted.  */)
   return do_switch_frame (frame, 1, 0, norecord);
 }
 
-DEFUN ("handle-switch-frame", Fhandle_switch_frame, Shandle_switch_frame, 1, 
1, "^e",
+DEFUN ("handle-switch-frame", Fhandle_switch_frame,
+       Shandle_switch_frame, 1, 1, "^e",
        doc: /* Handle a switch-frame event EVENT.
 Switch-frame events are usually bound to this function.
 A switch-frame event is an event Emacs sends itself to
@@ -1471,6 +1471,18 @@ DEFUN ("selected-frame", Fselected_frame, 
Sselected_frame, 0, 0, 0,
 {
   return selected_frame;
 }
+
+DEFUN ("old-selected-frame", Fold_selected_frame,
+       Sold_selected_frame, 0, 0, 0,
+       doc: /* Return the old selected FRAME.
+FRAME must be a live frame and defaults to the selected one.
+
+The return value is the frame selected the last time window change
+functions were run.  */)
+  (void)
+{
+  return old_selected_frame;
+}
 
 DEFUN ("frame-list", Fframe_list, Sframe_list,
        0, 0, 0,
@@ -1837,6 +1849,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
   Lisp_Object frames, frame1;
   int minibuffer_selected, is_tooltip_frame;
   bool nochild = !FRAME_PARENT_FRAME (f);
+  Lisp_Object minibuffer_child_frame = Qnil;
 
   if (!FRAME_LIVE_P (f))
     return Qnil;
@@ -1853,13 +1866,33 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
   /* Softly delete all frames with this frame as their parent frame or
      as their `delete-before' frame parameter value.  */
   FOR_EACH_FRAME (frames, frame1)
-    if (FRAME_PARENT_FRAME (XFRAME (frame1)) == f
+    {
+      struct frame *f1 = XFRAME (frame1);
+
+      if (EQ (frame1, frame) || FRAME_TOOLTIP_P (f1))
+       continue;
+      else if (FRAME_PARENT_FRAME (f1) == f)
+       {
+         if (FRAME_HAS_MINIBUF_P (f1) && !FRAME_HAS_MINIBUF_P (f)
+             && EQ (FRAME_MINIBUF_WINDOW (f), FRAME_MINIBUF_WINDOW (f1)))
+           /* frame1 owns frame's minibuffer window so we must not
+              delete it here to avoid a surrogate minibuffer error.
+              Unparent frame1 and make it a top-level frame.  */
+           {
+             Fmodify_frame_parameters
+               (frame1, Fcons (Fcons (Qparent_frame, Qnil), Qnil));
+             minibuffer_child_frame = frame1;
+           }
+         else
+           delete_frame (frame1, Qnil);
+       }
+      else if (nochild
+              && EQ (get_frame_param (XFRAME (frame1), Qdelete_before), frame))
        /* Process `delete-before' parameter iff FRAME is not a child
           frame.  This avoids that we enter an infinite chain of mixed
           dependencies.  */
-       || (nochild
-           && EQ (get_frame_param (XFRAME (frame1), Qdelete_before), frame)))
-      delete_frame (frame1, Qnil);
+       delete_frame (frame1, Qnil);
+    }
 
   /* Does this frame have a minibuffer, and is it the surrogate
      minibuffer for any other frame?  */
@@ -2124,18 +2157,27 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
        {
          struct frame *f1 = XFRAME (frame1);
 
-         /* Consider only frames on the same kboard
-            and only those with minibuffers.  */
-         if (kb == FRAME_KBOARD (f1)
-             && FRAME_HAS_MINIBUF_P (f1))
+         /* Set frame_on_same_kboard to frame1 if it is on the same
+            keyboard.  Set frame_with_minibuf to frame1 if it also
+            has a minibuffer.  Leave the loop immediately if frame1
+            is also minibuffer-only.
+
+            Emacs 26 does _not_ set frame_on_same_kboard here when it
+            finds a minibuffer-only frame and subsequently fails to
+            set default_minibuffer_frame below.  Not a great deal and
+            never noticed since make_frame_without_minibuffer creates
+            a new minibuffer frame in that case (which can be a minor
+            annoyance though).  To consider for Emacs 26.3.  */
+         if (kb == FRAME_KBOARD (f1))
            {
-             frame_with_minibuf = frame1;
-             if (FRAME_MINIBUF_ONLY_P (f1))
-               break;
+             frame_on_same_kboard = frame1;
+             if (FRAME_HAS_MINIBUF_P (f1))
+               {
+                 frame_with_minibuf = frame1;
+                 if (FRAME_MINIBUF_ONLY_P (f1))
+                   break;
+               }
            }
-
-         if (kb == FRAME_KBOARD (f1))
-           frame_on_same_kboard = frame1;
        }
 
       if (!NILP (frame_on_same_kboard))
@@ -2168,7 +2210,46 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
       = Fcons (list3 (Qrun_hook_with_args, Qafter_delete_frame_functions, 
frame),
               pending_funcalls);
   else
-      safe_call2 (Qrun_hook_with_args, Qafter_delete_frame_functions, frame);
+    safe_call2 (Qrun_hook_with_args, Qafter_delete_frame_functions, frame);
+
+  if (!NILP (minibuffer_child_frame))
+    /* If minibuffer_child_frame is non-nil, it was FRAME's minibuffer
+       child frame.  Delete it unless it's also the minibuffer frame
+       of another frame in which case we make sure it's visible.  */
+    {
+      struct frame *f1 = XFRAME (minibuffer_child_frame);
+
+      if (FRAME_LIVE_P (f1))
+       {
+         Lisp_Object window1 = FRAME_ROOT_WINDOW (f1);
+         Lisp_Object frame2;
+
+         FOR_EACH_FRAME (frames, frame2)
+           {
+             struct frame *f2 = XFRAME (frame2);
+
+             if (EQ (frame2, minibuffer_child_frame) || FRAME_TOOLTIP_P (f2))
+               continue;
+             else if (EQ (FRAME_MINIBUF_WINDOW (f2), window1))
+               {
+                 /* minibuffer_child_frame serves as minibuffer frame
+                    for at least one other frame - so make it visible
+                    and quit.  */
+                 if (!FRAME_VISIBLE_P (f1) && !FRAME_ICONIFIED_P (f1))
+                   Fmake_frame_visible (minibuffer_child_frame);
+
+                 return Qnil;
+               }
+           }
+
+         /* No other frame found that uses minibuffer_child_frame as
+            minibuffer frame.  If FORCE is Qnoelisp or there are
+            other visible frames left, delete minibuffer_child_frame
+            since it presumably was used by FRAME only.  */
+         if (EQ (force, Qnoelisp) || other_frames (f1, false, !NILP (force)))
+           delete_frame (minibuffer_child_frame, Qnoelisp);
+       }
+    }
 
   return Qnil;
 }
@@ -2961,6 +3042,13 @@ store_frame_param (struct frame *f, Lisp_Object prop, 
Lisp_Object val)
       fset_buried_buffer_list (f, Fnreverse (list));
       return;
     }
+  else if ((EQ (prop, Qscroll_bar_width) || EQ (prop, Qscroll_bar_height))
+          && !NILP (val) && !RANGED_FIXNUMP (1, val, INT_MAX))
+    {
+      Lisp_Object old_val = Fcdr (Fassq (prop, f->param_alist));
+
+      val = old_val;
+    }
 
   /* The tty color needed to be set before the frame's parameter
      alist was updated with the new value.  This is not true any more,
@@ -3190,7 +3278,7 @@ list, but are otherwise ignored.  */)
 #endif
 
     {
-      EMACS_INT length = XFIXNAT (Flength (alist));
+      EMACS_INT length = list_length (alist);
       ptrdiff_t i;
       Lisp_Object *parms;
       Lisp_Object *values;
@@ -3523,6 +3611,40 @@ bottom edge of FRAME's display.  */)
 
   return Qt;
 }
+
+DEFUN ("frame-window-state-change", Fframe_window_state_change,
+       Sframe_window_state_change, 0, 1, 0,
+       doc: /* Return t if FRAME's window state change flag is set, nil 
otherwise.
+FRAME must be a live frame and defaults to the selected one.
+
+If FRAME's window state change flag is set, the default values of
+`window-state-change-functions' and `window-state-change-hook' will be
+run during next redisplay, regardless of whether a window state change
+actually occurred on FRAME or not.  After that, the value of this flag
+is reset.  */)
+     (Lisp_Object frame)
+{
+  return FRAME_WINDOW_STATE_CHANGE (decode_live_frame (frame)) ? Qt : Qnil;
+}
+
+DEFUN ("set-frame-window-state-change", Fset_frame_window_state_change,
+       Sset_frame_window_state_change, 0, 2, 0,
+       doc: /* Set FRAME's window state change flag according to ARG.
+Set FRAME's window state change flag if ARG is non-nil, reset it
+otherwise.
+
+If FRAME's window state change flag is set, the default values of
+`window-state-change-functions' and `window-state-change-hook' will be
+run during next redisplay, regardless of whether a window state change
+actually occurred on FRAME or not.  After that, the value of FRAME's
+window state change flag is reset.  */)
+     (Lisp_Object frame, Lisp_Object arg)
+{
+  struct frame *f = decode_live_frame (frame);
+
+  return (FRAME_WINDOW_STATE_CHANGE (f) = !NILP (arg)) ? Qt : Qnil;
+}
+
 
 /***********************************************************************
                                Frame Parameters
@@ -4105,18 +4227,14 @@ x_report_frame_params (struct frame *f, Lisp_Object 
*alistptr)
   store_in_alist (alistptr, Qright_fringe,
                  make_fixnum (FRAME_RIGHT_FRINGE_WIDTH (f)));
   store_in_alist (alistptr, Qscroll_bar_width,
-                 (! FRAME_HAS_VERTICAL_SCROLL_BARS (f)
-                  ? make_fixnum (0)
-                  : FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0
+                 (FRAME_CONFIG_SCROLL_BAR_WIDTH (f) > 0
                   ? make_fixnum (FRAME_CONFIG_SCROLL_BAR_WIDTH (f))
                   /* nil means "use default width"
                      for non-toolkit scroll bar.
                      ruler-mode.el depends on this.  */
                   : Qnil));
   store_in_alist (alistptr, Qscroll_bar_height,
-                 (! FRAME_HAS_HORIZONTAL_SCROLL_BARS (f)
-                  ? make_fixnum (0)
-                  : FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) > 0
+                 (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) > 0
                   ? make_fixnum (FRAME_CONFIG_SCROLL_BAR_HEIGHT (f))
                   /* nil means "use default height"
                      for non-toolkit scroll bar.  */
@@ -4586,20 +4704,20 @@ x_set_scroll_bar_width (struct frame *f, Lisp_Object 
arg, Lisp_Object oldval)
 {
   int unit = FRAME_COLUMN_WIDTH (f);
 
-  if (NILP (arg))
+  if (RANGED_FIXNUMP (1, arg, INT_MAX)
+      && XFIXNAT (arg) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f))
     {
-      x_set_scroll_bar_default_width (f);
-
+      FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFIXNAT (arg);
+      FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFIXNAT (arg) + unit - 1) / unit;
       if (FRAME_X_WINDOW (f))
        adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width);
 
       SET_FRAME_GARBAGED (f);
     }
-  else if (RANGED_FIXNUMP (1, arg, INT_MAX)
-          && XFIXNAT (arg) != FRAME_CONFIG_SCROLL_BAR_WIDTH (f))
+  else
     {
-      FRAME_CONFIG_SCROLL_BAR_WIDTH (f) = XFIXNAT (arg);
-      FRAME_CONFIG_SCROLL_BAR_COLS (f) = (XFIXNAT (arg) + unit - 1) / unit;
+      x_set_scroll_bar_default_width (f);
+
       if (FRAME_X_WINDOW (f))
        adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_width);
 
@@ -4616,20 +4734,20 @@ x_set_scroll_bar_height (struct frame *f, Lisp_Object 
arg, Lisp_Object oldval)
 #if USE_HORIZONTAL_SCROLL_BARS
   int unit = FRAME_LINE_HEIGHT (f);
 
-  if (NILP (arg))
+  if (RANGED_FIXNUMP (1, arg, INT_MAX)
+      && XFIXNAT (arg) != FRAME_CONFIG_SCROLL_BAR_HEIGHT (f))
     {
-      x_set_scroll_bar_default_height (f);
-
+      FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) = XFIXNAT (arg);
+      FRAME_CONFIG_SCROLL_BAR_LINES (f) = (XFIXNAT (arg) + unit - 1) / unit;
       if (FRAME_X_WINDOW (f))
        adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height);
 
       SET_FRAME_GARBAGED (f);
     }
-  else if (RANGED_FIXNUMP (1, arg, INT_MAX)
-          && XFIXNAT (arg) != FRAME_CONFIG_SCROLL_BAR_HEIGHT (f))
+  else
     {
-      FRAME_CONFIG_SCROLL_BAR_HEIGHT (f) = XFIXNAT (arg);
-      FRAME_CONFIG_SCROLL_BAR_LINES (f) = (XFIXNAT (arg) + unit - 1) / unit;
+      x_set_scroll_bar_default_height (f);
+
       if (FRAME_X_WINDOW (f))
        adjust_frame_size (f, -1, -1, 3, 0, Qscroll_bar_height);
 
@@ -5295,9 +5413,9 @@ x_figure_window_size (struct frame *f, Lisp_Object parms, 
bool toolbar_p, int *x
        {
          int margin, relief;
 
-         relief = (tool_bar_button_relief >= 0
-                   ? tool_bar_button_relief
-                   : DEFAULT_TOOL_BAR_BUTTON_RELIEF);
+         relief = (tool_bar_button_relief < 0
+                   ? DEFAULT_TOOL_BAR_BUTTON_RELIEF
+                   : min (tool_bar_button_relief, 1000000));
 
          if (RANGED_FIXNUMP (1, Vtool_bar_button_margin, INT_MAX))
            margin = XFIXNAT (Vtool_bar_button_margin);
@@ -5610,6 +5728,26 @@ make_monitor_attribute_list (struct MonitorInfo 
*monitors,
                                Initialization
  ***********************************************************************/
 
+static void init_frame_once_for_pdumper (void);
+
+void
+init_frame_once (void)
+{
+  staticpro (&Vframe_list);
+  staticpro (&selected_frame);
+  PDUMPER_IGNORE (last_nonminibuf_frame);
+  Vframe_list = Qnil;
+  selected_frame = Qnil;
+  pdumper_do_now_and_after_load (init_frame_once_for_pdumper);
+}
+
+static void
+init_frame_once_for_pdumper (void)
+{
+  PDUMPER_RESET_LV (Vframe_list, Qnil);
+  PDUMPER_RESET_LV (selected_frame, Qnil);
+}
+
 void
 syms_of_frame (void)
 {
@@ -5941,6 +6079,19 @@ setting this variable does not change that frame's 
previous association.
 
 This variable is local to the current terminal and cannot be buffer-local.  
*/);
 
+  DEFVAR_LISP ("resize-mini-frames", resize_mini_frames,
+    doc: /* Non-nil means resize minibuffer-only frames automatically.
+If this is nil, do not resize minibuffer-only frames automatically.
+
+If this is a function, call that function with the minibuffer-only
+frame that shall be resized as sole argument.  The buffer of the root
+window of that frame is the buffer whose text will be eventually shown
+in the minibuffer window.
+
+Any other non-nil value means to resize minibuffer-only frames by
+calling `fit-frame-to-buffer'.  */);
+  resize_mini_frames = Qnil;
+
   DEFVAR_LISP ("focus-follows-mouse", focus_follows_mouse,
               doc: /* Non-nil if window system changes focus when you move the 
mouse.
 You should set this variable to tell Emacs how your window manager
@@ -6091,16 +6242,15 @@ making the child frame unresponsive to user actions, 
the default is to
 iconify the top level frame instead.  */);
   iconify_child_frame = Qiconify_top_level;
 
-  staticpro (&Vframe_list);
-
   defsubr (&Sframep);
   defsubr (&Sframe_live_p);
   defsubr (&Swindow_system);
   defsubr (&Sframe_windows_min_size);
   defsubr (&Smake_terminal_frame);
-  defsubr (&Shandle_switch_frame);
   defsubr (&Sselect_frame);
+  defsubr (&Shandle_switch_frame);
   defsubr (&Sselected_frame);
+  defsubr (&Sold_selected_frame);
   defsubr (&Sframe_list);
   defsubr (&Sframe_parent);
   defsubr (&Sframe_ancestor_p);
@@ -6153,6 +6303,8 @@ iconify the top level frame instead.  */);
   defsubr (&Sframe_position);
   defsubr (&Sset_frame_position);
   defsubr (&Sframe_pointer_visible_p);
+  defsubr (&Sframe_window_state_change);
+  defsubr (&Sset_frame_window_state_change);
 
 #ifdef HAVE_WINDOW_SYSTEM
   defsubr (&Sx_get_resource);
diff --git a/src/frame.h b/src/frame.h
index ad7376a..ed62e7a 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1,5 +1,5 @@
 /* Define frame-object for GNU Emacs.
-   Copyright (C) 1993-1994, 1999-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993-1994, 1999-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -125,6 +125,10 @@ struct frame
      The selected window of the selected frame is Emacs's selected window.  */
   Lisp_Object selected_window;
 
+  /* This frame's selected window when run_window_change_functions was
+     called the last time on this frame.  */
+  Lisp_Object old_selected_window;
+
   /* This frame's minibuffer window.
      Most frames have their own minibuffer windows,
      but only the selected frame's minibuffer window
@@ -177,7 +181,7 @@ struct frame
   Lisp_Object menu_bar_window;
 #endif
 
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
   /* A window used to display the tool-bar of a frame.  */
   Lisp_Object tool_bar_window;
 
@@ -205,7 +209,7 @@ struct frame
   /* Cache of realized faces.  */
   struct face_cache *face_cache;
 
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
   /* Tool-bar item index of the item on which a mouse button was pressed.  */
   int last_tool_bar_item;
 #endif
@@ -253,13 +257,13 @@ struct frame
   /* Set to true when current redisplay has updated frame.  */
   bool_bf updated_p : 1;
 
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
   /* Set to true to minimize tool-bar height even when
      auto-resize-tool-bar is set to grow-only.  */
   bool_bf minimize_tool_bar_window_p : 1;
 #endif
 
-#if defined (USE_GTK) || defined (HAVE_NS)
+#ifdef HAVE_EXT_TOOL_BAR
   /* True means using a tool bar that comes from the toolkit.  */
   bool_bf external_tool_bar : 1;
 #endif
@@ -274,9 +278,8 @@ struct frame
   /* True if it needs to be redisplayed.  */
   bool_bf redisplay : 1;
 
-#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI)    \
-    || defined (HAVE_NS) || defined (USE_GTK)
-  /* True means using a menu bar that comes from the X toolkit.  */
+#ifdef HAVE_EXT_MENU_BAR
+  /* True means using a menu bar that comes from the toolkit.  */
   bool_bf external_menu_bar : 1;
 #endif
 
@@ -321,9 +324,18 @@ struct frame
      cleared.  */
   bool_bf explicit_name : 1;
 
-  /* True if configuration of windows on this frame has changed since
-     last call of run_window_size_change_functions.  */
-  bool_bf window_configuration_changed : 1;
+  /* True if at least one window on this frame changed since the last
+     call of run_window_change_functions.  Changes are either "state
+     changes" (a window has been created, deleted or got assigned
+     another buffer) or "size changes" (the total or body size of a
+     window changed).  run_window_change_functions exits early unless
+     either this flag is true or a window selection happened on this
+     frame.  */
+  bool_bf window_change : 1;
+
+  /* True if running window state change functions has been explicitly
+     requested for this frame since last redisplay.  */
+  bool_bf window_state_change : 1;
 
   /* True if the mouse has moved on this display device
      since the last time we checked.  */
@@ -404,8 +416,26 @@ struct frame
   /* Non-zero if this frame's faces need to be recomputed.  */
   bool_bf face_change : 1;
 
+  /* Non-zero if this frame's image cache cannot be freed because the
+     frame is in the process of being redisplayed.  */
+  bool_bf inhibit_clear_image_cache : 1;
+
   /* Bitfield area ends here.  */
 
+  /* This frame's change stamp, set the last time window change
+     functions were run for this frame.  Should never be 0 because
+     that's the change stamp of a new window.  A window was not on a
+     frame the last run_window_change_functions was called on it if
+     it's change stamp differs from that of its frame.  */
+  int change_stamp;
+
+  /* This frame's number of windows, set the last time window change
+     functions were run for this frame.  Should never be 0 even for
+     minibuffer-only frames.  If no window has been added, this allows
+     to detect whether a window was deleted on this frame since the
+     last time run_window_change_functions was called on it.  */
+  ptrdiff_t number_of_windows;
+
   /* Number of lines (rounded up) of tool bar.  REMOVE THIS  */
   int tool_bar_lines;
 
@@ -553,7 +583,7 @@ struct frame
   int config_scroll_bar_lines;
 
   /* The baud rate that was used to calculate costs for this frame.  */
-  int cost_calculation_baud_rate;
+  intmax_t cost_calculation_baud_rate;
 
   /* Frame opacity
      alpha[0]: alpha transparency of the active frame
@@ -662,6 +692,11 @@ fset_selected_window (struct frame *f, Lisp_Object val)
   f->selected_window = val;
 }
 INLINE void
+fset_old_selected_window (struct frame *f, Lisp_Object val)
+{
+  f->old_selected_window = val;
+}
+INLINE void
 fset_title (struct frame *f, Lisp_Object val)
 {
   f->title = val;
@@ -678,7 +713,7 @@ fset_tool_bar_position (struct frame *f, Lisp_Object val)
   f->tool_bar_position = val;
 }
 #endif /* USE_GTK */
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
 INLINE void
 fset_tool_bar_window (struct frame *f, Lisp_Object val)
 {
@@ -846,7 +881,7 @@ default_pixels_per_inch_y (void)
 
 /* True if this frame should display a tool bar
    in a way that does not use any text lines.  */
-#if defined (USE_GTK) || defined (HAVE_NS)
+#ifdef HAVE_EXT_TOOL_BAR
 #define FRAME_EXTERNAL_TOOL_BAR(f) (f)->external_tool_bar
 #else
 #define FRAME_EXTERNAL_TOOL_BAR(f) false
@@ -875,8 +910,7 @@ default_pixels_per_inch_y (void)
 
 /* True if this frame should display a menu bar
    in a way that does not use any text lines.  */
-#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
-     || defined (HAVE_NS) || defined (USE_GTK)
+#ifdef HAVE_EXT_MENU_BAR
 #define FRAME_EXTERNAL_MENU_BAR(f) (f)->external_menu_bar
 #else
 #define FRAME_EXTERNAL_MENU_BAR(f) false
@@ -908,10 +942,13 @@ default_pixels_per_inch_y (void)
    are frozen on frame F.  */
 #define FRAME_WINDOWS_FROZEN(f) (f)->frozen_window_starts
 
-/* True if the frame's window configuration has changed since last call
-   of run_window_size_change_functions.  */
-#define FRAME_WINDOW_CONFIGURATION_CHANGED(f)  \
-  (f)->window_configuration_changed
+/* True if at least one window changed on frame F since the last time
+   window change functions were run on F.  */
+#define FRAME_WINDOW_CHANGE(f) (f)->window_change
+
+/* True if running window state change functions has been explicitly
+   requested for this frame since last redisplay.  */
+#define FRAME_WINDOW_STATE_CHANGE(f) (f)->window_state_change
 
 /* The minibuffer window of frame F, if it has one; otherwise nil.  */
 #define FRAME_MINIBUF_WINDOW(f) f->minibuffer_window
@@ -919,8 +956,10 @@ default_pixels_per_inch_y (void)
 /* The root window of the window tree of frame F.  */
 #define FRAME_ROOT_WINDOW(f) f->root_window
 
-/* The currently selected window of the window tree of frame F.  */
+/* The currently selected window of frame F.  */
 #define FRAME_SELECTED_WINDOW(f) f->selected_window
+/* The old selected window of frame F.  */
+#define FRAME_OLD_SELECTED_WINDOW(f) f->old_selected_window
 
 #define FRAME_INSERT_COST(f) (f)->insert_line_cost
 #define FRAME_DELETE_COST(f) (f)->delete_line_cost
@@ -1215,8 +1254,9 @@ SET_FRAME_VISIBLE (struct frame *f, int v)
   (f)->iconified = (eassert (0 <= (i) && (i) <= 1), (i))
 
 extern Lisp_Object selected_frame;
+extern Lisp_Object old_selected_frame;
 
-#if ! (defined USE_GTK || defined HAVE_NS)
+#ifndef HAVE_EXT_TOOL_BAR
 extern int frame_default_tool_bar_height;
 #endif
 
diff --git a/src/fringe.c b/src/fringe.c
index 6a44de1..335a6eb 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -1,5 +1,5 @@
 /* Fringe handling (split from xdisp.c).
-   Copyright (C) 1985-1988, 1993-1995, 1997-2018 Free Software
+   Copyright (C) 1985-1988, 1993-1995, 1997-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -30,6 +30,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "buffer.h"
 #include "blockinput.h"
 #include "termhooks.h"
+#include "pdumper.h"
 
 /* Fringe bitmaps are represented in three different ways:
 
@@ -719,7 +720,7 @@ static int
 get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, 
int partial_p)
 {
   Lisp_Object cmap, bm1 = Qnil, bm2 = Qnil, bm;
-  EMACS_INT ln1 = 0, ln2 = 0;
+  ptrdiff_t ln1 = 0, ln2 = 0;
   int ix1 = right_p;
   int ix2 = ix1 + (partial_p ? 2 : 0);
 
@@ -743,7 +744,7 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object 
bitmap, int right_p, in
            return NO_FRINGE_BITMAP;
          if (CONSP (bm1))
            {
-             ln1 = XFIXNUM (Flength (bm1));
+             ln1 = list_length (bm1);
              if (partial_p)
                {
                  if (ln1 > ix2)
@@ -778,7 +779,7 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object 
bitmap, int right_p, in
            {
              if (CONSP (bm2))
                {
-                 ln2 = XFIXNUM (Flength (bm2));
+                 ln2 = list_length (bm2);
                  if (partial_p)
                    {
                      if (ln2 > ix2)
@@ -909,6 +910,12 @@ draw_window_fringes (struct window *w, bool no_fringe_p)
   if (w->pseudo_window_p)
     return updated_p;
 
+  /* We must switch to the window's buffer to use its local value of
+     the fringe face, in case it's been remapped in face-remapping-alist.  */
+  Lisp_Object window_buffer = w->contents;
+  struct buffer *oldbuf = current_buffer;
+  set_buffer_internal_1 (XBUFFER (window_buffer));
+
   /* Must draw line if no fringe */
   if (no_fringe_p
       && (WINDOW_LEFT_FRINGE_WIDTH (w) == 0
@@ -926,6 +933,8 @@ draw_window_fringes (struct window *w, bool no_fringe_p)
       updated_p = 1;
     }
 
+  set_buffer_internal_1 (oldbuf);
+
   return updated_p;
 }
 
@@ -1731,12 +1740,18 @@ mark_fringe_data (void)
 
 /* Initialize this module when Emacs starts.  */
 
+static void init_fringe_once_for_pdumper (void);
+
 void
 init_fringe_once (void)
 {
-  int bt;
+  pdumper_do_now_and_after_load (init_fringe_once_for_pdumper);
+}
 
-  for (bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++)
+static void
+init_fringe_once_for_pdumper (void)
+{
+  for (int bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++)
     init_fringe_bitmap (bt, &standard_bitmaps[bt], 1);
 }
 
diff --git a/src/ftcrfont.c b/src/ftcrfont.c
index dc1a389..3a98e78 100644
--- a/src/ftcrfont.c
+++ b/src/ftcrfont.c
@@ -1,5 +1,5 @@
 /* ftcrfont.c -- FreeType font driver on cairo.
-   Copyright (C) 2015-2018 Free Software Foundation, Inc.
+   Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -26,33 +26,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "blockinput.h"
 #include "font.h"
 #include "ftfont.h"
-
-/* FTCR font driver.  */
-
-/* The actual structure for FTCR font.  A pointer to this structure
-   can be cast to struct font *.  */
-
-struct ftcrfont_info
-{
-  struct font font;
-  /* The following six members must be here in this order to be
-     compatible with struct ftfont_info (in ftfont.c).  */
-#ifdef HAVE_LIBOTF
-  bool maybe_otf;        /* Flag to tell if this may be OTF or not.  */
-  OTF *otf;
-#endif /* HAVE_LIBOTF */
-  FT_Size ft_size;
-  int index;
-  FT_Matrix matrix;
-
-  cairo_font_face_t *cr_font_face;
-  /* To prevent cairo from cluttering the activated FT_Size maintained
-     in ftfont.c, we activate this special FT_Size before drawing.  */
-  FT_Size ft_size_draw;
-  /* Font metrics cache.  */
-  struct font_metrics **metrics;
-  short metrics_nrows;
-};
+#include "pdumper.h"
 
 #define METRICS_NCOLS_PER_ROW  (128)
 
@@ -70,7 +44,7 @@ ftcrfont_glyph_extents (struct font *font,
                         unsigned glyph,
                         struct font_metrics *metrics)
 {
-  struct ftcrfont_info *ftcrfont_info = (struct ftcrfont_info *) font;
+  struct font_info *ftcrfont_info = (struct font_info *) font;
   int row, col;
   struct font_metrics *cache;
 
@@ -132,7 +106,7 @@ ftcrfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
 {
   Lisp_Object font_object;
   struct font *font;
-  struct ftcrfont_info *ftcrfont_info;
+  struct font_info *ftcrfont_info;
   FT_Face ft_face;
   FT_UInt size;
 
@@ -140,14 +114,14 @@ ftcrfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
   size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
   if (size == 0)
     size = pixel_size;
-  font_object = font_build_object (VECSIZE (struct ftcrfont_info),
+  font_object = font_build_object (VECSIZE (struct font_info),
                                   Qftcr, entity, size);
   font_object = ftfont_open2 (f, entity, pixel_size, font_object);
   if (NILP (font_object)) return Qnil;
 
   font = XFONT_OBJECT (font_object);
   font->driver = &ftcrfont_driver;
-  ftcrfont_info = (struct ftcrfont_info *) font;
+  ftcrfont_info = (struct font_info *) font;
   ft_face = ftcrfont_info->ft_size->face;
   FT_New_Size (ft_face, &ftcrfont_info->ft_size_draw);
   FT_Activate_Size (ftcrfont_info->ft_size_draw);
@@ -167,7 +141,7 @@ ftcrfont_close (struct font *font)
   if (font_data_structures_may_be_ill_formed ())
     return;
 
-  struct ftcrfont_info *ftcrfont_info = (struct ftcrfont_info *) font;
+  struct font_info *ftcrfont_info = (struct font_info *) font;
   int i;
 
   block_input ();
@@ -223,7 +197,7 @@ ftcrfont_draw (struct glyph_string *s,
 {
   struct frame *f = s->f;
   struct face *face = s->face;
-  struct ftcrfont_info *ftcrfont_info = (struct ftcrfont_info *) s->font;
+  struct font_info *ftcrfont_info = (struct font_info *) s->font;
   cairo_t *cr;
   cairo_glyph_t *glyphs;
   cairo_surface_t *surface;
@@ -281,6 +255,8 @@ ftcrfont_draw (struct glyph_string *s,
 
 
 
+static void syms_of_ftcrfont_for_pdumper (void);
+
 struct font_driver const ftcrfont_driver =
   {
   .type = LISPSYM_INITIALLY (Qftcr),
@@ -312,9 +288,12 @@ struct font_driver const ftcrfont_driver =
 void
 syms_of_ftcrfont (void)
 {
-  if (ftfont_info_size != offsetof (struct ftcrfont_info, cr_font_face))
-    abort ();
-
   DEFSYM (Qftcr, "ftcr");
+  pdumper_do_now_and_after_load (syms_of_ftcrfont_for_pdumper);
+}
+
+static void
+syms_of_ftcrfont_for_pdumper (void)
+{
   register_font_driver (&ftcrfont_driver, NULL);
 }
diff --git a/src/ftfont.c b/src/ftfont.c
index e83eff3..3e820f5 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -1,5 +1,5 @@
 /* ftfont.c -- FreeType font driver.
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006-2019 Free Software Foundation, Inc.
    Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H13PRO009
@@ -24,6 +24,17 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <fontconfig/fontconfig.h>
 #include <fontconfig/fcfreetype.h>
 
+/* These two blocks are here because this file is built when using XFT
+   and when using Cairo, so struct font_info in ftfont.h needs access
+   to the appropriate types.  */
+#ifdef HAVE_XFT
+# include <X11/Xlib.h>
+# include <X11/Xft/Xft.h>
+#endif
+#ifdef USE_CAIRO
+# include <cairo-ft.h>
+#endif
+
 #include <c-strcase.h>
 
 #include "lisp.h"
@@ -34,6 +45,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "composite.h"
 #include "font.h"
 #include "ftfont.h"
+#include "pdumper.h"
 
 static struct font_driver const ftfont_driver;
 
@@ -49,25 +61,6 @@ static Lisp_Object freetype_font_cache;
 /* Cache for FT_Face and FcCharSet. */
 static Lisp_Object ft_face_cache;
 
-/* The actual structure for FreeType font that can be cast to struct
-   font.  */
-
-struct ftfont_info
-{
-  struct font font;
-#ifdef HAVE_LIBOTF
-  /* The following four members must be here in this order to be
-     compatible with struct xftfont_info (in xftfont.c).  */
-  bool maybe_otf;      /* Flag to tell if this may be OTF or not.  */
-  OTF *otf;
-#endif /* HAVE_LIBOTF */
-  FT_Size ft_size;
-  int index;
-  FT_Matrix matrix;
-};
-
-size_t ftfont_info_size = sizeof (struct ftfont_info);
-
 enum ftfont_cache_for
   {
     FTFONT_CACHE_FOR_FACE,
@@ -452,7 +445,7 @@ ftfont_get_fc_charset (Lisp_Object entity)
 
 #ifdef HAVE_LIBOTF
 static OTF *
-ftfont_get_otf (struct ftfont_info *ftfont_info)
+ftfont_get_otf (struct font_info *ftfont_info)
 {
   OTF *otf;
 
@@ -593,16 +586,14 @@ ftfont_get_open_type_spec (Lisp_Object otf_spec)
   spec->nfeatures[0] = spec->nfeatures[1] = 0;
   for (i = 0; i < 2 && ! NILP (otf_spec); i++, otf_spec = XCDR (otf_spec))
     {
-      Lisp_Object len;
-
       val = XCAR (otf_spec);
       if (NILP (val))
        continue;
-      len = Flength (val);
+      ptrdiff_t len = list_length (val);
       spec->features[i] =
-       (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < XFIXNUM (len)
+       (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < len
         ? 0
-        : malloc (XFIXNUM (len) * sizeof *spec->features[i]));
+        : malloc (len * sizeof *spec->features[i]));
       if (! spec->features[i])
        {
          if (i > 0 && spec->features[0])
@@ -1095,7 +1086,7 @@ ftfont_open2 (struct frame *f,
               int pixel_size,
               Lisp_Object font_object)
 {
-  struct ftfont_info *ftfont_info;
+  struct font_info *ftfont_info;
   struct font *font;
   struct ftfont_cache_data *cache_data;
   FT_Face ft_face;
@@ -1146,7 +1137,7 @@ ftfont_open2 (struct frame *f,
 
   ASET (font_object, FONT_FILE_INDEX, filename);
   font = XFONT_OBJECT (font_object);
-  ftfont_info = (struct ftfont_info *) font;
+  ftfont_info = (struct font_info *) font;
   ftfont_info->ft_size = ft_face->size;
   ftfont_info->index = XFIXNUM (idx);
 #ifdef HAVE_LIBOTF
@@ -1236,7 +1227,7 @@ ftfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
   size = XFIXNUM (AREF (entity, FONT_SIZE_INDEX));
   if (size == 0)
     size = pixel_size;
-  font_object = font_build_object (VECSIZE (struct ftfont_info),
+  font_object = font_build_object (VECSIZE (struct font_info),
                                   Qfreetype, entity, size);
   return ftfont_open2 (f, entity, pixel_size, font_object);
 }
@@ -1247,7 +1238,7 @@ ftfont_close (struct font *font)
   if (font_data_structures_may_be_ill_formed ())
     return;
 
-  struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
+  struct font_info *ftfont_info = (struct font_info *) font;
   Lisp_Object val, cache;
 
   val = Fcons (font->props[FONT_FILE_INDEX], make_fixnum (ftfont_info->index));
@@ -1291,9 +1282,9 @@ ftfont_has_char (Lisp_Object font, int c)
     }
   else
     {
-      struct ftfont_info *ftfont_info;
+      struct font_info *ftfont_info;
 
-      ftfont_info = (struct ftfont_info *) XFONT_OBJECT (font);
+      ftfont_info = (struct font_info *) XFONT_OBJECT (font);
       return (FT_Get_Char_Index (ftfont_info->ft_size->face, (FT_ULong) c)
              != 0);
     }
@@ -1302,7 +1293,7 @@ ftfont_has_char (Lisp_Object font, int c)
 unsigned
 ftfont_encode_char (struct font *font, int c)
 {
-  struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
+  struct font_info *ftfont_info = (struct font_info *) font;
   FT_Face ft_face = ftfont_info->ft_size->face;
   FT_ULong charcode = c;
   FT_UInt code = FT_Get_Char_Index (ft_face, charcode);
@@ -1314,7 +1305,7 @@ void
 ftfont_text_extents (struct font *font, unsigned int *code,
                     int nglyphs, struct font_metrics *metrics)
 {
-  struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
+  struct font_info *ftfont_info = (struct font_info *) font;
   FT_Face ft_face = ftfont_info->ft_size->face;
   int i, width = 0;
   bool first;
@@ -1357,7 +1348,7 @@ ftfont_text_extents (struct font *font, unsigned int 
*code,
 int
 ftfont_get_bitmap (struct font *font, unsigned int code, struct font_bitmap 
*bitmap, int bits_per_pixel)
 {
-  struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
+  struct font_info *ftfont_info = (struct font_info *) font;
   FT_Face ft_face = ftfont_info->ft_size->face;
   FT_Int32 load_flags = FT_LOAD_RENDER;
 
@@ -1401,7 +1392,7 @@ int
 ftfont_anchor_point (struct font *font, unsigned int code, int idx,
                     int *x, int *y)
 {
-  struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
+  struct font_info *ftfont_info = (struct font_info *) font;
   FT_Face ft_face = ftfont_info->ft_size->face;
 
   if (ftfont_info->ft_size != ft_face->size)
@@ -1466,7 +1457,7 @@ ftfont_otf_features (OTF_GSUB_GPOS *gsub_gpos)
 Lisp_Object
 ftfont_otf_capability (struct font *font)
 {
-  struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
+  struct font_info *ftfont_info = (struct font_info *) font;
   OTF *otf = ftfont_get_otf (ftfont_info);
   Lisp_Object gsub_gpos;
 
@@ -2616,7 +2607,7 @@ Lisp_Object
 ftfont_shape (Lisp_Object lgstring)
 {
   struct font *font = CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring));
-  struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
+  struct font_info *ftfont_info = (struct font_info *) font;
   OTF *otf = ftfont_get_otf (ftfont_info);
 
   return ftfont_shape_by_flt (lgstring, font, ftfont_info->ft_size->face, otf,
@@ -2630,7 +2621,7 @@ ftfont_shape (Lisp_Object lgstring)
 int
 ftfont_variation_glyphs (struct font *font, int c, unsigned variations[256])
 {
-  struct ftfont_info *ftfont_info = (struct ftfont_info *) font;
+  struct font_info *ftfont_info = (struct font_info *) font;
   OTF *otf = ftfont_get_otf (ftfont_info);
 
   if (! otf)
@@ -2702,6 +2693,8 @@ ftfont_combining_capability (struct font *font)
 #endif
 }
 
+static void syms_of_ftfont_for_pdumper (void);
+
 static struct font_driver const ftfont_driver =
   {
   /* We can't draw a text without device dependent functions.  */
@@ -2753,5 +2746,12 @@ syms_of_ftfont (void)
   staticpro (&ft_face_cache);
   ft_face_cache = Qnil;
 
+  pdumper_do_now_and_after_load (syms_of_ftfont_for_pdumper);
+}
+
+static void
+syms_of_ftfont_for_pdumper (void)
+{
+  PDUMPER_RESET_LV (ft_face_cache, Qnil);
   register_font_driver (&ftfont_driver, NULL);
 }
diff --git a/src/ftfont.h b/src/ftfont.h
index 4201b2c..b6b0c5b 100644
--- a/src/ftfont.h
+++ b/src/ftfont.h
@@ -26,13 +26,13 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include FT_FREETYPE_H
 #include FT_SIZES_H
 #ifdef FT_BDF_H
-#include FT_BDF_H
+# include FT_BDF_H
 #endif
 
 #ifdef HAVE_LIBOTF
-#include <otf.h>
+# include <otf.h>
 #ifdef HAVE_M17N_FLT
-#include <m17n-flt.h>
+# include <m17n-flt.h>
 #endif /* HAVE_M17N_FLT */
 #endif /* HAVE_LIBOTF */
 
@@ -41,6 +41,35 @@ extern Lisp_Object ftfont_open2 (struct frame *f,
                                  Lisp_Object entity,
                                  int pixel_size,
                                  Lisp_Object font_object);
-extern size_t ftfont_info_size;
+
+/* This struct is shared by the XFT, Freetype, and Cairo font
+   backends.  Members up to and including 'matrix' are common, the
+   rest depend on which backend is in use.  */
+struct font_info
+{
+  struct font font;
+#ifdef HAVE_LIBOTF
+  bool maybe_otf;      /* Flag to tell if this may be OTF or not.  */
+  OTF *otf;
+#endif /* HAVE_LIBOTF */
+  FT_Size ft_size;
+  int index;
+  FT_Matrix matrix;
+
+#ifdef USE_CAIRO
+  cairo_font_face_t *cr_font_face;
+  /* To prevent cairo from cluttering the activated FT_Size maintained
+     in ftfont.c, we activate this special FT_Size before drawing.  */
+  FT_Size ft_size_draw;
+  /* Font metrics cache.  */
+  struct font_metrics **metrics;
+  short metrics_nrows;
+#else
+  /* These are used by the XFT backend.  */
+  Display *display;
+  XftFont *xftfont;
+  unsigned x_display_id;
+#endif
+};
 
 #endif /* EMACS_FTFONT_H */
diff --git a/src/ftxfont.c b/src/ftxfont.c
index bf3f109..f9a69c3 100644
--- a/src/ftxfont.c
+++ b/src/ftxfont.c
@@ -1,5 +1,5 @@
 /* ftxfont.c -- FreeType font driver on X (without using XFT).
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006-2019 Free Software Foundation, Inc.
    Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H13PRO009
@@ -28,6 +28,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "frame.h"
 #include "blockinput.h"
 #include "font.h"
+#include "pdumper.h"
 
 /* FTX font driver.  */
 
@@ -339,6 +340,8 @@ ftxfont_end_for_frame (struct frame *f)
 
 
 
+static void syms_of_ftxfont_for_pdumper (void);
+
 struct font_driver const ftxfont_driver =
   {
   /* We can't draw a text without device dependent functions.  */
@@ -373,5 +376,11 @@ void
 syms_of_ftxfont (void)
 {
   DEFSYM (Qftx, "ftx");
+  pdumper_do_now_and_after_load (syms_of_ftxfont_for_pdumper);
+}
+
+static void
+syms_of_ftxfont_for_pdumper (void)
+{
   register_font_driver (&ftxfont_driver, NULL);
 }
diff --git a/src/getpagesize.h b/src/getpagesize.h
index 561014a..aa21cf3 100644
--- a/src/getpagesize.h
+++ b/src/getpagesize.h
@@ -1,5 +1,5 @@
 /* Emulate getpagesize on systems that lack it.
-   Copyright (C) 1986, 1992, 1995, 2001-2018 Free Software Foundation,
+   Copyright (C) 1986, 1992, 1995, 2001-2019 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/gfilenotify.c b/src/gfilenotify.c
index 798f308..a9f33c9 100644
--- a/src/gfilenotify.c
+++ b/src/gfilenotify.c
@@ -1,5 +1,5 @@
 /* Filesystem notifications support with glib API.
-   Copyright (C) 2013-2018 Free Software Foundation, Inc.
+   Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -86,11 +86,11 @@ dir_monitor_callback (GFileMonitor *monitor,
 
       /* Check, whether event_type is expected.  */
       flags = XCAR (XCDR (XCDR (watch_object)));
-      if ((!NILP (Fmember (Qchange, flags)) &&
-          !NILP (Fmember (symbol, list5 (Qchanged, Qchanges_done_hint,
-                                         Qdeleted, Qcreated, Qmoved)))) ||
-         (!NILP (Fmember (Qattribute_change, flags)) &&
-          ((EQ (symbol, Qattribute_changed)))))
+      if ((!NILP (Fmember (Qchange, flags))
+          && !NILP (Fmember (symbol, list5 (Qchanged, Qchanges_done_hint,
+                                            Qdeleted, Qcreated, Qmoved))))
+         || (!NILP (Fmember (Qattribute_change, flags))
+             && EQ (symbol, Qattribute_changed)))
        {
          /* Construct an event.  */
          EVENT_INIT (event);
@@ -108,9 +108,9 @@ dir_monitor_callback (GFileMonitor *monitor,
        }
 
       /* Cancel monitor if file or directory is deleted.  */
-      if (!NILP (Fmember (symbol, list2 (Qdeleted, Qmoved))) &&
-         (strcmp (name, SSDATA (XCAR (XCDR (watch_object)))) == 0) &&
-         !g_file_monitor_is_cancelled (monitor))
+      if (!NILP (Fmember (symbol, list2 (Qdeleted, Qmoved)))
+         && strcmp (name, SSDATA (XCAR (XCDR (watch_object)))) == 0
+         && !g_file_monitor_is_cancelled (monitor))
        g_file_monitor_cancel (monitor);
     }
 
@@ -240,10 +240,10 @@ WATCH-DESCRIPTOR should be an object returned by 
`gfile-add-watch'.  */)
 
   eassert (FIXNUMP (watch_descriptor));
   GFileMonitor *monitor = XFIXNUMPTR (watch_descriptor);
-  if (!g_file_monitor_is_cancelled (monitor) &&
-      !g_file_monitor_cancel (monitor))
-      xsignal2 (Qfile_notify_error, build_string ("Could not rm watch"),
-               watch_descriptor);
+  if (!g_file_monitor_is_cancelled (monitor)
+      && !g_file_monitor_cancel (monitor))
+    xsignal2 (Qfile_notify_error, build_string ("Could not rm watch"),
+             watch_descriptor);
 
   /* Remove watch descriptor from watch list.  */
   watch_list = Fdelq (watch_object, watch_list);
diff --git a/src/gmalloc.c b/src/gmalloc.c
index ebba789..b6a96d5 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -1,5 +1,5 @@
 /* Declarations for `malloc' and friends.
-   Copyright (C) 1990-1993, 1995-1996, 1999, 2002-2007, 2013-2018 Free
+   Copyright (C) 1990-1993, 1995-1996, 1999, 2002-2007, 2013-2019 Free
    Software Foundation, Inc.
                  Written May 1989 by Mike Haertel.
 
@@ -36,9 +36,7 @@ License along with this library.  If not, see 
<https://www.gnu.org/licenses/>.
 #include <pthread.h>
 #endif
 
-#ifdef emacs
-# include "lisp.h"
-#endif
+#include "lisp.h"
 
 #include "ptr-bounds.h"
 
@@ -78,7 +76,6 @@ extern void *(*__morecore) (ptrdiff_t);
 
 #ifdef HYBRID_MALLOC
 # include "sheap.h"
-# define DUMPED bss_sbrk_did_unexec
 #endif
 
 #ifdef __cplusplus
@@ -1510,7 +1507,7 @@ static void *
 gdefault_morecore (ptrdiff_t increment)
 {
 #ifdef HYBRID_MALLOC
-  if (!DUMPED)
+  if (!definitely_will_not_unexec_p ())
     {
       return bss_sbrk (increment);
     }
@@ -1728,6 +1725,8 @@ extern int posix_memalign (void **memptr, size_t 
alignment, size_t size);
 static bool
 allocated_via_gmalloc (void *ptr)
 {
+  if (!__malloc_initialized)
+    return false;
   size_t block = BLOCK (ptr);
   size_t blockmax = _heaplimit - 1;
   return block <= blockmax && _heapinfo[block].busy.type != 0;
@@ -1739,7 +1738,7 @@ allocated_via_gmalloc (void *ptr)
 void *
 hybrid_malloc (size_t size)
 {
-  if (DUMPED)
+  if (definitely_will_not_unexec_p ())
     return malloc (size);
   return gmalloc (size);
 }
@@ -1747,7 +1746,7 @@ hybrid_malloc (size_t size)
 void *
 hybrid_calloc (size_t nmemb, size_t size)
 {
-  if (DUMPED)
+  if (definitely_will_not_unexec_p ())
     return calloc (nmemb, size);
   return gcalloc (nmemb, size);
 }
@@ -1765,7 +1764,7 @@ hybrid_free (void *ptr)
 void *
 hybrid_aligned_alloc (size_t alignment, size_t size)
 {
-  if (!DUMPED)
+  if (!definitely_will_not_unexec_p ())
     return galigned_alloc (alignment, size);
   /* The following is copied from alloc.c */
 #ifdef HAVE_ALIGNED_ALLOC
@@ -1788,7 +1787,7 @@ hybrid_realloc (void *ptr, size_t size)
     return hybrid_malloc (size);
   if (!allocated_via_gmalloc (ptr))
     return realloc (ptr, size);
-  if (!DUMPED)
+  if (!definitely_will_not_unexec_p ())
     return grealloc (ptr, size);
 
   /* The dumped emacs is trying to realloc storage allocated before
@@ -2022,11 +2021,7 @@ mabort (enum mcheck_status status)
 #else
   fprintf (stderr, "mcheck: %s\n", msg);
   fflush (stderr);
-# ifdef emacs
   emacs_abort ();
-# else
-  abort ();
-# endif
 #endif
 }
 
diff --git a/src/gnutls.c b/src/gnutls.c
index d36b637..1afbb2b 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -1,5 +1,5 @@
 /* GnuTLS glue for GNU Emacs.
-   Copyright (C) 2010-2018 Free Software Foundation, Inc.
+   Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -25,36 +25,23 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "gnutls.h"
 #include "coding.h"
 #include "buffer.h"
+#include "pdumper.h"
 
 #if GNUTLS_VERSION_NUMBER >= 0x030014
 # define HAVE_GNUTLS_X509_SYSTEM_TRUST
 #endif
 
-/* Although AEAD support started in GnuTLS 3.4.0 and works in 3.5.14,
-   it was broken through at least GnuTLS 3.4.10; see:
-   https://lists.gnu.org/r/emacs-devel/2017-07/msg00992.html
-   The relevant fix seems to have been made in GnuTLS 3.5.1; see:
-   
https://gitlab.com/gnutls/gnutls/commit/568935848dd6b82b9315d8b6c529d00e2605e03d
-   So, require 3.5.1.  */
-#if GNUTLS_VERSION_NUMBER >= 0x030501
-# define HAVE_GNUTLS_AEAD
-#elif GNUTLS_VERSION_NUMBER < 0x030202
-/* gnutls_cipher_get_tag_size was introduced in 3.2.2, but it's only
-   relevant for AEAD ciphers.  */
-# define gnutls_cipher_get_tag_size(cipher) 0
+#if GNUTLS_VERSION_NUMBER >= 0x030200
+# define HAVE_GNUTLS_CIPHER_GET_IV_SIZE
 #endif
 
-#if GNUTLS_VERSION_NUMBER < 0x030200
-/* gnutls_cipher_get_iv_size was introduced in 3.2.0.  For the ciphers
-   available in previous versions, block size is equivalent.  */
-#define gnutls_cipher_get_iv_size(cipher) gnutls_cipher_get_block_size (cipher)
+#if GNUTLS_VERSION_NUMBER >= 0x030202
+# define HAVE_GNUTLS_CIPHER_GET_TAG_SIZE
+# define HAVE_GNUTLS_DIGEST_LIST /* also gnutls_digest_get_name */
 #endif
 
-#if GNUTLS_VERSION_NUMBER < 0x030202
-/* gnutls_digest_list and gnutls_digest_get_name were added in 3.2.2.
-   For previous versions, the mac algorithms are equivalent.  */
-# define gnutls_digest_list() ((const gnutls_digest_algorithm_t *) 
gnutls_mac_list ())
-# define gnutls_digest_get_name(id) gnutls_mac_get_name 
((gnutls_mac_algorithm_t) id)
+#if GNUTLS_VERSION_NUMBER >= 0x030205
+# define HAVE_GNUTLS_EXT__DUMBFW
 #endif
 
 /* gnutls_mac_get_nonce_size was added in GnuTLS 3.2.0, but was
@@ -67,8 +54,14 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 # define HAVE_GNUTLS_EXT_GET_NAME
 #endif
 
-#if GNUTLS_VERSION_NUMBER >= 0x030205
-# define HAVE_GNUTLS_EXT__DUMBFW
+/* Although AEAD support started in GnuTLS 3.4.0 and works in 3.5.14,
+   it was broken through at least GnuTLS 3.4.10; see:
+   https://lists.gnu.org/r/emacs-devel/2017-07/msg00992.html
+   The relevant fix seems to have been made in GnuTLS 3.5.1; see:
+   
https://gitlab.com/gnutls/gnutls/commit/568935848dd6b82b9315d8b6c529d00e2605e03d
+   So, require 3.5.1.  */
+#if GNUTLS_VERSION_NUMBER >= 0x030501
+# define HAVE_GNUTLS_AEAD
 #endif
 
 #ifdef HAVE_GNUTLS
@@ -79,7 +72,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #  include "w32.h"
 # endif
 
-static bool emacs_gnutls_handle_error (gnutls_session_t, int);
+static int emacs_gnutls_handle_error (gnutls_session_t, int);
 
 static bool gnutls_global_initialized;
 
@@ -223,19 +216,17 @@ DEF_DLL_FN (const gnutls_mac_algorithm_t *, 
gnutls_mac_list, (void));
 DEF_DLL_FN (size_t, gnutls_mac_get_nonce_size, (gnutls_mac_algorithm_t));
 #   endif
 DEF_DLL_FN (size_t, gnutls_mac_get_key_size, (gnutls_mac_algorithm_t));
-#   ifndef gnutls_digest_list
+#   ifdef HAVE_GNUTLS_DIGEST_LIST
 DEF_DLL_FN (const gnutls_digest_algorithm_t *, gnutls_digest_list, (void));
-#   endif
-#   ifndef gnutls_digest_get_name
 DEF_DLL_FN (const char *, gnutls_digest_get_name, (gnutls_digest_algorithm_t));
 #   endif
 DEF_DLL_FN (gnutls_cipher_algorithm_t *, gnutls_cipher_list, (void));
-#   ifndef gnutls_cipher_get_iv_size
+#   ifdef HAVE_GNUTLS_CIPHER_GET_IV_SIZE
 DEF_DLL_FN (int, gnutls_cipher_get_iv_size, (gnutls_cipher_algorithm_t));
 #   endif
 DEF_DLL_FN (size_t, gnutls_cipher_get_key_size, (gnutls_cipher_algorithm_t));
 DEF_DLL_FN (int, gnutls_cipher_get_block_size, (gnutls_cipher_algorithm_t));
-#   ifndef gnutls_cipher_get_tag_size
+#   ifdef HAVE_GNUTLS_CIPHER_GET_TAG_SIZE
 DEF_DLL_FN (int, gnutls_cipher_get_tag_size, (gnutls_cipher_algorithm_t));
 #   endif
 DEF_DLL_FN (int, gnutls_cipher_init,
@@ -365,19 +356,17 @@ init_gnutls_functions (void)
   LOAD_DLL_FN (library, gnutls_mac_get_nonce_size);
 #   endif
   LOAD_DLL_FN (library, gnutls_mac_get_key_size);
-#   ifndef gnutls_digest_list
+#   ifdef HAVE_GNUTLS_DIGEST_LIST
   LOAD_DLL_FN (library, gnutls_digest_list);
-#   endif
-#   ifndef gnutls_digest_get_name
   LOAD_DLL_FN (library, gnutls_digest_get_name);
 #   endif
   LOAD_DLL_FN (library, gnutls_cipher_list);
-#   ifndef gnutls_cipher_get_iv_size
+#   ifdef HAVE_GNUTLS_CIPHER_GET_IV_SIZE
   LOAD_DLL_FN (library, gnutls_cipher_get_iv_size);
 #   endif
   LOAD_DLL_FN (library, gnutls_cipher_get_key_size);
   LOAD_DLL_FN (library, gnutls_cipher_get_block_size);
-#   ifndef gnutls_cipher_get_tag_size
+#   ifdef HAVE_GNUTLS_CIPHER_GET_TAG_SIZE
   LOAD_DLL_FN (library, gnutls_cipher_get_tag_size);
 #   endif
   LOAD_DLL_FN (library, gnutls_cipher_init);
@@ -406,8 +395,7 @@ init_gnutls_functions (void)
 #   endif
 #  endif        /* HAVE_GNUTLS3 */
 
-  max_log_level = global_gnutls_log_level;
-
+  max_log_level = clip_to_bounds (INT_MIN, global_gnutls_log_level, INT_MAX);
   {
     Lisp_Object name = CAR_SAFE (Fget (Qgnutls, QCloaded_from));
     GNUTLS_LOG2 (1, max_log_level, "GnuTLS library loaded:",
@@ -489,19 +477,17 @@ init_gnutls_functions (void)
 #    define gnutls_mac_get_nonce_size fn_gnutls_mac_get_nonce_size
 #   endif
 #  define gnutls_mac_get_key_size fn_gnutls_mac_get_key_size
-#  ifndef gnutls_digest_list
+#  ifdef HAVE_GNUTLS_DIGEST_LIST
 #   define gnutls_digest_list fn_gnutls_digest_list
-#  endif
-#  ifndef gnutls_digest_get_name
 #   define gnutls_digest_get_name fn_gnutls_digest_get_name
 #  endif
 #  define gnutls_cipher_list fn_gnutls_cipher_list
-#  ifndef gnutls_cipher_get_iv_size
+#  ifdef HAVE_GNUTLS_CIPHER_GET_IV_SIZE
 #   define gnutls_cipher_get_iv_size fn_gnutls_cipher_get_iv_size
 #  endif
 #  define gnutls_cipher_get_key_size fn_gnutls_cipher_get_key_size
 #  define gnutls_cipher_get_block_size fn_gnutls_cipher_get_block_size
-#  ifndef gnutls_cipher_get_tag_size
+#  ifdef HAVE_GNUTLS_CIPHER_GET_TAG_SIZE
 #   define gnutls_cipher_get_tag_size fn_gnutls_cipher_get_tag_size
 #  endif
 #  define gnutls_cipher_init fn_gnutls_cipher_init
@@ -592,15 +578,17 @@ gnutls_try_handshake (struct Lisp_Process *proc)
   if (non_blocking)
     proc->gnutls_p = true;
 
-  do
+  while ((ret = gnutls_handshake (state)) < 0)
     {
-      ret = gnutls_handshake (state);
-      emacs_gnutls_handle_error (state, ret);
+      do
+       ret = gnutls_handshake (state);
+      while (ret == GNUTLS_E_INTERRUPTED);
+
+      if (0 <= ret || emacs_gnutls_handle_error (state, ret) == 0
+         || non_blocking)
+       break;
       maybe_quit ();
     }
-  while (ret < 0
-        && gnutls_error_is_fatal (ret) == 0
-        && ! non_blocking);
 
   proc->gnutls_initstage = GNUTLS_STAGE_HANDSHAKE_TRIED;
 
@@ -695,8 +683,6 @@ emacs_gnutls_transport_set_errno (gnutls_session_t state, 
int err)
 ptrdiff_t
 emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t 
nbyte)
 {
-  ssize_t rtnval = 0;
-  ptrdiff_t bytes_written;
   gnutls_session_t state = proc->gnutls_state;
 
   if (proc->gnutls_initstage != GNUTLS_STAGE_READY)
@@ -705,25 +691,19 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char 
*buf, ptrdiff_t nbyte)
       return 0;
     }
 
-  bytes_written = 0;
+  ptrdiff_t bytes_written = 0;
 
   while (nbyte > 0)
     {
-      rtnval = gnutls_record_send (state, buf, nbyte);
+      ssize_t rtnval;
+      do
+       rtnval = gnutls_record_send (state, buf, nbyte);
+      while (rtnval == GNUTLS_E_INTERRUPTED);
 
       if (rtnval < 0)
        {
-         if (rtnval == GNUTLS_E_INTERRUPTED)
-           continue;
-         else
-           {
-             /* If we get GNUTLS_E_AGAIN, then set errno
-                appropriately so that send_process retries the
-                correct way instead of erroring out. */
-             if (rtnval == GNUTLS_E_AGAIN)
-               errno = EAGAIN;
-             break;
-           }
+         emacs_gnutls_handle_error (state, rtnval);
+         break;
        }
 
       buf += rtnval;
@@ -731,14 +711,12 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char 
*buf, ptrdiff_t nbyte)
       bytes_written += rtnval;
     }
 
-  emacs_gnutls_handle_error (state, rtnval);
   return (bytes_written);
 }
 
 ptrdiff_t
 emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte)
 {
-  ssize_t rtnval;
   gnutls_session_t state = proc->gnutls_state;
 
   if (proc->gnutls_initstage != GNUTLS_STAGE_READY)
@@ -747,19 +725,18 @@ emacs_gnutls_read (struct Lisp_Process *proc, char *buf, 
ptrdiff_t nbyte)
       return -1;
     }
 
-  rtnval = gnutls_record_recv (state, buf, nbyte);
+  ssize_t rtnval;
+  do
+    rtnval = gnutls_record_recv (state, buf, nbyte);
+  while (rtnval == GNUTLS_E_INTERRUPTED);
+
   if (rtnval >= 0)
     return rtnval;
   else if (rtnval == GNUTLS_E_UNEXPECTED_PACKET_LENGTH)
     /* The peer closed the connection. */
     return 0;
-  else if (emacs_gnutls_handle_error (state, rtnval))
-    /* non-fatal error */
-    return -1;
-  else {
-    /* a fatal error occurred */
-    return 0;
-  }
+  else
+    return emacs_gnutls_handle_error (state, rtnval);
 }
 
 static char const *
@@ -770,25 +747,25 @@ emacs_gnutls_strerror (int err)
 }
 
 /* Report a GnuTLS error to the user.
-   Return true if the error code was successfully handled.  */
-static bool
+   SESSION is the GnuTLS session, ERR is the (negative) GnuTLS error code.
+   Return 0 if the error was fatal, -1 (setting errno) otherwise so
+   that the caller can notice the error and attempt a repair.  */
+static int
 emacs_gnutls_handle_error (gnutls_session_t session, int err)
 {
-  int max_log_level = 0;
-
-  bool ret;
+  int ret;
 
   /* TODO: use a Lisp_Object generated by gnutls_make_error?  */
-  if (err >= 0)
-    return 1;
 
   check_memory_full (err);
 
-  max_log_level = global_gnutls_log_level;
+  int max_log_level
+    = clip_to_bounds (INT_MIN, global_gnutls_log_level, INT_MAX);
 
   /* TODO: use gnutls-error-fatalp and gnutls-error-string.  */
 
   char const *str = emacs_gnutls_strerror (err);
+  int errnum = EINVAL;
 
   if (gnutls_error_is_fatal (err))
     {
@@ -802,11 +779,11 @@ emacs_gnutls_handle_error (gnutls_session_t session, int 
err)
 # endif
 
       GNUTLS_LOG2 (level, max_log_level, "fatal error:", str);
-      ret = false;
+      ret = 0;
     }
   else
     {
-      ret = true;
+      ret = -1;
 
       switch (err)
         {
@@ -822,6 +799,26 @@ emacs_gnutls_handle_error (gnutls_session_t session, int 
err)
                        "non-fatal error:",
                        str);
         }
+
+      switch (err)
+       {
+       case GNUTLS_E_AGAIN:
+         errnum = EAGAIN;
+         break;
+
+# ifdef EMSGSIZE
+       case GNUTLS_E_LARGE_PACKET:
+       case GNUTLS_E_PUSH_ERROR:
+         errnum = EMSGSIZE;
+         break;
+# endif
+
+# if defined HAVE_GNUTLS3 && defined ECONNRESET
+       case GNUTLS_E_PREMATURE_TERMINATION:
+         errnum = ECONNRESET;
+         break;
+# endif
+       }
     }
 
   if (err == GNUTLS_E_WARNING_ALERT_RECEIVED
@@ -835,6 +832,8 @@ emacs_gnutls_handle_error (gnutls_session_t session, int 
err)
 
       GNUTLS_LOG2 (level, max_log_level, "Received alert: ", str);
     }
+
+  errno = errnum;
   return ret;
 }
 
@@ -1692,14 +1691,17 @@ one trustfile (usually a CA bundle).  */)
 
   state = XPROCESS (proc)->gnutls_state;
 
-  if (TYPE_RANGED_FIXNUMP (int, loglevel))
+  if (INTEGERP (loglevel))
     {
       gnutls_global_set_log_function (gnutls_log_function);
 # ifdef HAVE_GNUTLS3
       gnutls_global_set_audit_log_function (gnutls_audit_log_function);
 # endif
-      gnutls_global_set_log_level (XFIXNUM (loglevel));
-      max_log_level = XFIXNUM (loglevel);
+      int level = (FIXNUMP (loglevel)
+                  ? clip_to_bounds (INT_MIN, XFIXNUM (loglevel), INT_MAX)
+                  : NILP (Fnatnump (loglevel)) ? INT_MIN : INT_MAX);
+      gnutls_global_set_log_level (level);
+      max_log_level = level;
       XPROCESS (proc)->gnutls_log_level = max_log_level;
     }
 
@@ -1955,6 +1957,24 @@ This function may also return `gnutls-e-again', or
 
 #ifdef HAVE_GNUTLS3
 
+# ifndef HAVE_GNUTLS_CIPHER_GET_IV_SIZE
+   /* Block size is equivalent.  */
+#  define gnutls_cipher_get_iv_size(cipher) gnutls_cipher_get_block_size 
(cipher)
+# endif
+
+# ifndef HAVE_GNUTLS_CIPHER_GET_TAG_SIZE
+   /* Tag size is irrelevant.  */
+#  define gnutls_cipher_get_tag_size(cipher) 0
+# endif
+
+# ifndef HAVE_GNUTLS_DIGEST_LIST
+   /* The mac algorithms are equivalent.  */
+#  define gnutls_digest_list() \
+     ((gnutls_digest_algorithm_t const *) gnutls_mac_list ())
+#  define gnutls_digest_get_name(id) \
+     gnutls_mac_get_name ((gnutls_mac_algorithm_t) (id))
+# endif
+
 DEFUN ("gnutls-ciphers", Fgnutls_ciphers, Sgnutls_ciphers, 0, 0, 0,
        doc: /* Return alist of GnuTLS symmetric cipher descriptions as plists.
 The alist key is the cipher name. */)
@@ -1978,7 +1998,7 @@ The alist key is the cipher name. */)
       ptrdiff_t cipher_tag_size = gnutls_cipher_get_tag_size (gca);
 
       Lisp_Object cp
-       = listn (CONSTYPE_HEAP, 15, cipher_symbol,
+        = list (cipher_symbol,
                 QCcipher_id, make_fixnum (gca),
                 QCtype, Qgnutls_type_cipher,
                 QCcipher_aead_capable, cipher_tag_size == 0 ? Qnil : Qt,
@@ -2306,10 +2326,10 @@ name. */)
       Lisp_Object gma_symbol = intern (gnutls_mac_get_name (gma));
 
       size_t nonce_size = 0;
-#ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
+# ifdef HAVE_GNUTLS_MAC_GET_NONCE_SIZE
       nonce_size = gnutls_mac_get_nonce_size (gma);
-#endif
-      Lisp_Object mp = listn (CONSTYPE_HEAP, 11, gma_symbol,
+# endif
+      Lisp_Object mp =  list (gma_symbol,
                              QCmac_algorithm_id, make_fixnum (gma),
                              QCtype, Qgnutls_type_mac_algorithm,
 
@@ -2344,7 +2364,7 @@ method name. */)
       /* A symbol representing the GnuTLS digest algorithm.  */
       Lisp_Object gda_symbol = intern (gnutls_digest_get_name (gda));
 
-      Lisp_Object mp = listn (CONSTYPE_HEAP, 7, gda_symbol,
+      Lisp_Object mp  = list (gda_symbol,
                              QCdigest_algorithm_id, make_fixnum (gda),
                              QCtype, Qgnutls_type_digest_algorithm,
 
@@ -2622,6 +2642,7 @@ syms_of_gnutls (void)
         );
 #ifdef HAVE_GNUTLS
   gnutls_global_initialized = 0;
+  PDUMPER_IGNORE (gnutls_global_initialized);
 
   DEFSYM (Qgnutls_code, "gnutls-code");
   DEFSYM (Qgnutls_anon, "gnutls-anon");
diff --git a/src/gnutls.h b/src/gnutls.h
index 3c55739..6332dad 100644
--- a/src/gnutls.h
+++ b/src/gnutls.h
@@ -1,5 +1,5 @@
 /* GnuTLS glue for GNU Emacs.
-   Copyright (C) 2010-2018 Free Software Foundation, Inc.
+   Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/gtkutil.c b/src/gtkutil.c
index da4a0ae..4bd73b1 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -1,6 +1,6 @@
 /* Functions for creating and updating GTK widgets.
 
-Copyright (C) 2003-2018 Free Software Foundation, Inc.
+Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -147,6 +147,10 @@ struct xg_frame_tb_info
   GtkTextDirection dir;
 };
 
+#ifdef HAVE_XWIDGETS
+bool xg_gtk_initialized;        /* Used to make sure xwidget calls are 
possible */
+#endif
+
 static GtkWidget * xg_get_widget_from_map (ptrdiff_t idx);
 
 
@@ -364,7 +368,11 @@ xg_get_image_for_pixmap (struct frame *f,
                          GtkWidget *widget,
                          GtkImage *old_widget)
 {
+#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+  cairo_surface_t *surface;
+#else
   GdkPixbuf *icon_buf;
+#endif
 
   /* If we have a file, let GTK do all the image handling.
      This seems to be the only way to make insensitive and activated icons
@@ -392,6 +400,17 @@ xg_get_image_for_pixmap (struct frame *f,
      on a monochrome display, and sometimes bad on all displays with
      certain themes.  */
 
+#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+  surface = img->cr_data;
+
+  if (surface)
+    {
+      if (! old_widget)
+        old_widget = GTK_IMAGE (gtk_image_new_from_surface (surface));
+      else
+        gtk_image_set_from_surface (old_widget, surface);
+    }
+#else
   /* This is a workaround to make icons look good on pseudo color
      displays.  Apparently GTK expects the images to have an alpha
      channel.  If they don't, insensitive and activated icons will
@@ -412,6 +431,7 @@ xg_get_image_for_pixmap (struct frame *f,
 
       g_object_unref (G_OBJECT (icon_buf));
     }
+#endif
 
   return GTK_WIDGET (old_widget);
 }
@@ -963,7 +983,7 @@ xg_frame_set_char_size (struct frame *f, int width, int 
height)
     {
       frame_size_history_add
        (f, Qxg_frame_set_char_size_1, width, height,
-        list2 (make_fixnum (gheight), make_fixnum (totalheight)));
+        list2i (gheight, totalheight));
 
       gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
                         gwidth, totalheight);
@@ -972,7 +992,7 @@ xg_frame_set_char_size (struct frame *f, int width, int 
height)
     {
       frame_size_history_add
        (f, Qxg_frame_set_char_size_2, width, height,
-        list2 (make_fixnum (gwidth), make_fixnum (totalwidth)));
+        list2i (gwidth, totalwidth));
 
       gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
                         totalwidth, gheight);
@@ -981,7 +1001,7 @@ xg_frame_set_char_size (struct frame *f, int width, int 
height)
     {
       frame_size_history_add
        (f, Qxg_frame_set_char_size_3, width, height,
-        list2 (make_fixnum (totalwidth), make_fixnum (totalheight)));
+        list2i (totalwidth, totalheight));
 
       gtk_window_resize (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
                         totalwidth, totalheight);
@@ -4256,23 +4276,16 @@ xg_get_page_setup (void)
       eassume (false);
     }
 
-  return listn (CONSTYPE_HEAP, 7,
-               Fcons (Qorientation, orientation_symbol),
-#define MAKE_FLOAT_PAGE_SETUP(f)  make_float (f (page_setup, GTK_UNIT_POINTS))
-               Fcons (Qwidth,
-                      MAKE_FLOAT_PAGE_SETUP (gtk_page_setup_get_page_width)),
-               Fcons (Qheight,
-                      MAKE_FLOAT_PAGE_SETUP (gtk_page_setup_get_page_height)),
-               Fcons (Qleft_margin,
-                      MAKE_FLOAT_PAGE_SETUP (gtk_page_setup_get_left_margin)),
-               Fcons (Qright_margin,
-                      MAKE_FLOAT_PAGE_SETUP (gtk_page_setup_get_right_margin)),
-               Fcons (Qtop_margin,
-                      MAKE_FLOAT_PAGE_SETUP (gtk_page_setup_get_top_margin)),
-               Fcons (Qbottom_margin,
-                      MAKE_FLOAT_PAGE_SETUP (gtk_page_setup_get_bottom_margin))
-#undef MAKE_FLOAT_PAGE_SETUP
-               );
+#define GETSETUP(f) make_float (f (page_setup, GTK_UNIT_POINTS))
+  return
+    list (Fcons (Qorientation, orientation_symbol),
+         Fcons (Qwidth, GETSETUP (gtk_page_setup_get_page_width)),
+         Fcons (Qheight, GETSETUP (gtk_page_setup_get_page_height)),
+         Fcons (Qleft_margin, GETSETUP (gtk_page_setup_get_left_margin)),
+         Fcons (Qright_margin, GETSETUP (gtk_page_setup_get_right_margin)),
+         Fcons (Qtop_margin, GETSETUP (gtk_page_setup_get_top_margin)),
+         Fcons (Qbottom_margin, GETSETUP (gtk_page_setup_get_bottom_margin)));
+#undef GETSETUP
 }
 
 static void
@@ -4297,7 +4310,7 @@ xg_print_frames_dialog (Lisp_Object frames)
     gtk_print_operation_set_print_settings (print, print_settings);
   if (page_setup != NULL)
     gtk_print_operation_set_default_page_setup (print, page_setup);
-  gtk_print_operation_set_n_pages (print, XFIXNUM (Flength (frames)));
+  gtk_print_operation_set_n_pages (print, list_length (frames));
   g_signal_connect (print, "draw-page", G_CALLBACK (draw_page), &frames);
   res = gtk_print_operation_run (print, 
GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG,
                                  NULL, NULL);
@@ -4768,9 +4781,15 @@ xg_tool_item_stale_p (GtkWidget *wbutton, const char 
*stock_name,
     {
       gpointer gold_img = g_object_get_data (G_OBJECT (wimage),
                                              XG_TOOL_BAR_IMAGE_DATA);
+#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+      void *old_img = (void *) gold_img;
+      if (old_img != img->cr_data)
+       return 1;
+#else
       Pixmap old_img = (Pixmap) gold_img;
       if (old_img != img->pixmap)
        return 1;
+#endif
     }
 
   /* Check button configuration and label.  */
@@ -5062,7 +5081,13 @@ update_frame_tool_bar (struct frame *f)
           img = IMAGE_FROM_ID (f, img_id);
           prepare_image_for_display (f, img);
 
-          if (img->load_failed_p || img->pixmap == None)
+          if (img->load_failed_p
+#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+             || img->cr_data == NULL
+#else
+             || img->pixmap == None
+#endif
+             )
             {
               if (ti)
                gtk_container_remove (GTK_CONTAINER (wtoolbar),
@@ -5112,7 +5137,12 @@ update_frame_tool_bar (struct frame *f)
             {
               w = xg_get_image_for_pixmap (f, img, x->widget, NULL);
               g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
-                                 (gpointer)img->pixmap);
+#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+                                 (gpointer)img->cr_data
+#else
+                                 (gpointer)img->pixmap
+#endif
+                                );
             }
 
 #if GTK_CHECK_VERSION (3, 14, 0)
@@ -5321,6 +5351,10 @@ xg_initialize (void)
 #ifdef HAVE_FREETYPE
   x_last_font_name = NULL;
 #endif
+
+#ifdef HAVE_XWIDGETS
+  xg_gtk_initialized = true;
+#endif
 }
 
 #endif /* USE_GTK */
diff --git a/src/gtkutil.h b/src/gtkutil.h
index 7dcd549..ec89978 100644
--- a/src/gtkutil.h
+++ b/src/gtkutil.h
@@ -1,6 +1,6 @@
 /* Definitions and headers for GTK widgets.
 
-Copyright (C) 2003-2018 Free Software Foundation, Inc.
+Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -202,5 +202,6 @@ extern void xg_initialize (void);
    to indicate that the callback should do nothing.  */
 extern bool xg_ignore_gtk_scrollbar;
 
+extern bool xg_gtk_initialized;
 #endif /* USE_GTK */
 #endif /* GTKUTIL_H */
diff --git a/src/image.c b/src/image.c
index ad4f95b..6e415ef 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1,6 +1,6 @@
 /* Functions for image support on window system.
 
-Copyright (C) 1989, 1992-2018 Free Software Foundation, Inc.
+Copyright (C) 1989, 1992-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -46,6 +46,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "coding.h"
 #include "termhooks.h"
 #include "font.h"
+#include "pdumper.h"
 
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
@@ -408,8 +409,13 @@ x_destroy_all_bitmaps (Display_Info *dpyinfo)
   dpyinfo->bitmaps_last = 0;
 }
 
+#ifndef HAVE_XRENDER
+/* Required for the definition of x_create_x_image_and_pixmap below.  */
+typedef void Picture;
+#endif
+
 static bool x_create_x_image_and_pixmap (struct frame *, int, int, int,
-                                        XImagePtr *, Pixmap *);
+                                        XImagePtr *, Pixmap *, Picture *);
 static void x_destroy_x_image (XImagePtr ximg);
 
 #ifdef HAVE_NTGUI
@@ -472,7 +478,8 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
       return;
     }
 
-  result = x_create_x_image_and_pixmap (f, width, height, 1, &mask_img, &mask);
+  result = x_create_x_image_and_pixmap (f, width, height, 1,
+                                        &mask_img, &mask, NULL);
 
   unblock_input ();
   if (!result)
@@ -525,6 +532,33 @@ x_create_bitmap_mask (struct frame *f, ptrdiff_t id)
                            Image types
  ***********************************************************************/
 
+/* Each image format (JPEG, TIFF, ...) supported is described by
+   a structure of the type below.  */
+
+struct image_type
+{
+  /* Index of a symbol uniquely identifying the image type, e.g., 'jpeg'.  */
+  int type;
+
+  /* Check that SPEC is a valid image specification for the given
+     image type.  Value is true if SPEC is valid.  */
+  bool (*valid_p) (Lisp_Object spec);
+
+  /* Load IMG which is used on frame F from information contained in
+     IMG->spec.  Value is true if successful.  */
+  bool (*load) (struct frame *f, struct image *img);
+
+  /* Free resources of image IMG which is used on frame F.  */
+  void (*free) (struct frame *f, struct image *img);
+
+  /* Initialization function (used for dynamic loading of image
+     libraries on Windows), or NULL if none.  */
+  bool (*init) (void);
+
+  /* Next in list of all supported image types.  */
+  struct image_type *next;
+};
+
 /* List of supported image types.  Use define_image_type to add new
    types.  Use lookup_image_type to find a type for a given symbol.  */
 
@@ -984,6 +1018,13 @@ free_image (struct frame *f, struct image *img)
 
       c->images[img->id] = NULL;
 
+#ifdef HAVE_XRENDER
+      if (img->picture)
+        XRenderFreePicture (FRAME_X_DISPLAY (f), img->picture);
+      if (img->mask_picture)
+        XRenderFreePicture (FRAME_X_DISPLAY (f), img->mask_picture);
+#endif
+
       /* Windows NT redefines 'free', but in this file, we need to
          avoid the redefinition.  */
 #ifdef WINDOWSNT
@@ -1116,24 +1157,22 @@ get_spec_bg_or_alpha_as_argb (struct image *img,
   return bgcolor;
 }
 
-static void
-create_cairo_image_surface (struct image *img,
-                            unsigned char *data,
-                            int width,
-                            int height)
+static cairo_surface_t *
+create_cairo_image_surface (int width, int height)
 {
-  cairo_surface_t *surface;
   cairo_format_t format = CAIRO_FORMAT_ARGB32;
-  int stride = cairo_format_stride_for_width (format, width);
-  surface = cairo_image_surface_create_for_data (data,
-                                                 format,
-                                                 width,
-                                                 height,
-                                                 stride);
-  img->width = width;
-  img->height = height;
+  eassert (cairo_format_stride_for_width (format, width) == width * 4);
+
+  return cairo_image_surface_create (format, width, height);
+}
+
+static void
+set_cairo_image_surface (struct image *img, cairo_surface_t *surface)
+{
+  cairo_surface_mark_dirty (surface);
+  img->width = cairo_image_surface_get_width (surface);
+  img->height = cairo_image_surface_get_height (surface);
   img->cr_data = surface;
-  img->cr_data2 = data;
   img->pixmap = 0;
 }
 #endif
@@ -1363,7 +1402,6 @@ x_clear_image (struct frame *f, struct image *img)
 #ifdef USE_CAIRO
   if (img->cr_data)
     cairo_surface_destroy ((cairo_surface_t *)img->cr_data);
-  if (img->cr_data2) xfree (img->cr_data2);
 #endif
   x_clear_image_1 (f, img,
                   CLEAR_IMAGE_PIXMAP | CLEAR_IMAGE_MASK | CLEAR_IMAGE_COLORS);
@@ -1513,7 +1551,7 @@ clear_image_cache (struct frame *f, Lisp_Object filter)
 {
   struct image_cache *c = FRAME_IMAGE_CACHE (f);
 
-  if (c)
+  if (c && !f->inhibit_clear_image_cache)
     {
       ptrdiff_t i, nfreed = 0;
 
@@ -1720,6 +1758,157 @@ postprocess_image (struct frame *f, struct image *img)
     }
 }
 
+#if defined (HAVE_IMAGEMAGICK) || defined (HAVE_NATIVE_SCALING)
+/* Scale an image size by returning SIZE / DIVISOR * MULTIPLIER,
+   safely rounded and clipped to int range.  */
+
+static int
+scale_image_size (int size, size_t divisor, size_t multiplier)
+{
+  if (divisor != 0)
+    {
+      double s = size;
+      double scaled = s * multiplier / divisor + 0.5;
+      if (scaled < INT_MAX)
+       return scaled;
+    }
+  return INT_MAX;
+}
+
+/* Compute the desired size of an image with native size WIDTH x HEIGHT.
+   Use SPEC to deduce the size.  Store the desired size into
+   *D_WIDTH x *D_HEIGHT.  Store -1 x -1 if the native size is OK.  */
+static void
+compute_image_size (size_t width, size_t height,
+                   Lisp_Object spec,
+                   int *d_width, int *d_height)
+{
+  Lisp_Object value;
+  int desired_width = -1, desired_height = -1, max_width = -1, max_height = -1;
+  double scale = 1;
+
+  value = image_spec_value (spec, QCscale, NULL);
+  if (NUMBERP (value))
+    scale = XFLOATINT (value);
+
+  value = image_spec_value (spec, QCmax_width, NULL);
+  if (FIXNATP (value))
+    max_width = min (XFIXNAT (value), INT_MAX);
+
+  value = image_spec_value (spec, QCmax_height, NULL);
+  if (FIXNATP (value))
+    max_height = min (XFIXNAT (value), INT_MAX);
+
+  /* If width and/or height is set in the display spec assume we want
+     to scale to those values.  If either h or w is unspecified, the
+     unspecified should be calculated from the specified to preserve
+     aspect ratio.  */
+  value = image_spec_value (spec, QCwidth, NULL);
+  if (FIXNATP (value))
+    {
+      desired_width = min (XFIXNAT (value) * scale, INT_MAX);
+      /* :width overrides :max-width. */
+      max_width = -1;
+    }
+
+  value = image_spec_value (spec, QCheight, NULL);
+  if (FIXNATP (value))
+    {
+      desired_height = min (XFIXNAT (value) * scale, INT_MAX);
+      /* :height overrides :max-height. */
+      max_height = -1;
+    }
+
+  /* If we have both width/height set explicitly, we skip past all the
+     aspect ratio-preserving computations below. */
+  if (desired_width != -1 && desired_height != -1)
+    goto out;
+
+  width = width * scale;
+  height = height * scale;
+
+  if (desired_width != -1)
+    /* Width known, calculate height. */
+    desired_height = scale_image_size (desired_width, width, height);
+  else if (desired_height != -1)
+    /* Height known, calculate width. */
+    desired_width = scale_image_size (desired_height, height, width);
+  else
+    {
+      desired_width = width;
+      desired_height = height;
+    }
+
+  if (max_width != -1 && desired_width > max_width)
+    {
+      /* The image is wider than :max-width. */
+      desired_width = max_width;
+      desired_height = scale_image_size (desired_width, width, height);
+    }
+
+  if (max_height != -1 && desired_height > max_height)
+    {
+      /* The image is higher than :max-height. */
+      desired_height = max_height;
+      desired_width = scale_image_size (desired_height, height, width);
+    }
+
+ out:
+  *d_width = desired_width;
+  *d_height = desired_height;
+}
+#endif /* HAVE_IMAGEMAGICK || HAVE_NATIVE_SCALING */
+
+static void
+x_set_image_size (struct frame *f, struct image *img)
+{
+#ifdef HAVE_NATIVE_SCALING
+# ifdef HAVE_IMAGEMAGICK
+  /* ImageMagick images are already the correct size.  */
+  if (EQ (image_spec_value (img->spec, QCtype, NULL), Qimagemagick))
+    return;
+# endif
+
+  int width, height;
+  compute_image_size (img->width, img->height, img->spec, &width, &height);
+
+# ifdef HAVE_NS
+  ns_image_set_size (img->pixmap, width, height);
+  img->width = width;
+  img->height = height;
+# endif
+
+# ifdef USE_CAIRO
+  img->width = width;
+  img->height = height;
+# elif defined HAVE_XRENDER
+  if (img->picture)
+    {
+      double xscale = img->width / (double) width;
+      double yscale = img->height / (double) height;
+
+      XTransform tmat
+       = {{{XDoubleToFixed (xscale), XDoubleToFixed (0), XDoubleToFixed (0)},
+           {XDoubleToFixed (0), XDoubleToFixed (yscale), XDoubleToFixed (0)},
+           {XDoubleToFixed (0), XDoubleToFixed (0), XDoubleToFixed (1)}}};
+
+      XRenderSetPictureFilter (FRAME_X_DISPLAY (f), img->picture, FilterBest,
+                              0, 0);
+      XRenderSetPictureTransform (FRAME_X_DISPLAY (f), img->picture, &tmat);
+
+      img->width = width;
+      img->height = height;
+    }
+# endif
+# ifdef HAVE_NTGUI
+  /* Under HAVE_NTGUI, we will scale the image on the fly, when we
+     draw it.  See w32term.c:x_draw_image_foreground.  */
+  img->width = width;
+  img->height = height;
+# endif
+#endif
+}
+
 
 /* Return the id of image with Lisp specification SPEC on frame F.
    SPEC must be a valid Lisp image specification (see valid_image_p).  */
@@ -1775,6 +1964,7 @@ lookup_image (struct frame *f, Lisp_Object spec)
             `:background COLOR'.  */
          Lisp_Object ascent, margin, relief, bg;
          int relief_bound;
+          x_set_image_size (f, img);
 
          ascent = image_spec_value (spec, QCascent, NULL);
          if (FIXNUMP (ascent))
@@ -1949,7 +2139,7 @@ x_check_image_size (XImagePtr ximg, int width, int height)
 
 static bool
 x_create_x_image_and_pixmap (struct frame *f, int width, int height, int depth,
-                            XImagePtr *ximg, Pixmap *pixmap)
+                            XImagePtr *ximg, Pixmap *pixmap, Picture *picture)
 {
 #ifdef HAVE_X_WINDOWS
   Display *display = FRAME_X_DISPLAY (f);
@@ -1991,6 +2181,36 @@ x_create_x_image_and_pixmap (struct frame *f, int width, 
int height, int depth,
       return 0;
     }
 
+# ifdef HAVE_XRENDER
+  int event_basep, error_basep;
+  if (picture && XRenderQueryExtension (display, &event_basep, &error_basep))
+    {
+      if (depth == 32 || depth == 24 || depth == 8)
+        {
+          XRenderPictFormat *format;
+          XRenderPictureAttributes attr;
+
+          /* FIXME: Do we need to handle all possible bit depths?
+             XRenderFindStandardFormat supports PictStandardARGB32,
+             PictStandardRGB24, PictStandardA8, PictStandardA4,
+             PictStandardA1, and PictStandardNUM (what is this?!).
+
+             XRenderFindFormat may support more, but I don't
+             understand the documentation.  */
+          format = XRenderFindStandardFormat (display,
+                                              depth == 32 ? PictStandardARGB32
+                                              : depth == 24 ? PictStandardRGB24
+                                              : PictStandardA8);
+          *picture = XRenderCreatePicture (display, *pixmap, format, 0, &attr);
+        }
+      else
+        {
+          image_error ("Specified image bit depth is not supported by 
XRender");
+          *picture = 0;
+        }
+    }
+# endif
+
   return 1;
 #endif /* HAVE_X_WINDOWS */
 
@@ -2136,7 +2356,8 @@ x_put_x_image (struct frame *f, XImagePtr ximg, Pixmap 
pixmap, int width, int he
 
   eassert (input_blocked_p ());
   gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL);
-  XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height);
+  XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0,
+             ximg->width, ximg->height);
   XFreeGC (FRAME_X_DISPLAY (f), gc);
 #endif /* HAVE_X_WINDOWS */
 
@@ -2164,8 +2385,13 @@ image_create_x_image_and_pixmap (struct frame *f, struct 
image *img,
 {
   eassert ((!mask_p ? img->pixmap : img->mask) == NO_PIXMAP);
 
+  Picture *picture = NULL;
+#ifdef HAVE_XRENDER
+  picture = !mask_p ? &img->picture : &img->mask_picture;
+#endif
   return x_create_x_image_and_pixmap (f, width, height, depth, ximg,
-                                     !mask_p ? &img->pixmap : &img->mask);
+                                     !mask_p ? &img->pixmap : &img->mask,
+                                     picture);
 }
 
 /* Put X image XIMG into image IMG on frame F, as a mask if and only
@@ -2313,10 +2539,10 @@ x_find_image_fd (Lisp_Object file, int *pfd)
       file_found = ENCODE_FILE (file_found);
       if (fd == -2)
        {
-         /* The file exists locally, but has a file handler.  (This
-            happens, e.g., under Auto Image File Mode.)  'openp'
-            didn't open the file, so we should, because the caller
-            expects that.  */
+         /* The file exists locally, but has a file name handler.
+            (This happens, e.g., under Auto Image File Mode.)
+            'openp' didn't open the file, so we should, because the
+            caller expects that.  */
          fd = emacs_open (SSDATA (file_found), O_RDONLY, 0);
        }
     }
@@ -3741,9 +3967,9 @@ xpm_load (struct frame *f, struct image *img)
     {
       int width = img->ximg->width;
       int height = img->ximg->height;
-      void *data = xmalloc (width * height * 4);
+      cairo_surface_t *surface = create_cairo_image_surface (width, height);
       int i;
-      uint32_t *od = data;
+      uint32_t *od = (uint32_t *) cairo_image_surface_get_data (surface);
       uint32_t *id = (uint32_t *) img->ximg->data;
       char *mid = img->mask_img ? img->mask_img->data : 0;
       uint32_t bgcolor = get_spec_bg_or_alpha_as_argb (img, f);
@@ -3762,7 +3988,7 @@ xpm_load (struct frame *f, struct image *img)
             }
         }
 
-      create_cairo_image_surface (img, data, width, height);
+      set_cairo_image_surface (img, surface);
     }
   else
     {
@@ -4001,7 +4227,7 @@ xpm_make_color_table_v (void (**put_func) (Lisp_Object, 
const char *, int,
 {
   *put_func = xpm_put_color_table_v;
   *get_func = xpm_get_color_table_v;
-  return Fmake_vector (make_fixnum (256), Qnil);
+  return make_nil_vector (256);
 }
 
 static void
@@ -5399,8 +5625,8 @@ pbm_load (struct frame *f, struct image *img)
   height = pbm_scan_number (&p, end);
 
 #ifdef USE_CAIRO
-  void *data = xmalloc (width * height * 4);
-  uint32_t *dataptr = data;
+  cairo_surface_t *surface = create_cairo_image_surface (width, height);
+  uint32_t *dataptr = (uint32_t *) cairo_image_surface_get_data (surface);
 #endif
 
   if (type != PBM_MONO)
@@ -5484,7 +5710,7 @@ pbm_load (struct frame *f, struct image *img)
                    if (p >= end)
                      {
 #ifdef USE_CAIRO
-                        xfree (data);
+                        cairo_surface_destroy (surface);
 #else
                        x_destroy_x_image (ximg);
 #endif
@@ -5530,7 +5756,7 @@ pbm_load (struct frame *f, struct image *img)
       if (raw_p && p + expected_size > end)
        {
 #ifdef USE_CAIRO
-          xfree (data);
+          cairo_surface_destroy (surface);
 #else
          x_destroy_x_image (ximg);
 #endif
@@ -5564,7 +5790,7 @@ pbm_load (struct frame *f, struct image *img)
            if (r < 0 || g < 0 || b < 0)
              {
 #ifdef USE_CAIRO
-                xfree (data);
+                cairo_surface_destroy (surface);
 #else
                x_destroy_x_image (ximg);
 #endif
@@ -5601,7 +5827,7 @@ pbm_load (struct frame *f, struct image *img)
   /* Maybe fill in the background field while we have ximg handy.  */
 
 #ifdef USE_CAIRO
-  create_cairo_image_surface (img, data, width, height);
+  set_cairo_image_surface (img, surface);
 #else
   if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
     /* Casting avoids a GCC warning.  */
@@ -5947,7 +6173,7 @@ png_load_body (struct frame *f, struct image *img, struct 
png_load_context *c)
   ptrdiff_t nbytes;
 
 #ifdef USE_CAIRO
-  unsigned char *data = 0;
+  cairo_surface_t *surface;
   uint32_t *dataptr;
 #else
   XImagePtr ximg, mask_img = NULL;
@@ -6162,8 +6388,8 @@ png_load_body (struct frame *f, struct image *img, struct 
png_load_context *c)
     }
 
 #ifdef USE_CAIRO
-  data = (unsigned char *) xmalloc (width * height * 4);
-  dataptr = (uint32_t *) data;
+  surface = create_cairo_image_surface (width, height);
+  dataptr = (uint32_t *) cairo_image_surface_get_data (surface);
 #else
   /* Create an image and pixmap serving as mask if the PNG image
      contains an alpha channel.  */
@@ -6254,7 +6480,7 @@ png_load_body (struct frame *f, struct image *img, struct 
png_load_context *c)
   img->height = height;
 
 #ifdef USE_CAIRO
-  create_cairo_image_surface (img, data, width, height);
+  set_cairo_image_surface (img, surface);
 #else
   /* Maybe fill in the background field while we have ximg handy.
      Casting avoids a GCC warning.  */
@@ -6858,8 +7084,8 @@ jpeg_load_body (struct frame *f, struct image *img,
                                         JPOOL_IMAGE, row_stride, 1);
 #ifdef USE_CAIRO
   {
-    unsigned char *data = (unsigned char *) xmalloc (width*height*4);
-    uint32_t *dataptr = (uint32_t *) data;
+    cairo_surface_t *surface = create_cairo_image_surface (width, height);
+    uint32_t *dataptr = (uint32_t *) cairo_image_surface_get_data (surface);
     int r, g, b;
 
     for (y = 0; y < height; ++y)
@@ -6876,7 +7102,7 @@ jpeg_load_body (struct frame *f, struct image *img,
           }
       }
 
-    create_cairo_image_surface (img, data, width, height);
+    set_cairo_image_surface (img, surface);
   }
 #else
   for (y = 0; y < height; ++y)
@@ -7338,8 +7564,8 @@ tiff_load (struct frame *f, struct image *img)
 
 #ifdef USE_CAIRO
   {
-    unsigned char *data = (unsigned char *) xmalloc (width*height*4);
-    uint32_t *dataptr = (uint32_t *) data;
+    cairo_surface_t *surface = create_cairo_image_surface (width, height);
+    uint32_t *dataptr = (uint32_t *) cairo_image_surface_get_data (surface);
 
     for (y = 0; y < height; ++y)
       {
@@ -7355,7 +7581,7 @@ tiff_load (struct frame *f, struct image *img)
           }
       }
 
-    create_cairo_image_surface (img, data, width, height);
+    set_cairo_image_surface (img, surface);
   }
 #else
   /* Initialize the color table.  */
@@ -7794,9 +8020,8 @@ gif_load (struct frame *f, struct image *img)
     }
 
 #ifdef USE_CAIRO
-  /* xzalloc so data is zero => transparent */
-  void *data = xzalloc (width * height * 4);
-  uint32_t *data32 = data;
+  cairo_surface_t *surface = create_cairo_image_surface (width, height);
+  uint32_t *data32 = (uint32_t *) cairo_image_surface_get_data (surface);
   if (STRINGP (specified_bg))
     {
       XColor color;
@@ -7943,7 +8168,7 @@ gif_load (struct frame *f, struct image *img)
                     {
 #ifdef USE_CAIRO
                       uint32_t *dataptr =
-                        (data32 + ((row + subimg_top) * subimg_width
+                        (data32 + ((row + subimg_top) * width
                                   + x + subimg_left));
                       int r = gif_color_map->Colors[c].Red;
                       int g = gif_color_map->Colors[c].Green;
@@ -7955,7 +8180,7 @@ gif_load (struct frame *f, struct image *img)
                       XPutPixel (ximg, x + subimg_left, row + subimg_top,
                                  pixel_colors[c]);
 #endif
-                    }
+                   }
                }
            }
        }
@@ -7969,7 +8194,7 @@ gif_load (struct frame *f, struct image *img)
                   {
 #ifdef USE_CAIRO
                     uint32_t *dataptr =
-                      (data32 + ((y + subimg_top) * subimg_width
+                      (data32 + ((y + subimg_top) * width
                                 + x + subimg_left));
                     int r = gif_color_map->Colors[c].Red;
                     int g = gif_color_map->Colors[c].Green;
@@ -8039,7 +8264,7 @@ gif_load (struct frame *f, struct image *img)
     }
 
 #ifdef USE_CAIRO
-  create_cairo_image_surface (img, data, width, height);
+  set_cairo_image_surface (img, surface);
 #else
   /* Maybe fill in the background field while we have ximg handy. */
   if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
@@ -8074,105 +8299,6 @@ gif_load (struct frame *f, struct image *img)
                                 ImageMagick
 ***********************************************************************/
 
-/* Scale an image size by returning SIZE / DIVISOR * MULTIPLIER,
-   safely rounded and clipped to int range.  */
-
-static int
-scale_image_size (int size, size_t divisor, size_t multiplier)
-{
-  if (divisor != 0)
-    {
-      double s = size;
-      double scaled = s * multiplier / divisor + 0.5;
-      if (scaled < INT_MAX)
-       return scaled;
-    }
-  return INT_MAX;
-}
-
-/* Compute the desired size of an image with native size WIDTH x HEIGHT.
-   Use SPEC to deduce the size.  Store the desired size into
-   *D_WIDTH x *D_HEIGHT.  Store -1 x -1 if the native size is OK.  */
-static void
-compute_image_size (size_t width, size_t height,
-                   Lisp_Object spec,
-                   int *d_width, int *d_height)
-{
-  Lisp_Object value;
-  int desired_width = -1, desired_height = -1, max_width = -1, max_height = -1;
-  double scale = 1;
-
-  value = image_spec_value (spec, QCscale, NULL);
-  if (NUMBERP (value))
-    scale = XFLOATINT (value);
-
-  value = image_spec_value (spec, QCmax_width, NULL);
-  if (FIXNATP (value))
-    max_width = min (XFIXNAT (value), INT_MAX);
-
-  value = image_spec_value (spec, QCmax_height, NULL);
-  if (FIXNATP (value))
-    max_height = min (XFIXNAT (value), INT_MAX);
-
-  /* If width and/or height is set in the display spec assume we want
-     to scale to those values.  If either h or w is unspecified, the
-     unspecified should be calculated from the specified to preserve
-     aspect ratio.  */
-  value = image_spec_value (spec, QCwidth, NULL);
-  if (FIXNATP (value))
-    {
-      desired_width = min (XFIXNAT (value) * scale, INT_MAX);
-      /* :width overrides :max-width. */
-      max_width = -1;
-    }
-
-  value = image_spec_value (spec, QCheight, NULL);
-  if (FIXNATP (value))
-    {
-      desired_height = min (XFIXNAT (value) * scale, INT_MAX);
-      /* :height overrides :max-height. */
-      max_height = -1;
-    }
-
-  /* If we have both width/height set explicitly, we skip past all the
-     aspect ratio-preserving computations below. */
-  if (desired_width != -1 && desired_height != -1)
-    goto out;
-
-  width = width * scale;
-  height = height * scale;
-
-  if (desired_width != -1)
-    /* Width known, calculate height. */
-    desired_height = scale_image_size (desired_width, width, height);
-  else if (desired_height != -1)
-    /* Height known, calculate width. */
-    desired_width = scale_image_size (desired_height, height, width);
-  else
-    {
-      desired_width = width;
-      desired_height = height;
-    }
-
-  if (max_width != -1 && desired_width > max_width)
-    {
-      /* The image is wider than :max-width. */
-      desired_width = max_width;
-      desired_height = scale_image_size (desired_width, width, height);
-    }
-
-  if (max_height != -1 && desired_height > max_height)
-    {
-      /* The image is higher than :max-height. */
-      desired_height = max_height;
-      desired_width = scale_image_size (desired_height, height, width);
-    }
-
- out:
-  *d_width = desired_width;
-  *d_height = desired_height;
-}
-
 static bool imagemagick_image_p (Lisp_Object);
 static bool imagemagick_load (struct frame *, struct image *);
 static void imagemagick_clear_image (struct frame *, struct image *);
@@ -8566,7 +8692,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
   char hint_buffer[MaxTextExtent];
   char *filename_hint = NULL;
 #ifdef USE_CAIRO
-  void *data = NULL;
+  cairo_surface_t *surface;
 #endif
 
   /* Initialize the ImageMagick environment.  */
@@ -8778,9 +8904,9 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
          ad-hoc and needs to be more researched. */
       void *dataptr;
 #ifdef USE_CAIRO
-      data = xmalloc (width * height * 4);
+      surface = create_cairo_image_surface (width, height);
       const char *exportdepth = "BGRA";
-      dataptr = data;
+      dataptr = cairo_image_surface_get_data (surface);
 #else
       int imagedepth = 24; /*MagickGetImageDepth(image_wand);*/
       const char *exportdepth = imagedepth <= 8 ? "I" : "BGRP"; /*"RGBP";*/
@@ -8827,7 +8953,8 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
       double quantum_range = QuantumRange;
       MagickRealType color_scale = 65535.0 / quantum_range;
 #ifdef USE_CAIRO
-      data = xmalloc (width * height * 4);
+      surface = create_cairo_image_surface (width, height);
+      uint32_t *dataptr = (uint32_t *) cairo_image_surface_get_data (surface);
       color_scale /= 256;
 #else
       /* Try to create a x pixmap to hold the imagemagick pixmap.  */
@@ -8872,7 +8999,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
             {
               PixelGetMagickColor (pixels[x], &pixel);
 #ifdef USE_CAIRO
-             ((uint32_t *)data)[width * y + x] =
+             dataptr[width * y + x] =
                lookup_rgb_color (f,
                                  color_scale * pixel.red,
                                  color_scale * pixel.green,
@@ -8890,7 +9017,7 @@ imagemagick_load_image (struct frame *f, struct image 
*img,
     }
 
 #ifdef USE_CAIRO
-  create_cairo_image_surface (img, data, width, height);
+  set_cairo_image_surface (img, surface);
 #else
 #ifdef COLOR_TABLE_SUPPORT
   /* Remember colors allocated for this image.  */
@@ -8952,8 +9079,8 @@ imagemagick_load (struct frame *f, struct image *img)
 #endif
       success_p = imagemagick_load_image (f, img, 0, 0, SSDATA (file));
     }
-  /* Else its not a file, its a lisp object.  Load the image from a
-     lisp object rather than a file.  */
+  /* Else it's not a file, it's a Lisp object.  Load the image from a
+     Lisp object rather than a file.  */
   else
     {
       Lisp_Object data;
@@ -9261,8 +9388,8 @@ svg_load (struct frame *f, struct image *img)
                                  SSDATA (ENCODE_FILE (file)));
       xfree (contents);
     }
-  /* Else its not a file, its a lisp object.  Load the image from a
-     lisp object rather than a file.  */
+  /* Else it's not a file, it's a Lisp object.  Load the image from a
+     Lisp object rather than a file.  */
   else
     {
       Lisp_Object data, original_filename;
@@ -9353,13 +9480,13 @@ svg_load_image (struct frame *f, struct image *img, 
char *contents,
 
   {
 #ifdef USE_CAIRO
-    unsigned char *data = (unsigned char *) xmalloc (width*height*4);
+    cairo_surface_t *surface = create_cairo_image_surface (width, height);
+    uint32_t *dataptr = (uint32_t *) cairo_image_surface_get_data (surface);
     uint32_t bgcolor = get_spec_bg_or_alpha_as_argb (img, f);
 
     for (int y = 0; y < height; ++y)
       {
         const guchar *iconptr = pixels + y * rowstride;
-        uint32_t *dataptr = (uint32_t *) (data + y * rowstride);
 
         for (int x = 0; x < width; ++x)
           {
@@ -9376,7 +9503,7 @@ svg_load_image (struct frame *f, struct image *img, char 
*contents,
           }
       }
 
-    create_cairo_image_surface (img, data, width, height);
+    set_cairo_image_surface (img, surface);
     g_object_unref (pixbuf);
 #else
     /* Try to create a x pixmap to hold the svg pixmap.  */
@@ -9789,6 +9916,25 @@ DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 
1, 0,
                            Initialization
  ***********************************************************************/
 
+DEFUN ("image-scaling-p", Fimage_scaling_p, Simage_scaling_p, 0, 1, 0,
+       doc: /* Test whether FRAME supports resizing images.
+Return t if FRAME supports native scaling, nil otherwise.  */)
+     (Lisp_Object frame)
+{
+#if defined (USE_CAIRO) || defined (HAVE_NS) || defined (HAVE_NTGUI)
+  return Qt;
+#elif defined (HAVE_X_WINDOWS) && defined (HAVE_XRENDER)
+  int event_basep, error_basep;
+
+  if (XRenderQueryExtension
+      (FRAME_X_DISPLAY (decode_window_system_frame (frame)),
+       &event_basep, &error_basep))
+    return Qt;
+#endif
+
+  return Qnil;
+}
+
 DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 1, 1, 0,
        doc: /* Initialize image library implementing image type TYPE.
 Return non-nil if TYPE is a supported image type.
@@ -9857,7 +10003,7 @@ lookup_image_type (Lisp_Object type)
   return NULL;
 }
 
-#if !defined CANNOT_DUMP && defined HAVE_WINDOW_SYSTEM
+#if defined HAVE_UNEXEC && defined HAVE_WINDOW_SYSTEM
 
 /* Reset image_types before dumping.
    Called from Fdump_emacs.  */
@@ -9878,7 +10024,9 @@ void
 syms_of_image (void)
 {
   /* Initialize this only once; it will be reset before dumping.  */
+  /* The portable dumper will just leave it NULL, so no need to reset.  */
   image_types = NULL;
+  PDUMPER_IGNORE (image_types);
 
   /* Must be defined now because we're going to update it below, while
      defining the supported image types.  */
@@ -10031,6 +10179,8 @@ non-numeric, there is no explicit limit on the size of 
images.  */);
   defsubr (&Slookup_image);
 #endif
 
+  defsubr (&Simage_scaling_p);
+
   DEFVAR_BOOL ("cross-disabled-images", cross_disabled_images,
     doc: /* Non-nil means always draw a cross over disabled images.
 Disabled images are those having a `:conversion disabled' property.
diff --git a/src/indent.c b/src/indent.c
index 1885576..1d5d346 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -1,5 +1,5 @@
 /* Indentation functions.
-   Copyright (C) 1985-1988, 1993-1995, 1998, 2000-2018 Free Software
+   Copyright (C) 1985-1988, 1993-1995, 1998, 2000-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -49,7 +49,7 @@ ptrdiff_t last_known_column_point;
 
 /* Value of MODIFF when current_column was called.  */
 
-static EMACS_INT last_known_column_modified;
+static modiff_count last_known_column_modified;
 
 static ptrdiff_t current_column_1 (void);
 static ptrdiff_t position_indentation (ptrdiff_t);
@@ -1756,14 +1756,14 @@ visible section of the buffer, and pass LINE and COL as 
TOPOS.  */)
 
   CHECK_FIXNUM_COERCE_MARKER (from);
   CHECK_CONS (frompos);
-  CHECK_FIXNUM_CAR (frompos);
-  CHECK_FIXNUM_CDR (frompos);
+  CHECK_FIXNUM (XCAR (frompos));
+  CHECK_FIXNUM (XCDR (frompos));
   CHECK_FIXNUM_COERCE_MARKER (to);
   if (!NILP (topos))
     {
       CHECK_CONS (topos);
-      CHECK_FIXNUM_CAR (topos);
-      CHECK_FIXNUM_CDR (topos);
+      CHECK_FIXNUM (XCAR (topos));
+      CHECK_FIXNUM (XCDR (topos));
     }
   if (!NILP (width))
     CHECK_FIXNUM (width);
@@ -1771,8 +1771,8 @@ visible section of the buffer, and pass LINE and COL as 
TOPOS.  */)
   if (!NILP (offsets))
     {
       CHECK_CONS (offsets);
-      CHECK_FIXNUM_CAR (offsets);
-      CHECK_FIXNUM_CDR (offsets);
+      CHECK_FIXNUM (XCAR (offsets));
+      CHECK_FIXNUM (XCDR (offsets));
       if (! (0 <= XFIXNUM (XCAR (offsets)) && XFIXNUM (XCAR (offsets)) <= 
PTRDIFF_MAX
             && 0 <= XFIXNUM (XCDR (offsets)) && XFIXNUM (XCDR (offsets)) <= 
INT_MAX))
        args_out_of_range (XCAR (offsets), XCDR (offsets));
@@ -2286,7 +2286,7 @@ whether or not it is currently displayed in some window.  
*/)
          it.current_y = 0;
          /* Do this even if LINES is 0, so that we move back to the
             beginning of the current line as we ought.  */
-         if ((nlines < 0 && IT_CHARPOS (it) > 0)
+         if ((nlines < 0 && IT_CHARPOS (it) > BEGV)
              || (nlines == 0 && !(start_x_given && start_x <= to_x)))
            move_it_by_lines (&it, max (PTRDIFF_MIN, nlines));
        }
@@ -2338,7 +2338,7 @@ whether or not it is currently displayed in some window.  
*/)
             and then reposition point at the requested X coordinate;
             if we don't, the cursor will be placed just after the
             string, which might not be the requested column.  */
-         if (nlines > 0 && it.area == TEXT_AREA)
+         if (nlines >= 0 && it.area == TEXT_AREA)
            {
              while (it.method == GET_FROM_STRING
                     && !it.string_from_display_prop_p
diff --git a/src/indent.h b/src/indent.h
index f0fd23a..7fd1067 100644
--- a/src/indent.h
+++ b/src/indent.h
@@ -1,5 +1,5 @@
 /* Definitions for interface to indent.c
-   Copyright (C) 1985-1986, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1985-1986, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/inotify.c b/src/inotify.c
index 6e54c18..ecbe31c 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -1,6 +1,6 @@
 /* Inotify support for Emacs
 
-Copyright (C) 2012-2018 Free Software Foundation, Inc.
+Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/insdel.c b/src/insdel.c
index 70cebc0..1231bb2 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -1,5 +1,5 @@
 /* Buffer insertion/deletion and gap motion for GNU Emacs. -*- coding: utf-8 
-*-
-   Copyright (C) 1985-1986, 1993-1995, 1997-2018 Free Software
+   Copyright (C) 1985-1986, 1993-1995, 1997-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -29,6 +29,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "buffer.h"
 #include "window.h"
 #include "region-cache.h"
+#include "pdumper.h"
 
 static void insert_from_string_1 (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t,
                                  ptrdiff_t, bool, bool);
@@ -707,7 +708,7 @@ insert_char (int c)
   insert ((char *) str, len);
 }
 
-/* Insert the null-terminated string S before point.  */
+/* Insert the NUL-terminated string S before point.  */
 
 void
 insert_string (const char *s)
@@ -902,7 +903,7 @@ insert_1_both (const char *string,
      the insertion.  This, together with recording the insertion,
      will add up to the right stuff in the undo list.  */
   record_insert (PT, nchars);
-  MODIFF++;
+  modiff_incr (&MODIFF);
   CHARS_MODIFF = MODIFF;
 
   memcpy (GPT_ADDR, string, nbytes);
@@ -1030,7 +1031,7 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, 
ptrdiff_t pos_byte,
 #endif
 
   record_insert (PT, nchars);
-  MODIFF++;
+  modiff_incr (&MODIFF);
   CHARS_MODIFF = MODIFF;
 
   GAP_SIZE -= outgoing_nbytes;
@@ -1087,7 +1088,7 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes, bool 
text_at_gap_tail)
      of this dance.  */
   invalidate_buffer_caches (current_buffer, GPT, GPT);
   record_insert (GPT, nchars);
-  MODIFF++;
+  modiff_incr (&MODIFF);
 
   GAP_SIZE -= nbytes;
   if (! text_at_gap_tail)
@@ -1227,7 +1228,7 @@ insert_from_buffer_1 (struct buffer *buf,
 #endif
 
   record_insert (PT, nchars);
-  MODIFF++;
+  modiff_incr (&MODIFF);
   CHARS_MODIFF = MODIFF;
 
   GAP_SIZE -= outgoing_nbytes;
@@ -1328,7 +1329,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte,
 
   if (len == 0)
     evaporate_overlays (from);
-  MODIFF++;
+  modiff_incr (&MODIFF);
   CHARS_MODIFF = MODIFF;
 }
 
@@ -1523,7 +1524,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object 
new,
 
   check_markers ();
 
-  MODIFF++;
+  modiff_incr (&MODIFF);
   CHARS_MODIFF = MODIFF;
 
   if (adjust_match_data)
@@ -1654,7 +1655,7 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
 
   check_markers ();
 
-  MODIFF++;
+  modiff_incr (&MODIFF);
   CHARS_MODIFF = MODIFF;
 }
 
@@ -1829,7 +1830,7 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte,
      at the end of the text before the gap.  */
   adjust_markers_for_delete (from, from_byte, to, to_byte);
 
-  MODIFF++;
+  modiff_incr (&MODIFF);
   CHARS_MODIFF = MODIFF;
 
   /* Relocate point as if it were a marker.  */
@@ -1883,7 +1884,7 @@ modify_text (ptrdiff_t start, ptrdiff_t end)
   BUF_COMPUTE_UNCHANGED (current_buffer, start - 1, end);
   if (MODIFF <= SAVE_MODIFF)
     record_first_change ();
-  MODIFF++;
+  modiff_incr (&MODIFF);
   CHARS_MODIFF = MODIFF;
 
   bset_point_before_scroll (current_buffer, Qnil);
@@ -1927,6 +1928,14 @@ prepare_to_modify_buffer_1 (ptrdiff_t start, ptrdiff_t 
end,
   if (!NILP (BVAR (current_buffer, read_only)))
     Fbarf_if_buffer_read_only (temp);
 
+  /* If we're about to modify a buffer the contents of which come from
+     a dump file, copy the contents to private storage first so we
+     don't take a COW fault on the buffer text and keep it around
+     forever.  */
+  if (pdumper_object_p (BEG_ADDR))
+    enlarge_buffer_text (current_buffer, 0);
+  eassert (!pdumper_object_p (BEG_ADDR));
+
   run_undoable_change();
 
   bset_redisplay (current_buffer);
@@ -2255,7 +2264,7 @@ DEFUN ("combine-after-change-execute", 
Fcombine_after_change_execute,
 
   /* It is rare for combine_after_change_buffer to be invalid, but
      possible.  It can happen when combine-after-change-calls is
-     non-nil, and insertion calls a file handler (e.g. through
+     non-nil, and insertion calls a file name handler (e.g. through
      lock_file) which scribbles into a temp file -- cyd  */
   if (!BUFFERP (combine_after_change_buffer)
       || !BUFFER_LIVE_P (XBUFFER (combine_after_change_buffer)))
diff --git a/src/intervals.c b/src/intervals.c
index 7e77714..8f39c45 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -1,5 +1,5 @@
 /* Code for doing intervals.
-   Copyright (C) 1993-1995, 1997-1998, 2001-2018 Free Software
+   Copyright (C) 1993-1995, 1997-1998, 2001-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -713,11 +713,21 @@ previous_interval (register INTERVAL interval)
   return NULL;
 }
 
-/* Find the interval containing POS given some non-NULL INTERVAL
-   in the same tree.  Note that we need to update interval->position
-   if we go down the tree.
-   To speed up the process, we assume that the ->position of
-   I and all its parents is already uptodate.  */
+/* Set the ->position field of I's parent, based on I->position. */
+#define SET_PARENT_POSITION(i)                                  \
+  if (AM_LEFT_CHILD (i))                                        \
+    INTERVAL_PARENT (i)->position =                             \
+      i->position + TOTAL_LENGTH (i) - LEFT_TOTAL_LENGTH (i);   \
+  else                                                          \
+    INTERVAL_PARENT (i)->position =                             \
+      i->position - LEFT_TOTAL_LENGTH (i)                       \
+      - LENGTH (INTERVAL_PARENT (i))
+
+/* Find the interval containing POS, given some non-NULL INTERVAL in
+   the same tree.  Note that we update interval->position in each
+   interval we traverse, assuming it is already correctly set for the
+   argument I.  We don't assume that any other interval already has a
+   correctly set ->position.  */
 INTERVAL
 update_interval (register INTERVAL i, ptrdiff_t pos)
 {
@@ -738,7 +748,10 @@ update_interval (register INTERVAL i, ptrdiff_t pos)
          else if (NULL_PARENT (i))
            error ("Point before start of properties");
          else
-             i = INTERVAL_PARENT (i);
+            {
+              SET_PARENT_POSITION (i);
+              i = INTERVAL_PARENT (i);
+            }
          continue;
        }
       else if (pos >= INTERVAL_LAST_POS (i))
@@ -753,7 +766,10 @@ update_interval (register INTERVAL i, ptrdiff_t pos)
          else if (NULL_PARENT (i))
            error ("Point %"pD"d after end of properties", pos);
          else
-            i = INTERVAL_PARENT (i);
+            {
+              SET_PARENT_POSITION (i);
+              i = INTERVAL_PARENT (i);
+            }
          continue;
        }
       else
diff --git a/src/intervals.h b/src/intervals.h
index f37372a..e916694 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -1,5 +1,5 @@
 /* Definitions and global variables for intervals.
-   Copyright (C) 1993-1994, 2000-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993-1994, 2000-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -29,14 +29,17 @@ INLINE_HEADER_BEGIN
 struct interval
 {
   /* The first group of entries deal with the tree structure.  */
-
   ptrdiff_t total_length;       /* Length of myself and both children.  */
   ptrdiff_t position;          /* Cache of interval's character position.  */
-                               /* This field is usually updated
-                                  simultaneously with an interval
-                                  traversal, there is no guarantee
-                                  that it is valid for a random
-                                  interval.  */
+                                /* This field is valid in the final
+                                   target interval returned by
+                                   find_interval, next_interval,
+                                   previous_interval and
+                                   update_interval.  It cannot be
+                                   depended upon in any intermediate
+                                   intervals traversed by these
+                                   functions, or any other
+                                   interval. */
   struct interval *left;       /* Intervals which precede me.  */
   struct interval *right;      /* Intervals which succeed me.  */
 
diff --git a/src/json.c b/src/json.c
index e5c0dc2..5e1439f 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1,6 +1,6 @@
 /* JSON parsing and serialization.
 
-Copyright (C) 2017-2018 Free Software Foundation, Inc.
+Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -229,7 +229,7 @@ json_make_string (const char *data, ptrdiff_t size)
                               Qutf_8_unix, Qt, false, true, true);
 }
 
-/* Create a multibyte Lisp string from the null-terminated UTF-8
+/* Create a multibyte Lisp string from the NUL-terminated UTF-8
    string beginning at DATA.  If the string is not a valid UTF-8
    string, an unspecified string is returned.  Note that all callers
    below either pass only value UTF-8 strings or use this function for
@@ -301,10 +301,10 @@ json_release_object (void *object)
 }
 
 /* Signal an error if OBJECT is not a string, or if OBJECT contains
-   embedded null characters.  */
+   embedded NUL characters.  */
 
 static void
-check_string_without_embedded_nulls (Lisp_Object object)
+check_string_without_embedded_nuls (Lisp_Object object)
 {
   CHECK_STRING (object);
   CHECK_TYPE (memchr (SDATA (object), '\0', SBYTES (object)) == NULL,
@@ -381,8 +381,8 @@ lisp_to_json_toplevel_1 (Lisp_Object lisp,
           {
             Lisp_Object key = json_encode (HASH_KEY (h, i));
             /* We can't specify the length, so the string must be
-               null-terminated.  */
-            check_string_without_embedded_nulls (key);
+               NUL-terminated.  */
+            check_string_without_embedded_nuls (key);
             const char *key_str = SSDATA (key);
             /* Reject duplicate keys.  These are possible if the hash
                table test is not `equal'.  */
@@ -432,8 +432,8 @@ lisp_to_json_toplevel_1 (Lisp_Object lisp,
           CHECK_SYMBOL (key_symbol);
           Lisp_Object key = SYMBOL_NAME (key_symbol);
           /* We can't specify the length, so the string must be
-             null-terminated.  */
-          check_string_without_embedded_nulls (key);
+             NUL-terminated.  */
+          check_string_without_embedded_nuls (key);
           key_str = SSDATA (key);
           /* In plists, ensure leading ":" in keys is stripped.  It
              will be reconstructed later in `json_to_lisp'.*/
@@ -568,7 +568,7 @@ false values, t, numbers, strings, or other vectors 
hashtables, alists
 or plists.  t will be converted to the JSON true value.  Vectors will
 be converted to JSON arrays, whereas hashtables, alists and plists are
 converted to JSON objects.  Hashtable keys must be strings without
-embedded null characters and must be unique within each object.  Alist
+embedded NUL characters and must be unique within each object.  Alist
 and plist keys must be symbols; if a key is duplicate, the first
 instance is used.
 
@@ -815,9 +815,9 @@ json_to_lisp (json_t *json, struct json_configuration *conf)
         if (++lisp_eval_depth > max_lisp_eval_depth)
           xsignal0 (Qjson_object_too_deep);
         size_t size = json_array_size (json);
-        if (FIXNUM_OVERFLOW_P (size))
+        if (PTRDIFF_MAX < size)
           overflow_error ();
-        Lisp_Object result = Fmake_vector (make_fixed_natnum (size), Qunbound);
+        Lisp_Object result = make_vector (size, Qunbound);
         for (ptrdiff_t i = 0; i < size; ++i)
           ASET (result, i,
                 json_to_lisp (json_array_get (json, i), conf));
@@ -945,7 +945,7 @@ usage: (json-parse-string STRING &rest ARGS) */)
 
   Lisp_Object string = args[0];
   Lisp_Object encoded = json_encode (string);
-  check_string_without_embedded_nulls (encoded);
+  check_string_without_embedded_nuls (encoded);
   struct json_configuration conf = {json_object_hashtable, QCnull, QCfalse};
   json_parse_args (nargs - 1, args + 1, &conf, true);
 
diff --git a/src/keyboard.c b/src/keyboard.c
index 9d84716..04dbdb3 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1,6 +1,6 @@
 /* Keyboard and mouse input; editor command loop.
 
-Copyright (C) 1985-1989, 1993-1997, 1999-2018 Free Software Foundation,
+Copyright (C) 1985-1989, 1993-1997, 1999-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -68,6 +68,8 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 #include <ignore-value.h>
 
+#include "pdumper.h"
+
 #ifdef HAVE_WINDOW_SYSTEM
 #include TERM_HEADER
 #endif /* HAVE_WINDOW_SYSTEM */
@@ -92,7 +94,7 @@ volatile int interrupt_input_blocked;
    The maybe_quit function checks this.  */
 volatile bool pending_signals;
 
-#define KBD_BUFFER_SIZE 4096
+enum { KBD_BUFFER_SIZE = 4096 };
 
 KBOARD *initial_kboard;
 KBOARD *current_kboard;
@@ -206,7 +208,7 @@ struct buffer *buffer_before_last_command_or_undo;
 
 /* Value of num_nonmacro_input_events as of last auto save.  */
 
-static EMACS_INT last_auto_save;
+static intmax_t last_auto_save;
 
 /* The value of point when the last command was started. */
 static ptrdiff_t last_point_position;
@@ -286,15 +288,11 @@ static bool input_was_pending;
 static union buffered_input_event kbd_buffer[KBD_BUFFER_SIZE];
 
 /* Pointer to next available character in kbd_buffer.
-   If kbd_fetch_ptr == kbd_store_ptr, the buffer is empty.
-   This may be kbd_buffer + KBD_BUFFER_SIZE, meaning that the
-   next available char is in kbd_buffer[0].  */
+   If kbd_fetch_ptr == kbd_store_ptr, the buffer is empty.  */
 static union buffered_input_event *kbd_fetch_ptr;
 
-/* Pointer to next place to store character in kbd_buffer.  This
-   may be kbd_buffer + KBD_BUFFER_SIZE, meaning that the next
-   character should go in kbd_buffer[0].  */
-static union buffered_input_event *volatile kbd_store_ptr;
+/* Pointer to next place to store character in kbd_buffer.  */
+static union buffered_input_event *kbd_store_ptr;
 
 /* The above pair of variables forms a "queue empty" flag.  When we
    enqueue a non-hook event, we increment kbd_store_ptr.  When we
@@ -302,8 +300,7 @@ static union buffered_input_event *volatile kbd_store_ptr;
    there is input available if the two pointers are not equal.
 
    Why not just have a flag set and cleared by the enqueuing and
-   dequeuing functions?  Such a flag could be screwed up by interrupts
-   at inopportune times.  */
+   dequeuing functions?  The code is a bit simpler this way.  */
 
 static void recursive_edit_unwind (Lisp_Object buffer);
 static Lisp_Object command_loop (void);
@@ -363,7 +360,7 @@ static Lisp_Object make_lispy_focus_in (Lisp_Object);
 static Lisp_Object make_lispy_focus_out (Lisp_Object);
 static bool help_char_p (Lisp_Object);
 static void save_getcjmp (sys_jmp_buf);
-static void restore_getcjmp (sys_jmp_buf);
+static void restore_getcjmp (void *);
 static Lisp_Object apply_modifiers (int, Lisp_Object);
 static void restore_kboard_configuration (int);
 static void handle_interrupt (bool);
@@ -375,6 +372,20 @@ static void deliver_user_signal (int);
 static char *find_user_signal_name (int);
 static void store_user_signal_events (void);
 
+/* Advance or retreat a buffered input event pointer.  */
+
+static union buffered_input_event *
+next_kbd_event (union buffered_input_event *ptr)
+{
+  return ptr == kbd_buffer + KBD_BUFFER_SIZE - 1 ? kbd_buffer : ptr + 1;
+}
+
+static union buffered_input_event *
+prev_kbd_event (union buffered_input_event *ptr)
+{
+  return ptr == kbd_buffer ? kbd_buffer + KBD_BUFFER_SIZE - 1 : ptr - 1;
+}
+
 /* Like EVENT_START, but assume EVENT is an event.
    This pacifies gcc -Wnull-dereference, which might otherwise
    complain about earlier checks that EVENT is indeed an event.  */
@@ -728,7 +739,8 @@ void
 force_auto_save_soon (void)
 {
   last_auto_save = - auto_save_interval - 1;
-
+  /* FIXME: What's the relationship between forcing auto-save and adding
+     a buffer-switch event?  */
   record_asynch_buffer_change ();
 }
 #endif
@@ -1204,7 +1216,7 @@ some_mouse_moved (void)
 
   if (ignore_mouse_drag_p)
     {
-      /* ignore_mouse_drag_p = 0; */
+      /* ignore_mouse_drag_p = false; */
       return 0;
     }
 
@@ -1229,7 +1241,7 @@ static void adjust_point_for_property (ptrdiff_t, bool);
 Lisp_Object
 command_loop_1 (void)
 {
-  EMACS_INT prev_modiff = 0;
+  modiff_count prev_modiff = 0;
   struct buffer *prev_buffer = NULL;
   bool already_adjusted = 0;
 
@@ -1292,7 +1304,7 @@ command_loop_1 (void)
         loop.  (This flag is set in xdisp.c whenever the tool bar is
         resized, because the resize moves text up or down, and would
         generate false mouse drag events if we don't ignore them.)  */
-      ignore_mouse_drag_p = 0;
+      ignore_mouse_drag_p = false;
 
       /* If minibuffer on and echo area in use,
         wait a short time and redraw minibuffer.  */
@@ -1319,7 +1331,7 @@ command_loop_1 (void)
          if (!NILP (Vquit_flag))
            {
              Vquit_flag = Qnil;
-             Vunread_command_events = list1 (make_fixnum (quit_char));
+             Vunread_command_events = list1i (quit_char);
            }
        }
 
@@ -1467,8 +1479,12 @@ command_loop_1 (void)
       safe_run_hooks (Qpost_command_hook);
 
       /* If displaying a message, resize the echo area window to fit
-        that message's size exactly.  */
-      if (!NILP (echo_area_buffer[0]))
+        that message's size exactly.  Do this only if the echo area
+        window is the minibuffer window of the selected frame.  See
+        Bug#34317.  */
+      if (!NILP (echo_area_buffer[0])
+         && (EQ (echo_area_window,
+                 FRAME_MINIBUF_WINDOW (XFRAME (selected_frame)))))
        resize_echo_area_exactly ();
 
       /* If there are warnings waiting, process them.  */
@@ -1957,14 +1973,14 @@ void
 bind_polling_period (int n)
 {
 #ifdef POLL_FOR_INPUT
-  EMACS_INT new = polling_period;
+  intmax_t new = polling_period;
 
   if (n > new)
     new = n;
 
   stop_other_atimers (poll_timer);
   stop_polling ();
-  specbind (Qpolling_period, make_fixnum (new));
+  specbind (Qpolling_period, make_int (new));
   /* Start a new alarm with the new period.  */
   start_polling ();
 #endif
@@ -2117,12 +2133,14 @@ read_event_from_main_queue (struct timespec *end_time,
     return c;
 
   /* Actually read a character, waiting if necessary.  */
+  ptrdiff_t count = SPECPDL_INDEX ();
   save_getcjmp (save_jump);
+  record_unwind_protect_ptr (restore_getcjmp, save_jump);
   restore_getcjmp (local_getcjmp);
   if (!end_time)
     timer_start_idle ();
   c = kbd_buffer_get_event (&kb, used_mouse_menu, end_time);
-  restore_getcjmp (save_jump);
+  unbind_to (count, Qnil);
 
   if (! NILP (c) && (kb != current_kboard))
     {
@@ -2349,7 +2367,14 @@ read_char (int commandflag, Lisp_Object map,
       if (CONSP (c) && EQ (XCAR (c), Qt))
        c = XCDR (c);
       else
-       reread = true;
+       {
+         if (CONSP (c) && EQ (XCAR (c), Qno_record))
+           {
+             c = XCDR (c);
+             recorded = true;
+           }
+         reread = true;
+       }
 
       /* Undo what read_char_x_menu_prompt did when it unread
         additional keys returned by Fx_popup_menu.  */
@@ -2411,7 +2436,7 @@ read_char (int commandflag, Lisp_Object map,
          goto exit;
        }
 
-      c = Faref (Vexecuting_kbd_macro, make_fixnum 
(executing_kbd_macro_index));
+      c = Faref (Vexecuting_kbd_macro, make_int (executing_kbd_macro_index));
       if (STRINGP (Vexecuting_kbd_macro)
          && (XFIXNAT (c) & 0x80) && (XFIXNAT (c) <= 0xff))
        XSETFASTINT (c, CHAR_META | (XFIXNAT (c) & ~0x80));
@@ -2540,7 +2565,10 @@ read_char (int commandflag, Lisp_Object map,
       restore_getcjmp (save_jump);
       pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
       unbind_to (jmpcount, Qnil);
-      XSETINT (c, quit_char);
+      /* If we are in while-no-input, don't trigger C-g, as that will
+        quit instead of letting while-no-input do its thing.  */
+      if (!EQ (Vquit_flag, Vthrow_on_input))
+       XSETINT (c, quit_char);
       internal_last_event_frame = selected_frame;
       Vlast_event_frame = internal_last_event_frame;
       /* If we report the quit char as an event,
@@ -2611,10 +2639,12 @@ read_char (int commandflag, Lisp_Object map,
        {
          Lisp_Object tem0;
 
+         ptrdiff_t count = SPECPDL_INDEX ();
          save_getcjmp (save_jump);
+         record_unwind_protect_ptr (restore_getcjmp, save_jump);
          restore_getcjmp (local_getcjmp);
          tem0 = sit_for (Vecho_keystrokes, 1, 1);
-         restore_getcjmp (save_jump);
+         unbind_to (count, Qnil);
          if (EQ (tem0, Qt)
              && ! CONSP (Vunread_command_events))
            echo_now ();
@@ -2685,10 +2715,12 @@ read_char (int commandflag, Lisp_Object map,
 
          timeout = min (timeout, MOST_POSITIVE_FIXNUM / delay_level * 4);
          timeout = delay_level * timeout / 4;
+         ptrdiff_t count1 = SPECPDL_INDEX ();
          save_getcjmp (save_jump);
+         record_unwind_protect_ptr (restore_getcjmp, save_jump);
          restore_getcjmp (local_getcjmp);
          tem0 = sit_for (make_fixnum (timeout), 1, 1);
-         restore_getcjmp (save_jump);
+         unbind_to (count1, Qnil);
 
          if (EQ (tem0, Qt)
              && ! CONSP (Vunread_command_events))
@@ -2723,7 +2755,14 @@ read_char (int commandflag, Lisp_Object map,
       if (CONSP (c) && EQ (XCAR (c), Qt))
        c = XCDR (c);
       else
-       reread = true;
+       {
+         if (CONSP (c) && EQ (XCAR (c), Qno_record))
+           {
+             c = XCDR (c);
+             recorded = true;
+           }
+         reread = true;
+       }
     }
 
   /* Read something from current KBOARD's side queue, if possible.  */
@@ -2785,6 +2824,11 @@ read_char (int commandflag, Lisp_Object map,
 
       if (CONSP (c) && EQ (XCAR (c), Qt))
        c = XCDR (c);
+      else if (CONSP (c) && EQ (XCAR (c), Qno_record))
+       {
+         c = XCDR (c);
+         recorded = true;
+       }
   }
 
  non_reread:
@@ -3309,7 +3353,7 @@ save_getcjmp (sys_jmp_buf temp)
 }
 
 static void
-restore_getcjmp (sys_jmp_buf temp)
+restore_getcjmp (void *temp)
 {
   memcpy (getcjmp, temp, sizeof getcjmp);
 }
@@ -3340,8 +3384,6 @@ readable_events (int flags)
 
          do
            {
-              if (event == kbd_buffer + KBD_BUFFER_SIZE)
-                event = kbd_buffer;
              if (!(
 #ifdef USE_TOOLKIT_SCROLL_BARS
                    (flags & READABLE_EVENTS_FILTER_EVENTS) &&
@@ -3358,7 +3400,7 @@ readable_events (int flags)
                  && !((flags & READABLE_EVENTS_FILTER_EVENTS)
                       && event->kind == BUFFER_SWITCH_EVENT))
                return 1;
-             event++;
+             event = next_kbd_event (event);
            }
          while (event != kbd_store_ptr);
         }
@@ -3412,12 +3454,8 @@ event_to_kboard (struct input_event *event)
 static int
 kbd_buffer_nr_stored (void)
 {
-  return kbd_fetch_ptr == kbd_store_ptr
-    ? 0
-    : (kbd_fetch_ptr < kbd_store_ptr
-       ? kbd_store_ptr - kbd_fetch_ptr
-       : ((kbd_buffer + KBD_BUFFER_SIZE) - kbd_fetch_ptr
-          + (kbd_store_ptr - kbd_buffer)));
+  int n = kbd_store_ptr - kbd_fetch_ptr;
+  return n + (n < 0 ? KBD_BUFFER_SIZE : 0);
 }
 #endif /* Store an event obtained at interrupt level into kbd_buffer, fifo */
 
@@ -3468,12 +3506,10 @@ kbd_buffer_store_buffered_event (union 
buffered_input_event *event,
                (kb, list2 (make_lispy_switch_frame (event->ie.frame_or_window),
                            make_fixnum (c)));
              kb->kbd_queue_has_data = true;
-             union buffered_input_event *sp;
-             for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++)
-               {
-                 if (sp == kbd_buffer + KBD_BUFFER_SIZE)
-                   sp = kbd_buffer;
 
+             for (union buffered_input_event *sp = kbd_fetch_ptr;
+                  sp != kbd_store_ptr; sp = next_kbd_event (sp))
+               {
                  if (event_to_kboard (&sp->ie) == kb)
                    {
                      sp->ie.kind = NO_EVENT;
@@ -3518,22 +3554,18 @@ kbd_buffer_store_buffered_event (union 
buffered_input_event *event,
      Just ignore the second one.  */
   else if (event->kind == BUFFER_SWITCH_EVENT
           && kbd_fetch_ptr != kbd_store_ptr
-          && ((kbd_store_ptr == kbd_buffer
-               ? kbd_buffer + KBD_BUFFER_SIZE - 1
-               : kbd_store_ptr - 1)->kind) == BUFFER_SWITCH_EVENT)
+          && prev_kbd_event (kbd_store_ptr)->kind == BUFFER_SWITCH_EVENT)
     return;
 
-  if (kbd_store_ptr - kbd_buffer == KBD_BUFFER_SIZE)
-    kbd_store_ptr = kbd_buffer;
-
   /* Don't let the very last slot in the buffer become full,
      since that would make the two pointers equal,
      and that is indistinguishable from an empty buffer.
      Discard the event if it would fill the last slot.  */
-  if (kbd_fetch_ptr - 1 != kbd_store_ptr)
+  union buffered_input_event *next_slot = next_kbd_event (kbd_store_ptr);
+  if (kbd_fetch_ptr != next_slot)
     {
       *kbd_store_ptr = *event;
-      ++kbd_store_ptr;
+      kbd_store_ptr = next_slot;
 #ifdef subprocesses
       if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE / 2
          && ! kbd_on_hold_p ())
@@ -3576,11 +3608,8 @@ kbd_buffer_store_buffered_event (union 
buffered_input_event *event,
 void
 kbd_buffer_unget_event (struct selection_input_event *event)
 {
-  if (kbd_fetch_ptr == kbd_buffer)
-    kbd_fetch_ptr = kbd_buffer + KBD_BUFFER_SIZE;
-
   /* Don't let the very last slot in the buffer become full,  */
-  union buffered_input_event *kp = kbd_fetch_ptr - 1;
+  union buffered_input_event *kp = prev_kbd_event (kbd_fetch_ptr);
   if (kp != kbd_store_ptr)
     {
       kp->sie = *event;
@@ -3668,12 +3697,9 @@ kbd_buffer_store_help_event (Lisp_Object frame, 
Lisp_Object help)
 void
 discard_mouse_events (void)
 {
-  union buffered_input_event *sp;
-  for (sp = kbd_fetch_ptr; sp != kbd_store_ptr; sp++)
+  for (union buffered_input_event *sp = kbd_fetch_ptr;
+       sp != kbd_store_ptr; sp = next_kbd_event (sp))
     {
-      if (sp == kbd_buffer + KBD_BUFFER_SIZE)
-       sp = kbd_buffer;
-
       if (sp->kind == MOUSE_CLICK_EVENT
          || sp->kind == WHEEL_EVENT
           || sp->kind == HORIZ_WHEEL_EVENT
@@ -3698,18 +3724,13 @@ discard_mouse_events (void)
 bool
 kbd_buffer_events_waiting (void)
 {
-  union buffered_input_event *sp;
-
-  for (sp = kbd_fetch_ptr;
-       sp != kbd_store_ptr && sp->kind == NO_EVENT;
-       ++sp)
-    {
-      if (sp == kbd_buffer + KBD_BUFFER_SIZE)
-       sp = kbd_buffer;
-    }
-
-  kbd_fetch_ptr = sp;
-  return sp != kbd_store_ptr && sp->kind != NO_EVENT;
+  for (union buffered_input_event *sp = kbd_fetch_ptr;
+       ; sp = next_kbd_event (sp))
+    if (sp == kbd_store_ptr || sp->kind != NO_EVENT)
+      {
+       kbd_fetch_ptr = sp;
+       return sp != kbd_store_ptr && sp->kind != NO_EVENT;
+      }
 }
 
 
@@ -3838,11 +3859,7 @@ kbd_buffer_get_event (KBOARD **kbp,
      mouse movement enabled and available.  */
   if (kbd_fetch_ptr != kbd_store_ptr)
     {
-      union buffered_input_event *event;
-
-      event = ((kbd_fetch_ptr < kbd_buffer + KBD_BUFFER_SIZE)
-              ? kbd_fetch_ptr
-              : kbd_buffer);
+      union buffered_input_event *event = kbd_fetch_ptr;
 
       *kbp = event_to_kboard (&event->ie);
       if (*kbp == 0)
@@ -3863,7 +3880,7 @@ kbd_buffer_get_event (KBOARD **kbp,
             since otherwise swallow_events will see it
             and process it again.  */
          struct selection_input_event copy = event->sie;
-         kbd_fetch_ptr = event + 1;
+         kbd_fetch_ptr = next_kbd_event (event);
          input_pending = readable_events (0);
          x_handle_selection_event (&copy);
 #else
@@ -3874,11 +3891,10 @@ kbd_buffer_get_event (KBOARD **kbp,
        }
         break;
 
-#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
-    || defined (HAVE_NS) || defined (USE_GTK)
+#ifdef HAVE_EXT_MENU_BAR
       case MENU_BAR_ACTIVATE_EVENT:
        {
-         kbd_fetch_ptr = event + 1;
+         kbd_fetch_ptr = next_kbd_event (event);
          input_pending = readable_events (0);
          if (FRAME_LIVE_P (XFRAME (event->ie.frame_or_window)))
            x_activate_menubar (XFRAME (event->ie.frame_or_window));
@@ -3923,7 +3939,7 @@ kbd_buffer_get_event (KBOARD **kbp,
       case SELECT_WINDOW_EVENT:
         {
           obj = make_lispy_event (&event->ie);
-          kbd_fetch_ptr = event + 1;
+          kbd_fetch_ptr = next_kbd_event (event);
         }
         break;
       default:
@@ -3955,8 +3971,7 @@ kbd_buffer_get_event (KBOARD **kbp,
            {
              obj = make_lispy_event (&event->ie);
 
-#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
-    || defined (HAVE_NS) || defined (USE_GTK)
+#ifdef HAVE_EXT_MENU_BAR
              /* If this was a menu selection, then set the flag to inhibit
                 writing to last_nonmenu_event.  Don't do this if the event
                 we're returning is (menu-bar), though; that indicates the
@@ -3977,7 +3992,7 @@ kbd_buffer_get_event (KBOARD **kbp,
 
              /* Wipe out this event, to catch bugs.  */
              clear_event (&event->ie);
-             kbd_fetch_ptr = event + 1;
+             kbd_fetch_ptr = next_kbd_event (event);
            }
        }
       }
@@ -4044,17 +4059,9 @@ kbd_buffer_get_event (KBOARD **kbp,
 static void
 process_special_events (void)
 {
-  union buffered_input_event *event;
-
-  for (event = kbd_fetch_ptr; event != kbd_store_ptr; ++event)
+  for (union buffered_input_event *event = kbd_fetch_ptr;
+       event != kbd_store_ptr; event = next_kbd_event (event))
     {
-      if (event == kbd_buffer + KBD_BUFFER_SIZE)
-       {
-         event = kbd_buffer;
-         if (event == kbd_store_ptr)
-           break;
-       }
-
       /* If we find a stored X selection request, handle it now.  */
       if (event->kind == SELECTION_REQUEST_EVENT
          || event->kind == SELECTION_CLEAR_EVENT)
@@ -4068,28 +4075,21 @@ process_special_events (void)
             cyclically.  */
 
          struct selection_input_event copy = event->sie;
-         union buffered_input_event *beg
-           = (kbd_fetch_ptr == kbd_buffer + KBD_BUFFER_SIZE)
-           ? kbd_buffer : kbd_fetch_ptr;
+         int moved_events;
 
-         if (event > beg)
-           memmove (beg + 1, beg, (event - beg) * sizeof *beg);
-         else if (event < beg)
+         if (event < kbd_fetch_ptr)
            {
-             if (event > kbd_buffer)
-               memmove (kbd_buffer + 1, kbd_buffer,
-                        (event - kbd_buffer) * sizeof *kbd_buffer);
-             *kbd_buffer = *(kbd_buffer + KBD_BUFFER_SIZE - 1);
-             if (beg < kbd_buffer + KBD_BUFFER_SIZE - 1)
-               memmove (beg + 1, beg,
-                        (kbd_buffer + KBD_BUFFER_SIZE - 1 - beg) * sizeof 
*beg);
+             memmove (kbd_buffer + 1, kbd_buffer,
+                      (event - kbd_buffer) * sizeof *kbd_buffer);
+             kbd_buffer[0] = kbd_buffer[KBD_BUFFER_SIZE - 1];
+             moved_events = kbd_buffer + KBD_BUFFER_SIZE - 1 - kbd_fetch_ptr;
            }
-
-         if (kbd_fetch_ptr == kbd_buffer + KBD_BUFFER_SIZE)
-           kbd_fetch_ptr = kbd_buffer + 1;
          else
-           kbd_fetch_ptr++;
+           moved_events = event - kbd_fetch_ptr;
 
+         memmove (kbd_fetch_ptr + 1, kbd_fetch_ptr,
+                  moved_events * sizeof *kbd_fetch_ptr);
+         kbd_fetch_ptr = next_kbd_event (kbd_fetch_ptr);
          input_pending = readable_events (0);
          x_handle_selection_event (&copy);
 #else
@@ -5252,7 +5252,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, 
Lisp_Object y,
 static bool
 toolkit_menubar_in_use (struct frame *f)
 {
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NS) || 
defined (HAVE_NTGUI)
+#ifdef HAVE_EXT_MENU_BAR
   return !(!FRAME_WINDOW_P (f));
 #else
   return false;
@@ -5610,7 +5610,7 @@ make_lispy_event (struct input_event *event)
             double-click-fuzz as is.  On other frames, interpret it
             as a multiple of 1/8 characters.  */
          struct frame *f;
-         int fuzz;
+         intmax_t fuzz;
 
          if (WINDOWP (event->frame_or_window))
            f = XFRAME (XWINDOW (event->frame_or_window)->frame);
@@ -5653,7 +5653,7 @@ make_lispy_event (struct input_event *event)
              double_click_count = 1;
            button_down_time = event->timestamp;
            *start_pos_ptr = Fcopy_alist (position);
-           ignore_mouse_drag_p = 0;
+           ignore_mouse_drag_p = false;
          }
 
        /* Now we're releasing a button - check the co-ordinates to
@@ -5669,11 +5669,14 @@ make_lispy_event (struct input_event *event)
            if (!CONSP (start_pos))
              return Qnil;
 
-           event->modifiers &= ~up_modifier;
+           unsigned click_or_drag_modifier = click_modifier;
 
+           if (ignore_mouse_drag_p)
+             ignore_mouse_drag_p = false;
+           else
              {
                Lisp_Object new_down, down;
-               EMACS_INT xdiff = double_click_fuzz, ydiff = double_click_fuzz;
+               intmax_t xdiff = double_click_fuzz, ydiff = double_click_fuzz;
 
                /* The third element of every position
                   should be the (x,y) pair.  */
@@ -5687,39 +5690,37 @@ make_lispy_event (struct input_event *event)
                    ydiff = XFIXNUM (XCDR (new_down)) - XFIXNUM (XCDR (down));
                  }
 
-               if (ignore_mouse_drag_p)
-                 {
-                   event->modifiers |= click_modifier;
-                   ignore_mouse_drag_p = 0;
-                 }
-               else if (xdiff < double_click_fuzz && xdiff > - 
double_click_fuzz
-                        && ydiff < double_click_fuzz && ydiff > - 
double_click_fuzz
-                 /* Maybe the mouse has moved a lot, caused scrolling, and
-                    eventually ended up at the same screen position (but
-                    not buffer position) in which case it is a drag, not
-                    a click.  */
-                   /* FIXME: OTOH if the buffer position has changed
-                      because of a timer or process filter rather than
-                      because of mouse movement, it should be considered as
-                      a click.  But mouse-drag-region completely ignores
-                      this case and it hasn't caused any real problem, so
-                      it's probably OK to ignore it as well.  */
-                   && EQ (Fcar (Fcdr (start_pos)), Fcar (Fcdr (position))))
-                 /* Mouse hasn't moved (much).  */
-                 event->modifiers |= click_modifier;
-               else
+               if (! (0 < double_click_fuzz
+                      && - double_click_fuzz < xdiff
+                      && xdiff < double_click_fuzz
+                      && - double_click_fuzz < ydiff
+                      && ydiff < double_click_fuzz
+                      /* Maybe the mouse has moved a lot, caused scrolling, and
+                         eventually ended up at the same screen position (but
+                         not buffer position) in which case it is a drag, not
+                         a click.  */
+                      /* FIXME: OTOH if the buffer position has changed
+                         because of a timer or process filter rather than
+                         because of mouse movement, it should be considered as
+                         a click.  But mouse-drag-region completely ignores
+                         this case and it hasn't caused any real problem, so
+                         it's probably OK to ignore it as well.  */
+                      && EQ (Fcar (Fcdr (start_pos)), Fcar (Fcdr (position)))))
                  {
+                   /* Mouse has moved enough.  */
                    button_down_time = 0;
-                   event->modifiers |= drag_modifier;
+                   click_or_drag_modifier = drag_modifier;
                  }
-
-               /* Don't check is_double; treat this as multiple
-                  if the down-event was multiple.  */
-               if (double_click_count > 1)
-                 event->modifiers |= ((double_click_count > 2)
-                                      ? triple_modifier
-                                      : double_modifier);
              }
+
+           /* Don't check is_double; treat this as multiple if the
+              down-event was multiple.  */
+           event->modifiers
+             = ((event->modifiers & ~up_modifier)
+                | click_or_drag_modifier
+                | (double_click_count < 2 ? 0
+                   : double_click_count == 2 ? double_modifier
+                   : triple_modifier));
          }
        else
          /* Every mouse event should either have the down_modifier or
@@ -5768,7 +5769,7 @@ make_lispy_event (struct input_event *event)
             double-click-fuzz as is.  On other frames, interpret it
             as a multiple of 1/8 characters.  */
          struct frame *fr;
-         int fuzz;
+         intmax_t fuzz;
          int symbol_num;
          bool is_double;
 
@@ -5944,8 +5945,7 @@ make_lispy_event (struct input_event *event)
        return list3 (head, position, files);
       }
 
-#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
-    || defined (HAVE_NS) || defined (USE_GTK)
+#ifdef HAVE_EXT_MENU_BAR
     case MENU_BAR_EVENT:
       if (EQ (event->arg, event->frame_or_window))
        /* This is the prefix key.  We translate this to
@@ -6194,7 +6194,7 @@ parse_modifiers_uncached (Lisp_Object symbol, ptrdiff_t 
*modifier_end)
 static Lisp_Object
 apply_modifiers_uncached (int modifiers, char *base, int base_len, int 
base_len_byte)
 {
-  /* Since BASE could contain nulls, we can't use intern here; we have
+  /* Since BASE could contain NULs, we can't use intern here; we have
      to use Fintern, which expects a genuine Lisp_String, and keeps a
      reference to it.  */
   char new_mods[sizeof "A-C-H-M-S-s-up-down-drag-double-triple-"];
@@ -6483,12 +6483,7 @@ modify_event_symbol (ptrdiff_t symbol_num, int 
modifiers, Lisp_Object symbol_kin
     {
       if (! VECTORP (*symbol_table)
          || ASIZE (*symbol_table) != table_size)
-       {
-         Lisp_Object size;
-
-         XSETFASTINT (size, table_size);
-         *symbol_table = Fmake_vector (size, Qnil);
-       }
+       *symbol_table = make_nil_vector (table_size);
 
       value = AREF (*symbol_table, symbol_num);
     }
@@ -7397,7 +7392,7 @@ menu_bar_items (Lisp_Object old)
   if (!NILP (old))
     menu_bar_items_vector = old;
   else
-    menu_bar_items_vector = Fmake_vector (make_fixnum (24), Qnil);
+    menu_bar_items_vector = make_nil_vector (24);
   menu_bar_items_index = 0;
 
   /* Build our list of keymaps.
@@ -7640,8 +7635,7 @@ parse_menu_item (Lisp_Object item, int inmenubar)
 
   /* Create item_properties vector if necessary.  */
   if (NILP (item_properties))
-    item_properties
-      = Fmake_vector (make_fixnum (ITEM_PROPERTY_ENABLE + 1), Qnil);
+    item_properties = make_nil_vector (ITEM_PROPERTY_ENABLE + 1);
 
   /* Initialize optional entries.  */
   for (i = ITEM_PROPERTY_DEF; i < ITEM_PROPERTY_ENABLE; i++)
@@ -8135,8 +8129,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
        set_prop (i, Qnil);
     }
   else
-    tool_bar_item_properties
-      = Fmake_vector (make_fixnum (TOOL_BAR_ITEM_NSLOTS), Qnil);
+    tool_bar_item_properties = make_nil_vector (TOOL_BAR_ITEM_NSLOTS);
 
   /* Set defaults.  */
   set_prop (TOOL_BAR_ITEM_KEY, key);
@@ -8162,7 +8155,7 @@ parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
       if (menu_separator_name_p (SSDATA (caption)))
        {
          set_prop (TOOL_BAR_ITEM_TYPE, Qt);
-#if !defined (USE_GTK) && !defined (HAVE_NS)
+#ifndef HAVE_EXT_TOOL_BAR
          /* If we use build_desired_tool_bar_string to render the
             tool bar, the separator is rendered as an image.  */
          set_prop (TOOL_BAR_ITEM_IMAGES,
@@ -8331,7 +8324,7 @@ init_tool_bar_items (Lisp_Object reuse)
   if (VECTORP (reuse))
     tool_bar_items_vector = reuse;
   else
-    tool_bar_items_vector = Fmake_vector (make_fixnum (64), Qnil);
+    tool_bar_items_vector = make_nil_vector (64);
   ntool_bar_items = 0;
 }
 
@@ -10263,11 +10256,10 @@ stuff_buffered_input (Lisp_Object stuffstring)
 
      rms: we should stuff everything back into the kboard
      it came from.  */
-  for (; kbd_fetch_ptr != kbd_store_ptr; kbd_fetch_ptr++)
+  for (; kbd_fetch_ptr != kbd_store_ptr;
+       kbd_fetch_ptr = next_kbd_event (kbd_fetch_ptr))
     {
 
-      if (kbd_fetch_ptr == kbd_buffer + KBD_BUFFER_SIZE)
-       kbd_fetch_ptr = kbd_buffer;
       if (kbd_fetch_ptr->kind == ASCII_KEYSTROKE_EVENT)
        stuff_char (kbd_fetch_ptr->ie.code);
 
@@ -11020,6 +11012,8 @@ static const struct event_head head_table[] = {
   {SYMBOL_INDEX (Qselect_window),       SYMBOL_INDEX (Qswitch_frame)}
 };
 
+static void syms_of_keyboard_for_pdumper (void);
+
 void
 syms_of_keyboard (void)
 {
@@ -11030,9 +11024,11 @@ syms_of_keyboard (void)
   staticpro (&Vlispy_mouse_stem);
 
   regular_top_level_message = build_pure_c_string ("Back to top level");
+  staticpro (&regular_top_level_message);
 #ifdef HAVE_STACK_OVERFLOW_HANDLING
   recover_top_level_message
     = build_pure_c_string ("Re-entering top level after C stack overflow");
+  staticpro (&recover_top_level_message);
 #endif
   DEFVAR_LISP ("internal--top-level-message", Vinternal__top_level_message,
               doc: /* Message displayed by `normal-top-level'.  */);
@@ -11219,33 +11215,33 @@ syms_of_keyboard (void)
        Fput (var, Qevent_symbol_elements, list1 (var));
       }
   }
+  DEFSYM (Qno_record, "no-record");
 
-  button_down_location = Fmake_vector (make_fixnum (5), Qnil);
+  button_down_location = make_nil_vector (5);
   staticpro (&button_down_location);
-  mouse_syms = Fmake_vector (make_fixnum (5), Qnil);
+  mouse_syms = make_nil_vector (5);
   staticpro (&mouse_syms);
-  wheel_syms = Fmake_vector (make_fixnum (ARRAYELTS (lispy_wheel_names)),
-                            Qnil);
+  wheel_syms = make_nil_vector (ARRAYELTS (lispy_wheel_names));
   staticpro (&wheel_syms);
 
   {
     int i;
     int len = ARRAYELTS (modifier_names);
 
-    modifier_symbols = Fmake_vector (make_fixnum (len), Qnil);
+    modifier_symbols = make_nil_vector (len);
     for (i = 0; i < len; i++)
       if (modifier_names[i])
        ASET (modifier_symbols, i, intern_c_string (modifier_names[i]));
     staticpro (&modifier_symbols);
   }
 
-  recent_keys = Fmake_vector (make_fixnum (NUM_RECENT_KEYS), Qnil);
+  recent_keys = make_nil_vector (NUM_RECENT_KEYS);
   staticpro (&recent_keys);
 
-  this_command_keys = Fmake_vector (make_fixnum (40), Qnil);
+  this_command_keys = make_nil_vector (40);
   staticpro (&this_command_keys);
 
-  raw_keybuf = Fmake_vector (make_fixnum (30), Qnil);
+  raw_keybuf = make_nil_vector (30);
   staticpro (&raw_keybuf);
 
   DEFSYM (Qcommand_execute, "command-execute");
@@ -11330,7 +11326,9 @@ so that you can determine whether the command was run 
by mouse or not.  */);
 These events are processed first, before actual keyboard input.
 Events read from this list are not normally added to `this-command-keys',
 as they will already have been added once as they were read for the first time.
-An element of the form (t . EVENT) forces EVENT to be added to that list.  */);
+An element of the form (t . EVENT) forces EVENT to be added to that list.
+An element of the form (no-record . EVENT) means process EVENT, but do not
+record it in the keyboard macros, recent-keys, and the dribble file.  */);
   Vunread_command_events = Qnil;
 
   DEFVAR_LISP ("unread-post-input-method-events", 
Vunread_post_input_method_events,
@@ -11872,13 +11870,9 @@ preserve data in modified buffers that would otherwise 
be lost.
 If nil, Emacs crashes immediately in response to fatal signals.  */);
   attempt_orderly_shutdown_on_fatal_signal = true;
 
-  /* Create the initial keyboard.  Qt means 'unset'.  */
-  initial_kboard = allocate_kboard (Qt);
-
   DEFVAR_LISP ("while-no-input-ignore-events",
                Vwhile_no_input_ignore_events,
                doc: /* Ignored events from while-no-input.  */);
-  Vwhile_no_input_ignore_events = Qnil;
 
   DEFVAR_BOOL ("inhibit--record-char",
               inhibit_record_char,
@@ -11886,6 +11880,43 @@ If nil, Emacs crashes immediately in response to fatal 
signals.  */);
 This inhibits recording input events for the purposes of keyboard
 macros, dribble file, and `recent-keys'.
 Internal use only.  */);
+
+  pdumper_do_now_and_after_load (syms_of_keyboard_for_pdumper);
+}
+
+static void
+syms_of_keyboard_for_pdumper (void)
+{
+  /* Make sure input state is pristine when restoring from a dump.
+     init_keyboard() also resets some of these, but the duplication
+     doesn't hurt and makes sure that allocate_kboard and subsequent
+     early init functions see the environment they expect.  */
+
+  PDUMPER_RESET_LV (pending_funcalls, Qnil);
+  PDUMPER_RESET_LV (unread_switch_frame, Qnil);
+  PDUMPER_RESET_LV (internal_last_event_frame, Qnil);
+  PDUMPER_RESET_LV (last_command_event, Qnil);
+  PDUMPER_RESET_LV (last_nonmenu_event, Qnil);
+  PDUMPER_RESET_LV (last_input_event, Qnil);
+  PDUMPER_RESET_LV (Vunread_command_events, Qnil);
+  PDUMPER_RESET_LV (Vunread_post_input_method_events, Qnil);
+  PDUMPER_RESET_LV (Vunread_input_method_events, Qnil);
+  PDUMPER_RESET_LV (Vthis_command, Qnil);
+  PDUMPER_RESET_LV (Vreal_this_command, Qnil);
+  PDUMPER_RESET_LV (Vthis_command_keys_shift_translated, Qnil);
+  PDUMPER_RESET_LV (Vthis_original_command, Qnil);
+  PDUMPER_RESET (num_input_keys, 0);
+  PDUMPER_RESET (num_nonmacro_input_events, 0);
+  PDUMPER_RESET_LV (Vlast_event_frame, Qnil);
+  PDUMPER_RESET_LV (Vdeferred_action_list, Qnil);
+  PDUMPER_RESET_LV (Vdelayed_warnings_list, Qnil);
+
+  /* Create the initial keyboard.  Qt means 'unset'.  */
+  eassert (initial_kboard == NULL);
+  initial_kboard = allocate_kboard (Qt);
+
+  Vwhile_no_input_ignore_events = Qnil;
+
   inhibit_record_char = false;
 }
 
@@ -11984,8 +12015,8 @@ mark_kboards (void)
   for (kb = all_kboards; kb; kb = kb->next_kboard)
     {
       if (kb->kbd_macro_buffer)
-       for (p = kb->kbd_macro_buffer; p < kb->kbd_macro_ptr; p++)
-         mark_object (*p);
+        for (p = kb->kbd_macro_buffer; p < kb->kbd_macro_ptr; p++)
+          mark_object (*p);
       mark_object (KVAR (kb, Voverriding_terminal_local_map));
       mark_object (KVAR (kb, Vlast_command));
       mark_object (KVAR (kb, Vreal_last_command));
@@ -12005,21 +12036,18 @@ mark_kboards (void)
       mark_object (KVAR (kb, echo_string));
       mark_object (KVAR (kb, echo_prompt));
     }
-  {
-    union buffered_input_event *event;
-    for (event = kbd_fetch_ptr; event != kbd_store_ptr; event++)
-      {
-       if (event == kbd_buffer + KBD_BUFFER_SIZE)
-         event = kbd_buffer;
-       /* These two special event types has no Lisp_Objects to mark.  */
-       if (event->kind != SELECTION_REQUEST_EVENT
-           && event->kind != SELECTION_CLEAR_EVENT)
-         {
-           mark_object (event->ie.x);
-           mark_object (event->ie.y);
-           mark_object (event->ie.frame_or_window);
-           mark_object (event->ie.arg);
-         }
-      }
-  }
+
+  for (union buffered_input_event *event = kbd_fetch_ptr;
+       event != kbd_store_ptr; event = next_kbd_event (event))
+    {
+      /* These two special event types have no Lisp_Objects to mark.  */
+      if (event->kind != SELECTION_REQUEST_EVENT
+         && event->kind != SELECTION_CLEAR_EVENT)
+       {
+         mark_object (event->ie.x);
+         mark_object (event->ie.y);
+         mark_object (event->ie.frame_or_window);
+         mark_object (event->ie.arg);
+       }
+    }
 }
diff --git a/src/keyboard.h b/src/keyboard.h
index ce4630b..65c7402 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -1,5 +1,5 @@
 /* Declarations useful when processing input.
-   Copyright (C) 1985-1987, 1993, 2001-2018 Free Software Foundation,
+   Copyright (C) 1985-1987, 1993, 2001-2019 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
@@ -327,9 +327,9 @@ extern Lisp_Object item_properties;
    takes care of protecting all the data from GC.  */
 extern Lisp_Object menu_items;
 
-/* If non-nil, means that the global vars defined here are already in use.
+/* Whether the global vars defined here are already in use.
    Used to detect cases where we try to re-enter this non-reentrant code.  */
-extern Lisp_Object menu_items_inuse;
+extern bool menu_items_inuse;
 
 /* Number of slots currently allocated in menu_items.  */
 extern int menu_items_allocated;
diff --git a/src/keymap.c b/src/keymap.c
index 3a79bf4..2ac3d33 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1,5 +1,5 @@
 /* Manipulation of keymaps
-   Copyright (C) 1985-1988, 1993-1995, 1998-2018 Free Software
+   Copyright (C) 1985-1988, 1993-1995, 1998-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -120,11 +120,7 @@ The optional arg STRING supplies a menu name for the keymap
 in case you use it as a menu with `x-popup-menu'.  */)
   (Lisp_Object string)
 {
-  Lisp_Object tail;
-  if (!NILP (string))
-    tail = list1 (string);
-  else
-    tail = Qnil;
+  Lisp_Object tail = !NILP (string) ? list1 (string) : Qnil;
   return Fcons (Qkeymap,
                Fcons (Fmake_char_table (Qkeymap, Qnil), tail));
 }
@@ -1093,7 +1089,7 @@ binding KEY to DEF is added at the front of KEYMAP.  */)
 
   if (VECTORP (def) && ASIZE (def) > 0 && CONSP (AREF (def, 0)))
     { /* DEF is apparently an XEmacs-style keyboard macro.  */
-      Lisp_Object tmp = Fmake_vector (make_fixnum (ASIZE (def)), Qnil);
+      Lisp_Object tmp = make_nil_vector (ASIZE (def));
       ptrdiff_t i = ASIZE (def);
       while (--i >= 0)
        {
@@ -1931,14 +1927,12 @@ then the value includes only maps for prefixes that 
start with PREFIX.  */)
             we don't have to deal with the possibility of a string.  */
          if (STRINGP (prefix))
            {
-             int i, i_byte, c;
-             Lisp_Object copy;
-
-             copy = Fmake_vector (make_fixnum (SCHARS (prefix)), Qnil);
-             for (i = 0, i_byte = 0; i < SCHARS (prefix);)
+             ptrdiff_t i_byte = 0;
+             Lisp_Object copy = make_nil_vector (SCHARS (prefix));
+             for (ptrdiff_t i = 0; i < SCHARS (prefix); )
                {
-                 int i_before = i;
-
+                 ptrdiff_t i_before = i;
+                 int c;
                  FETCH_STRING_CHAR_ADVANCE (c, prefix, i, i_byte);
                  if (SINGLE_BYTE_CHAR_P (c) && (c & 0200))
                    c ^= 0200 | meta_modifier;
@@ -2044,7 +2038,7 @@ For an approximate inverse of this, see `kbd'.  */)
   else if (VECTORP (list))
     size = ASIZE (list);
   else if (CONSP (list))
-    size = XFIXNUM (Flength (list));
+    size = list_length (list);
   else
     wrong_type_argument (Qarrayp, list);
 
@@ -3141,7 +3135,7 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
   /* This vector gets used to present single keys to Flookup_key.  Since
      that is done once per keymap element, we don't want to cons up a
      fresh vector every time.  */
-  kludge = Fmake_vector (make_fixnum (1), Qnil);
+  kludge = make_nil_vector (1);
   definition = Qnil;
 
   map = call1 (Qkeymap_canonicalize, map);
@@ -3390,7 +3384,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, 
Lisp_Object args,
   /* This vector gets used to present single keys to Flookup_key.  Since
      that is done once per vector element, we don't want to cons up a
      fresh vector every time.  */
-  kludge = Fmake_vector (make_fixnum (1), Qnil);
+  kludge = make_nil_vector (1);
 
   if (partial)
     suppress = intern ("suppress-keymap");
@@ -3610,12 +3604,12 @@ syms_of_keymap (void)
   Fset (intern_c_string ("ctl-x-map"), control_x_map);
   Ffset (intern_c_string ("Control-X-prefix"), control_x_map);
 
-  exclude_keys = listn (CONSTYPE_PURE, 5,
-                       pure_cons (build_pure_c_string ("DEL"), 
build_pure_c_string ("\\d")),
-                       pure_cons (build_pure_c_string ("TAB"), 
build_pure_c_string ("\\t")),
-                       pure_cons (build_pure_c_string ("RET"), 
build_pure_c_string ("\\r")),
-                       pure_cons (build_pure_c_string ("ESC"), 
build_pure_c_string ("\\e")),
-                       pure_cons (build_pure_c_string ("SPC"), 
build_pure_c_string (" ")));
+  exclude_keys = pure_list
+    (pure_cons (build_pure_c_string ("DEL"), build_pure_c_string ("\\d")),
+     pure_cons (build_pure_c_string ("TAB"), build_pure_c_string ("\\t")),
+     pure_cons (build_pure_c_string ("RET"), build_pure_c_string ("\\r")),
+     pure_cons (build_pure_c_string ("ESC"), build_pure_c_string ("\\e")),
+     pure_cons (build_pure_c_string ("SPC"), build_pure_c_string (" ")));
   staticpro (&exclude_keys);
 
   DEFVAR_LISP ("define-key-rebound-commands", Vdefine_key_rebound_commands,
@@ -3671,16 +3665,12 @@ be preferred.  */);
   DEFSYM (Qmode_line, "mode-line");
 
   staticpro (&Vmouse_events);
-  Vmouse_events = listn (CONSTYPE_PURE, 9,
-                        Qmenu_bar,
-                        Qtool_bar,
-                        Qheader_line,
-                        Qmode_line,
-                        intern_c_string ("mouse-1"),
-                        intern_c_string ("mouse-2"),
-                        intern_c_string ("mouse-3"),
-                        intern_c_string ("mouse-4"),
-                        intern_c_string ("mouse-5"));
+  Vmouse_events = pure_list (Qmenu_bar, Qtool_bar, Qheader_line, Qmode_line,
+                            intern_c_string ("mouse-1"),
+                            intern_c_string ("mouse-2"),
+                            intern_c_string ("mouse-3"),
+                            intern_c_string ("mouse-4"),
+                            intern_c_string ("mouse-5"));
 
   /* Keymap used for minibuffers when doing completion.  */
   /* Keymap used for minibuffers when doing completion and require a match.  */
@@ -3690,7 +3680,7 @@ be preferred.  */);
   DEFSYM (Qremap, "remap");
   DEFSYM (QCadvertised_binding, ":advertised-binding");
 
-  command_remapping_vector = Fmake_vector (make_fixnum (2), Qremap);
+  command_remapping_vector = make_vector (2, Qremap);
   staticpro (&command_remapping_vector);
 
   where_is_cache_keymaps = Qt;
diff --git a/src/keymap.h b/src/keymap.h
index 8389220..e29145f 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -1,5 +1,5 @@
 /* Functions to manipulate keymaps.
-   Copyright (C) 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/kqueue.c b/src/kqueue.c
index bc01ab5..48121bd 100644
--- a/src/kqueue.c
+++ b/src/kqueue.c
@@ -1,6 +1,6 @@
 /* Filesystem notifications support with kqueue API.
 
-Copyright (C) 2015-2018 Free Software Foundation, Inc.
+Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -99,7 +99,7 @@ kqueue_generate_event (Lisp_Object watch_object, Lisp_Object 
actions,
     event.arg = list2 (Fcons (XCAR (watch_object),
                              Fcons (actions,
                                     NILP (file1)
-                                    ? Fcons (file, Qnil)
+                                    ? list1 (file)
                                     : list2 (file, file1))),
                       Fnth (make_fixnum (3), watch_object));
     kbd_buffer_store_event (&event);
@@ -395,11 +395,12 @@ only when the upper directory of the renamed file is 
watched.  */)
     maxfd = 256;
 
   /* We assume 50 file descriptors are sufficient for the rest of Emacs.  */
-  if ((maxfd - 50) < XFIXNUM (Flength (watch_list)))
+  ptrdiff_t watch_list_len = list_length (watch_list);
+  if (maxfd - 50 < watch_list_len)
     xsignal2
       (Qfile_notify_error,
        build_string ("File watching not possible, no file descriptor left"),
-       Flength (watch_list));
+       make_fixnum (watch_list_len));
 
   if (kqueuefd < 0)
     {
diff --git a/src/lastfile.c b/src/lastfile.c
index ec53111..bcaf105 100644
--- a/src/lastfile.c
+++ b/src/lastfile.c
@@ -1,5 +1,5 @@
 /* Mark end of data space to dump as pure, for GNU Emacs.
-   Copyright (C) 1985, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -43,7 +43,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 char my_edata[] = "End of Emacs initialized data";
 #endif
 
-#ifndef CANNOT_DUMP
+#ifdef HAVE_UNEXEC
 
 /* Help unexec locate the end of the .bss area used by Emacs (which
    isn't always a separate section in NT executables).  */
diff --git a/src/lcms.c b/src/lcms.c
index d5cfafa..cd8de0e 100644
--- a/src/lcms.c
+++ b/src/lcms.c
@@ -1,5 +1,5 @@
 /* Interface to Little CMS
-   Copyright (C) 2017-2018 Free Software Foundation, Inc.
+   Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/lisp.h b/src/lisp.h
index 6d2513e..3324dac 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1,6 +1,6 @@
 /* Fundamental definitions for GNU Emacs Lisp interpreter. -*- coding: utf-8 
-*-
 
-Copyright (C) 1985-1987, 1993-1995, 1997-2018 Free Software Foundation,
+Copyright (C) 1985-1987, 1993-1995, 1997-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -568,6 +568,7 @@ enum Lisp_Type
     /* Cons.  XCONS (object) points to a struct Lisp_Cons.  */
     Lisp_Cons = USE_LSB_TAG ? 3 : 6,
 
+    /* Must be last entry in Lisp_Type enumeration.  */
     Lisp_Float = 7
   };
 
@@ -663,16 +664,111 @@ extern void char_table_set (Lisp_Object, int, 
Lisp_Object);
 extern _Noreturn void wrong_type_argument (Lisp_Object, Lisp_Object);
 extern bool symbols_with_pos_enabled;
 
-#ifdef CANNOT_DUMP
-enum { might_dump = false };
-#elif defined DOUG_LEA_MALLOC
 /* Defined in emacs.c.  */
-extern bool might_dump;
-#endif
-/* True means Emacs has already been initialized.
-   Used during startup to detect startup of dumped Emacs.  */
+
+/* Set after Emacs has started up the first time.
+   Prevents reinitialization of the Lisp world and keymaps on
+   subsequent starts.  */
 extern bool initialized;
 
+extern struct gflags
+{
+  /* True means this Emacs instance was born to dump.  */
+#if defined HAVE_PDUMPER || defined HAVE_UNEXEC
+  bool will_dump_ : 1;
+  bool will_bootstrap_ : 1;
+#endif
+#ifdef HAVE_PDUMPER
+  /* Set in an Emacs process that will likely dump with pdumper; all
+     Emacs processes may dump with pdumper, however.  */
+  bool will_dump_with_pdumper_ : 1;
+  /* Set in an Emacs process that has been restored from a portable
+     dump.  */
+  bool dumped_with_pdumper_ : 1;
+#endif
+#ifdef HAVE_UNEXEC
+  bool will_dump_with_unexec_ : 1;
+  /* Set in an Emacs process that has been restored from an unexec
+     dump.  */
+  bool dumped_with_unexec_ : 1;
+  /* We promise not to unexec: useful for hybrid malloc.  */
+  bool will_not_unexec_ : 1;
+#endif
+} gflags;
+
+INLINE bool
+will_dump_p (void)
+{
+#if HAVE_PDUMPER || defined HAVE_UNEXEC
+  return gflags.will_dump_;
+#else
+  return false;
+#endif
+}
+
+INLINE bool
+will_bootstrap_p (void)
+{
+#if HAVE_PDUMPER || defined HAVE_UNEXEC
+  return gflags.will_bootstrap_;
+#else
+  return false;
+#endif
+}
+
+INLINE bool
+will_dump_with_pdumper_p (void)
+{
+#if HAVE_PDUMPER
+  return gflags.will_dump_with_pdumper_;
+#else
+  return false;
+#endif
+}
+
+INLINE bool
+dumped_with_pdumper_p (void)
+{
+#if HAVE_PDUMPER
+  return gflags.dumped_with_pdumper_;
+#else
+  return false;
+#endif
+}
+
+INLINE bool
+will_dump_with_unexec_p (void)
+{
+#ifdef HAVE_UNEXEC
+  return gflags.will_dump_with_unexec_;
+#else
+  return false;
+#endif
+}
+
+INLINE bool
+dumped_with_unexec_p (void)
+{
+#ifdef HAVE_UNEXEC
+  return gflags.dumped_with_unexec_;
+#else
+  return false;
+#endif
+}
+
+/* This function is the opposite of will_dump_with_unexec_p(), except
+   that it returns false before main runs.  It's important to use
+   gmalloc for any pre-main allocations if we're going to unexec.  */
+INLINE bool
+definitely_will_not_unexec_p (void)
+{
+#ifdef HAVE_UNEXEC
+  return gflags.will_not_unexec_;
+#else
+  return true;
+#endif
+}
+
 /* Defined in floatfns.c.  */
 extern double extract_float (Lisp_Object);
 
@@ -902,6 +998,19 @@ typedef EMACS_UINT Lisp_Word_tag;
 # define DEFINE_NON_NIL_Q_SYMBOL_MACROS true
 #endif
 
+/* True if N is a power of 2.  N should be positive.  */
+
+#define POWER_OF_2(n) (((n) & ((n) - 1)) == 0)
+
+/* Return X rounded to the next multiple of Y.  Y should be positive,
+   and Y - 1 + X should not overflow.  Arguments should not have side
+   effects, as they are evaluated more than once.  Tune for Y being a
+   power of 2.  */
+
+#define ROUNDUP(x, y) (POWER_OF_2 (y)                                  \
+                       ? ((y) - 1 + (x)) & ~ ((y) - 1)                 \
+                       : ((y) - 1 + (x)) - ((y) - 1 + (x)) % (y))
+
 #include "globals.h"
 
 /* Header of vector-like objects.  This documents the layout constraints on
@@ -1238,8 +1347,8 @@ INLINE bool
 #define FIXNUM_OVERFLOW_P(i) \
   (! ((0 <= (i) || MOST_NEGATIVE_FIXNUM <= (i)) && (i) <= 
MOST_POSITIVE_FIXNUM))
 
-INLINE ptrdiff_t
-clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper)
+INLINE intmax_t
+clip_to_bounds (intmax_t lower, intmax_t num, intmax_t upper)
 {
   return num < lower ? lower : num <= upper ? num : upper;
 }
@@ -1507,11 +1616,11 @@ STRING_MULTIBYTE (Lisp_Object str)
 }
 
 /* An upper bound on the number of bytes in a Lisp string, not
-   counting the terminating null.  This a tight enough bound to
+   counting the terminating NUL.  This a tight enough bound to
    prevent integer overflow errors that would otherwise occur during
    string size calculations.  A string cannot contain more bytes than
    a fixnum can represent, nor can it be so long that C pointer
-   arithmetic stops working on the string plus its terminating null.
+   arithmetic stops working on the string plus its terminating NUL.
    Although the actual size limit (see STRING_BYTES_MAX in alloc.c)
    may be a bit smaller than STRING_BYTES_BOUND, calculating it here
    would expose alloc.c internal details that we'd rather keep
@@ -1654,7 +1763,7 @@ CHECK_VECTOR (Lisp_Object x)
 /* A pseudovector is like a vector, but has other non-Lisp components.  */
 
 INLINE enum pvec_type
-PSEUDOVECTOR_TYPE (struct Lisp_Vector *v)
+PSEUDOVECTOR_TYPE (const struct Lisp_Vector *v)
 {
   ptrdiff_t size = v->header.size;
   return (size & PSEUDOVECTOR_FLAG
@@ -1664,7 +1773,7 @@ PSEUDOVECTOR_TYPE (struct Lisp_Vector *v)
 
 /* Can't be used with PVEC_NORMAL_VECTOR.  */
 INLINE bool
-PSEUDOVECTOR_TYPEP (union vectorlike_header *a, enum pvec_type code)
+PSEUDOVECTOR_TYPEP (const union vectorlike_header *a, enum pvec_type code)
 {
   /* We don't use PSEUDOVECTOR_TYPE here so as to avoid a shift
    * operation when `code' is known.  */
@@ -2239,6 +2348,12 @@ struct hash_table_test
 
 struct Lisp_Hash_Table
 {
+  /* Change pdumper.c if you change the fields here.
+
+     IMPORTANT!!!!!!!
+
+     Call hash_rehash_if_needed() before accessing.  */
+
   /* This is for Lisp; the hash table code does not refer to it.  */
   union vectorlike_header header;
 
@@ -2295,8 +2410,9 @@ struct Lisp_Hash_Table
   /* The comparison and hash functions.  */
   struct hash_table_test test;
 
-  /* Next weak hash table if this is a weak hash table.  The head
-     of the list is in weak_hash_tables.  */
+  /* Next weak hash table if this is a weak hash table.  The head of
+     the list is in weak_hash_tables.  Used only during garbage
+     collection --- at other times, it is NULL.  */
   struct Lisp_Hash_Table *next_weak;
 } GCALIGNED_STRUCT;
 
@@ -2321,32 +2437,47 @@ XHASH_TABLE (Lisp_Object a)
 
 /* Value is the key part of entry IDX in hash table H.  */
 INLINE Lisp_Object
-HASH_KEY (struct Lisp_Hash_Table *h, ptrdiff_t idx)
+HASH_KEY (const struct Lisp_Hash_Table *h, ptrdiff_t idx)
 {
   return AREF (h->key_and_value, 2 * idx);
 }
 
 /* Value is the value part of entry IDX in hash table H.  */
 INLINE Lisp_Object
-HASH_VALUE (struct Lisp_Hash_Table *h, ptrdiff_t idx)
+HASH_VALUE (const struct Lisp_Hash_Table *h, ptrdiff_t idx)
 {
   return AREF (h->key_and_value, 2 * idx + 1);
 }
 
 /* Value is the hash code computed for entry IDX in hash table H.  */
 INLINE Lisp_Object
-HASH_HASH (struct Lisp_Hash_Table *h, ptrdiff_t idx)
+HASH_HASH (const struct Lisp_Hash_Table *h, ptrdiff_t idx)
 {
   return AREF (h->hash, idx);
 }
 
 /* Value is the size of hash table H.  */
 INLINE ptrdiff_t
-HASH_TABLE_SIZE (struct Lisp_Hash_Table *h)
+HASH_TABLE_SIZE (const struct Lisp_Hash_Table *h)
 {
   return ASIZE (h->next);
 }
 
+void hash_table_rehash (struct Lisp_Hash_Table *h);
+
+INLINE bool
+hash_rehash_needed_p (const struct Lisp_Hash_Table *h)
+{
+  return h->count < 0;
+}
+
+INLINE void
+hash_rehash_if_needed (struct Lisp_Hash_Table *h)
+{
+  if (hash_rehash_needed_p (h))
+    hash_table_rehash (h);
+}
+
 /* Default size for hash tables if not specified.  */
 
 enum DEFAULT_HASH_SIZE { DEFAULT_HASH_SIZE = 65 };
@@ -2512,6 +2643,9 @@ struct Lisp_Finalizer
     struct Lisp_Finalizer *next;
   } GCALIGNED_STRUCT;
 
+extern struct Lisp_Finalizer finalizers;
+extern struct Lisp_Finalizer doomed_finalizers;
+
 INLINE bool
 FINALIZERP (Lisp_Object x)
 {
@@ -2618,7 +2752,7 @@ make_uint (uintmax_t n)
 struct Lisp_Intfwd
   {
     enum Lisp_Fwd_Type type;   /* = Lisp_Fwd_Int */
-    EMACS_INT *intvar;
+    intmax_t *intvar;
   };
 
 /* Boolean forwarding pointer to an int variable.
@@ -2770,13 +2904,6 @@ XFLOAT_DATA (Lisp_Object f)
 #define IEEE_FLOATING_POINT (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \
                             && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128)
 
-/* A character, declared with the following typedef, is a member
-   of some character set associated with the current buffer.  */
-#ifndef _UCHAR_T  /* Protect against something in ctab.h on AIX.  */
-#define _UCHAR_T
-typedef unsigned char UCHAR;
-#endif
-
 /* Meanings of slots in a Lisp_Compiled:  */
 
 enum Lisp_Compiled
@@ -2935,12 +3062,7 @@ CHECK_FIXNAT (Lisp_Object x)
   do {                                                                 \
     CHECK_FIXNUM (x);                                                  \
     if (! ((lo) <= XFIXNUM (x) && XFIXNUM (x) <= (hi)))                        
\
-      args_out_of_range_3                                              \
-       (x,                                                             \
-        make_fixnum ((lo) < 0 && (lo) < MOST_NEGATIVE_FIXNUM           \
-                     ? MOST_NEGATIVE_FIXNUM                            \
-                     : (lo)),                                          \
-        make_fixnum (min (hi, MOST_POSITIVE_FIXNUM)));                 \
+      args_out_of_range_3 (x, INT_TO_INTEGER (lo), INT_TO_INTEGER (hi)); \
   } while (false)
 #define CHECK_TYPE_RANGED_INTEGER(type, x) \
   do {                                                                 \
@@ -2993,28 +3115,24 @@ CHECK_INTEGER (Lisp_Object x)
     else                                                               \
       CHECK_TYPE (INTEGERP (x), Qnumber_or_marker_p, x);               \
   } while (false)
+
 
-/* Since we can't assign directly to the CAR or CDR fields of a cons
-   cell, use these when checking that those fields contain numbers.  */
-INLINE void
-CHECK_FIXNUM_CAR (Lisp_Object x)
-{
-  Lisp_Object tmp = XCAR (x);
-  CHECK_FIXNUM (tmp);
-  XSETCAR (x, tmp);
-}
+/* If we're not dumping using the legacy dumper and we might be using
+   the portable dumper, try to bunch all the subr structures together
+   for more efficient dump loading.  */
+#ifndef HAVE_UNEXEC
+# ifdef DARWIN_OS
+#  define SUBR_SECTION_ATTRIBUTE ATTRIBUTE_SECTION ("__DATA,subrs")
+# else
+#  define SUBR_SECTION_ATTRIBUTE ATTRIBUTE_SECTION (".subrs")
+# endif
+#else
+# define SUBR_SECTION_ATTRIBUTE
+#endif
 
-INLINE void
-CHECK_FIXNUM_CDR (Lisp_Object x)
-{
-  Lisp_Object tmp = XCDR (x);
-  CHECK_FIXNUM (tmp);
-  XSETCDR (x, tmp);
-}
-
 /* Define a built-in function for calling from Lisp.
  `lname' should be the name to give the function in Lisp,
-    as a null-terminated C string.
+    as a NUL-terminated C string.
  `fnname' should be the name of the function in C.
     By convention, it starts with F.
  `sname' should be the name for the C constant structure
@@ -3040,7 +3158,8 @@ CHECK_FIXNUM_CDR (Lisp_Object x)
 /* This version of DEFUN declares a function prototype with the right
    arguments, so we can catch errors with maxargs at compile-time.  */
 #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc)    \
-   static union Aligned_Lisp_Subr sname =                              \
+  SUBR_SECTION_ATTRIBUTE                                                \
+  static union Aligned_Lisp_Subr sname =                                \
      {{{ PVEC_SUBR << PSEUDOVECTOR_AREA_BITS },                                
\
        { .a ## maxargs = fnname },                                     \
        minargs, maxargs, lname, intspec, 0}};                          \
@@ -3068,7 +3187,7 @@ enum maxargs
 extern void defvar_lisp (struct Lisp_Objfwd *, const char *, Lisp_Object *);
 extern void defvar_lisp_nopro (struct Lisp_Objfwd *, const char *, Lisp_Object 
*);
 extern void defvar_bool (struct Lisp_Boolfwd *, const char *, bool *);
-extern void defvar_int (struct Lisp_Intfwd *, const char *, EMACS_INT *);
+extern void defvar_int (struct Lisp_Intfwd *, const char *, intmax_t *);
 extern void defvar_kboard (struct Lisp_Kboard_Objfwd *, const char *, int);
 
 /* Macros we use to define forwarded Lisp variables.
@@ -3201,11 +3320,6 @@ union specbinding
     } bt;
   };
 
-/* These 3 are defined as macros in thread.h.  */
-/* extern union specbinding *specpdl; */
-/* extern union specbinding *specpdl_ptr; */
-/* extern ptrdiff_t specpdl_size; */
-
 INLINE ptrdiff_t
 SPECPDL_INDEX (void)
 {
@@ -3285,16 +3399,33 @@ extern Lisp_Object Vascii_canon_table;
 
 /* Call staticpro (&var) to protect static variable `var'.  */
 
-void staticpro (Lisp_Object *);
+void staticpro (Lisp_Object const *);
+
+enum { NSTATICS = 2048 };
+extern Lisp_Object const *staticvec[NSTATICS];
+extern int staticidx;
+
 
 /* Forward declarations for prototypes.  */
 struct window;
 struct frame;
 
+/* Define if the windowing system provides a menu bar.  */
+#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
+  || defined (HAVE_NS) || defined (USE_GTK)
+#define HAVE_EXT_MENU_BAR true
+#endif
+
+/* Define if the windowing system provides a tool-bar.  */
+#if defined (USE_GTK) || defined (HAVE_NS)
+#define HAVE_EXT_TOOL_BAR true
+#endif
+
 /* Copy COUNT Lisp_Objects from ARGS to contents of V starting from OFFSET.  */
 
 INLINE void
-vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count)
+vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object const *args,
+       ptrdiff_t count)
 {
   eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v));
   memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args);
@@ -3454,6 +3585,28 @@ integer_to_uintmax (Lisp_Object num, uintmax_t *n)
     }
 }
 
+/* A modification count.  These are wide enough, and incremented
+   rarely enough, so that they should never overflow a 60-bit counter
+   in practice, and the code below assumes this so a compiler can
+   generate better code if EMACS_INT is 64 bits.  */
+typedef intmax_t modiff_count;
+
+INLINE modiff_count
+modiff_incr (modiff_count *a)
+{
+  modiff_count a0 = *a;
+  bool modiff_overflow = INT_ADD_WRAPV (a0, 1, a);
+  eassert (!modiff_overflow && *a >> 30 >> 30 == 0);
+  return a0;
+}
+
+INLINE Lisp_Object
+modiff_to_integer (modiff_count a)
+{
+  eassume (0 <= a && a >> 30 >> 30 == 0);
+  return make_int (a);
+}
+
 /* Defined in data.c.  */
 extern _Noreturn void wrong_choice (Lisp_Object, Lisp_Object);
 extern void notify_variable_watchers (Lisp_Object, Lisp_Object,
@@ -3530,14 +3683,17 @@ extern void syms_of_syntax (void);
 
 /* Defined in fns.c.  */
 enum { NEXT_ALMOST_PRIME_LIMIT = 11 };
+extern ptrdiff_t list_length (Lisp_Object);
 extern EMACS_INT next_almost_prime (EMACS_INT) ATTRIBUTE_CONST;
 extern Lisp_Object larger_vector (Lisp_Object, ptrdiff_t, ptrdiff_t);
-extern void sweep_weak_hash_tables (void);
+extern bool sweep_weak_table (struct Lisp_Hash_Table *, bool);
 extern char *extract_data_from_object (Lisp_Object, ptrdiff_t *, ptrdiff_t *);
 EMACS_UINT hash_string (char const *, ptrdiff_t);
 EMACS_UINT sxhash (Lisp_Object, int);
+EMACS_UINT hashfn_eql (struct hash_table_test *ht, Lisp_Object key);
+EMACS_UINT hashfn_equal (struct hash_table_test *ht, Lisp_Object key);
 Lisp_Object make_hash_table (struct hash_table_test, EMACS_INT, float, float,
-                            Lisp_Object, bool);
+                             Lisp_Object, bool);
 ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *);
 ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object,
                    EMACS_UINT);
@@ -3699,24 +3855,57 @@ extern void refill_memory_reserve (void);
 #endif
 extern void alloc_unexec_pre (void);
 extern void alloc_unexec_post (void);
-extern void mark_maybe_objects (Lisp_Object *, ptrdiff_t);
-extern void mark_stack (char *, char *);
+extern void mark_maybe_objects (Lisp_Object const *, ptrdiff_t);
+extern void mark_stack (char const *, char const *);
 extern void flush_stack_call_func (void (*func) (void *arg), void *arg);
+extern void garbage_collect (void);
 extern const char *pending_malloc_warning;
 extern Lisp_Object zero_vector;
-extern EMACS_INT consing_since_gc;
-extern EMACS_INT gc_relative_threshold;
-extern EMACS_INT memory_full_cons_threshold;
+typedef uintptr_t byte_ct;  /* System byte counts reported by GC.  */
+extern byte_ct consing_since_gc;
+extern byte_ct gc_relative_threshold;
+extern byte_ct const memory_full_cons_threshold;
+#ifdef HAVE_PDUMPER
+extern int number_finalizers_run;
+#endif
+#ifdef ENABLE_CHECKING
+extern Lisp_Object Vdead;
+#endif
 extern Lisp_Object list1 (Lisp_Object);
 extern Lisp_Object list2 (Lisp_Object, Lisp_Object);
 extern Lisp_Object list3 (Lisp_Object, Lisp_Object, Lisp_Object);
 extern Lisp_Object list4 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
 extern Lisp_Object list5 (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object,
                          Lisp_Object);
-enum constype {CONSTYPE_HEAP, CONSTYPE_PURE};
-extern Lisp_Object listn (enum constype, ptrdiff_t, Lisp_Object, ...);
+extern Lisp_Object listn (ptrdiff_t, Lisp_Object, ...);
+extern Lisp_Object pure_listn (ptrdiff_t, Lisp_Object, ...);
+#define list(...) \
+  listn (ARRAYELTS (((Lisp_Object []) {__VA_ARGS__})), __VA_ARGS__)
+#define pure_list(...) \
+  pure_listn (ARRAYELTS (((Lisp_Object []) {__VA_ARGS__})), __VA_ARGS__)
+
+enum gc_root_type
+{
+  GC_ROOT_STATICPRO,
+  GC_ROOT_BUFFER_LOCAL_DEFAULT,
+  GC_ROOT_BUFFER_LOCAL_NAME,
+  GC_ROOT_C_SYMBOL
+};
 
-/* Build a frequently used 2/3/4-integer lists.  */
+struct gc_root_visitor
+{
+  void (*visit) (Lisp_Object const *, enum gc_root_type, void *);
+  void *data;
+};
+extern void visit_static_gc_roots (struct gc_root_visitor visitor);
+
+/* Build a frequently used 1/2/3/4-integer lists.  */
+
+INLINE Lisp_Object
+list1i (EMACS_INT x)
+{
+  return list1 (make_fixnum (x));
+}
 
 INLINE Lisp_Object
 list2i (EMACS_INT x, EMACS_INT y)
@@ -3744,6 +3933,13 @@ extern Lisp_Object make_string (const char *, ptrdiff_t);
 extern Lisp_Object make_formatted_string (char *, const char *, ...)
   ATTRIBUTE_FORMAT_PRINTF (2, 3);
 extern Lisp_Object make_unibyte_string (const char *, ptrdiff_t);
+extern ptrdiff_t vectorlike_nbytes (const union vectorlike_header *hdr);
+
+INLINE ptrdiff_t
+vector_nbytes (const struct Lisp_Vector *v)
+{
+  return vectorlike_nbytes (&v->header);
+}
 
 /* Make unibyte string from C string when the length isn't known.  */
 
@@ -3781,8 +3977,9 @@ build_string (const char *str)
 }
 
 extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object);
+extern Lisp_Object make_vector (ptrdiff_t, Lisp_Object);
 extern void make_byte_code (struct Lisp_Vector *);
-extern struct Lisp_Vector *allocate_vector (EMACS_INT);
+extern struct Lisp_Vector *allocate_vector (ptrdiff_t);
 
 /* Make an uninitialized vector for SIZE objects.  NOTE: you must
    be sure that GC cannot happen until the vector is completely
@@ -3796,12 +3993,7 @@ extern struct Lisp_Vector *allocate_vector (EMACS_INT);
 INLINE Lisp_Object
 make_uninit_vector (ptrdiff_t size)
 {
-  Lisp_Object v;
-  struct Lisp_Vector *p;
-
-  p = allocate_vector (size);
-  XSETVECTOR (v, p);
-  return v;
+  return make_lisp_ptr (allocate_vector (size), Lisp_Vectorlike);
 }
 
 /* Like above, but special for sub char-tables.  */
@@ -3818,6 +4010,16 @@ make_uninit_sub_char_table (int depth, int min_char)
   return v;
 }
 
+/* Make a vector of SIZE nils.  */
+
+INLINE Lisp_Object
+make_nil_vector (ptrdiff_t size)
+{
+  Lisp_Object vec = make_uninit_vector (size);
+  memclear (XVECTOR (vec)->contents, size * word_size);
+  return vec;
+}
+
 extern struct Lisp_Vector *allocate_pseudovector (int, int, int,
                                                  enum pvec_type);
 
@@ -3934,7 +4136,7 @@ extern Lisp_Object string_to_number (char const *, int, 
ptrdiff_t *);
 extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object),
                          Lisp_Object);
 extern void dir_warning (const char *, Lisp_Object);
-extern void init_obarray (void);
+extern void init_obarray_once (void);
 extern void init_lread (void);
 extern void syms_of_lread (void);
 
@@ -4040,7 +4242,7 @@ Lisp_Object backtrace_top_function (void);
 extern bool let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol);
 
 /* Defined in unexmacosx.c.  */
-#if defined DARWIN_OS && !defined CANNOT_DUMP
+#if defined DARWIN_OS && defined HAVE_UNEXEC
 extern void unexec_init_emacs_zone (void);
 extern void *unexec_malloc (size_t);
 extern void *unexec_realloc (void *, size_t);
@@ -4127,7 +4329,7 @@ extern bool overlay_touches_p (ptrdiff_t);
 extern Lisp_Object other_buffer_safely (Lisp_Object);
 extern Lisp_Object get_truename_buffer (Lisp_Object);
 extern void init_buffer_once (void);
-extern void init_buffer (int);
+extern void init_buffer (void);
 extern void syms_of_buffer (void);
 extern void keys_of_buffer (void);
 
@@ -4149,6 +4351,9 @@ extern void syms_of_marker (void);
 
 /* Defined in fileio.c.  */
 
+extern char *splice_dir_file (char *, char const *, char const *);
+extern bool file_name_absolute_p (const char *);
+extern char const *get_homedir (void);
 extern Lisp_Object expand_and_dir_to_file (Lisp_Object);
 extern Lisp_Object write_region (Lisp_Object, Lisp_Object, Lisp_Object,
                                 Lisp_Object, Lisp_Object, Lisp_Object,
@@ -4194,8 +4399,8 @@ extern ptrdiff_t fast_looking_at (Lisp_Object, ptrdiff_t, 
ptrdiff_t,
                                   ptrdiff_t, ptrdiff_t, Lisp_Object);
 extern ptrdiff_t find_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
                               ptrdiff_t, ptrdiff_t *, ptrdiff_t *, bool);
-extern ptrdiff_t scan_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
-                              ptrdiff_t, bool);
+extern void scan_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
+                         ptrdiff_t, bool);
 extern ptrdiff_t scan_newline_from_point (ptrdiff_t, ptrdiff_t *, ptrdiff_t *);
 extern ptrdiff_t find_newline_no_quit (ptrdiff_t, ptrdiff_t,
                                       ptrdiff_t, ptrdiff_t *);
@@ -4268,11 +4473,13 @@ extern void store_in_alist (Lisp_Object *, Lisp_Object, 
Lisp_Object);
 extern Lisp_Object do_switch_frame (Lisp_Object, int, int, Lisp_Object);
 extern Lisp_Object get_frame_param (struct frame *, Lisp_Object);
 extern void frames_discard_buffer (Lisp_Object);
+extern void init_frame_once (void);
 extern void syms_of_frame (void);
 
 /* Defined in emacs.c.  */
 extern char **initial_argv;
 extern int initial_argc;
+extern char const *emacs_wd;
 #if defined (HAVE_X_WINDOWS) || defined (HAVE_NS)
 extern bool display_arg;
 #endif
@@ -4413,9 +4620,13 @@ struct tty_display_info;
 
 /* Defined in sysdep.c.  */
 #ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE
-extern bool disable_address_randomization (void);
+extern int maybe_disable_address_randomization (bool, int, char **);
 #else
-INLINE bool disable_address_randomization (void) { return false; }
+INLINE int
+maybe_disable_address_randomization (bool dumping, int argc, char **argv)
+{
+  return argc;
+}
 #endif
 extern int emacs_exec_file (char const *, char *const *, char *const *);
 extern void init_standard_fds (void);
@@ -4523,6 +4734,9 @@ extern void syms_of_w32cygwinx (void);
 extern Lisp_Object Vface_alternative_font_family_alist;
 extern Lisp_Object Vface_alternative_font_registry_alist;
 extern void syms_of_xfaces (void);
+#ifdef HAVE_PDUMPER
+extern void init_xfaces (void);
+#endif
 
 #ifdef HAVE_X_WINDOWS
 /* Defined in xfns.c.  */
@@ -4597,7 +4811,7 @@ extern char *xlispstrdup (Lisp_Object) ATTRIBUTE_MALLOC;
 extern void dupstring (char **, char const *);
 
 /* Make DEST a copy of STRING's data.  Return a pointer to DEST's terminating
-   null byte.  This is like stpcpy, except the source is a Lisp string.  */
+   NUL byte.  This is like stpcpy, except the source is a Lisp string.  */
 
 INLINE char *
 lispstpcpy (char *dest, Lisp_Object string)
@@ -4801,7 +5015,7 @@ enum
         : list4 (a, b, c, d))
 
 /* Declare NAME as an auto Lisp string if possible, a GC-based one if not.
-   Take its unibyte value from the null-terminated string STR,
+   Take its unibyte value from the NUL-terminated string STR,
    an expression that should not have side effects.
    STR's value is not necessarily copied.  The resulting Lisp string
    should not be modified or given text properties or made visible to
@@ -4811,8 +5025,8 @@ enum
   AUTO_STRING_WITH_LEN (name, str, strlen (str))
 
 /* Declare NAME as an auto Lisp string if possible, a GC-based one if not.
-   Take its unibyte value from the null-terminated string STR with length LEN.
-   STR may have side effects and may contain null bytes.
+   Take its unibyte value from the NUL-terminated string STR with length LEN.
+   STR may have side effects and may contain NUL bytes.
    STR's value is not necessarily copied.  The resulting Lisp string
    should not be modified or given text properties or made visible to
    user code.  */
@@ -4895,7 +5109,7 @@ maybe_gc (void)
        && consing_since_gc > gc_relative_threshold)
       || (!NILP (Vmemory_full)
          && consing_since_gc > memory_full_cons_threshold))
-    Fgarbage_collect ();
+    garbage_collect ();
 }
 
 INLINE_HEADER_END
diff --git a/src/lread.c b/src/lread.c
index 9609770..fcee7d4 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1,6 +1,6 @@
 /* Lisp parsing and input streams.
 
-Copyright (C) 1985-1989, 1993-1995, 1997-2018 Free Software Foundation,
+Copyright (C) 1985-1989, 1993-1995, 1997-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -42,14 +42,11 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "systime.h"
 #include "termhooks.h"
 #include "blockinput.h"
+#include "pdumper.h"
 #include <c-ctype.h>
 
 #ifdef MSDOS
 #include "msdos.h"
-#if __DJGPP__ == 2 && __DJGPP_MINOR__ < 5
-# define INFINITY  __builtin_inf()
-# define NAN       __builtin_nan("")
-#endif
 #endif
 
 #ifdef HAVE_NS
@@ -74,6 +71,9 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 #if IEEE_FLOATING_POINT
 # include <ieee754.h>
+# ifndef INFINITY
+#  define INFINITY ((union ieee754_double) {.ieee = {.exponent = -1}}.d)
+# endif
 #endif
 
 /* The objects or placeholders read with the #n=object form.
@@ -1070,14 +1070,15 @@ This uses the variables `load-suffixes' and 
`load-file-rep-suffixes'.  */)
   return Fnreverse (lst);
 }
 
-/* Returns true if STRING ends with SUFFIX */
+/* Return true if STRING ends with SUFFIX.  */
 static bool
 suffix_p (Lisp_Object string, const char *suffix)
 {
   ptrdiff_t suffix_len = strlen (suffix);
   ptrdiff_t string_len = SBYTES (string);
 
-  return string_len >= suffix_len && !strcmp (SSDATA (string) + string_len - 
suffix_len, suffix);
+  return (suffix_len <= string_len
+         && strcmp (SSDATA (string) + string_len - suffix_len, suffix) == 0);
 }
 
 static void
@@ -1932,13 +1933,10 @@ readevalloop (Lisp_Object readcharfun,
   Lisp_Object macroexpand = intern ("internal-macroexpand-for-load");
 
   if (NILP (Ffboundp (macroexpand))
-      /* Don't macroexpand in .elc files, since it should have been done
-        already.  We actually don't know whether we're in a .elc file or not,
-        so we use circumstantial evidence: .el files normally go through
-        Vload_source_file_function -> load-with-code-conversion
-        -> eval-buffer.  */
-      || EQ (readcharfun, Qget_file_char)
-      || EQ (readcharfun, Qget_emacs_mule_file_char))
+      || (STRINGP (sourcename) && suffix_p (sourcename, ".elc")))
+    /* Don't macroexpand before the corresponding function is defined
+       and don't bother macroexpanding in .elc files, since it should have
+       been done already.  */
     macroexpand = Qnil;
 
   if (MARKERP (readcharfun))
@@ -1970,7 +1968,7 @@ readevalloop (Lisp_Object readcharfun,
             ? Qnil : list1 (Qt)));
 
   /* Try to ensure sourcename is a truename, except whilst preloading.  */
-  if (NILP (Vpurify_flag)
+  if (!will_dump_p ()
       && !NILP (sourcename) && !NILP (Ffile_name_absolute_p (sourcename))
       && !NILP (Ffboundp (Qfile_truename)))
     sourcename = call1 (Qfile_truename, sourcename) ;
@@ -2692,7 +2690,7 @@ free_contents (void *p)
 static Lisp_Object
 read_integer (Lisp_Object readcharfun, EMACS_INT radix)
 {
-  /* Room for sign, leading 0, other digits, trailing null byte.
+  /* Room for sign, leading 0, other digits, trailing NUL byte.
      Also, room for invalid syntax diagnostic.  */
   size_t len = max (1 + 1 + UINTMAX_WIDTH + 1,
                    sizeof "integer, radix " + INT_STRLEN_BOUND (EMACS_INT));
@@ -2913,7 +2911,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool 
first_in_list, bool locate_syms)
                  /* Sub char-table can't be read as a regular
                     vector because of a two C integer fields.  */
                  Lisp_Object tbl, tmp = read_list (1, readcharfun, false);
-                 ptrdiff_t size = XFIXNUM (Flength (tmp));
+                 ptrdiff_t size = list_length (tmp);
                  int i, depth, min_char;
                  struct Lisp_Cons *cell;
 
@@ -3882,23 +3880,16 @@ string_to_number (char const *string, int base, 
ptrdiff_t *plen)
 static Lisp_Object
 read_vector (Lisp_Object readcharfun, bool bytecodeflag, bool locate_syms)
 {
-  ptrdiff_t i, size;
-  Lisp_Object *ptr;
-  Lisp_Object tem, item, vector;
-  struct Lisp_Cons *otem;
-  Lisp_Object len;
-
-  tem = read_list (1, readcharfun, locate_syms);
-  len = Flength (tem);
-  if (bytecodeflag && XFIXNAT (len) <= COMPILED_STACK_DEPTH)
+  Lisp_Object tem = read_list (1, readcharfun, locate_syms);
+  ptrdiff_t size = list_length (tem);
+  if (bytecodeflag && size <= COMPILED_STACK_DEPTH)
     error ("Invalid byte code");
-  vector = Fmake_vector (len, Qnil);
+  Lisp_Object vector = make_nil_vector (size);
 
-  size = XFIXNAT (len);
-  ptr = XVECTOR (vector)->contents;
-  for (i = 0; i < size; i++)
+  Lisp_Object *ptr = XVECTOR (vector)->contents;
+  for (ptrdiff_t i = 0; i < size; i++)
     {
-      item = Fcar (tem);
+      Lisp_Object item = Fcar (tem);
       /* If `load-force-doc-strings' is t when reading a lazily-loaded
         bytecode object, the docstring containing the bytecode and
         constants values must be treated as unibyte and passed to
@@ -3932,7 +3923,7 @@ read_vector (Lisp_Object readcharfun, bool bytecodeflag, 
bool locate_syms)
                  if (!CONSP (item))
                    error ("Invalid byte code");
 
-                 otem = XCONS (item);
+                 struct Lisp_Cons *otem = XCONS (item);
                  bytestr = XCAR (item);
                  item = XCDR (item);
                  free_cons (otem);
@@ -3952,7 +3943,7 @@ read_vector (Lisp_Object readcharfun, bool bytecodeflag, 
bool locate_syms)
            }
        }
       ASET (vector, i, item);
-      otem = XCONS (tem);
+      struct Lisp_Cons *otem = XCONS (tem);
       tem = Fcdr (tem);
       free_cons (otem);
     }
@@ -4419,9 +4410,9 @@ OBARRAY defaults to the value of `obarray'.  */)
 #define OBARRAY_SIZE 15121
 
 void
-init_obarray (void)
+init_obarray_once (void)
 {
-  Vobarray = Fmake_vector (make_fixnum (OBARRAY_SIZE), make_fixnum (0));
+  Vobarray = make_vector (OBARRAY_SIZE, make_fixnum (0));
   initial_obarray = Vobarray;
   staticpro (&initial_obarray);
 
@@ -4440,11 +4431,12 @@ init_obarray (void)
   make_symbol_constant (Qt);
   XSYMBOL (Qt)->u.s.declared_special = true;
 
-  /* Qt is correct even if CANNOT_DUMP.  loadup.el will set to nil at end.  */
+  /* Qt is correct even if not dumping.  loadup.el will set to nil at end.  */
   Vpurify_flag = Qt;
 
   DEFSYM (Qvariable_documentation, "variable-documentation");
 }
+
 
 void
 defsubr (union Aligned_Lisp_Subr *aname)
@@ -4468,11 +4460,11 @@ defalias (struct Lisp_Subr *sname, char *string)
 #endif /* NOTDEF */
 
 /* Define an "integer variable"; a symbol whose value is forwarded to a
-   C variable of type EMACS_INT.  Sample call (with "xx" to fool make-docfile):
+   C variable of type intmax_t.  Sample call (with "xx" to fool make-docfile):
    DEFxxVAR_INT ("emacs-priority", &emacs_priority, "Documentation");  */
 void
 defvar_int (struct Lisp_Intfwd *i_fwd,
-           const char *namestring, EMACS_INT *address)
+           const char *namestring, intmax_t *address)
 {
   Lisp_Object sym;
   sym = intern_c_string (namestring);
@@ -4572,11 +4564,9 @@ load_path_check (Lisp_Object lpath)
    are running uninstalled.
 
    Uses the following logic:
-   If CANNOT_DUMP:
-     If Vinstallation_directory is not nil (ie, running uninstalled),
-     use PATH_DUMPLOADSEARCH (ie, build path).  Else use PATH_LOADSEARCH.
-   The remainder is what happens when dumping works:
-   If purify-flag (ie dumping) just use PATH_DUMPLOADSEARCH.
+   If !will_dump: Use PATH_LOADSEARCH.
+   The remainder is what happens when dumping is about to happen:
+   If dumping, just use PATH_DUMPLOADSEARCH.
    Otherwise use PATH_LOADSEARCH.
 
    If !initialized, then just return PATH_DUMPLOADSEARCH.
@@ -4599,131 +4589,109 @@ load_path_check (Lisp_Object lpath)
 static Lisp_Object
 load_path_default (void)
 {
+  if (will_dump_p ())
+    /* PATH_DUMPLOADSEARCH is the lisp dir in the source directory.
+       We used to add ../lisp (ie the lisp dir in the build
+       directory) at the front here, but that should not be
+       necessary, since in out of tree builds lisp/ is empty, save
+       for Makefile.  */
+    return decode_env_path (0, PATH_DUMPLOADSEARCH, 0);
+
   Lisp_Object lpath = Qnil;
-  const char *normal;
+  const char *normal = PATH_LOADSEARCH;
+  const char *loadpath = NULL;
 
-#ifdef CANNOT_DUMP
 #ifdef HAVE_NS
-  const char *loadpath = ns_load_path ();
+  loadpath = ns_load_path ();
 #endif
 
-  normal = PATH_LOADSEARCH;
-  if (!NILP (Vinstallation_directory)) normal = PATH_DUMPLOADSEARCH;
-
-#ifdef HAVE_NS
   lpath = decode_env_path (0, loadpath ? loadpath : normal, 0);
-#else
-  lpath = decode_env_path (0, normal, 0);
-#endif
 
-#else  /* !CANNOT_DUMP */
-
-  normal = NILP (Vpurify_flag) ? PATH_LOADSEARCH : PATH_DUMPLOADSEARCH;
-
-  if (initialized)
+  if (!NILP (Vinstallation_directory))
     {
-#ifdef HAVE_NS
-      const char *loadpath = ns_load_path ();
-      lpath = decode_env_path (0, loadpath ? loadpath : normal, 0);
-#else
-      lpath = decode_env_path (0, normal, 0);
-#endif
-      if (!NILP (Vinstallation_directory))
+      Lisp_Object tem, tem1;
+
+      /* Add to the path the lisp subdir of the installation
+         dir, if it is accessible.  Note: in out-of-tree builds,
+         this directory is empty save for Makefile.  */
+      tem = Fexpand_file_name (build_string ("lisp"),
+                               Vinstallation_directory);
+      tem1 = Ffile_accessible_directory_p (tem);
+      if (!NILP (tem1))
+        {
+          if (NILP (Fmember (tem, lpath)))
+            {
+              /* We are running uninstalled.  The default load-path
+                 points to the eventual installed lisp directories.
+                 We should not use those now, even if they exist,
+                 so start over from a clean slate.  */
+              lpath = list1 (tem);
+            }
+        }
+      else
+        /* That dir doesn't exist, so add the build-time
+           Lisp dirs instead.  */
         {
-          Lisp_Object tem, tem1;
+          Lisp_Object dump_path =
+            decode_env_path (0, PATH_DUMPLOADSEARCH, 0);
+          lpath = nconc2 (lpath, dump_path);
+        }
 
-          /* Add to the path the lisp subdir of the installation
-             dir, if it is accessible.  Note: in out-of-tree builds,
-             this directory is empty save for Makefile.  */
-          tem = Fexpand_file_name (build_string ("lisp"),
+      /* Add site-lisp under the installation dir, if it exists.  */
+      if (!no_site_lisp)
+        {
+          tem = Fexpand_file_name (build_string ("site-lisp"),
                                    Vinstallation_directory);
           tem1 = Ffile_accessible_directory_p (tem);
           if (!NILP (tem1))
             {
               if (NILP (Fmember (tem, lpath)))
-                {
-                  /* We are running uninstalled.  The default load-path
-                     points to the eventual installed lisp directories.
-                     We should not use those now, even if they exist,
-                     so start over from a clean slate.  */
-                  lpath = list1 (tem);
-                }
-            }
-          else
-            /* That dir doesn't exist, so add the build-time
-               Lisp dirs instead.  */
-            {
-              Lisp_Object dump_path =
-                decode_env_path (0, PATH_DUMPLOADSEARCH, 0);
-              lpath = nconc2 (lpath, dump_path);
+                lpath = Fcons (tem, lpath);
             }
+        }
 
-          /* Add site-lisp under the installation dir, if it exists.  */
-          if (!no_site_lisp)
-            {
-              tem = Fexpand_file_name (build_string ("site-lisp"),
-                                       Vinstallation_directory);
-              tem1 = Ffile_accessible_directory_p (tem);
-              if (!NILP (tem1))
-                {
-                  if (NILP (Fmember (tem, lpath)))
-                    lpath = Fcons (tem, lpath);
-                }
-            }
+      /* If Emacs was not built in the source directory,
+         and it is run from where it was built, add to load-path
+         the lisp and site-lisp dirs under that directory.  */
+
+      if (NILP (Fequal (Vinstallation_directory, Vsource_directory)))
+        {
+          Lisp_Object tem2;
 
-          /* If Emacs was not built in the source directory,
-             and it is run from where it was built, add to load-path
-             the lisp and site-lisp dirs under that directory.  */
+          tem = Fexpand_file_name (build_string ("src/Makefile"),
+                                   Vinstallation_directory);
+          tem1 = Ffile_exists_p (tem);
 
-          if (NILP (Fequal (Vinstallation_directory, Vsource_directory)))
+          /* Don't be fooled if they moved the entire source tree
+             AFTER dumping Emacs.  If the build directory is indeed
+             different from the source dir, src/Makefile.in and
+             src/Makefile will not be found together.  */
+          tem = Fexpand_file_name (build_string ("src/Makefile.in"),
+                                   Vinstallation_directory);
+          tem2 = Ffile_exists_p (tem);
+          if (!NILP (tem1) && NILP (tem2))
             {
-              Lisp_Object tem2;
-
-              tem = Fexpand_file_name (build_string ("src/Makefile"),
-                                       Vinstallation_directory);
-              tem1 = Ffile_exists_p (tem);
-
-              /* Don't be fooled if they moved the entire source tree
-                 AFTER dumping Emacs.  If the build directory is indeed
-                 different from the source dir, src/Makefile.in and
-                 src/Makefile will not be found together.  */
-              tem = Fexpand_file_name (build_string ("src/Makefile.in"),
-                                       Vinstallation_directory);
-              tem2 = Ffile_exists_p (tem);
-              if (!NILP (tem1) && NILP (tem2))
-                {
-                  tem = Fexpand_file_name (build_string ("lisp"),
-                                           Vsource_directory);
+              tem = Fexpand_file_name (build_string ("lisp"),
+                                       Vsource_directory);
 
-                  if (NILP (Fmember (tem, lpath)))
-                    lpath = Fcons (tem, lpath);
+              if (NILP (Fmember (tem, lpath)))
+                lpath = Fcons (tem, lpath);
 
-                  if (!no_site_lisp)
+              if (!no_site_lisp)
+                {
+                  tem = Fexpand_file_name (build_string ("site-lisp"),
+                                           Vsource_directory);
+                  tem1 = Ffile_accessible_directory_p (tem);
+                  if (!NILP (tem1))
                     {
-                      tem = Fexpand_file_name (build_string ("site-lisp"),
-                                               Vsource_directory);
-                      tem1 = Ffile_accessible_directory_p (tem);
-                      if (!NILP (tem1))
-                        {
-                          if (NILP (Fmember (tem, lpath)))
-                            lpath = Fcons (tem, lpath);
-                        }
+                      if (NILP (Fmember (tem, lpath)))
+                        lpath = Fcons (tem, lpath);
                     }
                 }
-            } /* Vinstallation_directory != Vsource_directory */
+            }
+        } /* Vinstallation_directory != Vsource_directory */
 
-        } /* if Vinstallation_directory */
-    }
-  else                          /* !initialized */
-    {
-      /* NORMAL refers to PATH_DUMPLOADSEARCH, ie the lisp dir in the
-         source directory.  We used to add ../lisp (ie the lisp dir in
-         the build directory) at the front here, but that should not
-         be necessary, since in out of tree builds lisp/ is empty, save
-         for Makefile.  */
-      lpath = decode_env_path (0, normal, 0);
-    }
-#endif /* !CANNOT_DUMP */
+    } /* if Vinstallation_directory */
 
   return lpath;
 }
@@ -4737,11 +4705,7 @@ init_lread (void)
   /* First, set Vload_path.  */
 
   /* Ignore EMACSLOADPATH when dumping.  */
-#ifdef CANNOT_DUMP
-  bool use_loadpath = true;
-#else
-  bool use_loadpath = NILP (Vpurify_flag);
-#endif
+  bool use_loadpath = !will_dump_p ();
 
   if (use_loadpath && egetenv ("EMACSLOADPATH"))
     {
@@ -4792,7 +4756,7 @@ init_lread (void)
       load_path_check (Vload_path);
 
       /* Add the site-lisp directories at the front.  */
-      if (initialized && !no_site_lisp && PATH_SITELOADSEARCH[0] != '\0')
+      if (!will_dump_p () && !no_site_lisp && PATH_SITELOADSEARCH[0] != '\0')
         {
           Lisp_Object sitelisp;
           sitelisp = decode_env_path (0, PATH_SITELOADSEARCH, 0);
diff --git a/src/macfont.h b/src/macfont.h
index 4073fce..7065070 100644
--- a/src/macfont.h
+++ b/src/macfont.h
@@ -1,5 +1,5 @@
 /* Interface definition for macOS Core text font backend.
-   Copyright (C) 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/macfont.m b/src/macfont.m
index c9a1eda..5962782 100644
--- a/src/macfont.m
+++ b/src/macfont.m
@@ -1,5 +1,5 @@
 /* Font driver on macOS Core text.
-   Copyright (C) 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -35,6 +35,7 @@ Original author: YAMAMOTO Mitsuharu
 #include "nsterm.h"
 #include "macfont.h"
 #include "macuvs.h"
+#include "pdumper.h"
 
 #include <libkern/OSByteOrder.h>
 
@@ -1029,12 +1030,12 @@ macfont_handle_font_change_notification 
(CFNotificationCenterRef center,
 static void
 macfont_init_font_change_handler (void)
 {
-  static bool initialized = false;
+  static bool xinitialized = false;
 
-  if (initialized)
+  if (xinitialized)
     return;
 
-  initialized = true;
+  xinitialized = true;
   CFNotificationCenterAddObserver
     (CFNotificationCenterGetLocalCenter (), NULL,
      macfont_handle_font_change_notification,
@@ -1646,7 +1647,7 @@ static int macfont_variation_glyphs (struct font *, int c,
                                      unsigned variations[256]);
 static void macfont_filter_properties (Lisp_Object, Lisp_Object);
 
-static struct font_driver const macfont_driver =
+static struct font_driver macfont_driver =
   {
   .type = LISPSYM_INITIALLY (Qmac_ct),
   .get_cache = macfont_get_cache,
@@ -1791,16 +1792,14 @@ macfont_get_open_type_spec (Lisp_Object otf_spec)
   spec->nfeatures[0] = spec->nfeatures[1] = 0;
   for (i = 0; i < 2 && ! NILP (otf_spec); i++, otf_spec = XCDR (otf_spec))
     {
-      Lisp_Object len;
-
       val = XCAR (otf_spec);
       if (NILP (val))
         continue;
-      len = Flength (val);
+      ptrdiff_t len = list_length (val);
       spec->features[i] =
-        (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < XFIXNUM (len)
+        (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (int) < len
          ? 0
-         : malloc (XFIXNUM (len) * sizeof *spec->features[i]));
+         : malloc (len * sizeof *spec->features[i]));
       if (! spec->features[i])
         {
           if (i > 0 && spec->features[0])
@@ -2992,7 +2991,7 @@ macfont_shape (Lisp_Object lgstring)
 
       if (NILP (lglyph))
         {
-          lglyph = Fmake_vector (make_fixnum (LGLYPH_SIZE), Qnil);
+          lglyph = make_nil_vector (LGLYPH_SIZE);
           LGSTRING_SET_GLYPH (lgstring, i, lglyph);
         }
 
@@ -3044,9 +3043,7 @@ macfont_shape (Lisp_Object lgstring)
       wadjust = lround (gl->advance);
       if (xoff != 0 || yoff != 0 || wadjust != metrics.width)
         {
-          Lisp_Object vec;
-
-          vec = Fmake_vector (make_fixnum (3), Qnil);
+          Lisp_Object vec = make_uninit_vector (3);
           ASET (vec, 0, make_fixnum (xoff));
           ASET (vec, 1, make_fixnum (yoff));
           ASET (vec, 2, make_fixnum (wadjust));
@@ -4032,12 +4029,14 @@ mac_register_font_driver (struct frame *f)
 }
 
 
+
+static void syms_of_macfont_for_pdumper (void);
+
 void
 syms_of_macfont (void)
 {
   /* Core Text, for macOS.  */
   DEFSYM (Qmac_ct, "mac-ct");
-  register_font_driver (&macfont_driver, NULL);
 
   /* The font property key specifying the font design destination.  The
      value is an unsigned integer code: 0 for WYSIWYG, and 1 for Video
@@ -4052,4 +4051,18 @@ syms_of_macfont (void)
 
   macfont_family_cache = Qnil;
   staticpro (&macfont_family_cache);
+
+  pdumper_do_now_and_after_load (syms_of_macfont_for_pdumper);
+}
+
+static void
+syms_of_macfont_for_pdumper (void)
+{
+  if (dumped_with_pdumper_p ())
+    macfont_family_cache = Qnil;
+  else
+    eassert (NILP (macfont_family_cache));
+
+  macfont_driver.type = Qmac_ct;
+  register_font_driver (&macfont_driver, NULL);
 }
diff --git a/src/macros.c b/src/macros.c
index 0677021..2d927ff 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -1,6 +1,6 @@
 /* Keyboard macros.
 
-Copyright (C) 1985-1986, 1993, 2000-2018 Free Software Foundation, Inc.
+Copyright (C) 1985-1986, 1993, 2000-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -267,7 +267,7 @@ pop_kbd_macro (Lisp_Object info)
   Lisp_Object tem;
   Vexecuting_kbd_macro = XCAR (info);
   tem = XCDR (info);
-  executing_kbd_macro_index = XFIXNUM (XCAR (tem));
+  integer_to_intmax (XCAR (tem), &executing_kbd_macro_index);
   Vreal_this_command = XCDR (tem);
   run_hook (Qkbd_macro_termination_hook);
 }
@@ -301,7 +301,7 @@ each iteration of the macro.  Iteration stops if LOOPFUNC 
returns nil.  */)
     error ("Keyboard macros must be strings or vectors");
 
   tem = Fcons (Vexecuting_kbd_macro,
-              Fcons (make_fixnum (executing_kbd_macro_index),
+              Fcons (make_int (executing_kbd_macro_index),
                      Vreal_this_command));
   record_unwind_protect (pop_kbd_macro, tem);
 
diff --git a/src/macros.h b/src/macros.h
index c2b1a70..815dd01 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -1,5 +1,5 @@
 /* Definitions for keyboard macro interpretation in GNU Emacs.
-   Copyright (C) 1985, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1985, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/macuvs.h b/src/macuvs.h
index 679e8fa..e83a372 100644
--- a/src/macuvs.h
+++ b/src/macuvs.h
@@ -1,4 +1,5 @@
-/* Automatically generated by uvs.el.  */
+/* This file was automatically generated from admin/unidata/IVD_Sequences.txt
+   by the script admin/unidata/uvs.el  */
 static const unsigned char mac_uvs_table_adobe_japan1_bytes[] =
   {
     0x00, 0x0e, 0x00, 0x01, 0x1f, 0xb2, 0x00, 0x00,
diff --git a/src/marker.c b/src/marker.c
index b9ea5c5..b58051a 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -1,5 +1,5 @@
 /* Markers: examining, setting and deleting.
-   Copyright (C) 1985, 1997-1998, 2001-2018 Free Software Foundation,
+   Copyright (C) 1985, 1997-1998, 2001-2019 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
@@ -30,7 +30,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 static ptrdiff_t cached_charpos;
 static ptrdiff_t cached_bytepos;
 static struct buffer *cached_buffer;
-static EMACS_INT cached_modiff;
+static modiff_count cached_modiff;
 
 /* Juanma Barranquero <address@hidden> reported ~3x increased
    bootstrap time when byte_char_debug_check is enabled; so this
diff --git a/src/menu.c b/src/menu.c
index d75a842..7f46e68 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1,6 +1,6 @@
 /* Platform-independent code for terminal communications.
 
-Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2018 Free Software
+Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -60,9 +60,9 @@ have_boxes (void)
 
 Lisp_Object menu_items;
 
-/* If non-nil, means that the global vars defined here are already in use.
+/* Whether the global vars defined here are already in use.
    Used to detect cases where we try to re-enter this non-reentrant code.  */
-Lisp_Object menu_items_inuse;
+bool menu_items_inuse;
 
 /* Number of slots currently allocated in menu_items.  */
 int menu_items_allocated;
@@ -80,16 +80,16 @@ static int menu_items_submenu_depth;
 void
 init_menu_items (void)
 {
-  if (!NILP (menu_items_inuse))
+  if (menu_items_inuse)
     error ("Trying to use a menu from within a menu-entry");
 
   if (NILP (menu_items))
     {
       menu_items_allocated = 60;
-      menu_items = Fmake_vector (make_fixnum (menu_items_allocated), Qnil);
+      menu_items = make_nil_vector (menu_items_allocated);
     }
 
-  menu_items_inuse = Qt;
+  menu_items_inuse = true;
   menu_items_used = 0;
   menu_items_n_panes = 0;
   menu_items_submenu_depth = 0;
@@ -105,7 +105,7 @@ finish_menu_items (void)
 void
 unuse_menu_items (void)
 {
-  menu_items_inuse = Qnil;
+  menu_items_inuse = false;
 }
 
 /* Call when finished using the data for the current menu
@@ -121,7 +121,7 @@ discard_menu_items (void)
       menu_items = Qnil;
       menu_items_allocated = 0;
     }
-  eassert (NILP (menu_items_inuse));
+  eassert (!menu_items_inuse);
 }
 
 /* This undoes save_menu_items, and it is called by the specpdl unwind
@@ -131,7 +131,7 @@ static void
 restore_menu_items (Lisp_Object saved)
 {
   menu_items = XCAR (saved);
-  menu_items_inuse = (! NILP (menu_items) ? Qt : Qnil);
+  menu_items_inuse = ! NILP (menu_items);
   menu_items_allocated = (VECTORP (menu_items) ? ASIZE (menu_items) : 0);
   saved = XCDR (saved);
   menu_items_used = XFIXNUM (XCAR (saved));
@@ -147,12 +147,12 @@ restore_menu_items (Lisp_Object saved)
 void
 save_menu_items (void)
 {
-  Lisp_Object saved = list4 (!NILP (menu_items_inuse) ? menu_items : Qnil,
+  Lisp_Object saved = list4 (menu_items_inuse ? menu_items : Qnil,
                             make_fixnum (menu_items_used),
                             make_fixnum (menu_items_n_panes),
                             make_fixnum (menu_items_submenu_depth));
   record_unwind_protect (restore_menu_items, saved);
-  menu_items_inuse = Qnil;
+  menu_items_inuse = false;
   menu_items = Qnil;
 }
 
@@ -170,8 +170,7 @@ ensure_menu_items (int items)
     }
 }
 
-#if (defined USE_X_TOOLKIT || defined USE_GTK || defined HAVE_NS \
-     || defined HAVE_NTGUI)
+#ifdef HAVE_EXT_MENU_BAR
 
 /* Begin a submenu.  */
 
@@ -195,7 +194,7 @@ push_submenu_end (void)
   menu_items_submenu_depth--;
 }
 
-#endif /* USE_X_TOOLKIT || USE_GTK || HAVE_NS || defined HAVE_NTGUI */
+#endif /* HAVE_EXT_MENU_BAR */
 
 /* Indicate boundary between left and right.  */
 
@@ -524,19 +523,15 @@ bool
 parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name,
                      Lisp_Object maps)
 {
-  Lisp_Object length;
-  EMACS_INT len;
   Lisp_Object *mapvec;
-  ptrdiff_t i;
   bool top_level_items = 0;
   USE_SAFE_ALLOCA;
 
-  length = Flength (maps);
-  len = XFIXNUM (length);
+  ptrdiff_t len = list_length (maps);
 
   /* Convert the list MAPS into a vector MAPVEC.  */
   SAFE_ALLOCA_LISP (mapvec, len);
-  for (i = 0; i < len; i++)
+  for (ptrdiff_t i = 0; i < len; i++)
     {
       mapvec[i] = Fcar (maps);
       maps = Fcdr (maps);
@@ -544,7 +539,7 @@ parse_single_submenu (Lisp_Object item_key, Lisp_Object 
item_name,
 
   /* Loop over the given keymaps, making a pane for each map.
      But don't make a pane that is empty--ignore that map instead.  */
-  for (i = 0; i < len; i++)
+  for (ptrdiff_t i = 0; i < len; i++)
     {
       if (!KEYMAPP (mapvec[i]))
        {
@@ -1309,7 +1304,7 @@ x_popup_menu_1 (Lisp_Object position, Lisp_Object menu)
   else if (CONSP (menu) && KEYMAPP (XCAR (menu)))
     {
       /* We were given a list of keymaps.  */
-      EMACS_INT nmaps = XFIXNAT (Flength (menu));
+      ptrdiff_t nmaps = list_length (menu);
       Lisp_Object *maps;
       ptrdiff_t i;
       USE_SAFE_ALLOCA;
@@ -1580,9 +1575,8 @@ for instance using the window manager, then this produces 
a quit and
 void
 syms_of_menu (void)
 {
-  staticpro (&menu_items);
   menu_items = Qnil;
-  menu_items_inuse = Qnil;
+  staticpro (&menu_items);
 
   defsubr (&Sx_popup_menu);
   defsubr (&Sx_popup_dialog);
diff --git a/src/menu.h b/src/menu.h
index fa32a86..0321c27 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -1,5 +1,5 @@
 /* Functions to manipulate menus.
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -35,8 +35,7 @@ extern void discard_menu_items (void);
 extern void save_menu_items (void);
 extern bool parse_single_submenu (Lisp_Object, Lisp_Object, Lisp_Object);
 extern void list_of_panes (Lisp_Object);
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) \
-  || defined (HAVE_NS)
+#ifdef HAVE_EXT_MENU_BAR
 extern void free_menubar_widget_value_tree (widget_value *);
 extern void update_submenu_strings (widget_value *);
 extern void find_and_call_menu_selection (struct frame *, int,
diff --git a/src/mini-gmp-emacs.c b/src/mini-gmp-emacs.c
index 7a1b7ab..051590b 100644
--- a/src/mini-gmp-emacs.c
+++ b/src/mini-gmp-emacs.c
@@ -1,6 +1,6 @@
 /* Tailor mini-gmp.c for GNU Emacs
 
-Copyright 2018 Free Software Foundation, Inc.
+Copyright 2018-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/mini-gmp.c b/src/mini-gmp.c
index c0d5b87..90beb6e 100644
--- a/src/mini-gmp.c
+++ b/src/mini-gmp.c
@@ -2,7 +2,7 @@
 
    Contributed to the GNU project by Niels Möller
 
-Copyright 1991-1997, 1999-2018 Free Software Foundation, Inc.
+Copyright 1991-1997, 1999-2019 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
diff --git a/src/mini-gmp.h b/src/mini-gmp.h
index 27e0c06..2586d32 100644
--- a/src/mini-gmp.h
+++ b/src/mini-gmp.h
@@ -1,6 +1,6 @@
 /* mini-gmp, a minimalistic implementation of a GNU GMP subset.
 
-Copyright 2011-2015, 2017 Free Software Foundation, Inc.
+Copyright 2011-2015, 2017, 2019 Free Software Foundation, Inc.
 
 This file is part of the GNU MP Library.
 
diff --git a/src/minibuf.c b/src/minibuf.c
index 2b331c6..a0025e2 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1,6 +1,6 @@
 /* Minibuffer input and completion.
 
-Copyright (C) 1985-1986, 1993-2018 Free Software Foundation, Inc.
+Copyright (C) 1985-1986, 1993-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -32,6 +32,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "keymap.h"
 #include "sysstdio.h"
 #include "systty.h"
+#include "pdumper.h"
 
 /* List of buffers for use as minibuffers.
    The first element of the list is used for the outermost minibuffer
@@ -780,8 +781,7 @@ read_minibuf_unwind (void)
 
   /* Restore prompt, etc, from outer minibuffer level.  */
   Lisp_Object key_vec = Fcar (minibuf_save_list);
-  eassert (VECTORP (key_vec));
-  this_command_key_count = XFIXNAT (Flength (key_vec));
+  this_command_key_count = ASIZE (key_vec);
   this_command_keys = key_vec;
   minibuf_save_list = Fcdr (minibuf_save_list);
   minibuf_prompt = Fcar (minibuf_save_list);
@@ -1052,20 +1052,21 @@ A user option, or customizable variable, is one for 
which
 }
 
 DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 4, 0,
-       doc: /* Read the name of a buffer and return as a string.
-Prompt with PROMPT.
-Optional second arg DEF is value to return if user enters an empty line.
+       doc: /* Read the name of a buffer and return it as a string.
+Prompt with PROMPT, which should be a string ending with a colon and a space.
+Provides completion on buffer names the user types.
+Optional second arg DEF is value to return if user enters an empty line,
+ instead of that empty string.
  If DEF is a list of default values, return its first element.
-Optional third arg REQUIRE-MATCH determines whether non-existing
- buffer names are allowed.  It has the same meaning as the
+Optional third arg REQUIRE-MATCH has the same meaning as the
  REQUIRE-MATCH argument of `completing-read'.
-The argument PROMPT should be a string ending with a colon and a space.
+Optional arg PREDICATE, if non-nil, is a function limiting the buffers that
+can be considered.  It will be called with each potential candidate, and
+should return non-nil to accept the candidate for completion, nil otherwise.
 If `read-buffer-completion-ignore-case' is non-nil, completion ignores
 case while reading the buffer name.
 If `read-buffer-function' is non-nil, this works by calling it as a
-function, instead of the usual behavior.
-Optional arg PREDICATE if non-nil is a function limiting the buffers that can
-be considered.  */)
+function, instead of the usual behavior.  */)
   (Lisp_Object prompt, Lisp_Object def, Lisp_Object require_match,
    Lisp_Object predicate)
 {
@@ -1199,6 +1200,9 @@ is used to further constrain the set of candidates.  */)
       bucket = AREF (collection, idx);
     }
 
+  if (HASH_TABLE_P (collection))
+    hash_rehash_if_needed (XHASH_TABLE (collection));
+
   while (1)
     {
       /* Get the next element of the alist, obarray, or hash-table.  */
@@ -1783,7 +1787,7 @@ If FLAG is nil, invoke `try-completion'; if it is t, 
invoke
          while (CONSP (bufs) && SREF (XCAR (bufs), 0) == ' ')
            bufs = XCDR (bufs);
          if (NILP (bufs))
-           return (EQ (Flength (res), Flength (Vbuffer_alist))
+           return (list_length (res) == list_length (Vbuffer_alist)
                    /* If all bufs are internal don't strip them out.  */
                    ? res : bufs);
          res = bufs;
@@ -1798,7 +1802,9 @@ If FLAG is nil, invoke `try-completion'; if it is t, 
invoke
   else if (EQ (flag, Qlambda))
     return Ftest_completion (string, Vbuffer_alist, predicate);
   else if (EQ (flag, Qmetadata))
-    return list2 (Qmetadata, Fcons (Qcategory, Qbuffer));
+    return list3 (Qmetadata,
+                  Fcons (Qcategory, Qbuffer),
+                  Fcons (Qcycle_sort_function, Qidentity));
   else
     return Qnil;
 }
@@ -1859,21 +1865,36 @@ If no minibuffer is active, return nil.  */)
 }
 
 
+
+static void init_minibuf_once_for_pdumper (void);
+
 void
 init_minibuf_once (void)
 {
-  Vminibuffer_list = Qnil;
   staticpro (&Vminibuffer_list);
+  pdumper_do_now_and_after_load (init_minibuf_once_for_pdumper);
 }
 
-void
-syms_of_minibuf (void)
+static void
+init_minibuf_once_for_pdumper (void)
 {
+  PDUMPER_IGNORE (minibuf_level);
+  PDUMPER_IGNORE (minibuf_prompt_width);
+
+  /* We run this function on first initialization and whenever we
+     restore from a pdumper image.  pdumper doesn't try to preserve
+     frames, windows, and so on, so reset everything related here.  */
+  Vminibuffer_list = Qnil;
   minibuf_level = 0;
   minibuf_prompt = Qnil;
-  staticpro (&minibuf_prompt);
-
   minibuf_save_list = Qnil;
+  last_minibuf_string = Qnil;
+}
+
+void
+syms_of_minibuf (void)
+{
+  staticpro (&minibuf_prompt);
   staticpro (&minibuf_save_list);
 
   DEFSYM (Qcompletion_ignore_case, "completion-ignore-case");
@@ -1883,7 +1904,6 @@ syms_of_minibuf (void)
   DEFSYM (Qminibuffer_completion_table, "minibuffer-completion-table");
 
   staticpro (&last_minibuf_string);
-  last_minibuf_string = Qnil;
 
   DEFSYM (Qcustom_variable_history, "custom-variable-history");
   Fset (Qcustom_variable_history, Qnil);
@@ -1905,6 +1925,8 @@ syms_of_minibuf (void)
   DEFSYM (Qactivate_input_method, "activate-input-method");
   DEFSYM (Qcase_fold_search, "case-fold-search");
   DEFSYM (Qmetadata, "metadata");
+  DEFSYM (Qcycle_sort_function, "cycle-sort-function");
+
   /* A frame parameter.  */
   DEFSYM (Qminibuffer_exit, "minibuffer-exit");
 
diff --git a/src/module-env-25.h b/src/module-env-25.h
index 675010b..d8f8eb6 100644
--- a/src/module-env-25.h
+++ b/src/module-env-25.h
@@ -88,13 +88,13 @@
     EMACS_ATTRIBUTE_NONNULL(1);
 
   /* Copy the content of the Lisp string VALUE to BUFFER as an utf8
-     null-terminated string.
+     NUL-terminated string.
 
      SIZE must point to the total size of the buffer.  If BUFFER is
      NULL or if SIZE is not big enough, write the required buffer size
      to SIZE and return true.
 
-     Note that SIZE must include the last null byte (e.g. "abc" needs
+     Note that SIZE must include the last NUL byte (e.g. "abc" needs
      a buffer of size 4).
 
      Return true if the string was successfully copied.  */
diff --git a/src/module-env-27.h b/src/module-env-27.h
new file mode 100644
index 0000000..b491b60
--- /dev/null
+++ b/src/module-env-27.h
@@ -0,0 +1,4 @@
+  /* Processes pending input events and returns whether the module
+     function should quit.  */
+  enum emacs_process_input_result (*process_input) (emacs_env *env)
+    EMACS_ATTRIBUTE_NONNULL (1);
diff --git a/src/msdos.c b/src/msdos.c
index 4031c57..7dd5f57 100644
--- a/src/msdos.c
+++ b/src/msdos.c
@@ -1,6 +1,6 @@
 /* MS-DOS specific C utilities.          -*- coding: cp850 -*-
 
-Copyright (C) 1993-1997, 1999-2018 Free Software Foundation, Inc.
+Copyright (C) 1993-1997, 1999-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/msdos.h b/src/msdos.h
index 6b91338..ff756f8 100644
--- a/src/msdos.h
+++ b/src/msdos.h
@@ -1,5 +1,5 @@
 /* MS-DOS specific C utilities, interface.
-   Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/nsfns.m b/src/nsfns.m
index 659bce8..ee7598a 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -1,6 +1,6 @@
 /* Functions for the NeXT/Open/GNUstep and macOS window system.
 
-Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2018 Free Software
+Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -49,7 +49,6 @@ GNUstep port and post-20 update by Adrian Robert 
(address@hidden)
 #include "macfont.h"
 #endif
 
-
 #ifdef HAVE_NS
 
 static EmacsTooltip *ns_tooltip = nil;
@@ -2476,7 +2475,7 @@ ns_make_monitor_attribute_list (struct MonitorInfo 
*monitors,
                                 int primary_monitor,
                                 const char *source)
 {
-  Lisp_Object monitor_frames = Fmake_vector (make_fixnum (n_monitors), Qnil);
+  Lisp_Object monitor_frames = make_nil_vector (n_monitors);
   Lisp_Object frame, rest;
   NSArray *screens = [NSScreen screens];
   int i;
@@ -2812,23 +2811,20 @@ frame_geometry (Lisp_Object frame, Lisp_Object 
attribute)
 
   /* Construct list.  */
   if (EQ (attribute, Qouter_edges))
-    return list4 (make_fixnum (f->left_pos), make_fixnum (f->top_pos),
-                 make_fixnum (f->left_pos + outer_width),
-                 make_fixnum (f->top_pos + outer_height));
+    return list4i (f->left_pos, f->top_pos,
+                  f->left_pos + outer_width,
+                  f->top_pos + outer_height);
   else if (EQ (attribute, Qnative_edges))
-    return list4 (make_fixnum (native_left), make_fixnum (native_top),
-                 make_fixnum (native_right), make_fixnum (native_bottom));
+    return list4i (native_left, native_top,
+                  native_right, native_bottom);
   else if (EQ (attribute, Qinner_edges))
-    return list4 (make_fixnum (native_left + internal_border_width),
-                 make_fixnum (native_top
-                              + tool_bar_height
-                              + internal_border_width),
-                 make_fixnum (native_right - internal_border_width),
-                 make_fixnum (native_bottom - internal_border_width));
+    return list4i (native_left + internal_border_width,
+                  native_top + tool_bar_height + internal_border_width,
+                  native_right - internal_border_width,
+                  native_bottom - internal_border_width);
   else
     return
-      listn (CONSTYPE_HEAP, 10,
-            Fcons (Qouter_position,
+       list (Fcons (Qouter_position,
                    Fcons (make_fixnum (f->left_pos),
                           make_fixnum (f->top_pos))),
             Fcons (Qouter_size,
@@ -3125,7 +3121,6 @@ handlePanelKeys (NSSavePanel *panel, NSEvent *theEvent)
 
    ========================================================================== 
*/
 
-
 void
 syms_of_nsfns (void)
 {
@@ -3215,5 +3210,6 @@ Default is t.  */);
 
   as_status = 0;
   as_script = Qnil;
+  staticpro (&as_script);
   as_result = 0;
 }
diff --git a/src/nsfont.m b/src/nsfont.m
index b1ebb53..9721e48 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -1,6 +1,6 @@
 /* Font back-end driver for the NeXT/Open/GNUstep and macOS window system.
    See font.h
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -36,6 +36,7 @@ Author: Adrian Robert (address@hidden)
 #include "character.h"
 #include "font.h"
 #include "termchar.h"
+#include "pdumper.h"
 
 /* TODO: Drop once we can assume gnustep-gui 0.17.1.  */
 #ifdef NS_IMPL_GNUSTEP
@@ -576,7 +577,7 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
 
     /* Add synthItal member if needed.  */
     family = [fdesc objectForKey: NSFontFamilyAttribute];
-    if (family != nil && !foundItal && XFIXNUM (Flength (list)) > 0)
+    if (family != nil && !foundItal && !NILP (list))
       {
         NSFontDescriptor *s1 = [NSFontDescriptor new];
         NSFontDescriptor *sDesc
@@ -595,8 +596,8 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch)
       return ns_fallback_entity ();
 
     if (NSFONT_TRACE)
-       fprintf (stderr, "    Returning %"pI"d entities.\n",
-                 XFIXNUM (Flength (list)));
+       fprintf (stderr, "    Returning %"pD"d entities.\n",
+                list_length (list));
 
     return list;
 }
@@ -667,8 +668,8 @@ nsfont_list_family (struct frame *f)
   /* FIXME: escape the name?  */
 
   if (NSFONT_TRACE)
-    fprintf (stderr, "nsfont: list families returning %"pI"d entries\n",
-            XFIXNUM (Flength (list)));
+    fprintf (stderr, "nsfont: list families returning %"pD"d entries\n",
+            list_length (list));
 
   unblock_input ();
   return list;
@@ -1483,6 +1484,8 @@ ns_dump_glyphstring (struct glyph_string *s)
   fprintf (stderr, "\n");
 }
 
+static void syms_of_nsfont_for_pdumper (void);
+
 struct font_driver const nsfont_driver =
   {
   .type = LISPSYM_INITIALLY (Qns),
@@ -1502,13 +1505,17 @@ struct font_driver const nsfont_driver =
 void
 syms_of_nsfont (void)
 {
-  register_font_driver (&nsfont_driver, NULL);
   DEFSYM (Qcondensed, "condensed");
   DEFSYM (Qexpanded, "expanded");
   DEFSYM (Qapple, "apple");
   DEFSYM (Qmedium, "medium");
   DEFVAR_LISP ("ns-reg-to-script", Vns_reg_to_script,
                doc: /* Internal use: maps font registry to Unicode script.  
*/);
+  pdumper_do_now_and_after_load (syms_of_nsfont_for_pdumper);
+}
 
-  ascii_printable = NULL;
+static void
+syms_of_nsfont_for_pdumper (void)
+{
+  register_font_driver (&nsfont_driver, NULL);
 }
diff --git a/src/nsgui.h b/src/nsgui.h
index 4e7d7d3..c857d77 100644
--- a/src/nsgui.h
+++ b/src/nsgui.h
@@ -1,5 +1,5 @@
 /* Definitions and headers for communication on the NeXT/Open/GNUstep API.
-   Copyright (C) 1995, 2005, 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2005, 2008-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -73,6 +73,8 @@ typedef unichar XChar2b;
 #define XCHAR2B_BYTE2(chp) \
   (*(chp) & 0x00ff)
 
+/* Used in xdisp.c when comparing faces and frame colors.  */
+extern unsigned long ns_color_index_to_rgba(int idx, struct frame *f);
 
 /* XXX: xfaces requires these structures, but the question is are we
         forced to use them?  */
diff --git a/src/nsimage.m b/src/nsimage.m
index 0ae1b88..f16910d 100644
--- a/src/nsimage.m
+++ b/src/nsimage.m
@@ -1,5 +1,5 @@
 /* Image support for the NeXT/Open/GNUstep and macOS window system.
-   Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2018 Free Software
+   Copyright (C) 1989, 1992-1994, 2005-2006, 2008-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -126,8 +126,6 @@ ns_load_image (struct frame *f, struct image *img,
       eImg = temp;
     }
 
-  [eImg setSizeFromSpec:XCDR (img->spec)];
-
   size = [eImg size];
   img->width = size.width;
   img->height = size.height;
@@ -151,6 +149,12 @@ ns_image_height (void *img)
   return [(id)img size].height;
 }
 
+void
+ns_image_set_size (void *img, int width, int height)
+{
+  [(EmacsImage *)img setSize:NSMakeSize (width, height)];
+}
+
 unsigned long
 ns_get_pixel (void *img, int x, int y)
 {
@@ -524,66 +528,6 @@ ns_set_alpha (void *img, int x, int y, unsigned char a)
   return YES;
 }
 
-- (void)setSizeFromSpec: (Lisp_Object) spec
-{
-  NSSize size = [self size];
-  Lisp_Object value;
-  double scale = 1, aspect = size.width / size.height;
-  double width = -1, height = -1, max_width = -1, max_height = -1;
-
-  value = Fplist_get (spec, QCscale);
-  if (NUMBERP (value))
-    scale = XFLOATINT (value) ;
-
-  value = Fplist_get (spec, QCmax_width);
-  if (NUMBERP (value))
-    max_width = XFLOATINT (value);
-
-  value = Fplist_get (spec, QCmax_height);
-  if (NUMBERP (value))
-    max_height = XFLOATINT (value);
-
-  value = Fplist_get (spec, QCwidth);
-  if (NUMBERP (value))
-    {
-      width = XFLOATINT (value) * scale;
-      /* :width overrides :max-width. */
-      max_width = -1;
-    }
-
-  value = Fplist_get (spec, QCheight);
-  if (NUMBERP (value))
-    {
-      height = XFLOATINT (value) * scale;
-      /* :height overrides :max-height. */
-      max_height = -1;
-    }
-
-  if (width <= 0 && height <= 0)
-    {
-      width = size.width * scale;
-      height = size.height * scale;
-    }
-  else if (width > 0 && height <= 0)
-      height = width / aspect;
-  else if (height > 0 && width <= 0)
-      width = height * aspect;
-
-  if (max_width > 0 && width > max_width)
-    {
-      width = max_width;
-      height = max_width / aspect;
-    }
-
-  if (max_height > 0 && height > max_height)
-    {
-      height = max_height;
-      width = max_height * aspect;
-    }
-
-  [self setSize:NSMakeSize(width, height)];
-}
-
 - (instancetype)rotate: (double)rotation
 {
   EmacsImage *new_image;
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 983e777..34ec980 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1,5 +1,5 @@
 /* NeXT/Open/GNUstep and macOS Cocoa menu and toolbar module.
-   Copyright (C) 2007-2018 Free Software Foundation, Inc.
+   Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -37,6 +37,7 @@ Carbon version by Yamamoto Mitsuharu. */
 #include "termhooks.h"
 #include "keyboard.h"
 #include "menu.h"
+#include "pdumper.h"
 
 #define NSMENUPROFILE 0
 
@@ -1893,6 +1894,7 @@ syms_of_nsmenu (void)
   /* Don't know how to keep track of this in Next/Open/GNUstep.  Always
      update menus there.  */
   trackingMenu = 1;
+  PDUMPER_REMEMBER_SCALAR (trackingMenu);
 #endif
   defsubr (&Sns_reset_menu);
   defsubr (&Smenu_or_popup_active_p);
diff --git a/src/nsselect.m b/src/nsselect.m
index 35705bf..cf36c86 100644
--- a/src/nsselect.m
+++ b/src/nsselect.m
@@ -1,5 +1,5 @@
 /* NeXT/Open/GNUstep / macOS Cocoa selection processing for emacs.
-   Copyright (C) 1993-1994, 2005-2006, 2008-2018 Free Software
+   Copyright (C) 1993-1994, 2005-2006, 2008-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/nsterm.h b/src/nsterm.h
index 23460ab..78ce608 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -1,5 +1,5 @@
 /* Definitions and headers for communication with NeXT/Open/GNUstep API.
-   Copyright (C) 1989, 1993, 2005, 2008-2018 Free Software Foundation,
+   Copyright (C) 1989, 1993, 2005, 2008-2019 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
@@ -648,7 +648,6 @@ typedef id instancetype;
 - (NSColor *)stippleMask;
 - (Lisp_Object)getMetadata;
 - (BOOL)setFrame: (unsigned int) index;
-- (void)setSizeFromSpec: (Lisp_Object) spec;
 - (instancetype)rotate: (double)rotation;
 @end
 
@@ -1197,6 +1196,7 @@ extern bool ns_load_image (struct frame *f, struct image 
*img,
                           Lisp_Object spec_file, Lisp_Object spec_data);
 extern int ns_image_width (void *img);
 extern int ns_image_height (void *img);
+extern void ns_image_set_size (void *img, int width, int height);
 extern unsigned long ns_get_pixel (void *img, int x, int y);
 extern void ns_put_pixel (void *img, int x, int y, unsigned long argb);
 extern void ns_set_alpha (void *img, int x, int y, unsigned char a);
diff --git a/src/nsterm.m b/src/nsterm.m
index bcc23ff..81d36be 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -1,6 +1,6 @@
 /* NeXT/Open/GNUstep / macOS communication module.      -*- coding: utf-8 -*-
 
-Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2018 Free Software
+Copyright (C) 1989, 1993-1994, 2005-2006, 2008-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -60,6 +60,7 @@ GNUstep port and post-20 update by Adrian Robert 
(address@hidden)
 #include "keyboard.h"
 #include "buffer.h"
 #include "font.h"
+#include "pdumper.h"
 
 #ifdef NS_IMPL_GNUSTEP
 #include "process.h"
@@ -499,7 +500,7 @@ append2 (Lisp_Object list, Lisp_Object item)
    Utility to append to a list
    -------------------------------------------------------------------------- 
*/
 {
-  return CALLN (Fnconc, list, list1 (item));
+  return nconc2 (list, list (item));
 }
 
 
@@ -850,6 +851,27 @@ ns_menu_bar_height (NSScreen *screen)
 }
 
 
+static NSRect
+ns_row_rect (struct window *w, struct glyph_row *row,
+               enum glyph_row_area area)
+/* Get the row as an NSRect.  */
+{
+  struct frame *f = XFRAME (WINDOW_FRAME (w));
+  NSRect rect;
+  int window_x, window_y, window_width;
+
+  window_box (w, area, &window_x, &window_y, &window_width, 0);
+
+  rect.origin.x = window_x;
+  rect.origin.y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, row->y));
+  rect.origin.y = max (rect.origin.y, window_y);
+  rect.size.width = window_width;
+  rect.size.height = row->visible_height;
+
+  return rect;
+}
+
+
 /* ==========================================================================
 
     Focus (clipping) and screen update
@@ -1102,29 +1124,6 @@ ns_update_begin (struct frame *f)
     if (! tbar_visible != ! [toolbar isVisible])
       [toolbar setVisible: tbar_visible];
   }
-
-  /* drawRect may have been called for say the minibuffer, and then clip path
-     is for the minibuffer.  But the display engine may draw more because
-     we have set the frame as garbaged.  So reset clip path to the whole
-     view.  */
-  /* FIXME: I don't think we need to do this.  */
-  if ([NSView focusView] == FRAME_NS_VIEW (f))
-    {
-      NSBezierPath *bp;
-      NSRect r = [view frame];
-      NSRect cr = [[view window] frame];
-      /* If a large frame size is set, r may be larger than the window frame
-         before constrained.  In that case don't change the clip path, as we
-         will clear in to the tool bar and title bar.  */
-      if (r.size.height
-          + FRAME_NS_TITLEBAR_HEIGHT (f)
-          + FRAME_TOOLBAR_HEIGHT (f) <= cr.size.height)
-        {
-          bp = [[NSBezierPath bezierPathWithRect: r] retain];
-          [bp setClip];
-          [bp release];
-        }
-    }
 #endif
 }
 
@@ -1260,28 +1259,6 @@ ns_reset_clipping (struct frame *f)
 }
 
 
-static BOOL
-ns_clip_to_row (struct window *w, struct glyph_row *row,
-               enum glyph_row_area area, BOOL gc)
-/* --------------------------------------------------------------------------
-     Internal (but parallels other terms): Focus drawing on given row
-   -------------------------------------------------------------------------- 
*/
-{
-  struct frame *f = XFRAME (WINDOW_FRAME (w));
-  NSRect clip_rect;
-  int window_x, window_y, window_width;
-
-  window_box (w, area, &window_x, &window_y, &window_width, 0);
-
-  clip_rect.origin.x = window_x;
-  clip_rect.origin.y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, row->y));
-  clip_rect.origin.y = max (clip_rect.origin.y, window_y);
-  clip_rect.size.width = window_width;
-  clip_rect.size.height = row->visible_height;
-
-  return ns_clip_to_rect (f, &clip_rect, 1);
-}
-
 /* ==========================================================================
 
     Visible bell and beep.
@@ -1973,7 +1950,7 @@ x_set_parent_frame (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_valu
           [[child parentWindow] removeChildWindow:child];
 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
 #if MAC_OS_X_VERSION_MIN_REQUIRED < 101000
-          if ([child respondsToSelector:@selector(setAccessibilitySubrole:)]
+          if ([child respondsToSelector:@selector(setAccessibilitySubrole:)])
 #endif
               [child 
setAccessibilitySubrole:NSAccessibilityStandardWindowSubrole];
 #endif
@@ -1987,7 +1964,7 @@ x_set_parent_frame (struct frame *f, Lisp_Object 
new_value, Lisp_Object old_valu
                          ordered: NSWindowAbove];
 #if defined (NS_IMPL_COCOA) && MAC_OS_X_VERSION_MAX_ALLOWED >= 101000
 #if MAC_OS_X_VERSION_MIN_REQUIRED < 101000
-          if ([child respondsToSelector:@selector(setAccessibilitySubrole:)]
+          if ([child respondsToSelector:@selector(setAccessibilitySubrole:)])
 #endif
               [child 
setAccessibilitySubrole:NSAccessibilityFloatingWindowSubrole];
 #endif
@@ -2356,6 +2333,22 @@ ns_lisp_to_color (Lisp_Object color, NSColor **col)
   return 1;
 }
 
+/* Convert an index into the color table into an RGBA value.  Used in
+   xdisp.c:extend_face_to_end_of_line when comparing faces and frame
+   color values.  */
+
+unsigned long
+ns_color_index_to_rgba(int idx, struct frame *f)
+{
+  NSColor *col;
+  col = ns_lookup_indexed_color (idx, f);
+
+  EmacsCGFloat r, g, b, a;
+  [col getRed: &r green: &g blue: &b alpha: &a];
+
+  return ARGB_TO_ULONG((int)(a*255),
+                       (int)(r*255), (int)(g*255), (int)(b*255));
+}
 
 void
 ns_query_color(void *col, XColor *color_def, int setPixel)
@@ -2819,7 +2812,7 @@ static void
 ns_copy_bits (struct frame *f, NSRect src, NSRect dest)
 {
   NSSize delta = NSMakeSize (dest.origin.x - src.origin.x,
-                             dest.origin.y - src.origin.y)
+                             dest.origin.y - src.origin.y);
   NSTRACE ("ns_copy_bits");
 
   if (FRAME_NS_VIEW (f))
@@ -2952,12 +2945,20 @@ ns_shift_glyphs_for_insert (struct frame *f,
     External (RIF): copy an area horizontally, don't worry about clearing src
    -------------------------------------------------------------------------- 
*/
 {
-  NSRect srcRect = NSMakeRect (x, y, width, height);
+  //NSRect srcRect = NSMakeRect (x, y, width, height);
   NSRect dstRect = NSMakeRect (x+shift_by, y, width, height);
 
   NSTRACE ("ns_shift_glyphs_for_insert");
 
-  ns_copy_bits (f, srcRect, dstRect);
+  /* This doesn't work now as we copy the "bits" before we've had a
+     chance to actually draw any changes to the screen.  This means in
+     certain circumstances we end up with copies of the cursor all
+     over the place.  Just mark the area dirty so it is redrawn later.
+
+     FIXME: Work out how to do this properly.  */
+  // ns_copy_bits (f, srcRect, dstRect);
+
+  [FRAME_NS_VIEW (f) setNeedsDisplayInRect:dstRect];
 }
 
 
@@ -3038,6 +3039,9 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row 
*row,
   struct face *face = p->face;
   static EmacsImage **bimgs = NULL;
   static int nBimgs = 0;
+  NSRect clearRect = NSZeroRect;
+  NSRect imageRect = NSZeroRect;
+  NSRect rowRect = ns_row_rect (w, row, ANY_AREA);
 
   NSTRACE_WHEN (NSTRACE_GROUP_FRINGE, "ns_draw_fringe_bitmap");
   NSTRACE_MSG ("which:%d cursor:%d overlay:%d width:%d height:%d period:%d",
@@ -3052,25 +3056,40 @@ ns_draw_fringe_bitmap (struct window *w, struct 
glyph_row *row,
       nBimgs = max_used_fringe_bitmap;
     }
 
-  /* Must clip because of partially visible lines.  */
-  if (ns_clip_to_row (w, row, ANY_AREA, YES))
+  /* Work out the rectangle we will composite into.  */
+  if (p->which)
+    imageRect = NSMakeRect (p->x, p->y, p->wd, p->h);
+
+  /* Work out the rectangle we will need to clear.  Because we're
+     compositing rather than blitting, we need to clear the area under
+     the image regardless of anything else.  */
+  if (p->bx >= 0 && !p->overlay_p)
+    {
+      clearRect = NSMakeRect (p->bx, p->by, p->nx, p->ny);
+      clearRect = NSUnionRect (clearRect, imageRect);
+    }
+  else
+    {
+      clearRect = imageRect;
+    }
+
+  /* Handle partially visible rows.  */
+  clearRect = NSIntersectionRect (clearRect, rowRect);
+
+  /* The visible portion of imageRect will always be contained within
+     clearRect.  */
+  if (ns_clip_to_rect (f, &clearRect, 1))
     {
-      if (!p->overlay_p)
+      if (! NSIsEmptyRect (clearRect))
         {
-          int bx = p->bx, by = p->by, nx = p->nx, ny = p->ny;
+          NSTRACE_RECT ("clearRect", clearRect);
 
-          if (bx >= 0 && nx > 0)
-            {
-              NSRect r = NSMakeRect (bx, by, nx, ny);
-              NSRectClip (r);
-              [ns_lookup_indexed_color (face->background, f) set];
-              NSRectFill (r);
-            }
+          [ns_lookup_indexed_color(face->background, f) set];
+          NSRectFill (clearRect);
         }
 
       if (p->which)
         {
-          NSRect r = NSMakeRect (p->x, p->y, p->wd, p->h);
           EmacsImage *img = bimgs[p->which - 1];
 
           if (!img)
@@ -3091,13 +3110,6 @@ ns_draw_fringe_bitmap (struct window *w, struct 
glyph_row *row,
               xfree (cbits);
             }
 
-          NSTRACE_RECT ("r", r);
-
-          NSRectClip (r);
-          /* Since we composite the bitmap instead of just blitting it, we need
-             to erase the whole background.  */
-          [ns_lookup_indexed_color(face->background, f) set];
-          NSRectFill (r);
 
           {
             NSColor *bm_color;
@@ -3110,26 +3122,18 @@ ns_draw_fringe_bitmap (struct window *w, struct 
glyph_row *row,
             [img setXBMColor: bm_color];
           }
 
-#ifdef NS_IMPL_COCOA
           // Note: For periodic images, the full image height is "h + hd".
           // By using the height h, a suitable part of the image is used.
           NSRect fromRect = NSMakeRect(0, 0, p->wd, p->h);
 
           NSTRACE_RECT ("fromRect", fromRect);
 
-          [img drawInRect: r
+          [img drawInRect: imageRect
                  fromRect: fromRect
                 operation: NSCompositingOperationSourceOver
                  fraction: 1.0
                respectFlipped: YES
                     hints: nil];
-#else
-          {
-            NSPoint pt = r.origin;
-            pt.y += p->h;
-            [img compositeToPoint: pt operation: 
NSCompositingOperationSourceOver];
-          }
-#endif
         }
       ns_reset_clipping (f);
     }
@@ -3215,7 +3219,9 @@ ns_draw_window_cursor (struct window *w, struct glyph_row 
*glyph_row,
   r.size.width = w->phys_cursor_width;
 
   /* Prevent the cursor from being drawn outside the text area.  */
-  if (ns_clip_to_row (w, glyph_row, TEXT_AREA, NO))
+  r = NSIntersectionRect (r, ns_row_rect (w, glyph_row, TEXT_AREA));
+
+  if (ns_clip_to_rect (f, &r, 1))
     {
       face = FACE_FROM_ID_OR_NULL (f, phys_cursor_glyph->face_id);
       if (face && NS_FACE_BACKGROUND (face)
@@ -3255,11 +3261,19 @@ ns_draw_window_cursor (struct window *w, struct 
glyph_row *glyph_row,
           NSRectFill (s);
           break;
         }
-      ns_reset_clipping (f);
 
-      /* draw the character under the cursor */
-      if (cursor_type != NO_CURSOR)
+      /* Draw the character under the cursor.  Other terms only draw
+         the character on top of box cursors, so do the same here.  */
+      if (cursor_type == FILLED_BOX_CURSOR || cursor_type == HOLLOW_BOX_CURSOR)
         draw_phys_cursor_glyph (w, glyph_row, DRAW_CURSOR);
+
+      ns_reset_clipping (f);
+    }
+  else if (! redisplaying_p)
+    {
+      /* If this function is called outside redisplay, it probably
+         means we need an immediate update.  */
+      [FRAME_NS_VIEW (f) display];
     }
 }
 
@@ -3898,8 +3912,9 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r)
     {
       if (s->hl == DRAW_IMAGE_SUNKEN || s->hl == DRAW_IMAGE_RAISED)
         {
-          th = tool_bar_button_relief >= 0 ?
-            tool_bar_button_relief : DEFAULT_TOOL_BAR_BUTTON_RELIEF;
+          th = (tool_bar_button_relief < 0
+               ? DEFAULT_TOOL_BAR_BUTTON_RELIEF
+               : min (tool_bar_button_relief, 1000000));
           raised_p = (s->hl == DRAW_IMAGE_RAISED);
         }
       else
@@ -8142,6 +8157,14 @@ not_in_argv (NSString *arg)
 }
 
 
+- (void)viewWillDraw
+{
+  /* If the frame has been garbaged there's no point in redrawing
+     anything.  */
+  if (FRAME_GARBAGED_P (emacsframe))
+    [self setNeedsDisplay:NO];
+}
+
 - (void)drawRect: (NSRect)rect
 {
   const NSRect *rectList;
@@ -8165,6 +8188,9 @@ not_in_argv (NSString *arg)
   for (int i = 0 ; i < numRects ; i++)
     {
       NSRect r = rectList[i];
+
+      NSTRACE_RECT ("r", r);
+
       expose_frame (emacsframe,
                     NSMinX (r), NSMinY (r),
                     NSWidth (r), NSHeight (r));
@@ -8207,7 +8233,9 @@ not_in_argv (NSString *arg)
   NSEvent *theEvent = [[self window] currentEvent];
   NSPoint position;
   NSDragOperation op = [sender draggingSourceOperationMask];
-  int modifiers = 0;
+  Lisp_Object operations = Qnil;
+  Lisp_Object strings = Qnil;
+  Lisp_Object type_sym;
 
   NSTRACE ("[EmacsView performDragOperation:]");
 
@@ -8220,19 +8248,17 @@ not_in_argv (NSString *arg)
   pb = [sender draggingPasteboard];
   type = [pb availableTypeFromArray: ns_drag_types];
 
-  if (! (op & (NSDragOperationMove|NSDragOperationDelete)) &&
-      // URL drags contain all operations (0xf), don't allow all to be set.
-      (op & 0xf) != 0xf)
-    {
-      if (op & NSDragOperationLink)
-        modifiers |= NSEventModifierFlagControl;
-      if (op & NSDragOperationCopy)
-        modifiers |= NSEventModifierFlagOption;
-      if (op & NSDragOperationGeneric)
-        modifiers |= NSEventModifierFlagCommand;
-    }
+  /* We used to convert these drag operations to keyboard modifiers,
+     but because they can be set by the sending program as well as the
+     keyboard modifiers it was difficult to work out a sensible key
+     mapping for drag and drop.  */
+  if (op & NSDragOperationLink)
+    operations = Fcons (Qns_drag_operation_link, operations);
+  if (op & NSDragOperationCopy)
+    operations = Fcons (Qns_drag_operation_copy, operations);
+  if (op & NSDragOperationGeneric || NILP (operations))
+    operations = Fcons (Qns_drag_operation_generic, operations);
 
-  modifiers = EV_MODIFIERS2 (modifiers);
   if (type == 0)
     {
       return NO;
@@ -8246,39 +8272,20 @@ not_in_argv (NSString *arg)
       if (!(files = [pb propertyListForType: type]))
         return NO;
 
+      type_sym = Qfile;
+
       fenum = [files objectEnumerator];
       while ( (file = [fenum nextObject]) )
-        {
-          emacs_event->kind = DRAG_N_DROP_EVENT;
-          XSETINT (emacs_event->x, x);
-          XSETINT (emacs_event->y, y);
-          emacs_event->modifiers = modifiers;
-          emacs_event->arg =  list2 (Qfile, build_string ([file UTF8String]));
-          EV_TRAILER (theEvent);
-        }
-      return YES;
+        strings = Fcons (build_string ([file UTF8String]), strings);
     }
   else if ([type isEqualToString: NSURLPboardType])
     {
       NSURL *url = [NSURL URLFromPasteboard: pb];
       if (url == nil) return NO;
 
-      emacs_event->kind = DRAG_N_DROP_EVENT;
-      XSETINT (emacs_event->x, x);
-      XSETINT (emacs_event->y, y);
-      emacs_event->modifiers = modifiers;
-      emacs_event->arg =  list2 (Qurl,
-                                 build_string ([[url absoluteString]
-                                                 UTF8String]));
-      EV_TRAILER (theEvent);
+      type_sym = Qurl;
 
-      if ([url isFileURL] != NO)
-        {
-          NSString *file = [url path];
-          ns_input_file = append2 (ns_input_file,
-                                   build_string ([file UTF8String]));
-        }
-      return YES;
+      strings = list1 (build_string ([[url absoluteString] UTF8String]));
     }
   else if ([type isEqualToString: NSStringPboardType]
            || [type isEqualToString: NSTabularTextPboardType])
@@ -8288,19 +8295,27 @@ not_in_argv (NSString *arg)
       if (! (data = [pb stringForType: type]))
         return NO;
 
-      emacs_event->kind = DRAG_N_DROP_EVENT;
-      XSETINT (emacs_event->x, x);
-      XSETINT (emacs_event->y, y);
-      emacs_event->modifiers = modifiers;
-      emacs_event->arg =  list2 (Qnil, build_string ([data UTF8String]));
-      EV_TRAILER (theEvent);
-      return YES;
+      type_sym = Qnil;
+
+      strings = list1 (build_string ([data UTF8String]));
     }
   else
     {
       fprintf (stderr, "Invalid data type in dragging pasteboard");
       return NO;
     }
+
+  emacs_event->kind = DRAG_N_DROP_EVENT;
+  XSETINT (emacs_event->x, x);
+  XSETINT (emacs_event->y, y);
+  emacs_event->modifiers = 0;
+
+  emacs_event->arg = Fcons (type_sym,
+                            Fcons (operations,
+                                   strings));
+  EV_TRAILER (theEvent);
+
+  return YES;
 }
 
 
@@ -9322,6 +9337,7 @@ syms_of_nsterm (void)
   NSTRACE ("syms_of_nsterm");
 
   ns_antialias_threshold = 10.0;
+  PDUMPER_REMEMBER_SCALAR (ns_antialias_threshold);
 
   /* From 23+ we need to tell emacs what modifiers there are.  */
   DEFSYM (Qmodifier_value, "modifier-value");
@@ -9335,6 +9351,10 @@ syms_of_nsterm (void)
   DEFSYM (Qfile, "file");
   DEFSYM (Qurl, "url");
 
+  DEFSYM (Qns_drag_operation_copy, "ns-drag-operation-copy");
+  DEFSYM (Qns_drag_operation_link, "ns-drag-operation-link");
+  DEFSYM (Qns_drag_operation_generic, "ns-drag-operation-generic");
+
   Fput (Qalt, Qmodifier_value, make_fixnum (alt_modifier));
   Fput (Qhyper, Qmodifier_value, make_fixnum (hyper_modifier));
   Fput (Qmeta, Qmodifier_value, make_fixnum (meta_modifier));
diff --git a/src/pdumper.c b/src/pdumper.c
new file mode 100644
index 0000000..a9b3732
--- /dev/null
+++ b/src/pdumper.c
@@ -0,0 +1,5536 @@
+/* Copyright (C) 2018-2019 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.  */
+
+#include <config.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
+#include <math.h>
+#include <stdarg.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/mman.h>
+#include <sys/param.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "blockinput.h"
+#include "buffer.h"
+#include "charset.h"
+#include "coding.h"
+#include "fingerprint.h"
+#include "frame.h"
+#include "getpagesize.h"
+#include "intervals.h"
+#include "lisp.h"
+#include "pdumper.h"
+#include "window.h"
+#include "systime.h"
+#include "thread.h"
+#include "bignum.h"
+
+#include "dmpstruct.h"
+
+/*
+  TODO:
+
+  - Two-pass dumping: first assemble object list, then write all.
+    This way, we can perform arbitrary reordering or maybe use fancy
+    graph algorithms to get better locality.
+
+  - Don't emit relocations that happen to set Emacs memory locations
+    to values they will already have.
+
+  - Nullify frame_and_buffer_state.
+
+  - Preferred base address for relocation-free non-PIC startup.
+
+  - Compressed dump support.
+
+*/
+
+#ifdef HAVE_PDUMPER
+
+/* CHECK_STRUCTS being true makes the build break if we notice
+   changes to the source defining certain Lisp structures we dump. If
+   you change one of these structures, check that the pdumper code is
+   still valid, and update the pertinent hash lower down in this file
+   (pdumper.c) by manually copying the value from the dmpstruct.h
+   generated from your new code.  */
+#ifndef CHECK_STRUCTS
+# define CHECK_STRUCTS 1
+#endif
+
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
+# pragma GCC diagnostic error "-Wconversion"
+# pragma GCC diagnostic error "-Wshadow"
+# define ALLOW_IMPLICIT_CONVERSION                       \
+  _Pragma ("GCC diagnostic push")                        \
+  _Pragma ("GCC diagnostic ignored \"-Wconversion\"")
+  _Pragma ("GCC diagnostic ignored \"-Wsign-conversion\"")
+# define DISALLOW_IMPLICIT_CONVERSION \
+  _Pragma ("GCC diagnostic pop")
+#else
+# define ALLOW_IMPLICIT_CONVERSION ((void)0)
+# define DISALLOW_IMPLICIT_CONVERSION ((void)0)
+#endif
+
+#define VM_POSIX 1
+#define VM_MS_WINDOWS 2
+
+#if defined (HAVE_MMAP) && defined (MAP_FIXED)
+# define VM_SUPPORTED VM_POSIX
+# if !defined (MAP_POPULATE) && defined (MAP_PREFAULT_READ)
+#  define MAP_POPULATE MAP_PREFAULT_READ
+# elif !defined (MAP_POPULATE)
+#  define MAP_POPULATE 0
+# endif
+#elif defined (WINDOWSNT)
+  /* Use a float infinity, to avoid compiler warnings in comparing vs
+     candidates' score.  */
+# undef INFINITY
+# define INFINITY __builtin_inff ()
+# include <windows.h>
+# define VM_SUPPORTED VM_MS_WINDOWS
+#else
+# define VM_SUPPORTED 0
+#endif
+
+#define DANGEROUS 0
+
+/* PDUMPER_CHECK_REHASHING being true causes the portable dumper to
+   check, for each hash table it dumps, that the hash table means the
+   same thing after rehashing.  */
+#ifndef PDUMPER_CHECK_REHASHING
+# if ENABLE_CHECKING
+#  define PDUMPER_CHECK_REHASHING 1
+# else
+#  define PDUMPER_CHECK_REHASHING 0
+# endif
+#endif
+
+/* We require an architecture in which all pointers are the same size
+   and have the same layout, where pointers are either 32 or 64 bits
+   long, and where bytes have eight bits --- that is, a
+   general-purpose computer made after 1990.  */
+verify (sizeof (ptrdiff_t) == sizeof (void *));
+verify (sizeof (intptr_t) == sizeof (ptrdiff_t));
+verify (sizeof (void (*)(void)) == sizeof (void *));
+verify (sizeof (ptrdiff_t) <= sizeof (Lisp_Object));
+verify (sizeof (ptrdiff_t) <= sizeof (EMACS_INT));
+verify (sizeof (off_t) == sizeof (int32_t)
+       || sizeof (off_t) == sizeof (int64_t));
+verify (CHAR_BIT == 8);
+
+#define DIVIDE_ROUND_UP(x, y) (((x) + (y) - 1) / (y))
+
+static const char dump_magic[16] = {
+  'D', 'U', 'M', 'P', 'E', 'D',
+  'G', 'N', 'U',
+  'E', 'M', 'A', 'C', 'S'
+};
+
+static pdumper_hook dump_hooks[24];
+static int nr_dump_hooks = 0;
+
+static struct
+{
+  void *mem;
+  int sz;
+} remembered_data[32];
+static int nr_remembered_data = 0;
+
+typedef int32_t dump_off;
+#define DUMP_OFF_MIN INT32_MIN
+#define DUMP_OFF_MAX INT32_MAX
+
+__attribute__((format (printf,1,2)))
+static void
+dump_trace (const char *fmt, ...)
+{
+  if (0)
+    {
+      va_list args;
+      va_start (args, fmt);
+      vfprintf (stderr, fmt, args);
+      va_end (args);
+    }
+}
+
+static ssize_t dump_read_all (int fd, void *buf, size_t bytes_to_read);
+
+static dump_off
+ptrdiff_t_to_dump_off (ptrdiff_t value)
+{
+  eassert (DUMP_OFF_MIN <= value);
+  eassert (value <= DUMP_OFF_MAX);
+  return (dump_off) value;
+}
+
+/* Worst-case allocation granularity on any system that might load
+   this dump.  */
+static int
+dump_get_page_size (void)
+{
+#if defined (WINDOWSNT) || defined (CYGWIN)
+  return 64 * 1024;  /* Worst-case allocation granularity.  */
+#else
+  return getpagesize ();
+#endif
+}
+
+#define dump_offsetof(type, member)                             \
+  (ptrdiff_t_to_dump_off (offsetof (type, member)))
+
+enum dump_reloc_type
+  {
+    /* dump_ptr = dump_ptr + emacs_basis()  */
+    RELOC_DUMP_TO_EMACS_PTR_RAW,
+    /* dump_ptr = dump_ptr + dump_base  */
+    RELOC_DUMP_TO_DUMP_PTR_RAW,
+    /* dump_mpz = [rebuild bignum]  */
+    RELOC_BIGNUM,
+    /* dump_lv = make_lisp_ptr (dump_lv + dump_base,
+                               type - RELOC_DUMP_TO_DUMP_LV)
+       (Special case for symbols: make_lisp_symbol)
+       Must be second-last.  */
+    RELOC_DUMP_TO_DUMP_LV,
+    /* dump_lv = make_lisp_ptr (dump_lv + emacs_basis(),
+                               type - RELOC_DUMP_TO_DUMP_LV)
+       (Special case for symbols: make_lisp_symbol.)
+       Must be last.  */
+    RELOC_DUMP_TO_EMACS_LV = RELOC_DUMP_TO_DUMP_LV + 8,
+  };
+
+enum emacs_reloc_type
+  {
+    /* Copy raw bytes from the dump into Emacs.  The length field in
+       the emacs_reloc is the number of bytes to copy.  */
+    RELOC_EMACS_COPY_FROM_DUMP,
+    /* Set a piece of memory in Emacs to a value we store directly in
+       this relocation.  The length field contains the number of bytes
+       we actually copy into Emacs.  */
+    RELOC_EMACS_IMMEDIATE,
+    /* Set an aligned pointer-sized object in Emacs to a pointer into
+       the loaded dump at the given offset.  The length field is
+       always the machine word size.  */
+    RELOC_EMACS_DUMP_PTR_RAW,
+    /* Set an aligned pointer-sized object in Emacs to point to
+       something also in Emacs.  The length field is always
+       the machine word size.  */
+    RELOC_EMACS_EMACS_PTR_RAW,
+    /* Set an aligned Lisp_Object in Emacs to point to a value in the
+       dump.  The length field is the _tag type_ of the Lisp_Object,
+       not a byte count!  */
+    RELOC_EMACS_DUMP_LV,
+    /* Set an aligned Lisp_Object in Emacs to point to a value in the
+       Emacs image.  The length field is the _tag type_ of the
+       Lisp_Object, not a byte count!  */
+    RELOC_EMACS_EMACS_LV,
+  };
+
+#define EMACS_RELOC_TYPE_BITS 3
+#define EMACS_RELOC_LENGTH_BITS                         \
+  (sizeof (dump_off) * CHAR_BIT - EMACS_RELOC_TYPE_BITS)
+
+struct emacs_reloc
+{
+  ENUM_BF (emacs_reloc_type) type : EMACS_RELOC_TYPE_BITS;
+  dump_off length : EMACS_RELOC_LENGTH_BITS;
+  dump_off emacs_offset;
+  union
+  {
+    dump_off dump_offset;
+    dump_off emacs_offset2;
+    intmax_t immediate;
+  } u;
+};
+
+/* Set the type of an Emacs relocation.
+
+   Also make sure that the type fits in the bitfield.  */
+static void
+emacs_reloc_set_type (struct emacs_reloc *reloc,
+                      enum emacs_reloc_type type)
+{
+  reloc->type = type;
+  eassert (reloc->type == type);
+}
+
+struct dump_table_locator
+{
+  /* Offset in dump, in bytes, of the first entry in the dump
+     table.  */
+  dump_off offset;
+  /* Number of entries in the dump table.  We need an explicit end
+     indicator (as opposed to a special sentinel) so we can efficiently
+     binary search over the relocation entries.  */
+  dump_off nr_entries;
+};
+
+#define DUMP_RELOC_TYPE_BITS 5
+verify (RELOC_DUMP_TO_EMACS_LV + 8 < (1 << DUMP_RELOC_TYPE_BITS));
+
+#define DUMP_RELOC_ALIGNMENT_BITS 2
+#define DUMP_RELOC_OFFSET_BITS                          \
+  (sizeof (dump_off) * CHAR_BIT - DUMP_RELOC_TYPE_BITS)
+
+/* Minimum alignment required by dump file format.  */
+#define DUMP_RELOCATION_ALIGNMENT (1<<DUMP_RELOC_ALIGNMENT_BITS)
+
+/* The alignment granularity (in bytes) for objects we store in the
+   dump.  Always suitable for heap objects; may be more aligned.  */
+#define DUMP_ALIGNMENT (max (GCALIGNMENT, DUMP_RELOCATION_ALIGNMENT))
+verify (DUMP_ALIGNMENT >= GCALIGNMENT);
+
+struct dump_reloc
+{
+  uint32_t raw_offset : DUMP_RELOC_OFFSET_BITS;
+  ENUM_BF (dump_reloc_type) type : DUMP_RELOC_TYPE_BITS;
+};
+verify (sizeof (struct dump_reloc) == sizeof (int32_t));
+
+/* Set the type of a dump relocation.
+
+   Also assert that the type fits in the bitfield.  */
+static void
+dump_reloc_set_type (struct dump_reloc *reloc, enum dump_reloc_type type)
+{
+  reloc->type = type;
+  eassert (reloc->type == type);
+}
+
+static dump_off
+dump_reloc_get_offset (struct dump_reloc reloc)
+{
+  return reloc.raw_offset << DUMP_RELOC_ALIGNMENT_BITS;
+}
+
+static void
+dump_reloc_set_offset (struct dump_reloc *reloc, dump_off offset)
+{
+  eassert (offset >= 0);
+  ALLOW_IMPLICIT_CONVERSION;
+  reloc->raw_offset = offset >> DUMP_RELOC_ALIGNMENT_BITS;
+  DISALLOW_IMPLICIT_CONVERSION;
+  if (dump_reloc_get_offset (*reloc) != offset)
+    error ("dump relocation out of range");
+}
+
+static void
+dump_fingerprint (const char *label, const uint8_t *xfingerprint)
+{
+  fprintf (stderr, "%s: ", label);
+  for (int i = 0; i < 32; ++i)
+    fprintf (stderr, "%02x", (unsigned) xfingerprint[i]);
+  fprintf (stderr, "\n");
+}
+
+/* Format of an Emacs portable dump file.  All offsets are relative to
+   the beginning of the file.  An Emacs portable dump file is coupled
+   to exactly the Emacs binary that produced it, so details of
+   alignment and endianness are unimportant.
+
+   An Emacs dump file contains the contents of the Lisp heap.
+   On startup, Emacs can start faster by mapping a dump file into
+   memory and using the objects contained inside it instead of
+   performing initialization from scratch.
+
+   The dump file can be loaded at arbitrary locations in memory, so it
+   includes a table of relocations that let Emacs adjust the pointers
+   embedded in the dump file to account for the location where it was
+   actually loaded.
+
+   Dump files can contain pointers to other objects in the dump file
+   or to parts of the Emacs binary.  */
+struct dump_header
+{
+  /* File type magic.  */
+  char magic[sizeof (dump_magic)];
+
+  /* Associated Emacs binary.  */
+  uint8_t fingerprint[32];
+
+  /* Relocation table for the dump file; each entry is a
+     struct dump_reloc.  */
+  struct dump_table_locator dump_relocs;
+
+  /* "Relocation" table we abuse to hold information about the
+     location and type of each lisp object in the dump.  We need for
+     pdumper_object_type and ultimately for conservative GC
+     correctness.  */
+  struct dump_table_locator object_starts;
+
+  /* Relocation table for Emacs; each entry is a struct
+     emacs_reloc.  */
+  struct dump_table_locator emacs_relocs;
+
+  /* Start of sub-region of hot region that we can discard after load
+     completes.  The discardable region ends at cold_start.
+
+     This region contains objects that we copy into the Emacs image at
+     dump-load time.  */
+  dump_off discardable_start;
+
+  /* Start of the region that does not require relocations and that we
+     expect never to be modified.  This region can be memory-mapped
+     directly from the backing dump file with the reasonable
+     expectation of taking few copy-on-write faults.
+
+     For correctness, however, this region must be modifible, since in
+     rare cases it is possible to see modifications to these bytes.
+     For example, this region contains string data, and it's
+     technically possible for someone to ASET a string character
+     (although nobody tends to do that).
+
+     The start of the cold region is always aligned on a page
+     boundary.  */
+  dump_off cold_start;
+};
+
+/* Double-ended singly linked list.  */
+struct dump_tailq
+{
+  Lisp_Object head;
+  Lisp_Object tail;
+  intptr_t length;
+};
+
+/* Queue of objects to dump.  */
+struct dump_queue
+{
+  /* Objects with no link weights at all.  Kept in dump order.  */
+  struct dump_tailq zero_weight_objects;
+  /* Objects with simple link weight: just one entry of type
+     WEIGHT_NORMAL.  Score in this special case is non-decreasing as
+     position increases, so we can avoid the need to rescan a big list
+     for each object by storing these objects in order.  */
+  struct dump_tailq one_weight_normal_objects;
+  /* Likewise, for objects with one WEIGHT_STRONG weight.  */
+  struct dump_tailq one_weight_strong_objects;
+  /* List of objects with complex link weights --- i.e., not one of
+     the above cases.  Order is irrelevant, since we scan the whole
+     list every time.  Relatively few objects end up here.  */
+  struct dump_tailq fancy_weight_objects;
+  /* Hash table of link weights: maps an object to a list of zero or
+     more (BASIS . WEIGHT) pairs.  As a special case, an object with
+     zero weight is marked by Qt in the hash table --- this way, we
+     can distinguish objects we've seen but that have no weight from
+     ones that we haven't seen at all.  */
+  Lisp_Object link_weights;
+  /* Hash table mapping object to a sequence number --- used to
+     resolve ties.  */
+  Lisp_Object sequence_numbers;
+  dump_off next_sequence_number;
+};
+
+enum cold_op
+  {
+    COLD_OP_OBJECT,
+    COLD_OP_STRING,
+    COLD_OP_CHARSET,
+    COLD_OP_BUFFER,
+    COLD_OP_BIGNUM,
+  };
+
+/* This structure controls what operations we perform inside
+   dump_object.  */
+struct dump_flags
+{
+  /* Actually write object contents to the dump.  Without this flag
+     set, we still scan objects and enqueue pointed-to objects; making
+     this flag false is useful when we want to process an object's
+     referents normally, but dump an object itself separately,
+     later.  */
+  bool_bf dump_object_contents : 1;
+  /* Record object starts. We turn this flag off when writing to the
+     discardable section so that we don't trick conservative GC into
+     thinking we have objects there.  Ignored (we never record object
+     starts) if dump_object_contents is false.  */
+  bool_bf record_object_starts : 1;
+  /* Pack objects tighter than GC memory alignment would normally
+     require.  Useful for objects copied into the Emacs image instead
+     of used directly from the loaded dump.
+  */
+  bool_bf pack_objects : 1;
+  /* Sometimes we dump objects that we've already scanned for outbound
+     references to other objects.  These objects should not cause new
+     objects to enter the object dumping queue.  This flag causes Emacs
+     to assert that no new objects are enqueued while dumping.  */
+  bool_bf assert_already_seen : 1;
+  /* Punt on unstable hash tables: defer them to ctx->deferred_hash_tables.  */
+  bool_bf defer_hash_tables : 1;
+  /* Punt on symbols: defer them to ctx->deferred_symbols.  */
+  bool_bf defer_symbols : 1;
+  /* Punt on cold objects: defer them to ctx->cold_queue.  */
+  bool_bf defer_cold_objects : 1;
+  /* Punt on copied objects: defer them to ctx->copied_queue.  */
+  bool_bf defer_copied_objects : 1;
+};
+
+/* Information we use while we dump.  Note that we're not the garbage
+   collector and can operate under looser constraints: specifically,
+   we allocate memory during the dumping process.  */
+struct dump_context
+{
+  /* Header we'll write to the dump file when done.  */
+  struct dump_header header;
+
+  Lisp_Object old_purify_flag;
+  Lisp_Object old_post_gc_hook;
+
+#ifdef REL_ALLOC
+  bool blocked_ralloc;
+#endif
+
+  /* File descriptor for dumpfile; < 0 if closed.  */
+  int fd;
+  /* Name of dump file --- used for error reporting.  */
+  Lisp_Object dump_filename;
+  /* Current offset in dump file.  */
+  dump_off offset;
+
+  /* Starting offset of current object.  */
+  dump_off obj_offset;
+
+  /* Flags currently in effect for dumping.  */
+  struct dump_flags flags;
+
+  dump_off end_heap;
+
+  /* Hash mapping objects we've already dumped to their offsets.  */
+  Lisp_Object objects_dumped;
+
+  /* Hash mapping objects to where we got them.  Used for debugging.  */
+  Lisp_Object referrers;
+  Lisp_Object current_referrer;
+  bool have_current_referrer;
+
+  /* Queue of objects to dump.  */
+  struct dump_queue dump_queue;
+
+  /* Deferred object lists.  */
+  Lisp_Object deferred_hash_tables;
+  Lisp_Object deferred_symbols;
+
+  /* Fixups in the dump file.  */
+  Lisp_Object fixups;
+
+  /* Hash table of staticpro values: avoids double relocations.  */
+  Lisp_Object staticpro_table;
+
+  /* Hash table mapping symbols to their pre-copy-queue fwd or blv
+     structures (which we dump immediately before the start of the
+     discardable section). */
+  Lisp_Object symbol_aux;
+  /* Queue of copied objects for special treatment.  */
+  Lisp_Object copied_queue;
+  /* Queue of cold objects to dump.  */
+  Lisp_Object cold_queue;
+
+  /* Relocations in the dump.  */
+  Lisp_Object dump_relocs;
+
+  /* Object starts.  */
+  Lisp_Object object_starts;
+
+  /* Relocations in Emacs.  */
+  Lisp_Object emacs_relocs;
+
+  /* Hash table mapping bignums to their _data_ blobs, which we store
+     in the cold section.  The actual Lisp_Bignum objects are normal
+     heap objects.  */
+  Lisp_Object bignum_data;
+
+  unsigned number_hot_relocations;
+  unsigned number_discardable_relocations;
+};
+
+/* These special values for use as offsets in dump_remember_object and
+   dump_recall_object indicate that the corresponding object isn't in
+   the dump yet (and so it has no valid offset), but that it's on one
+   of our to-be-dumped-later object queues (or that we haven't seen it
+   at all).  All values must be non-positive, since positive values
+   are physical dump offsets.  */
+enum dump_object_special_offset
+  {
+   DUMP_OBJECT_IS_RUNTIME_MAGIC = -6,
+   DUMP_OBJECT_ON_COPIED_QUEUE = -5,
+   DUMP_OBJECT_ON_HASH_TABLE_QUEUE = -4,
+   DUMP_OBJECT_ON_SYMBOL_QUEUE = -3,
+   DUMP_OBJECT_ON_COLD_QUEUE = -2,
+   DUMP_OBJECT_ON_NORMAL_QUEUE = -1,
+   DUMP_OBJECT_NOT_SEEN = 0,
+  };
+
+/* Weights for score scores for object non-locality.  */
+enum link_weight_enum
+  {
+    WEIGHT_NONE_VALUE = 0,
+    WEIGHT_NORMAL_VALUE = 1000,
+    WEIGHT_STRONG_VALUE = 1200,
+  };
+
+struct link_weight
+{
+  /* Wrapped in a struct to break unwanted implicit conversion.  */
+  enum link_weight_enum value;
+};
+
+#define LINK_WEIGHT_LITERAL(x) ((struct link_weight){.value=(x)})
+#define WEIGHT_NONE LINK_WEIGHT_LITERAL (WEIGHT_NONE_VALUE)
+#define WEIGHT_NORMAL LINK_WEIGHT_LITERAL (WEIGHT_NORMAL_VALUE)
+#define WEIGHT_STRONG LINK_WEIGHT_LITERAL (WEIGHT_STRONG_VALUE)
+
+
+/* Dump file creation */
+
+static dump_off dump_object (struct dump_context *ctx, Lisp_Object object);
+static dump_off dump_object_for_offset (struct dump_context *ctx,
+                                       Lisp_Object object);
+
+/* Like the Lisp function `push'.  Return NEWELT.  */
+static Lisp_Object
+dump_push (Lisp_Object *where, Lisp_Object newelt)
+{
+  *where = Fcons (newelt, *where);
+  return newelt;
+}
+
+/* Like the Lisp function `pop'.  */
+static Lisp_Object
+dump_pop (Lisp_Object *where)
+{
+  Lisp_Object ret = XCAR (*where);
+  *where = XCDR (*where);
+  return ret;
+}
+
+static bool
+dump_tracking_referrers_p (struct dump_context *ctx)
+{
+  return !NILP (ctx->referrers);
+}
+
+static void
+dump_set_have_current_referrer (struct dump_context *ctx, bool have)
+{
+#ifdef ENABLE_CHECKING
+  ctx->have_current_referrer = have;
+#endif
+}
+
+/* Remember the reason objects are enqueued.
+
+   Until DUMP_CLEAR_REFERRER is called, any objects enqueued are being
+   enqueued because OBJECT refers to them.  It is not legal to enqueue
+   objects without a referer set.  We check this constraint
+   at runtime.
+
+   It is illegal to call DUMP_SET_REFERRER twice without an
+   intervening call to DUMP_CLEAR_REFERRER.
+
+   Define as a macro so we can avoid evaluating OBJECT
+   if we dont want referrer tracking.  */
+#define DUMP_SET_REFERRER(ctx, object)                   \
+  do                                                     \
+    {                                                    \
+      struct dump_context *_ctx = (ctx);                 \
+      eassert (!_ctx->have_current_referrer);            \
+      dump_set_have_current_referrer (_ctx, true);       \
+      if (dump_tracking_referrers_p (_ctx))              \
+        ctx->current_referrer = (object);                \
+    }                                                    \
+  while (0)
+
+/* Unset the referer that DUMP_SET_REFERRER set.
+
+   Named with upper-case letters for symmetry with
+   DUMP_SET_REFERRER.  */
+static void
+DUMP_CLEAR_REFERRER (struct dump_context *ctx)
+{
+  eassert (ctx->have_current_referrer);
+  dump_set_have_current_referrer (ctx, false);
+  if (dump_tracking_referrers_p (ctx))
+    ctx->current_referrer = Qnil;
+}
+
+static Lisp_Object
+dump_ptr_referrer (const char *label, void const *address)
+{
+  char buf[128];
+  buf[0] = '\0';
+  sprintf (buf, "%s @ %p", label, address);
+  return build_string (buf);
+}
+
+static void
+print_paths_to_root (struct dump_context *ctx, Lisp_Object object);
+
+static void dump_remember_cold_op (struct dump_context *ctx,
+                                   enum cold_op op,
+                                   Lisp_Object arg);
+
+_Noreturn
+static void
+error_unsupported_dump_object (struct dump_context *ctx,
+                               Lisp_Object object,
+                              const char *msg)
+{
+  if (dump_tracking_referrers_p (ctx))
+    print_paths_to_root (ctx, object);
+  error ("unsupported object type in dump: %s", msg);
+}
+
+static uintptr_t
+emacs_basis (void)
+{
+  return (uintptr_t) &Vpurify_flag;
+}
+
+static void *
+emacs_ptr_at (const ptrdiff_t offset)
+{
+  /* TODO: assert somehow that the result is actually in the Emacs
+     image.  */
+  return (void *) (emacs_basis () + offset);
+}
+
+static dump_off
+emacs_offset (const void *emacs_ptr)
+{
+  /* TODO: assert that EMACS_PTR is actually in the Emacs image.  */
+  eassert (emacs_ptr != NULL);
+  intptr_t emacs_ptr_value = (intptr_t) emacs_ptr;
+  ptrdiff_t emacs_ptr_relative = emacs_ptr_value - (intptr_t) emacs_basis ();
+  return ptrdiff_t_to_dump_off (emacs_ptr_relative);
+}
+
+/* Return whether OBJECT is a symbol the storage of which is built
+   into Emacs (and so is invariant across ASLR).  */
+static bool
+dump_builtin_symbol_p (Lisp_Object object)
+{
+  if (!SYMBOLP (object))
+    return false;
+  char *bp = (char *) lispsym;
+  struct Lisp_Symbol *s = XSYMBOL (object);
+  char *sp = (char *) s;
+  return bp <= sp && sp < bp + sizeof (lispsym);
+}
+
+/* Return whether OBJECT has the same bit pattern in all Emacs
+   invocations --- i.e., is invariant across a dump.  Note that some
+   self-representing objects still need to be dumped!
+*/
+static bool
+dump_object_self_representing_p (Lisp_Object object)
+{
+  bool result;
+  ALLOW_IMPLICIT_CONVERSION;
+  result =  FIXNUMP (object) || dump_builtin_symbol_p (object);
+  DISALLOW_IMPLICIT_CONVERSION;
+  return result;
+}
+
+#define DEFINE_FROMLISP_FUNC(fn, type)          \
+  static type                                   \
+  fn (Lisp_Object value)                        \
+  {                                             \
+    ALLOW_IMPLICIT_CONVERSION;                  \
+    if (FIXNUMP (value))                        \
+      return XFIXNUM (value);                   \
+    eassert (BIGNUMP (value));                  \
+    return TYPE_SIGNED (type)                   \
+      ? bignum_to_intmax (value)                \
+      : bignum_to_uintmax (value);              \
+    DISALLOW_IMPLICIT_CONVERSION;               \
+  }
+
+#define DEFINE_TOLISP_FUNC(fn, type) \
+  static Lisp_Object                 \
+  fn (type value)                    \
+  {                                  \
+    return INT_TO_INTEGER (value);   \
+  }
+
+DEFINE_FROMLISP_FUNC (intmax_t_from_lisp, intmax_t);
+DEFINE_TOLISP_FUNC (intmax_t_to_lisp, intmax_t);
+DEFINE_FROMLISP_FUNC (dump_off_from_lisp, dump_off);
+DEFINE_TOLISP_FUNC (dump_off_to_lisp, dump_off);
+
+static void
+dump_write (struct dump_context *ctx, const void *buf, dump_off nbyte)
+{
+  eassert (nbyte == 0 || buf != NULL);
+  eassert (ctx->obj_offset == 0);
+  eassert (ctx->flags.dump_object_contents);
+  if (emacs_write (ctx->fd, buf, nbyte) < nbyte)
+    report_file_error ("Could not write to dump file", ctx->dump_filename);
+  ctx->offset += nbyte;
+}
+
+static Lisp_Object
+make_eq_hash_table (void)
+{
+  return CALLN (Fmake_hash_table, QCtest, Qeq);
+}
+
+static void
+dump_tailq_init (struct dump_tailq *tailq)
+{
+  tailq->head = tailq->tail = Qnil;
+  tailq->length = 0;
+}
+
+static intptr_t
+dump_tailq_length (const struct dump_tailq *tailq)
+{
+  return tailq->length;
+}
+
+__attribute__((unused))
+static void
+dump_tailq_prepend (struct dump_tailq *tailq, Lisp_Object value)
+{
+  Lisp_Object link = Fcons (value, tailq->head);
+  tailq->head = link;
+  if (NILP (tailq->tail))
+    tailq->tail = link;
+  tailq->length += 1;
+}
+
+__attribute__((unused))
+static void
+dump_tailq_append (struct dump_tailq *tailq, Lisp_Object value)
+{
+  Lisp_Object link = Fcons (value, Qnil);
+  if (NILP (tailq->head))
+    {
+      eassert (NILP (tailq->tail));
+      tailq->head = tailq->tail = link;
+    }
+  else
+    {
+      eassert (!NILP (tailq->tail));
+      XSETCDR (tailq->tail, link);
+      tailq->tail = link;
+    }
+  tailq->length += 1;
+}
+
+static bool
+dump_tailq_empty_p (struct dump_tailq *tailq)
+{
+  return NILP (tailq->head);
+}
+
+static Lisp_Object
+dump_tailq_peek (struct dump_tailq *tailq)
+{
+  eassert (!dump_tailq_empty_p (tailq));
+  return XCAR (tailq->head);
+}
+
+static Lisp_Object
+dump_tailq_pop (struct dump_tailq *tailq)
+{
+  eassert (!dump_tailq_empty_p (tailq));
+  eassert (tailq->length > 0);
+  tailq->length -= 1;
+  Lisp_Object value = XCAR (tailq->head);
+  tailq->head = XCDR (tailq->head);
+  if (NILP (tailq->head))
+    tailq->tail = Qnil;
+  return value;
+}
+
+static void
+dump_seek (struct dump_context *ctx, dump_off offset)
+{
+  eassert (ctx->obj_offset == 0);
+  if (lseek (ctx->fd, offset, SEEK_SET) < 0)
+    report_file_error ("Setting file position",
+                       ctx->dump_filename);
+  ctx->offset = offset;
+}
+
+static void
+dump_write_zero (struct dump_context *ctx, dump_off nbytes)
+{
+  while (nbytes > 0)
+    {
+      uintmax_t zero = 0;
+      dump_off to_write = sizeof (zero);
+      if (to_write > nbytes)
+        to_write = nbytes;
+      dump_write (ctx, &zero, to_write);
+      nbytes -= to_write;
+    }
+}
+
+static void
+dump_align_output (struct dump_context *ctx, int alignment)
+{
+  if (ctx->offset % alignment != 0)
+    dump_write_zero (ctx, alignment - (ctx->offset % alignment));
+}
+
+static dump_off
+dump_object_start (struct dump_context *ctx,
+                   void *out,
+                   dump_off outsz)
+{
+  /* We dump only one object at a time, so obj_offset should be
+     invalid on entry to this function.  */
+  eassert (ctx->obj_offset == 0);
+  int alignment = ctx->flags.pack_objects ? 1 : DUMP_ALIGNMENT;
+  if (ctx->flags.dump_object_contents)
+    dump_align_output (ctx, alignment);
+  ctx->obj_offset = ctx->offset;
+  memset (out, 0, outsz);
+  return ctx->offset;
+}
+
+static dump_off
+dump_object_finish (struct dump_context *ctx,
+                    const void *out,
+                    dump_off sz)
+{
+  dump_off offset = ctx->obj_offset;
+  eassert (offset > 0);
+  eassert (offset == ctx->offset); /* No intervening writes.  */
+  ctx->obj_offset = 0;
+  if (ctx->flags.dump_object_contents)
+    dump_write (ctx, out, sz);
+  return offset;
+}
+
+/* Return offset at which OBJECT has been dumped, or one of the 
dump_object_special_offset
+   negative values, or DUMP_OBJECT_NOT_SEEN.  */
+static dump_off
+dump_recall_object (struct dump_context *ctx, Lisp_Object object)
+{
+  Lisp_Object dumped = ctx->objects_dumped;
+  return dump_off_from_lisp (Fgethash (object, dumped,
+                                       make_fixnum (DUMP_OBJECT_NOT_SEEN)));
+}
+
+static void
+dump_remember_object (struct dump_context *ctx,
+                      Lisp_Object object,
+                      dump_off offset)
+{
+  Fputhash (object,
+            dump_off_to_lisp (offset),
+            ctx->objects_dumped);
+}
+
+static void
+dump_note_reachable (struct dump_context *ctx, Lisp_Object object)
+{
+  eassert (ctx->have_current_referrer);
+  if (!dump_tracking_referrers_p (ctx))
+    return;
+  Lisp_Object referrer = ctx->current_referrer;
+  Lisp_Object obj_referrers = Fgethash (object, ctx->referrers, Qnil);
+  if (NILP (Fmemq (referrer, obj_referrers)))
+    Fputhash (object, Fcons (referrer, obj_referrers), ctx->referrers);
+}
+
+/* If this object lives in the Emacs image and not on the heap, return
+   a pointer to the object data.  Otherwise, return NULL.  */
+static void *
+dump_object_emacs_ptr (Lisp_Object lv)
+{
+  if (SUBRP (lv))
+    return XSUBR (lv);
+  if (dump_builtin_symbol_p (lv))
+    return XSYMBOL (lv);
+  if (XTYPE (lv) == Lisp_Vectorlike
+      && PSEUDOVECTOR_TYPEP (&XVECTOR (lv)->header, PVEC_THREAD)
+      && main_thread_p (XTHREAD (lv)))
+    return XTHREAD (lv);
+  return NULL;
+}
+
+static void
+dump_queue_init (struct dump_queue *dump_queue)
+{
+  dump_tailq_init (&dump_queue->zero_weight_objects);
+  dump_tailq_init (&dump_queue->one_weight_normal_objects);
+  dump_tailq_init (&dump_queue->one_weight_strong_objects);
+  dump_tailq_init (&dump_queue->fancy_weight_objects);
+  dump_queue->link_weights = make_eq_hash_table ();
+  dump_queue->sequence_numbers = make_eq_hash_table ();
+  dump_queue->next_sequence_number = 1;
+}
+
+static bool
+dump_queue_empty_p (struct dump_queue *dump_queue)
+{
+  bool is_empty =
+    EQ (Fhash_table_count (dump_queue->sequence_numbers),
+        make_fixnum (0));
+  eassert (EQ (Fhash_table_count (dump_queue->sequence_numbers),
+               Fhash_table_count (dump_queue->link_weights)));
+  if (!is_empty)
+    {
+      eassert (!dump_tailq_empty_p (&dump_queue->zero_weight_objects)
+              || !dump_tailq_empty_p (&dump_queue->one_weight_normal_objects)
+              || !dump_tailq_empty_p (&dump_queue->one_weight_strong_objects)
+              || !dump_tailq_empty_p (&dump_queue->fancy_weight_objects));
+    }
+  else
+    {
+      /* If we're empty, we can still have a few stragglers on one of
+         the above queues.  */
+    }
+
+  return is_empty;
+}
+
+static void
+dump_queue_push_weight (Lisp_Object *weight_list,
+                        dump_off basis,
+                        struct link_weight weight)
+{
+  if (EQ (*weight_list, Qt))
+    *weight_list = Qnil;
+  dump_push (weight_list, Fcons (dump_off_to_lisp (basis),
+                                 dump_off_to_lisp (weight.value)));
+}
+
+static void
+dump_queue_enqueue (struct dump_queue *dump_queue,
+                    Lisp_Object object,
+                    dump_off basis,
+                    struct link_weight weight)
+{
+  Lisp_Object weights = Fgethash (object, dump_queue->link_weights, Qnil);
+  Lisp_Object orig_weights = weights;
+  /* N.B. want to find the last item of a given weight in each queue
+     due to prepend use.  */
+  bool use_single_queues = true;
+  if (NILP (weights))
+    {
+      /* Object is new.  */
+      dump_trace ("new object %016x weight=%u\n",
+                  (unsigned) XLI (object),
+                  (unsigned) weight.value);
+
+      if (weight.value == WEIGHT_NONE.value)
+        {
+          eassert (weight.value == 0);
+          dump_tailq_prepend (&dump_queue->zero_weight_objects, object);
+          weights = Qt;
+        }
+      else if (!use_single_queues)
+        {
+          dump_tailq_prepend (&dump_queue->fancy_weight_objects, object);
+          dump_queue_push_weight (&weights, basis, weight);
+        }
+      else if (weight.value == WEIGHT_NORMAL.value)
+        {
+          dump_tailq_prepend (&dump_queue->one_weight_normal_objects, object);
+          dump_queue_push_weight (&weights, basis, weight);
+        }
+      else if (weight.value == WEIGHT_STRONG.value)
+        {
+          dump_tailq_prepend (&dump_queue->one_weight_strong_objects, object);
+          dump_queue_push_weight (&weights, basis, weight);
+        }
+      else
+        {
+          emacs_abort ();
+        }
+
+      Fputhash (object,
+                dump_off_to_lisp(dump_queue->next_sequence_number++),
+                dump_queue->sequence_numbers);
+    }
+  else
+    {
+      /* Object was already on the queue.  It's okay for an object to
+         be on multiple queues so long as we maintain order
+         invariants: attempting to dump an object multiple times is
+         harmless, and most of the time, an object is only referenced
+         once before being dumped, making this code path uncommon.  */
+      if (weight.value != WEIGHT_NONE.value)
+        {
+          if (EQ (weights, Qt))
+            {
+              /* Object previously had a zero weight.  Once we
+                 incorporate the link weight attached to this call,
+                 the object will have a single weight.  Put the object
+                 on the appropriate single-weight queue.  */
+              weights = Qnil;
+             struct dump_tailq *tailq;
+              if (!use_single_queues)
+               tailq = &dump_queue->fancy_weight_objects;
+              else if (weight.value == WEIGHT_NORMAL.value)
+               tailq = &dump_queue->one_weight_normal_objects;
+              else if (weight.value == WEIGHT_STRONG.value)
+               tailq = &dump_queue->one_weight_strong_objects;
+              else
+                emacs_abort ();
+             dump_tailq_prepend (tailq, object);
+            }
+          else if (use_single_queues && NILP (XCDR (weights)))
+            dump_tailq_prepend (&dump_queue->fancy_weight_objects, object);
+          dump_queue_push_weight (&weights, basis, weight);
+        }
+    }
+
+  if (!EQ (weights, orig_weights))
+    Fputhash (object, weights, dump_queue->link_weights);
+}
+
+static float
+dump_calc_link_score (dump_off basis,
+                      dump_off link_basis,
+                      dump_off link_weight)
+{
+  float distance = (float)(basis - link_basis);
+  eassert (distance >= 0);
+  float link_score = powf (distance, -0.2f);
+  return powf (link_score, (float) link_weight / 1000.0f);
+}
+
+/* Compute the score score for a queued object.
+
+   OBJECT is the object to query, which must currently be queued for
+   dumping.  BASIS is the offset at which we would be
+   dumping the object; score is computed relative to BASIS and the
+   various BASIS values supplied to dump_add_link_weight --- the
+   further an object is from its referrers, the greater the
+   score.  */
+static float
+dump_queue_compute_score (struct dump_queue *dump_queue,
+                          Lisp_Object object,
+                          dump_off basis)
+{
+  float score = 0;
+  Lisp_Object object_link_weights =
+    Fgethash (object, dump_queue->link_weights, Qnil);
+  if (EQ (object_link_weights, Qt))
+    object_link_weights = Qnil;
+  while (!NILP (object_link_weights))
+    {
+      Lisp_Object basis_weight_pair = dump_pop (&object_link_weights);
+      dump_off link_basis = dump_off_from_lisp (XCAR (basis_weight_pair));
+      dump_off link_weight = dump_off_from_lisp (XCDR (basis_weight_pair));
+      score += dump_calc_link_score (basis, link_basis, link_weight);
+    }
+  return score;
+}
+
+/* Scan the fancy part of the dump queue.
+
+   BASIS is the position at which to evaluate the score function,
+   usually ctx->offset.
+
+   If we have at least one entry in the queue, return the pointer (in
+   the singly-linked list) to the cons containing the object via
+   *OUT_HIGHEST_SCORE_CONS_PTR and return its score.
+
+   If the queue is empty, set *OUT_HIGHEST_SCORE_CONS_PTR to NULL
+   and return negative infinity.  */
+static float
+dump_queue_scan_fancy (struct dump_queue *dump_queue,
+                       dump_off basis,
+                       Lisp_Object **out_highest_score_cons_ptr)
+{
+  Lisp_Object *cons_ptr = &dump_queue->fancy_weight_objects.head;
+  Lisp_Object *highest_score_cons_ptr = NULL;
+  float highest_score = -INFINITY;
+  bool first = true;
+
+  while (!NILP (*cons_ptr))
+    {
+      Lisp_Object queued_object = XCAR (*cons_ptr);
+      float score = dump_queue_compute_score (dump_queue, queued_object, 
basis);
+      if (first || score >= highest_score)
+        {
+          highest_score_cons_ptr = cons_ptr;
+          highest_score = score;
+          if (first)
+            first = false;
+        }
+      cons_ptr = &XCONS (*cons_ptr)->u.s.u.cdr;
+    }
+
+  *out_highest_score_cons_ptr = highest_score_cons_ptr;
+  return highest_score;
+}
+
+/* Return the sequence number of OBJECT.
+
+   Return -1 if object doesn't have a sequence number.  This situation
+   can occur when we've double-queued an object.  If this happens, we
+   discard the errant object and try again.  */
+static dump_off
+dump_queue_sequence (struct dump_queue *dump_queue,
+                     Lisp_Object object)
+{
+  Lisp_Object n = Fgethash (object, dump_queue->sequence_numbers, Qnil);
+  return NILP (n) ? -1 : dump_off_from_lisp (n);
+}
+
+/* Find score and sequence at head of a one-weight object queue.
+
+   Transparently discard stale objects from head of queue.  BASIS
+   is the baseness for score computation.
+
+   We organize these queues so that score is strictly decreasing, so
+   examining the head is sufficient.  */
+static void
+dump_queue_find_score_of_one_weight_queue (struct dump_queue *dump_queue,
+                                          dump_off basis,
+                                          struct dump_tailq *one_weight_queue,
+                                          float *out_score,
+                                          int *out_sequence)
+{
+  /* Transparently discard stale objects from the head of this queue.  */
+  do
+    {
+      if (dump_tailq_empty_p (one_weight_queue))
+        {
+          *out_score = -INFINITY;
+          *out_sequence = 0;
+        }
+      else
+        {
+          Lisp_Object head = dump_tailq_peek (one_weight_queue);
+          *out_sequence = dump_queue_sequence (dump_queue, head);
+          if (*out_sequence < 0)
+            dump_tailq_pop (one_weight_queue);
+          else
+            *out_score =
+              dump_queue_compute_score (dump_queue, head, basis);
+        }
+    }
+  while (*out_sequence < 0);
+}
+
+/* Pop the next object to dump from the dump queue.
+
+   BASIS is the dump offset at which to evaluate score.
+
+   The object returned is the queued object with the greatest score;
+   by side effect, the object is removed from the dump queue.
+   The dump queue must not be empty.  */
+static Lisp_Object
+dump_queue_dequeue (struct dump_queue *dump_queue, dump_off basis)
+{
+  eassert (EQ (Fhash_table_count (dump_queue->sequence_numbers),
+               Fhash_table_count (dump_queue->link_weights)));
+
+  eassert (XFIXNUM (Fhash_table_count (dump_queue->sequence_numbers))
+          <= (dump_tailq_length (&dump_queue->fancy_weight_objects)
+              + dump_tailq_length (&dump_queue->zero_weight_objects)
+              + dump_tailq_length (&dump_queue->one_weight_normal_objects)
+              + dump_tailq_length (&dump_queue->one_weight_strong_objects)));
+
+  bool dump_object_counts = true;
+  if (dump_object_counts)
+    dump_trace
+      ("dump_queue_dequeue basis=%d fancy=%u zero=%u "
+       "normal=%u strong=%u hash=%u\n",
+       basis,
+       (unsigned) dump_tailq_length (&dump_queue->fancy_weight_objects),
+       (unsigned) dump_tailq_length (&dump_queue->zero_weight_objects),
+       (unsigned) dump_tailq_length (&dump_queue->one_weight_normal_objects),
+       (unsigned) dump_tailq_length (&dump_queue->one_weight_strong_objects),
+       (unsigned) XFIXNUM (Fhash_table_count (dump_queue->link_weights)));
+
+  static const int nr_candidates = 3;
+  struct candidate
+  {
+    float score;
+    dump_off sequence;
+  } candidates[nr_candidates];
+
+  Lisp_Object *fancy_cons = NULL;
+  candidates[0].sequence = 0;
+  do
+    {
+      if (candidates[0].sequence < 0)
+        *fancy_cons = XCDR (*fancy_cons);  /* Discard stale object.  */
+      candidates[0].score = dump_queue_scan_fancy (dump_queue, basis,
+                                                  &fancy_cons);
+      candidates[0].sequence =
+        candidates[0].score > -INFINITY
+        ? dump_queue_sequence (dump_queue, XCAR (*fancy_cons))
+        : 0;
+    }
+  while (candidates[0].sequence < 0);
+
+  dump_queue_find_score_of_one_weight_queue
+    (dump_queue, basis,
+     &dump_queue->one_weight_normal_objects,
+     &candidates[1].score,
+     &candidates[1].sequence);
+
+  dump_queue_find_score_of_one_weight_queue
+    (dump_queue, basis,
+     &dump_queue->one_weight_strong_objects,
+     &candidates[2].score,
+     &candidates[2].sequence);
+
+  int best = -1;
+  for (int i = 0; i < nr_candidates; ++i)
+    {
+      eassert (candidates[i].sequence >= 0);
+      if (candidates[i].score > -INFINITY
+         && (best < 0
+             || candidates[i].score > candidates[best].score
+             || (candidates[i].score == candidates[best].score
+                 && candidates[i].sequence < candidates[best].sequence)))
+        best = i;
+    }
+
+  Lisp_Object result;
+  const char *src;
+  if (best < 0)
+    {
+      src = "zero";
+      result = dump_tailq_pop (&dump_queue->zero_weight_objects);
+    }
+  else if (best == 0)
+    {
+      src = "fancy";
+      result = dump_tailq_pop (&dump_queue->fancy_weight_objects);
+    }
+  else if (best == 1)
+    {
+      src = "normal";
+      result = dump_tailq_pop (&dump_queue->one_weight_normal_objects);
+    }
+  else if (best == 2)
+    {
+      src = "strong";
+      result = dump_tailq_pop (&dump_queue->one_weight_strong_objects);
+    }
+  else
+    emacs_abort ();
+
+  dump_trace ("  result score=%f src=%s object=%016x\n",
+              best < 0 ? -1.0 : (double) candidates[best].score,
+              src,
+              (unsigned) XLI (result));
+
+  {
+    Lisp_Object weights = Fgethash (result, dump_queue->link_weights, Qnil);
+    while (!NILP (weights) && CONSP (weights))
+      {
+        Lisp_Object basis_weight_pair = dump_pop (&weights);
+        dump_off link_basis =
+          dump_off_from_lisp (XCAR (basis_weight_pair));
+        dump_off link_weight =
+          dump_off_from_lisp (XCDR (basis_weight_pair));
+       dump_trace
+         ("    link_basis=%d distance=%d weight=%d contrib=%f\n",
+          link_basis,
+          basis - link_basis,
+          link_weight,
+          (double) dump_calc_link_score (basis, link_basis, link_weight));
+      }
+  }
+
+  Fremhash (result, dump_queue->link_weights);
+  Fremhash (result, dump_queue->sequence_numbers);
+  return result;
+}
+
+/* Return whether we need to write OBJECT to the dump file.  */
+static bool
+dump_object_needs_dumping_p (Lisp_Object object)
+{
+  /* Some objects, like symbols, are self-representing because they
+     have invariant bit patterns, but sometimes these objects have
+     associated data too, and these data-carrying objects need to be
+     included in the dump despite all references to them being
+     bitwise-invariant.  */
+  return (!dump_object_self_representing_p (object)
+         || dump_object_emacs_ptr (object));
+}
+
+static void
+dump_enqueue_object (struct dump_context *ctx,
+                     Lisp_Object object,
+                     struct link_weight weight)
+{
+  if (dump_object_needs_dumping_p (object))
+    {
+      dump_off state = dump_recall_object (ctx, object);
+      bool already_dumped_object = state > DUMP_OBJECT_NOT_SEEN;
+      if (ctx->flags.assert_already_seen)
+        eassert (already_dumped_object);
+      if (!already_dumped_object)
+        {
+          if (state == DUMP_OBJECT_NOT_SEEN)
+            {
+              state = DUMP_OBJECT_ON_NORMAL_QUEUE;
+              dump_remember_object (ctx, object, state);
+            }
+          /* Note that we call dump_queue_enqueue even if the object
+             is already on the normal queue: multiple enqueue calls
+             can increase the object's weight.  */
+          if (state == DUMP_OBJECT_ON_NORMAL_QUEUE)
+            dump_queue_enqueue (&ctx->dump_queue,
+                                object,
+                                ctx->offset,
+                                weight);
+        }
+    }
+  /* Always remember the path to this object.  */
+  dump_note_reachable (ctx, object);
+}
+
+static void
+print_paths_to_root_1 (struct dump_context *ctx,
+                       Lisp_Object object,
+                       int level)
+{
+  Lisp_Object referrers = Fgethash (object, ctx->referrers, Qnil);
+  while (!NILP (referrers))
+    {
+      Lisp_Object referrer = XCAR (referrers);
+      referrers = XCDR (referrers);
+      Lisp_Object repr = Fprin1_to_string (referrer, Qnil);
+      for (int i = 0; i < level; ++i)
+        fputc (' ', stderr);
+      fprintf (stderr, "%s\n", SDATA (repr));
+      print_paths_to_root_1 (ctx, referrer, level + 1);
+    }
+}
+
+static void
+print_paths_to_root (struct dump_context *ctx, Lisp_Object object)
+{
+  print_paths_to_root_1 (ctx, object, 0);
+}
+
+static void
+dump_remember_cold_op (struct dump_context *ctx,
+                       enum cold_op op,
+                       Lisp_Object arg)
+{
+  if (ctx->flags.dump_object_contents)
+    dump_push (&ctx->cold_queue, Fcons (make_fixnum (op), arg));
+}
+
+/* Add a dump relocation that points into Emacs.
+
+   Add a relocation that updates the pointer stored at DUMP_OFFSET to
+   point into the Emacs binary upon dump load.  The pointer-sized
+   value at DUMP_OFFSET in the dump file should contain a number
+   relative to emacs_basis().  */
+static void
+dump_reloc_dump_to_emacs_ptr_raw (struct dump_context *ctx,
+                                  dump_off dump_offset)
+{
+  if (ctx->flags.dump_object_contents)
+    dump_push (&ctx->dump_relocs,
+               list2 (make_fixnum (RELOC_DUMP_TO_EMACS_PTR_RAW),
+                      dump_off_to_lisp (dump_offset)));
+}
+
+/* Add a dump relocation that points a Lisp_Object back at the dump.
+
+   Add a relocation that updates the Lisp_Object at DUMP_OFFSET in the
+   dump to point to another object in the dump.  The Lisp_Object-sized
+   value at DUMP_OFFSET in the dump file should contain the offset of
+   the target object relative to the start of the dump.  */
+static void
+dump_reloc_dump_to_dump_lv (struct dump_context *ctx,
+                            dump_off dump_offset,
+                            enum Lisp_Type type)
+{
+  if (!ctx->flags.dump_object_contents)
+    return;
+
+  int reloc_type;
+  switch (type)
+    {
+    case Lisp_Symbol:
+    case Lisp_String:
+    case Lisp_Vectorlike:
+    case Lisp_Cons:
+    case Lisp_Float:
+      reloc_type = RELOC_DUMP_TO_DUMP_LV + type;
+      break;
+    default:
+      emacs_abort ();
+    }
+
+  dump_push (&ctx->dump_relocs,
+             list2 (make_fixnum (reloc_type),
+                    dump_off_to_lisp (dump_offset)));
+}
+
+/* Add a dump relocation that points a raw pointer back at the dump.
+
+   Add a relocation that updates the raw pointer at DUMP_OFFSET in the
+   dump to point to another object in the dump.  The pointer-sized
+   value at DUMP_OFFSET in the dump file should contain the offset of
+   the target object relative to the start of the dump.  */
+static void
+dump_reloc_dump_to_dump_ptr_raw (struct dump_context *ctx,
+                                 dump_off dump_offset)
+{
+  if (ctx->flags.dump_object_contents)
+    dump_push (&ctx->dump_relocs,
+               list2 (make_fixnum (RELOC_DUMP_TO_DUMP_PTR_RAW),
+                      dump_off_to_lisp (dump_offset)));
+}
+
+/* Add a dump relocation that points to a Lisp object in Emacs.
+
+   Add a relocation that updates the Lisp_Object at DUMP_OFFSET in the
+   dump to point to a lisp object in Emacs.  The Lisp_Object-sized
+   value at DUMP_OFFSET in the dump file should contain the offset of
+   the target object relative to emacs_basis().  TYPE is the type of
+   Lisp value.  */
+static void
+dump_reloc_dump_to_emacs_lv (struct dump_context *ctx,
+                             dump_off dump_offset,
+                             enum Lisp_Type type)
+{
+  if (!ctx->flags.dump_object_contents)
+    return;
+
+  int reloc_type;
+  switch (type)
+    {
+    case Lisp_String:
+    case Lisp_Vectorlike:
+    case Lisp_Cons:
+    case Lisp_Float:
+      reloc_type = RELOC_DUMP_TO_EMACS_LV + type;
+      break;
+    default:
+      emacs_abort ();
+    }
+
+  dump_push (&ctx->dump_relocs,
+             list2 (make_fixnum (reloc_type),
+                    dump_off_to_lisp (dump_offset)));
+}
+
+/* Add an Emacs relocation that copies arbitrary bytes from the dump.
+
+   When the dump is loaded, Emacs copies SIZE bytes from OFFSET in
+   dump to LOCATION in the Emacs data section.  This copying happens
+   after other relocations, so it's all right to, say, copy a
+   Lisp_Object (since by the time we copy the Lisp_Object, it'll have
+   been adjusted to account for the location of the running Emacs and
+   dump file).  */
+static void
+dump_emacs_reloc_copy_from_dump (struct dump_context *ctx, dump_off 
dump_offset,
+                                void *emacs_ptr, dump_off size)
+{
+  eassert (size >= 0);
+  eassert (size < (1 << EMACS_RELOC_LENGTH_BITS));
+
+  if (!ctx->flags.dump_object_contents)
+    return;
+
+  if (size == 0)
+    return;
+
+  eassert (dump_offset >= 0);
+  dump_push (&ctx->emacs_relocs,
+             list4 (make_fixnum (RELOC_EMACS_COPY_FROM_DUMP),
+                    dump_off_to_lisp (emacs_offset (emacs_ptr)),
+                    dump_off_to_lisp (dump_offset),
+                    dump_off_to_lisp (size)));
+}
+
+/* Add an Emacs relocation that sets values to arbitrary bytes.
+
+   When the dump is loaded, Emacs copies SIZE bytes from the
+   relocation itself to the adjusted location inside Emacs EMACS_PTR.
+   SIZE is the number of bytes to copy.  See struct emacs_reloc for
+   the maximum size that this mechanism can support.  The value comes
+   from VALUE_PTR.
+ */
+static void
+dump_emacs_reloc_immediate (struct dump_context *ctx,
+                            const void *emacs_ptr,
+                            const void *value_ptr,
+                            dump_off size)
+{
+  if (!ctx->flags.dump_object_contents)
+    return;
+
+  intmax_t value = 0;
+  eassert (size <= sizeof (value));
+  memcpy (&value, value_ptr, size);
+  dump_push (&ctx->emacs_relocs,
+             list4 (make_fixnum (RELOC_EMACS_IMMEDIATE),
+                    dump_off_to_lisp (emacs_offset (emacs_ptr)),
+                    intmax_t_to_lisp (value),
+                    dump_off_to_lisp (size)));
+}
+
+#define DEFINE_EMACS_IMMEDIATE_FN(fnname, type)                         \
+  static void                                                           \
+  fnname (struct dump_context *ctx,                                     \
+          const type *emacs_ptr,                                        \
+          type value)                                                   \
+  {                                                                     \
+    dump_emacs_reloc_immediate (                                        \
+      ctx, emacs_ptr, &value, sizeof (value));                          \
+  }
+
+DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_lv, Lisp_Object);
+DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_ptrdiff_t, ptrdiff_t);
+DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_intmax_t, intmax_t);
+DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_int, int);
+DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_bool, bool);
+
+/* Add an emacs relocation that makes a raw pointer in Emacs point
+   into the dump.  */
+static void
+dump_emacs_reloc_to_dump_ptr_raw (struct dump_context *ctx,
+                                 const void *emacs_ptr, dump_off dump_offset)
+{
+  if (!ctx->flags.dump_object_contents)
+    return;
+
+  dump_push (&ctx->emacs_relocs,
+             list3 (make_fixnum (RELOC_EMACS_DUMP_PTR_RAW),
+                    dump_off_to_lisp (emacs_offset (emacs_ptr)),
+                    dump_off_to_lisp (dump_offset)));
+}
+
+/* Add an emacs relocation that points into the dump.
+
+   When the dump is loaded, the Lisp_Object at EMACS_ROOT in Emacs to
+   point to VALUE.  VALUE can be any Lisp value; this function
+   automatically queues the value for dumping if necessary.  */
+static void
+dump_emacs_reloc_to_lv (struct dump_context *ctx,
+                       Lisp_Object const *emacs_ptr,
+                        Lisp_Object value)
+{
+  if (dump_object_self_representing_p (value))
+    dump_emacs_reloc_immediate_lv (ctx, emacs_ptr, value);
+  else
+    {
+      if (ctx->flags.dump_object_contents)
+        /* Conditionally use RELOC_EMACS_EMACS_LV or
+           RELOC_EMACS_DUMP_LV depending on where the target object
+           lives.  We could just have decode_emacs_reloc pick the
+           right type, but we might as well maintain the invariant
+           that the types on ctx->emacs_relocs correspond to the types
+           of emacs_relocs we actually emit.  */
+       dump_push (&ctx->emacs_relocs,
+                  list3 (make_fixnum (dump_object_emacs_ptr (value)
+                                      ? RELOC_EMACS_EMACS_LV
+                                      : RELOC_EMACS_DUMP_LV),
+                         dump_off_to_lisp (emacs_offset (emacs_ptr)),
+                         value));
+      dump_enqueue_object (ctx, value, WEIGHT_NONE);
+    }
+}
+
+/* Add an emacs relocation that makes a raw pointer in Emacs point
+   back into the Emacs image.  */
+static void
+dump_emacs_reloc_to_emacs_ptr_raw (struct dump_context *ctx, void *emacs_ptr,
+                                  void const *target_emacs_ptr)
+{
+  if (!ctx->flags.dump_object_contents)
+    return;
+
+  dump_push (&ctx->emacs_relocs,
+             list3 (make_fixnum (RELOC_EMACS_EMACS_PTR_RAW),
+                    dump_off_to_lisp (emacs_offset (emacs_ptr)),
+                    dump_off_to_lisp (emacs_offset (target_emacs_ptr))));
+}
+
+/* Add an Emacs relocation that makes a raw pointer in Emacs point to
+   a different part of Emacs.  */
+
+enum dump_fixup_type
+  {
+    DUMP_FIXUP_LISP_OBJECT,
+    DUMP_FIXUP_LISP_OBJECT_RAW,
+    DUMP_FIXUP_PTR_DUMP_RAW,
+    DUMP_FIXUP_BIGNUM_DATA,
+  };
+
+enum dump_lv_fixup_type
+  {
+    LV_FIXUP_LISP_OBJECT,
+    LV_FIXUP_RAW_POINTER,
+  };
+
+/* Make something in the dump point to a lisp object.
+
+   CTX is a dump context.  DUMP_OFFSET is the location in the dump to
+   fix.  VALUE is the object to which the location in the dump
+   should point.
+
+   If FIXUP_SUBTYPE is LV_FIXUP_LISP_OBJECT, we expect a Lisp_Object
+   at DUMP_OFFSET.  If it's LV_FIXUP_RAW_POINTER, we expect a pointer.
+ */
+static void
+dump_remember_fixup_lv (struct dump_context *ctx,
+                        dump_off dump_offset,
+                        Lisp_Object value,
+                        enum dump_lv_fixup_type fixup_subtype)
+{
+  if (!ctx->flags.dump_object_contents)
+    return;
+
+  dump_push (&ctx->fixups,
+            list3 (make_fixnum (fixup_subtype == LV_FIXUP_LISP_OBJECT
+                                ? DUMP_FIXUP_LISP_OBJECT
+                                : DUMP_FIXUP_LISP_OBJECT_RAW),
+                   dump_off_to_lisp (dump_offset),
+                   value));
+}
+
+/* Remember to fix up the dump file such that the pointer-sized value
+   at DUMP_OFFSET points to NEW_DUMP_OFFSET in the dump file and to
+   its absolute address at runtime.  */
+static void
+dump_remember_fixup_ptr_raw (struct dump_context *ctx,
+                             dump_off dump_offset,
+                             dump_off new_dump_offset)
+{
+  if (!ctx->flags.dump_object_contents)
+    return;
+
+  /* We should not be generating relocations into the
+     to-be-copied-into-Emacs dump region.  */
+  eassert (ctx->header.discardable_start == 0
+          || new_dump_offset < ctx->header.discardable_start
+          || (ctx->header.cold_start != 0
+              && new_dump_offset >= ctx->header.cold_start));
+
+  dump_push (&ctx->fixups,
+            list3 (make_fixnum (DUMP_FIXUP_PTR_DUMP_RAW),
+                   dump_off_to_lisp (dump_offset),
+                   dump_off_to_lisp (new_dump_offset)));
+}
+
+static void
+dump_root_visitor (Lisp_Object const *root_ptr, enum gc_root_type type,
+                  void *data)
+{
+  struct dump_context *ctx = data;
+  Lisp_Object value = *root_ptr;
+  if (type == GC_ROOT_C_SYMBOL)
+    {
+      eassert (dump_builtin_symbol_p (value));
+      /* Remember to dump the object itself later along with all the
+         rest of the copied-to-Emacs objects.  */
+      DUMP_SET_REFERRER (ctx, build_string ("built-in symbol list"));
+      dump_enqueue_object (ctx, value, WEIGHT_NONE);
+      DUMP_CLEAR_REFERRER (ctx);
+    }
+  else
+    {
+      if (type == GC_ROOT_STATICPRO)
+        Fputhash (dump_off_to_lisp (emacs_offset (root_ptr)),
+                  Qt,
+                  ctx->staticpro_table);
+      if (root_ptr != &Vinternal_interpreter_environment)
+        {
+          DUMP_SET_REFERRER (ctx, dump_ptr_referrer ("emacs root", root_ptr));
+          dump_emacs_reloc_to_lv (ctx, root_ptr, *root_ptr);
+          DUMP_CLEAR_REFERRER (ctx);
+        }
+    }
+}
+
+/* Kick off the dump process by queuing up the static GC roots.  */
+static void
+dump_roots (struct dump_context *ctx)
+{
+  struct gc_root_visitor visitor = { .visit = dump_root_visitor,
+                                    .data = ctx };
+  visit_static_gc_roots (visitor);
+}
+
+static dump_off
+field_relpos (const void *in_start, const void *in_field)
+{
+  ptrdiff_t in_start_val = (ptrdiff_t) in_start;
+  ptrdiff_t in_field_val = (ptrdiff_t) in_field;
+  eassert (in_start_val <= in_field_val);
+  ptrdiff_t relpos = in_field_val - in_start_val;
+  eassert (relpos < 1024); /* Sanity check.  */
+  return (dump_off) relpos;
+}
+
+static void
+cpyptr (void *out, const void *in)
+{
+  memcpy (out, in, sizeof (void *));
+}
+
+/* Convenience macro for regular assignment.  */
+#define DUMP_FIELD_COPY(out, in, name) \
+  do                                   \
+    {                                  \
+      (out)->name = (in)->name;        \
+    }                                  \
+  while (0)
+
+static void
+dump_field_lv_or_rawptr (struct dump_context *ctx,
+                         void *out,
+                         const void *in_start,
+                         const void *in_field,
+                         /* opt */ const enum Lisp_Type *ptr_raw_type,
+                         struct link_weight weight)
+{
+  eassert (ctx->obj_offset > 0);
+
+  Lisp_Object value;
+  dump_off relpos = field_relpos (in_start, in_field);
+  void *out_field = (char *) out + relpos;
+  bool is_ptr_raw = (ptr_raw_type != NULL);
+
+  if (!is_ptr_raw)
+    {
+      memcpy (&value, in_field, sizeof (value));
+      if (dump_object_self_representing_p (value))
+        {
+          memcpy (out_field, &value, sizeof (value));
+          return;
+        }
+    }
+  else
+    {
+      void *ptrval;
+      cpyptr (&ptrval, in_field);
+      if (ptrval == NULL)
+        return; /* Nothing to do.  */
+      switch (*ptr_raw_type)
+        {
+        case Lisp_Symbol:
+          value = make_lisp_symbol (ptrval);
+          break;
+        case Lisp_String:
+        case Lisp_Vectorlike:
+        case Lisp_Cons:
+        case Lisp_Float:
+          value = make_lisp_ptr (ptrval, *ptr_raw_type);
+          break;
+        default:
+          emacs_abort ();
+        }
+    }
+
+  /* Now value is the Lisp_Object to which we want to point whether or
+     not the field is a raw pointer (in which case we just synthesized
+     the Lisp_Object outselves) or a Lisp_Object (in which case we
+     just copied the thing).  Add a fixup or relocation.  */
+
+  intptr_t out_value;
+  dump_off out_field_offset = ctx->obj_offset + relpos;
+  dump_off target_offset = dump_recall_object (ctx, value);
+  if (DANGEROUS
+      && target_offset > 0 && dump_object_emacs_ptr (value) == NULL)
+    {
+      /* We've already dumped the referenced object, so we can emit
+         the value and a relocation directly instead of indirecting
+         through a fixup.  */
+      out_value = target_offset;
+      if (is_ptr_raw)
+        dump_reloc_dump_to_dump_ptr_raw (ctx, out_field_offset);
+      else
+        dump_reloc_dump_to_dump_lv (ctx, out_field_offset, XTYPE (value));
+    }
+  else
+    {
+      /* We don't know about the target object yet, so add a fixup.
+         When we process the fixup, we'll have dumped the target
+         object.  */
+      out_value = (intptr_t) 0xDEADF00D;
+      dump_remember_fixup_lv (ctx,
+                              out_field_offset,
+                              value,
+                              ( is_ptr_raw
+                                ? LV_FIXUP_RAW_POINTER
+                                : LV_FIXUP_LISP_OBJECT ));
+      dump_enqueue_object (ctx, value, weight);
+    }
+
+  memcpy (out_field, &out_value, sizeof (out_value));
+}
+
+/* Set a pointer field on an output object during dump.
+
+   CTX is the dump context.  OFFSET is the offset at which the current
+   object starts.  OUT is a pointer to the dump output object.
+   IN_START is the start of the current Emacs object.  IN_FIELD is a
+   pointer to the field in that object.  TYPE is the type of pointer
+   to which IN_FIELD points.
+ */
+static void
+dump_field_lv_rawptr (struct dump_context *ctx,
+                      void *out,
+                      const void *in_start,
+                      const void *in_field,
+                      enum Lisp_Type type,
+                      struct link_weight weight)
+{
+  dump_field_lv_or_rawptr (ctx, out, in_start, in_field, &type, weight);
+}
+
+/* Set a Lisp_Object field on an output object during dump.
+
+   CTX is a dump context.  OFFSET is the offset at which the current
+   object starts.  OUT is a pointer to the dump output object.
+   IN_START is the start of the current Emacs object.  IN_FIELD is a
+   pointer to a Lisp_Object field in that object.
+
+   Arrange for the dump to contain fixups and relocations such that,
+   at load time, the given field of the output object contains a valid
+   Lisp_Object pointing to the same notional object that *IN_FIELD
+   contains now.
+
+   See idomatic usage below.  */
+static void
+dump_field_lv (struct dump_context *ctx,
+               void *out,
+               const void *in_start,
+               const Lisp_Object *in_field,
+               struct link_weight weight)
+{
+  dump_field_lv_or_rawptr (ctx, out, in_start, in_field, NULL, weight);
+}
+
+/* Note that we're going to add a manual fixup for the given field
+   later.  */
+static void
+dump_field_fixup_later (struct dump_context *ctx,
+                        void *out,
+                        const void *in_start,
+                        const void *in_field)
+{
+  /* TODO: more error checking.  */
+  (void) field_relpos (in_start, in_field);
+}
+
+/* Mark an output object field, which is as wide as a poiner, as being
+   fixed up to point to a specific offset in the dump.  */
+static void
+dump_field_ptr_to_dump_offset (struct dump_context *ctx,
+                               void *out,
+                               const void *in_start,
+                               const void *in_field,
+                               dump_off target_dump_offset)
+{
+  eassert (ctx->obj_offset > 0);
+  if (!ctx->flags.dump_object_contents)
+    return;
+
+  dump_off relpos = field_relpos (in_start, in_field);
+  dump_reloc_dump_to_dump_ptr_raw (ctx, ctx->obj_offset + relpos);
+  intptr_t outval = target_dump_offset;
+  memcpy ((char *) out + relpos, &outval, sizeof (outval));
+}
+
+/* Mark a field as pointing to a place inside Emacs.
+
+   CTX is the dump context.  OUT points to the out-object for the
+   current dump function.  IN_START points to the start of the object
+   being dumped.  IN_FIELD points to the field inside the object being
+   dumped that we're dumping.  The contents of this field (which
+   should be as wide as a pointer) are the Emacs pointer to dump.
+
+ */
+static void
+dump_field_emacs_ptr (struct dump_context *ctx,
+                      void *out,
+                      const void *in_start,
+                      const void *in_field)
+{
+  eassert (ctx->obj_offset > 0);
+  if (!ctx->flags.dump_object_contents)
+    return;
+
+  dump_off relpos = field_relpos (in_start, in_field);
+  void *abs_emacs_ptr;
+  cpyptr (&abs_emacs_ptr, in_field);
+  intptr_t rel_emacs_ptr = 0;
+  if (abs_emacs_ptr)
+    {
+      rel_emacs_ptr = emacs_offset ((void *)abs_emacs_ptr);
+      dump_reloc_dump_to_emacs_ptr_raw (ctx, ctx->obj_offset + relpos);
+    }
+  cpyptr ((char *) out + relpos, &rel_emacs_ptr);
+}
+
+static void
+_dump_object_start_pseudovector (struct dump_context *ctx,
+                                union vectorlike_header *out_hdr,
+                                const union vectorlike_header *in_hdr)
+{
+  eassert (in_hdr->size & PSEUDOVECTOR_FLAG);
+  ptrdiff_t vec_size = vectorlike_nbytes (in_hdr);
+  dump_object_start (ctx, out_hdr, (dump_off) vec_size);
+  *out_hdr = *in_hdr;
+}
+
+/* Need a macro for alloca.  */
+#define START_DUMP_PVEC(ctx, hdr, type, out)                  \
+  const union vectorlike_header *_in_hdr = (hdr);             \
+  type *out = alloca (vectorlike_nbytes (_in_hdr));           \
+  _dump_object_start_pseudovector (ctx, &out->header, _in_hdr)
+
+static dump_off
+finish_dump_pvec (struct dump_context *ctx,
+                  union vectorlike_header *out_hdr)
+{
+  ALLOW_IMPLICIT_CONVERSION;
+  return dump_object_finish (ctx, out_hdr, vectorlike_nbytes (out_hdr));
+  DISALLOW_IMPLICIT_CONVERSION;
+}
+
+static void
+dump_pseudovector_lisp_fields (struct dump_context *ctx,
+                              union vectorlike_header *out_hdr,
+                              const union vectorlike_header *in_hdr)
+{
+  const struct Lisp_Vector *in = (const struct Lisp_Vector *) in_hdr;
+  struct Lisp_Vector *out = (struct Lisp_Vector *) out_hdr;
+  ptrdiff_t size = in->header.size;
+  eassert (size & PSEUDOVECTOR_FLAG);
+  size &= PSEUDOVECTOR_SIZE_MASK;
+  for (ptrdiff_t i = 0; i < size; ++i)
+    dump_field_lv (ctx, out, in, &in->contents[i], WEIGHT_STRONG);
+}
+
+static dump_off
+dump_cons (struct dump_context *ctx, const struct Lisp_Cons *cons)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Cons_00EEE63F67)
+# error "Lisp_Cons changed. See CHECK_STRUCTS comment."
+#endif
+  struct Lisp_Cons out;
+  dump_object_start (ctx, &out, sizeof (out));
+  dump_field_lv (ctx, &out, cons, &cons->u.s.car, WEIGHT_STRONG);
+  dump_field_lv (ctx, &out, cons, &cons->u.s.u.cdr, WEIGHT_NORMAL);
+  return dump_object_finish (ctx, &out, sizeof (out));
+}
+
+static dump_off
+dump_interval_tree (struct dump_context *ctx,
+                    INTERVAL tree,
+                    dump_off parent_offset)
+{
+#if CHECK_STRUCTS && !defined (HASH_interval_1B38941C37)
+# error "interval changed. See CHECK_STRUCTS comment."
+#endif
+  /* TODO: output tree breadth-first?  */
+  struct interval out;
+  dump_object_start (ctx, &out, sizeof (out));
+  DUMP_FIELD_COPY (&out, tree, total_length);
+  DUMP_FIELD_COPY (&out, tree, position);
+  if (tree->left)
+    dump_field_fixup_later (ctx, &out, tree, &tree->left);
+  if (tree->right)
+    dump_field_fixup_later (ctx, &out, tree, &tree->right);
+  if (!tree->up_obj)
+    {
+      eassert (parent_offset != 0);
+      dump_field_ptr_to_dump_offset (ctx, &out, tree, &tree->up.interval,
+                                    parent_offset);
+    }
+  else
+    dump_field_lv (ctx, &out, tree, &tree->up.obj, WEIGHT_STRONG);
+  DUMP_FIELD_COPY (&out, tree, up_obj);
+  eassert (tree->gcmarkbit == 0);
+  DUMP_FIELD_COPY (&out, tree, write_protect);
+  DUMP_FIELD_COPY (&out, tree, visible);
+  DUMP_FIELD_COPY (&out, tree, front_sticky);
+  DUMP_FIELD_COPY (&out, tree, rear_sticky);
+  dump_field_lv (ctx, &out, tree, &tree->plist, WEIGHT_STRONG);
+  dump_off offset = dump_object_finish (ctx, &out, sizeof (out));
+  if (tree->left)
+      dump_remember_fixup_ptr_raw
+       (ctx,
+        offset + dump_offsetof (struct interval, left),
+        dump_interval_tree (ctx, tree->left, offset));
+  if (tree->right)
+      dump_remember_fixup_ptr_raw
+       (ctx,
+        offset + dump_offsetof (struct interval, right),
+        dump_interval_tree (ctx, tree->right, offset));
+  return offset;
+}
+
+static dump_off
+dump_string (struct dump_context *ctx, const struct Lisp_String *string)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_String_86FEA6EC7C)
+# error "Lisp_String changed. See CHECK_STRUCTS comment."
+#endif
+  /* If we have text properties, write them _after_ the string so that
+     at runtime, the prefetcher and cache will DTRT. (We access the
+     string before its properties.).
+
+     There's special code to dump string data contiguously later on.
+     we seldom write to string data and never relocate it, so lumping
+     it together at the end of the dump saves on COW faults.
+
+     If, however, the string's size_byte field is -1, the string data
+     is actually a pointer to Emacs data segment, so we can do even
+     better by emitting a relocation instead of bothering to copy the
+     string data.  */
+  struct Lisp_String out;
+  dump_object_start (ctx, &out, sizeof (out));
+  DUMP_FIELD_COPY (&out, string, u.s.size);
+  DUMP_FIELD_COPY (&out, string, u.s.size_byte);
+  if (string->u.s.intervals)
+    dump_field_fixup_later (ctx, &out, string, &string->u.s.intervals);
+
+  if (string->u.s.size_byte == -2)
+    /* String literal in Emacs rodata.  */
+    dump_field_emacs_ptr (ctx, &out, string, &string->u.s.data);
+  else
+    {
+      dump_field_fixup_later (ctx, &out, string, &string->u.s.data);
+      dump_remember_cold_op (ctx,
+                             COLD_OP_STRING,
+                            make_lisp_ptr ((void *) string, Lisp_String));
+    }
+
+  dump_off offset = dump_object_finish (ctx, &out, sizeof (out));
+  if (string->u.s.intervals)
+    dump_remember_fixup_ptr_raw
+      (ctx,
+       offset + dump_offsetof (struct Lisp_String, u.s.intervals),
+       dump_interval_tree (ctx, string->u.s.intervals, 0));
+
+  return offset;
+}
+
+static dump_off
+dump_marker (struct dump_context *ctx, const struct Lisp_Marker *marker)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Marker_642DBAF866)
+# error "Lisp_Marker changed. See CHECK_STRUCTS comment."
+#endif
+
+  START_DUMP_PVEC (ctx, &marker->header, struct Lisp_Marker, out);
+  dump_pseudovector_lisp_fields (ctx, &out->header, &marker->header);
+  DUMP_FIELD_COPY (out, marker, need_adjustment);
+  DUMP_FIELD_COPY (out, marker, insertion_type);
+  if (marker->buffer)
+    {
+      dump_field_lv_rawptr (ctx, out, marker, &marker->buffer,
+                           Lisp_Vectorlike, WEIGHT_NORMAL);
+      dump_field_lv_rawptr (ctx, out, marker, &marker->next,
+                           Lisp_Vectorlike, WEIGHT_STRONG);
+      DUMP_FIELD_COPY (out, marker, charpos);
+      DUMP_FIELD_COPY (out, marker, bytepos);
+    }
+  return finish_dump_pvec (ctx, &out->header);
+}
+
+static dump_off
+dump_overlay (struct dump_context *ctx, const struct Lisp_Overlay *overlay)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Overlay_72EADA9882)
+# error "Lisp_Overlay changed. See CHECK_STRUCTS comment."
+#endif
+  START_DUMP_PVEC (ctx, &overlay->header, struct Lisp_Overlay, out);
+  dump_pseudovector_lisp_fields (ctx, &out->header, &overlay->header);
+  dump_field_lv_rawptr (ctx, out, overlay, &overlay->next,
+                        Lisp_Vectorlike, WEIGHT_STRONG);
+  return finish_dump_pvec (ctx, &out->header);
+}
+
+static void
+dump_field_finalizer_ref (struct dump_context *ctx,
+                          void *out,
+                          const struct Lisp_Finalizer *finalizer,
+                          struct Lisp_Finalizer *const *field)
+{
+  if (*field == &finalizers || *field == &doomed_finalizers)
+    dump_field_emacs_ptr (ctx, out, finalizer, field);
+  else
+    dump_field_lv_rawptr (ctx, out, finalizer, field,
+                          Lisp_Vectorlike,
+                          WEIGHT_NORMAL);
+}
+
+static dump_off
+dump_finalizer (struct dump_context *ctx,
+                const struct Lisp_Finalizer *finalizer)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Finalizer_D58E647CB8)
+# error "Lisp_Finalizer changed. See CHECK_STRUCTS comment."
+#endif
+  START_DUMP_PVEC (ctx, &finalizer->header, struct Lisp_Finalizer, out);
+  /* Do _not_ call dump_pseudovector_lisp_fields here: we dump the
+     only Lisp field, finalizer->function, manually, so we can give it
+     a low weight.  */
+  dump_field_lv (ctx, &out, finalizer, &finalizer->function, WEIGHT_NONE);
+  dump_field_finalizer_ref (ctx, &out, finalizer, &finalizer->prev);
+  dump_field_finalizer_ref (ctx, &out, finalizer, &finalizer->next);
+  return finish_dump_pvec (ctx, &out->header);
+}
+
+struct bignum_reload_info
+{
+  dump_off data_location;
+  dump_off nlimbs;
+};
+
+static dump_off
+dump_bignum (struct dump_context *ctx, Lisp_Object object)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Bignum_661945DE2B)
+# error "Lisp_Bignum changed. See CHECK_STRUCTS comment."
+#endif
+  const struct Lisp_Bignum *bignum = XBIGNUM (object);
+  START_DUMP_PVEC (ctx, &bignum->header, struct Lisp_Bignum, out);
+  verify (sizeof (out->value) >= sizeof (struct bignum_reload_info));
+  dump_field_fixup_later (ctx, out, bignum, &bignum->value);
+  dump_off bignum_offset = finish_dump_pvec (ctx, &out->header);
+  if (ctx->flags.dump_object_contents)
+    {
+      /* Export the bignum into a blob in the cold section.  */
+      dump_remember_cold_op (ctx, COLD_OP_BIGNUM, object);
+
+      /* Write the offset of that exported blob here.  */
+      dump_off value_offset
+       = (bignum_offset
+          + (dump_off) offsetof (struct Lisp_Bignum, value));
+      dump_push (&ctx->fixups,
+                list3 (make_fixnum (DUMP_FIXUP_BIGNUM_DATA),
+                       dump_off_to_lisp (value_offset),
+                       object));
+
+      /* When we load the dump, slurp the data blob and turn it into a
+         real bignum.  Attach the relocation to the start of the
+         Lisp_Bignum instead of the actual mpz field so that the
+         relocation offset is aligned.  The relocation-application
+         code knows to actually advance past the header.  */
+      dump_push (&ctx->dump_relocs,
+                 list2 (make_fixnum (RELOC_BIGNUM),
+                        dump_off_to_lisp (bignum_offset)));
+    }
+
+  return bignum_offset;
+}
+
+static dump_off
+dump_float (struct dump_context *ctx, const struct Lisp_Float *lfloat)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Float_50A7B216D9)
+# error "Lisp_Float changed. See CHECK_STRUCTS comment."
+#endif
+  eassert (ctx->header.cold_start);
+  struct Lisp_Float out;
+  dump_object_start (ctx, &out, sizeof (out));
+  DUMP_FIELD_COPY (&out, lfloat, u.data);
+  return dump_object_finish (ctx, &out, sizeof (out));
+}
+
+static dump_off
+dump_fwd_int (struct dump_context *ctx, const struct Lisp_Intfwd *intfwd)
+{
+#if CHECK_STRUCTS && !defined HASH_Lisp_Intfwd_4D887A7387
+# error "Lisp_Intfwd changed. See CHECK_STRUCTS comment."
+#endif
+  dump_emacs_reloc_immediate_intmax_t (ctx, intfwd->intvar, *intfwd->intvar);
+  struct Lisp_Intfwd out;
+  dump_object_start (ctx, &out, sizeof (out));
+  DUMP_FIELD_COPY (&out, intfwd, type);
+  dump_field_emacs_ptr (ctx, &out, intfwd, &intfwd->intvar);
+  return dump_object_finish (ctx, &out, sizeof (out));
+}
+
+static dump_off
+dump_fwd_bool (struct dump_context *ctx, const struct Lisp_Boolfwd *boolfwd)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Boolfwd_0EA1C7ADCC)
+# error "Lisp_Boolfwd changed. See CHECK_STRUCTS comment."
+#endif
+  dump_emacs_reloc_immediate_bool (ctx, boolfwd->boolvar, *boolfwd->boolvar);
+  struct Lisp_Boolfwd out;
+  dump_object_start (ctx, &out, sizeof (out));
+  DUMP_FIELD_COPY (&out, boolfwd, type);
+  dump_field_emacs_ptr (ctx, &out, boolfwd, &boolfwd->boolvar);
+  return dump_object_finish (ctx, &out, sizeof (out));
+}
+
+static dump_off
+dump_fwd_obj (struct dump_context *ctx, const struct Lisp_Objfwd *objfwd)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Objfwd_45D3E513DC)
+# error "Lisp_Objfwd changed. See CHECK_STRUCTS comment."
+#endif
+  if (NILP (Fgethash (dump_off_to_lisp (emacs_offset (objfwd->objvar)),
+                      ctx->staticpro_table,
+                      Qnil)))
+    dump_emacs_reloc_to_lv (ctx, objfwd->objvar, *objfwd->objvar);
+  struct Lisp_Objfwd out;
+  dump_object_start (ctx, &out, sizeof (out));
+  DUMP_FIELD_COPY (&out, objfwd, type);
+  dump_field_emacs_ptr (ctx, &out, objfwd, &objfwd->objvar);
+  return dump_object_finish (ctx, &out, sizeof (out));
+}
+
+static dump_off
+dump_fwd_buffer_obj (struct dump_context *ctx,
+                     const struct Lisp_Buffer_Objfwd *buffer_objfwd)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Buffer_Objfwd_13CA6B04FC)
+# error "Lisp_Buffer_Objfwd changed. See CHECK_STRUCTS comment."
+#endif
+  struct Lisp_Buffer_Objfwd out;
+  dump_object_start (ctx, &out, sizeof (out));
+  DUMP_FIELD_COPY (&out, buffer_objfwd, type);
+  DUMP_FIELD_COPY (&out, buffer_objfwd, offset);
+  dump_field_lv (ctx, &out, buffer_objfwd, &buffer_objfwd->predicate,
+                 WEIGHT_NORMAL);
+  return dump_object_finish (ctx, &out, sizeof (out));
+}
+
+static dump_off
+dump_fwd_kboard_obj (struct dump_context *ctx,
+                     const struct Lisp_Kboard_Objfwd *kboard_objfwd)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Kboard_Objfwd_CAA7E71069)
+# error "Lisp_Intfwd changed. See CHECK_STRUCTS comment."
+#endif
+  struct Lisp_Kboard_Objfwd out;
+  dump_object_start (ctx, &out, sizeof (out));
+  DUMP_FIELD_COPY (&out, kboard_objfwd, type);
+  DUMP_FIELD_COPY (&out, kboard_objfwd, offset);
+  return dump_object_finish (ctx, &out, sizeof (out));
+}
+
+static dump_off
+dump_fwd (struct dump_context *ctx, union Lisp_Fwd *fwd)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Fwd_5227B18E87)
+# error "Lisp_Fwd changed. See CHECK_STRUCTS comment."
+#endif
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Fwd_Type_9CBA6EE55E)
+# error "Lisp_Fwd_Type changed. See CHECK_STRUCTS comment."
+#endif
+  dump_off offset;
+
+  switch (XFWDTYPE (fwd))
+    {
+    case Lisp_Fwd_Int:
+      offset = dump_fwd_int (ctx, &fwd->u_intfwd);
+      break;
+    case Lisp_Fwd_Bool:
+      offset = dump_fwd_bool (ctx, &fwd->u_boolfwd);
+      break;
+    case Lisp_Fwd_Obj:
+      offset = dump_fwd_obj (ctx, &fwd->u_objfwd);
+      break;
+    case Lisp_Fwd_Buffer_Obj:
+      offset = dump_fwd_buffer_obj (ctx, &fwd->u_buffer_objfwd);
+      break;
+    case Lisp_Fwd_Kboard_Obj:
+      offset = dump_fwd_kboard_obj (ctx, &fwd->u_kboard_objfwd);
+      break;
+    default:
+      emacs_abort ();
+    }
+
+  return offset;
+}
+
+static dump_off
+dump_blv (struct dump_context *ctx,
+          const struct Lisp_Buffer_Local_Value *blv)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Buffer_Local_Value_066F33A92E)
+# error "Lisp_Buffer_Local_Value changed. See CHECK_STRUCTS comment."
+#endif
+  struct Lisp_Buffer_Local_Value out;
+  dump_object_start (ctx, &out, sizeof (out));
+  DUMP_FIELD_COPY (&out, blv, local_if_set);
+  DUMP_FIELD_COPY (&out, blv, found);
+  if (blv->fwd)
+    dump_field_fixup_later (ctx, &out, blv, &blv->fwd);
+  dump_field_lv (ctx, &out, blv, &blv->where, WEIGHT_NORMAL);
+  dump_field_lv (ctx, &out, blv, &blv->defcell, WEIGHT_STRONG);
+  dump_field_lv (ctx, &out, blv, &blv->valcell, WEIGHT_STRONG);
+  dump_off offset = dump_object_finish (ctx, &out, sizeof (out));
+  if (blv->fwd)
+    dump_remember_fixup_ptr_raw
+      (ctx,
+       offset + dump_offsetof (struct Lisp_Buffer_Local_Value, fwd),
+       dump_fwd (ctx, blv->fwd));
+  return offset;
+}
+
+static dump_off
+dump_recall_symbol_aux (struct dump_context *ctx, Lisp_Object symbol)
+{
+  Lisp_Object symbol_aux = ctx->symbol_aux;
+  if (NILP (symbol_aux))
+    return 0;
+  return dump_off_from_lisp (Fgethash (symbol, symbol_aux, make_fixnum (0)));
+}
+
+static void
+dump_remember_symbol_aux (struct dump_context *ctx,
+                          Lisp_Object symbol,
+                          dump_off offset)
+{
+  Fputhash (symbol, dump_off_to_lisp (offset), ctx->symbol_aux);
+}
+
+static void
+dump_pre_dump_symbol (struct dump_context *ctx, struct Lisp_Symbol *symbol)
+{
+  Lisp_Object symbol_lv = make_lisp_symbol (symbol);
+  eassert (!dump_recall_symbol_aux (ctx, symbol_lv));
+  DUMP_SET_REFERRER (ctx, symbol_lv);
+  switch (symbol->u.s.redirect)
+    {
+    case SYMBOL_LOCALIZED:
+      dump_remember_symbol_aux (ctx, symbol_lv,
+                               dump_blv (ctx, symbol->u.s.val.blv));
+      break;
+    case SYMBOL_FORWARDED:
+      dump_remember_symbol_aux (ctx, symbol_lv,
+                               dump_fwd (ctx, symbol->u.s.val.fwd));
+      break;
+    default:
+      break;
+    }
+  DUMP_CLEAR_REFERRER (ctx);
+}
+
+static dump_off
+dump_symbol (struct dump_context *ctx,
+             Lisp_Object object,
+             dump_off offset)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Symbol_60EA1E748E)
+# error "Lisp_Symbol changed. See CHECK_STRUCTS comment."
+#endif
+#if CHECK_STRUCTS && !defined (HASH_symbol_redirect_ADB4F5B113)
+# error "symbol_redirect changed. See CHECK_STRUCTS comment."
+#endif
+
+  if (ctx->flags.defer_symbols)
+    {
+      if (offset != DUMP_OBJECT_ON_SYMBOL_QUEUE)
+        {
+         eassert (offset == DUMP_OBJECT_ON_NORMAL_QUEUE
+                  || offset == DUMP_OBJECT_NOT_SEEN);
+          DUMP_CLEAR_REFERRER (ctx);
+          struct dump_flags old_flags = ctx->flags;
+          ctx->flags.dump_object_contents = false;
+          ctx->flags.defer_symbols = false;
+          dump_object (ctx, object);
+          ctx->flags = old_flags;
+          DUMP_SET_REFERRER (ctx, object);
+
+          offset = DUMP_OBJECT_ON_SYMBOL_QUEUE;
+          dump_remember_object (ctx, object, offset);
+          dump_push (&ctx->deferred_symbols, object);
+        }
+      return offset;
+    }
+
+  struct Lisp_Symbol *symbol = XSYMBOL (object);
+  struct Lisp_Symbol out;
+  dump_object_start (ctx, &out, sizeof (out));
+  eassert (symbol->u.s.gcmarkbit == 0);
+  DUMP_FIELD_COPY (&out, symbol, u.s.redirect);
+  DUMP_FIELD_COPY (&out, symbol, u.s.trapped_write);
+  DUMP_FIELD_COPY (&out, symbol, u.s.interned);
+  DUMP_FIELD_COPY (&out, symbol, u.s.declared_special);
+  DUMP_FIELD_COPY (&out, symbol, u.s.pinned);
+  dump_field_lv (ctx, &out, symbol, &symbol->u.s.name, WEIGHT_STRONG);
+  switch (symbol->u.s.redirect)
+    {
+    case SYMBOL_PLAINVAL:
+      dump_field_lv (ctx, &out, symbol, &symbol->u.s.val.value,
+                     WEIGHT_NORMAL);
+      break;
+    case SYMBOL_VARALIAS:
+      dump_field_lv_rawptr (ctx, &out, symbol,
+                            &symbol->u.s.val.alias, Lisp_Symbol,
+                            WEIGHT_NORMAL);
+      break;
+    case SYMBOL_LOCALIZED:
+      dump_field_fixup_later (ctx, &out, symbol, &symbol->u.s.val.blv);
+      break;
+    case SYMBOL_FORWARDED:
+      dump_field_fixup_later (ctx, &out, symbol, &symbol->u.s.val.fwd);
+      break;
+    default:
+      emacs_abort ();
+    }
+  dump_field_lv (ctx, &out, symbol, &symbol->u.s.function, WEIGHT_NORMAL);
+  dump_field_lv (ctx, &out, symbol, &symbol->u.s.plist, WEIGHT_NORMAL);
+  dump_field_lv_rawptr (ctx, &out, symbol, &symbol->u.s.next, Lisp_Symbol,
+                        WEIGHT_STRONG);
+
+  offset = dump_object_finish (ctx, &out, sizeof (out));
+  dump_off aux_offset;
+
+  switch (symbol->u.s.redirect)
+    {
+    case SYMBOL_LOCALIZED:
+      aux_offset = dump_recall_symbol_aux (ctx, make_lisp_symbol (symbol));
+      dump_remember_fixup_ptr_raw
+       (ctx,
+        offset + dump_offsetof (struct Lisp_Symbol, u.s.val.blv),
+        (aux_offset
+         ? aux_offset
+         : dump_blv (ctx, symbol->u.s.val.blv)));
+      break;
+    case SYMBOL_FORWARDED:
+      aux_offset = dump_recall_symbol_aux (ctx, make_lisp_symbol (symbol));
+      dump_remember_fixup_ptr_raw
+       (ctx,
+        offset + dump_offsetof (struct Lisp_Symbol, u.s.val.fwd),
+        (aux_offset
+         ? aux_offset
+         : dump_fwd (ctx, symbol->u.s.val.fwd)));
+      break;
+    default:
+      break;
+    }
+  return offset;
+}
+
+static dump_off
+dump_vectorlike_generic (struct dump_context *ctx,
+                        const union vectorlike_header *header)
+{
+#if CHECK_STRUCTS && !defined (HASH_vectorlike_header_00A5A4BFB2)
+# error "vectorlike_header changed. See CHECK_STRUCTS comment."
+#endif
+  const struct Lisp_Vector *v = (const struct Lisp_Vector *) header;
+  ptrdiff_t size = header->size;
+  enum pvec_type pvectype = PSEUDOVECTOR_TYPE (v);
+  dump_off offset;
+
+  if (size & PSEUDOVECTOR_FLAG)
+    {
+      /* Assert that the pseudovector contains only Lisp values ---
+         but see the PVEC_SUB_CHAR_TABLE special case below.  We allow
+         one extra word of non-lisp data when Lisp_Object is shorter
+         than GCALIGN (e.g., on 32-bit builds) to account for
+         GCALIGN-enforcing struct padding.  We can't distinguish
+         between padding and some undumpable data member this way, but
+         we'll count on sizeof(Lisp_Object) >= GCALIGN builds to catch
+         this class of problem.
+         */
+      eassert ((size & PSEUDOVECTOR_REST_MASK) >> PSEUDOVECTOR_REST_BITS
+              <= (sizeof (Lisp_Object) < GCALIGNMENT));
+      size &= PSEUDOVECTOR_SIZE_MASK;
+    }
+
+  dump_align_output (ctx, DUMP_ALIGNMENT);
+  dump_off prefix_start_offset = ctx->offset;
+
+  dump_off skip;
+  if (pvectype == PVEC_SUB_CHAR_TABLE)
+    {
+      /* PVEC_SUB_CHAR_TABLE has a special case because it's a
+         variable-length vector (unlike other pseudovectors, which is
+         why we handle it here) and has its non-Lisp data _before_ the
+         variable-length Lisp part.  */
+      const struct Lisp_Sub_Char_Table *sct =
+        (const struct Lisp_Sub_Char_Table *) header;
+      struct Lisp_Sub_Char_Table out;
+      /* Don't use sizeof(out), since that incorporates unwanted
+         padding.  Instead, use the size through the last non-Lisp
+         field.  */
+      size_t sz = (char *)&out.min_char + sizeof (out.min_char) - (char *)&out;
+      eassert (sz < DUMP_OFF_MAX);
+      dump_object_start (ctx, &out, (dump_off) sz);
+      DUMP_FIELD_COPY (&out, sct, header.size);
+      DUMP_FIELD_COPY (&out, sct, depth);
+      DUMP_FIELD_COPY (&out, sct, min_char);
+      offset = dump_object_finish (ctx, &out, (dump_off) sz);
+      skip = SUB_CHAR_TABLE_OFFSET;
+    }
+  else
+    {
+      union vectorlike_header out;
+      dump_object_start (ctx, &out, sizeof (out));
+      DUMP_FIELD_COPY (&out, header, size);
+      offset = dump_object_finish (ctx, &out, sizeof (out));
+      skip = 0;
+    }
+
+  /* We may have written a non-Lisp vector prefix above.  If we have,
+     pad to the lisp content start with zero, and make sure we didn't
+     scribble beyond that start.  */
+  dump_off prefix_size = ctx->offset - prefix_start_offset;
+  eassert (prefix_size > 0);
+  dump_off skip_start = ptrdiff_t_to_dump_off ((char *) &v->contents[skip]
+                                              - (char *) v);
+  eassert (skip_start >= prefix_size);
+  dump_write_zero (ctx, skip_start - prefix_size);
+
+  /* dump_object_start isn't what records conservative-GC object
+     starts --- dump_object_1 does --- so the hack below of using
+     dump_object_start for each vector word doesn't cause GC problems
+     at runtime.  */
+  struct dump_flags old_flags = ctx->flags;
+  ctx->flags.pack_objects = true;
+  for (dump_off i = skip; i < size; ++i)
+    {
+      Lisp_Object out;
+      const Lisp_Object *vslot = &v->contents[i];
+      /* In the wide case, we're always misaligned.  */
+#ifndef WIDE_EMACS_INT
+      eassert (ctx->offset % sizeof (out) == 0);
+#endif
+      dump_object_start (ctx, &out, sizeof (out));
+      dump_field_lv (ctx, &out, vslot, vslot, WEIGHT_STRONG);
+      dump_object_finish (ctx, &out, sizeof (out));
+    }
+  ctx->flags = old_flags;
+  dump_align_output (ctx, DUMP_ALIGNMENT);
+  return offset;
+}
+
+/* Determine whether the hash table's hash order is stable
+   across dump and load.  If it is, we don't have to trigger
+   a rehash on access.  */
+static bool
+dump_hash_table_stable_p (const struct Lisp_Hash_Table *hash)
+{
+  bool is_eql = hash->test.hashfn == hashfn_eql;
+  bool is_equal = hash->test.hashfn == hashfn_equal;
+  ptrdiff_t size = HASH_TABLE_SIZE (hash);
+  for (ptrdiff_t i = 0; i < size; ++i)
+    if (!NILP (HASH_HASH (hash, i)))
+      {
+        Lisp_Object key =  HASH_KEY (hash, i);
+       bool key_stable = (dump_builtin_symbol_p (key)
+                          || FIXNUMP (key)
+                          || (is_equal && STRINGP (key))
+                          || ((is_equal || is_eql) && FLOATP (key)));
+        if (!key_stable)
+          return false;
+      }
+
+  return true;
+}
+
+/* Return a list of (KEY . VALUE) pairs in the given hash table.  */
+static Lisp_Object
+hash_table_contents (Lisp_Object table)
+{
+  Lisp_Object contents = Qnil;
+  struct Lisp_Hash_Table *h = XHASH_TABLE (table);
+  for (ptrdiff_t i = 0; i < HASH_TABLE_SIZE (h); ++i)
+    if (!NILP (HASH_HASH (h, i)))
+      dump_push (&contents, Fcons (HASH_KEY (h, i), HASH_VALUE (h, i)));
+  return Fnreverse (contents);
+}
+
+/* Copy the given hash table, rehash it, and make sure that we can
+   look up all the values in the original.  */
+static void
+check_hash_table_rehash (Lisp_Object table_orig)
+{
+  hash_rehash_if_needed (XHASH_TABLE (table_orig));
+  Lisp_Object table_rehashed = Fcopy_hash_table (table_orig);
+  eassert (XHASH_TABLE (table_rehashed)->count >= 0);
+  XHASH_TABLE (table_rehashed)->count *= -1;
+  eassert (XHASH_TABLE (table_rehashed)->count <= 0);
+  hash_rehash_if_needed (XHASH_TABLE (table_rehashed));
+  eassert (XHASH_TABLE (table_rehashed)->count >= 0);
+  Lisp_Object expected_contents = hash_table_contents (table_orig);
+  while (!NILP (expected_contents))
+    {
+      Lisp_Object key_value_pair = dump_pop (&expected_contents);
+      Lisp_Object key = XCAR (key_value_pair);
+      Lisp_Object expected_value = XCDR (key_value_pair);
+      Lisp_Object arbitrary = Qdump_emacs_portable__sort_predicate_copied;
+      Lisp_Object found_value = Fgethash (key, table_rehashed, arbitrary);
+      eassert (EQ (expected_value, found_value));
+      Fremhash (key, table_rehashed);
+    }
+
+  eassert (EQ (Fhash_table_count (table_rehashed),
+               make_fixnum (0)));
+}
+
+static dump_off
+dump_hash_table (struct dump_context *ctx,
+                 Lisp_Object object,
+                 dump_off offset)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Hash_Table_73C9BFB7D1)
+# error "Lisp_Hash_Table changed. See CHECK_STRUCTS comment."
+#endif
+  const struct Lisp_Hash_Table *hash_in = XHASH_TABLE (object);
+  bool is_stable = dump_hash_table_stable_p (hash_in);
+  /* If the hash table is likely to be modified in memory (either
+     because we need to rehash, and thus toggle hash->count, or
+     because we need to assemble a list of weak tables) punt the hash
+     table to the end of the dump, where we can lump all such hash
+     tables together.  */
+  if (!(is_stable || !NILP (hash_in->weak))
+      && ctx->flags.defer_hash_tables)
+    {
+      if (offset != DUMP_OBJECT_ON_HASH_TABLE_QUEUE)
+        {
+         eassert (offset == DUMP_OBJECT_ON_NORMAL_QUEUE
+                  || offset == DUMP_OBJECT_NOT_SEEN);
+          /* We still want to dump the actual keys and values now.  */
+          dump_enqueue_object (ctx, hash_in->key_and_value, WEIGHT_NONE);
+          /* We'll get to the rest later.  */
+          offset = DUMP_OBJECT_ON_HASH_TABLE_QUEUE;
+          dump_remember_object (ctx, object, offset);
+          dump_push (&ctx->deferred_hash_tables, object);
+        }
+      return offset;
+    }
+
+  if (PDUMPER_CHECK_REHASHING)
+    check_hash_table_rehash (make_lisp_ptr ((void *) hash_in, 
Lisp_Vectorlike));
+
+  struct Lisp_Hash_Table hash_munged = *hash_in;
+  struct Lisp_Hash_Table *hash = &hash_munged;
+
+  /* Remember to rehash this hash table on first access.  After a
+     dump reload, the hash table values will have changed, so we'll
+     need to rebuild the index.
+
+     TODO: for EQ and EQL hash tables, it should be possible to rehash
+     here using the preferred load address of the dump, eliminating
+     the need to rehash-on-access if we can load the dump where we
+     want.  */
+  if (hash->count > 0 && !is_stable)
+    hash->count = -hash->count;
+
+  START_DUMP_PVEC (ctx, &hash->header, struct Lisp_Hash_Table, out);
+  dump_pseudovector_lisp_fields (ctx, &out->header, &hash->header);
+  /* TODO: dump the hash bucket vectors synchronously here to keep
+     them as close to the hash table as possible.  */
+  DUMP_FIELD_COPY (out, hash, count);
+  DUMP_FIELD_COPY (out, hash, next_free);
+  DUMP_FIELD_COPY (out, hash, pure);
+  DUMP_FIELD_COPY (out, hash, rehash_threshold);
+  DUMP_FIELD_COPY (out, hash, rehash_size);
+  dump_field_lv (ctx, out, hash, &hash->key_and_value, WEIGHT_STRONG);
+  dump_field_lv (ctx, out, hash, &hash->test.name, WEIGHT_STRONG);
+  dump_field_lv (ctx, out, hash, &hash->test.user_hash_function,
+                 WEIGHT_STRONG);
+  dump_field_lv (ctx, out, hash, &hash->test.user_cmp_function,
+                 WEIGHT_STRONG);
+  dump_field_emacs_ptr (ctx, out, hash, &hash->test.cmpfn);
+  dump_field_emacs_ptr (ctx, out, hash, &hash->test.hashfn);
+  eassert (hash->next_weak == NULL);
+  return finish_dump_pvec (ctx, &out->header);
+}
+
+static dump_off
+dump_buffer (struct dump_context *ctx, const struct buffer *in_buffer)
+{
+#if CHECK_STRUCTS && !defined HASH_buffer_2CEE653E74
+# error "buffer changed. See CHECK_STRUCTS comment."
+#endif
+  struct buffer munged_buffer = *in_buffer;
+  struct buffer *buffer = &munged_buffer;
+
+  /* Clear some buffer state for correctness upon load.  */
+  if (buffer->base_buffer == NULL)
+    buffer->window_count = 0;
+  else
+    eassert (buffer->window_count == -1);
+  buffer->last_selected_window_ = Qnil;
+  buffer->display_count_ = make_fixnum (0);
+  buffer->clip_changed = 0;
+  buffer->last_window_start = -1;
+  buffer->point_before_scroll_ = Qnil;
+
+  dump_off base_offset = 0;
+  if (buffer->base_buffer)
+    {
+      eassert (buffer->base_buffer->base_buffer == NULL);
+      base_offset = dump_object_for_offset
+       (ctx,
+        make_lisp_ptr (buffer->base_buffer, Lisp_Vectorlike));
+    }
+
+  eassert ((base_offset == 0 && buffer->text == &in_buffer->own_text)
+          || (base_offset > 0 && buffer->text != &in_buffer->own_text));
+
+  START_DUMP_PVEC (ctx, &buffer->header, struct buffer, out);
+  dump_pseudovector_lisp_fields (ctx, &out->header, &buffer->header);
+  if (base_offset == 0)
+    base_offset = ctx->obj_offset;
+  eassert (base_offset > 0);
+  if (buffer->base_buffer == NULL)
+    {
+      eassert (base_offset == ctx->obj_offset);
+
+      if (BUFFER_LIVE_P (buffer))
+        {
+          dump_field_fixup_later (ctx, out, buffer, &buffer->own_text.beg);
+         dump_remember_cold_op (ctx, COLD_OP_BUFFER,
+                                make_lisp_ptr ((void *) in_buffer,
+                                               Lisp_Vectorlike));
+        }
+      else
+        eassert (buffer->own_text.beg == NULL);
+
+      DUMP_FIELD_COPY (out, buffer, own_text.gpt);
+      DUMP_FIELD_COPY (out, buffer, own_text.z);
+      DUMP_FIELD_COPY (out, buffer, own_text.gpt_byte);
+      DUMP_FIELD_COPY (out, buffer, own_text.z_byte);
+      DUMP_FIELD_COPY (out, buffer, own_text.gap_size);
+      DUMP_FIELD_COPY (out, buffer, own_text.modiff);
+      DUMP_FIELD_COPY (out, buffer, own_text.chars_modiff);
+      DUMP_FIELD_COPY (out, buffer, own_text.save_modiff);
+      DUMP_FIELD_COPY (out, buffer, own_text.overlay_modiff);
+      DUMP_FIELD_COPY (out, buffer, own_text.compact);
+      DUMP_FIELD_COPY (out, buffer, own_text.beg_unchanged);
+      DUMP_FIELD_COPY (out, buffer, own_text.end_unchanged);
+      DUMP_FIELD_COPY (out, buffer, own_text.unchanged_modified);
+      DUMP_FIELD_COPY (out, buffer, own_text.overlay_unchanged_modified);
+      if (buffer->own_text.intervals)
+        dump_field_fixup_later (ctx, out, buffer, &buffer->own_text.intervals);
+      dump_field_lv_rawptr (ctx, out, buffer, &buffer->own_text.markers,
+                            Lisp_Vectorlike, WEIGHT_NORMAL);
+      DUMP_FIELD_COPY (out, buffer, own_text.inhibit_shrinking);
+      DUMP_FIELD_COPY (out, buffer, own_text.redisplay);
+    }
+
+  eassert (ctx->obj_offset > 0);
+  dump_remember_fixup_ptr_raw
+    (ctx,
+     ctx->obj_offset + dump_offsetof (struct buffer, text),
+     base_offset + dump_offsetof (struct buffer, own_text));
+
+  dump_field_lv_rawptr (ctx, out, buffer, &buffer->next,
+                        Lisp_Vectorlike, WEIGHT_NORMAL);
+  DUMP_FIELD_COPY (out, buffer, pt);
+  DUMP_FIELD_COPY (out, buffer, pt_byte);
+  DUMP_FIELD_COPY (out, buffer, begv);
+  DUMP_FIELD_COPY (out, buffer, begv_byte);
+  DUMP_FIELD_COPY (out, buffer, zv);
+  DUMP_FIELD_COPY (out, buffer, zv_byte);
+
+  if (buffer->base_buffer)
+    {
+      eassert (ctx->obj_offset != base_offset);
+      dump_field_ptr_to_dump_offset (ctx, out, buffer, &buffer->base_buffer,
+                                    base_offset);
+    }
+
+  DUMP_FIELD_COPY (out, buffer, indirections);
+  DUMP_FIELD_COPY (out, buffer, window_count);
+
+  memcpy (out->local_flags,
+          &buffer->local_flags,
+          sizeof (out->local_flags));
+  DUMP_FIELD_COPY (out, buffer, modtime);
+  DUMP_FIELD_COPY (out, buffer, modtime_size);
+  DUMP_FIELD_COPY (out, buffer, auto_save_modified);
+  DUMP_FIELD_COPY (out, buffer, display_error_modiff);
+  DUMP_FIELD_COPY (out, buffer, auto_save_failure_time);
+  DUMP_FIELD_COPY (out, buffer, last_window_start);
+
+  /* Not worth serializing these caches.  TODO: really? */
+  out->newline_cache = NULL;
+  out->width_run_cache = NULL;
+  out->bidi_paragraph_cache = NULL;
+
+  DUMP_FIELD_COPY (out, buffer, prevent_redisplay_optimizations_p);
+  DUMP_FIELD_COPY (out, buffer, clip_changed);
+  DUMP_FIELD_COPY (out, buffer, inhibit_buffer_hooks);
+
+  dump_field_lv_rawptr (ctx, out, buffer, &buffer->overlays_before,
+                        Lisp_Vectorlike, WEIGHT_NORMAL);
+
+  dump_field_lv_rawptr (ctx, out, buffer, &buffer->overlays_after,
+                        Lisp_Vectorlike, WEIGHT_NORMAL);
+
+  DUMP_FIELD_COPY (out, buffer, overlay_center);
+  dump_field_lv (ctx, out, buffer, &buffer->undo_list_,
+                 WEIGHT_STRONG);
+  dump_off offset = finish_dump_pvec (ctx, &out->header);
+  if (!buffer->base_buffer && buffer->own_text.intervals)
+    dump_remember_fixup_ptr_raw
+      (ctx,
+       offset + dump_offsetof (struct buffer, own_text.intervals),
+       dump_interval_tree (ctx, buffer->own_text.intervals, 0));
+
+  return offset;
+}
+
+static dump_off
+dump_bool_vector (struct dump_context *ctx, const struct Lisp_Vector *v)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Vector_3091289B35)
+# error "Lisp_Vector changed. See CHECK_STRUCTS comment."
+#endif
+  /* No relocation needed, so we don't need dump_object_start.  */
+  dump_align_output (ctx, DUMP_ALIGNMENT);
+  eassert (ctx->offset >= ctx->header.cold_start);
+  dump_off offset = ctx->offset;
+  ptrdiff_t nbytes = vector_nbytes ((struct Lisp_Vector *) v);
+  if (nbytes > DUMP_OFF_MAX)
+    error ("vector too large");
+  dump_write (ctx, v, ptrdiff_t_to_dump_off (nbytes));
+  return offset;
+}
+
+static dump_off
+dump_subr (struct dump_context *ctx, const struct Lisp_Subr *subr)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Subr_594AB72B54)
+# error "Lisp_Subr changed. See CHECK_STRUCTS comment."
+#endif
+  struct Lisp_Subr out;
+  dump_object_start (ctx, &out, sizeof (out));
+  DUMP_FIELD_COPY (&out, subr, header.size);
+  dump_field_emacs_ptr (ctx, &out, subr, &subr->function.a0);
+  DUMP_FIELD_COPY (&out, subr, min_args);
+  DUMP_FIELD_COPY (&out, subr, max_args);
+  dump_field_emacs_ptr (ctx, &out, subr, &subr->symbol_name);
+  dump_field_emacs_ptr (ctx, &out, subr, &subr->intspec);
+  DUMP_FIELD_COPY (&out, subr, doc);
+  return dump_object_finish (ctx, &out, sizeof (out));
+}
+
+static void
+fill_pseudovec (union vectorlike_header *header, Lisp_Object item)
+{
+  struct Lisp_Vector *v = (struct Lisp_Vector *) header;
+  eassert (v->header.size & PSEUDOVECTOR_FLAG);
+  ptrdiff_t size = v->header.size & PSEUDOVECTOR_SIZE_MASK;
+  for (ptrdiff_t idx = 0; idx < size; idx++)
+    v->contents[idx] = item;
+}
+
+static dump_off
+dump_nilled_pseudovec (struct dump_context *ctx,
+                       const union vectorlike_header *in)
+{
+  START_DUMP_PVEC (ctx, in, struct Lisp_Vector, out);
+  fill_pseudovec (&out->header, Qnil);
+  return finish_dump_pvec (ctx, &out->header);
+}
+
+static dump_off
+dump_vectorlike (struct dump_context *ctx,
+                 Lisp_Object lv,
+                 dump_off offset)
+{
+#if CHECK_STRUCTS && !defined (HASH_pvec_type_549C833A54)
+# error "pvec_type changed. See CHECK_STRUCTS comment."
+#endif
+  const struct Lisp_Vector *v = XVECTOR (lv);
+  switch (PSEUDOVECTOR_TYPE (v))
+    {
+    case PVEC_FONT:
+      /* There are three kinds of font objects that all use PVEC_FONT,
+         distinguished by their size.  Font specs and entities are
+         harmless data carriers that we can dump like other Lisp
+         objects.  Fonts themselves are window-system-specific and
+         need to be recreated on each startup.  */
+      if ((v->header.size & PSEUDOVECTOR_SIZE_MASK) != FONT_SPEC_MAX
+         && (v->header.size & PSEUDOVECTOR_SIZE_MASK) != FONT_ENTITY_MAX)
+        error_unsupported_dump_object(ctx, lv, "font");
+      FALLTHROUGH;
+    case PVEC_NORMAL_VECTOR:
+    case PVEC_COMPILED:
+    case PVEC_CHAR_TABLE:
+    case PVEC_SUB_CHAR_TABLE:
+    case PVEC_RECORD:
+      offset = dump_vectorlike_generic (ctx, &v->header);
+      break;
+    case PVEC_BOOL_VECTOR:
+      offset = dump_bool_vector(ctx, v);
+      break;
+    case PVEC_HASH_TABLE:
+      offset = dump_hash_table (ctx, lv, offset);
+      break;
+    case PVEC_BUFFER:
+      offset = dump_buffer (ctx, XBUFFER (lv));
+      break;
+    case PVEC_SUBR:
+      offset = dump_subr (ctx, XSUBR (lv));
+      break;
+    case PVEC_FRAME:
+    case PVEC_WINDOW:
+    case PVEC_PROCESS:
+    case PVEC_TERMINAL:
+      offset = dump_nilled_pseudovec (ctx, &v->header);
+      break;
+    case PVEC_MARKER:
+      offset = dump_marker (ctx, XMARKER (lv));
+      break;
+    case PVEC_OVERLAY:
+      offset = dump_overlay (ctx, XOVERLAY (lv));
+      break;
+    case PVEC_FINALIZER:
+      offset = dump_finalizer (ctx, XFINALIZER (lv));
+      break;
+    case PVEC_BIGNUM:
+      offset = dump_bignum (ctx, lv);
+      break;
+    case PVEC_WINDOW_CONFIGURATION:
+      error_unsupported_dump_object (ctx, lv, "window configuration");
+    case PVEC_OTHER:
+      error_unsupported_dump_object (ctx, lv, "other?!");
+    case PVEC_XWIDGET:
+      error_unsupported_dump_object (ctx, lv, "xwidget");
+    case PVEC_XWIDGET_VIEW:
+      error_unsupported_dump_object (ctx, lv, "xwidget view");
+    case PVEC_MISC_PTR:
+#ifdef HAVE_MODULES
+    case PVEC_USER_PTR:
+#endif
+      error_unsupported_dump_object (ctx, lv, "smuggled pointers");
+    case PVEC_THREAD:
+      if (main_thread_p (v))
+        {
+          eassert (dump_object_emacs_ptr (lv));
+          return DUMP_OBJECT_IS_RUNTIME_MAGIC;
+        }
+      error_unsupported_dump_object (ctx, lv, "thread");
+    case PVEC_MUTEX:
+      error_unsupported_dump_object (ctx, lv, "mutex");
+    case PVEC_CONDVAR:
+      error_unsupported_dump_object (ctx, lv, "condvar");
+    case PVEC_MODULE_FUNCTION:
+      error_unsupported_dump_object (ctx, lv, "module function");
+    default:
+      error_unsupported_dump_object(ctx, lv, "weird pseudovector");
+    }
+
+  return offset;
+}
+
+/* Add an object to the dump.
+
+   CTX is the dump context; OBJECT is the object to add.  Normally,
+   return OFFSET, the location (in bytes, from the start of the dump
+   file) where we wrote the object.  Valid OFFSETs are always greater
+   than zero.
+
+   If we've already dumped an object, return the location where we put
+   it: dump_object is idempotent.
+
+   The object must refer to an actual pointer-ish object of some sort.
+   Some self-representing objects are immediate values rather than
+   tagged pointers to Lisp heap structures and so have no individual
+   representation in the Lisp heap dump.
+
+   May also return one of the DUMP_OBJECT_ON_*_QUEUE constants if we
+   "dumped" the object by remembering to process it specially later.
+   In this case, we don't have a valid offset.
+   Call dump_object_for_offset if you need a valid offset for
+   an object.
+ */
+static dump_off
+dump_object (struct dump_context *ctx, Lisp_Object object)
+{
+#if CHECK_STRUCTS && !defined (HASH_Lisp_Type_E2AD97D3F7)
+# error "Lisp_Type changed. See CHECK_STRUCTS comment."
+#endif
+#ifdef ENABLE_CHECKING
+  /* Vdead is extern only when ENABLE_CHECKING.  */
+  eassert (!EQ (object, Vdead));
+#endif
+
+  dump_off offset = dump_recall_object (ctx, object);
+  if (offset > 0)
+    return offset;  /* Object already dumped.  */
+
+  bool cold = BOOL_VECTOR_P (object) || FLOATP (object);
+  if (cold && ctx->flags.defer_cold_objects)
+    {
+      if (offset != DUMP_OBJECT_ON_COLD_QUEUE)
+        {
+         eassert (offset == DUMP_OBJECT_ON_NORMAL_QUEUE
+                  || offset == DUMP_OBJECT_NOT_SEEN);
+          offset = DUMP_OBJECT_ON_COLD_QUEUE;
+          dump_remember_object (ctx, object, offset);
+          dump_remember_cold_op (ctx, COLD_OP_OBJECT, object);
+        }
+      return offset;
+    }
+
+  void *obj_in_emacs = dump_object_emacs_ptr (object);
+  if (obj_in_emacs && ctx->flags.defer_copied_objects)
+    {
+      if (offset != DUMP_OBJECT_ON_COPIED_QUEUE)
+        {
+         eassert (offset == DUMP_OBJECT_ON_NORMAL_QUEUE
+                  || offset == DUMP_OBJECT_NOT_SEEN);
+          /* Even though we're not going to dump this object right
+             away, we still want to scan and enqueue its
+             referents.  */
+          struct dump_flags old_flags = ctx->flags;
+          ctx->flags.dump_object_contents = false;
+          ctx->flags.defer_copied_objects = false;
+          dump_object (ctx, object);
+          ctx->flags = old_flags;
+
+          offset = DUMP_OBJECT_ON_COPIED_QUEUE;
+          dump_remember_object (ctx, object, offset);
+          dump_push (&ctx->copied_queue, object);
+        }
+      return offset;
+    }
+
+  /* Object needs to be dumped.  */
+  DUMP_SET_REFERRER (ctx, object);
+  switch (XTYPE (object))
+    {
+    case Lisp_String:
+      offset = dump_string (ctx, XSTRING (object));
+      break;
+    case Lisp_Vectorlike:
+      offset = dump_vectorlike (ctx, object, offset);
+      break;
+    case Lisp_Symbol:
+      offset = dump_symbol (ctx, object, offset);
+      break;
+    case Lisp_Cons:
+      offset = dump_cons (ctx, XCONS (object));
+      break;
+    case Lisp_Float:
+      offset = dump_float (ctx, XFLOAT (object));
+      break;
+    case_Lisp_Int:
+      eassert ("should not be dumping int: is self-representing" && 0);
+      abort ();
+    default:
+      emacs_abort ();
+    }
+  DUMP_CLEAR_REFERRER (ctx);
+
+  /* offset can be < 0 if we've deferred an object.  */
+  if (ctx->flags.dump_object_contents && offset > DUMP_OBJECT_NOT_SEEN)
+    {
+      eassert (offset % DUMP_ALIGNMENT == 0);
+      dump_remember_object (ctx, object, offset);
+      if (ctx->flags.record_object_starts)
+        {
+          eassert (!ctx->flags.pack_objects);
+          dump_push (&ctx->object_starts,
+                     list2 (dump_off_to_lisp (XTYPE (object)),
+                            dump_off_to_lisp (offset)));
+        }
+    }
+
+  return offset;
+}
+
+/* Like dump_object(), but assert that we get a valid offset.  */
+static dump_off
+dump_object_for_offset (struct dump_context *ctx, Lisp_Object object)
+{
+  dump_off offset = dump_object (ctx, object);
+  eassert (offset > 0);
+  return offset;
+}
+
+static dump_off
+dump_charset (struct dump_context *ctx, int cs_i)
+{
+#if CHECK_STRUCTS && !defined (HASH_charset_317C49E291)
+# error "charset changed. See CHECK_STRUCTS comment."
+#endif
+  dump_align_output (ctx, alignof (int));
+  const struct charset *cs = charset_table + cs_i;
+  struct charset out;
+  dump_object_start (ctx, &out, sizeof (out));
+  DUMP_FIELD_COPY (&out, cs, id);
+  DUMP_FIELD_COPY (&out, cs, hash_index);
+  DUMP_FIELD_COPY (&out, cs, dimension);
+  memcpy (out.code_space, &cs->code_space, sizeof (cs->code_space));
+  if (cs->code_space_mask)
+    dump_field_fixup_later (ctx, &out, cs, &cs->code_space_mask);
+  DUMP_FIELD_COPY (&out, cs, code_linear_p);
+  DUMP_FIELD_COPY (&out, cs, iso_chars_96);
+  DUMP_FIELD_COPY (&out, cs, ascii_compatible_p);
+  DUMP_FIELD_COPY (&out, cs, supplementary_p);
+  DUMP_FIELD_COPY (&out, cs, compact_codes_p);
+  DUMP_FIELD_COPY (&out, cs, unified_p);
+  DUMP_FIELD_COPY (&out, cs, iso_final);
+  DUMP_FIELD_COPY (&out, cs, iso_revision);
+  DUMP_FIELD_COPY (&out, cs, emacs_mule_id);
+  DUMP_FIELD_COPY (&out, cs, method);
+  DUMP_FIELD_COPY (&out, cs, min_code);
+  DUMP_FIELD_COPY (&out, cs, max_code);
+  DUMP_FIELD_COPY (&out, cs, char_index_offset);
+  DUMP_FIELD_COPY (&out, cs, min_char);
+  DUMP_FIELD_COPY (&out, cs, max_char);
+  DUMP_FIELD_COPY (&out, cs, invalid_code);
+  memcpy (out.fast_map, &cs->fast_map, sizeof (cs->fast_map));
+  DUMP_FIELD_COPY (&out, cs, code_offset);
+  dump_off offset = dump_object_finish (ctx, &out, sizeof (out));
+  if (cs->code_space_mask)
+    dump_remember_cold_op (ctx, COLD_OP_CHARSET,
+                           Fcons (dump_off_to_lisp (cs_i),
+                                  dump_off_to_lisp (offset)));
+  return offset;
+}
+
+static dump_off
+dump_charset_table (struct dump_context *ctx)
+{
+  struct dump_flags old_flags = ctx->flags;
+  ctx->flags.pack_objects = true;
+  dump_align_output (ctx, DUMP_ALIGNMENT);
+  dump_off offset = ctx->offset;
+  /* We are dumping the entire table, not just the used slots, because
+     otherwise when we restore from the pdump file, the actual size of
+     the table will be smaller than charset_table_size, and we will
+     crash if/when a new charset is defined.  */
+  for (int i = 0; i < charset_table_size; ++i)
+    dump_charset (ctx, i);
+  dump_emacs_reloc_to_dump_ptr_raw (ctx, &charset_table, offset);
+  ctx->flags = old_flags;
+  return offset;
+}
+
+static void
+dump_finalizer_list_head_ptr (struct dump_context *ctx,
+                              struct Lisp_Finalizer **ptr)
+{
+  struct Lisp_Finalizer *value = *ptr;
+  if (value != &finalizers && value != &doomed_finalizers)
+    dump_emacs_reloc_to_dump_ptr_raw
+      (ctx, ptr,
+       dump_object_for_offset (ctx,
+                              make_lisp_ptr (value, Lisp_Vectorlike)));
+}
+
+static void
+dump_metadata_for_pdumper (struct dump_context *ctx)
+{
+  for (int i = 0; i < nr_dump_hooks; ++i)
+    dump_emacs_reloc_to_emacs_ptr_raw (ctx, &dump_hooks[i], dump_hooks[i]);
+  dump_emacs_reloc_immediate_int (ctx, &nr_dump_hooks, nr_dump_hooks);
+
+  for (int i = 0; i < nr_remembered_data; ++i)
+    {
+      dump_emacs_reloc_to_emacs_ptr_raw (ctx, &remembered_data[i].mem,
+                                        remembered_data[i].mem);
+      dump_emacs_reloc_immediate_int (ctx, &remembered_data[i].sz,
+                                     remembered_data[i].sz);
+    }
+  dump_emacs_reloc_immediate_int (ctx, &nr_remembered_data,
+                                 nr_remembered_data);
+}
+
+/* Sort the list of copied objects in CTX.  */
+static void
+dump_sort_copied_objects (struct dump_context *ctx)
+{
+  /* Sort the objects into the order in which they'll appear in the
+     Emacs: this way, on startup, we'll do both the IO from the dump
+     file and the copy into Emacs in-order, where prefetch will be
+     most effective.  */
+  ctx->copied_queue =
+    Fsort (Fnreverse (ctx->copied_queue),
+           Qdump_emacs_portable__sort_predicate_copied);
+}
+
+/* Dump parts of copied objects we need at runtime.  */
+static void
+dump_hot_parts_of_discardable_objects (struct dump_context *ctx)
+{
+  Lisp_Object copied_queue = ctx->copied_queue;
+  while (!NILP (copied_queue))
+    {
+      Lisp_Object copied = dump_pop (&copied_queue);
+      if (SYMBOLP (copied))
+        {
+          eassert (dump_builtin_symbol_p (copied));
+          dump_pre_dump_symbol (ctx, XSYMBOL (copied));
+        }
+    }
+}
+
+static void
+dump_drain_copied_objects (struct dump_context *ctx)
+{
+  Lisp_Object copied_queue = ctx->copied_queue;
+  ctx->copied_queue = Qnil;
+
+  struct dump_flags old_flags = ctx->flags;
+
+  /* We should have already fully scanned these objects, so assert
+     that we're not adding more entries to the dump queue.  */
+  ctx->flags.assert_already_seen = true;
+
+  /* Now we want to actually dump the copied objects, not just record
+     them.  */
+  ctx->flags.defer_copied_objects = false;
+
+  /* Objects that we memcpy into Emacs shouldn't get object-start
+     records (which conservative GC looks at): we usually discard this
+     memory after we're finished memcpying, and even if we don't, the
+     "real" objects in this section all live in the Emacs image, not
+     in the dump.  */
+  ctx->flags.record_object_starts = false;
+
+  /* Dump the objects and generate a copy relocation for each.  Don't
+     bother trying to reduce the number of copy relocations we
+     generate: we'll merge adjacent copy relocations upon output.
+     The overall result is that to the greatest extent possible while
+     maintaining strictly increasing address order, we copy into Emacs
+     in nice big chunks.  */
+  while (!NILP (copied_queue))
+    {
+      Lisp_Object copied = dump_pop (&copied_queue);
+      void *optr = dump_object_emacs_ptr (copied);
+      eassert (optr != NULL);
+      /* N.B. start_offset is beyond any padding we insert.  */
+      dump_off start_offset = dump_object (ctx, copied);
+      if (start_offset != DUMP_OBJECT_IS_RUNTIME_MAGIC)
+        {
+          dump_off size = ctx->offset - start_offset;
+          dump_emacs_reloc_copy_from_dump (ctx, start_offset, optr, size);
+        }
+    }
+
+  ctx->flags = old_flags;
+}
+
+static void
+dump_cold_string (struct dump_context *ctx, Lisp_Object string)
+{
+  /* Dump string contents.  */
+  dump_off string_offset = dump_recall_object (ctx, string);
+  eassert (string_offset > 0);
+  if (SBYTES (string) > DUMP_OFF_MAX - 1)
+    error ("string too large");
+  dump_off total_size = ptrdiff_t_to_dump_off (SBYTES (string) + 1);
+  eassert (total_size > 0);
+  dump_remember_fixup_ptr_raw
+    (ctx,
+     string_offset + dump_offsetof (struct Lisp_String, u.s.data),
+     ctx->offset);
+  dump_write (ctx, XSTRING (string)->u.s.data, total_size);
+}
+
+static void
+dump_cold_charset (struct dump_context *ctx, Lisp_Object data)
+{
+  /* Dump charset lookup tables.  */
+  ALLOW_IMPLICIT_CONVERSION;
+  int cs_i = XFIXNUM (XCAR (data));
+  DISALLOW_IMPLICIT_CONVERSION;
+  dump_off cs_dump_offset = dump_off_from_lisp (XCDR (data));
+  dump_remember_fixup_ptr_raw
+    (ctx,
+     cs_dump_offset + dump_offsetof (struct charset, code_space_mask),
+     ctx->offset);
+  struct charset *cs = charset_table + cs_i;
+  dump_write (ctx, cs->code_space_mask, 256);
+}
+
+static void
+dump_cold_buffer (struct dump_context *ctx, Lisp_Object data)
+{
+  /* Dump buffer text.  */
+  dump_off buffer_offset = dump_recall_object (ctx, data);
+  eassert (buffer_offset > 0);
+  struct buffer *b = XBUFFER (data);
+  eassert (b->text == &b->own_text);
+  /* Zero the gap so we don't dump uninitialized bytes.  */
+  memset (BUF_GPT_ADDR (b), 0, BUF_GAP_SIZE (b));
+  /* See buffer.c for this calculation.  */
+  ptrdiff_t nbytes =
+    BUF_Z_BYTE (b)
+    - BUF_BEG_BYTE (b)
+    + BUF_GAP_SIZE (b)
+    + 1;
+  if (nbytes > DUMP_OFF_MAX)
+    error ("buffer too large");
+  dump_remember_fixup_ptr_raw
+    (ctx,
+     buffer_offset + dump_offsetof (struct buffer, own_text.beg),
+     ctx->offset);
+  dump_write (ctx, b->own_text.beg, ptrdiff_t_to_dump_off (nbytes));
+}
+
+static void
+dump_cold_bignum (struct dump_context *ctx, Lisp_Object object)
+{
+  const struct Lisp_Bignum *bignum = XBIGNUM (object);
+  size_t sz_nlimbs = mpz_size (bignum->value);
+  eassert (sz_nlimbs < DUMP_OFF_MAX);
+  dump_align_output (ctx, alignof (mp_limb_t));
+  dump_off nlimbs = (dump_off) sz_nlimbs;
+  Lisp_Object descriptor
+    = list2 (dump_off_to_lisp (ctx->offset),
+            dump_off_to_lisp ((mpz_sgn (bignum->value) < 0
+                               ? -nlimbs : nlimbs)));
+  Fputhash (object, descriptor, ctx->bignum_data);
+  for (mp_size_t i = 0; i < nlimbs; ++i)
+    {
+      mp_limb_t limb = mpz_getlimbn (bignum->value, i);
+      dump_write (ctx, &limb, sizeof (limb));
+    }
+}
+
+static void
+dump_drain_cold_data (struct dump_context *ctx)
+{
+  Lisp_Object cold_queue = Fnreverse (ctx->cold_queue);
+  ctx->cold_queue = Qnil;
+
+  struct dump_flags old_flags = ctx->flags;
+
+  /* We should have already scanned all objects to which our cold
+     objects refer, so die if an object points to something we haven't
+     seen.  */
+  ctx->flags.assert_already_seen = true;
+
+  /* Actually dump cold objects instead of deferring them.  */
+  ctx->flags.defer_cold_objects = false;
+
+  while (!NILP (cold_queue))
+    {
+      Lisp_Object item = dump_pop (&cold_queue);
+      enum cold_op op = (enum cold_op) XFIXNUM (XCAR (item));
+      Lisp_Object data = XCDR (item);
+      switch (op)
+        {
+        case COLD_OP_STRING:
+          dump_cold_string (ctx, data);
+          break;
+        case COLD_OP_CHARSET:
+          dump_cold_charset (ctx, data);
+          break;
+        case COLD_OP_BUFFER:
+          dump_cold_buffer (ctx, data);
+          break;
+        case COLD_OP_OBJECT:
+          /* Objects that we can put in the cold section
+             must not refer to other objects.  */
+          eassert (dump_queue_empty_p (&ctx->dump_queue));
+          eassert (ctx->flags.dump_object_contents);
+          dump_object (ctx, data);
+          eassert (dump_queue_empty_p (&ctx->dump_queue));
+          break;
+        case COLD_OP_BIGNUM:
+          dump_cold_bignum (ctx, data);
+          break;
+        default:
+          emacs_abort ();
+        }
+    }
+
+  ctx->flags = old_flags;
+}
+
+static void
+read_ptr_raw_and_lv (const void *mem,
+                     enum Lisp_Type type,
+                     void **out_ptr,
+                     Lisp_Object *out_lv)
+{
+  memcpy (out_ptr, mem, sizeof (*out_ptr));
+  if (*out_ptr != NULL)
+    {
+      switch (type)
+        {
+        case Lisp_Symbol:
+          *out_lv = make_lisp_symbol (*out_ptr);
+          break;
+        case Lisp_String:
+        case Lisp_Vectorlike:
+        case Lisp_Cons:
+        case Lisp_Float:
+          *out_lv = make_lisp_ptr (*out_ptr, type);
+          break;
+        default:
+          emacs_abort ();
+        }
+    }
+}
+
+/* Enqueue for dumping objects referenced by static non-Lisp_Object
+   pointers inside Emacs.  */
+static void
+dump_drain_user_remembered_data_hot (struct dump_context *ctx)
+{
+  for (int i = 0; i < nr_remembered_data; ++i)
+    {
+      void *mem = remembered_data[i].mem;
+      int sz = remembered_data[i].sz;
+      if (sz <= 0)
+        {
+          enum Lisp_Type type = -sz;
+          void *value;
+          Lisp_Object lv;
+          read_ptr_raw_and_lv (mem, type, &value, &lv);
+          if (value != NULL)
+            {
+              DUMP_SET_REFERRER (ctx, dump_ptr_referrer ("user data", mem));
+              dump_enqueue_object (ctx, lv, WEIGHT_NONE);
+              DUMP_CLEAR_REFERRER (ctx);
+            }
+        }
+    }
+}
+
+/* Dump user-specified non-relocated data.  */
+static void
+dump_drain_user_remembered_data_cold (struct dump_context *ctx)
+{
+  for (int i = 0; i < nr_remembered_data; ++i)
+    {
+      void *mem = remembered_data[i].mem;
+      int sz = remembered_data[i].sz;
+      if (sz > 0)
+        {
+          /* Scalar: try to inline the value into the relocation if
+             it's small enough; if it's bigger than we can fit in a
+             relocation, we have to copy the data into the dump proper
+             and emit a copy relocation.  */
+          if (sz <= sizeof (intmax_t))
+            dump_emacs_reloc_immediate (ctx, mem, mem, sz);
+          else
+            {
+              dump_emacs_reloc_copy_from_dump (ctx, ctx->offset, mem, sz);
+              dump_write (ctx, mem, sz);
+            }
+        }
+      else
+        {
+          /* *mem is a raw pointer to a Lisp object of some sort.
+             The object to which it points should have already been
+             dumped by dump_drain_user_remembered_data_hot.  */
+          void *value;
+          Lisp_Object lv;
+          enum Lisp_Type type = -sz;
+          read_ptr_raw_and_lv (mem, type, &value, &lv);
+          if (value == NULL)
+            /* We can't just ignore NULL: the variable might have
+               transitioned from non-NULL to NULL, and we want to
+               record this fact.  */
+            dump_emacs_reloc_immediate_ptrdiff_t (ctx, mem, 0);
+          else
+            {
+              if (dump_object_emacs_ptr (lv) != NULL)
+                {
+                  /* We have situation like this:
+
+                     static Lisp_Symbol *foo;
+                     ...
+                     foo = XSYMBOL(Qt);
+                     ...
+                     pdumper_remember_lv_ptr_raw (&foo, Lisp_Symbol);
+
+                     Built-in symbols like Qt aren't in the dump!
+                     They're actually in Emacs proper.  We need a
+                     special case to point this value back at Emacs
+                     instead of to something in the dump that
+                     isn't there.
+
+                     An analogous situation applies to subrs, since
+                     Lisp_Subr structures always live in Emacs, not
+                     the dump.
+                  */
+                 dump_emacs_reloc_to_emacs_ptr_raw
+                   (ctx, mem, dump_object_emacs_ptr (lv));
+                }
+              else
+                {
+                  eassert (!dump_object_self_representing_p (lv));
+                  dump_off dump_offset = dump_recall_object (ctx, lv);
+                  if (dump_offset <= 0)
+                    error ("raw-pointer object not dumped?!");
+                  dump_emacs_reloc_to_dump_ptr_raw (ctx, mem, dump_offset);
+                }
+            }
+        }
+    }
+}
+
+static void
+dump_unwind_cleanup (void *data)
+{
+  struct dump_context *ctx = data;
+  if (ctx->fd >= 0)
+    emacs_close (ctx->fd);
+#ifdef REL_ALLOC
+  if (ctx->blocked_ralloc)
+    r_alloc_inhibit_buffer_relocation (0);
+#endif
+  Vpurify_flag = ctx->old_purify_flag;
+}
+
+/* Return DUMP_OFFSET, making sure it is within the heap.  */
+static dump_off
+dump_check_dump_off (struct dump_context *ctx, dump_off dump_offset)
+{
+  eassert (dump_offset > 0);
+  if (ctx)
+    eassert (dump_offset < ctx->end_heap);
+  return dump_offset;
+}
+
+static void
+dump_check_emacs_off (dump_off emacs_off)
+{
+  eassert (labs (emacs_off) <= 60 * 1024 * 1024);
+}
+
+static struct dump_reloc
+dump_decode_dump_reloc (Lisp_Object lreloc)
+{
+  struct dump_reloc reloc;
+  dump_reloc_set_type (&reloc,
+                      (enum dump_reloc_type) XFIXNUM (dump_pop (&lreloc)));
+  eassert (reloc.type <= RELOC_DUMP_TO_EMACS_LV + Lisp_Float);
+  dump_reloc_set_offset (&reloc, dump_off_from_lisp (dump_pop (&lreloc)));
+  eassert (NILP (lreloc));
+  return reloc;
+}
+
+static void
+dump_emit_dump_reloc (struct dump_context *ctx, Lisp_Object lreloc)
+{
+  eassert (ctx->flags.pack_objects);
+  struct dump_reloc reloc;
+  dump_object_start (ctx, &reloc, sizeof (reloc));
+  reloc = dump_decode_dump_reloc (lreloc);
+  dump_check_dump_off (ctx, dump_reloc_get_offset (reloc));
+  dump_object_finish (ctx, &reloc, sizeof (reloc));
+  if (dump_reloc_get_offset (reloc) < ctx->header.discardable_start)
+    ctx->number_hot_relocations += 1;
+  else
+    ctx->number_discardable_relocations += 1;
+}
+
+#ifdef ENABLE_CHECKING
+static Lisp_Object
+dump_check_overlap_dump_reloc (Lisp_Object lreloc_a,
+                               Lisp_Object lreloc_b)
+{
+  struct dump_reloc reloc_a = dump_decode_dump_reloc (lreloc_a);
+  struct dump_reloc reloc_b = dump_decode_dump_reloc (lreloc_b);
+  eassert (dump_reloc_get_offset (reloc_a) < dump_reloc_get_offset (reloc_b));
+  return Qnil;
+}
+#endif
+
+/* Translate a Lisp Emacs-relocation descriptor (a list whose first
+   element is one of the EMACS_RELOC_* values, encoded as a fixnum)
+   into an emacs_reloc structure value suitable for writing to the
+   dump file.
+*/
+static struct emacs_reloc
+decode_emacs_reloc (struct dump_context *ctx, Lisp_Object lreloc)
+{
+  struct emacs_reloc reloc;
+  memset (&reloc, 0, sizeof (reloc));
+  ALLOW_IMPLICIT_CONVERSION;
+  int type = XFIXNUM (dump_pop (&lreloc));
+  DISALLOW_IMPLICIT_CONVERSION;
+  reloc.emacs_offset = dump_off_from_lisp (dump_pop (&lreloc));
+  dump_check_emacs_off (reloc.emacs_offset);
+  switch (type)
+    {
+    case RELOC_EMACS_COPY_FROM_DUMP:
+      {
+        emacs_reloc_set_type (&reloc, type);
+        reloc.u.dump_offset = dump_off_from_lisp (dump_pop (&lreloc));
+        dump_check_dump_off (ctx, reloc.u.dump_offset);
+        dump_off length = dump_off_from_lisp (dump_pop (&lreloc));
+        ALLOW_IMPLICIT_CONVERSION;
+        reloc.length = length;
+        DISALLOW_IMPLICIT_CONVERSION;
+        if (reloc.length != length)
+          error ("relocation copy length too large");
+      }
+      break;
+    case RELOC_EMACS_IMMEDIATE:
+      {
+        emacs_reloc_set_type (&reloc, type);
+        intmax_t value = intmax_t_from_lisp (dump_pop (&lreloc));
+        dump_off size = dump_off_from_lisp (dump_pop (&lreloc));
+        reloc.u.immediate = value;
+        ALLOW_IMPLICIT_CONVERSION;
+        reloc.length = size;
+        DISALLOW_IMPLICIT_CONVERSION;
+        eassert (reloc.length == size);
+      }
+      break;
+    case RELOC_EMACS_EMACS_PTR_RAW:
+      emacs_reloc_set_type (&reloc, type);
+      reloc.u.emacs_offset2 = dump_off_from_lisp (dump_pop (&lreloc));
+      dump_check_emacs_off (reloc.u.emacs_offset2);
+      break;
+    case RELOC_EMACS_DUMP_PTR_RAW:
+      emacs_reloc_set_type (&reloc, type);
+      reloc.u.dump_offset = dump_off_from_lisp (dump_pop (&lreloc));
+      dump_check_dump_off (ctx, reloc.u.dump_offset);
+      break;
+    case RELOC_EMACS_DUMP_LV:
+    case RELOC_EMACS_EMACS_LV:
+      {
+        emacs_reloc_set_type (&reloc, type);
+        Lisp_Object target_value = dump_pop (&lreloc);
+        /* If the object is self-representing,
+           dump_emacs_reloc_to_lv didn't do its job.
+           dump_emacs_reloc_to_lv should have added a
+           RELOC_EMACS_IMMEDIATE relocation instead.  */
+        eassert (!dump_object_self_representing_p (target_value));
+        int tag_type = XTYPE (target_value);
+        ALLOW_IMPLICIT_CONVERSION;
+        reloc.length = tag_type;
+        DISALLOW_IMPLICIT_CONVERSION;
+        eassert (reloc.length == tag_type);
+
+        if (type == RELOC_EMACS_EMACS_LV)
+          {
+            void *obj_in_emacs = dump_object_emacs_ptr (target_value);
+            eassert (obj_in_emacs);
+            reloc.u.emacs_offset2 = emacs_offset (obj_in_emacs);
+          }
+        else
+          {
+            eassert (!dump_object_emacs_ptr (target_value));
+            reloc.u.dump_offset = dump_recall_object (ctx, target_value);
+            if (reloc.u.dump_offset <= 0)
+              {
+                Lisp_Object repr = Fprin1_to_string (target_value, Qnil);
+                error ("relocation target was not dumped: %s", SDATA (repr));
+              }
+            dump_check_dump_off (ctx, reloc.u.dump_offset);
+          }
+      }
+      break;
+    default:
+      eassume (!"not reached");
+    }
+
+  /* We should have consumed the whole relocation descriptor.  */
+  eassert (NILP (lreloc));
+
+  return reloc;
+}
+
+static void
+dump_emit_emacs_reloc (struct dump_context *ctx, Lisp_Object lreloc)
+{
+  eassert (ctx->flags.pack_objects);
+  struct emacs_reloc reloc;
+  dump_object_start (ctx, &reloc, sizeof (reloc));
+  reloc = decode_emacs_reloc (ctx, lreloc);
+  dump_object_finish (ctx, &reloc, sizeof (reloc));
+}
+
+static Lisp_Object
+dump_merge_emacs_relocs (Lisp_Object lreloc_a, Lisp_Object lreloc_b)
+{
+  /* Combine copy relocations together if they're copying from
+     adjacent chunks to adjacent chunks.  */
+
+#ifdef ENABLE_CHECKING
+  {
+    dump_off off_a = dump_off_from_lisp (XCAR (XCDR (lreloc_a)));
+    dump_off off_b = dump_off_from_lisp (XCAR (XCDR (lreloc_b)));
+    eassert (off_a <= off_b);  /* Catch sort errors.  */
+    eassert (off_a < off_b);  /* Catch duplicate relocations.  */
+  }
+#endif
+
+  if (XFIXNUM (XCAR (lreloc_a)) != RELOC_EMACS_COPY_FROM_DUMP
+      || XFIXNUM (XCAR (lreloc_b)) != RELOC_EMACS_COPY_FROM_DUMP)
+    return Qnil;
+
+  struct emacs_reloc reloc_a = decode_emacs_reloc (NULL, lreloc_a);
+  struct emacs_reloc reloc_b = decode_emacs_reloc (NULL, lreloc_b);
+
+  eassert (reloc_a.type == RELOC_EMACS_COPY_FROM_DUMP);
+  eassert (reloc_b.type == RELOC_EMACS_COPY_FROM_DUMP);
+
+  if (reloc_a.emacs_offset + reloc_a.length != reloc_b.emacs_offset)
+    return Qnil;
+
+  if (reloc_a.u.dump_offset + reloc_a.length != reloc_b.u.dump_offset)
+    return Qnil;
+
+  dump_off new_length = reloc_a.length + reloc_b.length;
+  ALLOW_IMPLICIT_CONVERSION;
+  reloc_a.length = new_length;
+  DISALLOW_IMPLICIT_CONVERSION;
+  if (reloc_a.length != new_length)
+    return Qnil; /* Overflow */
+
+  return list4 (make_fixnum (RELOC_EMACS_COPY_FROM_DUMP),
+                dump_off_to_lisp (reloc_a.emacs_offset),
+                dump_off_to_lisp (reloc_a.u.dump_offset),
+                dump_off_to_lisp (reloc_a.length));
+}
+
+typedef void (*drain_reloc_handler)(struct dump_context *, Lisp_Object);
+typedef Lisp_Object (*drain_reloc_merger)(Lisp_Object a, Lisp_Object b);
+
+static void
+drain_reloc_list (struct dump_context *ctx,
+                  drain_reloc_handler handler,
+                  drain_reloc_merger merger,
+                  Lisp_Object *reloc_list,
+                  struct dump_table_locator *out_locator)
+{
+  struct dump_flags old_flags = ctx->flags;
+  ctx->flags.pack_objects = true;
+  Lisp_Object relocs = Fsort (Fnreverse (*reloc_list),
+                              Qdump_emacs_portable__sort_predicate);
+  *reloc_list = Qnil;
+  dump_align_output (ctx, sizeof (dump_off));
+  struct dump_table_locator locator;
+  memset (&locator, 0, sizeof (locator));
+  locator.offset = ctx->offset;
+  for (; !NILP (relocs); locator.nr_entries += 1)
+    {
+      Lisp_Object reloc = dump_pop (&relocs);
+      Lisp_Object merged;
+      while (merger != NULL
+            && !NILP (relocs)
+            && (merged = merger (reloc, XCAR (relocs)), !NILP (merged)))
+        {
+          reloc = merged;
+          relocs = XCDR (relocs);
+        }
+      handler (ctx, reloc);
+    }
+  *out_locator = locator;
+  ctx->flags = old_flags;
+}
+
+static void
+dump_do_fixup (struct dump_context *ctx,
+               Lisp_Object fixup,
+               Lisp_Object prev_fixup)
+{
+  enum dump_fixup_type type =
+    (enum dump_fixup_type) XFIXNUM (dump_pop (&fixup));
+  dump_off dump_fixup_offset = dump_off_from_lisp (dump_pop (&fixup));
+#ifdef ENABLE_CHECKING
+  if (!NILP (prev_fixup))
+    {
+      dump_off prev_dump_fixup_offset =
+        dump_off_from_lisp (XCAR (XCDR (prev_fixup)));
+      eassert (dump_fixup_offset - prev_dump_fixup_offset
+              >= sizeof (void *));
+    }
+#endif
+  Lisp_Object arg = dump_pop (&fixup);
+  eassert (NILP (fixup));
+  dump_seek (ctx, dump_fixup_offset);
+  intptr_t dump_value;
+  bool do_write = true;
+  switch (type)
+    {
+    case DUMP_FIXUP_LISP_OBJECT:
+    case DUMP_FIXUP_LISP_OBJECT_RAW:
+      /* Dump wants a pointer to a Lisp object.
+         If DUMP_FIXUP_LISP_OBJECT_RAW, we should stick a C pointer in
+         the dump; otherwise, a Lisp_Object.  */
+      if (SUBRP (arg))
+        {
+          dump_value = emacs_offset (XSUBR (arg));
+          if (type == DUMP_FIXUP_LISP_OBJECT)
+            dump_reloc_dump_to_emacs_lv (ctx, ctx->offset, XTYPE (arg));
+          else
+            dump_reloc_dump_to_emacs_ptr_raw (ctx, ctx->offset);
+        }
+      else if (dump_builtin_symbol_p (arg))
+        {
+          eassert (dump_object_self_representing_p (arg));
+          /* These symbols are part of Emacs, so point there.  If we
+             want a Lisp_Object, we're set.  If we want a raw pointer,
+             we need to emit a relocation.  */
+          if (type == DUMP_FIXUP_LISP_OBJECT)
+            {
+              do_write = false;
+              dump_write (ctx, &arg, sizeof (arg));
+            }
+          else
+            {
+              dump_value = emacs_offset (XSYMBOL (arg));
+              dump_reloc_dump_to_emacs_ptr_raw (ctx, ctx->offset);
+            }
+        }
+      else
+        {
+          eassert (dump_object_emacs_ptr (arg) == NULL);
+          dump_value = dump_recall_object (ctx, arg);
+          if (dump_value <= 0)
+            error ("fixup object not dumped");
+          if (type == DUMP_FIXUP_LISP_OBJECT)
+            dump_reloc_dump_to_dump_lv (ctx, ctx->offset, XTYPE (arg));
+          else
+            dump_reloc_dump_to_dump_ptr_raw (ctx, ctx->offset);
+        }
+      break;
+    case DUMP_FIXUP_PTR_DUMP_RAW:
+      /* Dump wants a raw pointer to something that's not a lisp
+         object.  It knows the exact location it wants, so just
+         believe it.  */
+      dump_value = dump_off_from_lisp (arg);
+      dump_reloc_dump_to_dump_ptr_raw (ctx, ctx->offset);
+      break;
+    case DUMP_FIXUP_BIGNUM_DATA:
+      {
+        eassert (BIGNUMP (arg));
+        arg = Fgethash (arg, ctx->bignum_data, Qnil);
+        if (NILP (arg))
+          error ("bignum not dumped");
+        struct bignum_reload_info reload_info = { 0 };
+        reload_info.data_location = dump_off_from_lisp (dump_pop (&arg));
+        reload_info.nlimbs = dump_off_from_lisp (dump_pop (&arg));
+        eassert (NILP (arg));
+        dump_write (ctx, &reload_info, sizeof (reload_info));
+        do_write = false;
+        break;
+      }
+    default:
+      emacs_abort ();
+    }
+  if (do_write)
+    dump_write (ctx, &dump_value, sizeof (dump_value));
+}
+
+static void
+dump_do_fixups (struct dump_context *ctx)
+{
+  dump_off saved_offset = ctx->offset;
+  Lisp_Object fixups = Fsort (Fnreverse (ctx->fixups),
+                              Qdump_emacs_portable__sort_predicate);
+  Lisp_Object prev_fixup = Qnil;
+  ctx->fixups = Qnil;
+  while (!NILP (fixups))
+    {
+      Lisp_Object fixup = dump_pop (&fixups);
+      dump_do_fixup (ctx, fixup, prev_fixup);
+      prev_fixup = fixup;
+    }
+  dump_seek (ctx, saved_offset);
+}
+
+static void
+dump_drain_normal_queue (struct dump_context *ctx)
+{
+  while (!dump_queue_empty_p (&ctx->dump_queue))
+    dump_object (ctx, dump_queue_dequeue (&ctx->dump_queue, ctx->offset));
+}
+
+static void
+dump_drain_deferred_hash_tables (struct dump_context *ctx)
+{
+  struct dump_flags old_flags = ctx->flags;
+
+  /* Now we want to actually write the hash tables.  */
+  ctx->flags.defer_hash_tables = false;
+
+  Lisp_Object deferred_hash_tables = Fnreverse (ctx->deferred_hash_tables);
+  ctx->deferred_hash_tables = Qnil;
+  while (!NILP (deferred_hash_tables))
+    dump_object (ctx, dump_pop (&deferred_hash_tables));
+  ctx->flags = old_flags;
+}
+
+static void
+dump_drain_deferred_symbols (struct dump_context *ctx)
+{
+  struct dump_flags old_flags = ctx->flags;
+
+  /* Now we want to actually write the symbols.  */
+  ctx->flags.defer_symbols = false;
+
+  Lisp_Object deferred_symbols = Fnreverse (ctx->deferred_symbols);
+  ctx->deferred_symbols = Qnil;
+  while (!NILP (deferred_symbols))
+    dump_object (ctx, dump_pop (&deferred_symbols));
+  ctx->flags = old_flags;
+}
+
+DEFUN ("dump-emacs-portable",
+       Fdump_emacs_portable, Sdump_emacs_portable,
+       1, 2, 0,
+       doc: /* Dump current state of Emacs into portable dump file FILENAME.
+If TRACK-REFERRERS is non-nil, keep additional debugging information
+that can help track down the provenance of unsupported object
+types.  */)
+     (Lisp_Object filename, Lisp_Object track_referrers)
+{
+  eassert (initialized);
+
+  if (will_dump_with_unexec_p ())
+    error ("This Emacs instance was started under the assumption "
+           "that it would be dumped with unexec, not the portable "
+           "dumper.  Dumping with the portable dumper may produce "
+           "unexpected results.");
+
+  if (!main_thread_p (current_thread))
+    error ("This function can be called only in the main thread");
+
+  if (!NILP (XCDR (Fall_threads ())))
+    error ("No other Lisp threads can be running when this function is 
called");
+
+  /* Clear out any detritus in memory.  */
+  do
+    {
+      number_finalizers_run = 0;
+      garbage_collect ();
+    }
+  while (number_finalizers_run);
+
+  ptrdiff_t count = SPECPDL_INDEX ();
+
+  /* Bind `command-line-processed' to nil before dumping,
+     so that the dumped Emacs will process its command line
+     and set up to work with X windows if appropriate.  */
+  Lisp_Object symbol = intern ("command-line-processed");
+  specbind (symbol, Qnil);
+
+  /* Reset process-environment -- this is for when they re-dump a
+     pdump-restored emacs, since set_initial_environment wants always
+     to cons it from scratch.  */
+  Vprocess_environment = Qnil;
+  garbage_collect ();
+
+  CHECK_STRING (filename);
+  filename = Fexpand_file_name (filename, Qnil);
+  filename = ENCODE_FILE (filename);
+
+  struct dump_context ctx_buf;
+  struct dump_context *ctx = &ctx_buf;
+  memset (ctx, 0, sizeof (*ctx));
+  ctx->fd = -1;
+
+  ctx->objects_dumped = make_eq_hash_table ();
+  dump_queue_init (&ctx->dump_queue);
+  ctx->deferred_hash_tables = Qnil;
+  ctx->deferred_symbols = Qnil;
+
+  ctx->fixups = Qnil;
+  ctx->staticpro_table = CALLN (Fmake_hash_table);
+  ctx->symbol_aux = Qnil;
+  ctx->copied_queue = Qnil;
+  ctx->cold_queue = Qnil;
+  ctx->dump_relocs = Qnil;
+  ctx->object_starts = Qnil;
+  ctx->emacs_relocs = Qnil;
+  ctx->bignum_data = make_eq_hash_table ();
+
+  /* Ordinarily, dump_object should remember where it saw objects and
+     actually write the object contents to the dump file.  In special
+     circumstances below, we temporarily change this default
+     behavior.  */
+  ctx->flags.dump_object_contents = true;
+  ctx->flags.record_object_starts = true;
+
+  /* We want to consolidate certain object types that we know are very likely
+     to be modified.  */
+  ctx->flags.defer_hash_tables = true;
+  /* ctx->flags.defer_symbols = true; XXX  */
+
+  /* These objects go into special sections.  */
+  ctx->flags.defer_cold_objects = true;
+  ctx->flags.defer_copied_objects = true;
+
+  ctx->current_referrer = Qnil;
+  if (!NILP (track_referrers))
+    ctx->referrers = make_eq_hash_table ();
+
+  ctx->dump_filename = filename;
+
+  record_unwind_protect_ptr (dump_unwind_cleanup, ctx);
+  block_input ();
+
+#ifdef REL_ALLOC
+  r_alloc_inhibit_buffer_relocation (1);
+  ctx->blocked_ralloc = true;
+#endif
+
+  ctx->old_purify_flag = Vpurify_flag;
+  Vpurify_flag = Qnil;
+
+  /* Make sure various weird things are less likely to happen.  */
+  ctx->old_post_gc_hook = Vpost_gc_hook;
+  Vpost_gc_hook = Qnil;
+
+  ctx->fd = emacs_open (SSDATA (filename),
+                        O_RDWR | O_TRUNC | O_CREAT, 0666);
+  if (ctx->fd < 0)
+    report_file_error ("Opening dump output", filename);
+  verify (sizeof (ctx->header.magic) == sizeof (dump_magic));
+  memcpy (&ctx->header.magic, dump_magic, sizeof (dump_magic));
+  ctx->header.magic[0] = '!'; /* Note that dump is incomplete.  */
+
+  verify (sizeof (fingerprint) == sizeof (ctx->header.fingerprint));
+  memcpy (ctx->header.fingerprint, fingerprint, sizeof (fingerprint));
+
+  const dump_off header_start = ctx->offset;
+  dump_fingerprint ("dumping fingerprint", ctx->header.fingerprint);
+  dump_write (ctx, &ctx->header, sizeof (ctx->header));
+  const dump_off header_end = ctx->offset;
+
+  const dump_off hot_start = ctx->offset;
+  /* Start the dump process by processing the static roots and
+     queuing up the objects to which they refer.   */
+  dump_roots (ctx);
+
+  dump_charset_table (ctx);
+  dump_finalizer_list_head_ptr (ctx, &finalizers.prev);
+  dump_finalizer_list_head_ptr (ctx, &finalizers.next);
+  dump_finalizer_list_head_ptr (ctx, &doomed_finalizers.prev);
+  dump_finalizer_list_head_ptr (ctx, &doomed_finalizers.next);
+  dump_drain_user_remembered_data_hot (ctx);
+
+  /* We've already remembered all the objects to which GC roots point,
+     but we have to manually save the list of GC roots itself.  */
+  dump_metadata_for_pdumper (ctx);
+  for (int i = 0; i < staticidx; ++i)
+    dump_emacs_reloc_to_emacs_ptr_raw (ctx, &staticvec[i], staticvec[i]);
+  dump_emacs_reloc_immediate_int (ctx, &staticidx, staticidx);
+
+  /* Dump until while we keep finding objects to dump.  We add new
+     objects to the queue by side effect during dumping.
+     We accumulate some types of objects in special lists to get more
+     locality for these object types at runtime.  */
+  do
+    {
+      dump_drain_deferred_hash_tables (ctx);
+      dump_drain_deferred_symbols (ctx);
+      dump_drain_normal_queue (ctx);
+    }
+  while (!dump_queue_empty_p (&ctx->dump_queue)
+        || !NILP (ctx->deferred_hash_tables)
+        || !NILP (ctx->deferred_symbols));
+
+  dump_sort_copied_objects (ctx);
+
+  /* While we copy built-in symbols into the Emacs image, these
+     built-in structures refer to non-Lisp heap objects that must live
+     in the dump; we stick these auxiliary data structures at the end
+     of the hot section and use a special hash table to remember them.
+     The actual symbol dump will pick them up below.  */
+  ctx->symbol_aux = make_eq_hash_table ();
+  dump_hot_parts_of_discardable_objects (ctx);
+
+  /* Emacs, after initial dump loading, can forget about the portion
+     of the dump that runs from here to the start of the cold section.
+     This section consists of objects that need to be memcpy()ed into
+     the Emacs data section instead of just used directly.
+
+     We don't need to align hot_end: the loader knows to actually
+     start discarding only at the next page boundary if the loader
+     implements discarding using page manipulation.  */
+  const dump_off hot_end = ctx->offset;
+  ctx->header.discardable_start = hot_end;
+
+  dump_drain_copied_objects (ctx);
+  eassert (dump_queue_empty_p (&ctx->dump_queue));
+
+  dump_off discardable_end = ctx->offset;
+  dump_align_output (ctx, dump_get_page_size ());
+  ctx->header.cold_start = ctx->offset;
+
+  /* Start the cold section.  This section contains bytes that should
+     never change and so can be direct-mapped from the dump without
+     special processing.  */
+  dump_drain_cold_data (ctx);
+   /* dump_drain_user_remembered_data_cold needs to be after
+      dump_drain_cold_data in case dump_drain_cold_data dumps a lisp
+      object to which C code points.
+      dump_drain_user_remembered_data_cold assumes that all lisp
+      objects have been dumped.  */
+  dump_drain_user_remembered_data_cold (ctx);
+
+  /* After this point, the dump file contains no data that can be part
+     of the Lisp heap.  */
+  ctx->end_heap = ctx->offset;
+
+  /* Make remembered modifications to the dump file itself.  */
+  dump_do_fixups (ctx);
+
+  drain_reloc_merger emacs_reloc_merger =
+#ifdef ENABLE_CHECKING
+    dump_check_overlap_dump_reloc
+#else
+    NULL
+#endif
+    ;
+
+  /* Emit instructions for Emacs to execute when loading the dump.
+     Note that this relocation information ends up in the cold section
+     of the dump.  */
+  drain_reloc_list (ctx, dump_emit_dump_reloc, emacs_reloc_merger,
+                   &ctx->dump_relocs, &ctx->header.dump_relocs);
+  unsigned number_hot_relocations = ctx->number_hot_relocations;
+  ctx->number_hot_relocations = 0;
+  unsigned number_discardable_relocations = 
ctx->number_discardable_relocations;
+  ctx->number_discardable_relocations = 0;
+  drain_reloc_list (ctx, dump_emit_dump_reloc, emacs_reloc_merger,
+                   &ctx->object_starts, &ctx->header.object_starts);
+  drain_reloc_list (ctx, dump_emit_emacs_reloc, dump_merge_emacs_relocs,
+                   &ctx->emacs_relocs, &ctx->header.emacs_relocs);
+
+  const dump_off cold_end = ctx->offset;
+
+  eassert (dump_queue_empty_p (&ctx->dump_queue));
+  eassert (NILP (ctx->copied_queue));
+  eassert (NILP (ctx->cold_queue));
+  eassert (NILP (ctx->deferred_symbols));
+  eassert (NILP (ctx->deferred_hash_tables));
+  eassert (NILP (ctx->fixups));
+  eassert (NILP (ctx->dump_relocs));
+  eassert (NILP (ctx->emacs_relocs));
+
+  /* Dump is complete.  Go back to the header and write the magic
+     indicating that the dump is complete and can be loaded.  */
+  ctx->header.magic[0] = dump_magic[0];
+  dump_seek (ctx, 0);
+  dump_write (ctx, &ctx->header, sizeof (ctx->header));
+
+  fprintf (stderr, "Dump complete\n");
+  fprintf (stderr,
+           "Byte counts: header=%lu hot=%lu discardable=%lu cold=%lu\n",
+           (unsigned long) (header_end - header_start),
+           (unsigned long) (hot_end - hot_start),
+           (unsigned long) (discardable_end - ctx->header.discardable_start),
+           (unsigned long) (cold_end - ctx->header.cold_start));
+  fprintf (stderr, "Reloc counts: hot=%u discardable=%u\n",
+           number_hot_relocations,
+           number_discardable_relocations);
+
+  unblock_input ();
+  return unbind_to (count, Qnil);
+}
+
+DEFUN ("dump-emacs-portable--sort-predicate",
+       Fdump_emacs_portable__sort_predicate,
+       Sdump_emacs_portable__sort_predicate,
+       2, 2, 0,
+       doc: /* Internal relocation sorting function.  */)
+     (Lisp_Object a, Lisp_Object b)
+{
+  dump_off a_offset = dump_off_from_lisp (XCAR (XCDR (a)));
+  dump_off b_offset = dump_off_from_lisp (XCAR (XCDR (b)));
+  return a_offset < b_offset ? Qt : Qnil;
+}
+
+DEFUN ("dump-emacs-portable--sort-predicate-copied",
+       Fdump_emacs_portable__sort_predicate_copied,
+       Sdump_emacs_portable__sort_predicate_copied,
+       2, 2, 0,
+       doc: /* Internal relocation sorting function.  */)
+     (Lisp_Object a, Lisp_Object b)
+{
+  eassert (dump_object_emacs_ptr (a));
+  eassert (dump_object_emacs_ptr (b));
+  return dump_object_emacs_ptr (a) < dump_object_emacs_ptr (b) ? Qt : Qnil;
+}
+
+void
+pdumper_do_now_and_after_load_impl (pdumper_hook hook)
+{
+  if (nr_dump_hooks == ARRAYELTS (dump_hooks))
+    fatal ("out of dump hooks: make dump_hooks[] bigger");
+  dump_hooks[nr_dump_hooks++] = hook;
+  hook ();
+}
+
+static void
+pdumper_remember_user_data_1 (void *mem, int nbytes)
+{
+  if (nr_remembered_data == ARRAYELTS (remembered_data))
+    fatal ("out of remembered data slots: make remembered_data[] bigger");
+  remembered_data[nr_remembered_data].mem = mem;
+  remembered_data[nr_remembered_data].sz = nbytes;
+  nr_remembered_data += 1;
+}
+
+void
+pdumper_remember_scalar_impl (void *mem, ptrdiff_t nbytes)
+{
+  eassert (0 <= nbytes && nbytes <= INT_MAX);
+  if (nbytes > 0)
+    pdumper_remember_user_data_1 (mem, (int) nbytes);
+}
+
+void
+pdumper_remember_lv_ptr_raw_impl (void *ptr, enum Lisp_Type type)
+{
+  pdumper_remember_user_data_1 (ptr, -type);
+}
+
+
+/* Dump runtime */
+enum dump_memory_protection
+{
+  DUMP_MEMORY_ACCESS_NONE = 1,
+  DUMP_MEMORY_ACCESS_READ = 2,
+  DUMP_MEMORY_ACCESS_READWRITE = 3,
+};
+
+static void *
+dump_anonymous_allocate_w32 (void *base,
+                             size_t size,
+                             enum dump_memory_protection protection)
+{
+#if VM_SUPPORTED != VM_MS_WINDOWS
+  (void) base;
+  (void) size;
+  (void) protection;
+  emacs_abort ();
+#else
+  void *ret;
+  DWORD mem_type;
+  DWORD mem_prot;
+
+  switch (protection)
+    {
+    case DUMP_MEMORY_ACCESS_NONE:
+      mem_type = MEM_RESERVE;
+      mem_prot = PAGE_NOACCESS;
+      break;
+    case DUMP_MEMORY_ACCESS_READ:
+      mem_type = MEM_COMMIT;
+      mem_prot = PAGE_READONLY;
+      break;
+    case DUMP_MEMORY_ACCESS_READWRITE:
+      mem_type = MEM_COMMIT;
+      mem_prot = PAGE_READWRITE;
+      break;
+    default:
+      emacs_abort ();
+    }
+
+  ret = VirtualAlloc (base, size, mem_type, mem_prot);
+  if (ret == NULL)
+    errno = (base && GetLastError () == ERROR_INVALID_ADDRESS)
+      ? EBUSY
+      : EPERM;
+  return ret;
+#endif
+}
+
+/* Old versions of macOS only define MAP_ANON, not MAP_ANONYMOUS.
+   FIXME: This probably belongs elsewhere (gnulib/autoconf?)  */
+#ifndef MAP_ANONYMOUS
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+
+static void *
+dump_anonymous_allocate_posix (void *base,
+                               size_t size,
+                               enum dump_memory_protection protection)
+{
+#if VM_SUPPORTED != VM_POSIX
+  (void) base;
+  (void) size;
+  (void) protection;
+  emacs_abort ();
+#else
+  void *ret;
+  int mem_prot;
+
+  switch (protection)
+    {
+    case DUMP_MEMORY_ACCESS_NONE:
+      mem_prot = PROT_NONE;
+      break;
+    case DUMP_MEMORY_ACCESS_READ:
+      mem_prot = PROT_READ;
+      break;
+    case DUMP_MEMORY_ACCESS_READWRITE:
+      mem_prot = PROT_READ | PROT_WRITE;
+      break;
+    default:
+      emacs_abort ();
+    }
+
+  int mem_flags = MAP_PRIVATE | MAP_ANONYMOUS;
+  if (mem_prot != PROT_NONE)
+    mem_flags |= MAP_POPULATE;
+  if (base)
+    mem_flags |= MAP_FIXED;
+
+  bool retry;
+  do
+    {
+      retry = false;
+      ret = mmap (base, size, mem_prot, mem_flags, -1, 0);
+      if (ret == MAP_FAILED
+         && errno == EINVAL
+         && (mem_flags & MAP_POPULATE))
+        {
+          /* This system didn't understand MAP_POPULATE, so try
+             again without it.  */
+          mem_flags &= ~MAP_POPULATE;
+          retry = true;
+        }
+    }
+  while (retry);
+
+  if (ret == MAP_FAILED)
+    ret = NULL;
+  return ret;
+#endif
+}
+
+/* Perform anonymous memory allocation.  */
+static void *
+dump_anonymous_allocate (void *base,
+                         const size_t size,
+                         enum dump_memory_protection protection)
+{
+  void *ret = NULL;
+  if (VM_SUPPORTED == VM_MS_WINDOWS)
+    ret = dump_anonymous_allocate_w32 (base, size, protection);
+  else if (VM_SUPPORTED == VM_POSIX)
+    ret = dump_anonymous_allocate_posix (base, size, protection);
+  else
+    errno = ENOSYS;
+  return ret;
+}
+
+/* Undo the effect of dump_reserve_address_space().  */
+static void
+dump_anonymous_release (void *addr, size_t size)
+{
+  eassert (size >= 0);
+#if VM_SUPPORTED == VM_MS_WINDOWS
+  (void) size;
+  if (!VirtualFree (addr, 0, MEM_RELEASE))
+    emacs_abort ();
+#elif VM_SUPPORTED == VM_POSIX
+  if (munmap (addr, size) < 0)
+    emacs_abort ();
+#else
+  (void) addr;
+  (void) size;
+  emacs_abort ();
+#endif
+}
+
+static void *
+dump_map_file_w32 (void *base, int fd, off_t offset, size_t size,
+                  enum dump_memory_protection protection)
+{
+#if VM_SUPPORTED != VM_MS_WINDOWS
+  (void) base;
+  (void) fd;
+  (void) offset;
+  (void) size;
+  (void) protection;
+  emacs_abort ();
+#else
+  void *ret = NULL;
+  HANDLE section = NULL;
+  HANDLE file;
+
+  uint64_t full_offset = offset;
+  uint32_t offset_high = (uint32_t) (full_offset >> 32);
+  uint32_t offset_low = (uint32_t) (full_offset & 0xffffffff);
+
+  int error;
+  DWORD map_access;
+
+  file = (HANDLE) _get_osfhandle (fd);
+  if (file == INVALID_HANDLE_VALUE)
+    goto out;
+
+  section = CreateFileMapping (file,
+                              /*lpAttributes=*/NULL,
+                              PAGE_READONLY,
+                              /*dwMaximumSizeHigh=*/0,
+                              /*dwMaximumSizeLow=*/0,
+                              /*lpName=*/NULL);
+  if (!section)
+    {
+      errno = EINVAL;
+      goto out;
+    }
+
+  switch (protection)
+    {
+    case DUMP_MEMORY_ACCESS_NONE:
+    case DUMP_MEMORY_ACCESS_READ:
+      map_access = FILE_MAP_READ;
+      break;
+    case DUMP_MEMORY_ACCESS_READWRITE:
+      map_access = FILE_MAP_COPY;
+      break;
+    default:
+      emacs_abort ();
+    }
+
+  ret = MapViewOfFileEx (section,
+                         map_access,
+                         offset_high,
+                         offset_low,
+                         size,
+                         base);
+
+  error = GetLastError ();
+  if (ret == NULL)
+    errno = (error == ERROR_INVALID_ADDRESS ? EBUSY : EPERM);
+ out:
+  if (section && !CloseHandle (section))
+    emacs_abort ();
+  return ret;
+#endif
+}
+
+static void *
+dump_map_file_posix (void *base, int fd, off_t offset, size_t size,
+                    enum dump_memory_protection protection)
+{
+#if VM_SUPPORTED != VM_POSIX
+  (void) base;
+  (void) fd;
+  (void) offset;
+  (void) size;
+  (void) protection;
+  emacs_abort ();
+#else
+  void *ret;
+  int mem_prot;
+  int mem_flags;
+
+  switch (protection)
+    {
+    case DUMP_MEMORY_ACCESS_NONE:
+      mem_prot = PROT_NONE;
+      mem_flags = MAP_SHARED;
+      break;
+    case DUMP_MEMORY_ACCESS_READ:
+      mem_prot = PROT_READ;
+      mem_flags = MAP_SHARED;
+      break;
+    case DUMP_MEMORY_ACCESS_READWRITE:
+      mem_prot = PROT_READ | PROT_WRITE;
+      mem_flags = MAP_PRIVATE;
+      break;
+    default:
+      emacs_abort ();
+    }
+
+  if (base)
+    mem_flags |= MAP_FIXED;
+
+  ret = mmap (base, size, mem_prot, mem_flags, fd, offset);
+  if (ret == MAP_FAILED)
+    ret = NULL;
+  return ret;
+#endif
+}
+
+/* Map a file into memory.  */
+static void *
+dump_map_file (void *base, int fd, off_t offset, size_t size,
+              enum dump_memory_protection protection)
+{
+  void *ret = NULL;
+  if (VM_SUPPORTED == VM_MS_WINDOWS)
+    ret = dump_map_file_w32 (base, fd, offset, size, protection);
+  else if (VM_SUPPORTED == VM_POSIX)
+    ret = dump_map_file_posix (base, fd, offset, size, protection);
+  else
+    errno = ENOSYS;
+  return ret;
+}
+
+/* Remove a virtual memory mapping.
+
+   On failure, abort Emacs.  For maximum platform compatibility, ADDR
+   and SIZE must match the mapping exactly.  */
+static void
+dump_unmap_file (void *addr, size_t size)
+{
+  eassert (size >= 0);
+#if !VM_SUPPORTED
+  (void) addr;
+  (void) size;
+  emacs_abort ();
+#elif defined (WINDOWSNT)
+  (void) size;
+  if (!UnmapViewOfFile (addr))
+    emacs_abort ();
+#else
+  if (munmap (addr, size) < 0)
+    emacs_abort ();
+#endif
+}
+
+struct dump_memory_map_spec
+{
+  int fd;  /* File to map; anon zero if negative.  */
+  size_t size;  /* Number of bytes to map.  */
+  off_t offset;  /* Offset within fd.  */
+  enum dump_memory_protection protection;
+};
+
+struct dump_memory_map
+{
+  struct dump_memory_map_spec spec;
+  void *mapping;  /* Actual mapped memory.  */
+  void (*release)(struct dump_memory_map *);
+  void *private;
+};
+
+/* Mark the pages as unneeded, potentially zeroing them, without
+   releasing the address space reservation.  */
+static void
+dump_discard_mem (void *mem, size_t size)
+{
+#if VM_SUPPORTED == VM_MS_WINDOWS
+      /* Discard COWed pages.  */
+      (void) VirtualFree (mem, size, MEM_DECOMMIT);
+      /* Release the commit charge for the mapping.  */
+      DWORD old_prot;
+      (void) VirtualProtect (mem, size, PAGE_NOACCESS, &old_prot);
+#elif VM_SUPPORTED == VM_POSIX
+# ifdef HAVE_POSIX_MADVISE
+      /* Discard COWed pages.  */
+      (void) posix_madvise (mem, size, POSIX_MADV_DONTNEED);
+# endif
+      /* Release the commit charge for the mapping.  */
+      (void) mprotect (mem, size, PROT_NONE);
+#endif
+}
+
+static void
+dump_mmap_discard_contents (struct dump_memory_map *map)
+{
+  if (map->mapping)
+    dump_discard_mem (map->mapping, map->spec.size);
+}
+
+static void
+dump_mmap_reset (struct dump_memory_map *map)
+{
+  map->mapping = NULL;
+  map->release = NULL;
+  void *private = map->private;
+  map->private = NULL;
+  free (private);
+}
+
+static void
+dump_mmap_release (struct dump_memory_map *map)
+{
+  if (map->release)
+    map->release (map);
+  dump_mmap_reset (map);
+}
+
+/* Allows heap-allocated dump_mmap to "free" maps individually.  */
+struct dump_memory_map_heap_control_block
+{
+  int refcount;
+  void *mem;
+};
+
+static void
+dump_mm_heap_cb_release (struct dump_memory_map_heap_control_block *cb)
+{
+  eassert (cb->refcount > 0);
+  if (--cb->refcount == 0)
+    free (cb->mem);
+}
+
+static void
+dump_mmap_release_heap (struct dump_memory_map *map)
+{
+  dump_mm_heap_cb_release (map->private);
+}
+
+/* Implement dump_mmap using malloc and read.  */
+static bool
+dump_mmap_contiguous_heap (struct dump_memory_map *maps, int nr_maps,
+                          size_t total_size)
+{
+  bool ret = false;
+  struct dump_memory_map_heap_control_block *cb = calloc (1, sizeof (*cb));
+  char *mem;
+  if (!cb)
+    goto out;
+  cb->refcount = 1;
+  cb->mem = malloc (total_size);
+  if (!cb->mem)
+    goto out;
+  mem = cb->mem;
+  for (int i = 0; i < nr_maps; ++i)
+    {
+      struct dump_memory_map *map = &maps[i];
+      const struct dump_memory_map_spec spec = map->spec;
+      if (!spec.size)
+        continue;
+      map->mapping = mem;
+      mem += spec.size;
+      map->release = dump_mmap_release_heap;
+      map->private = cb;
+      cb->refcount += 1;
+      if (spec.fd < 0)
+        memset (map->mapping, 0, spec.size);
+      else
+        {
+          if (lseek (spec.fd, spec.offset, SEEK_SET) < 0)
+            goto out;
+          ssize_t nb = dump_read_all (spec.fd,
+                                      map->mapping,
+                                      spec.size);
+          if (nb >= 0 && nb != spec.size)
+            errno = EIO;
+          if (nb != spec.size)
+            goto out;
+        }
+    }
+
+  ret = true;
+ out:
+  dump_mm_heap_cb_release (cb);
+  if (!ret)
+    for (int i = 0; i < nr_maps; ++i)
+      dump_mmap_release (&maps[i]);
+  return ret;
+}
+
+static void
+dump_mmap_release_vm (struct dump_memory_map *map)
+{
+  if (map->spec.fd < 0)
+    dump_anonymous_release (map->mapping, map->spec.size);
+  else
+    dump_unmap_file (map->mapping, map->spec.size);
+}
+
+static bool
+needs_mmap_retry_p (void)
+{
+#if defined (CYGWIN) || VM_SUPPORTED == VM_MS_WINDOWS
+  return true;
+#else
+  return false;
+#endif
+}
+
+static bool
+dump_mmap_contiguous_vm (struct dump_memory_map *maps, int nr_maps,
+                        size_t total_size)
+{
+  bool ret = false;
+  void *resv = NULL;
+  bool retry = false;
+  const bool need_retry = needs_mmap_retry_p ();
+
+  do
+    {
+      if (retry)
+        {
+          eassert (need_retry);
+          retry = false;
+          for (int i = 0; i < nr_maps; ++i)
+            dump_mmap_release (&maps[i]);
+        }
+
+      eassert (resv == NULL);
+      resv = dump_anonymous_allocate (NULL,
+                                      total_size,
+                                      DUMP_MEMORY_ACCESS_NONE);
+      if (!resv)
+        goto out;
+
+      char *mem = resv;
+
+      if (need_retry)
+        {
+          /* Windows lacks atomic mapping replace; need to release the
+             reservation so we can allocate within it.  Will retry the
+             loop if someone squats on our address space before we can
+             finish allocation.  On POSIX systems, we leave the
+             reservation around for atomicity.  */
+          dump_anonymous_release (resv, total_size);
+          resv = NULL;
+        }
+
+      for (int i = 0; i < nr_maps; ++i)
+        {
+          struct dump_memory_map *map = &maps[i];
+          const struct dump_memory_map_spec spec = map->spec;
+          if (!spec.size)
+            continue;
+
+          if (spec.fd < 0)
+           map->mapping = dump_anonymous_allocate (mem, spec.size,
+                                                   spec.protection);
+          else
+           map->mapping = dump_map_file (mem, spec.fd, spec.offset,
+                                         spec.size, spec.protection);
+          mem += spec.size;
+         if (need_retry && map->mapping == NULL
+             && (errno == EBUSY
+#ifdef CYGWIN
+                 || errno == EINVAL
+#endif
+                 ))
+            {
+              retry = true;
+              continue;
+            }
+          if (map->mapping == NULL)
+            goto out;
+          map->release = dump_mmap_release_vm;
+        }
+    }
+  while (retry);
+
+  ret = true;
+  resv = NULL;
+ out:
+  if (resv)
+    dump_anonymous_release (resv, total_size);
+  if (!ret)
+    {
+      for (int i = 0; i < nr_maps; ++i)
+       {
+         if (need_retry)
+           dump_mmap_reset (&maps[i]);
+         else
+           dump_mmap_release (&maps[i]);
+       }
+    }
+  return ret;
+}
+
+/* Map a range of addresses into a chunk of contiguous memory.
+
+   Each dump_memory_map structure describes how to fill the
+   corresponding range of memory. On input, all members except MAPPING
+   are valid. On output, MAPPING contains the location of the given
+   chunk of memory. The MAPPING for MAPS[N] is MAPS[N-1].mapping +
+   MAPS[N-1].size.
+
+   Each mapping SIZE must be a multiple of the system page size except
+   for the last mapping.
+
+   Return true on success or false on failure with errno set.  */
+static bool
+dump_mmap_contiguous (struct dump_memory_map *maps, int nr_maps)
+{
+  if (!nr_maps)
+    return true;
+
+  size_t total_size = 0;
+  int worst_case_page_size = dump_get_page_size ();
+
+  for (int i = 0; i < nr_maps; ++i)
+    {
+      eassert (maps[i].mapping == NULL);
+      eassert (maps[i].release == NULL);
+      eassert (maps[i].private == NULL);
+      if (i != nr_maps - 1)
+        eassert (maps[i].spec.size % worst_case_page_size == 0);
+      total_size += maps[i].spec.size;
+    }
+
+  return (VM_SUPPORTED ? dump_mmap_contiguous_vm : dump_mmap_contiguous_heap)
+    (maps, nr_maps, total_size);
+}
+
+typedef uint_fast32_t dump_bitset_word;
+
+struct dump_bitset
+{
+  dump_bitset_word *restrict bits;
+  ptrdiff_t number_words;
+};
+
+static bool
+dump_bitset_init (struct dump_bitset *bitset, size_t number_bits)
+{
+  int xword_size = sizeof (bitset->bits[0]);
+  int bits_per_word = xword_size * CHAR_BIT;
+  ptrdiff_t words_needed = DIVIDE_ROUND_UP (number_bits, bits_per_word);
+  bitset->number_words = words_needed;
+  bitset->bits = calloc (words_needed, xword_size);
+  return bitset->bits != NULL;
+}
+
+static dump_bitset_word *
+dump_bitset__bit_slot (const struct dump_bitset *bitset,
+                       size_t bit_number)
+{
+  int xword_size = sizeof (bitset->bits[0]);
+  int bits_per_word = xword_size * CHAR_BIT;
+  ptrdiff_t word_number = bit_number / bits_per_word;
+  eassert (word_number < bitset->number_words);
+  return &bitset->bits[word_number];
+}
+
+static bool
+dump_bitset_bit_set_p (const struct dump_bitset *bitset,
+                       size_t bit_number)
+{
+  unsigned xword_size = sizeof (bitset->bits[0]);
+  unsigned bits_per_word = xword_size * CHAR_BIT;
+  dump_bitset_word bit = 1;
+  bit <<= bit_number % bits_per_word;
+  return *dump_bitset__bit_slot (bitset, bit_number) & bit;
+}
+
+static void
+dump_bitset__set_bit_value (struct dump_bitset *bitset,
+                            size_t bit_number,
+                            bool bit_is_set)
+{
+  int xword_size = sizeof (bitset->bits[0]);
+  int bits_per_word = xword_size * CHAR_BIT;
+  dump_bitset_word *slot = dump_bitset__bit_slot (bitset, bit_number);
+  dump_bitset_word bit = 1;
+  bit <<= bit_number % bits_per_word;
+  if (bit_is_set)
+    *slot = *slot | bit;
+  else
+    *slot = *slot & ~bit;
+}
+
+static void
+dump_bitset_set_bit (struct dump_bitset *bitset, size_t bit_number)
+{
+  dump_bitset__set_bit_value (bitset, bit_number, true);
+}
+
+static void
+dump_bitset_clear (struct dump_bitset *bitset)
+{
+  int xword_size = sizeof (bitset->bits[0]);
+  memset (bitset->bits, 0, bitset->number_words * xword_size);
+}
+
+struct pdumper_loaded_dump_private
+{
+  /* Copy of the header we read from the dump.  */
+  struct dump_header header;
+  /* Mark bits for objects in the dump; used during GC.  */
+  struct dump_bitset mark_bits;
+  /* Time taken to load the dump.  */
+  double load_time;
+  /* Dump file name.  */
+  char *dump_filename;
+};
+
+struct pdumper_loaded_dump dump_public;
+static struct pdumper_loaded_dump_private dump_private;
+
+/* Return a pointer to offset OFFSET within the dump, which begins at
+   DUMP_BASE. DUMP_BASE must be equal to the current dump load
+   location; it's passed as a parameter for efficiency.
+
+   The returned pointer points to the primary memory image of the
+   currently-loaded dump file.  The entire dump file is accessible
+   using this function.  */
+static void *
+dump_ptr (uintptr_t dump_base, dump_off offset)
+{
+  eassert (dump_base == dump_public.start);
+  eassert (0 <= offset);
+  eassert (dump_public.start + offset < dump_public.end);
+  return (char *)dump_base + offset;
+}
+
+/* Read a pointer-sized word of memory at OFFSET within the dump,
+   which begins at DUMP_BASE. DUMP_BASE must be equal to the current
+   dump load location; it's passed as a parameter for efficiency.  */
+static uintptr_t
+dump_read_word_from_dump (uintptr_t dump_base, dump_off offset)
+{
+  uintptr_t value;
+  /* The compiler optimizes this memcpy into a read.  */
+  memcpy (&value, dump_ptr (dump_base, offset), sizeof (value));
+  return value;
+}
+
+/* Write a word to the dump. DUMP_BASE and OFFSET are as for
+   dump_read_word_from_dump; VALUE is the word to write at the given
+   offset.  */
+static void
+dump_write_word_to_dump (uintptr_t dump_base,
+                         dump_off offset,
+                         uintptr_t value)
+{
+  /* The compiler optimizes this memcpy into a write.  */
+  memcpy (dump_ptr (dump_base, offset), &value, sizeof (value));
+}
+
+/* Write a Lisp_Object to the dump. DUMP_BASE and OFFSET are as for
+   dump_read_word_from_dump; VALUE is the Lisp_Object to write at the
+   given offset.  */
+static void
+dump_write_lv_to_dump (uintptr_t dump_base,
+                       dump_off offset,
+                       Lisp_Object value)
+{
+  /* The compiler optimizes this memcpy into a write.  */
+  memcpy (dump_ptr (dump_base, offset), &value, sizeof (value));
+}
+
+/* Search for a relocation given a relocation target.
+
+   DUMP is the dump metadata structure.  TABLE is the relocation table
+   to search.  KEY is the dump offset to find.  Return the relocation
+   RELOC such that RELOC.offset is the smallest RELOC.offset that
+   satisfies the constraint KEY <= RELOC.offset --- that is, return
+   the first relocation at KEY or after KEY.  Return NULL if no such
+   relocation exists.  */
+static const struct dump_reloc *
+dump_find_relocation (const struct dump_table_locator *const table,
+                      const dump_off key)
+{
+  const struct dump_reloc *const relocs = dump_ptr (dump_public.start,
+                                                   table->offset);
+  const struct dump_reloc *found = NULL;
+  ptrdiff_t idx_left = 0;
+  ptrdiff_t idx_right = table->nr_entries;
+
+  eassert (key >= 0);
+
+  while (idx_left < idx_right)
+    {
+      const ptrdiff_t idx_mid = idx_left + (idx_right - idx_left) / 2;
+      const struct dump_reloc *mid = &relocs[idx_mid];
+      if (key > dump_reloc_get_offset (*mid))
+        idx_left = idx_mid + 1;
+      else
+        {
+          found = mid;
+          idx_right = idx_mid;
+         if (idx_right <= idx_left
+             || key > dump_reloc_get_offset (relocs[idx_right - 1]))
+            break;
+        }
+   }
+
+  return found;
+}
+
+static bool
+dump_loaded_p (void)
+{
+  return dump_public.start != 0;
+}
+
+bool
+pdumper_cold_object_p_impl (const void *obj)
+{
+  eassert (pdumper_object_p (obj));
+  eassert (pdumper_object_p_precise (obj));
+  dump_off offset = ptrdiff_t_to_dump_off ((uintptr_t) obj - 
dump_public.start);
+  return offset >= dump_private.header.cold_start;
+}
+
+enum Lisp_Type
+pdumper_find_object_type_impl (const void *obj)
+{
+  eassert (pdumper_object_p (obj));
+  dump_off offset = ptrdiff_t_to_dump_off ((uintptr_t) obj - 
dump_public.start);
+  if (offset % DUMP_ALIGNMENT != 0)
+    return PDUMPER_NO_OBJECT;
+  const struct dump_reloc *reloc =
+    dump_find_relocation (&dump_private.header.object_starts, offset);
+  return (reloc != NULL && dump_reloc_get_offset (*reloc) == offset)
+    ? (enum Lisp_Type) reloc->type
+    : PDUMPER_NO_OBJECT;
+}
+
+bool
+pdumper_marked_p_impl (const void *obj)
+{
+  eassert (pdumper_object_p (obj));
+  ptrdiff_t offset = (uintptr_t) obj - dump_public.start;
+  eassert (offset % DUMP_ALIGNMENT == 0);
+  eassert (offset < dump_private.header.cold_start);
+  eassert (offset < dump_private.header.discardable_start);
+  ptrdiff_t bitno = offset / DUMP_ALIGNMENT;
+  return dump_bitset_bit_set_p (&dump_private.mark_bits, bitno);
+}
+
+void
+pdumper_set_marked_impl (const void *obj)
+{
+  eassert (pdumper_object_p (obj));
+  ptrdiff_t offset = (uintptr_t) obj - dump_public.start;
+  eassert (offset % DUMP_ALIGNMENT == 0);
+  eassert (offset < dump_private.header.cold_start);
+  eassert (offset < dump_private.header.discardable_start);
+  ptrdiff_t bitno = offset / DUMP_ALIGNMENT;
+  dump_bitset_set_bit (&dump_private.mark_bits, bitno);
+}
+
+void
+pdumper_clear_marks_impl (void)
+{
+  dump_bitset_clear (&dump_private.mark_bits);
+}
+
+static ssize_t
+dump_read_all (int fd, void *buf, size_t bytes_to_read)
+{
+  /* We don't want to use emacs_read, since that relies on the lisp
+     world, and we're not in the lisp world yet.  */
+  eassert (bytes_to_read <= SSIZE_MAX);
+  size_t bytes_read = 0;
+  while (bytes_read < bytes_to_read)
+    {
+      /* Some platforms accept only int-sized values to read.  */
+      unsigned chunk_to_read = INT_MAX;
+      if (bytes_to_read - bytes_read < chunk_to_read)
+       chunk_to_read = (unsigned) (bytes_to_read - bytes_read);
+      ssize_t chunk = read (fd, (char *) buf + bytes_read, chunk_to_read);
+      if (chunk < 0)
+        return chunk;
+      if (chunk == 0)
+        break;
+      bytes_read += chunk;
+    }
+
+  return bytes_read;
+}
+
+/* Return the number of bytes written when we perform the given
+   relocation.  */
+static int
+dump_reloc_size (const struct dump_reloc reloc)
+{
+  if (sizeof (Lisp_Object) == sizeof (void *))
+    return sizeof (Lisp_Object);
+  if (reloc.type == RELOC_DUMP_TO_EMACS_PTR_RAW
+      || reloc.type == RELOC_DUMP_TO_DUMP_PTR_RAW)
+    return sizeof (void *);
+  return sizeof (Lisp_Object);
+}
+
+static Lisp_Object
+dump_make_lv_from_reloc (const uintptr_t dump_base,
+                        const struct dump_reloc reloc)
+{
+  const dump_off reloc_offset = dump_reloc_get_offset (reloc);
+  uintptr_t value = dump_read_word_from_dump (dump_base, reloc_offset);
+  enum Lisp_Type lisp_type;
+
+  if (RELOC_DUMP_TO_DUMP_LV <= reloc.type
+      && reloc.type < RELOC_DUMP_TO_EMACS_LV)
+    {
+      lisp_type = reloc.type - RELOC_DUMP_TO_DUMP_LV;
+      value += dump_base;
+      eassert (pdumper_object_p ((void *) value));
+    }
+  else
+    {
+      eassert (RELOC_DUMP_TO_EMACS_LV <= reloc.type);
+      eassert (reloc.type < RELOC_DUMP_TO_EMACS_LV + 8);
+      lisp_type = reloc.type - RELOC_DUMP_TO_EMACS_LV;
+      value += emacs_basis ();
+    }
+
+  eassert (lisp_type != Lisp_Int0 && lisp_type != Lisp_Int1);
+
+  Lisp_Object lv;
+  if (lisp_type == Lisp_Symbol)
+    lv = make_lisp_symbol ((void *) value);
+  else
+    lv = make_lisp_ptr ((void *) value, lisp_type);
+
+  return lv;
+}
+
+/* Actually apply a dump relocation.  */
+static inline void
+dump_do_dump_relocation (const uintptr_t dump_base,
+                        const struct dump_reloc reloc)
+{
+  const dump_off reloc_offset = dump_reloc_get_offset (reloc);
+
+  /* We should never generate a relocation in the cold section.  */
+  eassert (reloc_offset < dump_private.header.cold_start);
+
+  switch (reloc.type)
+    {
+    case RELOC_DUMP_TO_EMACS_PTR_RAW:
+      {
+        uintptr_t value = dump_read_word_from_dump (dump_base, reloc_offset);
+        eassert (dump_reloc_size (reloc) == sizeof (value));
+        value += emacs_basis ();
+        dump_write_word_to_dump (dump_base, reloc_offset, value);
+        break;
+      }
+    case RELOC_DUMP_TO_DUMP_PTR_RAW:
+      {
+        uintptr_t value = dump_read_word_from_dump (dump_base, reloc_offset);
+        eassert (dump_reloc_size (reloc) == sizeof (value));
+        value += dump_base;
+        dump_write_word_to_dump (dump_base, reloc_offset, value);
+        break;
+      }
+    case RELOC_BIGNUM:
+      {
+        struct Lisp_Bignum *bignum = dump_ptr (dump_base, reloc_offset);
+        struct bignum_reload_info reload_info;
+        verify (sizeof (reload_info) <= sizeof (bignum->value));
+        memcpy (&reload_info, &bignum->value, sizeof (reload_info));
+        const mp_limb_t *limbs =
+          dump_ptr (dump_base, reload_info.data_location);
+        mpz_roinit_n (bignum->value, limbs, reload_info.nlimbs);
+        break;
+      }
+    default: /* Lisp_Object in the dump; precise type in reloc.type */
+      {
+        Lisp_Object lv = dump_make_lv_from_reloc (dump_base, reloc);
+        eassert (dump_reloc_size (reloc) == sizeof (lv));
+        dump_write_lv_to_dump (dump_base, reloc_offset, lv);
+        break;
+      }
+    }
+}
+
+static void
+dump_do_all_dump_relocations (const struct dump_header *const header,
+                             const uintptr_t dump_base)
+{
+  struct dump_reloc *r = dump_ptr (dump_base, header->dump_relocs.offset);
+  dump_off nr_entries = header->dump_relocs.nr_entries;
+  for (dump_off i = 0; i < nr_entries; ++i)
+    dump_do_dump_relocation (dump_base, r[i]);
+}
+
+static void
+dump_do_emacs_relocation (const uintptr_t dump_base,
+                         const struct emacs_reloc reloc)
+{
+  ptrdiff_t pval;
+  Lisp_Object lv;
+
+  switch (reloc.type)
+    {
+    case RELOC_EMACS_COPY_FROM_DUMP:
+      eassume (reloc.length > 0);
+      memcpy (emacs_ptr_at (reloc.emacs_offset),
+              dump_ptr (dump_base, reloc.u.dump_offset),
+              reloc.length);
+      break;
+    case RELOC_EMACS_IMMEDIATE:
+      eassume (reloc.length > 0);
+      eassume (reloc.length <= sizeof (reloc.u.immediate));
+      memcpy (emacs_ptr_at (reloc.emacs_offset),
+              &reloc.u.immediate,
+              reloc.length);
+      break;
+    case RELOC_EMACS_DUMP_PTR_RAW:
+      pval = reloc.u.dump_offset + dump_base;
+      memcpy (emacs_ptr_at (reloc.emacs_offset), &pval, sizeof (pval));
+      break;
+    case RELOC_EMACS_EMACS_PTR_RAW:
+      pval = reloc.u.emacs_offset2 + emacs_basis ();
+      memcpy (emacs_ptr_at (reloc.emacs_offset), &pval, sizeof (pval));
+      break;
+    case RELOC_EMACS_DUMP_LV:
+    case RELOC_EMACS_EMACS_LV:
+      {
+        /* Lisp_Float is the maximum lisp type.  */
+        eassume (reloc.length <= Lisp_Float);
+        void *obj_ptr = reloc.type == RELOC_EMACS_DUMP_LV
+          ? dump_ptr (dump_base, reloc.u.dump_offset)
+          : emacs_ptr_at (reloc.u.emacs_offset2);
+        if (reloc.length == Lisp_Symbol)
+          lv = make_lisp_symbol (obj_ptr);
+        else
+          lv = make_lisp_ptr (obj_ptr, reloc.length);
+        memcpy (emacs_ptr_at (reloc.emacs_offset), &lv, sizeof (lv));
+        break;
+      }
+    default:
+      fatal ("unrecognied relocation type %d", (int) reloc.type);
+    }
+}
+
+static void
+dump_do_all_emacs_relocations (const struct dump_header *const header,
+                              const uintptr_t dump_base)
+{
+  const dump_off nr_entries = header->emacs_relocs.nr_entries;
+  struct emacs_reloc *r = dump_ptr (dump_base, header->emacs_relocs.offset);
+  for (dump_off i = 0; i < nr_entries; ++i)
+    dump_do_emacs_relocation (dump_base, r[i]);
+}
+
+enum dump_section
+  {
+   DS_HOT,
+   DS_DISCARDABLE,
+   DS_COLD,
+   NUMBER_DUMP_SECTIONS,
+  };
+
+/* Load a dump from DUMP_FILENAME.  Return an error code.
+
+   N.B. We run very early in initialization, so we can't use lisp,
+   unwinding, xmalloc, and so on.  */
+enum pdumper_load_result
+pdumper_load (const char *dump_filename)
+{
+  intptr_t dump_size;
+  struct stat stat;
+  uintptr_t dump_base;
+  int dump_page_size;
+  dump_off adj_discardable_start;
+
+  struct dump_bitset mark_bits;
+  size_t mark_bits_needed;
+
+  struct dump_header header_buf = { 0 };
+  struct dump_header *header = &header_buf;
+  struct dump_memory_map sections[NUMBER_DUMP_SECTIONS] = { 0 };
+
+  const struct timespec start_time = current_timespec ();
+  char *dump_filename_copy;
+
+  /* Overwriting an initialized Lisp universe will not go well.  */
+  eassert (!initialized);
+
+  /* We can load only one dump.  */
+  eassert (!dump_loaded_p ());
+
+  enum pdumper_load_result err = PDUMPER_LOAD_FILE_NOT_FOUND;
+  int dump_fd = emacs_open (dump_filename, O_RDONLY, 0);
+  if (dump_fd < 0)
+    goto out;
+
+  err = PDUMPER_LOAD_FILE_NOT_FOUND;
+  if (fstat (dump_fd, &stat) < 0)
+    goto out;
+
+  err = PDUMPER_LOAD_BAD_FILE_TYPE;
+  if (stat.st_size > INTPTR_MAX)
+    goto out;
+  dump_size = (intptr_t) stat.st_size;
+
+  err = PDUMPER_LOAD_BAD_FILE_TYPE;
+  if (dump_size < sizeof (*header))
+    goto out;
+
+  err = PDUMPER_LOAD_BAD_FILE_TYPE;
+  if (dump_read_all (dump_fd,
+                     header,
+                     sizeof (*header)) < sizeof (*header))
+    goto out;
+
+  if (memcmp (header->magic, dump_magic, sizeof (dump_magic)) != 0)
+    {
+      if (header->magic[0] == '!'
+         && (header->magic[0] = dump_magic[0],
+             memcmp (header->magic, dump_magic, sizeof (dump_magic)) == 0))
+        {
+          err = PDUMPER_LOAD_FAILED_DUMP;
+          goto out;
+        }
+      err = PDUMPER_LOAD_BAD_FILE_TYPE;
+      goto out;
+    }
+
+  err = PDUMPER_LOAD_VERSION_MISMATCH;
+  verify (sizeof (header->fingerprint) == sizeof (fingerprint));
+  if (memcmp (header->fingerprint, fingerprint, sizeof (fingerprint)) != 0)
+    {
+      dump_fingerprint ("desired fingerprint", fingerprint);
+      dump_fingerprint ("found fingerprint", header->fingerprint);
+      goto out;
+    }
+
+  /* FIXME: The comment at the start of this function says it should
+     not use xmalloc, but xstrdup calls xmalloc.  Either fix the
+     comment or fix the following code.  */
+  dump_filename_copy = xstrdup (dump_filename);
+
+  err = PDUMPER_LOAD_OOM;
+
+  adj_discardable_start = header->discardable_start;
+  dump_page_size = dump_get_page_size ();
+  /* Snap to next page boundary.  */
+  adj_discardable_start = ROUNDUP (adj_discardable_start, dump_page_size);
+  eassert (adj_discardable_start % dump_page_size == 0);
+  eassert (adj_discardable_start <= header->cold_start);
+
+  sections[DS_HOT].spec = (struct dump_memory_map_spec)
+    {
+     .fd = dump_fd,
+     .size = adj_discardable_start,
+     .offset = 0,
+     .protection = DUMP_MEMORY_ACCESS_READWRITE,
+    };
+
+  sections[DS_DISCARDABLE].spec = (struct dump_memory_map_spec)
+    {
+     .fd = dump_fd,
+     .size = header->cold_start - adj_discardable_start,
+     .offset = adj_discardable_start,
+     .protection = DUMP_MEMORY_ACCESS_READWRITE,
+    };
+
+  sections[DS_COLD].spec = (struct dump_memory_map_spec)
+    {
+     .fd = dump_fd,
+     .size = dump_size - header->cold_start,
+     .offset = header->cold_start,
+     .protection = DUMP_MEMORY_ACCESS_READWRITE,
+    };
+
+  if (!dump_mmap_contiguous (sections, ARRAYELTS (sections)))
+    goto out;
+
+  err = PDUMPER_LOAD_ERROR;
+  mark_bits_needed =
+    DIVIDE_ROUND_UP (header->discardable_start, DUMP_ALIGNMENT);
+  if (!dump_bitset_init (&mark_bits, mark_bits_needed))
+    goto out;
+
+  /* Point of no return.  */
+  err = PDUMPER_LOAD_SUCCESS;
+  dump_base = (uintptr_t) sections[DS_HOT].mapping;
+  gflags.dumped_with_pdumper_ = true;
+  dump_private.header = *header;
+  dump_private.mark_bits = mark_bits;
+  dump_public.start = dump_base;
+  dump_public.end = dump_public.start + dump_size;
+
+  dump_do_all_dump_relocations (header, dump_base);
+  dump_do_all_emacs_relocations (header, dump_base);
+
+  dump_mmap_discard_contents (&sections[DS_DISCARDABLE]);
+  for (int i = 0; i < ARRAYELTS (sections); ++i)
+    dump_mmap_reset (&sections[i]);
+
+  /* Run the functions Emacs registered for doing post-dump-load
+     initialization.  */
+  for (int i = 0; i < nr_dump_hooks; ++i)
+    dump_hooks[i] ();
+  initialized = true;
+
+  struct timespec load_timespec =
+    timespec_sub (current_timespec (), start_time);
+  dump_private.load_time = timespectod (load_timespec);
+  dump_private.dump_filename = dump_filename_copy;
+
+ out:
+  for (int i = 0; i < ARRAYELTS (sections); ++i)
+    dump_mmap_release (&sections[i]);
+  if (dump_fd >= 0)
+    emacs_close (dump_fd);
+  return err;
+}
+
+/* Prepend the Emacs startup directory to dump_filename, if that is
+   relative, so that we could later make it absolute correctly.  */
+void
+pdumper_record_wd (const char *wd)
+{
+  if (wd && !file_name_absolute_p (dump_private.dump_filename))
+    {
+      char *dfn = xmalloc (strlen (wd) + 1
+                          + strlen (dump_private.dump_filename) + 1);
+      splice_dir_file (dfn, wd, dump_private.dump_filename);
+      xfree (dump_private.dump_filename);
+      dump_private.dump_filename = dfn;
+    }
+}
+
+DEFUN ("pdumper-stats", Fpdumper_stats, Spdumper_stats, 0, 0, 0,
+       doc: /* Return statistics about portable dumping used by this session.
+If this Emacs sesion was started from a portable dump file,
+the return value is an alist of the form:
+
+  ((dumped-with-pdumper . t) (load-time . TIME) (dump-file-name . FILE))
+
+where TIME is the time in seconds it took to restore Emacs state
+from the dump file, and FILE is the name of the dump file.
+Value is nil if this session was not started using a portable dump file.*/)
+     (void)
+{
+  if (!dumped_with_pdumper_p ())
+    return Qnil;
+
+  Lisp_Object dump_fn;
+#ifdef WINDOWSNT
+  char dump_fn_utf8[MAX_UTF8_PATH];
+  if (filename_from_ansi (dump_private.dump_filename, dump_fn_utf8) == 0)
+    dump_fn = DECODE_FILE (build_unibyte_string (dump_fn_utf8));
+  else
+    dump_fn = build_unibyte_string (dump_private.dump_filename);
+#else
+  dump_fn = DECODE_FILE (build_unibyte_string (dump_private.dump_filename));
+#endif
+
+  dump_fn = Fexpand_file_name (dump_fn, Qnil);
+
+  return list3 (Fcons (Qdumped_with_pdumper, Qt),
+               Fcons (Qload_time, make_float (dump_private.load_time)),
+               Fcons (Qdump_file_name, dump_fn));
+}
+
+#endif /* HAVE_PDUMPER */
+
+
+
+void
+syms_of_pdumper (void)
+{
+#ifdef HAVE_PDUMPER
+  defsubr (&Sdump_emacs_portable);
+  defsubr (&Sdump_emacs_portable__sort_predicate);
+  defsubr (&Sdump_emacs_portable__sort_predicate_copied);
+  DEFSYM (Qdump_emacs_portable__sort_predicate,
+          "dump-emacs-portable--sort-predicate");
+  DEFSYM (Qdump_emacs_portable__sort_predicate_copied,
+          "dump-emacs-portable--sort-predicate-copied");
+  DEFSYM (Qdumped_with_pdumper, "dumped-with-pdumper");
+  DEFSYM (Qload_time, "load-time");
+  DEFSYM (Qdump_file_name, "dump-file-name");
+  defsubr (&Spdumper_stats);
+#endif /* HAVE_PDUMPER */
+}
diff --git a/src/pdumper.h b/src/pdumper.h
new file mode 100644
index 0000000..ab2f426
--- /dev/null
+++ b/src/pdumper.h
@@ -0,0 +1,254 @@
+/* Header file for the portable dumper.
+
+Copyright (C) 2016, 2018-2019 Free Software Foundation, Inc.
+
+This file is part of GNU Emacs.
+
+GNU Emacs is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or (at
+your option) any later version.
+
+GNU Emacs is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
+
+#ifndef EMACS_PDUMPER_H
+#define EMACS_PDUMPER_H
+
+#include "lisp.h"
+
+INLINE_HEADER_BEGIN
+
+#define PDUMPER_NO_OBJECT ((enum Lisp_Type) -1)
+
+/* Indicate in source code that we're deliberately relying on pdumper
+   not preserving the given value.  Compiles to nothing --- for humans
+   only.  */
+#define PDUMPER_IGNORE(thing) ((void) &(thing))
+
+/* The portable dumper automatically preserves the Lisp heap and any C
+   variables to which the Lisp heap points.  It doesn't know anything
+   about other C variables.  The functions below allow code from other
+   parts of Emacs to tell the portable dumper about other bits of
+   information to preserve in dumped images.
+
+   These memory-records are themselves preserved in the dump, so call
+   the functions below only on the !initialized init path, just
+   like staticpro.
+
+   There are no special functions to preserve a global Lisp_Object.
+   You should just staticpro these.  */
+
+/* Remember the value of THING in dumped images.  THING must not
+   contain any pointers or Lisp_Object variables: these values are not
+   valid across dump and load.  */
+#define PDUMPER_REMEMBER_SCALAR(thing)                  \
+  pdumper_remember_scalar (&(thing), sizeof (thing))
+
+extern void pdumper_remember_scalar_impl (void *data, ptrdiff_t nbytes);
+
+INLINE void
+pdumper_remember_scalar (void *data, ptrdiff_t nbytes)
+{
+#ifdef HAVE_PDUMPER
+  pdumper_remember_scalar_impl (data, nbytes);
+#else
+  (void) data;
+  (void) nbytes;
+#endif
+}
+
+extern void pdumper_remember_lv_ptr_raw_impl (void *ptr, enum Lisp_Type type);
+
+/* Remember the pointer at *PTR.  *PTR must be null or point to a Lisp
+   object.  TYPE is the rough type of Lisp object to which *PTR
+   points.  */
+INLINE void
+pdumper_remember_lv_ptr_raw (void *ptr, enum Lisp_Type type)
+{
+#ifdef HAVE_PDUMPER
+  pdumper_remember_lv_ptr_raw_impl (ptr, type);
+#else
+  (void) ptr;
+  (void) type;
+#endif
+}
+
+typedef void (*pdumper_hook)(void);
+extern void pdumper_do_now_and_after_load_impl (pdumper_hook hook);
+
+INLINE void
+pdumper_do_now_and_after_load (pdumper_hook hook)
+{
+#ifdef HAVE_PDUMPER
+  pdumper_do_now_and_after_load_impl (hook);
+#else
+  hook ();
+#endif
+}
+
+/* Macros useful in pdumper callback functions.  Assign a value if
+   we're loading a dump and the value needs to be reset to its
+   original value, and if we're initializing for the first time,
+   assert that the value has the expected original value.  */
+
+#define PDUMPER_RESET(variable, value)         \
+  do {                                         \
+    if (dumped_with_pdumper_p ())              \
+      (variable) = (value);                    \
+    else                                       \
+      eassert ((variable) == (value));         \
+  } while (0)
+
+#define PDUMPER_RESET_LV(variable, value)         \
+  do {                                            \
+    if (dumped_with_pdumper_p ())                 \
+      (variable) = (value);                       \
+    else                                          \
+      eassert (EQ ((variable), (value)));         \
+  } while (0)
+
+/* Actually load a dump.  */
+
+enum pdumper_load_result
+  {
+    PDUMPER_LOAD_SUCCESS,
+    PDUMPER_NOT_LOADED /* Not returned: useful for callers */,
+    PDUMPER_LOAD_FILE_NOT_FOUND,
+    PDUMPER_LOAD_BAD_FILE_TYPE,
+    PDUMPER_LOAD_FAILED_DUMP,
+    PDUMPER_LOAD_OOM,
+    PDUMPER_LOAD_VERSION_MISMATCH,
+    PDUMPER_LOAD_ERROR,
+  };
+
+enum pdumper_load_result pdumper_load (const char *dump_filename);
+
+struct pdumper_loaded_dump
+{
+  uintptr_t start;
+  uintptr_t end;
+};
+
+extern struct pdumper_loaded_dump dump_public;
+
+/* Return whether the OBJ points somewhere into the loaded dump image.
+   Works even when we have no dump loaded --- in this case, it just
+   returns false.  */
+INLINE _GL_ATTRIBUTE_CONST bool
+pdumper_object_p (const void *obj)
+{
+#ifdef HAVE_PDUMPER
+  uintptr_t obj_addr = (uintptr_t) obj;
+  return dump_public.start <= obj_addr && obj_addr < dump_public.end;
+#else
+  (void) obj;
+  return false;
+#endif
+}
+
+extern bool pdumper_cold_object_p_impl (const void *obj);
+
+/* Return whether the OBJ is in the cold section of the dump.
+   Only bool-vectors and floats should end up there.
+   pdumper_object_p() and pdumper_object_p_precise() must have
+   returned true for OBJ before calling this function.  */
+INLINE _GL_ATTRIBUTE_CONST bool
+pdumper_cold_object_p (const void *obj)
+{
+#ifdef HAVE_PDUMPER
+  return pdumper_cold_object_p_impl (obj);
+#else
+  (void) obj;
+  return false;
+#endif
+}
+
+
+extern enum Lisp_Type pdumper_find_object_type_impl (const void *obj);
+
+/* Return the type of the dumped object that starts at OBJ.  It is a
+   programming error to call this routine for an OBJ for which
+   pdumper_object_p would return false.  */
+INLINE _GL_ATTRIBUTE_CONST enum Lisp_Type
+pdumper_find_object_type (const void *obj)
+{
+#ifdef HAVE_PDUMPER
+  return pdumper_find_object_type_impl (obj);
+#else
+  (void) obj;
+  emacs_abort ();
+#endif
+}
+
+/* Return whether OBJ points exactly to the start of some object in
+   the loaded dump image.  It is a programming error to call this
+   routine for an OBJ for which pdumper_object_p would return
+   false.  */
+INLINE _GL_ATTRIBUTE_CONST bool
+pdumper_object_p_precise (const void *obj)
+{
+#ifdef HAVE_PDUMPER
+  return pdumper_find_object_type (obj) != PDUMPER_NO_OBJECT;
+#else
+  (void) obj;
+  emacs_abort ();
+#endif
+}
+
+extern bool pdumper_marked_p_impl (const void *obj);
+
+/* Return whether OBJ is marked according to the portable dumper.
+   It is an error to call this routine for an OBJ for which
+   pdumper_object_p_precise would return false.  */
+INLINE bool
+pdumper_marked_p (const void *obj)
+{
+#ifdef HAVE_PDUMPER
+  return pdumper_marked_p_impl (obj);
+#else
+  (void) obj;
+  emacs_abort ();
+#endif
+}
+
+extern void pdumper_set_marked_impl (const void *obj);
+
+/* Set the pdumper mark bit for OBJ.  It is a programming error to
+   call this function with an OBJ for which pdumper_object_p_precise
+   would return false.  */
+INLINE void
+pdumper_set_marked (const void *obj)
+{
+#ifdef HAVE_PDUMPER
+  pdumper_set_marked_impl (obj);
+#else
+  (void) obj;
+  emacs_abort ();
+#endif
+}
+
+extern void pdumper_clear_marks_impl (void);
+
+/* Clear all the mark bits for pdumper objects.  */
+INLINE void
+pdumper_clear_marks (void)
+{
+#ifdef HAVE_PDUMPER
+  pdumper_clear_marks_impl ();
+#endif
+}
+
+/* Record the Emacs startup directory, relative to which the pdump
+   file was loaded.  */
+extern void pdumper_record_wd (const char *);
+
+void syms_of_pdumper (void);
+
+INLINE_HEADER_END
+#endif
diff --git a/src/print.c b/src/print.c
index 50de1e7..4ed0090 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1,6 +1,6 @@
 /* Lisp object printing and output streams.
 
-Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2018 Free Software
+Copyright (C) 1985-1986, 1988, 1993-1995, 1997-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/process.c b/src/process.c
index 6cda4f2..802ac02 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1,6 +1,6 @@
 /* Asynchronous subprocess control for GNU Emacs.
 
-Copyright (C) 1985-1988, 1993-1996, 1998-1999, 2001-2018 Free Software
+Copyright (C) 1985-1988, 1993-1996, 1998-1999, 2001-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -1360,7 +1360,7 @@ If THREAD is nil, the process is unlocked.  */)
 
 DEFUN ("process-thread", Fprocess_thread, Sprocess_thread,
        1, 1, 0,
-       doc: /* Ret the locking thread of PROCESS.
+       doc: /* Return the locking thread of PROCESS.
 If PROCESS is unlocked, this function returns nil.  */)
   (Lisp_Object process)
 {
@@ -1661,6 +1661,11 @@ to the standard error of subprocess.  Specifying this 
implies
 `:connection-type' is set to `pipe'.  If STDERR is nil, standard error
 is mixed with standard output and sent to BUFFER or FILTER.
 
+:file-handler FILE-HANDLER -- If FILE-HANDLER is non-nil, then look
+for a file name handler for the current buffer's `default-directory'
+and invoke that file name handler to make the process.  If there is no
+such handler, proceed as if FILE-HANDLER were nil.
+
 usage: (make-process &rest ARGS)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
@@ -1674,6 +1679,15 @@ usage: (make-process &rest ARGS)  */)
   /* Save arguments for process-contact and clone-process.  */
   contact = Flist (nargs, args);
 
+  if (!NILP (Fplist_get (contact, QCfile_handler)))
+    {
+      Lisp_Object file_handler
+        = Ffind_file_name_handler (BVAR (current_buffer, directory),
+                                   Qmake_process);
+      if (!NILP (file_handler))
+        return CALLN (Fapply, file_handler, Qmake_process, contact);
+    }
+
   buffer = Fplist_get (contact, QCbuffer);
   if (!NILP (buffer))
     buffer = Fget_buffer_create (buffer);
@@ -1790,7 +1804,7 @@ usage: (make-process &rest ARGS)  */)
       val = Vcoding_system_for_read;
     if (NILP (val))
       {
-       ptrdiff_t nargs2 = 3 + XFIXNUM (Flength (command));
+       ptrdiff_t nargs2 = 3 + list_length (command);
        Lisp_Object tem2;
        SAFE_ALLOCA_LISP (args2, nargs2);
        ptrdiff_t i = 0;
@@ -1820,7 +1834,7 @@ usage: (make-process &rest ARGS)  */)
       {
        if (EQ (coding_systems, Qt))
          {
-           ptrdiff_t nargs2 = 3 + XFIXNUM (Flength (command));
+           ptrdiff_t nargs2 = 3 + list_length (command);
            Lisp_Object tem2;
            SAFE_ALLOCA_LISP (args2, nargs2);
            ptrdiff_t i = 0;
@@ -1949,6 +1963,26 @@ close_process_fd (int *fd_addr)
     }
 }
 
+void
+dissociate_controlling_tty (void)
+{
+  if (setsid () < 0)
+    {
+#ifdef TIOCNOTTY
+      /* Needed on Darwin after vfork, since setsid fails in a vforked
+        child that has not execed.
+        I wonder: would just ioctl (fd, TIOCNOTTY, 0) work here, for
+        some fd that the caller already has?  */
+      int ttyfd = emacs_open (DEV_TTY, O_RDWR, 0);
+      if (0 <= ttyfd)
+       {
+         ioctl (ttyfd, TIOCNOTTY, 0);
+         emacs_close (ttyfd);
+       }
+#endif
+    }
+}
+
 /* Indexes of file descriptors in open_fds.  */
 enum
   {
@@ -2097,9 +2131,8 @@ create_process (Lisp_Object process, char **new_argv, 
Lisp_Object current_dir)
     {
       /* Make the pty be the controlling terminal of the process.  */
 #ifdef HAVE_PTYS
-      /* First, disconnect its current controlling terminal.
-        Do this even if !PTY_FLAG; see Bug#30762.  */
-      setsid ();
+      dissociate_controlling_tty ();
+
       /* Make the pty's terminal the controlling terminal.  */
       if (pty_flag && forkin >= 0)
        {
@@ -2128,21 +2161,6 @@ create_process (Lisp_Object process, char **new_argv, 
Lisp_Object current_dir)
        }
 #endif
 #endif
-#ifdef TIOCNOTTY
-      /* In 4.3BSD, the TIOCSPGRP bug has been fixed, and now you
-        can do TIOCSPGRP only to the process's controlling tty.  */
-      if (pty_flag)
-       {
-         /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here?
-            I can't test it since I don't have 4.3.  */
-         int j = emacs_open (DEV_TTY, O_RDWR, 0);
-         if (j >= 0)
-           {
-             ioctl (j, TIOCNOTTY, 0);
-             emacs_close (j);
-           }
-       }
-#endif /* TIOCNOTTY */
 
 #if !defined (DONT_REOPEN_PTY)
 /*** There is a suggestion that this ought to be a
@@ -2488,7 +2506,6 @@ Lisp_Object
 conv_sockaddr_to_lisp (struct sockaddr *sa, ptrdiff_t len)
 {
   Lisp_Object address;
-  ptrdiff_t i;
   unsigned char *cp;
   struct Lisp_Vector *p;
 
@@ -2504,7 +2521,7 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, ptrdiff_t len)
       {
        DECLARE_POINTER_ALIAS (sin, struct sockaddr_in, sa);
        len = sizeof (sin->sin_addr) + 1;
-       address = Fmake_vector (make_fixnum (len), Qnil);
+       address = make_uninit_vector (len);
        p = XVECTOR (address);
        p->contents[--len] = make_fixnum (ntohs (sin->sin_port));
        cp = (unsigned char *) &sin->sin_addr;
@@ -2516,10 +2533,10 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, ptrdiff_t 
len)
        DECLARE_POINTER_ALIAS (sin6, struct sockaddr_in6, sa);
        DECLARE_POINTER_ALIAS (ip6, uint16_t, &sin6->sin6_addr);
        len = sizeof (sin6->sin6_addr) / 2 + 1;
-       address = Fmake_vector (make_fixnum (len), Qnil);
+       address = make_uninit_vector (len);
        p = XVECTOR (address);
        p->contents[--len] = make_fixnum (ntohs (sin6->sin6_port));
-       for (i = 0; i < len; i++)
+       for (ptrdiff_t i = 0; i < len; i++)
          p->contents[i] = make_fixnum (ntohs (ip6[i]));
        return address;
       }
@@ -2548,16 +2565,14 @@ conv_sockaddr_to_lisp (struct sockaddr *sa, ptrdiff_t 
len)
 #endif
     default:
       len -= offsetof (struct sockaddr, sa_family) + sizeof (sa->sa_family);
-      address = Fcons (make_fixnum (sa->sa_family),
-                      Fmake_vector (make_fixnum (len), Qnil));
+      address = Fcons (make_fixnum (sa->sa_family), make_nil_vector (len));
       p = XVECTOR (XCDR (address));
       cp = (unsigned char *) &sa->sa_family + sizeof (sa->sa_family);
       break;
     }
 
-  i = 0;
-  while (i < len)
-    p->contents[i++] = make_fixnum (*cp++);
+  for (ptrdiff_t i = 0; i < len; i++)
+    p->contents[i] = make_fixnum (*cp++);
 
   return address;
 }
@@ -3718,6 +3733,8 @@ also nil, meaning that this process is not associated 
with any buffer.
 address.  The symbol `local' specifies the local host.  If specified
 for a server process, it must be a valid name or address for the local
 host, and only clients connecting to that address will be accepted.
+`local' will use IPv4 by default, use a FAMILY of 'ipv6 to override
+this.
 
 :service SERVICE -- SERVICE is name of the service desired, or an
 integer specifying a port number to connect to.  If SERVICE is t,
@@ -3968,14 +3985,24 @@ usage: (make-network-process &rest ARGS)  */)
 #ifdef HAVE_LOCAL_SOCKETS
       if (family != AF_LOCAL)
 #endif
-       host = build_string ("127.0.0.1");
+        {
+        if (family == AF_INET6)
+          host = build_string ("::1");
+        else
+          host = build_string ("127.0.0.1");
+        }
     }
   else
     {
       if (EQ (host, Qlocal))
+        {
        /* Depending on setup, "localhost" may map to different IPv4 and/or
           IPv6 addresses, so it's better to be explicit (Bug#6781).  */
-       host = build_string ("127.0.0.1");
+        if (family == AF_INET6)
+          host = build_string ("::1");
+        else
+          host = build_string ("127.0.0.1");
+        }
       CHECK_STRING (host);
     }
 
@@ -4359,7 +4386,7 @@ network_interface_info (Lisp_Object ifname)
   Lisp_Object res = Qnil;
   Lisp_Object elt;
   int s;
-  bool any = 0;
+  bool any = false;
   ptrdiff_t count;
 #if (! (defined SIOCGIFHWADDR && defined HAVE_STRUCT_IFREQ_IFR_HWADDR) \
      && defined HAVE_GETIFADDRS && defined LLADDR)
@@ -4392,7 +4419,7 @@ network_interface_info (Lisp_Object ifname)
       if (flags < 0 && sizeof (rq.ifr_flags) < sizeof (flags))
         flags = (unsigned short) rq.ifr_flags;
 
-      any = 1;
+      any = true;
       for (fp = ifflag_table; flags != 0 && fp->flag_sym; fp++)
        {
          if (flags & fp->flag_bit)
@@ -4416,12 +4443,11 @@ network_interface_info (Lisp_Object ifname)
 #if defined (SIOCGIFHWADDR) && defined (HAVE_STRUCT_IFREQ_IFR_HWADDR)
   if (ioctl (s, SIOCGIFHWADDR, &rq) == 0)
     {
-      Lisp_Object hwaddr = Fmake_vector (make_fixnum (6), Qnil);
-      register struct Lisp_Vector *p = XVECTOR (hwaddr);
-      int n;
+      Lisp_Object hwaddr = make_uninit_vector (6);
+      struct Lisp_Vector *p = XVECTOR (hwaddr);
 
-      any = 1;
-      for (n = 0; n < 6; n++)
+      any = true;
+      for (int n = 0; n < 6; n++)
        p->contents[n] = make_fixnum (((unsigned char *)
                                       &rq.ifr_hwaddr.sa_data[0])
                                      [n]);
@@ -4430,11 +4456,10 @@ network_interface_info (Lisp_Object ifname)
 #elif defined (HAVE_GETIFADDRS) && defined (LLADDR)
   if (getifaddrs (&ifap) != -1)
     {
-      Lisp_Object hwaddr = Fmake_vector (make_fixnum (6), Qnil);
-      register struct Lisp_Vector *p = XVECTOR (hwaddr);
-      struct ifaddrs *it;
+      Lisp_Object hwaddr = make_nil_vector (6);
+      struct Lisp_Vector *p = XVECTOR (hwaddr);
 
-      for (it = ifap; it != NULL; it = it->ifa_next)
+      for (struct ifaddrs *it = ifap; it != NULL; it = it->ifa_next)
         {
          DECLARE_POINTER_ALIAS (sdl, struct sockaddr_dl, it->ifa_addr);
           unsigned char linkaddr[6];
@@ -4462,10 +4487,12 @@ network_interface_info (Lisp_Object ifname)
   res = Fcons (elt, res);
 
   elt = Qnil;
-#if defined (SIOCGIFNETMASK) && (defined (HAVE_STRUCT_IFREQ_IFR_NETMASK) || 
defined (HAVE_STRUCT_IFREQ_IFR_ADDR))
+#if (defined SIOCGIFNETMASK \
+     && (defined HAVE_STRUCT_IFREQ_IFR_NETMASK \
+        || defined HAVE_STRUCT_IFREQ_IFR_ADDR))
   if (ioctl (s, SIOCGIFNETMASK, &rq) == 0)
     {
-      any = 1;
+      any = true;
 #ifdef HAVE_STRUCT_IFREQ_IFR_NETMASK
       elt = conv_sockaddr_to_lisp (&rq.ifr_netmask, sizeof (rq.ifr_netmask));
 #else
@@ -4479,8 +4506,8 @@ network_interface_info (Lisp_Object ifname)
 #if defined (SIOCGIFBRDADDR) && defined (HAVE_STRUCT_IFREQ_IFR_BROADADDR)
   if (ioctl (s, SIOCGIFBRDADDR, &rq) == 0)
     {
-      any = 1;
-      elt = conv_sockaddr_to_lisp (&rq.ifr_broadaddr, sizeof 
(rq.ifr_broadaddr));
+      any = true;
+      elt = conv_sockaddr_to_lisp (&rq.ifr_broadaddr, sizeof rq.ifr_broadaddr);
     }
 #endif
   res = Fcons (elt, res);
@@ -4489,7 +4516,7 @@ network_interface_info (Lisp_Object ifname)
 #if defined (SIOCGIFADDR) && defined (HAVE_STRUCT_IFREQ_IFR_ADDR)
   if (ioctl (s, SIOCGIFADDR, &rq) == 0)
     {
-      any = 1;
+      any = true;
       elt = conv_sockaddr_to_lisp (&rq.ifr_addr, sizeof (rq.ifr_addr));
     }
 #endif
@@ -4592,8 +4619,8 @@ DEFUN ("accept-process-output", Faccept_process_output, 
Saccept_process_output,
        0, 4, 0,
        doc: /* Allow any pending output from subprocesses to be read by Emacs.
 It is given to their filter functions.
-Optional argument PROCESS means do not return until output has been
-received from PROCESS.
+Optional argument PROCESS means to return only after output is
+received from PROCESS or PROCESS closes the connection.
 
 Optional second argument SECONDS and third argument MILLISEC
 specify a timeout; return after that much time even if there is
@@ -4605,7 +4632,8 @@ If optional fourth argument JUST-THIS-ONE is non-nil, 
accept output
 from PROCESS only, suspending reading output from other processes.
 If JUST-THIS-ONE is an integer, don't run any timers either.
 Return non-nil if we received any output from PROCESS (or, if PROCESS
-is nil, from any process) before the timeout expired.  */)
+is nil, from any process) before the timeout expired or the
+corresponding connection was closed.  */)
   (Lisp_Object process, Lisp_Object seconds, Lisp_Object millisec,
    Lisp_Object just_this_one)
 {
@@ -4725,19 +4753,24 @@ server_accept_connection (Lisp_Object server, int 
channel)
   service = Qnil;
   Lisp_Object args[11];
   int nargs = 0;
-  AUTO_STRING (procname_format_in, "%s <%d.%d.%d.%d:%d>");
-  AUTO_STRING (procname_format_in6, "%s <[%x:%x:%x:%x:%x:%x:%x:%x]:%d>");
+  #define HOST_FORMAT_IN "%d.%d.%d.%d"
+  #define HOST_FORMAT_IN6 "%x:%x:%x:%x:%x:%x:%x:%x"
+  AUTO_STRING (host_format_in, HOST_FORMAT_IN);
+  AUTO_STRING (host_format_in6, HOST_FORMAT_IN6);
+  AUTO_STRING (procname_format_in, "%s <"HOST_FORMAT_IN":%d>");
+  AUTO_STRING (procname_format_in6, "%s <["HOST_FORMAT_IN6"]:%d>");
   AUTO_STRING (procname_format_default, "%s <%d>");
   switch (saddr.sa.sa_family)
     {
     case AF_INET:
       {
        args[nargs++] = procname_format_in;
-       nargs++;
+       args[nargs++] = host_format_in;
        unsigned char *ip = (unsigned char *)&saddr.in.sin_addr.s_addr;
        service = make_fixnum (ntohs (saddr.in.sin_port));
        for (int i = 0; i < 4; i++)
          args[nargs++] = make_fixnum (ip[i]);
+       host = Fformat (5, args + 1);
        args[nargs++] = service;
       }
       break;
@@ -4746,11 +4779,12 @@ server_accept_connection (Lisp_Object server, int 
channel)
     case AF_INET6:
       {
        args[nargs++] = procname_format_in6;
-       nargs++;
+       args[nargs++] = host_format_in6;
        DECLARE_POINTER_ALIAS (ip6, uint16_t, &saddr.in6.sin6_addr);
        service = make_fixnum (ntohs (saddr.in.sin_port));
        for (int i = 0; i < 8; i++)
          args[nargs++] = make_fixnum (ip6[i]);
+       host = Fformat (9, args + 1);
        args[nargs++] = service;
       }
       break;
@@ -5824,7 +5858,8 @@ read_and_dispose_of_process_output (struct Lisp_Process 
*p, char *chars,
 
 /* Read pending output from the process channel,
    starting with our buffered-ahead character if we have one.
-   Yield number of decoded characters read.
+   Yield number of decoded characters read,
+   or -1 (setting errno) if there is a read error.
 
    This function reads at most 4096 characters.
    If you want to read all available subprocess output,
@@ -5854,8 +5889,10 @@ read_process_output (Lisp_Object proc, int channel)
   if (DATAGRAM_CHAN_P (channel))
     {
       socklen_t len = datagram_address[channel].len;
-      nbytes = recvfrom (channel, chars + carryover, readmax,
-                        0, datagram_address[channel].sa, &len);
+      do
+       nbytes = recvfrom (channel, chars + carryover, readmax,
+                          0, datagram_address[channel].sa, &len);
+      while (nbytes < 0 && errno == EINTR);
     }
   else
 #endif
@@ -5905,8 +5942,6 @@ read_process_output (Lisp_Object proc, int channel)
 
   p->decoding_carryover = 0;
 
-  /* At this point, NBYTES holds number of bytes just received
-     (including the one in proc_buffered_char[channel]).  */
   if (nbytes <= 0)
     {
       if (nbytes < 0 || coding->mode & CODING_MODE_LAST_BLOCK)
@@ -5914,6 +5949,9 @@ read_process_output (Lisp_Object proc, int channel)
       coding->mode |= CODING_MODE_LAST_BLOCK;
     }
 
+  /* At this point, NBYTES holds number of bytes just received
+     (including the one in proc_buffered_char[channel]).  */
+
   /* Ignore carryover, it's been added by a previous iteration already.  */
   p->nbytes_read += nbytes;
 
@@ -6356,9 +6394,17 @@ send_process (Lisp_Object proc, const char *buf, 
ptrdiff_t len,
 #ifdef DATAGRAM_SOCKETS
          if (DATAGRAM_CHAN_P (outfd))
            {
-             rv = sendto (outfd, cur_buf, cur_len,
-                          0, datagram_address[outfd].sa,
-                          datagram_address[outfd].len);
+             while (true)
+               {
+                 rv = sendto (outfd, cur_buf, cur_len, 0,
+                              datagram_address[outfd].sa,
+                              datagram_address[outfd].len);
+                 if (! (rv < 0 && errno == EINTR))
+                   break;
+                 if (pending_signals)
+                   process_pending_signals ();
+               }
+
              if (rv >= 0)
                written = rv;
              else if (errno == EMSGSIZE)
@@ -6448,9 +6494,11 @@ DEFUN ("process-send-region", Fprocess_send_region, 
Sprocess_send_region,
 PROCESS may be a process, a buffer, the name of a process or buffer, or
 nil, indicating the current buffer's process.
 Called from program, takes three arguments, PROCESS, START and END.
-If the region is more than 500 characters long,
-it is sent in several bunches.  This may happen even for shorter regions.
-Output from processes can arrive in between bunches.
+If the region is larger than the input buffer of the process (the
+length of which depends on the process connection type and the
+operating system), it is sent in several bunches.  This may happen
+even for shorter regions.  Output from processes can arrive in between
+bunches.
 
 If PROCESS is a non-blocking network process that hasn't been fully
 set up yet, this function will block until socket setup has completed.  */)
@@ -6481,9 +6529,10 @@ DEFUN ("process-send-string", Fprocess_send_string, 
Sprocess_send_string,
        doc: /* Send PROCESS the contents of STRING as input.
 PROCESS may be a process, a buffer, the name of a process or buffer, or
 nil, indicating the current buffer's process.
-If STRING is more than 500 characters long,
-it is sent in several bunches.  This may happen even for shorter strings.
-Output from processes can arrive in between bunches.
+If STRING is larger than the input buffer of the process (the length
+of which depends on the process connection type and the operating
+system), it is sent in several bunches.  This may happen even for
+shorter strings.  Output from processes can arrive in between bunches.
 
 If PROCESS is a non-blocking network process that hasn't been fully
 set up yet, this function will block until socket setup has completed.  */)
@@ -8009,9 +8058,7 @@ init_process_emacs (int sockfd)
 
   inhibit_sentinels = 0;
 
-#ifndef CANNOT_DUMP
-  if (! noninteractive || initialized)
-#endif
+  if (!will_dump_with_unexec_p ())
     {
 #if defined HAVE_GLIB && !defined WINDOWSNT
       /* Tickle glib's child-handling code.  Ask glib to wait for Emacs itself;
@@ -8097,6 +8144,8 @@ init_process_emacs (int sockfd)
 void
 syms_of_process (void)
 {
+  DEFSYM (Qmake_process, "make-process");
+
 #ifdef subprocesses
 
   DEFSYM (Qprocessp, "processp");
@@ -8137,6 +8186,7 @@ syms_of_process (void)
   DEFSYM (Qreal, "real");
   DEFSYM (Qnetwork, "network");
   DEFSYM (Qserial, "serial");
+  DEFSYM (QCfile_handler, ":file-handler");
   DEFSYM (QCbuffer, ":buffer");
   DEFSYM (QChost, ":host");
   DEFSYM (QCservice, ":service");
diff --git a/src/process.h b/src/process.h
index 3c6dd7b..d66aa06 100644
--- a/src/process.h
+++ b/src/process.h
@@ -1,5 +1,5 @@
 /* Definitions for asynchronous process control in GNU Emacs.
-   Copyright (C) 1985, 1994, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1994, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -300,6 +300,7 @@ extern Lisp_Object network_interface_info (Lisp_Object);
 extern Lisp_Object remove_slash_colon (Lisp_Object);
 
 extern void update_processes_for_thread_death (Lisp_Object);
+extern void dissociate_controlling_tty (void);
 
 INLINE_HEADER_END
 
diff --git a/src/profiler.c b/src/profiler.c
index 7330f88..87be30a 100644
--- a/src/profiler.c
+++ b/src/profiler.c
@@ -1,6 +1,6 @@
 /* Profiler implementation.
 
-Copyright (C) 2012-2018 Free Software Foundation, Inc.
+Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -21,6 +21,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "lisp.h"
 #include "syssignal.h"
 #include "systime.h"
+#include "pdumper.h"
 
 /* Return A + B, but return the maximum fixnum if the result would overflow.
    Assume A and B are nonnegative and in fixnum range.  */
@@ -35,15 +36,32 @@ saturated_add (EMACS_INT a, EMACS_INT b)
 
 typedef struct Lisp_Hash_Table log_t;
 
-static struct hash_table_test hashtest_profiler;
+static bool cmpfn_profiler (
+  struct hash_table_test *, Lisp_Object, Lisp_Object);
+
+static EMACS_UINT hashfn_profiler (
+  struct hash_table_test *, Lisp_Object);
+
+static const struct hash_table_test hashtest_profiler =
+  {
+   LISPSYM_INITIALLY (Qprofiler_backtrace_equal),
+   LISPSYM_INITIALLY (Qnil) /* user_hash_function */,
+   LISPSYM_INITIALLY (Qnil) /* user_cmp_function */,
+   cmpfn_profiler,
+   hashfn_profiler,
+  };
 
 static Lisp_Object
-make_log (EMACS_INT heap_size, EMACS_INT max_stack_depth)
+make_log (void)
 {
   /* We use a standard Elisp hash-table object, but we use it in
      a special way.  This is OK as long as the object is not exposed
      to Elisp, i.e. until it is returned by *-profiler-log, after which
      it can't be used any more.  */
+  EMACS_INT heap_size
+    = clip_to_bounds (0, profiler_log_size, MOST_POSITIVE_FIXNUM);
+  ptrdiff_t max_stack_depth
+    = clip_to_bounds (0, profiler_max_stack_depth, PTRDIFF_MAX);;
   Lisp_Object log = make_hash_table (hashtest_profiler, heap_size,
                                     DEFAULT_REHASH_SIZE,
                                     DEFAULT_REHASH_THRESHOLD,
@@ -54,8 +72,7 @@ make_log (EMACS_INT heap_size, EMACS_INT max_stack_depth)
      with the vectors we'll put in them.  */
   ptrdiff_t i = ASIZE (h->key_and_value) >> 1;
   while (i > 0)
-    set_hash_key_slot (h, --i,
-                      Fmake_vector (make_fixnum (max_stack_depth), Qnil));
+    set_hash_key_slot (h, --i, make_nil_vector (max_stack_depth));
   return log;
 }
 
@@ -105,9 +122,8 @@ static void evict_lower_half (log_t *log)
 {
   ptrdiff_t size = ASIZE (log->key_and_value) / 2;
   EMACS_INT median = approximate_median (log, 0, size);
-  ptrdiff_t i;
 
-  for (i = 0; i < size; i++)
+  for (ptrdiff_t i = 0; i < size; i++)
     /* Evict not only values smaller but also values equal to the median,
        so as to make sure we evict something no matter what.  */
     if (XFIXNUM (HASH_VALUE (log, i)) <= median)
@@ -135,17 +151,14 @@ static void evict_lower_half (log_t *log)
 static void
 record_backtrace (log_t *log, EMACS_INT count)
 {
-  Lisp_Object backtrace;
-  ptrdiff_t index;
-
   if (log->next_free < 0)
     /* FIXME: transfer the evicted counts to a special entry rather
        than dropping them on the floor.  */
     evict_lower_half (log);
-  index = log->next_free;
+  ptrdiff_t index = log->next_free;
 
   /* Get a "working memory" vector.  */
-  backtrace = HASH_KEY (log, index);
+  Lisp_Object backtrace = HASH_KEY (log, index);
   get_backtrace (backtrace);
 
   { /* We basically do a `gethash+puthash' here, except that we have to be
@@ -219,12 +232,6 @@ static EMACS_INT current_sampling_interval;
 
 /* Signal handler for sampling profiler.  */
 
-/* timer_getoverrun is not implemented on Cygwin, but the following
-   seems to be good enough for profiling. */
-#ifdef CYGWIN
-#define timer_getoverrun(x) 0
-#endif
-
 static void
 handle_profiler_signal (int signal)
 {
@@ -239,7 +246,7 @@ handle_profiler_signal (int signal)
   else
     {
       EMACS_INT count = 1;
-#ifdef HAVE_ITIMERSPEC
+#if defined HAVE_ITIMERSPEC && defined HAVE_TIMER_GETOVERRUN
       if (profiler_timer_ok)
        {
          int overruns = timer_getoverrun (profiler_timer);
@@ -261,9 +268,6 @@ deliver_profiler_signal (int signal)
 static int
 setup_cpu_timer (Lisp_Object sampling_interval)
 {
-  struct sigaction action;
-  struct itimerval timer;
-  struct timespec interval;
   int billion = 1000000000;
 
   if (! RANGED_FIXNUMP (1, sampling_interval,
@@ -274,8 +278,10 @@ setup_cpu_timer (Lisp_Object sampling_interval)
     return -1;
 
   current_sampling_interval = XFIXNUM (sampling_interval);
-  interval = make_timespec (current_sampling_interval / billion,
-                           current_sampling_interval % billion);
+  struct timespec interval
+    = make_timespec (current_sampling_interval / billion,
+                    current_sampling_interval % billion);
+  struct sigaction action;
   emacs_sigaction_init (&action, deliver_profiler_signal);
   sigaction (SIGPROF, &action, 0);
 
@@ -295,16 +301,15 @@ setup_cpu_timer (Lisp_Object sampling_interval)
 #endif
        CLOCK_REALTIME
       };
-      int i;
       struct sigevent sigev;
       sigev.sigev_value.sival_ptr = &profiler_timer;
       sigev.sigev_signo = SIGPROF;
       sigev.sigev_notify = SIGEV_SIGNAL;
 
-      for (i = 0; i < ARRAYELTS (system_clock); i++)
+      for (int i = 0; i < ARRAYELTS (system_clock); i++)
        if (timer_create (system_clock[i], &sigev, &profiler_timer) == 0)
          {
-           profiler_timer_ok = 1;
+           profiler_timer_ok = true;
            break;
          }
     }
@@ -319,6 +324,7 @@ setup_cpu_timer (Lisp_Object sampling_interval)
 #endif
 
 #ifdef HAVE_SETITIMER
+  struct itimerval timer;
   timer.it_value = timer.it_interval = make_timeval (interval);
   if (setitimer (ITIMER_PROF, &timer, 0) == 0)
     return SETITIMER_RUNNING;
@@ -340,12 +346,11 @@ See also `profiler-log-size' and 
`profiler-max-stack-depth'.  */)
   if (NILP (cpu_log))
     {
       cpu_gc_count = 0;
-      cpu_log = make_log (profiler_log_size,
-                         profiler_max_stack_depth);
+      cpu_log = make_log ();
     }
 
   int status = setup_cpu_timer (sampling_interval);
-  if (status == -1)
+  if (status < 0)
     {
       profiler_cpu_running = NOT_RUNNING;
       error ("Invalid sampling interval");
@@ -374,8 +379,7 @@ Return non-nil if the profiler was running.  */)
 #ifdef HAVE_ITIMERSPEC
     case TIMER_SETTIME_RUNNING:
       {
-       struct itimerspec disable;
-       memset (&disable, 0, sizeof disable);
+       struct itimerspec disable = { 0, };
        timer_settime (profiler_timer, 0, &disable, 0);
       }
       break;
@@ -384,8 +388,7 @@ Return non-nil if the profiler was running.  */)
 #ifdef HAVE_SETITIMER
     case SETITIMER_RUNNING:
       {
-       struct itimerval disable;
-       memset (&disable, 0, sizeof disable);
+       struct itimerval disable = { 0, };
        setitimer (ITIMER_PROF, &disable, 0);
       }
       break;
@@ -419,10 +422,8 @@ Before returning, a new log is allocated for future 
samples.  */)
   /* Here we're making the log visible to Elisp, so it's not safe any
      more for our use afterwards since we can't rely on its special
      pre-allocated keys anymore.  So we have to allocate a new one.  */
-  cpu_log = (profiler_cpu_running
-            ? make_log (profiler_log_size, profiler_max_stack_depth)
-            : Qnil);
-  Fputhash (Fmake_vector (make_fixnum (1), QAutomatic_GC),
+  cpu_log = profiler_cpu_running ? make_log () : Qnil;
+  Fputhash (make_vector (1, QAutomatic_GC),
            make_fixnum (cpu_gc_count),
            result);
   cpu_gc_count = 0;
@@ -450,8 +451,7 @@ See also `profiler-log-size' and 
`profiler-max-stack-depth'.  */)
     error ("Memory profiler is already running");
 
   if (NILP (memory_log))
-    memory_log = make_log (profiler_log_size,
-                          profiler_max_stack_depth);
+    memory_log = make_log ();
 
   profiler_memory_running = true;
 
@@ -494,9 +494,7 @@ Before returning, a new log is allocated for future 
samples.  */)
   /* Here we're making the log visible to Elisp , so it's not safe any
      more for our use afterwards since we can't rely on its special
      pre-allocated keys anymore.  So we have to allocate a new one.  */
-  memory_log = (profiler_memory_running
-               ? make_log (profiler_log_size, profiler_max_stack_depth)
-               : Qnil);
+  memory_log = profiler_memory_running ? make_log () : Qnil;
   return result;
 }
 
@@ -537,10 +535,10 @@ cmpfn_profiler (struct hash_table_test *t,
 {
   if (VECTORP (bt1) && VECTORP (bt2))
     {
-      ptrdiff_t i, l = ASIZE (bt1);
+      ptrdiff_t l = ASIZE (bt1);
       if (l != ASIZE (bt2))
        return false;
-      for (i = 0; i < l; i++)
+      for (ptrdiff_t i = 0; i < l; i++)
        if (NILP (Ffunction_equal (AREF (bt1, i), AREF (bt2, i))))
          return false;
       return true;
@@ -555,8 +553,8 @@ hashfn_profiler (struct hash_table_test *ht, Lisp_Object bt)
   if (VECTORP (bt))
     {
       EMACS_UINT hash = 0;
-      ptrdiff_t i, l = ASIZE (bt);
-      for (i = 0; i < l; i++)
+      ptrdiff_t l = ASIZE (bt);
+      for (ptrdiff_t i = 0; i < l; i++)
        {
          Lisp_Object f = AREF (bt, i);
          EMACS_UINT hash1
@@ -571,6 +569,8 @@ hashfn_profiler (struct hash_table_test *ht, Lisp_Object bt)
     return XHASH (bt);
 }
 
+static void syms_of_profiler_for_pdumper (void);
+
 void
 syms_of_profiler (void)
 {
@@ -585,12 +585,6 @@ to make room for new entries.  */);
 
   DEFSYM (Qprofiler_backtrace_equal, "profiler-backtrace-equal");
 
-  hashtest_profiler.name = Qprofiler_backtrace_equal;
-  hashtest_profiler.user_hash_function = Qnil;
-  hashtest_profiler.user_cmp_function = Qnil;
-  hashtest_profiler.cmpfn = cmpfn_profiler;
-  hashtest_profiler.hashfn = hashfn_profiler;
-
   defsubr (&Sfunction_equal);
 
 #ifdef PROFILER_CPU_SUPPORT
@@ -609,4 +603,26 @@ to make room for new entries.  */);
   defsubr (&Sprofiler_memory_stop);
   defsubr (&Sprofiler_memory_running_p);
   defsubr (&Sprofiler_memory_log);
+
+  pdumper_do_now_and_after_load (syms_of_profiler_for_pdumper);
+}
+
+static void
+syms_of_profiler_for_pdumper (void)
+{
+  if (dumped_with_pdumper_p ())
+    {
+#ifdef PROFILER_CPU_SUPPORT
+      cpu_log = Qnil;
+#endif
+      memory_log = Qnil;
+    }
+  else
+    {
+#ifdef PROFILER_CPU_SUPPORT
+      eassert (NILP (cpu_log));
+#endif
+      eassert (NILP (memory_log));
+    }
+
 }
diff --git a/src/ptr-bounds.h b/src/ptr-bounds.h
index 8cbd58d..b779816 100644
--- a/src/ptr-bounds.h
+++ b/src/ptr-bounds.h
@@ -1,6 +1,6 @@
 /* Pointer bounds checking for GNU Emacs
 
-Copyright 2017-2018 Free Software Foundation, Inc.
+Copyright 2017-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/puresize.h b/src/puresize.h
index b37ab97..f120a4b 100644
--- a/src/puresize.h
+++ b/src/puresize.h
@@ -1,5 +1,5 @@
 /* How much read-only Lisp storage a dumped Emacs needs.
-   Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/ralloc.c b/src/ralloc.c
index 046d550..66ea2ec 100644
--- a/src/ralloc.c
+++ b/src/ralloc.c
@@ -1,5 +1,5 @@
 /* Block-relocating memory allocator.
-   Copyright (C) 1993, 1995, 2000-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993, 1995, 2000-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -26,11 +26,9 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 #include <stddef.h>
 
-#ifdef emacs
-# include "lisp.h"
-# include "blockinput.h"
-# include <unistd.h>
-#endif
+#include "lisp.h"
+#include "blockinput.h"
+#include <unistd.h>
 
 #include "getpagesize.h"
 
@@ -924,9 +922,7 @@ r_alloc_free (void **ptr)
   free_bloc (dead_bloc);
   *ptr = 0;
 
-#ifdef emacs
   refill_memory_reserve ();
-#endif
 }
 
 /* Given a pointer at address PTR to relocatable data, resize it to SIZE.
@@ -1000,7 +996,7 @@ r_re_alloc (void **ptr, size_t size)
 }
 
 
-#if defined (emacs) && defined (DOUG_LEA_MALLOC)
+#ifdef DOUG_LEA_MALLOC
 
 /* Reinitialize the morecore hook variables after restarting a dumped
    Emacs.  This is needed when using Doug Lea's malloc from GNU libc.  */
diff --git a/src/regex-emacs.c b/src/regex-emacs.c
index d19838a..8dc6980 100644
--- a/src/regex-emacs.c
+++ b/src/regex-emacs.c
@@ -1,6 +1,6 @@
 /* Emacs regular expression matching and search
 
-   Copyright (C) 1993-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -151,8 +151,6 @@
 
 #define ISWORD(c) (SYNTAX (c) == Sword)
 
-#define SIGN_EXTEND_CHAR(c) ((signed char) (c))
-
 /* Use alloca instead of malloc.  This is because using malloc in
    re_search* or re_match* could cause memory leaks when C-g is used
    in Emacs (note that SAFE_ALLOCA could also call malloc, but does so
@@ -182,10 +180,6 @@ ptrdiff_t emacs_re_safe_alloca = MAX_ALLOCA;
 #define FIRST_STRING_P(ptr)                                    \
   (size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
 
-/* (Re)Allocate N items of type T using malloc, or fail.  */
-#define TALLOC(n, t) ((t *) xmalloc ((n) * sizeof (t)))
-#define RETALLOC(addr, n, t) ((addr) = (t *) xrealloc (addr, (n) * sizeof (t)))
-
 #define BYTEWIDTH 8 /* In bits.  */
 
 /* Type of source-pattern and string chars.  */
@@ -193,8 +187,8 @@ typedef const unsigned char re_char;
 
 static void re_compile_fastmap (struct re_pattern_buffer *);
 static ptrdiff_t re_match_2_internal (struct re_pattern_buffer *bufp,
-                                    re_char *string1, size_t size1,
-                                    re_char *string2, size_t size2,
+                                    re_char *string1, ptrdiff_t size1,
+                                    re_char *string2, ptrdiff_t size2,
                                     ptrdiff_t pos,
                                     struct re_registers *regs,
                                     ptrdiff_t stop);
@@ -368,8 +362,8 @@ typedef enum
 static int
 extract_number (re_char *source)
 {
-  unsigned leading_byte = SIGN_EXTEND_CHAR (source[1]);
-  return (leading_byte << 8) + source[0];
+  signed char leading_byte = source[1];
+  return leading_byte * 256 + source[0];
 }
 
 /* Same as EXTRACT_NUMBER, except increment SOURCE to after the number.
@@ -416,7 +410,7 @@ extract_number_and_incr (re_char **source)
 #define CHARSET_BITMAP_SIZE(p) ((p)[1] & 0x7F)
 
 /* Nonzero if charset P has range table.  */
-#define CHARSET_RANGE_TABLE_EXISTS_P(p)         ((p)[1] & 0x80)
+#define CHARSET_RANGE_TABLE_EXISTS_P(p)         (((p)[1] & 0x80) != 0)
 
 /* Return the address of range table of charset P.  But not the start
    of table itself, but the before where the number of ranges is
@@ -460,18 +454,18 @@ static int regex_emacs_debug = -100000;
 static void
 print_fastmap (char *fastmap)
 {
-  unsigned was_a_range = 0;
-  unsigned i = 0;
+  bool was_a_range = false;
+  int i = 0;
 
   while (i < (1 << BYTEWIDTH))
     {
       if (fastmap[i++])
        {
-         was_a_range = 0;
+         was_a_range = false;
          putchar (i - 1);
          while (i < (1 << BYTEWIDTH)  &&  fastmap[i])
            {
-             was_a_range = 1;
+             was_a_range = true;
              i++;
            }
          if (was_a_range)
@@ -545,10 +539,10 @@ print_partial_compiled_pattern (re_char *start, re_char 
*end)
        case charset:
        case charset_not:
          {
-           register int c, last = -100;
-           register int in_range = 0;
+           int c, last = -100;
+           bool in_range = false;
            int length = CHARSET_BITMAP_SIZE (p - 1);
-           int has_range_table = CHARSET_RANGE_TABLE_EXISTS_P (p - 1);
+           bool has_range_table = CHARSET_RANGE_TABLE_EXISTS_P (p - 1);
 
            fprintf (stderr, "/charset [%s",
                     (re_opcode_t) *(p - 1) == charset_not ? "^" : "");
@@ -564,13 +558,13 @@ print_partial_compiled_pattern (re_char *start, re_char 
*end)
                  if (last + 1 == c && ! in_range)
                    {
                      fprintf (stderr, "-");
-                     in_range = 1;
+                     in_range = true;
                    }
                  /* Have we broken a range?  */
                  else if (last + 1 != c && in_range)
                    {
                      fprintf (stderr, "%c", last);
-                     in_range = 0;
+                     in_range = false;
                    }
 
                  if (! in_range)
@@ -698,7 +692,6 @@ print_partial_compiled_pattern (re_char *start, re_char 
*end)
          fprintf (stderr, "/%d", mcnt);
          break;
 
-# ifdef emacs
        case at_dot:
          fprintf (stderr, "/at_dot");
          break;
@@ -714,7 +707,6 @@ print_partial_compiled_pattern (re_char *start, re_char 
*end)
          mcnt = *p++;
          fprintf (stderr, "/%d", mcnt);
          break;
-# endif /* emacs */
 
        case begbuf:
          fprintf (stderr, "/begbuf");
@@ -741,7 +733,7 @@ print_compiled_pattern (struct re_pattern_buffer *bufp)
   re_char *buffer = bufp->buffer;
 
   print_partial_compiled_pattern (buffer, buffer + bufp->used);
-  printf ("%zu bytes used/%zu bytes allocated.\n",
+  printf ("%tu bytes used/%tu bytes allocated.\n",
          bufp->used, bufp->allocated);
 
   if (bufp->fastmap_accurate && bufp->fastmap)
@@ -750,37 +742,29 @@ print_compiled_pattern (struct re_pattern_buffer *bufp)
       print_fastmap (bufp->fastmap);
     }
 
-  printf ("re_nsub: %zu\t", bufp->re_nsub);
+  printf ("re_nsub: %tu\t", bufp->re_nsub);
   printf ("regs_alloc: %d\t", bufp->regs_allocated);
   printf ("can_be_null: %d\t", bufp->can_be_null);
-#ifndef emacs
-  printf ("syntax: %lx\n", bufp->syntax);
-#endif
   fflush (stdout);
   /* Perhaps we should print the translate table?  */
 }
 
 
 static void
-print_double_string (re_char *where, re_char *string1, ssize_t size1,
-                    re_char *string2, ssize_t size2)
+print_double_string (re_char *where, re_char *string1, ptrdiff_t size1,
+                    re_char *string2, ptrdiff_t size2)
 {
-  ssize_t this_char;
-
   if (where == NULL)
     printf ("(null)");
   else
     {
       if (FIRST_STRING_P (where))
        {
-         for (this_char = where - string1; this_char < size1; this_char++)
-           putchar (string1[this_char]);
-
+         fwrite_unlocked (where, 1, string1 + size1 - where, stdout);
          where = string2;
        }
 
-      for (this_char = where - string2; this_char < size2; this_char++)
-       putchar (string2[this_char]);
+      fwrite_unlocked (where, 1, string2 + size2 - where, stdout);
     }
 }
 
@@ -877,13 +861,12 @@ enum { RE_NREGS = 30 };
    whose default stack limit is 2mb.  In order for a larger
    value to work reliably, you have to try to make it accord
    with the process stack limit.  */
-size_t emacs_re_max_failures = 40000;
+ptrdiff_t emacs_re_max_failures = 40000;
 
 union fail_stack_elt
 {
   re_char *pointer;
-  /* This should be the biggest 'int' that's no bigger than a pointer.  */
-  long integer;
+  intptr_t integer;
 };
 
 typedef union fail_stack_elt fail_stack_elt_t;
@@ -891,9 +874,9 @@ typedef union fail_stack_elt fail_stack_elt_t;
 typedef struct
 {
   fail_stack_elt_t *stack;
-  size_t size;
-  size_t avail;        /* Offset of next open position.  */
-  size_t frame;        /* Offset of the cur constructed frame.  */
+  ptrdiff_t size;
+  ptrdiff_t avail;     /* Offset of next open position.  */
+  ptrdiff_t frame;     /* Offset of the cur constructed frame.  */
 } fail_stack_type;
 
 #define FAIL_STACK_EMPTY()     (fail_stack.frame == 0)
@@ -972,17 +955,17 @@ typedef struct
 while (REMAINING_AVAIL_SLOTS <= space) {                               \
   if (!GROW_FAIL_STACK (fail_stack))                                   \
     return -2;                                                         \
-  DEBUG_PRINT ("\n  Doubled stack; size now: %zu\n", (fail_stack).size);\
-  DEBUG_PRINT ("        slots available: %zu\n", REMAINING_AVAIL_SLOTS);\
+  DEBUG_PRINT ("\n  Doubled stack; size now: %tu\n", fail_stack.size); \
+  DEBUG_PRINT ("        slots available: %tu\n", REMAINING_AVAIL_SLOTS);\
 }
 
 /* Push register NUM onto the stack.  */
 #define PUSH_FAILURE_REG(num)                                          \
 do {                                                                   \
   char *destination;                                                   \
-  long n = num;                                                                
\
+  intptr_t n = num;                                                    \
   ENSURE_FAIL_STACK(3);                                                        
\
-  DEBUG_PRINT ("    Push reg %ld (spanning %p -> %p)\n",               \
+  DEBUG_PRINT ("    Push reg %"PRIdPTR" (spanning %p -> %p)\n",                
\
               n, regstart[n], regend[n]);                              \
   PUSH_FAILURE_POINTER (regstart[n]);                                  \
   PUSH_FAILURE_POINTER (regend[n]);                                    \
@@ -1007,7 +990,7 @@ do {                                                       
                \
 /* Pop a saved register off the stack.  */
 #define POP_FAILURE_REG_OR_COUNT()                                     \
 do {                                                                   \
-  long pfreg = POP_FAILURE_INT ();                                     \
+  intptr_t pfreg = POP_FAILURE_INT ();                                 \
   if (pfreg == -1)                                                     \
     {                                                                  \
       /* It's a counter.  */                                           \
@@ -1015,7 +998,7 @@ do {                                                       
                \
       unsigned char *ptr = (unsigned char *) POP_FAILURE_POINTER ();   \
       pfreg = POP_FAILURE_INT ();                                      \
       STORE_NUMBER (ptr, pfreg);                                       \
-      DEBUG_PRINT ("     Pop counter %p = %ld\n", ptr, pfreg);         \
+      DEBUG_PRINT ("     Pop counter %p = %"PRIdPTR"\n", ptr, pfreg);  \
     }                                                                  \
   else                                                                 \
     {                                                                  \
@@ -1039,7 +1022,7 @@ do {                                                      
                \
               && FAILURE_PAT (failure) <= bufp->buffer + bufp->used);  \
       if (FAILURE_PAT (failure) == pat_cur)                            \
        {                                                               \
-         cycle = 1;                                                    \
+         cycle = true;                                                 \
          break;                                                        \
        }                                                               \
       DEBUG_PRINT ("  Other pattern: %p\n", FAILURE_PAT (failure));    \
@@ -1062,14 +1045,14 @@ do {                                                    
                \
   char *destination;                                                   \
   DEBUG_STATEMENT (nfailure_points_pushed++);                          \
   DEBUG_PRINT ("\nPUSH_FAILURE_POINT:\n");                             \
-  DEBUG_PRINT ("  Before push, next avail: %zu\n", (fail_stack).avail);        
\
-  DEBUG_PRINT ("                       size: %zu\n", (fail_stack).size);\
+  DEBUG_PRINT ("  Before push, next avail: %tu\n", fail_stack.avail);  \
+  DEBUG_PRINT ("                       size: %tu\n", fail_stack.size); \
                                                                        \
   ENSURE_FAIL_STACK (NUM_NONREG_ITEMS);                                        
\
                                                                        \
   DEBUG_PRINT ("\n");                                                  \
                                                                        \
-  DEBUG_PRINT ("  Push frame index: %zu\n", fail_stack.frame);         \
+  DEBUG_PRINT ("  Push frame index: %tu\n", fail_stack.frame);         \
   PUSH_FAILURE_INT (fail_stack.frame);                                 \
                                                                        \
   DEBUG_PRINT ("  Push string %p: \"", string_place);                  \
@@ -1111,8 +1094,8 @@ do {                                                      
                \
                                                                        \
   /* Remove failure points and point to how many regs pushed.  */      \
   DEBUG_PRINT ("POP_FAILURE_POINT:\n");                                        
\
-  DEBUG_PRINT ("  Before pop, next avail: %zu\n", fail_stack.avail);   \
-  DEBUG_PRINT ("                    size: %zu\n", fail_stack.size);    \
+  DEBUG_PRINT ("  Before pop, next avail: %tu\n", fail_stack.avail);   \
+  DEBUG_PRINT ("                    size: %tu\n", fail_stack.size);    \
                                                                        \
   /* Pop the saved registers.  */                                      \
   while (fail_stack.frame < fail_stack.avail)                          \
@@ -1146,7 +1129,7 @@ do {                                                      
                \
 
 /* Subroutine declarations and macros for regex_compile.  */
 
-static reg_errcode_t regex_compile (re_char *pattern, size_t size,
+static reg_errcode_t regex_compile (re_char *pattern, ptrdiff_t size,
                                    bool posix_backtracking,
                                    const char *whitespace_regexp,
                                    struct re_pattern_buffer *bufp);
@@ -1160,7 +1143,7 @@ static bool at_begline_loc_p (re_char *pattern, re_char 
*p);
 static bool at_endline_loc_p (re_char *p, re_char *pend);
 static re_char *skip_one_char (re_char *p);
 static int analyze_first (re_char *p, re_char *pend,
-                         char *fastmap, const int multibyte);
+                         char *fastmap, bool multibyte);
 
 /* Fetch the next character in the uncompiled pattern, with no
    translation.  */
@@ -1183,8 +1166,8 @@ static int analyze_first (re_char *p, re_char *pend,
 
 /* Ensure at least N more bytes of space in buffer.  */
 #define GET_BUFFER_SPACE(n)                                            \
-    while ((size_t) (b - bufp->buffer + (n)) > bufp->allocated)                
\
-      EXTEND_BUFFER ()
+    if (bufp->buffer + bufp->allocated - b < (n))                      \
+      EXTEND_BUFFER ((n) - (bufp->buffer + bufp->allocated - b))
 
 /* Ensure one more byte of buffer space and then add C to it.  */
 #define BUF_PUSH(c)                                                    \
@@ -1226,18 +1209,16 @@ static int analyze_first (re_char *p, re_char *pend,
    be too small, many things would have to change.  */
 # define MAX_BUF_SIZE (1 << 15)
 
-/* Extend the buffer by twice its current size via realloc and
+/* Extend the buffer by at least N bytes via realloc and
    reset the pointers that pointed into the old block to point to the
    correct places in the new one.  If extending the buffer results in it
    being larger than MAX_BUF_SIZE, then flag memory exhausted.  */
-#define EXTEND_BUFFER()                                                        
\
+#define EXTEND_BUFFER(n)                                               \
   do {                                                                 \
+    ptrdiff_t requested_extension = n;                                 \
     unsigned char *old_buffer = bufp->buffer;                          \
-    if (bufp->allocated == MAX_BUF_SIZE)                               \
+    if (MAX_BUF_SIZE - bufp->allocated < requested_extension)          \
       return REG_ESIZE;                                                        
\
-    bufp->allocated <<= 1;                                             \
-    if (bufp->allocated > MAX_BUF_SIZE)                                        
\
-      bufp->allocated = MAX_BUF_SIZE;                                  \
     ptrdiff_t b_off = b - old_buffer;                                  \
     ptrdiff_t begalt_off = begalt - old_buffer;                                
\
     bool fixup_alt_jump_set = !!fixup_alt_jump;                                
\
@@ -1247,7 +1228,8 @@ static int analyze_first (re_char *p, re_char *pend,
     if (fixup_alt_jump_set) fixup_alt_jump_off = fixup_alt_jump - old_buffer; \
     if (laststart_set) laststart_off = laststart - old_buffer;         \
     if (pending_exact_set) pending_exact_off = pending_exact - old_buffer; \
-    RETALLOC (bufp->buffer, bufp->allocated, unsigned char);           \
+    bufp->buffer = xpalloc (bufp->buffer, &bufp->allocated,            \
+                           requested_extension, MAX_BUF_SIZE, 1);      \
     unsigned char *new_buffer = bufp->buffer;                          \
     b = new_buffer + b_off;                                            \
     begalt = new_buffer + begalt_off;                                  \
@@ -1269,9 +1251,8 @@ typedef int regnum_t;
 
 /* Macros for the compile stack.  */
 
-/* Since offsets can go either forwards or backwards, this type needs to
-   be able to hold values from -(MAX_BUF_SIZE - 1) to MAX_BUF_SIZE - 1.  */
 typedef long pattern_offset_t;
+verify (LONG_MIN <= -(MAX_BUF_SIZE - 1) && MAX_BUF_SIZE - 1 <= LONG_MAX);
 
 typedef struct
 {
@@ -1285,8 +1266,8 @@ typedef struct
 typedef struct
 {
   compile_stack_elt_t *stack;
-  size_t size;
-  size_t avail;                        /* Offset of next open position.  */
+  ptrdiff_t size;
+  ptrdiff_t avail;             /* Offset of next open position.  */
 } compile_stack_type;
 
 
@@ -1307,9 +1288,7 @@ struct range_table_work_area
   int bits;                    /* flag to record character classes */
 };
 
-/* Make sure that WORK_AREA can hold more N multibyte characters.
-   This is used only in set_image_of_range and set_image_of_range_1.
-   It expects WORK_AREA to be a pointer.
+/* Make sure that WORK_AREA can hold N more multibyte characters.
    If it can't get the space, it returns from the surrounding function.  */
 
 #define EXTEND_RANGE_TABLE(work_area, n)                               \
@@ -1506,7 +1485,7 @@ struct range_table_work_area
    The function can be used on ASCII and multibyte (UTF-8-encoded) strings.
  */
 re_wctype_t
-re_wctype_parse (const unsigned char **strp, unsigned limit)
+re_wctype_parse (const unsigned char **strp, ptrdiff_t limit)
 {
   const char *beg = (const char *)*strp, *it;
 
@@ -1684,13 +1663,13 @@ do {                                                    
                \
      'buffer' is the compiled pattern;
      'syntax' is set to SYNTAX;
      'used' is set to the length of the compiled pattern;
-     'fastmap_accurate' is zero;
+     'fastmap_accurate' is false;
      're_nsub' is the number of subexpressions in PATTERN;
 
    The 'fastmap' field is neither examined nor set.  */
 
 static reg_errcode_t
-regex_compile (re_char *pattern, size_t size,
+regex_compile (re_char *pattern, ptrdiff_t size,
               bool posix_backtracking,
               const char *whitespace_regexp,
               struct re_pattern_buffer *bufp)
@@ -1737,7 +1716,7 @@ regex_compile (re_char *pattern, size_t size,
   /* Work area for range table of charset.  */
   struct range_table_work_area range_table_work;
 
-  /* If the object matched can contain multibyte characters.  */
+  /* If the regular expression is multibyte.  */
   bool multibyte = RE_MULTIBYTE_P (bufp);
 
   /* Nonzero if we have pushed down into a subpattern.  */
@@ -1754,16 +1733,15 @@ regex_compile (re_char *pattern, size_t size,
   DEBUG_PRINT ("\nCompiling pattern: ");
   if (regex_emacs_debug > 0)
     {
-      size_t debug_count;
-
-      for (debug_count = 0; debug_count < size; debug_count++)
+      for (ptrdiff_t debug_count = 0; debug_count < size; debug_count++)
        putchar (pattern[debug_count]);
       putchar ('\n');
     }
 #endif
 
   /* Initialize the compile stack.  */
-  compile_stack.stack = TALLOC (INIT_COMPILE_STACK_SIZE, compile_stack_elt_t);
+  compile_stack.stack = xmalloc (INIT_COMPILE_STACK_SIZE
+                                * sizeof *compile_stack.stack);
   compile_stack.size = INIT_COMPILE_STACK_SIZE;
   compile_stack.avail = 0;
 
@@ -1771,8 +1749,8 @@ regex_compile (re_char *pattern, size_t size,
   range_table_work.allocated = 0;
 
   /* Initialize the pattern buffer.  */
-  bufp->fastmap_accurate = 0;
-  bufp->used_syntax = 0;
+  bufp->fastmap_accurate = false;
+  bufp->used_syntax = false;
 
   /* Set 'used' to zero, so that if we return an error, the pattern
      printer (for debugging) will think there's no pattern.  We reset it
@@ -1783,16 +1761,9 @@ regex_compile (re_char *pattern, size_t size,
 
   if (bufp->allocated == 0)
     {
-      if (bufp->buffer)
-       { /* If zero allocated, but buffer is non-null, try to realloc
-            enough space.  This loses if buffer's address is bogus, but
-            that is the user's responsibility.  */
-         RETALLOC (bufp->buffer, INIT_BUF_SIZE, unsigned char);
-       }
-      else
-       { /* Caller did not allocate a buffer.  Do it for them.  */
-         bufp->buffer = TALLOC (INIT_BUF_SIZE, unsigned char);
-       }
+      /* This loses if BUFP->buffer is bogus, but that is the user's
+        responsibility.  */
+      bufp->buffer = xrealloc (bufp->buffer, INIT_BUF_SIZE);
       bufp->allocated = INIT_BUF_SIZE;
     }
 
@@ -1912,10 +1883,10 @@ regex_compile (re_char *pattern, size_t size,
                if (many_times_ok)
                  {
                    bool simple = skip_one_char (laststart) == b;
-                   size_t startoffset = 0;
+                   ptrdiff_t startoffset = 0;
                    re_opcode_t ofj =
                      /* Check if the loop can match the empty string.  */
-                     (simple || !analyze_first (laststart, b, NULL, 0))
+                     (simple || !analyze_first (laststart, b, NULL, false))
                      ? on_failure_jump : on_failure_jump_loop;
                    eassert (skip_one_char (laststart) <= b);
 
@@ -1962,7 +1933,7 @@ regex_compile (re_char *pattern, size_t size,
                GET_BUFFER_SPACE (7); /* We might use less.  */
                if (many_times_ok)
                  {
-                   bool emptyp = analyze_first (laststart, b, NULL, 0);
+                   bool emptyp = !!analyze_first (laststart, b, NULL, false);
 
                    /* The non-greedy multiple match looks like
                       a repeat..until: we only need a conditional jump
@@ -2080,7 +2051,7 @@ regex_compile (re_char *pattern, size_t size,
                       content of the syntax-table is not hardcoded in the
                       range_table.  SPACE and WORD are the two exceptions.  */
                    if ((1 << cc) & ((1 << RECC_SPACE) | (1 << RECC_WORD)))
-                     bufp->used_syntax = 1;
+                     bufp->used_syntax = true;
 
                    /* Repeat the loop. */
                    continue;
@@ -2187,7 +2158,7 @@ regex_compile (re_char *pattern, size_t size,
            {
            case '(':
              {
-               int shy = 0;
+               bool shy = false;
                regnum_t regnum = 0;
                if (p+1 < pend)
                  {
@@ -2200,7 +2171,7 @@ regex_compile (re_char *pattern, size_t size,
                            PATFETCH (c);
                            switch (c)
                              {
-                             case ':': shy = 1; break;
+                             case ':': shy = true; break;
                              case '0':
                                /* An explicitly specified regnum must start
                                   with non-0. */
@@ -2209,7 +2180,11 @@ regex_compile (re_char *pattern, size_t size,
                                FALLTHROUGH;
                              case '1': case '2': case '3': case '4':
                              case '5': case '6': case '7': case '8': case '9':
-                               regnum = 10*regnum + (c - '0'); break;
+                               if (INT_MULTIPLY_WRAPV (regnum, 10, &regnum)
+                                   || INT_ADD_WRAPV (regnum, c - '0',
+                                                     &regnum))
+                                 FREE_STACK_RETURN (REG_ESIZE);
+                               break;
                              default:
                                /* Only (?:...) is supported right now. */
                                FREE_STACK_RETURN (REG_BADPAT);
@@ -2222,7 +2197,7 @@ regex_compile (re_char *pattern, size_t size,
                  regnum = ++bufp->re_nsub;
                else if (regnum)
                  { /* It's actually not shy, but explicitly numbered.  */
-                   shy = 0;
+                   shy = false;
                    if (regnum > bufp->re_nsub)
                      bufp->re_nsub = regnum;
                    else if (regnum > bufp->re_nsub
@@ -2239,11 +2214,9 @@ regex_compile (re_char *pattern, size_t size,
                  regnum = - bufp->re_nsub;
 
                if (COMPILE_STACK_FULL)
-                 {
-                   RETALLOC (compile_stack.stack, compile_stack.size << 1,
-                             compile_stack_elt_t);
-                   compile_stack.size <<= 1;
-                 }
+                 compile_stack.stack
+                   = xpalloc (compile_stack.stack, &compile_stack.size,
+                              1, -1, sizeof *compile_stack.stack);
 
                /* These are the values to restore when we hit end of this
                   group.  They are all relative offsets, so that if the
@@ -2400,9 +2373,8 @@ regex_compile (re_char *pattern, size_t size,
                else
                  { /* If the upper bound is > 1, we need to insert
                       more at the end of the loop.  */
-                   unsigned int nbytes = (upper_bound < 0 ? 3
-                                          : upper_bound > 1 ? 5 : 0);
-                   unsigned int startoffset = 0;
+                   int nbytes = upper_bound < 0 ? 3 : upper_bound > 1 ? 5 : 0;
+                   int startoffset = 0;
 
                    GET_BUFFER_SPACE (20); /* We might use less.  */
 
@@ -2806,8 +2778,7 @@ group_in_compile_stack (compile_stack_type compile_stack, 
regnum_t regnum)
    Return -1 if fastmap was not updated accurately.  */
 
 static int
-analyze_first (re_char *p, re_char *pend, char *fastmap,
-              const int multibyte)
+analyze_first (re_char *p, re_char *pend, char *fastmap, bool multibyte)
 {
   int j, k;
   bool not;
@@ -3109,6 +3080,8 @@ re_compile_fastmap (struct re_pattern_buffer *bufp)
   eassert (fastmap && bufp->buffer);
 
   memset (fastmap, 0, 1 << BYTEWIDTH);  /* Assume nothing's valid.  */
+
+  /* FIXME: Is the following assignment correct even when ANALYSIS < 0?  */
   bufp->fastmap_accurate = 1;      /* It will be when we're done.  */
 
   analysis = analyze_first (bufp->buffer, bufp->buffer + bufp->used,
@@ -3131,7 +3104,7 @@ re_compile_fastmap (struct re_pattern_buffer *bufp)
 
 void
 re_set_registers (struct re_pattern_buffer *bufp, struct re_registers *regs,
-                 unsigned int num_regs, ptrdiff_t *starts, ptrdiff_t *ends)
+                 ptrdiff_t num_regs, ptrdiff_t *starts, ptrdiff_t *ends)
 {
   if (num_regs)
     {
@@ -3154,7 +3127,7 @@ re_set_registers (struct re_pattern_buffer *bufp, struct 
re_registers *regs,
    doesn't let you say where to stop matching. */
 
 ptrdiff_t
-re_search (struct re_pattern_buffer *bufp, const char *string, size_t size,
+re_search (struct re_pattern_buffer *bufp, const char *string, ptrdiff_t size,
           ptrdiff_t startpos, ptrdiff_t range, struct re_registers *regs)
 {
   return re_search_2 (bufp, NULL, 0, string, size, startpos, range,
@@ -3191,8 +3164,8 @@ re_search (struct re_pattern_buffer *bufp, const char 
*string, size_t size,
    stack overflow).  */
 
 ptrdiff_t
-re_search_2 (struct re_pattern_buffer *bufp, const char *str1, size_t size1,
-            const char *str2, size_t size2,
+re_search_2 (struct re_pattern_buffer *bufp, const char *str1, ptrdiff_t size1,
+            const char *str2, ptrdiff_t size2,
             ptrdiff_t startpos, ptrdiff_t range,
             struct re_registers *regs, ptrdiff_t stop)
 {
@@ -3201,7 +3174,7 @@ re_search_2 (struct re_pattern_buffer *bufp, const char 
*str1, size_t size1,
   re_char *string2 = (re_char *) str2;
   char *fastmap = bufp->fastmap;
   Lisp_Object translate = bufp->translate;
-  size_t total_size = size1 + size2;
+  ptrdiff_t total_size = size1 + size2;
   ptrdiff_t endpos = startpos + range;
   bool anchored_start;
   /* Nonzero if we are searching multibyte string.  */
@@ -3425,10 +3398,8 @@ re_search_2 (struct re_pattern_buffer *bufp, const char 
*str1, size_t size1,
 
 /* Declarations and macros for re_match_2.  */
 
-static int bcmp_translate (re_char *s1, re_char *s2,
-                          ptrdiff_t len,
-                          Lisp_Object translate,
-                          const int multibyte);
+static bool bcmp_translate (re_char *, re_char *, ptrdiff_t,
+                           Lisp_Object, bool);
 
 /* This converts PTR, a pointer into one of the search strings 'string1'
    and 'string2' into an offset from the beginning of that string.  */
@@ -3572,8 +3543,9 @@ skip_noops (re_char *p, re_char *pend)
    character (i.e. without any translations).  UNIBYTE denotes whether c is
    unibyte or multibyte character. */
 static bool
-execute_charset (re_char **pp, unsigned c, unsigned corig, bool unibyte)
+execute_charset (re_char **pp, int c, int corig, bool unibyte)
 {
+  eassume (0 <= c && 0 <= corig);
   re_char *p = *pp, *rtp = NULL;
   bool not = (re_opcode_t) *p == charset_not;
 
@@ -3633,8 +3605,8 @@ execute_charset (re_char **pp, unsigned c, unsigned 
corig, bool unibyte)
   return not;
 }
 
-/* Non-zero if "p1 matches something" implies "p2 fails".  */
-static int
+/* True if "p1 matches something" implies "p2 fails".  */
+static bool
 mutually_exclusive_p (struct re_pattern_buffer *bufp, re_char *p1,
                      re_char *p2)
 {
@@ -3667,7 +3639,7 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, 
re_char *p1,
       if (skip_one_char (p1))
        {
          DEBUG_PRINT ("  End of pattern: fast loop.\n");
-         return 1;
+         return true;
        }
       break;
 
@@ -3683,7 +3655,7 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, 
re_char *p1,
            if (c != RE_STRING_CHAR (p1 + 2, multibyte))
              {
                DEBUG_PRINT ("  '%c' != '%c' => fast loop.\n", c, p1[2]);
-               return 1;
+               return true;
              }
          }
 
@@ -3693,14 +3665,14 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, 
re_char *p1,
            if (!execute_charset (&p1, c, c, !multibyte || ASCII_CHAR_P (c)))
              {
                DEBUG_PRINT ("   No match => fast loop.\n");
-               return 1;
+               return true;
              }
          }
        else if ((re_opcode_t) *p1 == anychar
                 && c == '\n')
          {
            DEBUG_PRINT ("   . != \\n => fast loop.\n");
-           return 1;
+           return true;
          }
       }
       break;
@@ -3743,7 +3715,7 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, 
re_char *p1,
                  || idx == CHARSET_BITMAP_SIZE (p1))
                {
                  DEBUG_PRINT ("         No match => fast loop.\n");
-                 return 1;
+                 return true;
                }
            }
          else if ((re_opcode_t) *p1 == charset_not)
@@ -3760,7 +3732,7 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, 
re_char *p1,
              if (idx == p2[1])
                {
                  DEBUG_PRINT ("         No match => fast loop.\n");
-                 return 1;
+                 return true;
                }
              }
          }
@@ -3814,7 +3786,7 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, 
re_char *p1,
     }
 
   /* Safe default.  */
-  return 0;
+  return false;
 }
 
 
@@ -3833,9 +3805,10 @@ mutually_exclusive_p (struct re_pattern_buffer *bufp, 
re_char *p1,
    matched substring.  */
 
 ptrdiff_t
-re_match_2 (struct re_pattern_buffer *bufp, const char *string1,
-           size_t size1, const char *string2, size_t size2, ptrdiff_t pos,
-           struct re_registers *regs, ptrdiff_t stop)
+re_match_2 (struct re_pattern_buffer *bufp,
+           char const *string1, ptrdiff_t size1,
+           char const *string2, ptrdiff_t size2,
+           ptrdiff_t pos, struct re_registers *regs, ptrdiff_t stop)
 {
   ptrdiff_t result;
 
@@ -3854,13 +3827,13 @@ re_match_2 (struct re_pattern_buffer *bufp, const char 
*string1,
 /* This is a separate function so that we can force an alloca cleanup
    afterwards.  */
 static ptrdiff_t
-re_match_2_internal (struct re_pattern_buffer *bufp, re_char *string1,
-                    size_t size1, re_char *string2, size_t size2,
+re_match_2_internal (struct re_pattern_buffer *bufp,
+                    re_char *string1, ptrdiff_t size1,
+                    re_char *string2, ptrdiff_t size2,
                     ptrdiff_t pos, struct re_registers *regs, ptrdiff_t stop)
 {
   /* General temporaries.  */
   int mcnt;
-  size_t reg;
 
   /* Just past the end of the corresponding string.  */
   re_char *end1, *end2;
@@ -3900,13 +3873,14 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
      scanning the strings.  */
   fail_stack_type fail_stack;
 #ifdef DEBUG_COMPILES_ARGUMENTS
-  unsigned nfailure_points_pushed = 0, nfailure_points_popped = 0;
+  ptrdiff_t nfailure_points_pushed = 0, nfailure_points_popped = 0;
 #endif
 
   /* We fill all the registers internally, independent of what we
      return, for use in backreferences.  The number here includes
      an element for register zero.  */
-  size_t num_regs = bufp->re_nsub + 1;
+  ptrdiff_t num_regs = bufp->re_nsub + 1;
+  eassume (0 < num_regs);
 
   /* Information on the contents of registers. These are pointers into
      the input strings; they record just what was matched (on this
@@ -3921,7 +3895,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
      variables when we find a match better than any we've seen before.
      This happens as we backtrack through the failure points, which in
      turn happens only if we have not yet matched the entire string. */
-  unsigned best_regs_set = false;
+  bool best_regs_set = false;
   re_char **best_regstart UNINIT, **best_regend UNINIT;
 
   /* Logically, this is 'best_regend[0]'.  But we don't want to have to
@@ -3936,7 +3910,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
 
 #ifdef DEBUG_COMPILES_ARGUMENTS
   /* Counts the total number of registers pushed.  */
-  unsigned num_regs_pushed = 0;
+  ptrdiff_t num_regs_pushed = 0;
 #endif
 
   DEBUG_PRINT ("\n\nEntering re_match_2.\n");
@@ -3966,9 +3940,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
     }
 
   /* Initialize subexpression text positions to -1 to mark ones that no
-     start_memory/stop_memory has been seen for. Also initialize the
-     register information struct.  */
-  for (reg = 1; reg < num_regs; reg++)
+     start_memory/stop_memory has been seen for.  */
+  for (ptrdiff_t reg = 1; reg < num_regs; reg++)
     regstart[reg] = regend[reg] = NULL;
 
   /* We move 'string1' into 'string2' if the latter's empty -- but not if
@@ -4075,7 +4048,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
 
                      DEBUG_PRINT ("\nSAVING match as best so far.\n");
 
-                     for (reg = 1; reg < num_regs; reg++)
+                     for (ptrdiff_t reg = 1; reg < num_regs; reg++)
                        {
                          best_regstart[reg] = regstart[reg];
                          best_regend[reg] = regend[reg];
@@ -4101,7 +4074,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
                  dend = ((d >= string1 && d <= end1)
                           ? end_match_1 : end_match_2);
 
-                 for (reg = 1; reg < num_regs; reg++)
+                 for (ptrdiff_t reg = 1; reg < num_regs; reg++)
                    {
                      regstart[reg] = best_regstart[reg];
                      regend[reg] = best_regend[reg];
@@ -4117,23 +4090,25 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
            {
              /* Have the register data arrays been allocated?  */
              if (bufp->regs_allocated == REGS_UNALLOCATED)
-               { /* No.  So allocate them with malloc.  We need one
-                    extra element beyond 'num_regs' for the '-1' marker
-                    GNU code uses.  */
-                 regs->num_regs = max (RE_NREGS, num_regs + 1);
-                 regs->start = TALLOC (regs->num_regs, ptrdiff_t);
-                 regs->end = TALLOC (regs->num_regs, ptrdiff_t);
+               { /* No.  So allocate them with malloc.  */
+                 ptrdiff_t n = max (RE_NREGS, num_regs);
+                 regs->start = xnmalloc (n, sizeof *regs->start);
+                 regs->end = xnmalloc (n, sizeof *regs->end);
+                 regs->num_regs = n;
                  bufp->regs_allocated = REGS_REALLOCATE;
                }
              else if (bufp->regs_allocated == REGS_REALLOCATE)
                { /* Yes.  If we need more elements than were already
                     allocated, reallocate them.  If we need fewer, just
                     leave it alone.  */
-                 if (regs->num_regs < num_regs + 1)
+                 ptrdiff_t n = regs->num_regs;
+                 if (n < num_regs)
                    {
-                     regs->num_regs = num_regs + 1;
-                     RETALLOC (regs->start, regs->num_regs, ptrdiff_t);
-                     RETALLOC (regs->end, regs->num_regs, ptrdiff_t);
+                     n = max (n + (n >> 1), num_regs);
+                     regs->start
+                       = xnrealloc (regs->start, n, sizeof *regs->start);
+                     regs->end = xnrealloc (regs->end, n, sizeof *regs->end);
+                     regs->num_regs = n;
                    }
                }
              else
@@ -4148,9 +4123,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
                  regs->end[0] = POINTER_TO_OFFSET (d);
                }
 
-             /* Go through the first 'min (num_regs, regs->num_regs)'
-                registers, since that is all we initialized.  */
-             for (reg = 1; reg < min (num_regs, regs->num_regs); reg++)
+             for (ptrdiff_t reg = 1; reg < num_regs; reg++)
                {
                  if (REG_UNSET (regstart[reg]) || REG_UNSET (regend[reg]))
                    regs->start[reg] = regs->end[reg] = -1;
@@ -4162,18 +4135,15 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
                }
 
              /* If the regs structure we return has more elements than
-                were in the pattern, set the extra elements to -1.  If
-                we (re)allocated the registers, this is the case,
-                because we always allocate enough to have at least one
-                -1 at the end.  */
-             for (reg = num_regs; reg < regs->num_regs; reg++)
+                were in the pattern, set the extra elements to -1.  */
+             for (ptrdiff_t reg = num_regs; reg < regs->num_regs; reg++)
                regs->start[reg] = regs->end[reg] = -1;
            }
 
-         DEBUG_PRINT ("%u failure points pushed, %u popped (%u remain).\n",
+         DEBUG_PRINT ("%td failure points pushed, %td popped (%td remain).\n",
                       nfailure_points_pushed, nfailure_points_popped,
                       nfailure_points_pushed - nfailure_points_popped);
-         DEBUG_PRINT ("%u registers pushed.\n", num_regs_pushed);
+         DEBUG_PRINT ("%td registers pushed.\n", num_regs_pushed);
 
          ptrdiff_t dcnt = POINTER_TO_OFFSET (d) - pos;
 
@@ -4298,9 +4268,6 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
        case charset:
        case charset_not:
          {
-           register unsigned int c, corig;
-           int len;
-
            /* Whether matching against a unibyte character.  */
            bool unibyte_char = false;
 
@@ -4308,7 +4275,9 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
                         (re_opcode_t) *(p - 1) == charset_not ? "_not" : "");
 
            PREFETCH ();
-           corig = c = RE_STRING_CHAR_AND_LENGTH (d, len, target_multibyte);
+           int len;
+           int corig = RE_STRING_CHAR_AND_LENGTH (d, len, target_multibyte);
+           int c = corig;
            if (target_multibyte)
              {
                int c1;
@@ -4376,7 +4345,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
          /* Strictly speaking, there should be code such as:
 
                eassert (REG_UNSET (regend[*p]));
-               PUSH_FAILURE_REGSTOP ((unsigned int)*p);
+               PUSH_FAILURE_REGSTOP (*p);
 
             But the only info to be pushed is regend[*p] and it is known to
             be UNSET, so there really isn't anything to push.
@@ -4555,7 +4524,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
 
          eassert ((re_opcode_t)p[-4] == no_op);
          {
-           int cycle = 0;
+           bool cycle = false;
            CHECK_INFINITE_LOOP (p - 4, d);
            if (!cycle)
              /* If there's a cycle, just continue without pushing
@@ -4574,7 +4543,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
          DEBUG_PRINT ("EXECUTING on_failure_jump_loop %d (to %p):\n",
                       mcnt, p + mcnt);
          {
-           int cycle = 0;
+           bool cycle = false;
            CHECK_INFINITE_LOOP (p - 3, d);
            if (cycle)
              /* If there's a cycle, get out of the loop, as if the matching
@@ -4737,8 +4706,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
                int c1, c2;
                int s1, s2;
                int dummy;
-               ptrdiff_t offset = PTR_TO_OFFSET (d - 1);
-               ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset);
+                ptrdiff_t offset = PTR_TO_OFFSET (d);
+                ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset) - 1;
                UPDATE_SYNTAX_TABLE (charpos);
                GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2);
                s1 = SYNTAX (c1);
@@ -4816,8 +4785,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
              int c1, c2;
              int s1, s2;
              int dummy;
-             ptrdiff_t offset = PTR_TO_OFFSET (d) - 1;
-             ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset);
+              ptrdiff_t offset = PTR_TO_OFFSET (d);
+              ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset) - 1;
              UPDATE_SYNTAX_TABLE (charpos);
              GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2);
              s1 = SYNTAX (c1);
@@ -4831,7 +4800,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
                {
                  PREFETCH_NOLIMIT ();
                  GET_CHAR_AFTER (c2, d, dummy);
-                 UPDATE_SYNTAX_TABLE_FORWARD (charpos);
+                  UPDATE_SYNTAX_TABLE_FORWARD (charpos + 1);
                  s2 = SYNTAX (c2);
 
                  /* ... and S2 is Sword, and WORD_BOUNDARY_P (C1, C2)
@@ -4895,8 +4864,8 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
                 is the character at D, and S2 is the syntax of C2.  */
              int c1, c2;
              int s1, s2;
-             ptrdiff_t offset = PTR_TO_OFFSET (d) - 1;
-             ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset);
+              ptrdiff_t offset = PTR_TO_OFFSET (d);
+              ptrdiff_t charpos = SYNTAX_TABLE_BYTE_TO_CHAR (offset) - 1;
              UPDATE_SYNTAX_TABLE (charpos);
              GET_CHAR_BEFORE_2 (c1, d, string1, end1, string2, end2);
              s1 = SYNTAX (c1);
@@ -5032,12 +5001,12 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
 
 /* Subroutine definitions for re_match_2.  */
 
-/* Return zero if TRANSLATE[S1] and TRANSLATE[S2] are identical for LEN
-   bytes; nonzero otherwise.  */
+/* Return true if TRANSLATE[S1] and TRANSLATE[S2] are not identical
+   for LEN bytes.  */
 
-static int
+static bool
 bcmp_translate (re_char *s1, re_char *s2, ptrdiff_t len,
-               Lisp_Object translate, int target_multibyte)
+               Lisp_Object translate, bool target_multibyte)
 {
   re_char *p1 = s1, *p2 = s2;
   re_char *p1_end = s1 + len;
@@ -5055,15 +5024,12 @@ bcmp_translate (re_char *s1, re_char *s2, ptrdiff_t len,
 
       if (RE_TRANSLATE (translate, p1_ch)
          != RE_TRANSLATE (translate, p2_ch))
-       return 1;
+       return true;
 
       p1 += p1_charlen, p2 += p2_charlen;
     }
 
-  if (p1 != p1_end || p2 != p2_end)
-    return 1;
-
-  return 0;
+  return p1 != p1_end || p2 != p2_end;
 }
 
 /* Entry points for GNU code.  */
@@ -5078,17 +5044,14 @@ bcmp_translate (re_char *s1, re_char *s2, ptrdiff_t len,
    We call regex_compile to do the actual compilation.  */
 
 const char *
-re_compile_pattern (const char *pattern, size_t length,
+re_compile_pattern (const char *pattern, ptrdiff_t length,
                    bool posix_backtracking, const char *whitespace_regexp,
                    struct re_pattern_buffer *bufp)
 {
-  reg_errcode_t ret;
-
-  /* GNU code is written to assume at least RE_NREGS registers will be set
-     (and at least one extra will be -1).  */
   bufp->regs_allocated = REGS_UNALLOCATED;
 
-  ret = regex_compile ((re_char *) pattern, length,
+  reg_errcode_t ret
+      = regex_compile ((re_char *) pattern, length,
                       posix_backtracking,
                       whitespace_regexp,
                       bufp);
diff --git a/src/regex-emacs.h b/src/regex-emacs.h
index a849cbe..ddf14e0 100644
--- a/src/regex-emacs.h
+++ b/src/regex-emacs.h
@@ -1,7 +1,7 @@
 /* Emacs regular expression API
 
-   Copyright (C) 1985, 1989-1993, 1995, 2000-2018 Free Software
-   Foundation, Inc.
+   Copyright (C) 1985, 1989-1993, 1995, 2000-2019 Free Software Foundation,
+   Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@
    uses struct re_registers.  */
 struct re_registers
 {
-  unsigned num_regs;
+  ptrdiff_t num_regs;
   ptrdiff_t *start;
   ptrdiff_t *end;
 };
@@ -50,7 +50,7 @@ struct re_registers
 extern Lisp_Object re_match_object;
 
 /* Roughly the maximum number of failure points on the stack.  */
-extern size_t emacs_re_max_failures;
+extern ptrdiff_t emacs_re_max_failures;
 
 /* Amount of memory that we can safely stack allocate.  */
 extern ptrdiff_t emacs_re_safe_alloca;
@@ -69,10 +69,10 @@ struct re_pattern_buffer
   unsigned char *buffer;
 
        /* Number of bytes to which 'buffer' points.  */
-  size_t allocated;
+  ptrdiff_t allocated;
 
        /* Number of bytes actually used in 'buffer'.  */
-  size_t used;
+  ptrdiff_t used;
 
         /* Charset of unibyte characters at compiling time.  */
   int charset_unibyte;
@@ -89,35 +89,35 @@ struct re_pattern_buffer
   Lisp_Object translate;
 
        /* Number of subexpressions found by the compiler.  */
-  size_t re_nsub;
+  ptrdiff_t re_nsub;
 
         /* True if and only if this pattern can match the empty string.
            Well, in truth it's used only in 're_search_2', to see
            whether or not we should use the fastmap, so we don't set
            this absolutely perfectly; see 're_compile_fastmap'.  */
-  unsigned can_be_null : 1;
+  bool_bf can_be_null : 1;
 
         /* If REGS_UNALLOCATED, allocate space in the 'regs' structure
-             for 'max (RE_NREGS, re_nsub + 1)' groups.
+             for at least (re_nsub + 1) groups.
            If REGS_REALLOCATE, reallocate space if necessary.
            If REGS_FIXED, use what's there.  */
   unsigned regs_allocated : 2;
 
         /* Set to false when 'regex_compile' compiles a pattern; set to true
            by 're_compile_fastmap' if it updates the fastmap.  */
-  unsigned fastmap_accurate : 1;
+  bool_bf fastmap_accurate : 1;
 
   /* If true, the compilation of the pattern had to look up the syntax table,
      so the compiled pattern is valid for the current syntax table only.  */
-  unsigned used_syntax : 1;
+  bool_bf used_syntax : 1;
 
   /* If true, multi-byte form in the regexp pattern should be
      recognized as a multibyte character.  */
-  unsigned multibyte : 1;
+  bool_bf multibyte : 1;
 
   /* If true, multi-byte form in the target of match should be
      recognized as a multibyte character.  */
-  unsigned target_multibyte : 1;
+  bool_bf target_multibyte : 1;
 };
 
 /* Declarations for routines.  */
@@ -125,7 +125,7 @@ struct re_pattern_buffer
 /* Compile the regular expression PATTERN, with length LENGTH
    and syntax given by the global 're_syntax_options', into the buffer
    BUFFER.  Return NULL if successful, and an error string if not.  */
-extern const char *re_compile_pattern (const char *pattern, size_t length,
+extern const char *re_compile_pattern (const char *pattern, ptrdiff_t length,
                                       bool posix_backtracking,
                                       const char *whitespace_regexp,
                                       struct re_pattern_buffer *buffer);
@@ -137,7 +137,7 @@ extern const char *re_compile_pattern (const char *pattern, 
size_t length,
    match, or -2 for an internal error.  Also return register
    information in REGS (if REGS is non-null).  */
 extern ptrdiff_t re_search (struct re_pattern_buffer *buffer,
-                          const char *string, size_t length,
+                          const char *string, ptrdiff_t length,
                           ptrdiff_t start, ptrdiff_t range,
                           struct re_registers *regs);
 
@@ -145,8 +145,8 @@ extern ptrdiff_t re_search (struct re_pattern_buffer 
*buffer,
 /* Like 're_search', but search in the concatenation of STRING1 and
    STRING2.  Also, stop searching at index START + STOP.  */
 extern ptrdiff_t re_search_2 (struct re_pattern_buffer *buffer,
-                            const char *string1, size_t length1,
-                            const char *string2, size_t length2,
+                            const char *string1, ptrdiff_t length1,
+                            const char *string2, ptrdiff_t length2,
                             ptrdiff_t start, ptrdiff_t range,
                             struct re_registers *regs,
                             ptrdiff_t stop);
@@ -155,8 +155,8 @@ extern ptrdiff_t re_search_2 (struct re_pattern_buffer 
*buffer,
 /* Like 're_search_2', but return how many characters in STRING the regexp
    in BUFFER matched, starting at position START.  */
 extern ptrdiff_t re_match_2 (struct re_pattern_buffer *buffer,
-                           const char *string1, size_t length1,
-                           const char *string2, size_t length2,
+                           const char *string1, ptrdiff_t length1,
+                           const char *string2, ptrdiff_t length2,
                            ptrdiff_t start, struct re_registers *regs,
                            ptrdiff_t stop);
 
@@ -175,7 +175,7 @@ extern ptrdiff_t re_match_2 (struct re_pattern_buffer 
*buffer,
    freeing the old data.  */
 extern void re_set_registers (struct re_pattern_buffer *buffer,
                              struct re_registers *regs,
-                             unsigned num_regs,
+                             ptrdiff_t num_regs,
                              ptrdiff_t *starts, ptrdiff_t *ends);
 
 /* Character classes.  */
@@ -192,6 +192,6 @@ typedef enum { RECC_ERROR = 0,
 
 extern bool re_iswctype (int ch, re_wctype_t cc);
 extern re_wctype_t re_wctype_parse (const unsigned char **strp,
-                                   unsigned limit);
+                                   ptrdiff_t limit);
 
 #endif /* EMACS_REGEX_H */
diff --git a/src/region-cache.c b/src/region-cache.c
index f92654c..d2e3d94 100644
--- a/src/region-cache.c
+++ b/src/region-cache.c
@@ -1,6 +1,6 @@
 /* Caching facts about regions of the buffer, for optimization.
 
-Copyright (C) 1985-1989, 1993, 1995, 2001-2018 Free Software Foundation,
+Copyright (C) 1985-1989, 1993, 1995, 2001-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/region-cache.h b/src/region-cache.h
index 4e2d5cc..c528f78 100644
--- a/src/region-cache.h
+++ b/src/region-cache.h
@@ -1,6 +1,6 @@
 /* Header file: Caching facts about regions of the buffer, for optimization.
 
-Copyright (C) 1985-1986, 1993, 1995, 2001-2018 Free Software Foundation,
+Copyright (C) 1985-1986, 1993, 1995, 2001-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/scroll.c b/src/scroll.c
index 5d0f320..8eda510 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -1,6 +1,6 @@
 /* Calculate what line insertion or deletion to do, and do it
 
-Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2018 Free Software
+Copyright (C) 1985-1986, 1990, 1993-1994, 2001-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -107,10 +107,8 @@ calculate_scrolling (struct frame *frame,
   /* Discourage long scrolls on fast lines.
      Don't scroll nearly a full frame height unless it saves
      at least 1/4 second.  */
-  int extra_cost = baud_rate / (10 * 4 * frame_total_lines);
-
-  if (baud_rate <= 0)
-    extra_cost = 1;
+  int extra_cost
+    = clip_to_bounds (1, baud_rate / (10 * 4) / frame_total_lines, INT_MAX / 
2);
 
   /* initialize the top left corner of the matrix */
   matrix->writecost = 0;
@@ -446,10 +444,8 @@ calculate_direct_scrolling (struct frame *frame,
   /* Discourage long scrolls on fast lines.
      Don't scroll nearly a full frame height unless it saves
      at least 1/4 second.  */
-  int extra_cost = baud_rate / (10 * 4 * frame_total_lines);
-
-  if (baud_rate <= 0)
-    extra_cost = 1;
+  int extra_cost
+    = clip_to_bounds (1, baud_rate / (10 * 4) / frame_total_lines, INT_MAX / 
2);
 
   /* Overhead of setting the scroll window, plus the extra
      cost of scrolling by a distance of one.  The extra cost is
diff --git a/src/search.c b/src/search.c
index f5c7719..a450e92 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1,6 +1,6 @@
 /* String search routines for GNU Emacs.
 
-Copyright (C) 1985-1987, 1993-1994, 1997-1999, 2001-2018 Free Software
+Copyright (C) 1985-1987, 1993-1994, 1997-1999, 2001-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -29,6 +29,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "region-cache.h"
 #include "blockinput.h"
 #include "intervals.h"
+#include "pdumper.h"
 
 #include "regex-emacs.h"
 
@@ -58,31 +59,6 @@ static struct regexp_cache searchbufs[REGEXP_CACHE_SIZE];
 /* The head of the linked list; points to the most recently used buffer.  */
 static struct regexp_cache *searchbuf_head;
 
-
-/* Every call to re_search, etc., must pass &search_regs as the regs
-   argument unless you can show it is unnecessary (i.e., if re_search
-   is certainly going to be called again before region-around-match
-   can be called).
-
-   Since the registers are now dynamically allocated, we need to make
-   sure not to refer to the Nth register before checking that it has
-   been allocated by checking search_regs.num_regs.
-
-   The regex code keeps track of whether it has allocated the search
-   buffer using bits in the re_pattern_buffer.  This means that whenever
-   you compile a new pattern, it completely forgets whether it has
-   allocated any registers, and will allocate new registers the next
-   time you call a searching or matching function.  Therefore, we need
-   to call re_set_registers after compiling a new pattern or after
-   setting the match registers, so that the regex functions will be
-   able to free or re-allocate it properly.  */
-/* static struct re_registers search_regs; */
-
-/* The buffer in which the last search was performed, or
-   Qt if the last search was done in a string;
-   Qnil if no searching has been done yet.  */
-/* static Lisp_Object last_thing_searched; */
-
 static void set_search_regs (ptrdiff_t, ptrdiff_t);
 static void save_search_regs (void);
 static EMACS_INT simple_search (EMACS_INT, unsigned char *, ptrdiff_t,
@@ -222,11 +198,13 @@ static struct regexp_cache *
 compile_pattern (Lisp_Object pattern, struct re_registers *regp,
                 Lisp_Object translate, bool posix, bool multibyte)
 {
-  struct regexp_cache *cp, **cpp;
+  struct regexp_cache *cp, **cpp, **lru_nonbusy;
 
-  for (cpp = &searchbuf_head; ; cpp = &cp->next)
+  for (cpp = &searchbuf_head, lru_nonbusy = NULL; ; cpp = &cp->next)
     {
       cp = *cpp;
+      if (!cp->busy)
+        lru_nonbusy = cpp;
       /* Entries are initialized to nil, and may be set to nil by
         compile_pattern_1 if the pattern isn't valid.  Don't apply
         string accessors in those cases.  However, compile_pattern_1
@@ -246,13 +224,14 @@ compile_pattern (Lisp_Object pattern, struct re_registers 
*regp,
          && cp->buf.charset_unibyte == charset_unibyte)
        break;
 
-      /* If we're at the end of the cache, compile into the nil cell
-        we found, or the last (least recently used) cell with a
-        string value.  */
+      /* If we're at the end of the cache, compile into the last
+        (least recently used) non-busy cell in the cache.  */
       if (cp->next == 0)
        {
-          if (cp->busy)
+          if (!lru_nonbusy)
             error ("Too much matching reentrancy");
+          cpp = lru_nonbusy;
+          cp = *cpp;
        compile_it:
           eassert (!cp->busy);
          compile_pattern_1 (cp, pattern, translate, posix);
@@ -340,7 +319,10 @@ looking_at_1 (Lisp_Object string, bool posix)
                  ZV_BYTE - BEGV_BYTE);
 
   if (i == -2)
-    matcher_overflow ();
+    {
+      unbind_to (count, Qnil);
+      matcher_overflow ();
+    }
 
   val = (i >= 0 ? Qt : Qnil);
   if (preserve_match_data && i >= 0)
@@ -646,14 +628,16 @@ newline_cache_on_off (struct buffer *buf)
    If COUNT is zero, do anything you please; run rogue, for all I care.
 
    If END is zero, use BEGV or ZV instead, as appropriate for the
-   direction indicated by COUNT.
+   direction indicated by COUNT.  If START_BYTE is -1 it is unknown,
+   and similarly for END_BYTE.
 
-   If we find COUNT instances, set *SHORTAGE to zero, and return the
+   If we find COUNT instances, set *COUNTED to COUNT, and return the
    position past the COUNTth match.  Note that for reverse motion
    this is not the same as the usual convention for Emacs motion commands.
 
-   If we don't find COUNT instances before reaching END, set *SHORTAGE
-   to the number of newlines left unfound, and return END.
+   If we don't find COUNT instances before reaching END, set *COUNTED
+   to the number of newlines left found (negated if COUNT is negative),
+   and return END.
 
    If BYTEPOS is not NULL, set *BYTEPOS to the byte position corresponding
    to the returned character position.
@@ -663,23 +647,17 @@ newline_cache_on_off (struct buffer *buf)
 
 ptrdiff_t
 find_newline (ptrdiff_t start, ptrdiff_t start_byte, ptrdiff_t end,
-             ptrdiff_t end_byte, ptrdiff_t count, ptrdiff_t *shortage,
+             ptrdiff_t end_byte, ptrdiff_t count, ptrdiff_t *counted,
              ptrdiff_t *bytepos, bool allow_quit)
 {
   struct region_cache *newline_cache;
-  int direction;
   struct buffer *cache_buffer;
 
-  if (count > 0)
+  if (!end)
     {
-      direction = 1;
-      if (!end)
+      if (count > 0)
        end = ZV, end_byte = ZV_BYTE;
-    }
-  else
-    {
-      direction = -1;
-      if (!end)
+      else
        end = BEGV, end_byte = BEGV_BYTE;
     }
   if (end_byte == -1)
@@ -691,8 +669,8 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
   else
     cache_buffer = current_buffer;
 
-  if (shortage != 0)
-    *shortage = 0;
+  if (counted)
+    *counted = count;
 
   if (count > 0)
     while (start != end)
@@ -935,8 +913,8 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
         }
       }
 
-  if (shortage)
-    *shortage = count * direction;
+  if (counted)
+    *counted -= count;
   if (bytepos)
     {
       *bytepos = start_byte == -1 ? CHAR_TO_BYTE (start) : start_byte;
@@ -951,30 +929,28 @@ find_newline (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
    We report the resulting position by calling TEMP_SET_PT_BOTH.
 
    If we find COUNT instances. we position after (always after,
-   even if scanning backwards) the COUNTth match, and return 0.
+   even if scanning backwards) the COUNTth match.
 
    If we don't find COUNT instances before reaching the end of the
-   buffer (or the beginning, if scanning backwards), we return
-   the number of line boundaries left unfound, and position at
+   buffer (or the beginning, if scanning backwards), we position at
    the limit we bumped up against.
 
    If ALLOW_QUIT, check for quitting.  That's good to do
    except in special cases.  */
 
-ptrdiff_t
+void
 scan_newline (ptrdiff_t start, ptrdiff_t start_byte,
              ptrdiff_t limit, ptrdiff_t limit_byte,
              ptrdiff_t count, bool allow_quit)
 {
-  ptrdiff_t charpos, bytepos, shortage;
+  ptrdiff_t charpos, bytepos, counted;
 
   charpos = find_newline (start, start_byte, limit, limit_byte,
-                         count, &shortage, &bytepos, allow_quit);
-  if (shortage)
+                         count, &counted, &bytepos, allow_quit);
+  if (counted != count)
     TEMP_SET_PT_BOTH (limit, limit_byte);
   else
     TEMP_SET_PT_BOTH (charpos, bytepos);
-  return shortage;
 }
 
 /* Like above, but always scan from point and report the
@@ -984,19 +960,19 @@ ptrdiff_t
 scan_newline_from_point (ptrdiff_t count, ptrdiff_t *charpos,
                         ptrdiff_t *bytepos)
 {
-  ptrdiff_t shortage;
+  ptrdiff_t counted;
 
   if (count <= 0)
     *charpos = find_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, count - 1,
-                            &shortage, bytepos, 1);
+                            &counted, bytepos, 1);
   else
     *charpos = find_newline (PT, PT_BYTE, ZV, ZV_BYTE, count,
-                            &shortage, bytepos, 1);
-  return shortage;
+                            &counted, bytepos, 1);
+  return counted;
 }
 
 /* Like find_newline, but doesn't allow QUITting and doesn't return
-   SHORTAGE.  */
+   COUNTED.  */
 ptrdiff_t
 find_newline_no_quit (ptrdiff_t from, ptrdiff_t frombyte,
                      ptrdiff_t cnt, ptrdiff_t *bytepos)
@@ -1012,10 +988,10 @@ ptrdiff_t
 find_before_next_newline (ptrdiff_t from, ptrdiff_t to,
                          ptrdiff_t cnt, ptrdiff_t *bytepos)
 {
-  ptrdiff_t shortage;
-  ptrdiff_t pos = find_newline (from, -1, to, -1, cnt, &shortage, bytepos, 1);
+  ptrdiff_t counted;
+  ptrdiff_t pos = find_newline (from, -1, to, -1, cnt, &counted, bytepos, 1);
 
-  if (shortage == 0)
+  if (counted == cnt)
     {
       if (bytepos)
        DEC_BOTH (pos, *bytepos);
@@ -1225,6 +1201,7 @@ search_buffer_re (Lisp_Object string, ptrdiff_t pos, 
ptrdiff_t pos_byte,
                          pos_byte - BEGV_BYTE);
       if (val == -2)
         {
+          unbind_to (count, Qnil);
           matcher_overflow ();
         }
       if (val >= 0)
@@ -1270,6 +1247,7 @@ search_buffer_re (Lisp_Object string, ptrdiff_t pos, 
ptrdiff_t pos_byte,
                          lim_byte - BEGV_BYTE);
       if (val == -2)
         {
+          unbind_to (count, Qnil);
           matcher_overflow ();
         }
       if (val >= 0)
@@ -2768,7 +2746,7 @@ since only regular expressions have distinguished 
subexpressions.  */)
      error out since otherwise this will result in confusing bugs.  */
   ptrdiff_t sub_start = search_regs.start[sub];
   ptrdiff_t sub_end = search_regs.end[sub];
-  unsigned  num_regs = search_regs.num_regs;
+  ptrdiff_t num_regs = search_regs.num_regs;
   newpoint = search_regs.start[sub] + SCHARS (newtext);
 
   /* Replace the old text with the new in the cleanest possible way.  */
@@ -2992,13 +2970,11 @@ If optional arg RESEAT is non-nil, make markers on LIST 
point nowhere.  */)
 
   /* Allocate registers if they don't already exist.  */
   {
-    EMACS_INT length = XFIXNAT (Flength (list)) / 2;
+    ptrdiff_t length = list_length (list) / 2;
 
     if (length > search_regs.num_regs)
       {
        ptrdiff_t num_regs = search_regs.num_regs;
-       if (PTRDIFF_MAX < length)
-         memory_full (SIZE_MAX);
        search_regs.start =
          xpalloc (search_regs.start, &num_regs, length - num_regs,
                   min (PTRDIFF_MAX, UINT_MAX), sizeof *search_regs.start);
@@ -3086,29 +3062,19 @@ If optional arg RESEAT is non-nil, make markers on LIST 
point nowhere.  */)
   return Qnil;
 }
 
-/* If true the match data have been saved in saved_search_regs
-   during the execution of a sentinel or filter. */
-/* static bool search_regs_saved; */
-/* static struct re_registers saved_search_regs; */
-/* static Lisp_Object saved_last_thing_searched; */
-
 /* Called from Flooking_at, Fstring_match, search_buffer, Fstore_match_data
    if asynchronous code (filter or sentinel) is running. */
 static void
 save_search_regs (void)
 {
-  if (!search_regs_saved)
+  if (saved_search_regs.num_regs == 0)
     {
-      saved_search_regs.num_regs = search_regs.num_regs;
-      saved_search_regs.start = search_regs.start;
-      saved_search_regs.end = search_regs.end;
+      saved_search_regs = search_regs;
       saved_last_thing_searched = last_thing_searched;
       last_thing_searched = Qnil;
       search_regs.num_regs = 0;
       search_regs.start = 0;
       search_regs.end = 0;
-
-      search_regs_saved = 1;
     }
 }
 
@@ -3116,19 +3082,17 @@ save_search_regs (void)
 void
 restore_search_regs (void)
 {
-  if (search_regs_saved)
+  if (saved_search_regs.num_regs != 0)
     {
       if (search_regs.num_regs > 0)
        {
          xfree (search_regs.start);
          xfree (search_regs.end);
        }
-      search_regs.num_regs = saved_search_regs.num_regs;
-      search_regs.start = saved_search_regs.start;
-      search_regs.end = saved_search_regs.end;
+      search_regs = saved_search_regs;
       last_thing_searched = saved_last_thing_searched;
       saved_last_thing_searched = Qnil;
-      search_regs_saved = 0;
+      saved_search_regs.num_regs = 0;
     }
 }
 
@@ -3211,7 +3175,7 @@ DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 
1, 0,
 /* Like find_newline, but doesn't use the cache, and only searches forward.  */
 static ptrdiff_t
 find_newline1 (ptrdiff_t start, ptrdiff_t start_byte, ptrdiff_t end,
-              ptrdiff_t end_byte, ptrdiff_t count, ptrdiff_t *shortage,
+              ptrdiff_t end_byte, ptrdiff_t count, ptrdiff_t *counted,
               ptrdiff_t *bytepos, bool allow_quit)
 {
   if (count > 0)
@@ -3227,8 +3191,8 @@ find_newline1 (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
   if (end_byte == -1)
     end_byte = CHAR_TO_BYTE (end);
 
-  if (shortage != 0)
-    *shortage = 0;
+  if (counted)
+    *counted = count;
 
   if (count > 0)
     while (start != end)
@@ -3285,8 +3249,8 @@ find_newline1 (ptrdiff_t start, ptrdiff_t start_byte, 
ptrdiff_t end,
         }
       }
 
-  if (shortage)
-    *shortage = count;
+  if (counted)
+    *counted -= count;
   if (bytepos)
     {
       *bytepos = start_byte == -1 ? CHAR_TO_BYTE (start) : start_byte;
@@ -3307,7 +3271,7 @@ the buffer.  If the buffer doesn't have a cache, the 
value is nil.  */)
   (Lisp_Object buffer)
 {
   struct buffer *buf, *old = NULL;
-  ptrdiff_t shortage, nl_count_cache, nl_count_buf;
+  ptrdiff_t nl_count_cache, nl_count_buf;
   Lisp_Object cache_newlines, buf_newlines, val;
   ptrdiff_t from, found, i;
 
@@ -3333,8 +3297,7 @@ the buffer.  If the buffer doesn't have a cache, the 
value is nil.  */)
 
   /* How many newlines are there according to the cache?  */
   find_newline (BEGV, BEGV_BYTE, ZV, ZV_BYTE,
-               TYPE_MAXIMUM (ptrdiff_t), &shortage, NULL, true);
-  nl_count_cache = TYPE_MAXIMUM (ptrdiff_t) - shortage;
+               TYPE_MAXIMUM (ptrdiff_t), &nl_count_cache, NULL, true);
 
   /* Create vector and populate it.  */
   cache_newlines = make_uninit_vector (nl_count_cache);
@@ -3343,11 +3306,11 @@ the buffer.  If the buffer doesn't have a cache, the 
value is nil.  */)
     {
       for (from = BEGV, found = from, i = 0; from < ZV; from = found, i++)
        {
-         ptrdiff_t from_byte = CHAR_TO_BYTE (from);
+         ptrdiff_t from_byte = CHAR_TO_BYTE (from), counted;
 
-         found = find_newline (from, from_byte, 0, -1, 1, &shortage,
+         found = find_newline (from, from_byte, 0, -1, 1, &counted,
                                NULL, true);
-         if (shortage != 0 || i >= nl_count_cache)
+         if (counted == 0 || i >= nl_count_cache)
            break;
          ASET (cache_newlines, i, make_fixnum (found - 1));
        }
@@ -3358,18 +3321,17 @@ the buffer.  If the buffer doesn't have a cache, the 
value is nil.  */)
 
   /* Now do the same, but without using the cache.  */
   find_newline1 (BEGV, BEGV_BYTE, ZV, ZV_BYTE,
-                TYPE_MAXIMUM (ptrdiff_t), &shortage, NULL, true);
-  nl_count_buf = TYPE_MAXIMUM (ptrdiff_t) - shortage;
+                TYPE_MAXIMUM (ptrdiff_t), &nl_count_buf, NULL, true);
   buf_newlines = make_uninit_vector (nl_count_buf);
   if (nl_count_buf)
     {
       for (from = BEGV, found = from, i = 0; from < ZV; from = found, i++)
        {
-         ptrdiff_t from_byte = CHAR_TO_BYTE (from);
+         ptrdiff_t from_byte = CHAR_TO_BYTE (from), counted;
 
-         found = find_newline1 (from, from_byte, 0, -1, 1, &shortage,
+         found = find_newline1 (from, from_byte, 0, -1, 1, &counted,
                                 NULL, true);
-         if (shortage != 0 || i >= nl_count_buf)
+         if (counted == 0 || i >= nl_count_buf)
            break;
          ASET (buf_newlines, i, make_fixnum (found - 1));
        }
@@ -3388,26 +3350,17 @@ the buffer.  If the buffer doesn't have a cache, the 
value is nil.  */)
 }
 
 
+static void syms_of_search_for_pdumper (void);
+
 void
 syms_of_search (void)
 {
-  register int i;
-
-  for (i = 0; i < REGEXP_CACHE_SIZE; ++i)
+  for (int i = 0; i < REGEXP_CACHE_SIZE; ++i)
     {
-      searchbufs[i].buf.allocated = 100;
-      searchbufs[i].buf.buffer = xmalloc (100);
-      searchbufs[i].buf.fastmap = searchbufs[i].fastmap;
-      searchbufs[i].regexp = Qnil;
-      searchbufs[i].f_whitespace_regexp = Qnil;
-      searchbufs[i].busy = false;
-      searchbufs[i].syntax_table = Qnil;
       staticpro (&searchbufs[i].regexp);
       staticpro (&searchbufs[i].f_whitespace_regexp);
       staticpro (&searchbufs[i].syntax_table);
-      searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]);
     }
-  searchbuf_head = &searchbufs[0];
 
   /* Error condition used for failing searches.  */
   DEFSYM (Qsearch_failed, "search-failed");
@@ -3420,18 +3373,17 @@ syms_of_search (void)
   DEFSYM (Qinvalid_regexp, "invalid-regexp");
 
   Fput (Qsearch_failed, Qerror_conditions,
-       listn (CONSTYPE_PURE, 2, Qsearch_failed, Qerror));
+       pure_list (Qsearch_failed, Qerror));
   Fput (Qsearch_failed, Qerror_message,
        build_pure_c_string ("Search failed"));
 
   Fput (Quser_search_failed, Qerror_conditions,
-        listn (CONSTYPE_PURE, 4,
-               Quser_search_failed, Quser_error, Qsearch_failed, Qerror));
+       pure_list (Quser_search_failed, Quser_error, Qsearch_failed, Qerror));
   Fput (Quser_search_failed, Qerror_message,
         build_pure_c_string ("Search failed"));
 
   Fput (Qinvalid_regexp, Qerror_conditions,
-       listn (CONSTYPE_PURE, 2, Qinvalid_regexp, Qerror));
+       pure_list (Qinvalid_regexp, Qerror));
   Fput (Qinvalid_regexp, Qerror_message,
        build_pure_c_string ("Invalid regexp"));
 
@@ -3478,4 +3430,23 @@ is to bind it with `let' around a small expression.  */);
   defsubr (&Sset_match_data);
   defsubr (&Sregexp_quote);
   defsubr (&Snewline_cache_check);
+
+  pdumper_do_now_and_after_load (syms_of_search_for_pdumper);
+}
+
+static void
+syms_of_search_for_pdumper (void)
+{
+  for (int i = 0; i < REGEXP_CACHE_SIZE; ++i)
+    {
+      searchbufs[i].buf.allocated = 100;
+      searchbufs[i].buf.buffer = xmalloc (100);
+      searchbufs[i].buf.fastmap = searchbufs[i].fastmap;
+      searchbufs[i].regexp = Qnil;
+      searchbufs[i].f_whitespace_regexp = Qnil;
+      searchbufs[i].busy = false;
+      searchbufs[i].syntax_table = Qnil;
+      searchbufs[i].next = (i == REGEXP_CACHE_SIZE-1 ? 0 : &searchbufs[i+1]);
+    }
+  searchbuf_head = &searchbufs[0];
 }
diff --git a/src/sheap.c b/src/sheap.c
index 882cb02..015ee57 100644
--- a/src/sheap.c
+++ b/src/sheap.c
@@ -1,7 +1,7 @@
 /* simulate `sbrk' with an array in .bss, for `unexec' support for Cygwin;
    complete rewrite of xemacs Cygwin `unexec' code
 
-   Copyright (C) 2004-2018 Free Software Foundation, Inc.
+   Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -31,7 +31,6 @@ static int debug_sheap;
 
 char bss_sbrk_buffer[STATIC_HEAP_SIZE];
 char *max_bss_sbrk_ptr;
-bool bss_sbrk_did_unexec;
 
 void *
 bss_sbrk (ptrdiff_t request_size)
diff --git a/src/sheap.h b/src/sheap.h
index e17fd52..a565328 100644
--- a/src/sheap.h
+++ b/src/sheap.h
@@ -1,6 +1,6 @@
 /* Static heap allocation for GNU Emacs.
 
-Copyright 2016-2018 Free Software Foundation, Inc.
+Copyright 2016-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -27,5 +27,4 @@ enum { STATIC_HEAP_SIZE = sizeof (Lisp_Object) << 22 };
 
 extern char bss_sbrk_buffer[STATIC_HEAP_SIZE];
 extern char *max_bss_sbrk_ptr;
-extern bool bss_sbrk_did_unexec;
 extern void *bss_sbrk (ptrdiff_t);
diff --git a/src/sound.c b/src/sound.c
index 6f15f5d..2b87150 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -1,6 +1,6 @@
 /* sound.c -- sound support.
 
-Copyright (C) 1998-1999, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1998-1999, 2001-2019 Free Software Foundation, Inc.
 
 Author: Gerd Moellmann <address@hidden>
 
diff --git a/src/syntax.c b/src/syntax.c
index 432d82c..edfdae2 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -1,5 +1,5 @@
 /* GNU Emacs routines to deal with syntax tables; also word and list parsing.
-   Copyright (C) 1985, 1987, 1993-1995, 1997-1999, 2001-2018 Free
+   Copyright (C) 1985, 1987, 1993-1995, 1997-1999, 2001-2019 Free
    Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -175,7 +175,7 @@ static ptrdiff_t find_start_value;
 static ptrdiff_t find_start_value_byte;
 static struct buffer *find_start_buffer;
 static ptrdiff_t find_start_begv;
-static EMACS_INT find_start_modiff;
+static modiff_count find_start_modiff;
 
 
 static Lisp_Object skip_chars (bool, Lisp_Object, Lisp_Object, bool);
@@ -309,7 +309,7 @@ SETUP_SYNTAX_TABLE_FOR_OBJECT (Lisp_Object object,
 }
 
 /* Update gl_state to an appropriate interval which contains CHARPOS.  The
-   sign of COUNT give the relative position of CHARPOS wrt the previously
+   sign of COUNT gives the relative position of CHARPOS wrt the previously
    valid interval.  If INIT, only [be]_property fields of gl_state are
    valid at start, the rest is filled basing on OBJECT.
 
@@ -340,59 +340,46 @@ update_syntax_table (ptrdiff_t charpos, EMACS_INT count, 
bool init,
       invalidate = false;
       if (!i)
        return;
-      /* interval_of updates only ->position of the return value, so
-        update the parents manually to speed up update_interval.  */
-      while (!NULL_PARENT (i))
-       {
-         if (AM_RIGHT_CHILD (i))
-           INTERVAL_PARENT (i)->position = i->position
-             - LEFT_TOTAL_LENGTH (i) + TOTAL_LENGTH (i) /* right end */
-             - TOTAL_LENGTH (INTERVAL_PARENT (i))
-             + LEFT_TOTAL_LENGTH (INTERVAL_PARENT (i));
-         else
-           INTERVAL_PARENT (i)->position = i->position - LEFT_TOTAL_LENGTH (i)
-             + TOTAL_LENGTH (i);
-         i = INTERVAL_PARENT (i);
-       }
       i = gl_state.forward_i;
       gl_state.b_property = i->position - gl_state.offset;
       gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset;
-      goto update;
-    }
-  i = count > 0 ? gl_state.forward_i : gl_state.backward_i;
-
-  /* We are guaranteed to be called with CHARPOS either in i,
-     or further off.  */
-  if (!i)
-    error ("Error in syntax_table logic for to-the-end intervals");
-  else if (charpos < i->position)              /* Move left.  */
-    {
-      if (count > 0)
-       error ("Error in syntax_table logic for intervals <-");
-      /* Update the interval.  */
-      i = update_interval (i, charpos);
-      if (INTERVAL_LAST_POS (i) != gl_state.b_property)
-       {
-         invalidate = false;
-         gl_state.forward_i = i;
-         gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset;
-       }
     }
-  else if (charpos >= INTERVAL_LAST_POS (i)) /* Move right.  */
+  else
     {
-      if (count < 0)
-       error ("Error in syntax_table logic for intervals ->");
-      /* Update the interval.  */
-      i = update_interval (i, charpos);
-      if (i->position != gl_state.e_property)
-       {
-         invalidate = false;
-         gl_state.backward_i = i;
-         gl_state.b_property = i->position - gl_state.offset;
-       }
+      i = count > 0 ? gl_state.forward_i : gl_state.backward_i;
+
+      /* We are guaranteed to be called with CHARPOS either in i,
+         or further off.  */
+      if (!i)
+        error ("Error in syntax_table logic for to-the-end intervals");
+      else if (charpos < i->position)          /* Move left.  */
+        {
+          if (count > 0)
+           error ("Error in syntax_table logic for intervals <-");
+          /* Update the interval.  */
+          i = update_interval (i, charpos);
+          if (INTERVAL_LAST_POS (i) != gl_state.b_property)
+           {
+             invalidate = false;
+             gl_state.forward_i = i;
+             gl_state.e_property = INTERVAL_LAST_POS (i) - gl_state.offset;
+           }
+        }
+      else if (charpos >= INTERVAL_LAST_POS (i)) /* Move right.  */
+        {
+          if (count < 0)
+           error ("Error in syntax_table logic for intervals ->");
+          /* Update the interval.  */
+          i = update_interval (i, charpos);
+          if (i->position != gl_state.e_property)
+           {
+             invalidate = false;
+             gl_state.backward_i = i;
+             gl_state.b_property = i->position - gl_state.offset;
+           }
+        }
     }
 
-  update:
   tmp_table = textget (i->plist, Qsyntax_table);
 
   if (invalidate)
@@ -489,7 +476,7 @@ parse_sexp_propertize (ptrdiff_t charpos)
   if (syntax_propertize__done <= charpos
       && syntax_propertize__done < zv)
     {
-      EMACS_INT modiffs = CHARS_MODIFF;
+      modiff_count modiffs = CHARS_MODIFF;
       safe_call1 (Qinternal__syntax_propertize,
                  make_fixnum (min (zv, 1 + charpos)));
       if (modiffs != CHARS_MODIFF)
@@ -608,7 +595,7 @@ find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte)
 
   if (!NILP (Vcomment_use_syntax_ppss))
     {
-      EMACS_INT modiffs = CHARS_MODIFF;
+      modiff_count modiffs = CHARS_MODIFF;
       Lisp_Object ppss = call1 (Qsyntax_ppss, make_fixnum (pos));
       if (modiffs != CHARS_MODIFF)
        error ("syntax-ppss modified the buffer!");
@@ -3490,10 +3477,7 @@ internalize_parse_state (Lisp_Object external, struct 
lisp_parse_state *state)
   else
     {
       tem = Fcar (external);
-      if (!NILP (tem))
-       state->depth = XFIXNUM (tem);
-      else
-       state->depth = 0;
+      state->depth = FIXNUMP (tem) ? XFIXNUM (tem) : 0;
 
       external = Fcdr (external);
       external = Fcdr (external);
@@ -3730,12 +3714,9 @@ syms_of_syntax (void)
   staticpro (&gl_state.current_syntax_table);
   staticpro (&gl_state.old_prop);
 
-  /* Defined in regex-emacs.c.  */
-  staticpro (&re_match_object);
-
   DEFSYM (Qscan_error, "scan-error");
   Fput (Qscan_error, Qerror_conditions,
-       listn (CONSTYPE_PURE, 2, Qscan_error, Qerror));
+       pure_list (Qscan_error, Qerror));
   Fput (Qscan_error, Qerror_message,
        build_pure_c_string ("Scan error"));
 
diff --git a/src/syntax.h b/src/syntax.h
index d971c74..6d3851f 100644
--- a/src/syntax.h
+++ b/src/syntax.h
@@ -1,6 +1,6 @@
 /* Declarations having to do with GNU Emacs syntax tables.
 
-Copyright (C) 1985, 1993-1994, 1997-1998, 2001-2018 Free Software
+Copyright (C) 1985, 1993-1994, 1997-1998, 2001-2019 Free Software
 Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/sysdep.c b/src/sysdep.c
index 7a0c8a8..57ea822 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1,5 +1,5 @@
 /* Interfaces to system-dependent kernel and library entries.
-   Copyright (C) 1985-1988, 1993-1995, 1999-2018 Free Software
+   Copyright (C) 1985-1988, 1993-1995, 1999-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -150,22 +150,52 @@ static const int baud_convert[] =
 #ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE
 # include <sys/personality.h>
 
-/* Disable address randomization in the current process.  Return true
-   if addresses were randomized but this has been disabled, false
-   otherwise. */
-bool
-disable_address_randomization (void)
+/* If not -1, the personality that should be restored before exec.  */
+static int exec_personality;
+
+/* Try to disable randomization if the current process needs it and
+   does not appear to have it already.  */
+int
+maybe_disable_address_randomization (bool dumping, int argc, char **argv)
 {
-  int pers = personality (0xffffffff);
-  if (pers < 0)
-    return false;
-  int desired_pers = pers | ADDR_NO_RANDOMIZE;
+  /* Undocumented Emacs option used only by this function.  */
+  static char const aslr_disabled_option[] = "--__aslr-disabled";
+
+  if (argc < 2 || strcmp (argv[1], aslr_disabled_option) != 0)
+    {
+      bool disable_aslr = dumping;
+# ifdef __PPC64__
+      disable_aslr = true;
+# endif
+      exec_personality = disable_aslr ? personality (0xffffffff) : -1;
+      if (exec_personality & ADDR_NO_RANDOMIZE)
+       exec_personality = -1;
+      if (exec_personality != -1
+         && personality (exec_personality | ADDR_NO_RANDOMIZE) != -1)
+       {
+         char **newargv = malloc ((argc + 2) * sizeof *newargv);
+         if (newargv)
+           {
+             /* Invoke self with undocumented option.  */
+             newargv[0] = argv[0];
+             newargv[1] = (char *) aslr_disabled_option;
+             memcpy (&newargv[2], &argv[1], argc * sizeof *newargv);
+             execvp (newargv[0], newargv);
+           }
+
+         /* If malloc or execvp fails, warn and then try anyway.  */
+         perror (argv[0]);
+         free (newargv);
+       }
+    }
+  else
+    {
+      /* Our earlier incarnation already disabled ASLR.  */
+      argc--;
+      memmove (&argv[1], &argv[2], argc * sizeof *argv);
+    }
 
-  /* Call 'personality' twice, to detect buggy platforms like WSL
-     where 'personality' always returns 0.  */
-  return (pers != desired_pers
-         && personality (desired_pers) == pers
-         && personality (0xffffffff) == desired_pers);
+  return argc;
 }
 #endif
 
@@ -177,21 +207,12 @@ int
 emacs_exec_file (char const *file, char *const *argv, char *const *envp)
 {
 #ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE
-  int pers = getenv ("EMACS_HEAP_EXEC") ? personality (0xffffffff) : -1;
-  bool change_personality = 0 <= pers && pers & ADDR_NO_RANDOMIZE;
-  if (change_personality)
-    personality (pers & ~ADDR_NO_RANDOMIZE);
+  if (exec_personality != -1)
+    personality (exec_personality);
 #endif
 
   execve (file, argv, envp);
-  int err = errno;
-
-#ifdef HAVE_PERSONALITY_ADDR_NO_RANDOMIZE
-  if (change_personality)
-    personality (pers);
-#endif
-
-  return err;
+  return errno;
 }
 
 /* If FD is not already open, arrange for it to be open with FLAGS.  */
@@ -236,12 +257,12 @@ get_current_dir_name_or_unreachable (void)
 
   char *pwd;
 
-  /* The maximum size of a directory name, including the terminating null.
+  /* The maximum size of a directory name, including the terminating NUL.
      Leave room so that the caller can append a trailing slash.  */
   ptrdiff_t dirsize_max = min (PTRDIFF_MAX, SIZE_MAX) - 1;
 
   /* The maximum size of a buffer for a file name, including the
-     terminating null.  This is bounded by MAXPATHLEN, if available.  */
+     terminating NUL.  This is bounded by MAXPATHLEN, if available.  */
   ptrdiff_t bufsize_max = dirsize_max;
 #ifdef MAXPATHLEN
   bufsize_max = min (bufsize_max, MAXPATHLEN);
@@ -249,7 +270,7 @@ get_current_dir_name_or_unreachable (void)
 
 # if HAVE_GET_CURRENT_DIR_NAME && !BROKEN_GET_CURRENT_DIR_NAME
 #  ifdef HYBRID_MALLOC
-  bool use_libc = bss_sbrk_did_unexec;
+  bool use_libc = will_dump_with_unexec_p ();
 #  else
   bool use_libc = true;
 #  endif
@@ -1499,18 +1520,18 @@ reset_sys_modes (struct tty_display_info *tty_out)
     tty_out->terminal->reset_terminal_modes_hook (tty_out->terminal);
 
   /* Avoid possible loss of output when changing terminal modes.  */
-  while (fdatasync (fileno (tty_out->output)) != 0 && errno == EINTR)
+  while (tcdrain (fileno (tty_out->output)) != 0 && errno == EINTR)
     continue;
 
 #ifndef DOS_NT
-#ifdef F_SETOWN
+# ifdef F_SETOWN
   if (interrupt_input)
     {
       reset_sigio (fileno (tty_out->input));
       fcntl (fileno (tty_out->input), F_SETOWN,
              old_fcntl_owner[fileno (tty_out->input)]);
     }
-#endif /* F_SETOWN */
+# endif /* F_SETOWN */
   fcntl (fileno (tty_out->input), F_SETFL,
          fcntl (fileno (tty_out->input), F_GETFL, 0) & ~O_NONBLOCK);
 #endif
@@ -1829,8 +1850,8 @@ stack_overflow (siginfo_t *siginfo)
 
   /* The known top and bottom of the stack.  The actual stack may
      extend a bit beyond these boundaries.  */
-  char *bot = stack_bottom;
-  char *top = current_thread->stack_top;
+  char const *bot = stack_bottom;
+  char const *top = current_thread->stack_top;
 
   /* Log base 2 of the stack heuristic ratio.  This ratio is the size
      of the known stack divided by the size of the guard area past the
@@ -1887,7 +1908,10 @@ init_sigsegv (void)
   sigfillset (&sa.sa_mask);
   sa.sa_sigaction = handle_sigsegv;
   sa.sa_flags = SA_SIGINFO | SA_ONSTACK | emacs_sigaction_flags ();
-  return sigaction (SIGSEGV, &sa, NULL) < 0 ? 0 : 1;
+  if (sigaction (SIGSEGV, &sa, NULL) < 0)
+    return 0;
+
+  return 1;
 }
 
 #else /* not HAVE_STACK_OVERFLOW_HANDLING or WINDOWSNT */
@@ -1942,7 +1966,7 @@ maybe_fatal_sig (int sig)
 }
 
 void
-init_signals (bool dumping)
+init_signals (void)
 {
   struct sigaction thread_fatal_action;
   struct sigaction action;
@@ -2093,7 +2117,7 @@ init_signals (bool dumping)
   /* Don't alter signal handlers if dumping.  On some machines,
      changing signal handlers sets static data that would make signals
      fail to work right when the dumped Emacs is run.  */
-  if (dumping)
+  if (will_dump_p ())
     return;
 
   sigfillset (&process_fatal_action.sa_mask);
@@ -3411,7 +3435,7 @@ system_process_attributes (Lisp_Object pid)
 
       if (nread)
        {
-         /* We don't want trailing null characters.  */
+         /* We don't want trailing NUL characters.  */
          for (p = cmdline + nread; cmdline < p && !p[-1]; p--)
            continue;
 
diff --git a/src/sysselect.h b/src/sysselect.h
index c7bce3c..25e8f51 100644
--- a/src/sysselect.h
+++ b/src/sysselect.h
@@ -1,5 +1,5 @@
 /* sysselect.h - System-dependent definitions for the select function.
-   Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/syssignal.h b/src/syssignal.h
index 0887eac..82e3761 100644
--- a/src/syssignal.h
+++ b/src/syssignal.h
@@ -1,6 +1,6 @@
 /* syssignal.h - System-dependent definitions for signals.
 
-Copyright (C) 1993, 1999, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1993, 1999, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -22,7 +22,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 #include <signal.h>
 
-extern void init_signals (bool);
+extern void init_signals (void);
 extern void block_child_signal (sigset_t *);
 extern void unblock_child_signal (sigset_t const *);
 extern void block_interrupt_signal (sigset_t *);
diff --git a/src/sysstdio.h b/src/sysstdio.h
index 9462338..3ff1d6a 100644
--- a/src/sysstdio.h
+++ b/src/sysstdio.h
@@ -1,6 +1,6 @@
 /* Standard I/O for Emacs.
 
-Copyright 2013-2018 Free Software Foundation, Inc.
+Copyright 2013-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/systhread.c b/src/systhread.c
index d53b5c2..6f4de53 100644
--- a/src/systhread.c
+++ b/src/systhread.c
@@ -1,5 +1,5 @@
 /* System thread definitions
-Copyright (C) 2012-2018 Free Software Foundation, Inc.
+Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/systhread.h b/src/systhread.h
index 3805cb2..a1d2746 100644
--- a/src/systhread.h
+++ b/src/systhread.h
@@ -1,5 +1,5 @@
 /* System thread definitions
-Copyright (C) 2012-2018 Free Software Foundation, Inc.
+Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/systime.h b/src/systime.h
index 0bc1e90..9080cd2 100644
--- a/src/systime.h
+++ b/src/systime.h
@@ -1,5 +1,5 @@
 /* systime.h - System-dependent definitions for time manipulations.
-   Copyright (C) 1993-1994, 2002-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993-1994, 2002-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -93,7 +93,7 @@ extern bool list4_to_timespec (Lisp_Object, Lisp_Object, 
Lisp_Object,
                               Lisp_Object, struct timespec *);
 extern struct timespec lisp_time_argument (Lisp_Object);
 extern _Noreturn void time_overflow (void);
-extern void init_timefns (bool);
+extern void init_timefns (void);
 extern void syms_of_timefns (void);
 
 INLINE_HEADER_END
diff --git a/src/systty.h b/src/systty.h
index b82dc6c..f2cd231 100644
--- a/src/systty.h
+++ b/src/systty.h
@@ -1,5 +1,5 @@
 /* systty.h - System-dependent definitions for terminals.
-   Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/syswait.h b/src/syswait.h
index 8f0357f..f631b71 100644
--- a/src/syswait.h
+++ b/src/syswait.h
@@ -1,5 +1,5 @@
 /* Define wait system call interface for Emacs.
-   Copyright (C) 1993-1995, 2000-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993-1995, 2000-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/term.c b/src/term.c
index 852dc23..a492276 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1,5 +1,5 @@
 /* Terminal control module for terminals described by TERMCAP
-   Copyright (C) 1985-1987, 1993-1995, 1998, 2000-2018 Free Software
+   Copyright (C) 1985-1987, 1993-1995, 1998, 2000-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -1201,7 +1201,9 @@ calculate_costs (struct frame *frame)
       calculate_ins_del_char_costs (frame);
 
       /* Don't use TS_repeat if its padding is worse than sending the chars */
-      if (tty->TS_repeat && per_line_cost (tty->TS_repeat) * baud_rate < 9000)
+      if (tty->TS_repeat
+         && (baud_rate <= 0
+             || per_line_cost (tty->TS_repeat) < 9000 / baud_rate))
         tty->RPov = string_cost (tty->TS_repeat);
       else
         tty->RPov = FRAME_COLS (frame) * 2;
@@ -1350,7 +1352,8 @@ term_get_fkeys_1 (void)
   char **address = term_get_fkeys_address;
   KBOARD *kboard = term_get_fkeys_kboard;
 
-  /* This can happen if CANNOT_DUMP or with strange options.  */
+  /* This can happen if Emacs is starting up from scratch, or with
+     strange options.  */
   if (!KEYMAPP (KVAR (kboard, Vinput_decode_map)))
     kset_input_decode_map (kboard, Fmake_sparse_keymap (Qnil));
 
@@ -1359,8 +1362,7 @@ term_get_fkeys_1 (void)
       char *sequence = tgetstr (keys[i].cap, address);
       if (sequence)
        Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (sequence),
-                    Fmake_vector (make_fixnum (1),
-                                  intern (keys[i].name)));
+                    make_vector (1, intern (keys[i].name)));
     }
 
   /* The uses of the "k0" capability are inconsistent; sometimes it
@@ -1379,13 +1381,13 @@ term_get_fkeys_1 (void)
          /* Define f0 first, so that f10 takes precedence in case the
             key sequences happens to be the same.  */
          Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0),
-                      Fmake_vector (make_fixnum (1), intern ("f0")));
+                      make_vector (1, intern ("f0")));
        Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k_semi),
-                    Fmake_vector (make_fixnum (1), intern ("f10")));
+                    make_vector (1, intern ("f10")));
       }
     else if (k0)
       Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string (k0),
-                  Fmake_vector (make_fixnum (1), intern (k0_name)));
+                  make_vector (1, intern (k0_name)));
   }
 
   /* Set up cookies for numbered function keys above f10. */
@@ -1408,8 +1410,7 @@ term_get_fkeys_1 (void)
            {
              sprintf (fkey, "f%d", i);
              Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string 
(sequence),
-                          Fmake_vector (make_fixnum (1),
-                                        intern (fkey)));
+                          make_vector (1, intern (fkey)));
            }
        }
       }
@@ -1425,8 +1426,7 @@ term_get_fkeys_1 (void)
          char *sequence = tgetstr (cap2, address);                     \
          if (sequence)                                                 \
            Fdefine_key (KVAR (kboard, Vinput_decode_map), build_string 
(sequence), \
-                        Fmake_vector (make_fixnum (1),                 \
-                                      intern (sym)));                  \
+                        make_vector (1, intern (sym)));                \
        }
 
       /* if there's no key_next keycap, map key_npage to `next' keysym */
@@ -2437,15 +2437,14 @@ term_mouse_movement (struct frame *frame, Gpm_Event 
*event)
   return 0;
 }
 
-/* Return the Time that corresponds to T.  Wrap around on overflow.  */
+/* Return the current time, as a Time value.  Wrap around on overflow.  */
 static Time
-timeval_to_Time (struct timeval const *t)
+current_Time (void)
 {
-  Time s_1000, ms;
-
-  s_1000 = t->tv_sec;
+  struct timespec now = current_timespec ();
+  Time s_1000 = now.tv_sec;
   s_1000 *= 1000;
-  ms = t->tv_usec / 1000;
+  Time ms = now.tv_nsec / 1000000;
   return s_1000 + ms;
 }
 
@@ -2467,8 +2466,6 @@ term_mouse_position (struct frame **fp, int insist, 
Lisp_Object *bar_window,
                     enum scroll_bar_part *part, Lisp_Object *x,
                     Lisp_Object *y, Time *timeptr)
 {
-  struct timeval now;
-
   *fp = SELECTED_FRAME ();
   (*fp)->mouse_moved = 0;
 
@@ -2477,8 +2474,7 @@ term_mouse_position (struct frame **fp, int insist, 
Lisp_Object *bar_window,
 
   XSETINT (*x, last_mouse_x);
   XSETINT (*y, last_mouse_y);
-  gettimeofday(&now, 0);
-  *timeptr = timeval_to_Time (&now);
+  *timeptr = current_Time ();
 }
 
 /* Prepare a mouse-event in *RESULT for placement in the input queue.
@@ -2490,7 +2486,6 @@ static Lisp_Object
 term_mouse_click (struct input_event *result, Gpm_Event *event,
                  struct frame *f)
 {
-  struct timeval now;
   int i, j;
 
   result->kind = GPM_CLICK_EVENT;
@@ -2501,8 +2496,7 @@ term_mouse_click (struct input_event *result, Gpm_Event 
*event,
        break;
       }
     }
-  gettimeofday(&now, 0);
-  result->timestamp = timeval_to_Time (&now);
+  result->timestamp = current_Time ();
 
   if (event->type & GPM_UP)
     result->modifiers = up_modifier;
diff --git a/src/termcap.c b/src/termcap.c
index 4d85323..7dc0d57 100644
--- a/src/termcap.c
+++ b/src/termcap.c
@@ -1,5 +1,5 @@
 /* Work-alike for termcap, plus extra features.
-   Copyright (C) 1985-1986, 1993-1995, 2000-2008, 2011, 2013-2018 Free
+   Copyright (C) 1985-1986, 1993-1995, 2000-2008, 2011, 2013-2019 Free
    Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
@@ -20,10 +20,14 @@ along with this program.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 /* Emacs config.h may rename various library functions such as malloc.  */
 #include <config.h>
+
+#include <stdlib.h>
 #include <sys/file.h>
 #include <fcntl.h>
 #include <unistd.h>
 
+#include <intprops.h>
+
 #include "lisp.h"
 #include "tparam.h"
 #ifdef MSDOS
@@ -158,7 +162,7 @@ tgetst1 (char *ptr, char **area)
   else
     ret = *area;
 
-  /* Copy the string value, stopping at null or colon.
+  /* Copy the string value, stopping at NUL or colon.
      Also process ^ and \ abbreviations.  */
   p = ptr;
   r = ret;
@@ -265,14 +269,7 @@ char PC;
 void
 tputs (register const char *str, int nlines, int (*outfun) (int))
 {
-  register int padcount = 0;
-  register int speed;
-
-  speed = baud_rate;
-  /* For quite high speeds, convert to the smaller
-     units to avoid overflow.  */
-  if (speed > 10000)
-    speed = - speed / 100;
+  int padcount = 0;
 
   if (!str)
     return;
@@ -296,21 +293,13 @@ tputs (register const char *str, int nlines, int 
(*outfun) (int))
     (*outfun) (*str++);
 
   /* PADCOUNT is now in units of tenths of msec.
-     SPEED is measured in characters per 10 seconds
-     or in characters per .1 seconds (if negative).
-     We use the smaller units for larger speeds to avoid overflow.  */
-  padcount *= speed;
-  padcount += 500;
-  padcount /= 1000;
-  if (speed < 0)
-    padcount = -padcount;
-  else
-    {
-      padcount += 50;
-      padcount /= 100;
-    }
+     BAUD_RATE is measured in characters per 10 seconds.
+     Compute PADFACTOR = 100000 * (how many padding bytes are needed).  */
+  intmax_t padfactor;
+  if (INT_MULTIPLY_WRAPV (padcount, baud_rate, &padfactor))
+    padfactor = baud_rate < 0 ? INTMAX_MIN : INTMAX_MAX;
 
-  while (padcount-- > 0)
+  for (; 50000 <= padfactor; padfactor -= 100000)
     (*outfun) (PC);
 }
 
@@ -426,7 +415,7 @@ tgetent (char *bp, const char *name)
     }
 
   if (!termcap_name || !filep)
-    termcap_name = TERMCAP_FILE;
+    termcap_name = (char *) TERMCAP_FILE;
 
   /* Here we know we must search a file and termcap_name has its name.  */
 
@@ -435,7 +424,7 @@ tgetent (char *bp, const char *name)
     return -1;
 
   buf.size = BUFSIZE;
-  /* Add 1 to size to ensure room for terminating null.  */
+  /* Add 1 to size to ensure room for terminating NUL.  */
   buf.beg = xmalloc (buf.size + 1);
   term = indirect ? indirect : (char *)name;
 
@@ -491,7 +480,7 @@ tgetent (char *bp, const char *name)
       *bp1 = '\0';
 
       /* Does this entry refer to another terminal type's entry?
-        If something is found, copy it into heap and null-terminate it.  */
+        If something is found, copy it into heap and NUL-terminate it.  */
       tc_search_point = find_capability (tc_search_point, "tc");
       term = tgetst1 (tc_search_point, 0);
     }
@@ -629,7 +618,7 @@ gobble_line (int fd, register struct termcap_buffer *bufp, 
char *append_end)
            {
              ptrdiff_t ptr_offset = bufp->ptr - buf;
              ptrdiff_t append_end_offset = append_end - buf;
-             /* Add 1 to size to ensure room for terminating null.  */
+             /* Add 1 to size to ensure room for terminating NUL.  */
              ptrdiff_t size = bufp->size + 1;
              bufp->beg = buf = xpalloc (buf, &size, 1, -1, 1);
              bufp->size = size - 1;
diff --git a/src/termchar.h b/src/termchar.h
index 3b6be54..796453d 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -1,5 +1,5 @@
 /* Flags and parameters describing terminal's characteristics.
-   Copyright (C) 1985-1986, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1985-1986, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/termhooks.h b/src/termhooks.h
index 4e34105..ca6782f 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -1,6 +1,6 @@
 /* Parameters and display hooks for terminal devices.
 
-Copyright (C) 1985-1986, 1993-1994, 2001-2018 Free Software Foundation,
+Copyright (C) 1985-1986, 1993-1994, 2001-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/terminal.c b/src/terminal.c
index e480359..1d7a965 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -1,5 +1,5 @@
 /* Functions related to terminal devices.
-   Copyright (C) 2005-2018 Free Software Foundation, Inc.
+   Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/terminfo.c b/src/terminfo.c
index d8a148e..7ca2548 100644
--- a/src/terminfo.c
+++ b/src/terminfo.c
@@ -1,5 +1,5 @@
 /* Interface from Emacs to terminfo.
-   Copyright (C) 1985-1986, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1985-1986, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/termopts.h b/src/termopts.h
index 4ac75ba..a7a825b 100644
--- a/src/termopts.h
+++ b/src/termopts.h
@@ -1,5 +1,5 @@
 /* Flags and parameters describing user options for handling the terminal.
-   Copyright (C) 1985-1986, 1990, 2001-2018 Free Software Foundation,
+   Copyright (C) 1985-1986, 1990, 2001-2019 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/textprop.c b/src/textprop.c
index 8e8baf4..bb063d3 100644
--- a/src/textprop.c
+++ b/src/textprop.c
@@ -1,5 +1,5 @@
 /* Interface code for dealing with text properties.
-   Copyright (C) 1993-1995, 1997, 1999-2018 Free Software Foundation,
+   Copyright (C) 1993-1995, 1997, 1999-2019 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
@@ -89,7 +89,7 @@ modify_text_properties (Lisp_Object buffer, Lisp_Object 
start, Lisp_Object end)
   BUF_COMPUTE_UNCHANGED (buf, b - 1, e);
   if (MODIFF <= SAVE_MODIFF)
     record_first_change ();
-  MODIFF++;
+  modiff_incr (&MODIFF);
 
   bset_point_before_scroll (current_buffer, Qnil);
 
@@ -111,9 +111,6 @@ CHECK_STRING_OR_BUFFER (Lisp_Object x)
    to by BEGIN and END may be integers or markers; if the latter, they
    are coerced to integers.
 
-   When OBJECT is a string, we increment *BEGIN and *END
-   to make them origin-one.
-
    Note that buffer points don't correspond to interval indices.
    For example, point-max is 1 greater than the index of the last
    character.  This difference is handled in the caller, which uses
@@ -175,9 +172,6 @@ validate_interval_range (Lisp_Object object, Lisp_Object 
*begin,
       if (! (0 <= XFIXNUM (*begin) && XFIXNUM (*begin) <= XFIXNUM (*end)
             && XFIXNUM (*end) <= len))
        args_out_of_range (*begin, *end);
-      XSETFASTINT (*begin, XFIXNAT (*begin));
-      if (begin != end)
-       XSETFASTINT (*end, XFIXNAT (*end));
       i = string_intervals (object);
 
       if (len == 0)
@@ -1348,13 +1342,9 @@ Lisp_Object
 set_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object 
properties,
                     Lisp_Object object, Lisp_Object coherent_change_p)
 {
-  register INTERVAL i;
-  Lisp_Object ostart, oend;
+  INTERVAL i;
   bool first_time = true;
 
-  ostart = start;
-  oend = end;
-
   properties = validate_plist (properties);
 
   if (NILP (object))
@@ -1382,11 +1372,6 @@ set_text_properties (Lisp_Object start, Lisp_Object end, 
Lisp_Object properties,
       if (NILP (properties))
        return Qnil;
 
-      /* Restore the original START and END values
-        because validate_interval_range increments them for strings.  */
-      start = ostart;
-      end = oend;
-
       i = validate_interval_range (object, &start, &end, hard);
       /* This can return if start == end.  */
       if (!i)
@@ -1421,34 +1406,25 @@ set_text_properties (Lisp_Object start, Lisp_Object 
end, Lisp_Object properties,
 /* Replace properties of text from START to END with new list of
    properties PROPERTIES.  OBJECT is the buffer or string containing
    the text.  This does not obey any hooks.
-   You should provide the interval that START is located in as I.
-   START and END can be in any order.  */
+   I is the interval that START is located in.  */
 
 void
-set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object 
properties, Lisp_Object object, INTERVAL i)
+set_text_properties_1 (Lisp_Object start, Lisp_Object end,
+                      Lisp_Object properties, Lisp_Object object, INTERVAL i)
 {
-  register INTERVAL prev_changed = NULL;
-  register ptrdiff_t s, len;
-  INTERVAL unchanged;
+  INTERVAL prev_changed = NULL;
+  ptrdiff_t s = XFIXNUM (start);
+  ptrdiff_t len = XFIXNUM (end) - s;
 
-  if (XFIXNUM (start) < XFIXNUM (end))
-    {
-      s = XFIXNUM (start);
-      len = XFIXNUM (end) - s;
-    }
-  else if (XFIXNUM (end) < XFIXNUM (start))
-    {
-      s = XFIXNUM (end);
-      len = XFIXNUM (start) - s;
-    }
-  else
+  if (len == 0)
     return;
+  eassert (0 < len);
 
   eassert (i);
 
   if (i->position != s)
     {
-      unchanged = i;
+      INTERVAL unchanged = i;
       i = split_interval_right (unchanged, s - unchanged->position);
 
       if (LENGTH (i) > len)
@@ -1896,45 +1872,30 @@ Lisp_Object
 copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src,
                      Lisp_Object pos, Lisp_Object dest, Lisp_Object prop)
 {
-  INTERVAL i;
-  Lisp_Object res;
-  Lisp_Object stuff;
-  Lisp_Object plist;
-  ptrdiff_t s, e, e2, p, len;
-  bool modified = false;
-
-  i = validate_interval_range (src, &start, &end, soft);
+  INTERVAL i = validate_interval_range (src, &start, &end, soft);
   if (!i)
     return Qnil;
 
   CHECK_FIXNUM_COERCE_MARKER (pos);
-  {
-    Lisp_Object dest_start, dest_end;
-
-    e = XFIXNUM (pos) + (XFIXNUM (end) - XFIXNUM (start));
-    if (MOST_POSITIVE_FIXNUM < e)
-      args_out_of_range (pos, end);
-    dest_start = pos;
-    XSETFASTINT (dest_end, e);
-    /* Apply this to a copy of pos; it will try to increment its arguments,
-       which we don't want.  */
-    validate_interval_range (dest, &dest_start, &dest_end, soft);
-  }
 
-  s = XFIXNUM (start);
-  e = XFIXNUM (end);
-  p = XFIXNUM (pos);
+  EMACS_INT dest_e = XFIXNUM (pos) + (XFIXNUM (end) - XFIXNUM (start));
+  if (MOST_POSITIVE_FIXNUM < dest_e)
+    args_out_of_range (pos, end);
+  Lisp_Object dest_end = make_fixnum (dest_e);
+  validate_interval_range (dest, &pos, &dest_end, soft);
+
+  ptrdiff_t s = XFIXNUM (start), e = XFIXNUM (end), p = XFIXNUM (pos);
 
-  stuff = Qnil;
+  Lisp_Object stuff = Qnil;
 
   while (s < e)
     {
-      e2 = i->position + LENGTH (i);
+      ptrdiff_t e2 = i->position + LENGTH (i);
       if (e2 > e)
        e2 = e;
-      len = e2 - s;
+      ptrdiff_t len = e2 - s;
 
-      plist = i->plist;
+      Lisp_Object plist = i->plist;
       if (! NILP (prop))
        while (! NILP (plist))
          {
@@ -1959,9 +1920,11 @@ copy_text_properties (Lisp_Object start, Lisp_Object 
end, Lisp_Object src,
       s = i->position;
     }
 
+  bool modified = false;
+
   while (! NILP (stuff))
     {
-      res = Fcar (stuff);
+      Lisp_Object res = Fcar (stuff);
       res = Fadd_text_properties (Fcar (res), Fcar (Fcdr (res)),
                                  Fcar (Fcdr (Fcdr (res))), dest);
       if (! NILP (res))
@@ -2356,11 +2319,10 @@ inherits it if NONSTICKINESS is nil.  The 
`front-sticky' and
   Vtext_property_default_nonsticky
     = list2 (Fcons (Qsyntax_table, Qt), Fcons (Qdisplay, Qt));
 
-  staticpro (&interval_insert_behind_hooks);
-  staticpro (&interval_insert_in_front_hooks);
   interval_insert_behind_hooks = Qnil;
   interval_insert_in_front_hooks = Qnil;
-
+  staticpro (&interval_insert_behind_hooks);
+  staticpro (&interval_insert_in_front_hooks);
 
   /* Common attributes one might give text.  */
 
diff --git a/src/thread.c b/src/thread.c
index 6612697..e51d614 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -1,5 +1,5 @@
 /* Threading code.
-Copyright (C) 2012-2018 Free Software Foundation, Inc.
+Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -25,6 +25,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "process.h"
 #include "coding.h"
 #include "syssignal.h"
+#include "pdumper.h"
 #include "keyboard.h"
 
 union aligned_thread_state
@@ -616,7 +617,7 @@ static void
 mark_one_thread (struct thread_state *thread)
 {
   /* Get the stack top now, in case mark_specpdl changes it.  */
-  void *stack_top = thread->stack_top;
+  void const *stack_top = thread->stack_top;
 
   mark_specpdl (thread->m_specpdl, thread->m_specpdl_ptr);
 
@@ -767,9 +768,21 @@ run_thread (void *state)
   return NULL;
 }
 
+static void
+free_search_regs (struct re_registers *regs)
+{
+  if (regs->num_regs != 0)
+    {
+      xfree (regs->start);
+      xfree (regs->end);
+    }
+}
+
 void
 finalize_one_thread (struct thread_state *state)
 {
+  free_search_regs (&state->m_search_regs);
+  free_search_regs (&state->m_saved_search_regs);
   sys_cond_destroy (&state->thread_condvar);
 }
 
@@ -1064,7 +1077,7 @@ init_main_thread (void)
 }
 
 bool
-main_thread_p (void *ptr)
+main_thread_p (const void *ptr)
 {
   return ptr == &main_thread.s;
 }
diff --git a/src/thread.h b/src/thread.h
index 464506d..50f8f5c 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -1,5 +1,5 @@
 /* Thread definitions
-Copyright (C) 2012-2018 Free Software Foundation, Inc.
+Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -65,7 +65,7 @@ struct thread_state
   /* m_stack_bottom must be the first non-Lisp field.  */
   /* An address near the bottom of the stack.
      Tells GC how to save a copy of the stack.  */
-  char *m_stack_bottom;
+  char const *m_stack_bottom;
 #define stack_bottom (current_thread->m_stack_bottom)
 
   /* The address of an object near the C stack top, used to determine
@@ -75,7 +75,7 @@ struct thread_state
      error in Emacs.  If the C function F calls G which calls H which
      calls ... F, then at least one of the functions in the chain
      should set this to the address of a local variable.  */
-  void *stack_top;
+  void const *stack_top;
 
   struct catchtag *m_catchlist;
 #define catchlist (current_thread->m_catchlist)
@@ -104,15 +104,15 @@ struct thread_state
 #define specpdl_ptr (current_thread->m_specpdl_ptr)
 
   /* Depth in Lisp evaluations and function calls.  */
-  EMACS_INT m_lisp_eval_depth;
+  intmax_t m_lisp_eval_depth;
 #define lisp_eval_depth (current_thread->m_lisp_eval_depth)
 
   /* This points to the current buffer.  */
   struct buffer *m_current_buffer;
 #define current_buffer (current_thread->m_current_buffer)
 
-  /* Every call to re_match_2, etc., must pass &search_regs as the regs
-     argument unless you can show it is unnecessary (i.e., if re_match_2
+  /* Every call to re_search, etc., must pass &search_regs as the regs
+     argument unless you can show it is unnecessary (i.e., if re_search
      is certainly going to be called again before region-around-match
      can be called).
 
@@ -131,11 +131,6 @@ struct thread_state
   struct re_registers m_search_regs;
 #define search_regs (current_thread->m_search_regs)
 
-  /* If non-zero the match data have been saved in saved_search_regs
-     during the execution of a sentinel or filter. */
-  bool m_search_regs_saved;
-#define search_regs_saved (current_thread->m_search_regs_saved)
-
   struct re_registers m_saved_search_regs;
 #define saved_search_regs (current_thread->m_saved_search_regs)
 
@@ -295,7 +290,7 @@ extern void maybe_reacquire_global_lock (void);
 extern void init_threads_once (void);
 extern void init_threads (void);
 extern void syms_of_threads (void);
-extern bool main_thread_p (void *);
+extern bool main_thread_p (const void *);
 extern bool in_current_thread (void);
 
 typedef int select_func (int, fd_set *, fd_set *, fd_set *,
diff --git a/src/timefns.c b/src/timefns.c
index c94d97d..514fa24 100644
--- a/src/timefns.c
+++ b/src/timefns.c
@@ -1,6 +1,6 @@
 /* Timestamp functions for Emacs
 
-Copyright (C) 1985-1987, 1989, 1993-2018 Free Software Foundation, Inc.
+Copyright (C) 1985-1987, 1989, 1993-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -25,6 +25,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "bignum.h"
 #include "coding.h"
 #include "lisp.h"
+#include "pdumper.h"
 
 #include <strftime.h>
 
@@ -44,7 +45,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 # define HAVE_TZALLOC_BUG false
 #endif
 
-#define TM_YEAR_BASE 1900
+enum { TM_YEAR_BASE = 1900 };
 
 #ifndef HAVE_TM_GMTOFF
 # define HAVE_TM_GMTOFF false
@@ -171,16 +172,6 @@ emacs_localtime_rz (timezone_t tz, time_t const *t, struct 
tm *tm)
   return tm;
 }
 
-static time_t
-emacs_mktime_z (timezone_t tz, struct tm *tm)
-{
-  errno = 0;
-  time_t t = mktime_z (tz, tm);
-  if (t == (time_t) -1 && errno == ENOMEM)
-    memory_full (SIZE_MAX);
-  return t;
-}
-
 static _Noreturn void
 invalid_time_zone_specification (Lisp_Object zone)
 {
@@ -301,16 +292,16 @@ tzlookup (Lisp_Object zone, bool settz)
 }
 
 void
-init_timefns (bool dumping)
+init_timefns (void)
 {
-#ifndef CANNOT_DUMP
+#ifdef HAVE_UNEXEC
   /* A valid but unlikely setting for the TZ environment variable.
      It is OK (though a bit slower) if the user chooses this value.  */
   static char dump_tz_string[] = "TZ=UtC0";
 
   /* When just dumping out, set the time zone to a known unlikely value
      and skip the rest of this function.  */
-  if (dumping)
+  if (will_dump_with_unexec_p ())
     {
       xputenv (dump_tz_string);
       tzset ();
@@ -320,7 +311,7 @@ init_timefns (bool dumping)
 
   char *tz = getenv ("TZ");
 
-#if !defined CANNOT_DUMP
+#ifdef HAVE_UNEXEC
   /* If the execution TZ happens to be the same as the dump TZ,
      change it to some other value and then change it back,
      to force the underlying implementation to reload the TZ info.
@@ -347,9 +338,14 @@ time_overflow (void)
 }
 
 static _Noreturn void
-invalid_time (void)
+time_error (int err)
 {
-  error ("Invalid time specification");
+  switch (err)
+    {
+    case ENOMEM: memory_full (SIZE_MAX);
+    case EOVERFLOW: time_overflow ();
+    default: error ("Invalid time specification");
+    }
 }
 
 static _Noreturn void
@@ -373,19 +369,19 @@ lo_time (time_t t)
 }
 
 /* Convert T into an Emacs time *RESULT, truncating toward minus infinity.
-   Return true if T is in range, false otherwise.  */
-static bool
+   Return zero if successful, an error number otherwise.  */
+static int
 decode_float_time (double t, struct lisp_time *result)
 {
   if (!isfinite (t))
-    return false;
+    return isnan (t) ? EINVAL : EOVERFLOW;
   /* Actual hz unknown; guess TIMESPEC_HZ.  */
   mpz_set_d (mpz[1], t);
   mpz_set_si (mpz[0], floor ((t - trunc (t)) * TIMESPEC_HZ));
   mpz_addmul_ui (mpz[0], mpz[1], TIMESPEC_HZ);
   result->ticks = make_integer_mpz ();
   result->hz = timespec_hz;
-  return true;
+  return 0;
 }
 
 /* Compute S + NS/TIMESPEC_HZ as a double.
@@ -569,9 +565,9 @@ lisp_time_form_stamp (struct lisp_time t, Lisp_Object form)
    start of the POSIX Epoch.  Unsuccessful calls may or may not store
    results.
 
-   Return true if successful, false if (TICKS . HZ) would not
+   Return zero if successful, an error number if (TICKS . HZ) would not
    be a valid new-format timestamp.  */
-static bool
+static int
 decode_ticks_hz (Lisp_Object ticks, Lisp_Object hz,
                 struct lisp_time *result, double *dresult)
 {
@@ -581,7 +577,7 @@ decode_ticks_hz (Lisp_Object ticks, Lisp_Object hz,
   if (! (INTEGERP (ticks)
         && ((FIXNUMP (hz) && 0 < XFIXNUM (hz))
             || (BIGNUMP (hz) && 0 < mpz_sgn (XBIGNUM (hz)->value)))))
-    return false;
+    return EINVAL;
 
   if (result)
     {
@@ -600,7 +596,7 @@ decode_ticks_hz (Lisp_Object ticks, Lisp_Object hz,
              if (ns < 0)
                s--, ns += TIMESPEC_HZ;
              *dresult = s_ns_to_double (s, ns);
-             return true;
+             return 0;
            }
          ns = mpz_fdiv_q_ui (*q, XBIGNUM (ticks)->value, TIMESPEC_HZ);
        }
@@ -610,7 +606,7 @@ decode_ticks_hz (Lisp_Object ticks, Lisp_Object hz,
          if (FIXNUMP (ticks))
            {
              *dresult = XFIXNUM (ticks);
-             return true;
+             return 0;
            }
          q = &XBIGNUM (ticks)->value;
        }
@@ -624,7 +620,7 @@ decode_ticks_hz (Lisp_Object ticks, Lisp_Object hz,
       *dresult = s_ns_to_double (mpz_get_d (*q), ns);
     }
 
-  return true;
+  return 0;
 }
 
 /* Lisp timestamp classification.  */
@@ -649,9 +645,8 @@ enum timeform
    start of the POSIX Epoch.  Unsuccessful calls may or may not store
    results.
 
-   Return true if successful, false if the components are of the wrong
-   type.  */
-static bool
+   Return zero if successful, an error number otherwise.  */
+static int
 decode_time_components (enum timeform form,
                        Lisp_Object high, Lisp_Object low,
                        Lisp_Object usec, Lisp_Object psec,
@@ -660,7 +655,7 @@ decode_time_components (enum timeform form,
   switch (form)
     {
     case TIMEFORM_INVALID:
-      return false;
+      return EINVAL;
 
     case TIMEFORM_TICKS_HZ:
       return decode_ticks_hz (high, low, result, dresult);
@@ -673,7 +668,7 @@ decode_time_components (enum timeform form,
        else
          {
            *dresult = t;
-           return true;
+           return 0;
          }
       }
 
@@ -687,7 +682,7 @@ decode_time_components (enum timeform form,
          }
        else
          *dresult = s_ns_to_double (now.tv_sec, now.tv_nsec);
-       return true;
+       return 0;
       }
 
     default:
@@ -696,7 +691,7 @@ decode_time_components (enum timeform form,
 
   if (! (INTEGERP (high) && INTEGERP (low)
         && FIXNUMP (usec) && FIXNUMP (psec)))
-    return false;
+    return EINVAL;
   EMACS_INT us = XFIXNUM (usec);
   EMACS_INT ps = XFIXNUM (psec);
 
@@ -740,7 +735,7 @@ decode_time_components (enum timeform form,
   else
     *dresult = mpz_get_d (mpz[0]) + (us * 1e6L + ps) / 1e12L;
 
-  return true;
+  return 0;
 }
 
 enum { DECODE_SECS_ONLY = WARN_OBSOLETE_TIMESTAMPS + 1 };
@@ -758,9 +753,8 @@ enum { DECODE_SECS_ONLY = WARN_OBSOLETE_TIMESTAMPS + 1 };
    start of the POSIX Epoch.  Unsuccessful calls may or may not store
    results.
 
-   Return true if successful, false if SPECIFIED_TIME is
-   not a valid Lisp timestamp.  */
-static bool
+   Signal an error if unsuccessful.  */
+static void
 decode_lisp_time (Lisp_Object specified_time, int flags,
                  enum timeform *pform,
                  struct lisp_time *result, double *dresult)
@@ -820,7 +814,10 @@ decode_lisp_time (Lisp_Object specified_time, int flags,
 
   if (pform)
     *pform = form;
-  return decode_time_components (form, high, low, usec, psec, result, dresult);
+  int err = decode_time_components (form, high, low, usec, psec,
+                                   result, dresult);
+  if (err)
+    time_error (err);
 }
 
 /* Convert Z to time_t, returning true if it fits.  */
@@ -915,8 +912,8 @@ list4_to_timespec (Lisp_Object high, Lisp_Object low,
                   struct timespec *result)
 {
   struct lisp_time t;
-  if (! decode_time_components (TIMEFORM_HI_LO_US_PS, high, low, usec, psec,
-                               &t, 0))
+  if (decode_time_components (TIMEFORM_HI_LO_US_PS, high, low, usec, psec,
+                             &t, 0))
     return false;
   *result = lisp_to_timespec (t);
   return timespec_valid_p (*result);
@@ -928,10 +925,8 @@ list4_to_timespec (Lisp_Object high, Lisp_Object low,
 static struct lisp_time
 lisp_time_struct (Lisp_Object specified_time, enum timeform *pform)
 {
-  int flags = WARN_OBSOLETE_TIMESTAMPS;
   struct lisp_time t;
-  if (! decode_lisp_time (specified_time, flags, pform, &t, 0))
-    invalid_time ();
+  decode_lisp_time (specified_time, WARN_OBSOLETE_TIMESTAMPS, pform, &t, 0);
   return t;
 }
 
@@ -956,8 +951,7 @@ lisp_seconds_argument (Lisp_Object specified_time)
 {
   int flags = WARN_OBSOLETE_TIMESTAMPS | DECODE_SECS_ONLY;
   struct lisp_time lt;
-  if (! decode_lisp_time (specified_time, flags, 0, &lt, 0))
-    invalid_time ();
+  decode_lisp_time (specified_time, flags, 0, &lt, 0);
   struct timespec t = lisp_to_timespec (lt);
   if (! timespec_valid_p (t))
     time_overflow ();
@@ -1126,8 +1120,7 @@ or (if you need time as a string) `format-time-string'.  
*/)
   (Lisp_Object specified_time)
 {
   double t;
-  if (! decode_lisp_time (specified_time, 0, 0, 0, &t))
-    invalid_time ();
+  decode_lisp_time (specified_time, 0, 0, 0, &t);
   return make_float (t);
 }
 
@@ -1140,7 +1133,7 @@ or (if you need time as a string) `format-time-string'.  
*/)
    determine how many bytes would be written, use NULL for S and
    ((size_t) -1) for MAXSIZE.
 
-   This function behaves like nstrftime, except it allows null
+   This function behaves like nstrftime, except it allows NUL
    bytes in FORMAT and it does not support nanoseconds.  */
 static size_t
 emacs_nmemftime (char *s, size_t maxsize, const char *format,
@@ -1148,8 +1141,8 @@ emacs_nmemftime (char *s, size_t maxsize, const char 
*format,
 {
   size_t total = 0;
 
-  /* Loop through all the null-terminated strings in the format
-     argument.  Normally there's just one null-terminated string, but
+  /* Loop through all the NUL-terminated strings in the format
+     argument.  Normally there's just one NUL-terminated string, but
      there can be arbitrarily many, concatenated together, if the
      format contains '\0' bytes.  nstrftime stops at the first
      '\0' byte so we must invoke it separately for each such string.  */
@@ -1200,8 +1193,9 @@ format_time_string (char const *format, ptrdiff_t 
formatlen,
   tmp = emacs_localtime_rz (tz, &tsec, tmp);
   if (! tmp)
     {
+      int localtime_errno = errno;
       xtzfree (tz);
-      time_overflow ();
+      time_error (localtime_errno);
     }
   synchronize_system_time_locale ();
 
@@ -1273,7 +1267,7 @@ by text that describes the specified date and time in 
TIME:
 %c is the locale's date and time format.
 %x is the locale's "preferred" date format.
 %D is like "%m/%d/%y".
-%F is the ISO 8601 date format (like "%Y-%m-%d").
+%F is the ISO 8601 date format (like "%+4Y-%m-%d").
 
 %R is like "%H:%M", %T is like "%H:%M:%S", %r is like "%I:%M:%S %p".
 %X is the locale's "preferred" time format.
@@ -1281,17 +1275,23 @@ by text that describes the specified date and time in 
TIME:
 Finally, %n is a newline, %t is a tab, %% is a literal %, and
 unrecognized %-sequences stand for themselves.
 
-Certain flags and modifiers are available with some format controls.
-The flags are `_', `-', `^' and `#'.  For certain characters X,
-%_X is like %X, but padded with blanks; %-X is like %X,
-but without padding.  %^X is like %X, but with all textual
-characters up-cased; %#X is like %X, but with letter-case of
-all textual characters reversed.
-%NX (where N stands for an integer) is like %X,
-but takes up at least N (a number) positions.
-The modifiers are `E' and `O'.  For certain characters X,
-%EX is a locale's alternative version of %X;
-%OX is like %X, but uses the locale's number symbols.
+A %-sequence can contain optional flags, field width, and a modifier
+(in that order) after the `%'.  The flags are:
+
+`-' Do not pad the field.
+`_' Pad with spaces.
+`0' Pad with zeros.
+`+' Pad with zeros and put `+' before nonnegative year numbers with >4 digits.
+`^' Use upper case characters if possible.
+`#' Use opposite case characters if possible.
+
+A field width N is an unsigned decimal integer with a leading digit nonzero.
+%NX is like %X, but takes up at least N positions.
+
+The modifiers are:
+
+`E' Use the locale's alternative version.
+`O' Use the locale's number symbols.
 
 For example, to produce full ISO 8601 format, use "%FT%T%z".
 
@@ -1338,15 +1338,27 @@ usage: (decode-time &optional TIME ZONE)  */)
   struct tm local_tm, gmt_tm;
   timezone_t tz = tzlookup (zone, false);
   struct tm *tm = emacs_localtime_rz (tz, &time_spec, &local_tm);
+  int localtime_errno = errno;
   xtzfree (tz);
 
-  if (! (tm
-        && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= local_tm.tm_year
-        && local_tm.tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE))
-    time_overflow ();
+  if (!tm)
+    time_error (localtime_errno);
 
-  /* Avoid overflow when INT_MAX < EMACS_INT_MAX.  */
-  EMACS_INT tm_year_base = TM_YEAR_BASE;
+  Lisp_Object year;
+  if (FASTER_TIMEFNS
+      && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= local_tm.tm_year
+      && local_tm.tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE)
+    {
+      /* Avoid overflow when INT_MAX - TM_YEAR_BASE < local_tm.tm_year.  */
+      EMACS_INT tm_year_base = TM_YEAR_BASE;
+      year = make_fixnum (local_tm.tm_year + tm_year_base);
+    }
+  else
+    {
+      mpz_set_si (mpz[0], local_tm.tm_year);
+      mpz_add_ui (mpz[0], mpz[0], TM_YEAR_BASE);
+      year = make_integer_mpz ();
+    }
 
   return CALLN (Flist,
                make_fixnum (local_tm.tm_sec),
@@ -1354,7 +1366,7 @@ usage: (decode-time &optional TIME ZONE)  */)
                make_fixnum (local_tm.tm_hour),
                make_fixnum (local_tm.tm_mday),
                make_fixnum (local_tm.tm_mon + 1),
-               make_fixnum (local_tm.tm_year + tm_year_base),
+               year,
                make_fixnum (local_tm.tm_wday),
                (local_tm.tm_isdst < 0 ? make_fixnum (-1)
                 : local_tm.tm_isdst == 0 ? Qnil : Qt),
@@ -1365,7 +1377,7 @@ usage: (decode-time &optional TIME ZONE)  */)
                 : Qnil));
 }
 
-/* Return OBJ - OFFSET, checking that OBJ is a valid fixnum and that
+/* Return OBJ - OFFSET, checking that OBJ is a valid integer and that
    the result is representable as an int.  0 <= OFFSET <= TM_YEAR_BASE.  */
 static int
 check_tm_member (Lisp_Object obj, int offset)
@@ -1445,7 +1457,6 @@ year values as low as 1901 do work.
 usage: (encode-time &optional TIME FORM &rest OBSOLESCENT-ARGUMENTS)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
-  time_t value;
   struct tm tm;
   Lisp_Object form = Qnil, zone = Qnil;
   Lisp_Object a = args[0];
@@ -1460,8 +1471,7 @@ usage: (encode-time &optional TIME FORM &rest 
OBSOLESCENT-ARGUMENTS)  */)
        if (! CONSP (tail))
          {
            struct lisp_time t;
-           if (! decode_lisp_time (a, 0, 0, &t, 0))
-             invalid_time ();
+           decode_lisp_time (a, 0, 0, &t, 0);
            return lisp_time_form_stamp (t, form);
          }
       tm.tm_sec  = check_tm_member (XCAR (a), 0); a = XCDR (a);
@@ -1482,7 +1492,6 @@ usage: (encode-time &optional TIME FORM &rest 
OBSOLESCENT-ARGUMENTS)  */)
     {
       if (6 < nargs)
        zone = args[nargs - 1];
-      form = Qnil;
       tm.tm_sec  = check_tm_member (a, 0);
       tm.tm_min  = check_tm_member (args[1], 0);
       tm.tm_hour = check_tm_member (args[2], 0);
@@ -1492,11 +1501,13 @@ usage: (encode-time &optional TIME FORM &rest 
OBSOLESCENT-ARGUMENTS)  */)
     }
 
   timezone_t tz = tzlookup (zone, false);
-  value = emacs_mktime_z (tz, &tm);
+  tm.tm_wday = -1;
+  time_t value = mktime_z (tz, &tm);
+  int mktime_errno = errno;
   xtzfree (tz);
 
-  if (value == (time_t) -1)
-    time_overflow ();
+  if (tm.tm_wday < 0)
+    time_error (mktime_errno);
 
   return time_form_stamp (value, form);
 }
@@ -1544,9 +1555,10 @@ without consideration for daylight saving time.  */)
      range -999 .. 9999.  */
   struct tm tm;
   struct tm *tmp = emacs_localtime_rz (tz, &value, &tm);
+  int localtime_errno = errno;
   xtzfree (tz);
   if (! tmp)
-    time_overflow ();
+    time_error (localtime_errno);
 
   static char const wday_name[][4] =
     { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
@@ -1724,6 +1736,19 @@ emacs_setenv_TZ (const char *tzstring)
   return 0;
 }
 
+#if (ULONG_MAX < TRILLION || !FASTER_TIMEFNS) && !defined ztrillion
+# define NEED_ZTRILLION_INIT 1
+#endif
+
+#ifdef NEED_ZTRILLION_INIT
+static void
+syms_of_timefns_for_pdumper (void)
+{
+  mpz_init_set_ui (ztrillion, 1000000);
+  mpz_mul_ui (ztrillion, ztrillion, 1000000);
+}
+#endif
+
 void
 syms_of_timefns (void)
 {
@@ -1735,10 +1760,6 @@ syms_of_timefns (void)
   trillion = make_int (1000000000000);
   staticpro (&trillion);
 #endif
-#if (ULONG_MAX < TRILLION || !FASTER_TIMEFNS) && !defined ztrillion
-  mpz_init_set_ui (ztrillion, 1000000);
-  mpz_mul_ui (ztrillion, ztrillion, 1000000);
-#endif
 
   DEFSYM (Qencode_time, "encode-time");
 
@@ -1754,4 +1775,7 @@ syms_of_timefns (void)
   defsubr (&Scurrent_time_string);
   defsubr (&Scurrent_time_zone);
   defsubr (&Sset_time_zone_rule);
+#ifdef NEED_ZTRILLION_INIT
+  pdumper_do_now_and_after_load (syms_of_timefns_for_pdumper);
+#endif
 }
diff --git a/src/tparam.c b/src/tparam.c
index 0896740..9f17785 100644
--- a/src/tparam.c
+++ b/src/tparam.c
@@ -1,5 +1,5 @@
 /* Merge parameters into a termcap entry string.
-   Copyright (C) 1985, 1987, 1993, 1995, 2000-2008, 2013-2018 Free
+   Copyright (C) 1985, 1987, 1993, 1995, 2000-2008, 2013-2019 Free
    Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify
diff --git a/src/tparam.h b/src/tparam.h
index 79c55b9..6918c9e 100644
--- a/src/tparam.h
+++ b/src/tparam.h
@@ -1,6 +1,6 @@
 /* Interface definitions for termcap entries.
 
-Copyright (C) 2011-2018 Free Software Foundation, Inc.
+Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/undo.c b/src/undo.c
index 1975e38..3c1251d 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -1,5 +1,5 @@
 /* undo handling for GNU Emacs.
-   Copyright (C) 1990, 1993-1994, 2000-2018 Free Software Foundation,
+   Copyright (C) 1990, 1993-1994, 2000-2019 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
@@ -291,7 +291,7 @@ truncate_undo_list (struct buffer *b)
 {
   Lisp_Object list;
   Lisp_Object prev, next, last_boundary;
-  EMACS_INT size_so_far = 0;
+  intmax_t size_so_far = 0;
 
   /* Make sure that calling undo-outer-limit-function
      won't cause another GC.  */
@@ -348,14 +348,17 @@ truncate_undo_list (struct buffer *b)
 
   /* If by the first boundary we have already passed undo_outer_limit,
      we're heading for memory full, so offer to clear out the list.  */
-  if (FIXNUMP (Vundo_outer_limit)
-      && size_so_far > XFIXNUM (Vundo_outer_limit)
+  intmax_t undo_outer_limit;
+  if ((INTEGERP (Vundo_outer_limit)
+       && (integer_to_intmax (Vundo_outer_limit, &undo_outer_limit)
+          ? undo_outer_limit < size_so_far
+          : NILP (Fnatnump (Vundo_outer_limit))))
       && !NILP (Vundo_outer_limit_function))
     {
       Lisp_Object tem;
 
       /* Normally the function this calls is undo-outer-limit-truncate.  */
-      tem = call1 (Vundo_outer_limit_function, make_fixnum (size_so_far));
+      tem = call1 (Vundo_outer_limit_function, make_int (size_so_far));
       if (! NILP (tem))
        {
          /* The function is responsible for making
diff --git a/src/unexaix.c b/src/unexaix.c
index 126fc8b..349d365 100644
--- a/src/unexaix.c
+++ b/src/unexaix.c
@@ -1,5 +1,5 @@
 /* Dump an executable image.
-   Copyright (C) 1985-1988, 1999, 2001-2018 Free Software Foundation,
+   Copyright (C) 1985-1988, 1999, 2001-2019 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/unexcoff.c b/src/unexcoff.c
index f310d92..220ce70 100644
--- a/src/unexcoff.c
+++ b/src/unexcoff.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1985-1988, 1992-1994, 2001-2018 Free Software
+/* Copyright (C) 1985-1988, 1992-1994, 2001-2019 Free Software
  * Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -56,7 +56,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 #define PERROR(file) report_error (file, new)
 
-#ifndef CANNOT_DUMP  /* all rest of file!  */
+#ifdef HAVE_UNEXEC  /* all rest of file!  */
 
 #ifdef HAVE_COFF_H
 #include <coff.h>
@@ -538,4 +538,4 @@ unexec (const char *new_name, const char *a_name)
     emacs_close (a_out);
 }
 
-#endif /* not CANNOT_DUMP */
+#endif /* HAVE_UNEXEC */
diff --git a/src/unexcw.c b/src/unexcw.c
index dea9f6a..a6e30f6 100644
--- a/src/unexcw.c
+++ b/src/unexcw.c
@@ -1,7 +1,7 @@
 /* unexec() support for Cygwin;
    complete rewrite of xemacs Cygwin unexec() code
 
-   Copyright (C) 2004-2018 Free Software Foundation, Inc.
+   Copyright (C) 2004-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/unexelf.c b/src/unexelf.c
index 4b9292f..c63a8d0 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1985-1988, 1990, 1992, 1999-2018 Free Software
+/* Copyright (C) 1985-1988, 1990, 1992, 1999-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 2439102..a94c0cc 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -1,5 +1,5 @@
 /* Dump Emacs in Mach-O format for use on macOS.
-   Copyright (C) 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -447,7 +447,7 @@ unexec_regions_recorder (task_t task, void *rr, unsigned 
type,
 
   while (num && num_unexec_regions < MAX_UNEXEC_REGIONS)
     {
-      /* Subtract the size of trailing null bytes from filesize.  It
+      /* Subtract the size of trailing NUL bytes from filesize.  It
         can be smaller than vmsize in segment commands.  In such a
         case, trailing bytes are initialized with zeros.  */
       for (p = ranges->address + ranges->size; p > ranges->address; p--)
diff --git a/src/unexw32.c b/src/unexw32.c
index 41d6ccf..59feaa7 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -1,5 +1,5 @@
 /* unexec for GNU Emacs on Windows NT.
-   Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -39,17 +39,12 @@ PIMAGE_NT_HEADERS (__stdcall * pfnCheckSumMappedFile) 
(LPVOID BaseAddress,
                                                       LPDWORD HeaderSum,
                                                       LPDWORD CheckSum);
 
-extern BOOL ctrl_c_handler (unsigned long type);
-
 extern char my_begdata[];
 extern char my_begbss[];
 extern char *my_begbss_static;
 
 #include "w32heap.h"
 
-/* Basically, our "initialized" flag.  */
-BOOL using_dynamic_heap = FALSE;
-
 void get_section_info (file_data *p_file);
 void copy_executable_and_dump_data (file_data *, file_data *);
 void dump_bss_and_heap (file_data *p_infile, file_data *p_outfile);
@@ -70,84 +65,10 @@ PCHAR  bss_start_static = 0;
 DWORD_PTR  bss_size_static = 0;
 DWORD_PTR  extra_bss_size_static = 0;
 
-/* MinGW64 doesn't add a leading underscore to external symbols,
-   whereas configure.ac sets up LD_SWITCH_SYSTEM_TEMACS to force the
-   entry point at __start, with two underscores.  */
-#ifdef __MINGW64__
-#define _start __start
-#endif
-
-extern void mainCRTStartup (void);
-
-/* Startup code for running on NT.  When we are running as the dumped
-   version, we need to bootstrap our heap and .bss section into our
-   address space before we can actually hand off control to the startup
-   code supplied by NT (primarily because that code relies upon malloc ()).  */
-void _start (void);
-
-void
-_start (void)
-{
-
-#if 1
-  /* Give us a way to debug problems with crashes on startup when
-     running under the MSVC profiler. */
-  if (GetEnvironmentVariable ("EMACS_DEBUG", NULL, 0) > 0)
-    DebugBreak ();
-#endif
-
-  /* Cache system info, e.g., the NT page size.  */
-  cache_system_info ();
-
-  /* Grab our malloc arena space now, before CRT starts up. */
-  init_heap ();
-
-  /* This prevents ctrl-c's in shells running while we're suspended from
-     having us exit.  */
-  SetConsoleCtrlHandler ((PHANDLER_ROUTINE) ctrl_c_handler, TRUE);
-
-  /* Prevent Emacs from being locked up (eg. in batch mode) when
-     accessing devices that aren't mounted (eg. removable media drives).  */
-  SetErrorMode (SEM_FAILCRITICALERRORS);
-  mainCRTStartup ();
-}
-
-
 /* File handling.  */
 
 /* Implementation note: this and the next functions work with ANSI
    codepage encoded file names!  */
-int
-open_input_file (file_data *p_file, char *filename)
-{
-  HANDLE file;
-  HANDLE file_mapping;
-  void  *file_base;
-  unsigned long size, upper_size;
-
-  file = CreateFileA (filename, GENERIC_READ, FILE_SHARE_READ, NULL,
-                     OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
-  if (file == INVALID_HANDLE_VALUE)
-    return FALSE;
-
-  size = GetFileSize (file, &upper_size);
-  file_mapping = CreateFileMapping (file, NULL, PAGE_READONLY,
-                                   0, size, NULL);
-  if (!file_mapping)
-    return FALSE;
-
-  file_base = MapViewOfFile (file_mapping, FILE_MAP_READ, 0, 0, size);
-  if (file_base == 0)
-    return FALSE;
-
-  p_file->name = filename;
-  p_file->size = size;
-  p_file->file = file;
-  p_file->file_mapping = file_mapping;
-  p_file->file_base = file_base;
-
-  return TRUE;
-}
 
 int
 open_output_file (file_data *p_file, char *filename, unsigned long size)
@@ -187,18 +108,6 @@ open_output_file (file_data *p_file, char *filename, 
unsigned long size)
   return TRUE;
 }
 
-/* Close the system structures associated with the given file.  */
-void
-close_file_data (file_data *p_file)
-{
-  UnmapViewOfFile (p_file->file_base);
-  CloseHandle (p_file->file_mapping);
-  /* For the case of output files, set final size.  */
-  SetFilePointer (p_file->file, p_file->size, NULL, FILE_BEGIN);
-  SetEndOfFile (p_file->file);
-  CloseHandle (p_file->file);
-}
-
 
 /* Routines to manipulate NT executable file sections.  */
 
@@ -220,34 +129,6 @@ find_section (const char * name, IMAGE_NT_HEADERS * 
nt_header)
   return NULL;
 }
 
-/* Return pointer to section header for section containing the given
-   relative virtual address. */
-IMAGE_SECTION_HEADER *
-rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header)
-{
-  PIMAGE_SECTION_HEADER section;
-  int i;
-
-  section = IMAGE_FIRST_SECTION (nt_header);
-
-  for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++)
-    {
-      /* Some linkers (eg. the NT SDK linker I believe) swapped the
-        meaning of these two values - or rather, they ignored
-        VirtualSize entirely and always set it to zero.  This affects
-        some very old exes (eg. gzip dated Dec 1993).  Since
-        w32_executable_type relies on this function to work reliably,
-        we need to cope with this.  */
-      DWORD_PTR real_size = max (section->SizeOfRawData,
-                            section->Misc.VirtualSize);
-      if (rva >= section->VirtualAddress
-         && rva < section->VirtualAddress + real_size)
-       return section;
-      section++;
-    }
-  return NULL;
-}
-
 #if 0  /* unused */
 /* Return pointer to section header for section containing the given
    offset in its raw data area. */
@@ -765,15 +646,8 @@ unexec (const char *new_name, const char *old_name)
       exit (1);
     }
 
-  /* Set the flag (before dumping).  */
-  using_dynamic_heap = TRUE;
-
   copy_executable_and_dump_data (&in_file, &out_file);
 
-  /* Unset it because it is plain wrong to keep it after dumping.
-     Malloc can still occur!  */
-  using_dynamic_heap = FALSE;
-
   /* Patch up header fields; profiler is picky about this. */
   {
     PIMAGE_DOS_HEADER dos_header;
diff --git a/src/vm-limit.c b/src/vm-limit.c
index cb06e05..20ddaa9 100644
--- a/src/vm-limit.c
+++ b/src/vm-limit.c
@@ -1,5 +1,5 @@
 /* Functions for memory limit warnings.
-   Copyright (C) 1990, 1992, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1992, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w16select.c b/src/w16select.c
index a5f0757..3eb2199 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -1,6 +1,6 @@
 /* 16-bit Windows Selection processing for emacs on MS-Windows
 
-Copyright (C) 1996-1997, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1996-1997, 2001-2019 Free Software Foundation, Inc.
 
 Author: Dale P. Smith <address@hidden>
 
@@ -220,7 +220,7 @@ set_clipboard_data (unsigned Format, void *Data, unsigned 
Size, int Raw)
   /* need to know final size after '\r' chars are inserted (the
      standard CF_OEMTEXT clipboard format uses CRLF line endings,
      while Emacs uses just LF internally).  */
-  truelen = Size + 1;          /* +1 for the terminating null */
+  truelen = Size + 1;          /* +1 for the terminating NUL */
 
   if (!Raw)
     {
@@ -243,7 +243,7 @@ set_clipboard_data (unsigned Format, void *Data, unsigned 
Size, int Raw)
     {
       dosmemput (Data, Size, xbuf_addr);
 
-      /* Terminate with a null, otherwise Windows does strange things
+      /* Terminate with a NUL, otherwise Windows does strange things
         when the text size is an integral multiple of 32 bytes. */
       _farpokeb (_dos_ds, xbuf_addr + Size, '\0');
     }
@@ -255,7 +255,7 @@ set_clipboard_data (unsigned Format, void *Data, unsigned 
Size, int Raw)
       while (Size--)
        {
          /* Don't allow them to put binary data into the clipboard, since
-            it will cause yanked data to be truncated at the first null.  */
+            it will cause yanked data to be truncated at the first NUL.  */
          if (*dp == '\0')
            return 2;
          if (*dp == '\n')
@@ -263,7 +263,7 @@ set_clipboard_data (unsigned Format, void *Data, unsigned 
Size, int Raw)
          _farnspokeb (buf_offset++, *dp++);
        }
 
-      /* Terminate with a null, otherwise Windows does strange things
+      /* Terminate with a NUL, otherwise Windows does strange things
         when the text size is an integral multiple of 32 bytes. */
       _farnspokeb (buf_offset, '\0');
     }
@@ -354,13 +354,13 @@ get_clipboard_data (unsigned Format, void *Data, unsigned 
Size, int Raw)
   __dpmi_int (0x2f, &regs);
   if (regs.x.ax != 0)
     {
-      unsigned char null_char = '\0';
+      unsigned char nul_char = '\0';
       unsigned long xbuf_beg = xbuf_addr;
 
       /* If last_clipboard_text is NULL, we don't want to slow down
         the next loop by an additional test.  */
       register unsigned char *lcdp =
-       last_clipboard_text == NULL ? &null_char : last_clipboard_text;
+       last_clipboard_text == NULL ? &nul_char : last_clipboard_text;
 
       /* Copy data from low memory, remove CR
         characters before LF if needed.  */
@@ -383,7 +383,7 @@ get_clipboard_data (unsigned Format, void *Data, unsigned 
Size, int Raw)
          /* Windows reportedly rounds up the size of clipboard data
             (passed in SIZE) to a multiple of 32, and removes trailing
             spaces from each line without updating SIZE.  We therefore
-            bail out when we see the first null character.  */
+            bail out when we see the first NUL character.  */
          else if (c == '\0')
            break;
        }
@@ -392,7 +392,7 @@ get_clipboard_data (unsigned Format, void *Data, unsigned 
Size, int Raw)
         last time set_clipboard_data was called, pretend there's no
         data in the clipboard.  This is so we don't pass our own text
         from the clipboard (which might be troublesome if the killed
-        text includes null characters).  */
+        text includes NUL characters).  */
       if (last_clipboard_text &&
          xbuf_addr - xbuf_beg == (long)(lcdp - last_clipboard_text))
        dp = (unsigned char *)Data + 1;
diff --git a/src/w32.c b/src/w32.c
index e643c42..082a66b 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1,6 +1,6 @@
 /* Utility and Unix shadow routines for GNU Emacs on the Microsoft Windows API.
 
-Copyright (C) 1994-1995, 2000-2018 Free Software Foundation, Inc.
+Copyright (C) 1994-1995, 2000-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -1771,7 +1771,40 @@ filename_from_ansi (const char *fn_in, char *fn_out)
 /* The directory where we started, in UTF-8. */
 static char startup_dir[MAX_UTF8_PATH];
 
-/* Get the current working directory.  */
+/* Get the current working directory.  The caller must arrange for CWD
+   to be allocated with enough space to hold a 260-char directory name
+   in UTF-8.  IOW, the space should be at least MAX_UTF8_PATH bytes.  */
+static void
+w32_get_current_directory (char *cwd)
+{
+  /* FIXME: Do we need to resolve possible symlinks in startup_dir?
+     Does it matter anywhere in Emacs?  */
+  if (w32_unicode_filenames)
+    {
+      wchar_t wstartup_dir[MAX_PATH];
+
+      if (!GetCurrentDirectoryW (MAX_PATH, wstartup_dir))
+       emacs_abort ();
+      filename_from_utf16 (wstartup_dir, cwd);
+    }
+  else
+    {
+      char astartup_dir[MAX_PATH];
+
+      if (!GetCurrentDirectoryA (MAX_PATH, astartup_dir))
+       emacs_abort ();
+      filename_from_ansi (astartup_dir, cwd);
+    }
+}
+
+/* For external callers.  Used by 'main' in emacs.c.  */
+void
+w32_init_current_directory (void)
+{
+  w32_get_current_directory (startup_dir);
+}
+
+/* Return the original directory where Emacs started.  */
 char *
 getcwd (char *dir, int dirsize)
 {
@@ -2043,7 +2076,9 @@ getpwuid (unsigned uid)
 struct group *
 getgrgid (gid_t gid)
 {
-  return &dflt_group;
+  if (gid == dflt_passwd.pw_gid)
+    return &dflt_group;
+  return NULL;
 }
 
 struct passwd *
@@ -2056,7 +2091,29 @@ getpwnam (char *name)
     return pw;
 
   if (xstrcasecmp (name, pw->pw_name))
-    return NULL;
+    {
+      /* Mimic what init_editfns does with these environment
+        variables, so that the likes of ~USER is recognized by
+        expand-file-name even if $LOGNAME gives a name different from
+        the real username produced by the process token.  */
+      char *logname = getenv ("LOGNAME");
+      char *username = getenv ("USERNAME");
+      if ((logname || username)
+         && xstrcasecmp (name, logname ? logname : username) == 0)
+       {
+         static struct passwd alias_user;
+         static char alias_name[PASSWD_FIELD_SIZE];
+
+         memcpy (&alias_user, &dflt_passwd, sizeof dflt_passwd);
+         alias_name[0] = '\0';
+         strncat (alias_name, logname ? logname : username,
+                  PASSWD_FIELD_SIZE - 1);
+         alias_user.pw_name = alias_name;
+         pw = &alias_user;
+       }
+      else
+       return NULL;
+    }
 
   return pw;
 }
@@ -2925,8 +2982,7 @@ init_environment (char ** argv)
                if (strcmp (env_vars[i].name, "HOME") == 0 && !appdata)
                  Vdelayed_warnings_list
                     = Fcons
-                    (listn (CONSTYPE_HEAP, 2,
-                            intern ("initialization"), build_string
+                   (list2 (intern ("initialization"), build_string
                             ("Use of `C:\\.emacs' without defining `HOME'\n"
                              "in the environment is deprecated, "
                              "see `Windows HOME' in the Emacs manual.")),
@@ -2995,24 +3051,7 @@ init_environment (char ** argv)
   }
 
   /* Remember the initial working directory for getcwd.  */
-  /* FIXME: Do we need to resolve possible symlinks in startup_dir?
-     Does it matter anywhere in Emacs?  */
-  if (w32_unicode_filenames)
-    {
-      wchar_t wstartup_dir[MAX_PATH];
-
-      if (!GetCurrentDirectoryW (MAX_PATH, wstartup_dir))
-       emacs_abort ();
-      filename_from_utf16 (wstartup_dir, startup_dir);
-    }
-  else
-    {
-      char astartup_dir[MAX_PATH];
-
-      if (!GetCurrentDirectoryA (MAX_PATH, astartup_dir))
-       emacs_abort ();
-      filename_from_ansi (astartup_dir, startup_dir);
-    }
+  w32_get_current_directory (startup_dir);
 
   {
     static char modname[MAX_PATH];
@@ -3196,22 +3235,7 @@ GetCachedVolumeInformation (char * root_dir)
   /* NULL for root_dir means use root from current directory.  */
   if (root_dir == NULL)
     {
-      if (w32_unicode_filenames)
-       {
-         wchar_t curdirw[MAX_PATH];
-
-         if (GetCurrentDirectoryW (MAX_PATH, curdirw) == 0)
-           return NULL;
-         filename_from_utf16 (curdirw, default_root);
-       }
-      else
-       {
-         char curdira[MAX_PATH];
-
-         if (GetCurrentDirectoryA (MAX_PATH, curdira) == 0)
-           return NULL;
-         filename_from_ansi (curdira, default_root);
-       }
+      w32_get_current_directory (default_root);
       parse_root (default_root, (const char **)&root_dir);
       *root_dir = 0;
       root_dir = default_root;
@@ -5917,7 +5941,7 @@ is_symlink (const char *filename)
 
 /* If NAME identifies a symbolic link, copy into BUF the file name of
    the symlink's target.  Copy at most BUF_SIZE bytes, and do NOT
-   null-terminate the target name, even if it fits.  Return the number
+   NUL-terminate the target name, even if it fits.  Return the number
    of bytes copied, or -1 if NAME is not a symlink or any error was
    encountered while resolving it.  The file name copied into BUF is
    encoded in the current ANSI codepage.  */
@@ -6021,10 +6045,10 @@ readlink (const char *name, char *buf, size_t buf_size)
          size_t size_to_copy = buf_size;
 
          /* According to MSDN, PrintNameLength does not include the
-            terminating null character.  */
+            terminating NUL character.  */
          lwname = alloca ((lwname_len + 1) * sizeof(WCHAR));
          memcpy (lwname, lwname_src, lwname_len);
-         lwname[lwname_len/sizeof(WCHAR)] = 0; /* null-terminate */
+         lwname[lwname_len/sizeof(WCHAR)] = 0; /* NUL-terminate */
          filename_from_utf16 (lwname, resolved);
          dostounix_filename (resolved);
          lname_size = strlen (resolved) + 1;
@@ -7223,6 +7247,7 @@ system_process_attributes (Lisp_Object pid)
                         code_convert_string_norecord (tem, 
Vlocale_coding_system, 0)),
                 attrs);
 
+  memstex.dwLength = sizeof (memstex);
   if (global_memory_status_ex (&memstex))
 #if __GNUC__ || (defined (_MSC_VER) && _MSC_VER >= 1300)
     totphys = memstex.ullTotalPhys / 1024.0;
@@ -9359,7 +9384,7 @@ w32_read_registry (HKEY rootkey, Lisp_Object lkey, 
Lisp_Object lname)
       /* Convert input strings to UTF-16.  */
       encoded_key = code_convert_string_norecord (lkey, Qutf_16le, 1);
       memcpy (key_w, SSDATA (encoded_key), SBYTES (encoded_key));
-      /* wchar_t strings need to be terminated by 2 null bytes.  */
+      /* wchar_t strings need to be terminated by 2 NUL bytes.  */
       key_w [SBYTES (encoded_key)/2] = L'\0';
       encoded_vname = code_convert_string_norecord (lname, Qutf_16le, 1);
       memcpy (value_w, SSDATA (encoded_vname), SBYTES (encoded_vname));
@@ -9451,7 +9476,7 @@ w32_read_registry (HKEY rootkey, Lisp_Object lkey, 
Lisp_Object lname)
       case REG_SZ:
        if (use_unicode)
          {
-           /* pvalue ends with 2 null bytes, but we need only one,
+           /* pvalue ends with 2 NUL bytes, but we need only one,
               and AUTO_STRING_WITH_LEN will add it.  */
            if (pvalue[vsize - 1] == '\0')
              vsize -= 2;
@@ -9460,7 +9485,7 @@ w32_read_registry (HKEY rootkey, Lisp_Object lkey, 
Lisp_Object lname)
          }
        else
          {
-           /* Don't waste a byte on the terminating null character,
+           /* Don't waste a byte on the terminating NUL character,
               since make_unibyte_string will add one anyway.  */
            if (pvalue[vsize - 1] == '\0')
              vsize--;
@@ -9922,6 +9947,40 @@ maybe_load_unicows_dll (void)
     }
 }
 
+/* Relocate a directory specified by epaths.h, using the location of
+   our binary as an anchor.  Note: this runs early during startup, so
+   we cannot rely on the usual file-related facilities, and in
+   particular the argument is assumed to be a unibyte string in system
+   codepage encoding.  */
+const char *
+w32_relocate (const char *epath_dir)
+{
+  if (strncmp (epath_dir, "%emacs_dir%/", 12) == 0)
+    {
+      static char relocated_dir[MAX_PATH];
+
+      /* Replace "%emacs_dir%" with the parent of the directory where
+        our binary lives.  Note that init_environment was not yet
+        called, so we cannot rely on emacs_dir being set in the
+        environment.  */
+      if (GetModuleFileNameA (NULL, relocated_dir, MAX_PATH))
+       {
+         char *p = _mbsrchr (relocated_dir, '\\');
+
+         if (p)
+           {
+             *p = '\0';
+             if ((p = _mbsrchr (relocated_dir, '\\')) != NULL)
+               {
+                 strcpy (p, epath_dir + 11);
+                 epath_dir = relocated_dir;
+               }
+           }
+       }
+    }
+  return epath_dir;
+}
+
 /*
        globals_of_w32 is used to initialize those global variables that
        must always be initialized on startup even when the global variable
diff --git a/src/w32.h b/src/w32.h
index 42b3d98..3790583 100644
--- a/src/w32.h
+++ b/src/w32.h
@@ -2,7 +2,7 @@
 #define EMACS_W32_H
 
 /* Support routines for the NT version of Emacs.
-   Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -185,6 +185,8 @@ extern MultiByteToWideChar_Proc pMultiByteToWideChar;
 extern WideCharToMultiByte_Proc pWideCharToMultiByte;
 extern DWORD multiByteToWideCharFlags;
 
+extern const char *w32_relocate (const char *);
+
 extern void init_environment (char **);
 extern void check_windows_init_file (void);
 extern void syms_of_ntproc (void);
@@ -201,6 +203,7 @@ extern int  codepage_for_filenames (CPINFO *);
 extern Lisp_Object ansi_encode_filename (Lisp_Object);
 extern int  w32_copy_file (const char *, const char *, int, int, int);
 extern int  w32_accessible_directory_p (const char *, ptrdiff_t);
+extern void w32_init_current_directory (void);
 
 extern BOOL init_winsock (int load_now);
 extern void srandom (int);
diff --git a/src/w32common.h b/src/w32common.h
index e860dbc..bca5244 100644
--- a/src/w32common.h
+++ b/src/w32common.h
@@ -1,5 +1,5 @@
 /* Common functions for Microsoft Windows builds of Emacs
-   Copyright (C) 2012-2018 Free Software Foundation, Inc.
+   Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32console.c b/src/w32console.c
index 9f9db68..df232ec 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -1,5 +1,5 @@
 /* Terminal hooks for GNU Emacs on the Microsoft Windows API.
-   Copyright (C) 1992, 1999, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1999, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32cygwinx.c b/src/w32cygwinx.c
index bc40123..3b994b1 100644
--- a/src/w32cygwinx.c
+++ b/src/w32cygwinx.c
@@ -1,6 +1,6 @@
 /* Common functions for the Microsoft Windows and Cygwin builds.
 
-Copyright (C) 2018 Free Software Foundation, Inc.
+Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -115,8 +115,7 @@ The following %-sequences are provided:
          remain = format_string ("%ld:%02ld", m / 60, m % 60);
        }
 
-      status = listn (CONSTYPE_HEAP, 8,
-                     Fcons (make_fixnum ('L'), line_status),
+      status =  list (Fcons (make_fixnum ('L'), line_status),
                      Fcons (make_fixnum ('B'), battery_status),
                      Fcons (make_fixnum ('b'), battery_status_symbol),
                      Fcons (make_fixnum ('p'), load_percentage),
diff --git a/src/w32fns.c b/src/w32fns.c
index 9a9789d..25900c5 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -1,6 +1,6 @@
 /* Graphical user interface functions for the Microsoft Windows API.
 
-Copyright (C) 1989, 1992-2018 Free Software Foundation, Inc.
+Copyright (C) 1989, 1992-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -48,6 +48,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 #ifdef WINDOWSNT
 #include <mbstring.h>
+#include <mbctype.h>   /* for _getmbcp */
 #endif /* WINDOWSNT */
 
 #if CYGWIN
@@ -56,6 +57,8 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "w32.h"
 #endif
 
+#include "pdumper.h"
+
 #include <basetyps.h>
 #include <unknwn.h>
 #include <commctrl.h>
@@ -1648,12 +1651,16 @@ x_clear_under_internal_border (struct frame *f)
   /* Clear border if it's larger than before.  */
   if (border != 0)
     {
-      HDC hdc = get_frame_dc (f);
       int width = FRAME_PIXEL_WIDTH (f);
       int height = FRAME_PIXEL_HEIGHT (f);
-      struct face *face = FACE_FROM_ID_OR_NULL (f, INTERNAL_BORDER_FACE_ID);
+      int face_id =
+       !NILP (Vface_remapping_alist)
+       ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID)
+       : INTERNAL_BORDER_FACE_ID;
+      struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
 
       block_input ();
+      HDC hdc = get_frame_dc (f);
       if (face)
        {
          /* Fill border with internal border face.  */
@@ -7958,7 +7965,7 @@ DEFUN ("system-move-file-to-trash", 
Fsystem_move_file_to_trash,
        {
          SHFILEOPSTRUCTW file_op_w;
          /* We need one more element beyond MAX_PATH because this is
-            a list of file names, with the last element double-null
+            a list of file names, with the last element double-NUL
             terminated. */
          wchar_t tmp_path_w[MAX_PATH + 1];
 
@@ -8219,7 +8226,7 @@ a ShowWindow flag:
      URL, for example.  So we make it absolute only if it is an
      existing file; if it is a file that does not exist, tough.  */
   absdoc = Fexpand_file_name (document, Qnil);
-  /* Don't call file handlers for file-exists-p, since they might
+  /* Don't call file name handlers for file-exists-p, since they might
      attempt to access the file, which could fail or produce undesired
      consequences, see bug#16558 for an example.  */
   handler = Ffind_file_name_handler (absdoc, Qfile_exists_p);
@@ -8785,8 +8792,7 @@ and width values are in pixels.
     /* A single line menu bar.  */
     menu_bar_height = single_menu_bar_height;
 
-  return listn (CONSTYPE_HEAP, 10,
-               Fcons (Qouter_position,
+  return  list (Fcons (Qouter_position,
                       Fcons (make_fixnum (left), make_fixnum (top))),
                Fcons (Qouter_size,
                       Fcons (make_fixnum (right - left),
@@ -9097,7 +9103,7 @@ DEFUN ("file-system-info", Ffile_system_info, 
Sfile_system_info, 1, 1, 0,
   encoded = ENCODE_FILE (filename);
 
   /* If the file name has special constructs in it,
-     call the corresponding file handler.  */
+     call the corresponding file name handler.  */
   Lisp_Object handler = Ffind_file_name_handler (encoded, Qfile_system_info);
   if (!NILP (handler))
     {
@@ -9718,7 +9724,7 @@ get_dll_version (const char *dll_name)
 /* Return the number of bytes in UTF-8 encoded string STR that
    corresponds to at most LIM characters.  If STR ends before LIM
    characters, return the number of bytes in STR including the
-   terminating null byte.  */
+   terminating NUL byte.  */
 static int
 utf8_mbslen_lim (const char *str, int lim)
 {
@@ -10209,6 +10215,7 @@ syms_of_w32fns (void)
   track_mouse_window = NULL;
 
   w32_visible_system_caret_hwnd = NULL;
+  PDUMPER_IGNORE (w32_visible_system_caret_hwnd);
 
   DEFSYM (Qundefined_color, "undefined-color");
   DEFSYM (Qcancel_timer, "cancel-timer");
@@ -10254,7 +10261,7 @@ syms_of_w32fns (void)
   DEFSYM (Qjson, "json");
 
   Fput (Qundefined_color, Qerror_conditions,
-       listn (CONSTYPE_PURE, 2, Qundefined_color, Qerror));
+       pure_list (Qundefined_color, Qerror));
   Fput (Qundefined_color, Qerror_message,
        build_pure_c_string ("Undefined color"));
 
@@ -10902,6 +10909,15 @@ globals_of_w32fns (void)
              doc: /* The ANSI code page used by the system.  */);
   w32_ansi_code_page = GetACP ();
 
+#ifndef CYGWIN
+  DEFVAR_INT ("w32-multibyte-code-page",
+             w32_multibyte_code_page,
+             doc: /* The current multibyte code page used by the system.
+A value of zero indicates that the single-byte code page is in use,
+see `w32-ansi-code-page'.  */);
+  w32_multibyte_code_page = _getmbcp ();
+#endif
+
   if (os_subtype == OS_NT)
     w32_unicode_gui = 1;
   else
diff --git a/src/w32font.c b/src/w32font.c
index 798869b..33c8982 100644
--- a/src/w32font.c
+++ b/src/w32font.c
@@ -1,5 +1,5 @@
 /* Font backend for the Microsoft Windows API.
-   Copyright (C) 2007-2018 Free Software Foundation, Inc.
+   Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -33,6 +33,8 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "w32.h"
 #endif
 
+#include "pdumper.h"
+
 /* Cleartype available on Windows XP, cleartype_natural from XP SP1.
    The latter does not try to fit cleartype smoothed fonts into the
    same bounding box as the non-antialiased version of the font.
@@ -2624,6 +2626,9 @@ struct font_driver w32font_driver =
 
 /* Initialize state that does not change between invocations. This is only
    called when Emacs is dumped.  */
+
+static void syms_of_w32font_for_pdumper (void);
+
 void
 syms_of_w32font (void)
 {
@@ -2803,6 +2808,12 @@ versions of Windows) characters.  */);
 
   defsubr (&Sx_select_font);
 
+  pdumper_do_now_and_after_load (syms_of_w32font_for_pdumper);
+}
+
+static void
+syms_of_w32font_for_pdumper (void)
+{
   register_font_driver (&w32font_driver, NULL);
 }
 
diff --git a/src/w32font.h b/src/w32font.h
index 5c216cb..65f42a3 100644
--- a/src/w32font.h
+++ b/src/w32font.h
@@ -1,5 +1,5 @@
 /* Shared GDI and Uniscribe Font backend declarations for the Windows API.
-   Copyright (C) 2007-2018 Free Software Foundation, Inc.
+   Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32gui.h b/src/w32gui.h
index ddef433..dbc6799 100644
--- a/src/w32gui.h
+++ b/src/w32gui.h
@@ -1,5 +1,5 @@
 /* Definitions and headers for communication on the Microsoft Windows API.
-   Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32heap.c b/src/w32heap.c
index 8c94682..9a59a1f 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -1,5 +1,5 @@
 /* Heap management routines for GNU Emacs on the Microsoft Windows API.
-   Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
    This file is part of GNU Emacs.
 
@@ -28,7 +28,7 @@
   Memory allocation scheme for w32/w64:
 
   - Buffers are mmap'ed using a very simple emulation of mmap/munmap
-  - During the temacs phase:
+  - During the temacs phase, if unexec is to be used:
     * we use a private heap declared to be stored into the `dumped_data'
     * unfortunately, this heap cannot be made growable, so the size of
       blocks it can allocate is limited to (0x80000 - pagesize)
@@ -37,7 +37,7 @@
       We use a very simple first-fit scheme to reuse those blocks.
     * we check that the private heap does not cross the area used
       by the bigger chunks.
-  - During the emacs phase:
+  - During the emacs phase, or always if pdumper is used:
     * we create a private heap for new memory blocks
     * we make sure that we never free a block that has been dumped.
       Freeing a dumped block could work in principle, but may prove
@@ -115,10 +115,16 @@ typedef struct _RTL_HEAP_PARAMETERS {
    than half of the size stated below.  It would be nice to find a way
    to build only the first bootstrap-emacs.exe with the large size,
    and reset that to a lower value afterwards.  */
-#if defined _WIN64 || defined WIDE_EMACS_INT
-# define DUMPED_HEAP_SIZE (23*1024*1024)
+#ifndef HAVE_UNEXEC
+/* We don't use dumped_data[], so define to a small size that won't
+   matter.  */
+# define DUMPED_HEAP_SIZE 10
 #else
-# define DUMPED_HEAP_SIZE (13*1024*1024)
+# if defined _WIN64 || defined WIDE_EMACS_INT
+#  define DUMPED_HEAP_SIZE (23*1024*1024)
+# else
+#  define DUMPED_HEAP_SIZE (13*1024*1024)
+# endif
 #endif
 
 static unsigned char dumped_data[DUMPED_HEAP_SIZE];
@@ -173,8 +179,8 @@ static DWORD          blocks_number = 0;
 static unsigned char *bc_limit;
 
 /* Handle for the private heap:
-    - inside the dumped_data[] array before dump,
-    - outside of it after dump.
+    - inside the dumped_data[] array before dump with unexec,
+    - outside of it after dump, or always if pdumper is used.
 */
 HANDLE heap = NULL;
 
@@ -188,8 +194,8 @@ free_fn the_free_fn;
      
http://stackoverflow.com/questions/307060/what-is-the-purpose-of-allocating-pages-in-the-pagefile-with-createfilemapping
  */
 
 /* This is the function to commit memory when the heap allocator
-   claims for new memory.  Before dumping, we allocate space
-   from the fixed size dumped_data[] array.
+   claims for new memory.  Before dumping with unexec, we allocate
+   space from the fixed size dumped_data[] array.
 */
 static NTSTATUS NTAPI
 dumped_data_commit (PVOID Base, PVOID *CommitAddress, PSIZE_T CommitSize)
@@ -224,14 +230,13 @@ typedef WINBASEAPI BOOL (WINAPI * 
HeapSetInformation_Proc)(HANDLE,HEAP_INFORMATI
 #endif
 
 void
-init_heap (void)
+init_heap (bool use_dynamic_heap)
 {
-  if (using_dynamic_heap)
+  /* FIXME: Remove the condition, the 'else' branch below, and all the
+     related definitions and code, including dumped_data[], when unexec
+     support is removed from Emacs.  */
+  if (use_dynamic_heap)
     {
-#ifndef MINGW_W64
-      unsigned long enable_lfh = 2;
-#endif
-
       /* After dumping, use a new private heap.  We explicitly enable
          the low fragmentation heap (LFH) here, for the sake of pre
          Vista versions.  Note: this will harmlessly fail on Vista and
@@ -248,6 +253,7 @@ init_heap (void)
       heap = HeapCreate (0, 0, 0);
 
 #ifndef MINGW_W64
+      unsigned long enable_lfh = 2;
       /* Set the low-fragmentation heap for OS before Vista.  */
       HMODULE hm_kernel32dll = LoadLibrary ("kernel32.dll");
       HeapSetInformation_Proc s_pfn_Heap_Set_Information =
@@ -276,7 +282,7 @@ init_heap (void)
           the_free_fn = free_after_dump;
         }
     }
-  else
+  else /* Before dumping with unexec: use static heap.  */
     {
       /* Find the RtlCreateHeap function.  Headers for this function
          are provided with the w32 DDK, but the function is available
@@ -355,6 +361,8 @@ malloc_after_dump (size_t size)
   return p;
 }
 
+/* FIXME: The *_before_dump functions should be removed when pdumper
+   becomes the only dumping method.  */
 void *
 malloc_before_dump (size_t size)
 {
@@ -589,7 +597,7 @@ free_after_dump_9x (void *ptr)
     }
 }
 
-#ifdef ENABLE_CHECKING
+#if defined HAVE_UNEXEC && defined ENABLE_CHECKING
 void
 report_temacs_memory_usage (void)
 {
diff --git a/src/w32heap.h b/src/w32heap.h
index fdf2e2c..13f7a63 100644
--- a/src/w32heap.h
+++ b/src/w32heap.h
@@ -1,5 +1,5 @@
 /* Heap management routines (including unexec) for GNU Emacs on Windows NT.
-   Copyright (C) 1994, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1994, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -31,7 +31,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.
 extern unsigned char *get_data_start (void);
 extern unsigned char *get_data_end (void);
 extern size_t         reserved_heap_size;
-extern BOOL           using_dynamic_heap;
 
 extern void *mmap_realloc (void **, size_t);
 extern void  mmap_free (void **);
@@ -43,7 +42,7 @@ extern void report_temacs_memory_usage (void);
 extern void *sbrk (ptrdiff_t size);
 
 /* Initialize heap structures for sbrk on startup.  */
-extern void init_heap (void);
+extern void init_heap (bool);
 
 /* ----------------------------------------------------------------- */
 /* Useful routines for manipulating memory-mapped files.  */
diff --git a/src/w32inevt.c b/src/w32inevt.c
index f5558bb..ab71c56 100644
--- a/src/w32inevt.c
+++ b/src/w32inevt.c
@@ -1,5 +1,5 @@
 /* Input event support for Emacs on the Microsoft Windows API.
-   Copyright (C) 1992-1993, 1995, 2001-2018 Free Software Foundation,
+   Copyright (C) 1992-1993, 1995, 2001-2019 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/w32inevt.h b/src/w32inevt.h
index 0628b20..5832c3f 100644
--- a/src/w32inevt.h
+++ b/src/w32inevt.h
@@ -1,5 +1,5 @@
 /* Input routines for GNU Emacs on the Microsoft Windows API.
-   Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32menu.c b/src/w32menu.c
index a2d39c5..38e1b50 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -1,5 +1,5 @@
 /* Menu support for GNU Emacs on the Microsoft Windows API.
-   Copyright (C) 1986, 1988, 1993-1994, 1996, 1998-1999, 2001-2018 Free
+   Copyright (C) 1986, 1988, 1993-1994, 1996, 1998-1999, 2001-2019 Free
    Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -30,6 +30,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "buffer.h"
 #include "coding.h"    /* for ENCODE_SYSTEM */
 #include "menu.h"
+#include "pdumper.h"
 
 /* This may include sys/types.h, and that somehow loses
    if this is not done before the other system files.  */
@@ -1586,6 +1587,7 @@ syms_of_w32menu (void)
   globals_of_w32menu ();
 
   current_popup_menu = NULL;
+  PDUMPER_IGNORE (current_popup_menu);
 
   DEFSYM (Qdebug_on_next_call, "debug-on-next-call");
   DEFSYM (Qunsupported__w32_dialog, "unsupported--w32-dialog");
diff --git a/src/w32notify.c b/src/w32notify.c
index 67385b8..53787fd 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -1,6 +1,6 @@
 /* Filesystem notifications support for GNU Emacs on the Microsoft Windows API.
 
-Copyright (C) 2012-2018 Free Software Foundation, Inc.
+Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 Author: Eli Zaretskii <address@hidden>
 
diff --git a/src/w32proc.c b/src/w32proc.c
index cb02ba6..75e345a 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -1,6 +1,6 @@
 /* Process support for GNU Emacs on the Microsoft Windows API.
 
-Copyright (C) 1992, 1995, 1999-2018 Free Software Foundation, Inc.
+Copyright (C) 1992, 1995, 1999-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -81,6 +81,82 @@ static sigset_t sig_mask;
 
 static CRITICAL_SECTION crit_sig;
 
+/* Catch memory allocation before the heap allocation scheme is set
+   up.  These functions should never be called, unless code is added
+   early on in 'main' that runs before init_heap is called.  */
+_Noreturn void * malloc_before_init (size_t);
+_Noreturn void * realloc_before_init (void *, size_t);
+_Noreturn void   free_before_init (void *);
+
+_Noreturn void *
+malloc_before_init (size_t size)
+{
+  fprintf (stderr,
+          "error: 'malloc' called before setting up heap allocation; 
exiting.\n");
+  exit (-1);
+}
+
+_Noreturn void *
+realloc_before_init (void *ptr, size_t size)
+{
+  fprintf (stderr,
+          "error: 'realloc' called before setting up heap allocation; 
exiting.\n");
+  exit (-1);
+}
+
+_Noreturn void
+free_before_init (void *ptr)
+{
+  fprintf (stderr,
+          "error: 'free' called before setting up heap allocation; 
exiting.\n");
+  exit (-1);
+}
+
+extern BOOL ctrl_c_handler (unsigned long type);
+
+/* MinGW64 doesn't add a leading underscore to external symbols,
+   whereas configure.ac sets up LD_SWITCH_SYSTEM_TEMACS to force the
+   entry point at __start, with two underscores.  */
+#ifdef __MINGW64__
+#define _start __start
+#endif
+
+extern void mainCRTStartup (void);
+
+/* Startup code for running on NT.  When we are running as the dumped
+   version, we need to bootstrap our heap and .bss section into our
+   address space before we can actually hand off control to the startup
+   code supplied by NT (primarily because that code relies upon malloc ()).  */
+void _start (void);
+
+void
+_start (void)
+{
+
+#if 1
+  /* Give us a way to debug problems with crashes on startup when
+     running under the MSVC profiler. */
+  if (GetEnvironmentVariable ("EMACS_DEBUG", NULL, 0) > 0)
+    DebugBreak ();
+#endif
+
+  the_malloc_fn = malloc_before_init;
+  the_realloc_fn = realloc_before_init;
+  the_free_fn = free_before_init;
+
+  /* Cache system info, e.g., the NT page size.  */
+  cache_system_info ();
+
+  /* This prevents ctrl-c's in shells running while we're suspended from
+     having us exit.  */
+  SetConsoleCtrlHandler ((PHANDLER_ROUTINE) ctrl_c_handler, TRUE);
+
+  /* Prevent Emacs from being locked up (eg. in batch mode) when
+     accessing devices that aren't mounted (eg. removable media drives).  */
+  SetErrorMode (SEM_FAILCRITICALERRORS);
+  mainCRTStartup ();
+}
+
 /* Improve on the CRT 'signal' implementation so that we could record
    the SIGCHLD handler and fake interval timers.  */
 signal_handler
@@ -1528,6 +1604,78 @@ waitpid (pid_t pid, int *status, int options)
   return pid;
 }
 
+int
+open_input_file (file_data *p_file, char *filename)
+{
+  HANDLE file;
+  HANDLE file_mapping;
+  void  *file_base;
+  unsigned long size, upper_size;
+
+  file = CreateFileA (filename, GENERIC_READ, FILE_SHARE_READ, NULL,
+                     OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+  if (file == INVALID_HANDLE_VALUE)
+    return FALSE;
+
+  size = GetFileSize (file, &upper_size);
+  file_mapping = CreateFileMapping (file, NULL, PAGE_READONLY,
+                                   0, size, NULL);
+  if (!file_mapping)
+    return FALSE;
+
+  file_base = MapViewOfFile (file_mapping, FILE_MAP_READ, 0, 0, size);
+  if (file_base == 0)
+    return FALSE;
+
+  p_file->name = filename;
+  p_file->size = size;
+  p_file->file = file;
+  p_file->file_mapping = file_mapping;
+  p_file->file_base = file_base;
+
+  return TRUE;
+}
+
+/* Return pointer to section header for section containing the given
+   relative virtual address. */
+IMAGE_SECTION_HEADER *
+rva_to_section (DWORD_PTR rva, IMAGE_NT_HEADERS * nt_header)
+{
+  PIMAGE_SECTION_HEADER section;
+  int i;
+
+  section = IMAGE_FIRST_SECTION (nt_header);
+
+  for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++)
+    {
+      /* Some linkers (eg. the NT SDK linker I believe) swapped the
+        meaning of these two values - or rather, they ignored
+        VirtualSize entirely and always set it to zero.  This affects
+        some very old exes (eg. gzip dated Dec 1993).  Since
+        w32_executable_type relies on this function to work reliably,
+        we need to cope with this.  */
+      DWORD_PTR real_size = max (section->SizeOfRawData,
+                            section->Misc.VirtualSize);
+      if (rva >= section->VirtualAddress
+         && rva < section->VirtualAddress + real_size)
+       return section;
+      section++;
+    }
+  return NULL;
+}
+
+/* Close the system structures associated with the given file.  */
+void
+close_file_data (file_data *p_file)
+{
+  UnmapViewOfFile (p_file->file_base);
+  CloseHandle (p_file->file_mapping);
+  /* For the case of output files, set final size.  */
+  SetFilePointer (p_file->file, p_file->size, NULL, FILE_BEGIN);
+  SetEndOfFile (p_file->file);
+  CloseHandle (p_file->file);
+}
+
 /* Old versions of w32api headers don't have separate 32-bit and
    64-bit defines, but the one they have matches the 32-bit variety.  */
 #ifndef IMAGE_NT_OPTIONAL_HDR32_MAGIC
@@ -1628,22 +1776,27 @@ w32_executable_type (char * filename,
           if (data_dir)
             {
               /* Look for Cygwin DLL in the DLL import list. */
-              IMAGE_DATA_DIRECTORY import_dir =
-                data_dir[IMAGE_DIRECTORY_ENTRY_IMPORT];
+              IMAGE_DATA_DIRECTORY import_dir
+                = data_dir[IMAGE_DIRECTORY_ENTRY_IMPORT];
 
              /* Import directory can be missing in .NET DLLs.  */
              if (import_dir.VirtualAddress != 0)
                {
+                 IMAGE_SECTION_HEADER *section
+                   = rva_to_section (import_dir.VirtualAddress, nt_header);
+                 if (!section)
+                   emacs_abort ();
+
                  IMAGE_IMPORT_DESCRIPTOR * imports =
-                   RVA_TO_PTR (import_dir.VirtualAddress,
-                               rva_to_section (import_dir.VirtualAddress,
-                                               nt_header),
+                   RVA_TO_PTR (import_dir.VirtualAddress, section,
                                executable);
 
                  for ( ; imports->Name; imports++)
                    {
-                     IMAGE_SECTION_HEADER * section =
-                       rva_to_section (imports->Name, nt_header);
+                     section = rva_to_section (imports->Name, nt_header);
+                     if (!section)
+                       emacs_abort ();
+
                      char * dllname = RVA_TO_PTR (imports->Name, section,
                                                   executable);
 
@@ -1854,9 +2007,9 @@ sys_spawnve (int mode, char *cmdname, char **argv, char 
**envp)
     }
 
   /* we have to do some conjuring here to put argv and envp into the
-     form CreateProcess wants...  argv needs to be a space separated/null
-     terminated list of parameters, and envp is a null
-     separated/double-null terminated list of parameters.
+     form CreateProcess wants...  argv needs to be a space separated/NUL
+     terminated list of parameters, and envp is a NUL
+     separated/double-NUL terminated list of parameters.
 
      Additionally, zero-length args and args containing whitespace or
      quote chars need to be wrapped in double quotes - for this to work,
@@ -3100,6 +3253,12 @@ such programs cannot be invoked by Emacs anyway.  */)
 }
 
 #ifdef HAVE_LANGINFO_CODESET
+
+/* If we are compiling for compatibility with older 32-bit Windows
+   versions, this might not be defined by the Windows headers.  */
+#ifndef LOCALE_IPAPERSIZE
+# define LOCALE_IPAPERSIZE 0x100A
+#endif
 /* Emulation of nl_langinfo.  Used in fns.c:Flocale_info.  */
 char *
 nl_langinfo (nl_item item)
@@ -3112,7 +3271,8 @@ nl_langinfo (nl_item item)
     LOCALE_SMONTHNAME1, LOCALE_SMONTHNAME2, LOCALE_SMONTHNAME3,
     LOCALE_SMONTHNAME4, LOCALE_SMONTHNAME5, LOCALE_SMONTHNAME6,
     LOCALE_SMONTHNAME7, LOCALE_SMONTHNAME8, LOCALE_SMONTHNAME9,
-    LOCALE_SMONTHNAME10, LOCALE_SMONTHNAME11, LOCALE_SMONTHNAME12
+    LOCALE_SMONTHNAME10, LOCALE_SMONTHNAME11, LOCALE_SMONTHNAME12,
+    LOCALE_IPAPERSIZE, LOCALE_IPAPERSIZE
   };
 
   static char *nl_langinfo_buf = NULL;
@@ -3121,6 +3281,8 @@ nl_langinfo (nl_item item)
   if (nl_langinfo_len <= 0)
     nl_langinfo_buf = xmalloc (nl_langinfo_len = 1);
 
+  char *retval = nl_langinfo_buf;
+
   if (item < 0 || item >= _NL_NUM)
     nl_langinfo_buf[0] = 0;
   else
@@ -3142,6 +3304,8 @@ nl_langinfo (nl_item item)
          if (nl_langinfo_len <= need_len)
            nl_langinfo_buf = xrealloc (nl_langinfo_buf,
                                        nl_langinfo_len = need_len);
+         retval = nl_langinfo_buf;
+
          if (!GetLocaleInfo (cloc, w32item[item] | LOCALE_USE_CP_ACP,
                              nl_langinfo_buf, nl_langinfo_len))
            nl_langinfo_buf[0] = 0;
@@ -3158,9 +3322,32 @@ nl_langinfo (nl_item item)
                  nl_langinfo_buf[1] = 'p';
                }
            }
+         else if (item == _NL_PAPER_WIDTH || item == _NL_PAPER_HEIGHT)
+           {
+             static const int paper_size[][2] =
+               {
+                { -1, -1 },
+                { 216, 279 },
+                { -1, -1 },
+                { -1, -1 },
+                { -1, -1 },
+                { 216, 356 },
+                { -1, -1 },
+                { -1, -1 },
+                { 297, 420 },
+                { 210, 297 }
+               };
+             int idx = atoi (nl_langinfo_buf);
+             if (0 <= idx && idx < ARRAYELTS (paper_size))
+               retval = (char *)(intptr_t) (item == _NL_PAPER_WIDTH
+                                            ? paper_size[idx][0]
+                                            : paper_size[idx][1]);
+             else
+               retval = (char *)(intptr_t) -1;
+           }
        }
     }
-  return nl_langinfo_buf;
+  return retval;
 }
 #endif /* HAVE_LANGINFO_CODESET */
 
@@ -3211,10 +3398,10 @@ If LCID (a 16-bit number) is not a valid locale, the 
result is nil.  */)
       got_full = GetLocaleInfo (XFIXNUM (lcid),
                                XFIXNUM (longform),
                                full_name, sizeof (full_name));
-      /* GetLocaleInfo's return value includes the terminating null
+      /* GetLocaleInfo's return value includes the terminating NUL
         character, when the returned information is a string, whereas
         make_unibyte_string needs the string length without the
-        terminating null.  */
+        terminating NUL.  */
       if (got_full)
        return make_unibyte_string (full_name, got_full - 1);
     }
@@ -3476,8 +3663,8 @@ If successful, the new layout id is returned, otherwise 
nil.  */)
   HKL kl;
 
   CHECK_CONS (layout);
-  CHECK_FIXNUM_CAR (layout);
-  CHECK_FIXNUM_CDR (layout);
+  CHECK_FIXNUM (XCAR (layout));
+  CHECK_FIXNUM (XCDR (layout));
 
   kl = (HKL) (UINT_PTR) ((XFIXNUM (XCAR (layout)) & 0xffff)
                         | (XFIXNUM (XCDR (layout)) << 16));
diff --git a/src/w32reg.c b/src/w32reg.c
index 4ddbaa3..aff131d 100644
--- a/src/w32reg.c
+++ b/src/w32reg.c
@@ -1,6 +1,6 @@
 /* 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-2019 Free Software Foundation, Inc.
 
 Author: Kevin Gallo
 
diff --git a/src/w32select.c b/src/w32select.c
index dc568d4..af4f049 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -1,6 +1,6 @@
 /* Selection processing for Emacs on the Microsoft Windows API.
 
-Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 Author: Kevin Gallo
        Benjamin Riefenstahl
@@ -803,7 +803,7 @@ DEFUN ("w32-get-clipboard-data", Fw32_get_clipboard_data,
   (void) ignored;
 
   /* Don't pass our own text from the clipboard (which might be
-     troublesome if the killed text includes null characters).  */
+     troublesome if the killed text includes NUL characters).  */
   if (!NILP (current_text))
     return ret;
 
diff --git a/src/w32select.h b/src/w32select.h
index 3b8a9ac..3f8f469 100644
--- a/src/w32select.h
+++ b/src/w32select.h
@@ -1,6 +1,6 @@
 /* Selection processing for Emacs on the Microsoft W32 API.
 
-Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
+Copyright (C) 1993-1994, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32term.c b/src/w32term.c
index 8d189ae..4d5f2e7 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -1,6 +1,6 @@
 /* Implementation of GUI terminal on the Microsoft Windows API.
 
-Copyright (C) 1989, 1993-2018 Free Software Foundation, Inc.
+Copyright (C) 1989, 1993-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -800,29 +800,32 @@ x_after_update_window_line (struct window *w, struct 
glyph_row *desired_row)
          height > 0))
     {
       int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
+      int face_id =
+       !NILP (Vface_remapping_alist)
+       ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID)
+       : INTERNAL_BORDER_FACE_ID;
+      struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
 
       block_input ();
-      {
-       HDC hdc = get_frame_dc (f);
-       struct face *face = FACE_FROM_ID_OR_NULL (f, INTERNAL_BORDER_FACE_ID);
 
-       if (face)
-         {
-           /* Fill border with internal border face.  */
-           unsigned long color = face->background;
+      HDC hdc = get_frame_dc (f);
+      if (face)
+       {
+         /* Fill border with internal border face.  */
+         unsigned long color = face->background;
+
+         w32_fill_area (f, hdc, color, 0, y, width, height);
+         w32_fill_area (f, hdc, color, FRAME_PIXEL_WIDTH (f) - width,
+                        y, width, height);
+       }
+      else
+       {
+         w32_clear_area (f, hdc, 0, y, width, height);
+         w32_clear_area (f, hdc, FRAME_PIXEL_WIDTH (f) - width,
+                         y, width, height);
+       }
+      release_frame_dc (f, hdc);
 
-           w32_fill_area (f, hdc, color, 0, y, width, height);
-           w32_fill_area (f, hdc, color, FRAME_PIXEL_WIDTH (f) - width,
-                          y, width, height);
-         }
-       else
-         {
-           w32_clear_area (f, hdc, 0, y, width, height);
-           w32_clear_area (f, hdc, FRAME_PIXEL_WIDTH (f) - width,
-                           y, width, height);
-         }
-       release_frame_dc (f, hdc);
-      }
       unblock_input ();
     }
 }
@@ -1874,9 +1877,42 @@ x_draw_image_foreground (struct glyph_string *s)
       HBRUSH fg_brush = CreateSolidBrush (s->gc->foreground);
       HBRUSH orig_brush = SelectObject (s->hdc, fg_brush);
       HGDIOBJ orig_obj = SelectObject (compat_hdc, s->img->pixmap);
+      LONG orig_width, orig_height;
+      DIBSECTION dib;
       SetBkColor (compat_hdc, RGB (255, 255, 255));
       SetTextColor (s->hdc, RGB (0, 0, 0));
       x_set_glyph_string_clipping (s);
+      /* Extract the original dimensions of the bitmap.  */
+      if (GetObject (s->img->pixmap, sizeof (dib), &dib) > 0)
+       {
+         BITMAP bmp = dib.dsBm;
+         orig_width = bmp.bmWidth;
+         orig_height = bmp.bmHeight;
+       }
+      else
+       {
+         DebPrint (("x_draw_image_foreground: GetObject failed!\n"));
+         orig_width = s->slice.width;
+         orig_height = s->slice.height;
+       }
+
+      double w_factor = 1.0, h_factor = 1.0;
+      bool scaled = false;
+      int orig_slice_width  = s->slice.width,
+         orig_slice_height = s->slice.height;
+      int orig_slice_x = s->slice.x, orig_slice_y = s->slice.y;
+      /* For scaled images we need to restore the original slice's
+        dimensions and origin coordinates, from before the scaling.  */
+      if (s->img->width != orig_width || s->img->height != orig_height)
+       {
+         scaled = true;
+         w_factor = (double) orig_width  / (double) s->img->width;
+         h_factor = (double) orig_height / (double) s->img->height;
+         orig_slice_width = s->slice.width * w_factor + 0.5;
+         orig_slice_height = s->slice.height * h_factor + 0.5;
+         orig_slice_x = s->slice.x * w_factor + 0.5;
+         orig_slice_y = s->slice.y * h_factor + 0.5;
+       }
 
       if (s->img->mask)
        {
@@ -1885,14 +1921,36 @@ x_draw_image_foreground (struct glyph_string *s)
 
          SetTextColor (s->hdc, RGB (255, 255, 255));
          SetBkColor (s->hdc, RGB (0, 0, 0));
-
-         BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
-                 compat_hdc, s->slice.x, s->slice.y, SRCINVERT);
-         BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
-                 mask_dc, s->slice.x, s->slice.y, SRCAND);
-         BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
-                 compat_hdc, s->slice.x, s->slice.y, SRCINVERT);
-
+         if (!scaled)
+           {
+             BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
+                     compat_hdc, s->slice.x, s->slice.y, SRCINVERT);
+             BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
+                     mask_dc, s->slice.x, s->slice.y, SRCAND);
+             BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
+                     compat_hdc, s->slice.x, s->slice.y, SRCINVERT);
+           }
+         else
+           {
+             int pmode = 0;
+             /* HALFTONE produces better results, especially when
+                scaling to a larger size, but Windows 9X doesn't
+                support HALFTONE.  */
+             if (os_subtype == OS_NT
+                 && (pmode = SetStretchBltMode (s->hdc, HALFTONE)) != 0)
+               SetBrushOrgEx (s->hdc, 0, 0, NULL);
+             StretchBlt (s->hdc, x, y, s->slice.width, s->slice.height,
+                         compat_hdc, orig_slice_x, orig_slice_y,
+                         orig_slice_width, orig_slice_height, SRCINVERT);
+             StretchBlt (s->hdc, x, y, s->slice.width, s->slice.height,
+                         mask_dc, orig_slice_x, orig_slice_y,
+                         orig_slice_width, orig_slice_height, SRCAND);
+             StretchBlt (s->hdc, x, y, s->slice.width, s->slice.height,
+                         compat_hdc, orig_slice_x, orig_slice_y,
+                         orig_slice_width, orig_slice_height, SRCINVERT);
+             if (pmode)
+               SetStretchBltMode (s->hdc, pmode);
+           }
          SelectObject (mask_dc, mask_orig_obj);
          DeleteDC (mask_dc);
        }
@@ -1900,9 +1958,22 @@ x_draw_image_foreground (struct glyph_string *s)
        {
          SetTextColor (s->hdc, s->gc->foreground);
          SetBkColor (s->hdc, s->gc->background);
-
-          BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
-                  compat_hdc, s->slice.x, s->slice.y, SRCCOPY);
+         if (!scaled)
+           BitBlt (s->hdc, x, y, s->slice.width, s->slice.height,
+                   compat_hdc, s->slice.x, s->slice.y, SRCCOPY);
+         else
+           {
+             int pmode = 0;
+             /* Windows 9X doesn't support HALFTONE.  */
+             if (os_subtype == OS_NT
+                 && (pmode = SetStretchBltMode (s->hdc, HALFTONE)) != 0)
+               SetBrushOrgEx (s->hdc, 0, 0, NULL);
+             StretchBlt (s->hdc, x, y, s->slice.width, s->slice.height,
+                         compat_hdc, orig_slice_x, orig_slice_y,
+                         orig_slice_width, orig_slice_height, SRCCOPY);
+             if (pmode)
+               SetStretchBltMode (s->hdc, pmode);
+           }
 
          /* When the image has a mask, we can expect that at
             least part of a mouse highlight or a block cursor will
@@ -2031,6 +2102,10 @@ w32_draw_image_foreground_1 (struct glyph_string *s, 
HBITMAP pixmap)
   if (s->slice.y == 0)
     y += s->img->vmargin;
 
+  /* FIXME (maybe): The below doesn't support image scaling.  But it
+     seems to never be called, because the conditions for its call in
+     x_draw_image_glyph_string are never fulfilled (they will be if
+     the #ifdef'ed away part of that function is ever activated).  */
   if (s->img->pixmap)
     {
       HDC compat_hdc = CreateCompatibleDC (hdc);
@@ -6679,7 +6754,10 @@ x_make_frame_visible (struct frame *f)
     }
 
   if (!FLOATP (Vx_wait_for_event_timeout))
+    {
+      unblock_input ();
       return;
+    }
 
   /* Synchronize to ensure Emacs knows the frame is visible
      before we do anything else.  We do this loop with input not blocked
diff --git a/src/w32term.h b/src/w32term.h
index ebdab04..4c496e9 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -1,5 +1,5 @@
 /* Definitions and headers for communication on the Microsoft Windows API.
-   Copyright (C) 1995, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1995, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c
index 29c9c7a..72b524f 100644
--- a/src/w32uniscribe.c
+++ b/src/w32uniscribe.c
@@ -1,5 +1,5 @@
 /* Font backend for the Microsoft W32 Uniscribe API.
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -36,6 +36,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "composite.h"
 #include "font.h"
 #include "w32font.h"
+#include "pdumper.h"
 #include "w32common.h"
 
 struct uniscribe_font_info
@@ -177,6 +178,11 @@ uniscribe_otf_capability (struct font *font)
   Lisp_Object features;
 
   f = XFRAME (selected_frame);
+  /* Prevent quitting while we cons the lists in otf_features.
+     That's because get_frame_dc acquires the critical section, so we
+     cannot quit before we release it in release_frame_dc.  */
+  Lisp_Object prev_quit = Vinhibit_quit;
+  Vinhibit_quit = Qt;
   context = get_frame_dc (f);
   old_font = SelectObject (context, FONT_HANDLE (font));
 
@@ -187,6 +193,7 @@ uniscribe_otf_capability (struct font *font)
 
   SelectObject (context, old_font);
   release_frame_dc (f, context);
+  Vinhibit_quit = prev_quit;
 
   return capability;
 }
@@ -1176,9 +1183,17 @@ struct font_driver uniscribe_font_driver =
    as it needs to test for the existence of the Uniscribe library.  */
 void syms_of_w32uniscribe (void);
 
+static void syms_of_w32uniscribe_for_pdumper (void);
+
 void
 syms_of_w32uniscribe (void)
 {
+  pdumper_do_now_and_after_load (syms_of_w32uniscribe_for_pdumper);
+}
+
+static void
+syms_of_w32uniscribe_for_pdumper (void)
+{
   HMODULE uniscribe;
 
   /* Don't init uniscribe when dumping */
diff --git a/src/w32xfns.c b/src/w32xfns.c
index e9261b0..a5966b2 100644
--- a/src/w32xfns.c
+++ b/src/w32xfns.c
@@ -1,5 +1,5 @@
 /* Functions taken directly from X sources for use with the Microsoft Windows 
API.
-   Copyright (C) 1989, 1992-1995, 1999, 2001-2018 Free Software
+   Copyright (C) 1989, 1992-1995, 1999, 2001-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/widget.c b/src/widget.c
index 2e9295f..c695bd5 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -1,5 +1,5 @@
 /* The emacs frame widget.
-   Copyright (C) 1992-1993, 2000-2018 Free Software Foundation, Inc.
+   Copyright (C) 1992-1993, 2000-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -282,7 +282,7 @@ set_frame_size (EmacsFrame ew)
 
   frame_size_history_add
     (f, Qset_frame_size, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f),
-     list2 (make_fixnum (ew->core.width), make_fixnum (ew->core.height)));
+     list2i (ew->core.width, ew->core.height));
 }
 
 static void
diff --git a/src/widget.h b/src/widget.h
index 68e4ef1..00b538f 100644
--- a/src/widget.h
+++ b/src/widget.h
@@ -1,5 +1,5 @@
 /* The emacs frame widget public header file.
-   Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/widgetprv.h b/src/widgetprv.h
index fc9b446..075fd60 100644
--- a/src/widgetprv.h
+++ b/src/widgetprv.h
@@ -1,5 +1,5 @@
 /* The emacs frame widget private header file.
-   Copyright (C) 1993, 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993, 2001-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/window.c b/src/window.c
index 20084a1..be338c2 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1,6 +1,6 @@
 /* Window creation, deletion and examination for GNU Emacs.
    Does not include redisplay.
-   Copyright (C) 1985-1987, 1993-1998, 2000-2018 Free Software
+   Copyright (C) 1985-1987, 1993-1998, 2000-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -42,6 +42,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #ifdef MSDOS
 #include "msdos.h"
 #endif
+#include "pdumper.h"
 
 static ptrdiff_t count_windows (struct window *);
 static ptrdiff_t get_leaf_windows (struct window *, struct window **,
@@ -77,11 +78,19 @@ static void apply_window_adjustment (struct window *);
    FRAME_SELECTED_WINDOW (selected_frame).  */
 Lisp_Object selected_window;
 
+/* The value of selected_window at the last time window change
+   functions were run.  This is always the same as
+   FRAME_OLD_SELECTED_WINDOW (old_selected_frame).  */
+static Lisp_Object old_selected_window;
+
 /* A list of all windows for use by next_window and Fwindow_list.
    Functions creating or deleting windows should invalidate this cache
    by setting it to nil.  */
 Lisp_Object Vwindow_list;
 
+/* True mean window_change_record has to record all live frames.  */
+static bool window_change_record_frames;
+
 /* The mini-buffer window of the selected frame.
    Note that you cannot test for mini-bufferness of an arbitrary window
    by comparing against this; but you can test for mini-bufferness of
@@ -304,6 +313,12 @@ wset_buffer (struct window *w, Lisp_Object val)
   adjust_window_count (w, 1);
 }
 
+static void
+wset_old_buffer (struct window *w, Lisp_Object val)
+{
+  w->old_buffer = val;
+}
+
 DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
        doc: /* Return t if OBJECT is a window and nil otherwise.  */)
   (Lisp_Object object)
@@ -428,6 +443,22 @@ return the selected window of that frame.  */)
   return window;
 }
 
+DEFUN ("frame-old-selected-window", Fframe_old_selected_window,
+       Sframe_old_selected_window, 0, 1, 0,
+       doc: /* Return old selected window of FRAME.
+FRAME must be a live frame and defaults to the selected one.
+
+The return value is the window selected on FRAME the last time window
+change functions were run for FRAME.  */)
+  (Lisp_Object frame)
+{
+  if (NILP (frame))
+    frame = selected_frame;
+  CHECK_LIVE_FRAME (frame);
+
+  return XFRAME (frame)->old_selected_window;
+}
+
 DEFUN ("set-frame-selected-window", Fset_frame_selected_window,
        Sset_frame_selected_window, 2, 3, 0,
        doc: /* Set selected window of FRAME to WINDOW.
@@ -465,6 +496,16 @@ selected windows appears and to which many commands apply. 
 */)
   return selected_window;
 }
 
+DEFUN ("old-selected-window", Fold_selected_window,
+       Sold_selected_window, 0, 0, 0,
+       doc: /* Return the old selected window.
+The return value is the window selected the last time window change
+functions were run.  */)
+  (void)
+{
+  return old_selected_window;
+}
+
 EMACS_INT window_select_count;
 
 /* If select_window is called with inhibit_point_swap true it will
@@ -597,9 +638,33 @@ Return nil for an internal window or a deleted window.  */)
   (Lisp_Object window)
 {
   struct window *w = decode_any_window (window);
+
   return WINDOW_LEAF_P (w) ? w->contents : Qnil;
 }
 
+DEFUN ("window-old-buffer", Fwindow_old_buffer, Swindow_old_buffer, 0, 1, 0,
+       doc: /* Return the old buffer displayed by WINDOW.
+WINDOW must be a live window and defaults to the selected one.
+
+The return value is the buffer shown in WINDOW at the last time window
+change functions were run.  It is nil if WINDOW was created after
+that.  It is t if WINDOW has been restored from a window configuration
+after that.  */)
+  (Lisp_Object window)
+{
+  struct window *w = decode_live_window (window);
+
+  return (NILP (w->old_buffer)
+         /* A new window.  */
+         ? Qnil
+         : (w->change_stamp != WINDOW_XFRAME (w)->change_stamp)
+         /* A window restored from a configuration.  */
+         ? Qt
+         /* A window that was live the last time seen by window
+            change functions.  */
+         : w->old_buffer);
+}
+
 DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0,
        doc: /* Return the parent window of window WINDOW.
 WINDOW must be a valid window and defaults to the selected one.
@@ -723,34 +788,32 @@ the height of the screen areas spanned by its children.  
*/)
   return make_fixnum (decode_valid_window (window)->pixel_height);
 }
 
-DEFUN ("window-pixel-width-before-size-change",
-       Fwindow_pixel_width_before_size_change,
-       Swindow_pixel_width_before_size_change, 0, 1, 0,
-       doc: /* Return pixel width of window WINDOW before last size changes.
+DEFUN ("window-old-pixel-width", Fwindow_old_pixel_width,
+       Swindow_old_pixel_width, 0, 1, 0,
+       doc: /* Return old total pixel width of WINDOW.
 WINDOW must be a valid window and defaults to the selected one.
 
-The return value is the pixel width of WINDOW at the last time
-`window-size-change-functions' was run.  It's zero if WINDOW was made
-after that.  */)
+The return value is the total pixel width of WINDOW after the last
+time window change functions found WINDOW live on its frame.  It is
+zero if WINDOW was created after that.  */)
   (Lisp_Object window)
 {
   return (make_fixnum
-         (decode_valid_window (window)->pixel_width_before_size_change));
+         (decode_valid_window (window)->old_pixel_width));
 }
 
-DEFUN ("window-pixel-height-before-size-change",
-       Fwindow_pixel_height_before_size_change,
-       Swindow_pixel_height_before_size_change, 0, 1, 0,
-       doc: /* Return pixel height of window WINDOW before last size changes.
+DEFUN ("window-old-pixel-height", Fwindow_old_pixel_height,
+       Swindow_old_pixel_height, 0, 1, 0,
+       doc: /* Return old total pixel height of WINDOW.
 WINDOW must be a valid window and defaults to the selected one.
 
-The return value is the pixel height of WINDOW at the last time
-`window-size-change-functions' was run.  It's zero if WINDOW was made
-after that.  */)
+The return value is the total pixel height of WINDOW after the last
+time window change functions found WINDOW live on its frame.  It is
+zero if WINDOW was created after that.  */)
   (Lisp_Object window)
 {
   return (make_fixnum
-         (decode_valid_window (window)->pixel_height_before_size_change));
+         (decode_valid_window (window)->old_pixel_height));
 }
 
 DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 
2, 0,
@@ -984,6 +1047,26 @@ window_body_width (struct window *w, bool pixelwise)
              0);
 }
 
+DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 2, 0,
+       doc: /* Return the width of WINDOW's text area.
+WINDOW must be a live window and defaults to the selected one.  Optional
+argument PIXELWISE non-nil means return the width in pixels.  The return
+value does not include any vertical dividers, fringes or marginal areas,
+or scroll bars.
+
+If PIXELWISE is nil, return the largest integer smaller than WINDOW's
+pixel width divided by the character width of WINDOW's frame.  This
+means that if a column at the right of the text area is only partially
+visible, that column is not counted.
+
+Note that the returned value includes the column reserved for the
+continuation glyph.  */)
+  (Lisp_Object window, Lisp_Object pixelwise)
+{
+  return make_fixnum (window_body_width (decode_live_window (window),
+                                        !NILP (pixelwise)));
+}
+
 DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 2, 0,
        doc: /* Return the height of WINDOW's text area.
 WINDOW must be a live window and defaults to the selected one.  Optional
@@ -1001,24 +1084,34 @@ visible, that line is not counted.  */)
                                          !NILP (pixelwise)));
 }
 
-DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 2, 0,
-       doc: /* Return the width of WINDOW's text area.
-WINDOW must be a live window and defaults to the selected one.  Optional
-argument PIXELWISE non-nil means return the width in pixels.  The return
-value does not include any vertical dividers, fringes or marginal areas,
-or scroll bars.
+DEFUN ("window-old-body-pixel-width",
+       Fwindow_old_body_pixel_width,
+       Swindow_old_body_pixel_width, 0, 1, 0,
+       doc: /* Return old width of WINDOW's text area in pixels.
+WINDOW must be a live window and defaults to the selected one.
 
-If PIXELWISE is nil, return the largest integer smaller than WINDOW's
-pixel width divided by the character width of WINDOW's frame.  This
-means that if a column at the right of the text area is only partially
-visible, that column is not counted.
+The return value is the pixel width of WINDOW's text area after the
+last time window change functions found WINDOW live on its frame.  It
+is zero if WINDOW was created after that.  */)
+  (Lisp_Object window)
+{
+  return (make_fixnum
+         (decode_live_window (window)->old_body_pixel_width));
+}
 
-Note that the returned value includes the column reserved for the
-continuation glyph.  */)
-  (Lisp_Object window, Lisp_Object pixelwise)
+DEFUN ("window-old-body-pixel-height",
+       Fwindow_old_body_pixel_height,
+       Swindow_old_body_pixel_height, 0, 1, 0,
+       doc: /* Return old height of WINDOW's text area in pixels.
+WINDOW must be a live window and defaults to the selected one.
+
+The return value is the pixel height of WINDOW's text area after the
+last time window change functions found WINDOW live on its frame.  It
+is zero if WINDOW was created after that.  */)
+  (Lisp_Object window)
 {
-  return make_fixnum (window_body_width (decode_live_window (window),
-                                        !NILP (pixelwise)));
+  return (make_fixnum
+         (decode_live_window (window)->old_body_pixel_height));
 }
 
 DEFUN ("window-mode-line-height", Fwindow_mode_line_height,
@@ -1506,7 +1599,7 @@ window_from_coordinates (struct frame *f, int x, int y,
   cw.window = &window, cw.x = x, cw.y = y; cw.part = part;
   foreach_window (f, check_window_containing, &cw);
 
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
   /* If not found above, see if it's in the tool bar window, if a tool
      bar exists.  */
   if (NILP (window)
@@ -2435,7 +2528,7 @@ window_list (void)
             have to reverse this list at the end.  */
          foreach_window (XFRAME (frame), add_window_to_list, &arglist);
          arglist = Fnreverse (arglist);
-         Vwindow_list = CALLN (Fnconc, Vwindow_list, arglist);
+         Vwindow_list = nconc2 (Vwindow_list, arglist);
        }
     }
 
@@ -3264,7 +3357,7 @@ window-start value is reasonable when this function is 
called.  */)
   adjust_frame_glyphs (f);
   unblock_input ();
 
-  run_window_configuration_change_hook (f);
+  FRAME_WINDOW_CHANGE (f) = true;
 
   return Qnil;
 }
@@ -3318,6 +3411,15 @@ select_frame_norecord (Lisp_Object frame)
     Fselect_frame (frame, Qt);
 }
 
+/**
+ * run_window_configuration_change_hook:
+ *
+ * Run any functions on 'window-configuration-change-hook' for the
+ * frame specified by F.  The buffer-local values are run with the
+ * window showing the buffer selected.  The default value is run with
+ * the frame specified by F selected.  All functions are called with
+ * the selected window's buffer current.
+ */
 static void
 run_window_configuration_change_hook (struct frame *f)
 {
@@ -3327,8 +3429,8 @@ run_window_configuration_change_hook (struct frame *f)
   XSETFRAME (frame, f);
 
   if (NILP (Vrun_hooks)
-      || !(f->can_x_set_window_size)
-      || !(f->after_make_frame))
+      || !f->can_x_set_window_size
+      || !f->after_make_frame)
     return;
 
   /* Use the right buffer.  Matters when running the local hooks.  */
@@ -3371,7 +3473,10 @@ run_window_configuration_change_hook (struct frame *f)
 DEFUN ("run-window-configuration-change-hook", 
Frun_window_configuration_change_hook,
        Srun_window_configuration_change_hook, 0, 1, 0,
        doc: /* Run `window-configuration-change-hook' for FRAME.
-If FRAME is omitted or nil, it defaults to the selected frame.  */)
+If FRAME is omitted or nil, it defaults to the selected frame.
+
+This function should not be needed any more and will be therefore
+considered obsolete.  */)
   (Lisp_Object frame)
 {
   run_window_configuration_change_hook (decode_live_frame (frame));
@@ -3381,131 +3486,438 @@ If FRAME is omitted or nil, it defaults to the 
selected frame.  */)
 DEFUN ("run-window-scroll-functions", Frun_window_scroll_functions,
        Srun_window_scroll_functions, 0, 1, 0,
        doc: /* Run `window-scroll-functions' for WINDOW.
-If WINDOW is omitted or nil, it defaults to the selected window.  */)
+If WINDOW is omitted or nil, it defaults to the selected window.
+
+This function is curently only called by 'split-window' for the new
+window after it has established the size of the new window.  */)
   (Lisp_Object window)
 {
-  if (! NILP (Vwindow_scroll_functions))
+  struct window *w = decode_live_window (window);
+  ptrdiff_t count = SPECPDL_INDEX ();
+
+  record_unwind_current_buffer ();
+  Fset_buffer (w->contents);
+  if (!NILP (Vwindow_scroll_functions))
     run_hook_with_args_2 (Qwindow_scroll_functions, window,
-                         Fmarker_position (decode_live_window 
(window)->start));
+                         Fmarker_position (w->start));
+  unbind_to (count, Qnil);
+
   return Qnil;
 }
 
 
-/* Compare old and present pixel sizes of windows in tree rooted at W.
-   Return true iff any of these windows differs in size.  */
+/**
+ * window_sub_list:
+ *
+ * Return list of live windows constructed by traversing any window
+ * sub-tree rooted at WINDOW in preorder followed by right siblings of
+ * WINDOW.  Called from outside with second argument WINDOWS nil.  The
+ * returned list is in reverse order.
+ */
+static Lisp_Object
+window_sub_list (Lisp_Object window, Lisp_Object windows)
+{
+
+  struct window *w = XWINDOW (window);
+
+  while (w)
+    {
+      if (WINDOW_INTERNAL_P (w))
+       windows = window_sub_list (w->contents, windows);
+      else
+       windows = Fcons (window, windows);
+
+      window = w->next;
+      w = NILP (window) ? 0 : XWINDOW (window);
+    }
 
-static bool
-window_size_changed (struct window *w)
+  return windows;
+}
+
+
+/**
+ * window_change_record_windows:
+ *
+ * Record changes for all live windows found by traversing any window
+ * sub-tree rooted at WINDOW in preorder followed by any right
+ * siblings of WINDOW.  This sets the old buffer, old pixel and old
+ * body pixel sizes of each live window found to the respective
+ * current values.  It also sets the change stamp of each window found
+ * to STAMP.  Return the number of live windows found.
+ *
+ * When not called by itself recursively, WINDOW is its frame's root
+ * window, STAMP is the current change stamp of WINDOW's frame and
+ * NUMBER is 0.
+ */
+static ptrdiff_t
+window_change_record_windows (Lisp_Object window, int stamp, ptrdiff_t number)
 {
-  if (w->pixel_width != w->pixel_width_before_size_change
-      || w->pixel_height != w->pixel_height_before_size_change)
-    return true;
+  struct window *w = XWINDOW (window);
 
-  if (WINDOW_INTERNAL_P (w))
+  while (w)
     {
-      w = XWINDOW (w->contents);
-      while (w)
+      if (WINDOW_INTERNAL_P (w))
+       number = window_change_record_windows (w->contents, stamp, number);
+      else
        {
-         if (window_size_changed (w))
-           return true;
-
-         w = NILP (w->next) ? 0 : XWINDOW (w->next);
+         number += 1;
+         w->change_stamp = stamp;
+         wset_old_buffer (w, w->contents);
+         w->old_pixel_width = w->pixel_width;
+         w->old_pixel_height = w->pixel_height;
+         w->old_body_pixel_width = window_body_width (w, true);
+         w->old_body_pixel_height = window_body_height (w, true);
        }
+
+      w = NILP (w->next) ? 0 : XWINDOW (w->next);
     }
 
-  return false;
+  return number;
 }
 
-/* Set before size change pixel sizes of windows in tree rooted at W to
-   their present pixel sizes.  */
 
+/**
+ * window_change_record:
+ *
+ * For each frame that has recorded changes, record its selected
+ * window, update Fchange stamp, record the states of all its live
+ * windows via window_change_record_windows and reset its
+ * window_change and window_state_change flags.
+ *
+ * Record selected window in old_selected_window and selected frame in
+ * old_selected_frame.
+ */
 static void
-window_set_before_size_change_sizes (struct window *w)
+window_change_record (void)
 {
-  w->pixel_width_before_size_change = w->pixel_width;
-  w->pixel_height_before_size_change = w->pixel_height;
-
-  if (WINDOW_INTERNAL_P (w))
+  if (window_change_record_frames)
     {
-      w = XWINDOW (w->contents);
-      while (w)
+      Lisp_Object tail, frame;
+
+      FOR_EACH_FRAME (tail, frame)
        {
-         window_set_before_size_change_sizes (w);
-         w = NILP (w->next) ? 0 : XWINDOW (w->next);
+         struct frame *f = XFRAME (frame);
+
+         /* Record FRAME's selected window.  */
+         fset_old_selected_window (f, FRAME_SELECTED_WINDOW (f));
+
+         /* Bump up FRAME's change stamp.  If this wraps, make it 1 to avoid
+            that a new window (whose change stamp is always set to 0) gets
+            reported as "existing before".  */
+         f->change_stamp += 1;
+         if (f->change_stamp == 0)
+           f->change_stamp = 1;
+
+         /* Bump up the change stamps of all live windows on this frame so
+            the next call of this function can tell whether any of them
+            "existed before" and record state for each of these windows.  */
+         f->number_of_windows
+           = window_change_record_windows (f->root_window, f->change_stamp, 0);
+
+         /* Reset our flags.  */
+         FRAME_WINDOW_CHANGE (f) = false;
+         FRAME_WINDOW_STATE_CHANGE (f) = false;
        }
     }
+
+  /* Strictly spoken we don't need old_selected_window at all - its
+     value is the old selected window of old_selected_frame.  */
+  old_selected_window = selected_window;
+  old_selected_frame = selected_frame;
 }
 
 
-void
-run_window_size_change_functions (Lisp_Object frame)
+/**
+ * run_window_change_functions_1:
+ *
+ * Run window change functions specified by SYMBOL with argument
+ * WINDOW_OR_FRAME.  If BUFFER is nil, WINDOW_OR_FRAME specifies a
+ * frame.  In this case, run the default value of SYMBOL.  Otherwise,
+ * WINDOW_OR_FRAME denotes a window showing BUFFER.  In this case, run
+ * the buffer local value of SYMBOL in BUFFER, if any.
+ */
+static void
+run_window_change_functions_1 (Lisp_Object symbol, Lisp_Object buffer,
+                              Lisp_Object window_or_frame)
 {
-  struct frame *f = XFRAME (frame);
-  struct window *r = XWINDOW (FRAME_ROOT_WINDOW (f));
+  Lisp_Object funs = Qnil;
 
-  if (NILP (Vrun_hooks)
-      || !(f->can_x_set_window_size)
-      || !(f->after_make_frame))
-    return;
+  if (NILP (buffer))
+    funs = Fdefault_value (symbol);
+  else if (!NILP (Fassoc (symbol, BVAR (XBUFFER (buffer), local_var_alist),
+                         Qnil)))
+    /* Don't run global value buffer-locally.  */
+    funs = buffer_local_value (symbol, buffer);
 
-  if (FRAME_WINDOW_CONFIGURATION_CHANGED (f)
-      /* Here we implicitly exclude the possibility that the height of
-        FRAME and its minibuffer window both change leaving the height
-        of FRAME's root window alone.  */
-      || window_size_changed (r))
+  while (CONSP (funs))
     {
-      Lisp_Object globals = Fdefault_value (Qwindow_size_change_functions);
-      Lisp_Object windows = Fwindow_list (frame, Qlambda, Qnil);
-      /* The buffers for which the local hook was already run.  */
-      Lisp_Object buffers = Qnil;
+      if (!EQ (XCAR (funs), Qt)
+         && (NILP (buffer)
+             ? FRAME_LIVE_P (XFRAME (window_or_frame))
+             : WINDOW_LIVE_P (window_or_frame)))
+       {
+         /* Any function called here may change the state of any
+            frame.  Make sure to record changes for each live frame
+            in window_change_record later.  */
+         window_change_record_frames = true;
+         safe_call1 (XCAR (funs), window_or_frame);
+       }
+
+      funs = XCDR (funs);
+    }
+}
+
+
+/**
+ * run_window_change_functions:
+ *
+ * Run window change functions for each live frame.  This function
+ * must be called from a "safe" position in redisplay_internal.
+ *
+ * Do not run any functions for a frame whose window_change flag is
+ * nil, where no window selection happened and whose window state
+ * change flag was not set since the last time this function was
+ * called.  Never run any functions for tooltip frames.
+ *
+ * The change functions run are, in this order:
+ *
+ * 'window-buffer-change-functions' which are run for a window that
+ * changed its buffer or that was not shown the last time window
+ * change functions were run.  The default value is also run when a
+ * window was deleted since the last time window change functions were
+ * run.
+ *
+ * `window-size-change-functions' run for a window that changed its
+ * body or total size, a window that changed its buffer or a window
+ * that was not shown the last time window change functions were run.
+ *
+ * `window-selected-change-functions' run for a window that was
+ * (de-)selected since the last time window change functions were run.
+ *
+ * `window-state-change-functions' run for a window for which any of
+ * the above three changes occurred.
+ *
+ * A buffer-local value of these functions is run if and only if the
+ * window for which the functions are run currently shows the buffer.
+ * Each call gets one argument - the window showing the buffer.  This
+ * means that the buffer-local value of these functions may be called
+ * as many times as the buffer is shown on the frame.
+ *
+ * The default values of these functions are called only after all
+ * buffer-local values for all of these functions have been run.  Each
+ * such call receives one argument - the frame for which a change
+ * occurred.  Functions on `window-state-change-functions' are run
+ * also if the corresponding frame's window state change flag has been
+ * set.
+ *
+ * After the four change functions cited above have been run in the
+ * indicated way, functions on 'window-configuration-change-hook' are
+ * run.  A buffer-local value is run if a window shows that buffer and
+ * has either changed its buffer or its body or total size or did not
+ * appear on this frame since the last time window change functions
+ * were run.  The functions are called without argument and with the
+ * buffer's window selected.  The default value is run without
+ * argument and with the frame for which the function is run selected.
+ *
+ * In a final step, functions on `window-state-change-hook' are run
+ * provided a window state change has occurred or the window state
+ * change flag has been set on at least one frame.  Each of these
+ * functions is called without argument.
+ *
+ * This function does not save and restore match data.  Any functions
+ * it calls are responsible for doing that themselves.
+ */
+void
+run_window_change_functions (void)
+{
+  Lisp_Object tail, frame;
+  bool selected_frame_change = !EQ (selected_frame, old_selected_frame);
+  bool run_window_state_change_hook = false;
+  ptrdiff_t count = SPECPDL_INDEX ();
 
+  window_change_record_frames = false;
+  record_unwind_protect_void (window_change_record);
+  specbind (Qinhibit_redisplay, Qt);
+
+  FOR_EACH_FRAME (tail, frame)
+    {
+      struct frame *f = XFRAME (frame);
+      Lisp_Object root = FRAME_ROOT_WINDOW (f);
+      bool frame_window_change = FRAME_WINDOW_CHANGE (f);
+      bool window_buffer_change, window_size_change;
+      bool frame_buffer_change = false, frame_size_change = false;
+      bool frame_selected_change
+       = (selected_frame_change
+          && (EQ (frame, old_selected_frame)
+              || EQ (frame, selected_frame)));
+      bool frame_selected_window_change
+       = !EQ (FRAME_OLD_SELECTED_WINDOW (f), FRAME_SELECTED_WINDOW (f));
+      bool frame_window_state_change = FRAME_WINDOW_STATE_CHANGE (f);
+      bool window_deleted = false;
+      Lisp_Object windows;
+      ptrdiff_t number_of_windows;
+
+      if (!FRAME_LIVE_P (f)
+         || !f->can_x_set_window_size
+         || !f->after_make_frame
+         || FRAME_TOOLTIP_P (f)
+         || !(frame_window_change
+              || frame_selected_change
+              || frame_selected_window_change
+              || frame_window_state_change))
+       /* Either we are not allowed to run hooks for this frame or no
+          window change has been reported for it since the last time
+          we ran window change functions on it.  */
+       continue;
+
+      /* Analyze windows and run buffer locals hooks in pre-order.  */
+      windows = Fnreverse (window_sub_list (root, Qnil));
+      number_of_windows = 0;
+
+      /* The following loop collects all data needed to tell whether
+        the default value of a hook shall be run and runs any buffer
+        local hooks right away.  */
       for (; CONSP (windows); windows = XCDR (windows))
        {
          Lisp_Object window = XCAR (windows);
-         Lisp_Object buffer = Fwindow_buffer (window);
-
-         /* Run a buffer-local value only once for that buffer and
-            only if at least one window showing that buffer on FRAME
-            actually changed its size.  Note that the function is run
-            with FRAME as its argument and as such oblivious to the
-            window checked below.  */
-         if (window_size_changed (XWINDOW (window))
-             && !NILP (Flocal_variable_p (Qwindow_size_change_functions, 
buffer))
-             && NILP (Fmemq (buffer, buffers)))
-           {
-             Lisp_Object locals
-               = Fbuffer_local_value (Qwindow_size_change_functions, buffer);
-
-             while (CONSP (locals))
-               {
-                 if (!EQ (XCAR (locals), Qt))
-                   safe_call1 (XCAR (locals), frame);
-                 locals = XCDR (locals);
-               }
-
-             buffers = Fcons (buffer, buffers);
-           }
+         struct window *w = XWINDOW (window);
+         Lisp_Object buffer = WINDOW_BUFFER (w);
+
+         /* Count this window even if it has been deleted while
+            running a hook.  */
+         number_of_windows += 1;
+
+         if (!WINDOW_LIVE_P (window))
+           continue;
+
+         /* A "buffer change" means either the window's buffer
+            changed or the window was not part of this frame the last
+            time window change functions were run for it.  */
+         window_buffer_change =
+           (frame_window_change
+            && (!EQ (buffer, w->old_buffer)
+                || w->change_stamp != f->change_stamp));
+         /* A "size change" means either a buffer change or that the
+            total or body size of the window has changed.
+
+            Note: A buffer change implies a size change because either
+            this window didn't show the buffer before or this window
+            didn't show the buffer the last time the window change
+            functions were run.  In either case, an application
+            tracing size changes in a buffer-locally fashion might
+            want to be informed about that change.  */
+         window_size_change =
+           (frame_window_change
+            && (window_buffer_change
+                || w->pixel_width != w->old_pixel_width
+                || w->pixel_height != w->old_pixel_height
+                || window_body_width (w, true) != w->old_body_pixel_width
+                || window_body_height (w, true) != w->old_body_pixel_height));
+
+         /* The following two are needed when running the default
+            values for this frame below.  */
+         frame_buffer_change = frame_buffer_change || window_buffer_change;
+         frame_size_change = frame_size_change || window_size_change;
+
+         if (window_buffer_change)
+           run_window_change_functions_1
+             (Qwindow_buffer_change_functions, buffer, window);
+
+         if (window_size_change && WINDOW_LIVE_P (window))
+           run_window_change_functions_1
+             (Qwindow_size_change_functions, buffer, window);
+
+         /* This window's selection has changed when it was
+            (de-)selected as its frame's or the globally selected
+            window.  */
+         if (((frame_selected_change
+               && (EQ (window, old_selected_window)
+                   || EQ (window, selected_window)))
+              || (frame_selected_window_change
+                  && (EQ (window, FRAME_OLD_SELECTED_WINDOW (f))
+                      || EQ (window, FRAME_SELECTED_WINDOW (f)))))
+             && WINDOW_LIVE_P (window))
+           run_window_change_functions_1
+             (Qwindow_selection_change_functions, buffer, window);
+
+         /* This window's state has changed when its buffer or size
+            changed or it was (de-)selected as its frame's or the
+            globally selected window.  */
+         if ((window_buffer_change
+              || window_size_change
+              || ((frame_selected_change
+                   && (EQ (window, old_selected_window)
+                       || EQ (window, selected_window)))
+                  || (frame_selected_window_change
+                      && (EQ (window, FRAME_OLD_SELECTED_WINDOW (f))
+                          || EQ (window, FRAME_SELECTED_WINDOW (f))))))
+             && WINDOW_LIVE_P (window))
+           run_window_change_functions_1
+             (Qwindow_state_change_functions, buffer, window);
        }
 
-      while (CONSP (globals))
+      /* When the number of windows on a frame has decreased, at least
+        one window of that frame was deleted.  In that case, we want
+        to run the default buffer and configuration change hooks.  The
+        default size change hook is not necessarily run in that case,
+        but usually will be unless the deletion was "compensated" by
+        a reduction of the frame size or an increase of a minibuffer
+        window size.  */
+      window_deleted = number_of_windows < f->number_of_windows;
+      /* A frame changed buffers when one of its windows has changed
+        its buffer or at least one window was deleted.  */
+      if ((frame_buffer_change || window_deleted) && FRAME_LIVE_P (f))
+       run_window_change_functions_1
+         (Qwindow_buffer_change_functions, Qnil, frame);
+
+      /* A size change occurred when at least one of the frame's
+        windows has changed size.  */
+      if (frame_size_change && FRAME_LIVE_P (f))
+       run_window_change_functions_1
+         (Qwindow_size_change_functions, Qnil, frame);
+
+      /* A frame has changed its window selection when its selected
+        window has changed or when it was (de-)selected.  */
+      if ((frame_selected_change || frame_selected_window_change)
+         && FRAME_LIVE_P (f))
+       run_window_change_functions_1
+         (Qwindow_selection_change_functions, Qnil, frame);
+
+      /* A frame has changed state when a size or buffer change
+        occurred, its selected window has changed, when it was
+        (de-)selected or its window state change flag was set.  */
+      if ((frame_selected_change || frame_selected_window_change
+          || frame_buffer_change || window_deleted
+          || frame_size_change || frame_window_state_change)
+         && FRAME_LIVE_P (f))
        {
-         if (!EQ (XCAR (globals), Qt))
-           safe_call1 (XCAR (globals), frame);
-         globals = XCDR (globals);
+         run_window_change_functions_1
+           (Qwindow_state_change_functions, Qnil, frame);
+         /* Make sure to run 'window-state-change-hook' later.  */
+         run_window_state_change_hook = true;
+         /*  Make sure to record changes for each live frame in
+            window_change_record later.  */
+         window_change_record_frames = true;
        }
 
-      window_set_before_size_change_sizes (r);
+      /* A frame's configuration changed when one of its windows has
+        changed buffer or size or at least one window was deleted.  */
+      if ((frame_size_change || window_deleted) && FRAME_LIVE_P (f))
+       /* This will run any buffer local window configuration change
+          hook as well.  */
+       run_window_configuration_change_hook (f);
+    }
 
-      if (FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f))
-       /* Record size of FRAME's minibuffer window too.  */
-       window_set_before_size_change_sizes
-         (XWINDOW (FRAME_MINIBUF_WINDOW (f)));
+  /* Run 'window-state-change-hook' if at least one frame has changed
+     state.  */
+  if (run_window_state_change_hook && !NILP (Vwindow_state_change_hook))
+    safe_run_hooks (Qwindow_state_change_hook);
 
-      FRAME_WINDOW_CONFIGURATION_CHANGED (f) = false;
-    }
+  /* Record changes for all frames (if asked for), selected window and
+     frame.  */
+  unbind_to (count, Qnil);
 }
 
-
 /* Make WINDOW display BUFFER.  RUN_HOOKS_P means it's allowed
    to run hooks.  See make_frame for a case where it's not allowed.
    KEEP_MARGINS_P means that the current margins, fringes, and
@@ -3581,14 +3993,18 @@ set_window_buffer (Lisp_Object window, Lisp_Object 
buffer,
       apply_window_adjustment (w);
     }
 
-  if (run_hooks_p)
-    {
-      if (!NILP (Vwindow_scroll_functions))
-       run_hook_with_args_2 (Qwindow_scroll_functions, window,
-                             Fmarker_position (w->start));
-      if (!samebuf)
-       run_window_configuration_change_hook (XFRAME (WINDOW_FRAME (w)));
-    }
+  if (run_hooks_p && !NILP (Vwindow_scroll_functions))
+    run_hook_with_args_2 (Qwindow_scroll_functions, window,
+                         Fmarker_position (w->start));
+
+  /* Ensure that window change functions are run later if the buffer
+     differs and the window is neither a mini nor a pseudo window.
+
+     Note: Running window change functions for the minibuffer is noisy
+     and was generally suppressed in the past.  Is there any reason we
+     should run them?  */
+  if (!samebuf && !MINI_WINDOW_P (w) && !WINDOW_PSEUDO_P (w))
+    FRAME_WINDOW_CHANGE (XFRAME (w->frame)) = true;
 
   unbind_to (count, Qnil);
 }
@@ -3828,8 +4244,6 @@ make_window (void)
   w->phys_cursor_width = -1;
 #endif
   w->sequence_number = ++sequence_number;
-  w->pixel_width_before_size_change = 0;
-  w->pixel_height_before_size_change = 0;
   w->scroll_bar_width = -1;
   w->scroll_bar_height = -1;
   w->column_number_displayed = -1;
@@ -4095,6 +4509,9 @@ window_resize_apply (struct window *w, bool horflag)
   else
     /* Bug#15957.  */
     w->window_end_valid = false;
+
+  if (!WINDOW_PSEUDO_P (w))
+    FRAME_WINDOW_CHANGE (WINDOW_XFRAME (w)) = true;
 }
 
 
@@ -4292,16 +4709,26 @@ resize_frame_windows (struct frame *f, int size, bool 
horflag, bool pixelwise)
     /* For a leaf root window just set the size.  */
     if (horflag)
       {
+       bool changed = r->pixel_width != new_pixel_size;
+
        r->total_cols = new_size;
        r->pixel_width = new_pixel_size;
+
+       if (changed && !WINDOW_PSEUDO_P (r))
+         FRAME_WINDOW_CHANGE (f) = true;
       }
     else
       {
+       bool changed = r->pixel_height != new_pixel_size;
+
        r->top_line = FRAME_TOP_MARGIN (f);
        r->pixel_top = FRAME_TOP_MARGIN_HEIGHT (f);
 
        r->total_lines = new_size;
        r->pixel_height = new_pixel_size;
+
+       if (changed && !WINDOW_PSEUDO_P (r))
+         FRAME_WINDOW_CHANGE (f) = true;
       }
   else
     {
@@ -4559,17 +4986,11 @@ set correctly.  See the code of `split-window' for how 
this is done.  */)
   block_input ();
   window_resize_apply (p, horflag);
   adjust_frame_glyphs (f);
-  /* Set buffer of NEW to buffer of reference window.  Don't run
-     any hooks.  */
-  set_window_buffer (new, r->contents, false, true);
+  /* Set buffer of NEW to buffer of reference window.  */
+  set_window_buffer (new, r->contents, true, true);
+  FRAME_WINDOW_CHANGE (f) = true;
   unblock_input ();
 
-  /* Maybe we should run the scroll functions in Elisp (which already
-     runs the configuration change hook).  */
-  if (! NILP (Vwindow_scroll_functions))
-    run_hook_with_args_2 (Qwindow_scroll_functions, new,
-                         Fmarker_position (n->start));
-  /* Return NEW.  */
   return new;
 }
 
@@ -4720,6 +5141,8 @@ Signal an error when WINDOW is the only window on its 
frame.  */)
        }
       else
        unblock_input ();
+
+      FRAME_WINDOW_CHANGE (f) = true;
     }
   else
     /* We failed: Relink WINDOW into window tree.  */
@@ -4745,118 +5168,111 @@ Signal an error when WINDOW is the only window on its 
frame.  */)
                        Resizing Mini-Windows
  ***********************************************************************/
 
-/* Grow mini-window W by DELTA lines, DELTA >= 0, or as much as we
-   can.  */
+/**
+ * resize_mini_window_apply:
+ *
+ * Assign new window sizes after resizing a mini window W by DELTA
+ * pixels.  No error checking performed.
+  */
+static void
+resize_mini_window_apply (struct window *w, int delta)
+{
+  struct frame *f = XFRAME (w->frame);
+  Lisp_Object root = FRAME_ROOT_WINDOW (f);
+  struct window *r = XWINDOW (root);
+
+  block_input ();
+  w->pixel_height = w->pixel_height + delta;
+  w->total_lines = w->pixel_height / FRAME_LINE_HEIGHT (f);
+
+  window_resize_apply (r, false);
+
+  w->pixel_top = r->pixel_top + r->pixel_height;
+  w->top_line = r->top_line + r->total_lines;
+
+  /* Enforce full redisplay of the frame.  */
+  /* FIXME: Shouldn't some of the caller do it?  */
+  fset_redisplay (f);
+  adjust_frame_glyphs (f);
+  unblock_input ();
+}
+
+/**
+ * grow_mini_window:
+ *
+ * Grow mini-window W by DELTA pixels.  If DELTA is negative, this may
+ * shrink the minibuffer window to the minimum height to display one
+ * line of text.
+ */
 void
-grow_mini_window (struct window *w, int delta, bool pixelwise)
+grow_mini_window (struct window *w, int delta)
 {
   struct frame *f = XFRAME (w->frame);
-  struct window *r;
-  Lisp_Object root, height;
-  int line_height, pixel_height;
+  int old_height = WINDOW_PIXEL_HEIGHT (w);
+  int min_height = FRAME_LINE_HEIGHT (f);
 
   eassert (MINI_WINDOW_P (w));
-  eassert (delta >= 0);
 
-  if (delta > 0)
-    {
-      root = FRAME_ROOT_WINDOW (f);
-      r = XWINDOW (root);
-      height = call3 (Qwindow__resize_root_window_vertically,
-                     root, make_fixnum (- delta), pixelwise ? Qt : Qnil);
-      if (FIXNUMP (height) && window_resize_check (r, false))
-       {
-         block_input ();
-         window_resize_apply (r, false);
+  if (old_height + delta < min_height)
+    /* Never shrink mini-window to less than its minimum
+       height.  */
+    delta = old_height > min_height ? min_height - old_height : 0;
 
-         if (pixelwise)
-           {
-             pixel_height = min (-XFIXNUM (height), INT_MAX - w->pixel_height);
-             line_height = pixel_height / FRAME_LINE_HEIGHT (f);
-           }
-         else
-           {
-             line_height = min (-XFIXNUM (height),
-                                ((INT_MAX - w->pixel_height)
-                                 / FRAME_LINE_HEIGHT (f)));
-             pixel_height = line_height * FRAME_LINE_HEIGHT (f);
-           }
+  if (delta != 0)
+    {
+      Lisp_Object root = FRAME_ROOT_WINDOW (f);
+      struct window *r = XWINDOW (root);
+      Lisp_Object grow;
 
-         /* Grow the mini-window.  */
-         w->pixel_top = r->pixel_top + r->pixel_height;
-         w->top_line = r->top_line + r->total_lines;
-         /* Make sure the mini-window has always at least one line.  */
-         w->pixel_height = max (w->pixel_height + pixel_height,
-                                FRAME_LINE_HEIGHT (f));
-         w->total_lines = max (w->total_lines + line_height, 1);
-
-         /* Enforce full redisplay of the frame.  */
-         /* FIXME: Shouldn't window--resize-root-window-vertically do it?  */
-         fset_redisplay (f);
-         adjust_frame_glyphs (f);
-         unblock_input ();
-       }
-      else
-       error ("Failed to grow minibuffer window");
+      FRAME_WINDOWS_FROZEN (f) = true;
+      grow = call3 (Qwindow__resize_root_window_vertically,
+                   root, make_fixnum (- delta), Qt);
 
+      if (FIXNUMP (grow) && window_resize_check (r, false))
+       resize_mini_window_apply (w, -XFIXNUM (grow));
     }
 }
 
-/* Shrink mini-window W to one line.  */
+/**
+ * shrink_mini_window:
+ *
+ * Shrink mini-window W to the minimum height needed to display one
+ * line of text.
+ */
 void
-shrink_mini_window (struct window *w, bool pixelwise)
+shrink_mini_window (struct window *w)
 {
   struct frame *f = XFRAME (w->frame);
-  struct window *r;
-  Lisp_Object root, delta;
-  EMACS_INT height, unit;
+  int delta = WINDOW_PIXEL_HEIGHT (w) - FRAME_LINE_HEIGHT (f);
 
   eassert (MINI_WINDOW_P (w));
 
-  height = pixelwise ? w->pixel_height : w->total_lines;
-  unit = pixelwise ? FRAME_LINE_HEIGHT (f) : 1;
-  if (height > unit)
+  if (delta > 0)
     {
-      root = FRAME_ROOT_WINDOW (f);
-      r = XWINDOW (root);
-      delta = call3 (Qwindow__resize_root_window_vertically,
-                    root, make_fixnum (height - unit),
-                    pixelwise ? Qt : Qnil);
-      if (FIXNUMP (delta) && window_resize_check (r, false))
-       {
-         block_input ();
-         window_resize_apply (r, false);
-
-         /* Shrink the mini-window.  */
-         w->top_line = r->top_line + r->total_lines;
-         w->total_lines = 1;
-         w->pixel_top = r->pixel_top + r->pixel_height;
-         w->pixel_height = FRAME_LINE_HEIGHT (f);
-         /* Enforce full redisplay of the frame.  */
-         /* FIXME: Shouldn't window--resize-root-window-vertically do it?  */
-         fset_redisplay (f);
-         adjust_frame_glyphs (f);
-         unblock_input ();
-       }
-      /* If the above failed for whatever strange reason we must make a
-        one window frame here.  The same routine will be needed when
-        shrinking the frame (and probably when making the initial
-        *scratch* window).  For the moment leave things as they are.  */
-      else
-       error ("Failed to shrink minibuffer window");
+      Lisp_Object root = FRAME_ROOT_WINDOW (f);
+      struct window *r = XWINDOW (root);
+      Lisp_Object grow;
+
+      FRAME_WINDOWS_FROZEN (f) = false;
+      grow = call3 (Qwindow__resize_root_window_vertically,
+                   root, make_fixnum (delta), Qt);
+
+      if (FIXNUMP (grow) && window_resize_check (r, false))
+       resize_mini_window_apply (w, -XFIXNUM (grow));
     }
 }
 
-DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, 
Sresize_mini_window_internal, 1, 1, 0,
-       doc: /* Resize minibuffer window WINDOW.  */)
+DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal,
+       Sresize_mini_window_internal, 1, 1, 0,
+       doc: /* Resize mini window WINDOW.  */)
      (Lisp_Object window)
 {
   struct window *w = XWINDOW (window);
   struct window *r;
   struct frame *f;
-  int height;
+  int old_height, delta;
 
-  CHECK_WINDOW (window);
+  CHECK_LIVE_WINDOW (window);
   f = XFRAME (w->frame);
 
   if (!EQ (FRAME_MINIBUF_WINDOW (XFRAME (w->frame)), window))
@@ -4865,26 +5281,18 @@ DEFUN ("resize-mini-window-internal", 
Fresize_mini_window_internal, Sresize_mini
     error ("Cannot resize a minibuffer-only frame");
 
   r = XWINDOW (FRAME_ROOT_WINDOW (f));
-  height = r->pixel_height + w->pixel_height;
+  old_height = r->pixel_height + w->pixel_height;
+  delta = XFIXNUM (w->new_pixel) - w->pixel_height;
   if (window_resize_check (r, false)
       && XFIXNUM (w->new_pixel) > 0
-      && height == XFIXNUM (r->new_pixel) + XFIXNUM (w->new_pixel))
+      && old_height == XFIXNUM (r->new_pixel) + XFIXNUM (w->new_pixel))
     {
-      block_input ();
-      window_resize_apply (r, false);
+      resize_mini_window_apply (w, delta);
 
-      w->pixel_height = XFIXNAT (w->new_pixel);
-      w->total_lines = w->pixel_height / FRAME_LINE_HEIGHT (f);
-      w->pixel_top = r->pixel_top + r->pixel_height;
-      w->top_line = r->top_line + r->total_lines;
-
-      fset_redisplay (f);
-      adjust_frame_glyphs (f);
-      unblock_input ();
       return Qt;
     }
   else
-    error ("Failed to resize minibuffer window");
+    error ("Cannot resize mini window");
 }
 
 /* Mark window cursors off for all windows in the window tree rooted
@@ -4970,25 +5378,21 @@ window_wants_header_line (struct window *w)
          : 0);
 }
 
-/* Return number of lines of text (not counting mode lines) in W.  */
+/* Return number of lines of text in window W, not counting the mode
+   line and header line, if any.  Do NOT use this for windows on GUI
+   frames; use window_body_height instead.  This function is only for
+   windows on TTY frames, where it is much more efficient.  */
 
 int
 window_internal_height (struct window *w)
 {
   int ht = w->total_lines;
 
-  if (!MINI_WINDOW_P (w))
-    {
-      if (!NILP (w->parent)
-         || WINDOWP (w->contents)
-         || !NILP (w->next)
-         || !NILP (w->prev)
-         || window_wants_mode_line (w))
-       --ht;
+  if (window_wants_mode_line (w))
+    --ht;
 
-      if (window_wants_header_line (w))
-       --ht;
-    }
+  if (window_wants_header_line (w))
+    --ht;
 
   return ht;
 }
@@ -5017,8 +5421,8 @@ window_scroll (Lisp_Object window, EMACS_INT n, bool 
whole, bool noerror)
   if (whole && Vfast_but_imprecise_scrolling)
     specbind (Qfontification_functions, Qnil);
 
-  /* If we must, use the pixel-based version which is much slower than
-     the line-based one but can handle varying line heights.  */
+  /* On GUI frames, use the pixel-based version which is much slower
+     than the line-based one but can handle varying line heights.  */
   if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame)))
     window_scroll_pixel_based (window, n, whole, noerror);
   else
@@ -5060,6 +5464,11 @@ window_scroll_margin (struct window *window, enum 
margin_unit unit)
     return 0;
 }
 
+static int
+sanitize_next_screen_context_lines (void)
+{
+  return clip_to_bounds (0, next_screen_context_lines, 1000000);
+}
 
 /* Implementation of window_scroll that works based on pixel line
    heights.  See the comment of window_scroll for parameter
@@ -5130,9 +5539,11 @@ window_scroll_pixel_based (Lisp_Object window, int n, 
bool whole, bool noerror)
             height.  This is important to ensure we get back to the
             same position when scrolling up, then down.  */
          if (whole)
-           dy = max ((window_box_height (w) / dy
-                      - next_screen_context_lines) * dy,
-                     dy);
+           {
+             int ht = window_box_height (w);
+             int nscls = sanitize_next_screen_context_lines ();
+             dy = max (dy, (ht / dy - nscls) * dy);
+           }
          dy *= n;
 
          if (n < 0)
@@ -5213,13 +5624,14 @@ window_scroll_pixel_based (Lisp_Object window, int n, 
bool whole, bool noerror)
     {
       ptrdiff_t start_pos = IT_CHARPOS (it);
       int dy = frame_line_height;
+      int ht = window_box_height (w);
+      int nscls = sanitize_next_screen_context_lines ();
       /* In the below we divide the window box height by the frame's
         line height to make the result predictable when the window
         box is not an integral multiple of the line height.  This is
         important to ensure we get back to the same position when
         scrolling up, then down.  */
-      dy = max ((window_box_height (w) / dy - next_screen_context_lines) * dy,
-               dy) * n;
+      dy = n * max (dy, (ht / dy - nscls) * dy);
 
       /* Note that move_it_vertically always moves the iterator to the
          start of a line.  So, if the last line doesn't have a newline,
@@ -5517,7 +5929,10 @@ window_scroll_line_based (Lisp_Object window, int n, 
bool whole, bool noerror)
   /* If scrolling screen-fulls, compute the number of lines to
      scroll from the window's height.  */
   if (whole)
-    n *= max (1, ht - next_screen_context_lines);
+    {
+      int nscls = sanitize_next_screen_context_lines ();
+      n *= max (1, ht - nscls);
+    }
 
   if (!NILP (Vscroll_preserve_screen_position))
     {
@@ -5983,7 +6398,7 @@ and redisplay normally--don't erase and redraw the frame. 
 */)
          /* Invalidate pixel data calculated for all compositions.  */
          for (i = 0; i < n_compositions; i++)
            composition_table[i]->font = NULL;
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
          WINDOW_XFRAME (w)->minimize_tool_bar_window_p = 1;
 #endif
          Fredraw_frame (WINDOW_FRAME (w));
@@ -6314,7 +6729,6 @@ struct saved_window
 
   Lisp_Object window, buffer, start, pointm, old_pointm;
   Lisp_Object pixel_left, pixel_top, pixel_height, pixel_width;
-  Lisp_Object pixel_height_before_size_change, pixel_width_before_size_change;
   Lisp_Object left_col, top_line, total_cols, total_lines;
   Lisp_Object normal_cols, normal_lines;
   Lisp_Object hscroll, min_hscroll, hscroll_whole, suspend_auto_hscroll;
@@ -6430,12 +6844,6 @@ the return value is nil.  Otherwise the value is t.  */)
       struct window *root_window;
       struct window **leaf_windows;
       ptrdiff_t i, k, n_leaf_windows;
-      /* Records whether a window has been added or removed wrt the
-        original configuration.  */
-      bool window_changed = false;
-      /* Records whether a window has changed its buffer wrt the
-        original configuration.  */
-      bool buffer_changed = false;
 
       /* Don't do this within the main loop below: This may call Lisp
         code and is thus potentially unsafe while input is blocked.  */
@@ -6445,11 +6853,6 @@ the return value is nil.  Otherwise the value is t.  */)
          window = p->window;
          w = XWINDOW (window);
 
-         if (NILP (w->contents))
-           /* A dead window that will be resurrected, the window
-              configuration will change.  */
-           window_changed = true;
-
          if (BUFFERP (w->contents)
              && !EQ (w->contents, p->buffer)
              && BUFFER_LIVE_P (XBUFFER (p->buffer)))
@@ -6534,10 +6937,6 @@ the return value is nil.  Otherwise the value is t.  */)
          w->pixel_top = XFIXNAT (p->pixel_top);
          w->pixel_width = XFIXNAT (p->pixel_width);
          w->pixel_height = XFIXNAT (p->pixel_height);
-         w->pixel_width_before_size_change
-           = XFIXNAT (p->pixel_width_before_size_change);
-         w->pixel_height_before_size_change
-           = XFIXNAT (p->pixel_height_before_size_change);
          w->left_col = XFIXNAT (p->left_col);
          w->top_line = XFIXNAT (p->top_line);
          w->total_cols = XFIXNAT (p->total_cols);
@@ -6585,9 +6984,6 @@ the return value is nil.  Otherwise the value is t.  */)
          if (BUFFERP (p->buffer) && BUFFER_LIVE_P (XBUFFER (p->buffer)))
            /* If saved buffer is alive, install it.  */
            {
-             if (!EQ (w->contents, p->buffer))
-               /* Record buffer configuration change.  */
-               buffer_changed = true;
              wset_buffer (w, p->buffer);
              w->start_at_line_beg = !NILP (p->start_at_line_beg);
              set_marker_restricted (w->start, p->start, w->contents);
@@ -6621,8 +7017,6 @@ the return value is nil.  Otherwise the value is t.  */)
          else if (!NILP (w->start))
            /* Leaf window has no live buffer, get one.  */
            {
-             /* Record buffer configuration change.  */
-             buffer_changed = true;
              /* Get the buffer via other_buffer_safely in order to
                 avoid showing an unimportant buffer and, if necessary, to
                 recreate *scratch* in the course (part of Juanma's bs-show
@@ -6670,10 +7064,7 @@ the return value is nil.  Otherwise the value is t.  */)
       /* Now, free glyph matrices in windows that were not reused.  */
       for (i = 0; i < n_leaf_windows; i++)
        if (NILP (leaf_windows[i]->contents))
-         {
-           free_window_matrices (leaf_windows[i]);
-           window_changed = true;
-         }
+         free_window_matrices (leaf_windows[i]);
 
       /* Allow x_set_window_size again and apply frame size changes if
         needed.  */
@@ -6703,35 +7094,10 @@ the return value is nil.  Otherwise the value is t.  */)
         selected window.  */
       if (FRAME_LIVE_P (XFRAME (data->selected_frame)))
        do_switch_frame (data->selected_frame, 0, 0, Qnil);
-
-      if (window_changed)
-       /* At least one window has been added or removed.  Run
-          `window-configuration-change-hook' and make sure
-          `window-size-change-functions' get run later.
-
-          We have to do this in order to capture the following
-          scenario: Suppose our frame contains two live windows W1 and
-          W2 and 'set-window-configuration' replaces them by two
-          windows W3 and W4 that were dead the last time
-          run_window_size_change_functions was run.  If W3 and W4 have
-          the same values for their old and new pixel sizes but these
-          values differ from those of W1 and W2, the sizes of our
-          frame's two live windows changed but window_size_changed has
-          no means to detect that fact.
-
-          Obviously, this will get us false positives, for example,
-          when we restore the original configuration with W1 and W2
-          before run_window_size_change_functions gets called.  */
-       {
-         run_window_configuration_change_hook (f);
-         FRAME_WINDOW_CONFIGURATION_CHANGED (f) = true;
-       }
-      else if (buffer_changed)
-       /* At least one window has changed its buffer.  Run
-          `window-configuration-change-hook' only.  */
-       run_window_configuration_change_hook (f);
     }
 
+  FRAME_WINDOW_CHANGE (f) = true;
+
   if (!NILP (new_current_buffer))
     {
       Fset_buffer (new_current_buffer);
@@ -6893,10 +7259,6 @@ save_window_save (Lisp_Object window, struct Lisp_Vector 
*vector, ptrdiff_t i)
       p->pixel_top = make_fixnum (w->pixel_top);
       p->pixel_width = make_fixnum (w->pixel_width);
       p->pixel_height = make_fixnum (w->pixel_height);
-      p->pixel_width_before_size_change
-       = make_fixnum (w->pixel_width_before_size_change);
-      p->pixel_height_before_size_change
-       = make_fixnum (w->pixel_height_before_size_change);
       p->left_col = make_fixnum (w->left_col);
       p->top_line = make_fixnum (w->top_line);
       p->total_cols = make_fixnum (w->total_cols);
@@ -6969,6 +7331,10 @@ save_window_save (Lisp_Object window, struct Lisp_Vector 
*vector, ptrdiff_t i)
 
       if (BUFFERP (w->contents))
        {
+         bool window_point_insertion_type
+           = !NILP (buffer_local_value
+                      (Qwindow_point_insertion_type, w->contents));
+
          /* Save w's value of point in the window configuration.  If w
             is the selected window, then get the value of point from
             the buffer; pointm is garbage in the selected window.  */
@@ -6979,12 +7345,8 @@ save_window_save (Lisp_Object window, struct Lisp_Vector 
*vector, ptrdiff_t i)
          else
            p->pointm = Fcopy_marker (w->pointm, Qnil);
          p->old_pointm = Fcopy_marker (w->old_pointm, Qnil);
-         XMARKER (p->pointm)->insertion_type
-           = !NILP (buffer_local_value /* Don't signal error if void.  */
-                    (Qwindow_point_insertion_type, w->contents));
-         XMARKER (p->old_pointm)->insertion_type
-           = !NILP (buffer_local_value /* Don't signal error if void.  */
-                    (Qwindow_point_insertion_type, w->contents));
+         XMARKER (p->pointm)->insertion_type = window_point_insertion_type;
+         XMARKER (p->old_pointm)->insertion_type = window_point_insertion_type;
 
          p->start = Fcopy_marker (w->start, Qnil);
          p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil;
@@ -7048,8 +7410,7 @@ saved by this function.  */)
   tem = make_uninit_vector (n_windows);
   data->saved_windows = tem;
   for (i = 0; i < n_windows; i++)
-    ASET (tem, i,
-         Fmake_vector (make_fixnum (VECSIZE (struct saved_window)), Qnil));
+    ASET (tem, i, make_nil_vector (VECSIZE (struct saved_window)));
   save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0);
   XSETWINDOW_CONFIGURATION (tem, data);
   return (tem);
@@ -7120,7 +7481,9 @@ reserve for the left marginal area.  Optional third arg 
RIGHT-WIDTH
 does the same for the right marginal area.  A nil width parameter
 means no margin.
 
-Return t if any margin was actually changed and nil otherwise.  */)
+Leave margins unchanged if WINDOW is not large enough to accommodate
+margins of the desired width.  Return t if any margin was actually
+changed and nil otherwise.  */)
   (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width)
 {
   struct window *w = set_window_margins (decode_live_window (window),
@@ -7181,6 +7544,11 @@ set_window_fringes (struct window *w, Lisp_Object 
left_width,
       w->right_fringe_width = right;
       w->fringes_outside_margins = outside;
 
+      /* This is needed to trigger immediate redisplay of the window
+        when its fringes are changed, because fringes are redrawn
+        only if update_window is called, so we must trigger that even
+        if the window's glyph matrices did not change at all.  */
+      windows_or_buffers_changed = 35;
       return w;
     }
   else
@@ -7197,11 +7565,14 @@ the left fringe.  Optional third arg RIGHT-WIDTH 
specifies the right
 fringe width.  If a fringe width arg is nil, that means to use the
 frame's default fringe width.  Default fringe widths can be set with
 the command `set-fringe-style'.
+
 If optional fourth arg OUTSIDE-MARGINS is non-nil, draw the fringes
 outside of the display margins.  By default, fringes are drawn between
 display marginal areas and the text area.
 
-Return t if any fringe was actually changed and nil otherwise.  */)
+Leave fringes unchanged if WINDOW is not large enough to accommodate
+fringes of the desired width.  Return t if any fringe was actually
+changed and nil otherwise.  */)
   (Lisp_Object window, Lisp_Object left_width,
    Lisp_Object right_width, Lisp_Object outside_margins)
 {
@@ -7298,6 +7669,12 @@ set_window_scroll_bars (struct window *w, Lisp_Object 
width,
   wset_horizontal_scroll_bar_type (w, Qnil);
 #endif
 
+  /* This is needed to trigger immediate redisplay of the window when
+     scroll bars are changed, because scroll bars are redisplayed only
+     if more than a single window needs to be considered, see
+     redisplay_internal.  */
+  if (changed)
+    windows_or_buffers_changed = 31;
   return changed ? w : NULL;
 }
 
@@ -7320,6 +7697,8 @@ horizontal scroll bar: bottom, nil, or t where nil means 
to not display
 a horizontal scroll bar on WINDOW and t means to use WINDOW frame's
 horizontal scroll bar type.
 
+If WINDOW is not large enough to accommodate a scroll bar of the
+desired dimension, leave the corresponding scroll bar unchanged.
 Return t if scroll bars were actually changed and nil otherwise.  */)
   (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type,
    Lisp_Object height, Lisp_Object horizontal_type)
@@ -7570,14 +7949,63 @@ and scrolling positions.  */)
   return Qnil;
 }
 
+
+static void init_window_once_for_pdumper (void);
+
 void
 init_window_once (void)
 {
+  minibuf_window = Qnil;
+  staticpro (&minibuf_window);
+
+  selected_window = Qnil;
+  staticpro (&selected_window);
+
+  Vwindow_list = Qnil;
+  staticpro (&Vwindow_list);
+
+  minibuf_selected_window = Qnil;
+  staticpro (&minibuf_selected_window);
+
+  pdumper_do_now_and_after_load (init_window_once_for_pdumper);
+}
+
+static void init_window_once_for_pdumper (void)
+{
+  window_scroll_pixel_based_preserve_x = -1;
+  window_scroll_pixel_based_preserve_y = -1;
+  window_scroll_preserve_hpos = -1;
+  window_scroll_preserve_vpos = -1;
+  PDUMPER_IGNORE (sequence_number);
+
+  PDUMPER_RESET_LV (minibuf_window, Qnil);
+  PDUMPER_RESET_LV (selected_window, Qnil);
+  PDUMPER_RESET_LV (Vwindow_list, Qnil);
+  PDUMPER_RESET_LV (minibuf_selected_window, Qnil);
+
+  /* Hack: if mode_line_in_non_selected_windows is true (which it may
+     be, if we're restoring from a dump) the guts of
+     make_initial_frame will try to access selected_window, which is
+     invalid at this point, and lose.  For the purposes of creating
+     the initial frame and window, this variable must be false.  */
+  bool old_mode_line_in_non_selected_windows;
+
+  /* Snapshot dumped_with_pdumper to suppress compiler warning.  */
+  bool saved_dumped_with_pdumper = dumped_with_pdumper_p ();
+  if (saved_dumped_with_pdumper)
+    {
+      old_mode_line_in_non_selected_windows
+        = mode_line_in_non_selected_windows;
+      mode_line_in_non_selected_windows = false;
+    }
   struct frame *f = make_initial_frame ();
+  if (saved_dumped_with_pdumper)
+    mode_line_in_non_selected_windows =
+      old_mode_line_in_non_selected_windows;
   XSETFRAME (selected_frame, f);
-  Vterminal_frame = selected_frame;
+  old_selected_frame = Vterminal_frame = selected_frame;
   minibuf_window = f->minibuffer_window;
-  selected_window = f->selected_window;
+  old_selected_window = selected_window = f->selected_window;
 }
 
 void
@@ -7597,7 +8025,11 @@ syms_of_window (void)
   Fput (Qscroll_down, Qscroll_command, Qt);
 
   DEFSYM (Qwindow_configuration_change_hook, 
"window-configuration-change-hook");
+  DEFSYM (Qwindow_state_change_hook, "window-state-change-hook");
+  DEFSYM (Qwindow_state_change_functions, "window-state-change-functions");
   DEFSYM (Qwindow_size_change_functions, "window-size-change-functions");
+  DEFSYM (Qwindow_buffer_change_functions, "window-buffer-change-functions");
+  DEFSYM (Qwindow_selection_change_functions, 
"window-selection-change-functions");
   DEFSYM (Qwindowp, "windowp");
   DEFSYM (Qwindow_configuration_p, "window-configuration-p");
   DEFSYM (Qwindow_live_p, "window-live-p");
@@ -7607,6 +8039,7 @@ syms_of_window (void)
   DEFSYM (Qwindow__resize_root_window, "window--resize-root-window");
   DEFSYM (Qwindow__resize_root_window_vertically,
          "window--resize-root-window-vertically");
+  DEFSYM (Qwindow__resize_mini_frame, "window--resize-mini-frame");
   DEFSYM (Qwindow__sanitize_window_sizes, "window--sanitize-window-sizes");
   DEFSYM (Qwindow__pixel_to_total, "window--pixel-to-total");
   DEFSYM (Qsafe, "safe");
@@ -7624,16 +8057,6 @@ syms_of_window (void)
   DEFSYM (Qmode_line_format, "mode-line-format");
   DEFSYM (Qheader_line_format, "header-line-format");
 
-  staticpro (&Vwindow_list);
-
-  minibuf_selected_window = Qnil;
-  staticpro (&minibuf_selected_window);
-
-  window_scroll_pixel_based_preserve_x = -1;
-  window_scroll_pixel_based_preserve_y = -1;
-  window_scroll_preserve_hpos = -1;
-  window_scroll_preserve_vpos = -1;
-
   DEFVAR_LISP ("temp-buffer-show-function", Vtemp_buffer_show_function,
               doc: /* Non-nil means call as function to display a help buffer.
 The function is called with one argument, the buffer to be displayed.
@@ -7680,26 +8103,98 @@ on their symbols to be controlled by this variable.  
*/);
   DEFVAR_LISP ("window-point-insertion-type", Vwindow_point_insertion_type,
               doc: /* Type of marker to use for `window-point'.  */);
   Vwindow_point_insertion_type = Qnil;
-  DEFSYM (Qwindow_point_insertion_type, "window_point_insertion_type");
-
-  DEFVAR_LISP ("window-configuration-change-hook",
-              Vwindow_configuration_change_hook,
-              doc: /* Functions to call when window configuration changes.
-The buffer-local value is run once per window, with the relevant window
-selected; while the global value is run only once for the modified frame,
-with the relevant frame selected.  */);
-  Vwindow_configuration_change_hook = Qnil;
+  DEFSYM (Qwindow_point_insertion_type, "window-point-insertion-type");
+
+  DEFVAR_LISP ("window-buffer-change-functions", 
Vwindow_buffer_change_functions,
+              doc: /* Functions called during redisplay when window buffers 
have changed.
+The value should be a list of functions that take one argument.
+
+Functions specified buffer-locally are called for each window showing
+the corresponding buffer if and only if that window has been added or
+changed its buffer since the last redisplay.  In this case the window
+is passed as argument.
+
+Functions specified by the default value are called for each frame if
+at least one window on that frame has been added, deleted or changed
+its buffer since the last redisplay.  In this case the frame is passed
+as argument.  */);
+  Vwindow_buffer_change_functions = Qnil;
 
   DEFVAR_LISP ("window-size-change-functions", Vwindow_size_change_functions,
-    doc: /* Functions called during redisplay, if window sizes have changed.
+              doc: /* Functions called during redisplay when window sizes have 
changed.
 The value should be a list of functions that take one argument.
-During the first part of redisplay, for each frame, if any of its windows
-have changed size since the last redisplay, or have been split or deleted,
-all the functions in the list are called, with the frame as argument.
-If redisplay decides to resize the minibuffer window, it calls these
-functions on behalf of that as well.  */);
+
+Functions specified buffer-locally are called for each window showing
+the corresponding buffer if and only if that window has been added or
+changed its buffer or its total or body size since the last redisplay.
+In this case the window is passed as argument.
+
+Functions specified by the default value are called for each frame if
+at least one window on that frame has been added or changed its buffer
+or its total or body size since the last redisplay.  In this case the
+frame is passed as argument.  */);
   Vwindow_size_change_functions = Qnil;
 
+  DEFVAR_LISP ("window-selection-change-functions", 
Vwindow_selection_change_functions,
+              doc: /* Functions called during redisplay when the selected 
window has changed.
+The value should be a list of functions that take one argument.
+
+Functions specified buffer-locally are called for each window showing
+the corresponding buffer if and only if that window has been selected
+or deselected since the last redisplay.  In this case the window is
+passed as argument.
+
+Functions specified by the default value are called for each frame if
+the frame's selected window has changed since the last redisplay.  In
+this case the frame is passed as argument.  */);
+  Vwindow_selection_change_functions = Qnil;
+
+  DEFVAR_LISP ("window-state-change-functions", Vwindow_state_change_functions,
+              doc: /* Functions called during redisplay when the window state 
changed.
+The value should be a list of functions that take one argument.
+
+Functions specified buffer-locally are called for each window showing
+the corresponding buffer if and only if that window has been added,
+resized, changed its buffer or has been (de-)selected since the last
+redisplay.  In this case the window is passed as argument.
+
+Functions specified by the default value are called for each frame if
+at least one window on that frame has been added, deleted, changed its
+buffer or its total or body size or the frame has been (de-)selected,
+its selected window has changed or the window state change flag has
+been set for this frame since the last redisplay.  In this case the
+frame is passed as argument.  */);
+  Vwindow_state_change_functions = Qnil;
+
+  DEFVAR_LISP ("window-state-change-hook", Vwindow_state_change_hook,
+              doc: /* Functions called during redisplay when the window state 
changed.
+The value should be a list of functions that take no argument.
+
+This hook is called during redisplay when at least one window has been
+added, deleted, (de-)selected, changed its buffer or its total or body
+size or the window state change flag has been set for at least one
+frame.  This hook is called after all other window change functions
+have been run and should be used only if a function should react to
+changes that happened on at least two frames since last redisplay or
+the function intends to change the window configuration.  */);
+  Vwindow_state_change_hook = Qnil;
+
+  DEFVAR_LISP ("window-configuration-change-hook", 
Vwindow_configuration_change_hook,
+              doc: /* Functions called during redisplay when window 
configuration has changed.
+The value should be a list of functions that take no argument.
+
+Functions specified buffer-locally are called for each window showing
+the corresponding buffer if at least one window on that frame has been
+added, deleted or changed its buffer or its total or body size since
+the last redisplay.  Each call is performed with the window showing
+the buffer temporarily selected.
+
+Functions specified by the default value are called for each frame if
+at least one window on that frame has been added, deleted or changed
+its buffer or its total or body size since the last redisplay.  Each
+call is performed with the frame temporarily selected.  */);
+  Vwindow_configuration_change_hook = Qnil;
+
   DEFVAR_LISP ("recenter-redisplay", Vrecenter_redisplay,
               doc: /* Non-nil means `recenter' redraws entire frame.
 If this option is non-nil, then the `recenter' command with a nil
@@ -7811,6 +8306,7 @@ displayed after a scrolling operation to be somewhat 
inaccurate.  */);
   Vfast_but_imprecise_scrolling = false;
 
   defsubr (&Sselected_window);
+  defsubr (&Sold_selected_window);
   defsubr (&Sminibuffer_window);
   defsubr (&Swindow_minibuffer_p);
   defsubr (&Swindowp);
@@ -7820,10 +8316,12 @@ displayed after a scrolling operation to be somewhat 
inaccurate.  */);
   defsubr (&Sframe_root_window);
   defsubr (&Sframe_first_window);
   defsubr (&Sframe_selected_window);
+  defsubr (&Sframe_old_selected_window);
   defsubr (&Sset_frame_selected_window);
   defsubr (&Spos_visible_in_window_p);
   defsubr (&Swindow_line_height);
   defsubr (&Swindow_buffer);
+  defsubr (&Swindow_old_buffer);
   defsubr (&Swindow_parent);
   defsubr (&Swindow_top_child);
   defsubr (&Swindow_left_child);
@@ -7834,8 +8332,10 @@ displayed after a scrolling operation to be somewhat 
inaccurate.  */);
   defsubr (&Swindow_use_time);
   defsubr (&Swindow_pixel_width);
   defsubr (&Swindow_pixel_height);
-  defsubr (&Swindow_pixel_width_before_size_change);
-  defsubr (&Swindow_pixel_height_before_size_change);
+  defsubr (&Swindow_old_pixel_width);
+  defsubr (&Swindow_old_pixel_height);
+  defsubr (&Swindow_old_body_pixel_width);
+  defsubr (&Swindow_old_body_pixel_height);
   defsubr (&Swindow_total_width);
   defsubr (&Swindow_total_height);
   defsubr (&Swindow_normal_size);
diff --git a/src/window.h b/src/window.h
index cc0b6b6..4235a6e 100644
--- a/src/window.h
+++ b/src/window.h
@@ -1,5 +1,5 @@
 /* Window definitions for GNU Emacs.
-   Copyright (C) 1985-1986, 1993, 1995, 1997-2018 Free Software
+   Copyright (C) 1985-1986, 1993, 1995, 1997-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -24,57 +24,69 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 INLINE_HEADER_BEGIN
 
-/* Windows are allocated as if they were vectors, but then the
-Lisp data type is changed to Lisp_Window.  They are garbage
-collected along with the vectors.
+/* Windows are allocated as if they were vectors, but then the Lisp
+data type is changed to Lisp_Window.  They are garbage collected along
+with the vectors.
 
 All windows in use are arranged into a tree, with pointers up and down.
 
-Windows that are leaves of the tree are actually displayed
-and show the contents of buffers.  Windows that are not leaves
-are used for representing the way groups of leaf windows are
-arranged on the frame.  Leaf windows never become non-leaves.
-They are deleted only by calling delete-window on them (but
-this can be done implicitly).  Combination windows can be created
-and deleted at any time.
-
-A leaf window has a buffer stored in contents field and markers in its start
-and pointm fields.  Non-leaf windows have nil in the latter two fields.
-
-Non-leaf windows are either vertical or horizontal combinations.
-
-A vertical combination window has children that are arranged on the frame
-one above the next.  Its contents field points to the uppermost child.
-The parent field of each of the children points to the vertical
-combination window.  The next field of each child points to the
-child below it, or is nil for the lowest child.  The prev field
-of each child points to the child above it, or is nil for the
-highest child.
-
-A horizontal combination window has children that are side by side.
-Its contents field points to the leftmost child.  In each child
-the next field points to the child to the right and the prev field
-points to the child to the left.
-
-The children of a vertical combination window may be leaf windows
-or horizontal combination windows.  The children of a horizontal
-combination window may be leaf windows or vertical combination windows.
-
-At the top of the tree are two windows which have nil as parent.
-The second of these is minibuf_window.  The first one manages all
-the frame area that is not minibuffer, and is called the root window.
-Different windows can be the root at different times;
-initially the root window is a leaf window, but if more windows
-are created then that leaf window ceases to be root and a newly
-made combination window becomes root instead.
-
-In any case, on screens which have an ordinary window and a
-minibuffer, prev of the minibuf window is the root window and next of
-the root window is the minibuf window.  On minibufferless screens or
-minibuffer-only screens, the root window and the minibuffer window are
-one and the same, so its prev and next members are nil.
-
-A dead window has its contents field set to nil.  */
+Windows that are leaves of the tree are actually displayed and show
+the contents of buffers.  Windows that are not leaves are used for
+representing the way groups of leaf windows are arranged on the frame.
+Leaf windows never become non-leaves.  They are deleted only by
+calling `delete-window' on them (but this can be done implicitly).
+Non-leaf windows never become leaf windows and can be created and
+deleted at any time by the window management code.  Non-leaf windows
+can be seen but not directly manipulated by Lisp functions.
+
+A leaf window has a buffer stored in its contents field and markers in
+its 'start' and 'pointm' fields.  Non-leaf windows have nil in the
+latter two fields.  Non-leaf windows are either vertical or horizontal
+combinations.
+
+A vertical combination window has children that are arranged on the
+frame one above the next.  Its 'contents' field points to the
+uppermost child.  The 'parent' field of each of the children points to
+the vertical combination window.  The 'next' field of each child
+points to the child below it, or is nil for the lowest child.  The
+'prev' field of each child points to the child above it, or is nil for
+the highest child.
+
+A horizontal combination window has children that are arranged side by
+side.  Its 'contents' field points to the leftmost child.  In each
+child the 'next' field points to the child to the right and the 'prev'
+field points to the child to the left.
+
+On each frame there are at least one and at most two windows which
+have nil as parent.  The second of these, if present, is the frame's
+minibuffer window and shows the minibuffer or the echo area.  The
+first one manages the remaining frame area and is called the frame's
+root window.  Different windows can be the root at different times;
+initially the root window is a leaf window, but if more windows are
+created, then that leaf window ceases to be root and a newly made
+combination window becomes the root instead.
+
+On frames which have an ordinary window and a minibuffer window,
+'prev' of the minibuffer window is the root window and 'next' of the
+root window is the minibuffer window.  On minibuffer-less frames there
+is only a root window and 'next' of the root window is nil.  On
+minibuffer-only frames, the root window and the minibuffer window are
+one and the same, so its 'prev' and 'next' members are nil.  In any
+case, 'prev' of a root window and 'next' of a minibuffer window are
+always nil.
+
+In Lisp parlance, leaf windows are called "live windows" and non-leaf
+windows are called "internal windows".  Together, live and internal
+windows form the set of "valid windows".  A window that has been
+deleted is considered "dead" regardless of whether it formerly was a
+leaf or a non-leaf window.  A dead window has its 'contents' field set
+to nil.
+
+Frames may also contain pseudo windows, windows that are not exposed
+directly to Lisp code.  Pseudo windows are currently either used to
+display the menu bar or the tool bar (when Emacs uses toolkits that
+don't display their own menu bar and tool bar) or a tooltip in a
+tooltip frame (when tooltips are not display by the toolkit).  */
 
 struct cursor_pos
 {
@@ -93,29 +105,48 @@ struct window
     /* The frame this window is on.  */
     Lisp_Object frame;
 
-    /* Following (to right or down) and preceding (to left or up) child
-       at same level of tree.  */
+    /* Following (to right or down) and preceding (to left or up)
+       child at same level of tree.  Whether this is left/right or
+       up/down is determined by the parent window's 'horizontal' flag,
+       see below.  On a frame that is neither a minibuffer-only nor a
+       minibuffer-less frame, 'next' of the root window points to the
+       frame's minibuffer window and 'prev' of the minibuffer window
+       points to the frame's root window.  In all other cases, 'next'
+       of the root window and 'prev' of the minibuffer window, if
+       present, are nil.  'prev' of the root window and 'next' of the
+       minibuffer window are always nil.  */
     Lisp_Object next;
     Lisp_Object prev;
 
-    /* The window this one is a child of.  */
+    /* The window this one is a child of.  For the root and a
+       minibuffer window this is always nil.  */
     Lisp_Object parent;
 
-    /* The normal size of the window.  These are fractions, but we do
-       not use C doubles to avoid creating new Lisp_Float objects while
-       interfacing Lisp in Fwindow_normal_size.  */
+    /* The "normal" size of the window.  These are fractions, but we
+       do not use C doubles to avoid creating new Lisp_Float objects
+       while interfacing Lisp in Fwindow_normal_size.  */
     Lisp_Object normal_lines;
     Lisp_Object normal_cols;
 
-    /* New sizes of the window.  Note that Lisp code may set new_normal
-       to something beyond an integer, so C int can't be used here.  */
+    /* The new sizes of the window as proposed by the window resizing
+       functions.  Note that Lisp code may set new_normal to something
+       beyond an integer, so C int can't be used here.  */
     Lisp_Object new_total;
     Lisp_Object new_normal;
     Lisp_Object new_pixel;
 
-    /* May be buffer, window, or nil.  */
+    /* For a leaf window or a tooltip window this is the buffer shown
+       in the window; for a combination window this is the first of
+       its child windows; for a pseudo window showing the menu bar or
+       tool bar this is nil.  It is a buffer for a minibuffer window
+       as well.  */
     Lisp_Object contents;
 
+    /* The old buffer of this window, set to this window's buffer by
+       run_window_change_functions every time it sees this window.
+       Unused for internal windows.  */
+    Lisp_Object old_buffer;
+
     /* A marker pointing to where in the text to start displaying.
        BIDI Note: This is the _logical-order_ start, i.e. the smallest
        buffer position visible in the window, not necessarily the
@@ -191,7 +222,7 @@ struct window
 
     /* The two Lisp_Object fields below are marked in a special way,
        which is why they're placed after `current_matrix'.  */
-    /* Alist of <buffer, window-start, window-point> triples listing
+    /* A list of <buffer, window-start, window-point> triples listing
        buffers previously shown in this window.  */
     Lisp_Object prev_buffers;
     /* List of buffers re-shown in this window.  */
@@ -203,6 +234,14 @@ struct window
     /* Unique number of window assigned when it was created.  */
     EMACS_INT sequence_number;
 
+    /* The change stamp of this window.  Set to 0 when the window is
+       created, it is set to its frame's change stamp every time
+       run_window_change_functions is run on that frame with this
+       window live.  It is left alone when the window exists only
+       within a window configuration.  Not useful for internal
+       windows.  */
+    int change_stamp;
+
     /* The upper left corner pixel coordinates of this window, as
        integers relative to upper left corner of frame = 0, 0.  */
     int pixel_left;
@@ -217,10 +256,13 @@ struct window
     int pixel_width;
     int pixel_height;
 
-    /* The pixel sizes of the window at the last time
-       `window-size-change-functions' was run.  */
-    int pixel_width_before_size_change;
-    int pixel_height_before_size_change;
+    /* The pixel and pixel body sizes of the window at the last time
+       run_window_change_functions was run with this window live.  Not
+       useful for internal windows.  */
+    int old_pixel_width;
+    int old_pixel_height;
+    int old_body_pixel_width;
+    int old_body_pixel_height;
 
     /* The size of the window.  */
     int total_cols;
@@ -239,11 +281,11 @@ struct window
 
     /* Displayed buffer's text modification events counter as of last time
        display completed.  */
-    EMACS_INT last_modified;
+    modiff_count last_modified;
 
     /* Displayed buffer's overlays modification events counter as of last
        complete update.  */
-    EMACS_INT last_overlay_modified;
+    modiff_count last_overlay_modified;
 
     /* Value of point at that time.  Since this is a position in a buffer,
        it should be positive.  */
@@ -697,7 +739,7 @@ wset_next_buffers (struct window *w, Lisp_Object val)
 #endif
 
 /* True if W is a tool bar window.  */
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
 #define WINDOW_TOOL_BAR_P(W) \
   (WINDOWP (WINDOW_XFRAME (W)->tool_bar_window) \
    && (W) == XWINDOW (WINDOW_XFRAME (W)->tool_bar_window))
@@ -1021,11 +1063,11 @@ extern Lisp_Object window_from_coordinates (struct 
frame *, int, int,
 extern void resize_frame_windows (struct frame *, int, bool, bool);
 extern void restore_window_configuration (Lisp_Object);
 extern void delete_all_child_windows (Lisp_Object);
-extern void grow_mini_window (struct window *, int, bool);
-extern void shrink_mini_window (struct window *, bool);
+extern void grow_mini_window (struct window *, int);
+extern void shrink_mini_window (struct window *);
 extern int window_relative_x_coord (struct window *, enum window_part, int);
 
-void run_window_size_change_functions (Lisp_Object);
+void run_window_change_functions (void);
 
 /* Make WINDOW display BUFFER.  RUN_HOOKS_P means it's allowed
    to run hooks.  See make_frame for a case where it's not allowed.  */
diff --git a/src/xdisp.c b/src/xdisp.c
index 7b0ca47..a88fc69 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1,6 +1,6 @@
 /* Display generation from window structure and buffer text.
 
-Copyright (C) 1985-1988, 1993-1995, 1997-2018 Free Software Foundation,
+Copyright (C) 1985-1988, 1993-1995, 1997-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
@@ -2786,6 +2786,7 @@ init_iterator (struct it *it, struct window *w,
               struct glyph_row *row, enum face_id base_face_id)
 {
   enum face_id remapped_base_face_id = base_face_id;
+  int body_width = 0, body_height = 0;
 
   /* Some precondition checks.  */
   eassert (w != NULL && it != NULL);
@@ -2962,7 +2963,7 @@ init_iterator (struct it *it, struct window *w,
     {
       /* Mode lines, menu bar in terminal frames.  */
       it->first_visible_x = 0;
-      it->last_visible_x = WINDOW_PIXEL_WIDTH (w);
+      it->last_visible_x = body_width = WINDOW_PIXEL_WIDTH (w);
     }
   else
     {
@@ -2982,8 +2983,12 @@ init_iterator (struct it *it, struct window *w,
       else
        it->first_visible_x =
          window_hscroll_limited (w, it->f) * FRAME_COLUMN_WIDTH (it->f);
-      it->last_visible_x = (it->first_visible_x
-                           + window_box_width (w, TEXT_AREA));
+
+      body_width = window_box_width (w, TEXT_AREA);
+      if (!w->pseudo_window_p && !MINI_WINDOW_P (w)
+         && body_width != w->old_body_pixel_width)
+       FRAME_WINDOW_CHANGE (it->f) = true;
+      it->last_visible_x = it->first_visible_x + body_width;
 
       /* If we truncate lines, leave room for the truncation glyph(s) at
         the right margin.  Otherwise, leave room for the continuation
@@ -2997,7 +3002,8 @@ init_iterator (struct it *it, struct window *w,
        }
 
       it->header_line_p = window_wants_header_line (w);
-      it->current_y = WINDOW_HEADER_LINE_HEIGHT (w) + w->vscroll;
+      body_height = WINDOW_HEADER_LINE_HEIGHT (w);
+      it->current_y =  body_height + w->vscroll;
     }
 
   /* Leave room for a border glyph.  */
@@ -3006,6 +3012,10 @@ init_iterator (struct it *it, struct window *w,
     it->last_visible_x -= 1;
 
   it->last_visible_y = window_text_bottom_y (w);
+  body_height += it->last_visible_y;
+  if (!w->pseudo_window_p && !MINI_WINDOW_P (w)
+      && body_height != w->old_body_pixel_height)
+    FRAME_WINDOW_CHANGE (it->f) = true;
 
   /* For mode lines and alike, arrange for the first glyph having a
      left box line if the face specifies a box.  */
@@ -3751,7 +3761,7 @@ compute_display_string_pos (struct text_pos *position,
          || !EQ (Fget_char_property (make_fixnum (charpos - 1), Qdisplay,
                                      object),
                  spec))
-      && (rv = handle_display_spec (NULL, spec, object, Qnil, &tpos, bufpos,
+      && (rv = handle_display_spec (NULL, spec, object1, Qnil, &tpos, bufpos,
                                    frame_window_p)))
     {
       if (rv == 2)
@@ -3778,7 +3788,7 @@ compute_display_string_pos (struct text_pos *position,
     if (!STRINGP (object))
       bufpos = CHARPOS (tpos);
   } while (NILP (spec)
-          || !(rv = handle_display_spec (NULL, spec, object, Qnil, &tpos,
+          || !(rv = handle_display_spec (NULL, spec, object1, Qnil, &tpos,
                                          bufpos, frame_window_p)));
   if (rv == 2)
     *disp_prop = 2;
@@ -10558,7 +10568,7 @@ message_log_check_duplicate (ptrdiff_t prev_bol_byte, 
ptrdiff_t this_bol_byte)
 
 
 /* Display an echo area message M with a specified length of NBYTES
-   bytes.  The string may include null characters.  If M is not a
+   bytes.  The string may include NUL characters.  If M is not a
    string, clear out any existing message, and let the mini-buffer
    text show through.
 
@@ -10662,7 +10672,7 @@ message3_nolog (Lisp_Object m)
 }
 
 
-/* Display a null-terminated echo area message M.  If M is 0, clear
+/* Display a NUL-terminated echo area message M.  If M is 0, clear
    out any existing message, and let the mini-buffer text show through.
 
    The buffer M must continue to exist until after the echo area gets
@@ -10977,7 +10987,7 @@ with_echo_area_buffer_unwind_data (struct window *w)
   Vwith_echo_area_save_vector = Qnil;
 
   if (NILP (vector))
-    vector = Fmake_vector (make_fixnum (11), Qnil);
+    vector = make_nil_vector (11);
 
   XSETBUFFER (tmp, current_buffer); ASET (vector, i, tmp); ++i;
   ASET (vector, i, Vdeactivate_mark); ++i;
@@ -11025,15 +11035,15 @@ unwind_with_echo_area_buffer (Lisp_Object vector)
       buffer = AREF (vector, 4);
 
       wset_buffer (w, buffer);
-      set_marker_both (w->pointm, buffer,
-                      XFIXNAT (AREF (vector, 5)),
-                      XFIXNAT (AREF (vector, 6)));
-      set_marker_both (w->old_pointm, buffer,
-                      XFIXNAT (AREF (vector, 7)),
-                      XFIXNAT (AREF (vector, 8)));
-      set_marker_both (w->start, buffer,
-                      XFIXNAT (AREF (vector, 9)),
-                      XFIXNAT (AREF (vector, 10)));
+      set_marker_restricted_both (w->pointm, buffer,
+                                 XFIXNAT (AREF (vector, 5)),
+                                 XFIXNAT (AREF (vector, 6)));
+      set_marker_restricted_both (w->old_pointm, buffer,
+                                 XFIXNAT (AREF (vector, 7)),
+                                 XFIXNAT (AREF (vector, 8)));
+      set_marker_restricted_both (w->start, buffer,
+                                 XFIXNAT (AREF (vector, 9)),
+                                 XFIXNAT (AREF (vector, 10)));
     }
 
   Vwith_echo_area_save_vector = vector;
@@ -11249,15 +11259,10 @@ bool
 resize_mini_window (struct window *w, bool exact_p)
 {
   struct frame *f = XFRAME (w->frame);
-  bool window_height_changed_p = false;
+  int old_height = WINDOW_PIXEL_HEIGHT (w);
 
   eassert (MINI_WINDOW_P (w));
 
-  /* By default, start display at the beginning.  */
-  set_marker_both (w->start, w->contents,
-                  BUF_BEGV (XBUFFER (w->contents)),
-                  BUF_BEGV_BYTE (XBUFFER (w->contents)));
-
   /* Don't resize windows while redisplaying a window; it would
      confuse redisplay functions when the size of the window they are
      displaying changes from under them.  Such a resizing can happen,
@@ -11268,19 +11273,30 @@ resize_mini_window (struct window *w, bool exact_p)
     return false;
 
   /* Nil means don't try to resize.  */
-  if (NILP (Vresize_mini_windows)
+  if ((NILP (Vresize_mini_windows)
+       && (NILP (resize_mini_frames) || !FRAME_MINIBUF_ONLY_P (f)))
       || (FRAME_X_P (f) && FRAME_X_OUTPUT (f) == NULL))
     return false;
 
-  if (!FRAME_MINIBUF_ONLY_P (f))
+  /* By default, start display at the beginning.  */
+  set_marker_both (w->start, w->contents,
+                  BUF_BEGV (XBUFFER (w->contents)),
+                  BUF_BEGV_BYTE (XBUFFER (w->contents)));
+
+  if (FRAME_MINIBUF_ONLY_P (f))
+    {
+      if (!NILP (resize_mini_frames))
+       safe_call1 (Qwindow__resize_mini_frame, WINDOW_FRAME (w));
+    }
+  else
     {
       struct it it;
-      int total_height = (WINDOW_PIXEL_HEIGHT (XWINDOW (FRAME_ROOT_WINDOW (f)))
-                         + WINDOW_PIXEL_HEIGHT (w));
+      int old_height = WINDOW_PIXEL_HEIGHT (w);
       int unit = FRAME_LINE_HEIGHT (f);
       int height, max_height;
       struct text_pos start;
       struct buffer *old_current_buffer = NULL;
+      int windows_height = FRAME_WINDOWS_HEIGHT (f);
 
       if (current_buffer != XBUFFER (w->contents))
        {
@@ -11292,14 +11308,14 @@ resize_mini_window (struct window *w, bool exact_p)
 
       /* Compute the max. number of lines specified by the user.  */
       if (FLOATP (Vmax_mini_window_height))
-       max_height = XFLOAT_DATA (Vmax_mini_window_height) * total_height;
+       max_height = XFLOAT_DATA (Vmax_mini_window_height) * windows_height;
       else if (FIXNUMP (Vmax_mini_window_height))
        max_height = XFIXNUM (Vmax_mini_window_height) * unit;
       else
-       max_height = total_height / 4;
+       max_height = windows_height / 4;
 
       /* Correct that max. height if it's bogus.  */
-      max_height = clip_to_bounds (unit, max_height, total_height);
+      max_height = clip_to_bounds (unit, max_height, windows_height);
 
       /* Find out the height of the text in the window.  */
       if (it.line_wrap == TRUNCATE)
@@ -11325,63 +11341,27 @@ resize_mini_window (struct window *w, bool exact_p)
        }
       else
        SET_TEXT_POS (start, BEGV, BEGV_BYTE);
+
       SET_MARKER_FROM_TEXT_POS (w->start, start);
 
       if (EQ (Vresize_mini_windows, Qgrow_only))
        {
          /* Let it grow only, until we display an empty message, in which
             case the window shrinks again.  */
-         if (height > WINDOW_PIXEL_HEIGHT (w))
-           {
-             int old_height = WINDOW_PIXEL_HEIGHT (w);
-
-             FRAME_WINDOWS_FROZEN (f) = true;
-             grow_mini_window (w, height - WINDOW_PIXEL_HEIGHT (w), true);
-             window_height_changed_p = WINDOW_PIXEL_HEIGHT (w) != old_height;
-           }
-         else if (height < WINDOW_PIXEL_HEIGHT (w)
-                  && (exact_p || BEGV == ZV))
-           {
-             int old_height = WINDOW_PIXEL_HEIGHT (w);
-
-             FRAME_WINDOWS_FROZEN (f) = false;
-             shrink_mini_window (w, true);
-             window_height_changed_p = WINDOW_PIXEL_HEIGHT (w) != old_height;
-           }
-       }
-      else
-       {
-         /* Always resize to exact size needed.  */
-         if (height > WINDOW_PIXEL_HEIGHT (w))
-           {
-             int old_height = WINDOW_PIXEL_HEIGHT (w);
-
-             FRAME_WINDOWS_FROZEN (f) = true;
-             grow_mini_window (w, height - WINDOW_PIXEL_HEIGHT (w), true);
-             window_height_changed_p = WINDOW_PIXEL_HEIGHT (w) != old_height;
-           }
-         else if (height < WINDOW_PIXEL_HEIGHT (w))
-           {
-             int old_height = WINDOW_PIXEL_HEIGHT (w);
-
-             FRAME_WINDOWS_FROZEN (f) = false;
-             shrink_mini_window (w, true);
-
-             if (height)
-               {
-                 FRAME_WINDOWS_FROZEN (f) = true;
-                 grow_mini_window (w, height - WINDOW_PIXEL_HEIGHT (w), true);
-               }
-
-             window_height_changed_p = WINDOW_PIXEL_HEIGHT (w) != old_height;
-           }
+         if (height > old_height)
+           grow_mini_window (w, height - old_height);
+         else if (height < old_height && (exact_p || BEGV == ZV))
+           shrink_mini_window (w);
        }
+      else if (height != old_height)
+       /* Always resize to exact size needed.  */
+       grow_mini_window (w, height - old_height);
 
       if (old_current_buffer)
        set_buffer_internal (old_current_buffer);
     }
 
-  return window_height_changed_p;
+  return WINDOW_PIXEL_HEIGHT (w) != old_height;
 }
 
 
@@ -11850,7 +11830,7 @@ format_mode_line_unwind_data (struct frame 
*target_frame,
   Vmode_line_unwind_vector = Qnil;
 
   if (NILP (vector))
-    vector = Fmake_vector (make_fixnum (10), Qnil);
+    vector = make_nil_vector (12);
 
   ASET (vector, 0, make_fixnum (mode_line_target));
   ASET (vector, 1, make_fixnum (MODE_LINE_NOPROP_LEN (0)));
@@ -11867,12 +11847,24 @@ format_mode_line_unwind_data (struct frame 
*target_frame,
   ASET (vector, 7, owin);
   if (target_frame)
     {
+      Lisp_Object buffer = XWINDOW (target_frame->selected_window)->contents;
+      struct buffer *b = XBUFFER (buffer);
+      struct buffer *cb = current_buffer;
+
       /* Similarly to `with-selected-window', if the operation selects
         a window on another frame, we must restore that frame's
         selected window, and (for a tty) the top-frame.  */
       ASET (vector, 8, target_frame->selected_window);
       if (FRAME_TERMCAP_P (target_frame))
        ASET (vector, 9, FRAME_TTY (target_frame)->top_frame);
+
+      /* If we select a window on another frame, make sure that that
+        selection does not leave its buffer's point modified when
+        unwinding (Bug#32777).  */
+      ASET (vector, 10, buffer);
+      current_buffer = b;
+      ASET (vector, 11, build_marker (current_buffer, PT, PT_BYTE));
+      current_buffer = cb;
     }
 
   return vector;
@@ -11912,6 +11904,24 @@ unwind_format_mode_line (Lisp_Object vector)
        }
 
       Fselect_window (old_window, Qt);
+
+      /* Restore point of target_frame_window's buffer (Bug#32777).
+        But do this only after old_window has been reselected to
+        avoid that the window point of target_frame_window moves.  */
+      if (!NILP (target_frame_window))
+       {
+         Lisp_Object buffer = AREF (vector, 10);
+
+         if (BUFFER_LIVE_P (XBUFFER (buffer)))
+           {
+             struct buffer *cb = current_buffer;
+
+             current_buffer = XBUFFER (buffer);
+             set_point_from_marker (AREF (vector, 11));
+             ASET (vector, 11, Qnil);
+             current_buffer = cb;
+           }
+       }
     }
 
   if (!NILP (AREF (vector, 6)))
@@ -12022,19 +12032,26 @@ x_consider_frame_title (Lisp_Object frame)
       /* Set global variable indicating that multiple frames exist.  */
       multiple_frames = CONSP (tail);
 
-      /* Switch to the buffer of selected window of the frame.  Set up
-        mode_line_target so that display_mode_element will output into
-        mode_line_noprop_buf; then display the title.  */
-      record_unwind_protect (unwind_format_mode_line,
-                            format_mode_line_unwind_data
-                              (f, current_buffer, selected_window, false));
       /* select-frame calls resize_mini_window, which could resize the
         mini-window and by that undo the effect of this redisplay
         cycle wrt minibuffer and echo-area display.  Binding
         inhibit-redisplay to t makes the call to resize_mini_window a
         no-op, thus avoiding the adverse side effects.  */
+
+      /* The following was moved before the record_unwind_protect form
+        below to inhibit redisplay also when restoring the selected
+        window/frame: This avoids that resize_mini_window sizes back
+        the minibuffer window of a temporarily selected frame.  See
+        Bug#34317.  */
       specbind (Qinhibit_redisplay, Qt);
 
+      /* Switch to the buffer of selected window of the frame.  Set up
+        mode_line_target so that display_mode_element will output into
+        mode_line_noprop_buf; then display the title.  */
+      record_unwind_protect (unwind_format_mode_line,
+                            format_mode_line_unwind_data
+                              (f, current_buffer, selected_window, false));
+
       Fselect_window (f->selected_window, Qt);
       set_buffer_internal_1
        (XBUFFER (XWINDOW (f->selected_window)->contents));
@@ -12170,8 +12187,6 @@ prepare_menu_bars (void)
              && !XBUFFER (w->contents)->text->redisplay)
            continue;
 
-         run_window_size_change_functions (frame);
-
          if (FRAME_PARENT_FRAME (f))
            continue;
 
@@ -12222,8 +12237,7 @@ update_menu_bar (struct frame *f, bool save_match_data, 
bool hooks_run)
 
   if (FRAME_WINDOW_P (f)
       ?
-#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
-    || defined (HAVE_NS) || defined (USE_GTK)
+#ifdef HAVE_EXT_MENU_BAR
       FRAME_EXTERNAL_MENU_BAR (f)
 #else
       FRAME_MENU_BAR_LINES (f) > 0
@@ -12276,8 +12290,7 @@ update_menu_bar (struct frame *f, bool save_match_data, 
bool hooks_run)
          fset_menu_bar_items (f, menu_bar_items (FRAME_MENU_BAR_ITEMS (f)));
 
          /* Redisplay the menu bar in case we changed it.  */
-#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
-    || defined (HAVE_NS) || defined (USE_GTK)
+#ifdef HAVE_EXT_MENU_BAR
          if (FRAME_WINDOW_P (f))
             {
 #if defined (HAVE_NS)
@@ -12291,11 +12304,11 @@ update_menu_bar (struct frame *f, bool 
save_match_data, bool hooks_run)
            /* On a terminal screen, the menu bar is an ordinary screen
               line, and this makes it get updated.  */
            w->update_mode_line = true;
-#else /* ! (USE_X_TOOLKIT || HAVE_NTGUI || HAVE_NS || USE_GTK) */
+#else /* ! (HAVE_EXT_MENU_BAR) */
          /* In the non-toolkit version, the menu bar is an ordinary screen
             line, and this makes it get updated.  */
          w->update_mode_line = true;
-#endif /* ! (USE_X_TOOLKIT || HAVE_NTGUI || HAVE_NS || USE_GTK) */
+#endif /* HAVE_EXT_MENU_BAR */
 
          unbind_to (count, Qnil);
          set_buffer_internal_1 (prev);
@@ -12333,7 +12346,7 @@ fast_set_selected_frame (Lisp_Object frame)
 static void
 update_tool_bar (struct frame *f, bool save_match_data)
 {
-#if defined (USE_GTK) || defined (HAVE_NS)
+#ifdef HAVE_EXT_TOOL_BAR
   bool do_update = FRAME_EXTERNAL_TOOL_BAR (f);
 #else
   bool do_update = (WINDOWP (f->tool_bar_window)
@@ -12418,7 +12431,7 @@ update_tool_bar (struct frame *f, bool save_match_data)
     }
 }
 
-#if ! defined (USE_GTK) && ! defined (HAVE_NS)
+#ifndef HAVE_EXT_TOOL_BAR
 
 /* Set F->desired_tool_bar_string to a Lisp string representing frame
    F's desired tool-bar contents.  F->tool_bar_items must have
@@ -12495,7 +12508,8 @@ build_desired_tool_bar_string (struct frame *f)
 
       /* Compute margin and relief to draw.  */
       relief = (tool_bar_button_relief >= 0
-               ? tool_bar_button_relief
+               ? min (tool_bar_button_relief,
+                      min (INT_MAX, MOST_POSITIVE_FIXNUM))
                : DEFAULT_TOOL_BAR_BUTTON_RELIEF);
       hmargin = vmargin = relief;
 
@@ -12752,7 +12766,7 @@ tool_bar_height (struct frame *f, int *n_rows, bool 
pixelwise)
     return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f);
 }
 
-#endif /* !USE_GTK && !HAVE_NS */
+#endif /* ! (HAVE_EXT_TOOL_BAR) */
 
 DEFUN ("tool-bar-height", Ftool_bar_height, Stool_bar_height,
        0, 2, 0,
@@ -12763,7 +12777,7 @@ PIXELWISE non-nil means return the height of the tool 
bar in pixels.  */)
 {
   int height = 0;
 
-#if ! defined (USE_GTK) && ! defined (HAVE_NS)
+#ifndef HAVE_EXT_TOOL_BAR
   struct frame *f = decode_any_frame (frame);
 
   if (WINDOWP (f->tool_bar_window)
@@ -12788,13 +12802,13 @@ static bool
 redisplay_tool_bar (struct frame *f)
 {
   f->tool_bar_redisplayed = true;
-#if defined (USE_GTK) || defined (HAVE_NS)
+#ifdef HAVE_EXT_TOOL_BAR
 
   if (FRAME_EXTERNAL_TOOL_BAR (f))
     update_frame_tool_bar (f);
   return false;
 
-#else /* !USE_GTK && !HAVE_NS */
+#else /* ! (HAVE_EXT_TOOL_BAR) */
 
   struct window *w;
   struct it it;
@@ -12943,10 +12957,10 @@ redisplay_tool_bar (struct frame *f)
   f->minimize_tool_bar_window_p = false;
   return false;
 
-#endif /* USE_GTK || HAVE_NS */
+#endif /* HAVE_EXT_TOOL_BAR */
 }
 
-#if ! defined (USE_GTK) && ! defined (HAVE_NS)
+#ifndef HAVE_EXT_TOOL_BAR
 
 /* Get information about the tool-bar item which is displayed in GLYPH
    on frame F.  Return in *PROP_IDX the index where tool-bar item
@@ -13184,7 +13198,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
     help_echo_string = AREF (f->tool_bar_items, prop_idx + 
TOOL_BAR_ITEM_CAPTION);
 }
 
-#endif /* !USE_GTK && !HAVE_NS */
+#endif /* ! (HAVE_EXT_TOOL_BAR) */
 
 #endif /* HAVE_WINDOW_SYSTEM */
 
@@ -13296,7 +13310,8 @@ hscroll_window_tree (Lisp_Object window)
          text_area_width = window_box_width (w, TEXT_AREA);
 
          /* Scroll when cursor is inside this scroll margin.  */
-         h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w);
+         h_margin = (clip_to_bounds (0, hscroll_margin, 1000000)
+                     * WINDOW_FRAME_COLUMN_WIDTH (w));
 
          /* If the position of this window's point has explicitly
             changed, no more suspend auto hscrolling.  */
@@ -14089,20 +14104,6 @@ redisplay_internal (void)
     {
       echo_area_display (false);
 
-      /* If echo_area_display resizes the mini-window, the redisplay and
-        window_sizes_changed flags of the selected frame are set, but
-        it's too late for the hooks in window-size-change-functions,
-        which have been examined already in prepare_menu_bars.  So in
-        that case we call the hooks here only for the selected frame.  */
-      if (sf->redisplay)
-       {
-         ptrdiff_t count1 = SPECPDL_INDEX ();
-
-         record_unwind_save_match_data ();
-         run_window_size_change_functions (selected_frame);
-         unbind_to (count1, Qnil);
-       }
-
       if (message_cleared_p)
        update_miniwindow_p = true;
 
@@ -14119,15 +14120,6 @@ redisplay_internal (void)
           && (current_buffer->clip_changed || window_outdated (w))
           && resize_mini_window (w, false))
     {
-      if (sf->redisplay)
-       {
-         ptrdiff_t count1 = SPECPDL_INDEX ();
-
-         record_unwind_save_match_data ();
-         run_window_size_change_functions (selected_frame);
-         unbind_to (count1, Qnil);
-       }
-
       /* Resized active mini-window to fit the size of what it is
          showing if its contents might have changed.  */
       must_finish = true;
@@ -14138,6 +14130,9 @@ redisplay_internal (void)
       clear_garbaged_frames ();
     }
 
+  if (!NILP (Vrun_hooks))
+    run_window_change_functions ();
+
   if (windows_or_buffers_changed && !update_mode_lines)
     /* Code that sets windows_or_buffers_changed doesn't distinguish whether
        only the windows's contents needs to be refreshed, or whether the
@@ -14317,7 +14312,7 @@ redisplay_internal (void)
                  && (w = XWINDOW (selected_window)) != sw)
                goto retry;
 
-             /* We used to always goto end_of_redisplay here, but this
+               /* We used to always goto end_of_redisplay here, but this
                 isn't enough if we have a blinking cursor.  */
              if (w->cursor_off_p == w->last_cursor_off_p)
                goto end_of_redisplay;
@@ -14413,7 +14408,17 @@ redisplay_internal (void)
                FRAME_TERMINAL (f)->condemn_scroll_bars_hook (f);
 
              if (FRAME_VISIBLE_P (f) && !FRAME_OBSCURED_P (f))
-               redisplay_windows (FRAME_ROOT_WINDOW (f));
+               {
+
+                 /* Don't allow freeing images for this frame as long
+                    as the frame's update wasn't completed.  This
+                    prevents crashes when some Lisp that runs from
+                    the various hooks or font-lock decides to clear
+                    the frame's image cache, when the images in that
+                    cache are referenced by the desired matrix.  */
+                 f->inhibit_clear_image_cache = true;
+                 redisplay_windows (FRAME_ROOT_WINDOW (f));
+               }
              /* Remember that the invisible frames need to be redisplayed next
                 time they're visible.  */
              else if (!REDISPLAY_SOME_P ())
@@ -14494,6 +14499,7 @@ redisplay_internal (void)
                  pending |= update_frame (f, false, false);
                  f->cursor_type_changed = false;
                  f->updated_p = true;
+                 f->inhibit_clear_image_cache = false;
                }
            }
        }
@@ -14521,6 +14527,7 @@ redisplay_internal (void)
     }
   else if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf))
     {
+      sf->inhibit_clear_image_cache = true;
       displayed_buffer = XBUFFER (XWINDOW (selected_window)->contents);
       /* Use list_of_error, not Qerror, so that
         we catch only errors and don't run the debugger.  */
@@ -14576,6 +14583,7 @@ redisplay_internal (void)
          XWINDOW (selected_window)->must_be_updated_p = true;
          pending = update_frame (sf, false, false);
          sf->cursor_type_changed = false;
+         sf->inhibit_clear_image_cache = false;
        }
 
       /* We may have called echo_area_display at the top of this
@@ -14676,7 +14684,8 @@ redisplay_internal (void)
   /* If we just did a pending size change, or have additional
      visible frames, or selected_window changed, redisplay again.  */
   if ((windows_or_buffers_changed && !pending)
-      || (WINDOWP (selected_window) && (w = XWINDOW (selected_window)) != sw))
+      || (WINDOWP (selected_window)
+         && (w = XWINDOW (selected_window)) != sw))
     goto retry;
 
   /* Clear the face and image caches.
@@ -15733,7 +15742,7 @@ enum
 
 static int
 try_scrolling (Lisp_Object window, bool just_this_one_p,
-              ptrdiff_t arg_scroll_conservatively, ptrdiff_t scroll_step,
+              intmax_t arg_scroll_conservatively, intmax_t scroll_step,
               bool temp_scroll_step, bool last_line_misfit)
 {
   struct window *w = XWINDOW (window);
@@ -15765,12 +15774,15 @@ try_scrolling (Lisp_Object window, bool 
just_this_one_p,
       arg_scroll_conservatively = scroll_limit + 1;
       scroll_max = scroll_limit * frame_line_height;
     }
-  else if (scroll_step || arg_scroll_conservatively || temp_scroll_step)
+  else if (0 < scroll_step || 0 < arg_scroll_conservatively || 
temp_scroll_step)
     /* Compute how much we should try to scroll maximally to bring
        point into view.  */
-    scroll_max = (max (scroll_step,
-                      max (arg_scroll_conservatively, temp_scroll_step))
-                 * frame_line_height);
+    {
+      intmax_t scroll_lines_max
+       = max (scroll_step, max (arg_scroll_conservatively, temp_scroll_step));
+      int scroll_lines = clip_to_bounds (0, scroll_lines_max, 1000000);
+      scroll_max = scroll_lines * frame_line_height;
+    }
   else if (NUMBERP (BVAR (current_buffer, scroll_down_aggressively))
           || NUMBERP (BVAR (current_buffer, scroll_up_aggressively)))
     /* We're trying to scroll because of aggressive scrolling but no
@@ -17263,8 +17275,8 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
     }
 
   /* Try to scroll by specified few lines.  */
-  if ((scroll_conservatively
-       || emacs_scroll_step
+  if ((0 < scroll_conservatively
+       || 0 < emacs_scroll_step
        || temp_scroll_step
        || NUMBERP (BVAR (current_buffer, scroll_up_aggressively))
        || NUMBERP (BVAR (current_buffer, scroll_down_aggressively)))
@@ -17644,8 +17656,7 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
 
       if (FRAME_WINDOW_P (f))
        {
-#if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) \
-    || defined (HAVE_NS) || defined (USE_GTK)
+#ifdef HAVE_EXT_MENU_BAR
          redisplay_menu_p = FRAME_EXTERNAL_MENU_BAR (f);
 #else
          redisplay_menu_p = FRAME_MENU_BAR_LINES (f) > 0;
@@ -17660,7 +17671,7 @@ redisplay_window (Lisp_Object window, bool 
just_this_one_p)
 #ifdef HAVE_WINDOW_SYSTEM
       if (FRAME_WINDOW_P (f))
         {
-#if defined (USE_GTK) || defined (HAVE_NS)
+#ifdef HAVE_EXT_TOOL_BAR
          if (FRAME_EXTERNAL_TOOL_BAR (f))
            redisplay_tool_bar (f);
 #else
@@ -19695,7 +19706,7 @@ If there's no tool-bar, or if the tool-bar is not drawn 
by Emacs,
 do nothing.  */)
   (Lisp_Object row, Lisp_Object glyphs)
 {
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
   struct frame *sf = SELECTED_FRAME ();
   struct glyph_matrix *m = XWINDOW (sf->tool_bar_window)->current_matrix;
   EMACS_INT vpos;
@@ -20287,7 +20298,7 @@ extend_face_to_end_of_line (struct it *it)
   if (FRAME_WINDOW_P (f)
       && MATRIX_ROW_DISPLAYS_TEXT_P (it->glyph_row)
       && face->box == FACE_NO_BOX
-      && face->background == FRAME_BACKGROUND_PIXEL (f)
+      && FACE_COLOR_TO_PIXEL (face->background, f) == FRAME_BACKGROUND_PIXEL 
(f)
 #ifdef HAVE_WINDOW_SYSTEM
       && !face->stipple
 #endif
@@ -20321,7 +20332,7 @@ extend_face_to_end_of_line (struct it *it)
       /* Mode line and the header line don't have margins, and
         likewise the frame's tool-bar window, if there is any.  */
       if (!(it->glyph_row->mode_line_p
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
            || (WINDOWP (f->tool_bar_window)
                && it->w == XWINDOW (f->tool_bar_window))
 #endif
@@ -20432,7 +20443,7 @@ extend_face_to_end_of_line (struct it *it)
          && (it->glyph_row->used[LEFT_MARGIN_AREA]
              < WINDOW_LEFT_MARGIN_WIDTH (it->w))
          && !it->glyph_row->mode_line_p
-         && default_face->background != FRAME_BACKGROUND_PIXEL (f))
+         && FACE_COLOR_TO_PIXEL (face->background, f) != 
FRAME_BACKGROUND_PIXEL (f))
        {
          struct glyph *g = it->glyph_row->glyphs[LEFT_MARGIN_AREA];
          struct glyph *e = g + it->glyph_row->used[LEFT_MARGIN_AREA];
@@ -20473,7 +20484,7 @@ extend_face_to_end_of_line (struct it *it)
          && (it->glyph_row->used[RIGHT_MARGIN_AREA]
              < WINDOW_RIGHT_MARGIN_WIDTH (it->w))
          && !it->glyph_row->mode_line_p
-         && default_face->background != FRAME_BACKGROUND_PIXEL (f))
+         && FACE_COLOR_TO_PIXEL (face->background, f) != 
FRAME_BACKGROUND_PIXEL (f))
        {
          struct glyph *g = it->glyph_row->glyphs[RIGHT_MARGIN_AREA];
          struct glyph *e = g + it->glyph_row->used[RIGHT_MARGIN_AREA];
@@ -20564,7 +20575,7 @@ highlight_trailing_whitespace (struct it *it)
       else
        {
          while (glyph <= start
-                && glyph->type == CHAR_GLYPH
+                && (glyph->type == CHAR_GLYPH || glyph->type == STRETCH_GLYPH)
                 && NILP (glyph->object))
            ++glyph;
        }
@@ -21242,7 +21253,10 @@ maybe_produce_line_number (struct it *it)
       if (lnum_face_id != current_lnum_face_id
          && (EQ (Vdisplay_line_numbers, Qvisual)
              ? this_line == 0
-             : this_line == it->pt_lnum))
+             : this_line == it->pt_lnum)
+         /* Avoid displaying the line-number-current-line face on
+            empty lines beyond EOB.  */
+         && it->what != IT_EOB)
        tem_it.face_id = current_lnum_face_id;
       else
        tem_it.face_id = lnum_face_id;
@@ -23041,7 +23055,7 @@ Emacs UBA implementation, in particular with the test 
suite.  */)
     }
   else
     {
-      CHECK_FIXNUM_COERCE_MARKER (vpos);
+      CHECK_FIXNUM (vpos);
       nrow = XFIXNUM (vpos);
     }
 
@@ -24104,7 +24118,7 @@ store_mode_line_string (const char *string, Lisp_Object 
lisp_string,
     }
   else
     {
-      len = XFIXNAT (Flength (lisp_string));
+      len = SCHARS (lisp_string);
       if (precision > 0 && len > precision)
        {
          len = precision;
@@ -24258,7 +24272,7 @@ are the selected window and the WINDOW's buffer).  */)
   return unbind_to (count, str);
 }
 
-/* Write a null-terminated, right justified decimal representation of
+/* Write a NUL-terminated, right justified decimal representation of
    the positive integer D to BUF using a minimal field width WIDTH.  */
 
 static void
@@ -24288,7 +24302,7 @@ pint2str (register char *buf, register int width, 
register ptrdiff_t d)
     }
 }
 
-/* Write a null-terminated, right justified decimal and "human
+/* Write a NUL-terminated, right justified decimal and "human
    readable" representation of the nonnegative integer D to BUF using
    a minimal field width WIDTH.  D should be smaller than 999.5e24. */
 
@@ -24508,7 +24522,7 @@ decode_mode_spec (struct window *w, register int c, int 
field_width,
      produce strings from numerical values, so limit preposterously
      large values of FIELD_WIDTH to avoid overrunning the buffer's
      end.  The size of the buffer is enough for FRAME_MESSAGE_BUF_SIZE
-     bytes plus the terminating null.  */
+     bytes plus the terminating NUL.  */
   int width = min (field_width, FRAME_MESSAGE_BUF_SIZE (f));
   struct buffer *b = current_buffer;
 
@@ -24714,8 +24728,12 @@ decode_mode_spec (struct window *w, register int c, 
int field_width,
            ptrdiff_t limit = BUF_BEGV (b);
            ptrdiff_t limit_byte = BUF_BEGV_BYTE (b);
            ptrdiff_t position;
-           ptrdiff_t distance =
-             (height * 2 + 30) * line_number_display_limit_width;
+           ptrdiff_t distance
+             = (line_number_display_limit_width < 0 ? 0
+                : INT_MULTIPLY_WRAPV (line_number_display_limit_width,
+                                      height * 2 + 30,
+                                      &distance)
+                ? PTRDIFF_MAX : distance);
 
            if (startpos - distance > limit)
              {
@@ -25704,22 +25722,28 @@ dump_glyph_string (struct glyph_string *s)
    face-override for drawing S.  */
 
 #ifdef HAVE_NTGUI
-#define OPTIONAL_HDC(hdc)  HDC hdc,
-#define DECLARE_HDC(hdc)   HDC hdc;
-#define ALLOCATE_HDC(hdc, f) hdc = get_frame_dc ((f))
-#define RELEASE_HDC(hdc, f)  release_frame_dc ((f), (hdc))
-#endif
-
-#ifndef OPTIONAL_HDC
-#define OPTIONAL_HDC(hdc)
-#define DECLARE_HDC(hdc)
-#define ALLOCATE_HDC(hdc, f)
-#define RELEASE_HDC(hdc, f)
+/* We set inhibit-quit here due to paranoia: get_frame_dc acquires the
+   critical section, and we cannot QUIT while we hold the critical
+   section.  If any of the code run by callers of ALLOCATE_HDC happens
+   to call Lisp (might be possible due to all the hooks lying around),
+   we must prevent it from quitting.  */
+# define ALLOCATE_HDC(hdc, f)                  \
+  Lisp_Object prev_quit = Vinhibit_quit;       \
+  Vinhibit_quit = Qt;                          \
+  HDC hdc = get_frame_dc ((f))
+# define RELEASE_HDC(hdc, f)                   \
+  release_frame_dc ((f), (hdc));               \
+  Vinhibit_quit = prev_quit
+#else
+# define ALLOCATE_HDC(hdc, f)
+# define RELEASE_HDC(hdc, f)
 #endif
 
 static void
 init_glyph_string (struct glyph_string *s,
-                  OPTIONAL_HDC (hdc)
+#ifdef HAVE_NTGUI
+                  HDC hdc,
+#endif
                   XChar2b *char2b, struct window *w, struct glyph_row *row,
                   enum glyph_row_area area, int start, enum draw_glyphs_face 
hl)
 {
@@ -26759,7 +26783,6 @@ draw_glyphs (struct window *w, int x, struct glyph_row 
*row,
   struct glyph_string *clip_head = NULL, *clip_tail = NULL;
   int i, j, x_reached, last_x, area_left = 0;
   struct frame *f = XFRAME (WINDOW_FRAME (w));
-  DECLARE_HDC (hdc);
 
   ALLOCATE_HDC (hdc, f);
 
@@ -27958,7 +27981,7 @@ calc_line_height_property (struct it *it, Lisp_Object 
val, struct font *font,
   /* FIXME: Check for overflow in multiplication or conversion.  */
   if (FLOATP (val))
     height = (int)(XFLOAT_DATA (val) * height);
-  else
+  else if (INTEGERP (val))
     {
       intmax_t v;
       if (integer_to_intmax (val, &v))
@@ -28337,7 +28360,7 @@ x_produce_glyphs (struct it *it)
          /* If face has an overline, add the height of the overline
             (1 pixel) and a 1 pixel margin to the character height.  */
          if (face->overline_p)
-           it->ascent += overline_margin;
+           it->ascent += clip_to_bounds (0, overline_margin, 1000000);
 
          if (it->constrain_row_ascent_descent_p)
            {
@@ -28878,7 +28901,7 @@ x_produce_glyphs (struct it *it)
       /* If face has an overline, add the height of the overline
         (1 pixel) and a 1 pixel margin to the character height.  */
       if (face->overline_p)
-       it->ascent += overline_margin;
+       it->ascent += clip_to_bounds (0, overline_margin, 1000000);
 
       take_vertical_position_into_account (it);
       if (it->ascent < 0)
@@ -28927,7 +28950,7 @@ x_produce_glyphs (struct it *it)
       /* If face has an overline, add the height of the overline
         (1 pixel) and a 1 pixel margin to the character height.  */
       if (face->overline_p)
-       it->ascent += overline_margin;
+       it->ascent += clip_to_bounds (0, overline_margin, 1000000);
       take_vertical_position_into_account (it);
       if (it->ascent < 0)
        it->ascent = 0;
@@ -29994,7 +30017,7 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum 
draw_glyphs_face draw)
   /* Change the mouse cursor.  */
   if (FRAME_WINDOW_P (f) && NILP (do_mouse_tracking))
     {
-#if ! defined (USE_GTK) && ! defined (HAVE_NS)
+#ifndef HAVE_EXT_TOOL_BAR
       if (draw == DRAW_NORMAL_TEXT
          && !EQ (hlinfo->mouse_face_window, f->tool_bar_window))
        FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
@@ -31396,7 +31419,7 @@ note_mouse_highlight (struct frame *f, int x, int y)
   w = XWINDOW (window);
   frame_to_window_pixel_xy (w, &x, &y);
 
-#if defined (HAVE_WINDOW_SYSTEM) && ! defined (USE_GTK) && ! defined (HAVE_NS)
+#if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR)
   /* Handle tool-bar window differently since it doesn't display a
      buffer.  */
   if (EQ (window, f->tool_bar_window))
@@ -32252,6 +32275,18 @@ expose_window (struct window *w, XRectangle *fr)
         y0 or y1 is negative (can happen for tall images).  */
       int r_bottom = r.y + r.height;
 
+      /* We must temporarily switch to the window's buffer, in case
+        the fringe face has been remapped in that buffer's
+        face-remapping-alist, so that draw_row_fringe_bitmaps,
+        called from expose_line, will use the right face.  */
+      bool buffer_changed = false;
+      struct buffer *oldbuf = current_buffer;
+      if (!w->pseudo_window_p)
+       {
+         set_buffer_internal_1 (XBUFFER (w->contents));
+         buffer_changed = true;
+       }
+
       /* Update lines intersecting rectangle R.  */
       first_overlapping_row = last_overlapping_row = NULL;
       for (row = w->current_matrix->rows;
@@ -32297,6 +32332,9 @@ expose_window (struct window *w, XRectangle *fr)
            break;
        }
 
+      if (buffer_changed)
+       set_buffer_internal_1 (oldbuf);
+
       /* Display the mode line if there is one.  */
       if (window_wants_mode_line (w)
          && (row = MATRIX_MODE_LINE_ROW (w->current_matrix),
@@ -32373,7 +32411,6 @@ expose_frame (struct frame *f, int x, int y, int w, int 
h)
 
   TRACE ((stderr, "expose_frame "));
 
-  /* No need to redraw if frame will be redrawn soon.  */
   if (FRAME_GARBAGED_P (f))
     {
       TRACE ((stderr, " garbaged\n"));
@@ -32407,7 +32444,7 @@ expose_frame (struct frame *f, int x, int y, int w, int 
h)
   TRACE ((stderr, "(%d, %d, %d, %d)\n", r.x, r.y, r.width, r.height));
   mouse_face_overwritten_p = expose_window_tree (XWINDOW (f->root_window), &r);
 
-#if ! defined (USE_GTK) && ! defined (HAVE_NS)
+#ifndef HAVE_EXT_TOOL_BAR
   if (WINDOWP (f->tool_bar_window))
     mouse_face_overwritten_p
       |= expose_window (XWINDOW (f->tool_bar_window), &r);
@@ -32869,14 +32906,12 @@ and is used only on frames for which no explicit name 
has been set
 \(see `modify-frame-parameters').  */);
   Vicon_title_format
     = Vframe_title_format
-    = listn (CONSTYPE_PURE, 3,
-            intern_c_string ("multiple-frames"),
-            build_pure_c_string ("%b"),
-            listn (CONSTYPE_PURE, 4,
-                   empty_unibyte_string,
-                   intern_c_string ("invocation-name"),
-                   build_pure_c_string ("@"),
-                   intern_c_string ("system-name")));
+    = pure_list (intern_c_string ("multiple-frames"),
+                build_pure_c_string ("%b"),
+                pure_list (empty_unibyte_string,
+                           intern_c_string ("invocation-name"),
+                           build_pure_c_string ("@"),
+                           intern_c_string ("system-name")));
 
   DEFVAR_LISP ("message-log-max", Vmessage_log_max,
     doc: /* Maximum number of lines to keep in the message log buffer.
@@ -33023,7 +33058,11 @@ A value of nil means don't automatically resize 
mini-windows.
 A value of t means resize them to fit the text displayed in them.
 A value of `grow-only', the default, means let mini-windows grow only;
 they return to their normal size when the minibuffer is closed, or the
-echo area becomes empty.  */);
+echo area becomes empty.
+
+This variable does not affect resizing of the minibuffer window of
+minibuffer-only frames.  These are handled by 'resize-mini-frames'
+only.  */);
   /* Contrary to the doc string, we initialize this to nil, so that
      loading loadup.el won't try to resize windows before loading
      window.el, where some functions we need to call for this live.
diff --git a/src/xfaces.c b/src/xfaces.c
index 50593f6..c6723eb 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1,6 +1,6 @@
 /* xfaces.c -- "Face" primitives.
 
-Copyright (C) 1993-1994, 1998-2018 Free Software Foundation, Inc.
+Copyright (C) 1993-1994, 1998-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -1157,8 +1157,6 @@ load_color (struct frame *f, struct face *face, 
Lisp_Object name,
 
 #ifdef HAVE_WINDOW_SYSTEM
 
-#define NEAR_SAME_COLOR_THRESHOLD 30000
-
 /* Load colors for face FACE which is used on frame F.  Colors are
    specified by slots LFACE_BACKGROUND_INDEX and LFACE_FOREGROUND_INDEX
    of ATTRS.  If the background color specified is not supported on F,
@@ -1199,7 +1197,7 @@ load_face_colors (struct frame *f, struct face *face,
 
   dfg = attrs[LFACE_DISTANT_FOREGROUND_INDEX];
   if (!NILP (dfg) && !UNSPECIFIEDP (dfg)
-      && color_distance (&xbg, &xfg) < NEAR_SAME_COLOR_THRESHOLD)
+      && color_distance (&xbg, &xfg) < face_near_same_color_threshold)
     {
       if (EQ (attrs[LFACE_INVERSE_INDEX], Qt))
         face->background = load_color (f, face, dfg, LFACE_BACKGROUND_INDEX);
@@ -1424,7 +1422,6 @@ the face font sort order.  */)
   Lisp_Object font_spec, list, *drivers, vec;
   struct frame *f = decode_live_frame (frame);
   ptrdiff_t i, nfonts;
-  EMACS_INT ndrivers;
   Lisp_Object result;
   USE_SAFE_ALLOCA;
 
@@ -1457,7 +1454,7 @@ the face font sort order.  */)
   font_props_for_sorting[i++] = FONT_ADSTYLE_INDEX;
   font_props_for_sorting[i++] = FONT_REGISTRY_INDEX;
 
-  ndrivers = XFIXNUM (Flength (list));
+  ptrdiff_t ndrivers = list_length (list);
   SAFE_ALLOCA_LISP (drivers, ndrivers);
   for (i = 0; i < ndrivers; i++, list = XCDR (list))
     drivers[i] = XCAR (list);
@@ -1600,7 +1597,7 @@ the WIDTH times as wide as FACE on FRAME.  */)
     /* We don't have to check fontsets.  */
     return fonts;
   Lisp_Object fontsets = list_fontsets (f, pattern, size);
-  return CALLN (Fnconc, fonts, fontsets);
+  return nconc2 (fonts, fontsets);
 }
 
 #endif /* HAVE_WINDOW_SYSTEM */
@@ -2615,8 +2612,7 @@ Value is a vector of face attributes.  */)
   /* Add a global definition if there is none.  */
   if (NILP (global_lface))
     {
-      global_lface = Fmake_vector (make_fixnum (LFACE_VECTOR_SIZE),
-                                  Qunspecified);
+      global_lface = make_vector (LFACE_VECTOR_SIZE, Qunspecified);
       ASET (global_lface, 0, Qface);
       Vface_new_frame_defaults = Fcons (Fcons (face, global_lface),
                                        Vface_new_frame_defaults);
@@ -2643,8 +2639,7 @@ Value is a vector of face attributes.  */)
     {
       if (NILP (lface))
        {
-         lface = Fmake_vector (make_fixnum (LFACE_VECTOR_SIZE),
-                               Qunspecified);
+         lface = make_vector (LFACE_VECTOR_SIZE, Qunspecified);
          ASET (lface, 0, Qface);
          fset_face_alist (f, Fcons (Fcons (face, lface), f->face_alist));
        }
@@ -4259,12 +4254,8 @@ two lists of the form (RED GREEN BLUE) aforementioned. 
*/)
     return make_fixnum (color_distance (&cdef1, &cdef2));
   else
     return call2 (metric,
-                  list3 (make_fixnum (cdef1.red),
-                         make_fixnum (cdef1.green),
-                         make_fixnum (cdef1.blue)),
-                  list3 (make_fixnum (cdef2.red),
-                         make_fixnum (cdef2.green),
-                         make_fixnum (cdef2.blue)));
+                 list3i (cdef1.red, cdef1.green, cdef1.blue),
+                 list3i (cdef2.red, cdef2.green, cdef2.blue));
 }
 
 
@@ -4775,9 +4766,7 @@ DEFUN ("face-attributes-as-vector", 
Fface_attributes_as_vector,
        doc: /* Return a vector of face attributes corresponding to PLIST.  */)
   (Lisp_Object plist)
 {
-  Lisp_Object lface;
-  lface = Fmake_vector (make_fixnum (LFACE_VECTOR_SIZE),
-                       Qunspecified);
+  Lisp_Object lface = make_vector (LFACE_VECTOR_SIZE, Qunspecified);
   merge_face_ref (NULL, XFRAME (selected_frame),
                   plist, XVECTOR (lface)->contents,
                  true, 0);
@@ -6093,7 +6082,14 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos,
     int face_id;
 
     if (base_face_id >= 0)
-      face_id = base_face_id;
+      {
+       face_id = base_face_id;
+       /* Make sure the base face ID is usable: if someone freed the
+          cached faces since we've looked up the base face, we need
+          to look it up again.  */
+       if (!FACE_FROM_ID_OR_NULL (f, face_id))
+         face_id = lookup_basic_face (w, f, DEFAULT_FACE_ID);
+      }
     else if (NILP (Vface_remapping_alist))
       face_id = DEFAULT_FACE_ID;
     else
@@ -6505,6 +6501,37 @@ DEFUN ("show-face-resources", Fshow_face_resources, 
Sshow_face_resources,
                            Initialization
  ***********************************************************************/
 
+#ifdef HAVE_PDUMPER
+/* All the faces defined during loadup are recorded in
+   face-new-frame-defaults, with the last face first in the list.  We
+   need to set next_lface_id to the next face ID number, so that any
+   new faces defined in this session will have face IDs different from
+   those defined during loadup.  We also need to set up the
+   lface_id_to_name[] array for the faces that were defined during
+   loadup.  */
+void
+init_xfaces (void)
+{
+  if (CONSP (Vface_new_frame_defaults))
+    {
+      /* Allocate the lface_id_to_name[] array.  */
+      lface_id_to_name_size = next_lface_id =
+       XFIXNAT (Flength (Vface_new_frame_defaults));
+      lface_id_to_name = xnmalloc (next_lface_id, sizeof *lface_id_to_name);
+
+      /* Store the faces.  */
+      Lisp_Object tail;
+      int i = next_lface_id - 1;
+      for (tail = Vface_new_frame_defaults; CONSP (tail); tail = XCDR (tail))
+       {
+         Lisp_Object lface = XCAR (tail);
+         eassert (i >= 0);
+         lface_id_to_name[i--] = XCAR (lface);
+       }
+    }
+}
+#endif
+
 void
 syms_of_xfaces (void)
 {
@@ -6755,6 +6782,7 @@ Because Emacs normally only redraws screen areas when the 
underlying
 buffer contents change, you may need to call `redraw-display' after
 changing this variable for it to take effect.  */);
   Vface_remapping_alist = Qnil;
+  DEFSYM (Qface_remapping_alist,"face-remapping-alist");
 
   DEFVAR_LISP ("face-font-rescale-alist", Vface_font_rescale_alist,
               doc: /* Alist of fonts vs the rescaling factors.
@@ -6765,6 +6793,20 @@ RESCALE-RATIO is a floating point number to specify how 
much larger
 a font of 10 point, we actually use a font of 10 * RESCALE-RATIO point.  */);
   Vface_font_rescale_alist = Qnil;
 
+  DEFVAR_INT ("face-near-same-color-threshold", face_near_same_color_threshold,
+             doc: /* Threshold for using distant-foreground color instead of 
foreground.
+
+The value should be an integer number providing the minimum distance
+between two colors that will still qualify them to be used as foreground
+and background.  If the value of `color-distance', invoked with a nil
+METRIC argument, for the foreground and background colors of a face is
+less than this threshold, the distant-foreground color, if defined,
+will be used for the face instead of the foreground color.
+
+Lisp programs that change the value of this variable should also
+clear the face cache, see `clear-face-cache'.  */);
+  face_near_same_color_threshold = 30000;
+
 #ifdef HAVE_WINDOW_SYSTEM
   defsubr (&Sbitmap_spec_p);
   defsubr (&Sx_list_fonts);
diff --git a/src/xfns.c b/src/xfns.c
index c4cf59d..f238a3d 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -1,6 +1,6 @@
 /* Functions for the X window system.
 
-Copyright (C) 1989, 1992-2018 Free Software Foundation, Inc.
+Copyright (C) 1989, 1992-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -4628,7 +4628,7 @@ x_make_monitor_attribute_list (struct MonitorInfo 
*monitors,
                                struct x_display_info *dpyinfo,
                                const char *source)
 {
-  Lisp_Object monitor_frames = Fmake_vector (make_fixnum (n_monitors), Qnil);
+  Lisp_Object monitor_frames = make_nil_vector (n_monitors);
   Lisp_Object frame, rest;
 
   FOR_EACH_FRAME (rest, frame)
@@ -4931,7 +4931,7 @@ Internal use only, use `display-monitor-attributes-list' 
instead.  */)
 #endif
   n_monitors = gdk_screen_get_n_monitors (gscreen);
 #endif
-  monitor_frames = Fmake_vector (make_fixnum (n_monitors), Qnil);
+  monitor_frames = make_nil_vector (n_monitors);
   monitors = xzalloc (n_monitors * sizeof *monitors);
 
   FOR_EACH_FRAME (rest, frame)
@@ -5132,7 +5132,7 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
   inner_right = native_right - internal_border_width;
   inner_bottom = native_bottom - internal_border_width;
 
-#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
+#ifdef HAVE_EXT_MENU_BAR
   menu_bar_external = true;
   menu_bar_height = FRAME_MENUBAR_HEIGHT (f);
   native_top += menu_bar_height;
@@ -5143,7 +5143,7 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
 #endif
   menu_bar_width = menu_bar_height ? native_width : 0;
 
-#if defined (USE_GTK)
+#ifdef HAVE_EXT_TOOL_BAR
   tool_bar_external = true;
   if (EQ (FRAME_TOOL_BAR_POSITION (f), Qleft))
     {
@@ -5185,18 +5185,14 @@ frame_geometry (Lisp_Object frame, Lisp_Object 
attribute)
 
   /* Construct list.  */
   if (EQ (attribute, Qouter_edges))
-    return list4 (make_fixnum (outer_left), make_fixnum (outer_top),
-                 make_fixnum (outer_right), make_fixnum (outer_bottom));
+    return list4i (outer_left, outer_top, outer_right, outer_bottom);
   else if (EQ (attribute, Qnative_edges))
-    return list4 (make_fixnum (native_left), make_fixnum (native_top),
-                 make_fixnum (native_right), make_fixnum (native_bottom));
+    return list4i (native_left, native_top, native_right, native_bottom);
   else if (EQ (attribute, Qinner_edges))
-    return list4 (make_fixnum (inner_left), make_fixnum (inner_top),
-                 make_fixnum (inner_right), make_fixnum (inner_bottom));
+    return list4i (inner_left, inner_top, inner_right, inner_bottom);
   else
     return
-      listn (CONSTYPE_HEAP, 11,
-            Fcons (Qouter_position,
+       list (Fcons (Qouter_position,
                    Fcons (make_fixnum (outer_left),
                           make_fixnum (outer_top))),
             Fcons (Qouter_size,
@@ -7675,7 +7671,7 @@ syms_of_xfns (void)
 #endif
 
   Fput (Qundefined_color, Qerror_conditions,
-       listn (CONSTYPE_PURE, 2, Qundefined_color, Qerror));
+       pure_list (Qundefined_color, Qerror));
   Fput (Qundefined_color, Qerror_message,
        build_pure_c_string ("Undefined color"));
 
diff --git a/src/xfont.c b/src/xfont.c
index 73caa70..5ecbd6d 100644
--- a/src/xfont.c
+++ b/src/xfont.c
@@ -1,5 +1,5 @@
 /* xfont.c -- X core font driver.
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006-2019 Free Software Foundation, Inc.
    Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H13PRO009
@@ -31,6 +31,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "character.h"
 #include "charset.h"
 #include "font.h"
+#include "pdumper.h"
 
 
 /* X core font driver.  */
@@ -131,7 +132,7 @@ compare_font_names (const void *name1, const void *name2)
 
 /* Decode XLFD as iso-8859-1 into OUTPUT, and return the byte length
    of the decoding result.  LEN is the byte length of XLFD, or -1 if
-   XLFD is NULL terminated.  The caller must assure that OUTPUT is at
+   XLFD is NUL terminated.  The caller must assure that OUTPUT is at
    least twice (plus 1) as large as XLFD.  */
 
 static ptrdiff_t
@@ -1077,6 +1078,7 @@ xfont_check (struct frame *f, struct font *font)
 }
 
 
+static void syms_of_xfont_for_pdumper (void);
 
 struct font_driver const xfont_driver =
   {
@@ -1101,6 +1103,12 @@ syms_of_xfont (void)
   staticpro (&xfont_scripts_cache);
   xfont_scripts_cache = CALLN (Fmake_hash_table, QCtest, Qequal);
   staticpro (&xfont_scratch_props);
-  xfont_scratch_props = Fmake_vector (make_fixnum (8), Qnil);
+  xfont_scratch_props = make_nil_vector (8);
+  pdumper_do_now_and_after_load (syms_of_xfont_for_pdumper);
+}
+
+static void
+syms_of_xfont_for_pdumper (void)
+{
   register_font_driver (&xfont_driver, NULL);
 }
diff --git a/src/xftfont.c b/src/xftfont.c
index 85df0d8..8a4516f 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -1,5 +1,5 @@
 /* xftfont.c -- XFT font driver.
-   Copyright (C) 2006-2018 Free Software Foundation, Inc.
+   Copyright (C) 2006-2019 Free Software Foundation, Inc.
    Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H13PRO009
@@ -32,30 +32,10 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "composite.h"
 #include "font.h"
 #include "ftfont.h"
+#include "pdumper.h"
 
 /* Xft font driver.  */
 
-
-/* The actual structure for Xft font that can be cast to struct
-   font.  */
-
-struct xftfont_info
-{
-  struct font font;
-  /* The following five members must be here in this order to be
-     compatible with struct ftfont_info (in ftfont.c).  */
-#ifdef HAVE_LIBOTF
-  bool maybe_otf;        /* Flag to tell if this may be OTF or not.  */
-  OTF *otf;
-#endif /* HAVE_LIBOTF */
-  FT_Size ft_size;
-  int index;
-  FT_Matrix matrix;
-  Display *display;
-  XftFont *xftfont;
-  unsigned x_display_id;
-};
-
 /* Structure pointed by (struct face *)->extra  */
 
 struct xftface_info
@@ -255,7 +235,7 @@ xftfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
   Display *display = FRAME_X_DISPLAY (f);
   Lisp_Object val, filename, idx, font_object;
   FcPattern *pat = NULL, *match;
-  struct xftfont_info *xftfont_info = NULL;
+  struct font_info *xftfont_info = NULL;
   struct font *font;
   double size = 0;
   XftFont *xftfont = NULL;
@@ -330,7 +310,7 @@ xftfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
 
   /* We should not destroy PAT here because it is kept in XFTFONT and
      destroyed automatically when XFTFONT is closed.  */
-  font_object = font_build_object (VECSIZE (struct xftfont_info),
+  font_object = font_build_object (VECSIZE (struct font_info),
                                   Qxft, entity, size);
   ASET (font_object, FONT_FILE_INDEX, filename);
   font = XFONT_OBJECT (font_object);
@@ -338,7 +318,7 @@ xftfont_open (struct frame *f, Lisp_Object entity, int 
pixel_size)
   font->driver = &xftfont_driver;
   font->encoding_charset = font->repertory_charset = -1;
 
-  xftfont_info = (struct xftfont_info *) font;
+  xftfont_info = (struct font_info *) font;
   xftfont_info->display = display;
   xftfont_info->xftfont = xftfont;
   xftfont_info->x_display_id = FRAME_DISPLAY_INFO (f)->x_id;
@@ -460,7 +440,7 @@ static void
 xftfont_close (struct font *font)
 {
   struct x_display_info *xdi;
-  struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
+  struct font_info *xftfont_info = (struct font_info *) font;
 
 #ifdef HAVE_LIBOTF
   if (xftfont_info->otf)
@@ -526,7 +506,7 @@ xftfont_done_face (struct frame *f, struct face *face)
 static int
 xftfont_has_char (Lisp_Object font, int c)
 {
-  struct xftfont_info *xftfont_info;
+  struct font_info *xftfont_info;
   struct charset *cs = NULL;
 
   if (EQ (AREF (font, FONT_ADSTYLE_INDEX), Qja)
@@ -540,7 +520,7 @@ xftfont_has_char (Lisp_Object font, int c)
 
   if (FONT_ENTITY_P (font))
     return ftfont_has_char (font, c);
-  xftfont_info = (struct xftfont_info *) XFONT_OBJECT (font);
+  xftfont_info = (struct font_info *) XFONT_OBJECT (font);
   return (XftCharExists (xftfont_info->display, xftfont_info->xftfont,
                         (FcChar32) c) == FcTrue);
 }
@@ -548,7 +528,7 @@ xftfont_has_char (Lisp_Object font, int c)
 static unsigned
 xftfont_encode_char (struct font *font, int c)
 {
-  struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
+  struct font_info *xftfont_info = (struct font_info *) font;
   unsigned code = XftCharIndex (xftfont_info->display, xftfont_info->xftfont,
                                (FcChar32) c);
 
@@ -559,7 +539,7 @@ static void
 xftfont_text_extents (struct font *font, unsigned int *code,
                      int nglyphs, struct font_metrics *metrics)
 {
-  struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
+  struct font_info *xftfont_info = (struct font_info *) font;
   XGlyphInfo extents;
 
   block_input ();
@@ -601,7 +581,7 @@ xftfont_draw (struct glyph_string *s, int from, int to, int 
x, int y,
 
   struct frame *f = s->f;
   struct face *face = s->face;
-  struct xftfont_info *xftfont_info = (struct xftfont_info *) s->font;
+  struct font_info *xftfont_info = (struct font_info *) s->font;
   struct xftface_info *xftface_info = NULL;
   XftDraw *xft_draw = xftfont_get_xft_draw (f);
   FT_UInt *code;
@@ -664,7 +644,7 @@ static Lisp_Object
 xftfont_shape (Lisp_Object lgstring)
 {
   struct font *font = CHECK_FONT_GET_OBJECT (LGSTRING_FONT (lgstring));
-  struct xftfont_info *xftfont_info = (struct xftfont_info *) font;
+  struct font_info *xftfont_info = (struct font_info *) font;
   FT_Face ft_face = XftLockFace (xftfont_info->xftfont);
   xftfont_info->ft_size = ft_face->size;
   Lisp_Object val = ftfont_shape (lgstring);
@@ -708,7 +688,7 @@ static bool
 xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object,
                         Lisp_Object entity)
 {
-  struct xftfont_info *info = (struct xftfont_info *) XFONT_OBJECT 
(font_object);
+  struct font_info *info = (struct font_info *) XFONT_OBJECT (font_object);
   FcPattern *oldpat = info->xftfont->pattern;
   Display *display = FRAME_X_DISPLAY (f);
   FcPattern *pat = FcPatternCreate ();
@@ -749,6 +729,8 @@ xftfont_cached_font_ok (struct frame *f, Lisp_Object 
font_object,
   return ok;
 }
 
+static void syms_of_xftfont_for_pdumper (void);
+
 struct font_driver const xftfont_driver =
   {
     /* We can't draw a text without device dependent functions.  */
@@ -800,7 +782,11 @@ syms_of_xftfont (void)
 This is needed with some fonts to correct vertical overlap of glyphs.  */);
   xft_font_ascent_descent_override = 0;
 
-  ascii_printable[0] = 0;
+  pdumper_do_now_and_after_load (syms_of_xftfont_for_pdumper);
+}
 
+static void
+syms_of_xftfont_for_pdumper (void)
+{
   register_font_driver (&xftfont_driver, NULL);
 }
diff --git a/src/xgselect.c b/src/xgselect.c
index fedd312..9982a1f 100644
--- a/src/xgselect.c
+++ b/src/xgselect.c
@@ -1,6 +1,6 @@
 /* Function for handling the GLib event loop.
 
-Copyright (C) 2009-2018 Free Software Foundation, Inc.
+Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/xgselect.h b/src/xgselect.h
index a2728c6..92c79c5 100644
--- a/src/xgselect.h
+++ b/src/xgselect.h
@@ -1,6 +1,6 @@
 /* Header for xg_select.
 
-Copyright (C) 2009-2018 Free Software Foundation, Inc.
+Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/xmenu.c b/src/xmenu.c
index 31034f7..22d1cc2 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -1,6 +1,6 @@
 /* X Communication module for terminals which understand the X protocol.
 
-Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2018 Free Software
+Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2019 Free Software
 Foundation, Inc.
 
 Author: Jon Arnold
@@ -45,6 +45,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "buffer.h"
 #include "coding.h"
 #include "sysselect.h"
+#include "pdumper.h"
 
 #ifdef MSDOS
 #include "msdos.h"
@@ -143,7 +144,7 @@ x_menu_set_in_use (bool in_use)
 {
   Lisp_Object frames, frame;
 
-  menu_items_inuse = in_use ? Qt : Qnil;
+  menu_items_inuse = in_use;
   popup_activated_flag = in_use;
 #ifdef USE_X_TOOLKIT
   if (popup_activated_flag)
@@ -2401,15 +2402,12 @@ DEFUN ("menu-or-popup-active-p", 
Fmenu_or_popup_active_p, Smenu_or_popup_active_
   return (popup_activated ()) ? Qt : Qnil;
 }
 
+
+static void syms_of_xmenu_for_pdumper (void);
+
 void
 syms_of_xmenu (void)
 {
-#ifdef USE_X_TOOLKIT
-  enum { WIDGET_ID_TICK_START = 1 << 16 };
-  widget_id_tick = WIDGET_ID_TICK_START;
-  next_menubar_widget_id = 1;
-#endif
-
   DEFSYM (Qdebug_on_next_call, "debug-on-next-call");
   defsubr (&Smenu_or_popup_active_p);
 
@@ -2422,4 +2420,16 @@ syms_of_xmenu (void)
   Ffset (intern_c_string ("accelerate-menu"),
         intern_c_string (Sx_menu_bar_open_internal.s.symbol_name));
 #endif
+
+  pdumper_do_now_and_after_load (syms_of_xmenu_for_pdumper);
+}
+
+static void
+syms_of_xmenu_for_pdumper (void)
+{
+#ifdef USE_X_TOOLKIT
+  enum { WIDGET_ID_TICK_START = 1 << 16 };
+  widget_id_tick = WIDGET_ID_TICK_START;
+  next_menubar_widget_id = 1;
+#endif
 }
diff --git a/src/xml.c b/src/xml.c
index e85891d..60bd958 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -1,5 +1,5 @@
 /* Interface to libxml2.
-   Copyright (C) 2010-2018 Free Software Foundation, Inc.
+   Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/xrdb.c b/src/xrdb.c
index 4abf1ad..35de446 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -1,5 +1,5 @@
 /* Deal with the X Resource Manager.
-   Copyright (C) 1990, 1993-1994, 2000-2018 Free Software Foundation,
+   Copyright (C) 1990, 1993-1994, 2000-2019 Free Software Foundation,
    Inc.
 
 Author: Joseph Arceneaux
@@ -202,35 +202,6 @@ magic_db (const char *string, ptrdiff_t string_len, const 
char *class,
 }
 
 
-static char *
-gethomedir (void)
-{
-  struct passwd *pw;
-  char *ptr;
-  char *copy;
-
-  if ((ptr = getenv ("HOME")) == NULL)
-    {
-      if ((ptr = getenv ("LOGNAME")) != NULL
-         || (ptr = getenv ("USER")) != NULL)
-       pw = getpwnam (ptr);
-      else
-       pw = getpwuid (getuid ());
-
-      if (pw)
-       ptr = pw->pw_dir;
-    }
-
-  if (ptr == NULL)
-    return xstrdup ("/");
-
-  ptrdiff_t len = strlen (ptr);
-  copy = xmalloc (len + 2);
-  strcpy (copy + len, "/");
-  return memcpy (copy, ptr, len);
-}
-
-
 /* Find the first element of SEARCH_PATH which exists and is readable,
    after expanding the %-escapes.  Return 0 if we didn't find any, and
    the path name of the one we found otherwise.  */
@@ -316,12 +287,11 @@ get_user_app (const char *class)
   if (! db)
     {
       /* Check in the home directory.  This is a bit of a hack; let's
-        hope one's home directory doesn't contain any %-escapes.  */
-      char *home = gethomedir ();
+        hope one's home directory doesn't contain ':' or '%'.  */
+      char const *home = get_homedir ();
       db = search_magic_path (home, class, "%L/%N");
       if (! db)
        db = search_magic_path (home, class, "%N");
-      xfree (home);
     }
 
   return db;
@@ -346,10 +316,9 @@ get_user_db (Display *display)
   else
     {
       /* Use ~/.Xdefaults.  */
-      char *home = gethomedir ();
-      ptrdiff_t homelen = strlen (home);
-      char *filename = xrealloc (home, homelen + sizeof xdefaults);
-      strcpy (filename + homelen, xdefaults);
+      char const *home = get_homedir ();
+      char *filename = xmalloc (strlen (home) + 1 + sizeof xdefaults);
+      splice_dir_file (filename, home, xdefaults);
       db = XrmGetFileDatabase (filename);
       xfree (filename);
     }
@@ -380,13 +349,12 @@ get_environ_db (void)
       if (STRINGP (system_name))
        {
          /* Use ~/.Xdefaults-HOSTNAME.  */
-         char *home = gethomedir ();
-         ptrdiff_t homelen = strlen (home);
-         ptrdiff_t filenamesize = (homelen + sizeof xdefaults
-                                   + 1 + SBYTES (system_name));
-         p = filename = xrealloc (home, filenamesize);
-         lispstpcpy (stpcpy (stpcpy (filename + homelen, xdefaults), "-"),
-                     system_name);
+         char const *home = get_homedir ();
+         p = filename = xmalloc (strlen (home) + 1 + sizeof xdefaults
+                                 + 1 + SBYTES (system_name));
+         char *e = splice_dir_file (p, home, xdefaults);
+         *e++ = '/';
+         lispstpcpy (e, system_name);
        }
     }
 
diff --git a/src/xselect.c b/src/xselect.c
index a87784f..5f0bb44 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -1,5 +1,5 @@
 /* X Selection processing for Emacs.
-   Copyright (C) 1993-1997, 2000-2018 Free Software Foundation, Inc.
+   Copyright (C) 1993-1997, 2000-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -35,6 +35,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "blockinput.h"
 #include "termhooks.h"
 #include "keyboard.h"
+#include "pdumper.h"
 
 #include <X11/Xproto.h>
 
@@ -1084,10 +1085,10 @@ wait_for_property_change (struct prop_location 
*location)
      property_change_reply, because property_change_reply_object says so.  */
   if (! location->arrived)
     {
-      EMACS_INT timeout = max (0, x_selection_timeout);
-      EMACS_INT secs = timeout / 1000;
+      intmax_t timeout = max (0, x_selection_timeout);
+      intmax_t secs = timeout / 1000;
       int nsecs = (timeout % 1000) * 1000000;
-      TRACE2 ("  Waiting %"pI"d secs, %d nsecs", secs, nsecs);
+      TRACE2 ("  Waiting %"PRIdMAX" secs, %d nsecs", secs, nsecs);
       wait_reading_process_output (secs, nsecs, 0, false,
                                   property_change_reply, NULL, 0);
 
@@ -1157,8 +1158,6 @@ x_get_foreign_selection (Lisp_Object selection_symbol, 
Lisp_Object target_type,
   Atom type_atom = (CONSP (target_type)
                    ? symbol_to_x_atom (dpyinfo, XCAR (target_type))
                    : symbol_to_x_atom (dpyinfo, target_type));
-  EMACS_INT timeout, secs;
-  int nsecs;
 
   if (!FRAME_LIVE_P (f))
     return Qnil;
@@ -1194,10 +1193,10 @@ x_get_foreign_selection (Lisp_Object selection_symbol, 
Lisp_Object target_type,
   unblock_input ();
 
   /* This allows quits.  Also, don't wait forever.  */
-  timeout = max (0, x_selection_timeout);
-  secs = timeout / 1000;
-  nsecs = (timeout % 1000) * 1000000;
-  TRACE1 ("  Start waiting %"pI"d secs for SelectionNotify", secs);
+  intmax_t timeout = max (0, x_selection_timeout);
+  intmax_t secs = timeout / 1000;
+  int nsecs = (timeout % 1000) * 1000000;
+  TRACE1 ("  Start waiting %"PRIdMAX" secs for SelectionNotify", secs);
   wait_reading_process_output (secs, nsecs, 0, false,
                               reading_selection_reply, NULL, 0);
   TRACE1 ("  Got event = %d", !NILP (XCAR (reading_selection_reply)));
@@ -2474,7 +2473,7 @@ x_handle_dnd_message (struct frame *f, const 
XClientMessageEvent *event,
       data = (unsigned char *) idata;
     }
 
-  vec = Fmake_vector (make_fixnum (4), Qnil);
+  vec = make_nil_vector (4);
   ASET (vec, 0, SYMBOL_NAME (x_atom_to_symbol (FRAME_DISPLAY_INFO (f),
                                               event->message_type)));
   ASET (vec, 1, frame);
@@ -2613,6 +2612,9 @@ x_send_client_event (Lisp_Object display, Lisp_Object 
dest, Lisp_Object from,
 }
 
 
+
+static void syms_of_xselect_for_pdumper (void);
+
 void
 syms_of_xselect (void)
 {
@@ -2628,17 +2630,9 @@ syms_of_xselect (void)
 
   reading_selection_reply = Fcons (Qnil, Qnil);
   staticpro (&reading_selection_reply);
-  reading_selection_window = 0;
-  reading_which_selection = 0;
 
-  property_change_wait_list = 0;
-  prop_location_identifier = 0;
-  property_change_reply = Fcons (Qnil, Qnil);
   staticpro (&property_change_reply);
 
-  converted_selections = NULL;
-  conversion_fail_tag = None;
-
   /* FIXME: Duplicate definition in nsselect.c.  */
   DEFVAR_LISP ("selection-converter-alist", Vselection_converter_alist,
               doc: /* An alist associating X Windows selection-types with 
functions.
@@ -2717,4 +2711,18 @@ A value of 0 means wait as long as necessary.  This is 
initialized from the
   DEFSYM (Qforeign_selection, "foreign-selection");
   DEFSYM (Qx_lost_selection_functions, "x-lost-selection-functions");
   DEFSYM (Qx_sent_selection_functions, "x-sent-selection-functions");
+
+  pdumper_do_now_and_after_load (syms_of_xselect_for_pdumper);
+}
+
+static void
+syms_of_xselect_for_pdumper (void)
+{
+  reading_selection_window = 0;
+  reading_which_selection = 0;
+  property_change_wait_list = 0;
+  prop_location_identifier = 0;
+  property_change_reply = Fcons (Qnil, Qnil);
+  converted_selections = NULL;
+  conversion_fail_tag = None;
 }
diff --git a/src/xsettings.c b/src/xsettings.c
index 0b67db3..0c5e36d 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -1,6 +1,6 @@
 /* Functions for handling font and other changes dynamically.
 
-Copyright (C) 2009-2018 Free Software Foundation, Inc.
+Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -32,6 +32,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "keyboard.h"
 #include "blockinput.h"
 #include "termhooks.h"
+#include "pdumper.h"
 
 #include <X11/Xproto.h>
 
@@ -1023,13 +1024,18 @@ void
 syms_of_xsettings (void)
 {
   current_mono_font = NULL;
+  PDUMPER_IGNORE (current_mono_font);
   current_font = NULL;
+  PDUMPER_IGNORE (current_font);
   first_dpyinfo = NULL;
+  PDUMPER_IGNORE (first_dpyinfo);
 #ifdef HAVE_GSETTINGS
   gsettings_client = NULL;
+  PDUMPER_IGNORE (gsettings_client);
 #endif
 #ifdef HAVE_GCONF
   gconf_client = NULL;
+  PDUMPER_IGNORE (gconf_client);
 #endif
 
   DEFSYM (Qmonospace_font_name, "monospace-font-name");
diff --git a/src/xsettings.h b/src/xsettings.h
index 0c704f4..d5609f8 100644
--- a/src/xsettings.h
+++ b/src/xsettings.h
@@ -1,6 +1,6 @@
 /* Functions for handle font changes dynamically.
 
-Copyright (C) 2009-2018 Free Software Foundation, Inc.
+Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 2f1da6e..1706cdd 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -1,7 +1,7 @@
 /* Session management module for systems which understand the X Session
    management protocol.
 
-Copyright (C) 2002-2018 Free Software Foundation, Inc.
+Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/src/xterm.c b/src/xterm.c
index f8ea787..f90d671 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -1,6 +1,6 @@
 /* X Communication module for terminals which understand the X protocol.
 
-Copyright (C) 1989, 1993-2018 Free Software Foundation, Inc.
+Copyright (C) 1989, 1993-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -38,11 +38,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <X11/extensions/Xfixes.h>
 #endif
 
-/* Using Xft implies that XRender is available.  */
-#ifdef HAVE_XFT
-#include <X11/extensions/Xrender.h>
-#endif
-
 #ifdef HAVE_XDBE
 #include <X11/extensions/Xdbe.h>
 #endif
@@ -79,6 +74,7 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include "xsettings.h"
 #include "sysselect.h"
 #include "menu.h"
+#include "pdumper.h"
 
 #ifdef USE_X_TOOLKIT
 #include <X11/Shell.h>
@@ -360,10 +356,15 @@ x_begin_cr_clip (struct frame *f, GC gc)
 
       if (! FRAME_CR_SURFACE (f))
         {
+         int scale = 1;
+#ifdef USE_GTK
+         scale = xg_get_scale (f);
+#endif
+
          FRAME_CR_SURFACE (f) =
            cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
-                                       FRAME_PIXEL_WIDTH (f),
-                                       FRAME_PIXEL_HEIGHT (f));
+                                       scale * FRAME_PIXEL_WIDTH (f),
+                                       scale * FRAME_PIXEL_HEIGHT (f));
        }
       cr = cairo_create (FRAME_CR_SURFACE (f));
       FRAME_CR_CONTEXT (f) = cr;
@@ -425,7 +426,7 @@ x_set_cr_source_with_gc_background (struct frame *f, GC gc)
 /* Fringe bitmaps.  */
 
 static int max_fringe_bmp = 0;
-static cairo_pattern_t **fringe_bmp = 0;
+static cairo_surface_t **fringe_bmp = 0;
 
 static void
 x_cr_define_fringe_bitmap (int which, unsigned short *bits, int h, int wd)
@@ -433,13 +434,12 @@ x_cr_define_fringe_bitmap (int which, unsigned short 
*bits, int h, int wd)
   int i, stride;
   cairo_surface_t *surface;
   unsigned char *data;
-  cairo_pattern_t *pattern;
 
   if (which >= max_fringe_bmp)
     {
       i = max_fringe_bmp;
       max_fringe_bmp = which + 20;
-      fringe_bmp = (cairo_pattern_t **) xrealloc (fringe_bmp, max_fringe_bmp * 
sizeof (cairo_pattern_t *));
+      fringe_bmp = xrealloc (fringe_bmp, max_fringe_bmp * sizeof 
(*fringe_bmp));
       while (i < max_fringe_bmp)
        fringe_bmp[i++] = 0;
     }
@@ -457,12 +457,10 @@ x_cr_define_fringe_bitmap (int which, unsigned short 
*bits, int h, int wd)
     }
 
   cairo_surface_mark_dirty (surface);
-  pattern = cairo_pattern_create_for_surface (surface);
-  cairo_surface_destroy (surface);
 
   unblock_input ();
 
-  fringe_bmp[which] = pattern;
+  fringe_bmp[which] = surface;
 }
 
 static void
@@ -474,23 +472,20 @@ x_cr_destroy_fringe_bitmap (int which)
   if (fringe_bmp[which])
     {
       block_input ();
-      cairo_pattern_destroy (fringe_bmp[which]);
+      cairo_surface_destroy (fringe_bmp[which]);
       unblock_input ();
     }
   fringe_bmp[which] = 0;
 }
 
 static void
-x_cr_draw_image (struct frame *f, GC gc, cairo_pattern_t *image,
+x_cr_draw_image (struct frame *f, GC gc, cairo_surface_t *image,
+                int image_width, int image_height,
                 int src_x, int src_y, int width, int height,
                 int dest_x, int dest_y, bool overlay_p)
 {
-  cairo_t *cr;
-  cairo_matrix_t matrix;
-  cairo_surface_t *surface;
-  cairo_format_t format;
+  cairo_t *cr = x_begin_cr_clip (f, gc);
 
-  cr = x_begin_cr_clip (f, gc);
   if (overlay_p)
     cairo_rectangle (cr, dest_x, dest_y, width, height);
   else
@@ -499,21 +494,33 @@ x_cr_draw_image (struct frame *f, GC gc, cairo_pattern_t 
*image,
       cairo_rectangle (cr, dest_x, dest_y, width, height);
       cairo_fill_preserve (cr);
     }
-  cairo_clip (cr);
-  cairo_matrix_init_translate (&matrix, src_x - dest_x, src_y - dest_y);
-  cairo_pattern_set_matrix (image, &matrix);
-  cairo_pattern_get_surface (image, &surface);
-  format = cairo_image_surface_get_format (surface);
+
+  int orig_image_width = cairo_image_surface_get_width (image);
+  if (image_width == 0) image_width = orig_image_width;
+  int orig_image_height = cairo_image_surface_get_height (image);
+  if (image_height == 0) image_height = orig_image_height;
+
+  cairo_pattern_t *pattern = cairo_pattern_create_for_surface (image);
+  cairo_matrix_t matrix;
+  cairo_matrix_init_scale (&matrix, orig_image_width / (double) image_width,
+                          orig_image_height / (double) image_height);
+  cairo_matrix_translate (&matrix, src_x - dest_x, src_y - dest_y);
+  cairo_pattern_set_matrix (pattern, &matrix);
+
+  cairo_format_t format = cairo_image_surface_get_format (image);
   if (format != CAIRO_FORMAT_A8 && format != CAIRO_FORMAT_A1)
     {
-      cairo_set_source (cr, image);
+      cairo_set_source (cr, pattern);
       cairo_fill (cr);
     }
   else
     {
       x_set_cr_source_with_gc_foreground (f, gc);
-      cairo_mask (cr, image);
+      cairo_clip (cr);
+      cairo_mask (cr, pattern);
     }
+  cairo_pattern_destroy (pattern);
+
   x_end_cr_clip (f);
 }
 
@@ -999,8 +1006,9 @@ x_update_begin (struct frame *f)
       if (FRAME_GTK_WIDGET (f))
         {
           GdkWindow *w = gtk_widget_get_window (FRAME_GTK_WIDGET (f));
-          width = gdk_window_get_width (w);
-          height = gdk_window_get_height (w);
+         int scale = xg_get_scale (f);
+         width = scale * gdk_window_get_width (w);
+         height = scale * gdk_window_get_height (w);
         }
       else
 #endif
@@ -1300,7 +1308,11 @@ x_clear_under_internal_border (struct frame *f)
 #else
       int margin = FRAME_TOP_MARGIN_HEIGHT (f);
 #endif
-      struct face *face = FACE_FROM_ID_OR_NULL (f, INTERNAL_BORDER_FACE_ID);
+      int face_id =
+       !NILP (Vface_remapping_alist)
+       ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID)
+       : INTERNAL_BORDER_FACE_ID;
+      struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
 
       block_input ();
 
@@ -1363,7 +1375,11 @@ x_after_update_window_line (struct window *w, struct 
glyph_row *desired_row)
            height > 0))
       {
        int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
-       struct face *face = FACE_FROM_ID_OR_NULL (f, INTERNAL_BORDER_FACE_ID);
+       int face_id =
+         !NILP (Vface_remapping_alist)
+         ? lookup_basic_face (NULL, f, INTERNAL_BORDER_FACE_ID)
+         : INTERNAL_BORDER_FACE_ID;
+       struct face *face = FACE_FROM_ID_OR_NULL (f, face_id);
 
        block_input ();
        if (face)
@@ -1428,7 +1444,7 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row 
*row, struct draw_fring
                                       : f->output_data.x->cursor_pixel)
                                    : face->foreground));
       XSetBackground (display, gc, face->background);
-      x_cr_draw_image (f, gc, fringe_bmp[p->which], 0, p->dh,
+      x_cr_draw_image (f, gc, fringe_bmp[p->which], 0, 0, 0, p->dh,
                       p->wd, p->h, p->x, p->y, p->overlay_p);
       XSetForeground (display, gc, gcv.foreground);
       XSetBackground (display, gc, gcv.background);
@@ -1509,7 +1525,9 @@ static void x_setup_relief_colors (struct glyph_string *);
 static void x_draw_image_glyph_string (struct glyph_string *);
 static void x_draw_image_relief (struct glyph_string *);
 static void x_draw_image_foreground (struct glyph_string *);
+#ifndef USE_CAIRO
 static void x_draw_image_foreground_1 (struct glyph_string *, Pixmap);
+#endif
 static void x_clear_glyph_string_rect (struct glyph_string *, int,
                                        int, int, int);
 static void x_draw_relief_rect (struct frame *, int, int, int, int,
@@ -2970,6 +2988,47 @@ x_draw_glyph_string_box (struct glyph_string *s)
 }
 
 
+static void
+x_composite_image (struct glyph_string *s, Pixmap dest,
+                   int srcX, int srcY, int dstX, int dstY,
+                   int width, int height)
+{
+#ifdef HAVE_XRENDER
+  if (s->img->picture)
+    {
+      Picture destination;
+      XRenderPictFormat *default_format;
+      XRenderPictureAttributes attr;
+
+      /* FIXME: Should we do this each time or would it make sense to
+         store destination in the frame struct?  */
+      default_format = XRenderFindVisualFormat (s->display,
+                                                DefaultVisual (s->display, 0));
+      destination = XRenderCreatePicture (s->display, dest,
+                                          default_format, 0, &attr);
+
+      /* FIXME: It may make sense to use PictOpSrc instead of
+         PictOpOver, as I don't know if we care about alpha values too
+         much here.  */
+      XRenderComposite (s->display, PictOpOver,
+                        s->img->picture, s->img->mask_picture, destination,
+                        srcX, srcY,
+                        srcX, srcY,
+                        dstX, dstY,
+                        width, height);
+
+      XRenderFreePicture (s->display, destination);
+      return;
+    }
+#endif
+
+  XCopyArea (s->display, s->img->pixmap,
+            dest, s->gc,
+            srcX, srcY,
+            width, height, dstX, dstY);
+}
+
+
 /* Draw foreground of image glyph string S.  */
 
 static void
@@ -2992,6 +3051,32 @@ x_draw_image_foreground (struct glyph_string *s)
   if (s->slice.y == 0)
     y += s->img->vmargin;
 
+#ifdef USE_CAIRO
+  if (s->img->cr_data)
+    {
+      x_set_glyph_string_clipping (s);
+      x_cr_draw_image (s->f, s->gc,
+                      s->img->cr_data, s->img->width, s->img->height,
+                      s->slice.x, s->slice.y, s->slice.width, s->slice.height,
+                      x, y, true);
+      if (!s->img->mask)
+       {
+         /* When the image has a mask, we can expect that at
+            least part of a mouse highlight or a block cursor will
+            be visible.  If the image doesn't have a mask, make
+            a block cursor visible by drawing a rectangle around
+            the image.  I believe it's looking better if we do
+            nothing here for mouse-face.  */
+         if (s->hl == DRAW_CURSOR)
+           {
+             int relief = eabs (s->img->relief);
+             x_draw_rectangle (s->f, s->gc, x - relief, y - relief,
+                               s->slice.width + relief*2 - 1,
+                               s->slice.height + relief*2 - 1);
+           }
+       }
+    }
+#else  /* ! USE_CAIRO */
   if (s->img->pixmap)
     {
       if (s->img->mask)
@@ -3001,6 +3086,7 @@ x_draw_image_foreground (struct glyph_string *s)
             trust on the shape extension to be available
             (XShapeCombineRegion).  So, compute the rectangle to draw
             manually.  */
+          /* FIXME: Do we need to do this when using XRender compositing?  */
          unsigned long mask = (GCClipMask | GCClipXOrigin | GCClipYOrigin
                                | GCFunction);
          XGCValues xgcv;
@@ -3018,10 +3104,9 @@ x_draw_image_foreground (struct glyph_string *s)
          image_rect.width = s->slice.width;
          image_rect.height = s->slice.height;
          if (x_intersect_rectangles (&clip_rect, &image_rect, &r))
-            XCopyArea (s->display, s->img->pixmap,
-                       FRAME_X_DRAWABLE (s->f), s->gc,
-                      s->slice.x + r.x - x, s->slice.y + r.y - y,
-                      r.width, r.height, r.x, r.y);
+            x_composite_image (s, FRAME_X_DRAWABLE (s->f),
+                              s->slice.x + r.x - x, s->slice.y + r.y - y,
+                               r.x, r.y, r.width, r.height);
        }
       else
        {
@@ -3033,10 +3118,8 @@ x_draw_image_foreground (struct glyph_string *s)
          image_rect.width = s->slice.width;
          image_rect.height = s->slice.height;
          if (x_intersect_rectangles (&clip_rect, &image_rect, &r))
-            XCopyArea (s->display, s->img->pixmap,
-                       FRAME_X_DRAWABLE (s->f), s->gc,
-                      s->slice.x + r.x - x, s->slice.y + r.y - y,
-                      r.width, r.height, r.x, r.y);
+            x_composite_image (s, FRAME_X_DRAWABLE (s->f), s->slice.x + r.x - 
x, s->slice.y + r.y - y,
+                               r.x, r.y, r.width, r.height);
 
          /* When the image has a mask, we can expect that at
             least part of a mouse highlight or a block cursor will
@@ -3054,6 +3137,7 @@ x_draw_image_foreground (struct glyph_string *s)
            }
        }
     }
+#endif /* ! USE_CAIRO */
   else
     /* Draw a rectangle if image could not be loaded.  */
     x_draw_rectangle (s->f, s->gc, x, y,
@@ -3090,7 +3174,9 @@ x_draw_image_relief (struct glyph_string *s)
   if (s->hl == DRAW_IMAGE_SUNKEN
       || s->hl == DRAW_IMAGE_RAISED)
     {
-      thick = tool_bar_button_relief >= 0 ? tool_bar_button_relief : 
DEFAULT_TOOL_BAR_BUTTON_RELIEF;
+      thick = (tool_bar_button_relief < 0
+              ? DEFAULT_TOOL_BAR_BUTTON_RELIEF
+              : min (tool_bar_button_relief, 1000000));
       raised_p = s->hl == DRAW_IMAGE_RAISED;
     }
   else
@@ -3134,6 +3220,7 @@ x_draw_image_relief (struct glyph_string *s)
 }
 
 
+#ifndef USE_CAIRO
 /* Draw the foreground of image glyph string S to PIXMAP.  */
 
 static void
@@ -3206,6 +3293,7 @@ x_draw_image_foreground_1 (struct glyph_string *s, Pixmap 
pixmap)
     x_draw_rectangle (s->f, s->gc, x, y,
                    s->slice.width - 1, s->slice.height - 1);
 }
+#endif /* ! USE_CAIRO */
 
 
 /* Draw part of the background of glyph string S.  X, Y, W, and H
@@ -3265,6 +3353,7 @@ x_draw_image_glyph_string (struct glyph_string *s)
       || s->img->pixmap == 0
       || s->width != s->background_width)
     {
+#ifndef USE_CAIRO
       if (s->img->mask)
        {
          /* Create a pixmap as large as the glyph string.  Fill it
@@ -3305,6 +3394,7 @@ x_draw_image_glyph_string (struct glyph_string *s)
            }
        }
       else
+#endif /* ! USE_CAIRO */
        {
          int x = s->x;
          int y = s->y;
@@ -3327,25 +3417,8 @@ x_draw_image_glyph_string (struct glyph_string *s)
     }
 
   /* Draw the foreground.  */
-#ifdef USE_CAIRO
-  if (s->img->cr_data)
-    {
-      cairo_t *cr = x_begin_cr_clip (s->f, s->gc);
-
-      int x = s->x + s->img->hmargin;
-      int y = s->y + s->img->vmargin;
-      int width = s->background_width;
-
-      cairo_set_source_surface (cr, s->img->cr_data,
-                                x - s->slice.x,
-                                y - s->slice.y);
-      cairo_rectangle (cr, x, y, width, height);
-      cairo_fill (cr);
-      x_end_cr_clip (s->f);
-    }
-  else
-#endif
-    if (pixmap != None)
+#ifndef USE_CAIRO
+  if (pixmap != None)
     {
       x_draw_image_foreground_1 (s, pixmap);
       x_set_glyph_string_clipping (s);
@@ -3354,6 +3427,7 @@ x_draw_image_glyph_string (struct glyph_string *s)
       XFreePixmap (s->display, pixmap);
     }
   else
+#endif /* ! USE_CAIRO */
     x_draw_image_foreground (s);
 
   /* If we must draw a relief around the image, do it.  */
@@ -4264,7 +4338,6 @@ x_scroll_run (struct window *w, struct run *run)
 #ifdef USE_CAIRO
   if (FRAME_CR_CONTEXT (f))
     {
-      int wx = WINDOW_LEFT_EDGE_X (w);
       cairo_surface_t *s = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
                                                       width, height);
       cairo_t *cr = cairo_create (s);
@@ -4275,8 +4348,8 @@ x_scroll_run (struct window *w, struct run *run)
 
       cr = FRAME_CR_CONTEXT (f);
       cairo_save (cr);
-      cairo_set_source_surface (cr, s, wx, to_y);
-      cairo_rectangle (cr, wx, to_y, width, height);
+      cairo_set_source_surface (cr, s, x, to_y);
+      cairo_rectangle (cr, x, to_y, width, height);
       cairo_fill (cr);
       cairo_restore (cr);
       cairo_surface_destroy (s);
@@ -4843,7 +4916,7 @@ x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, 
int state)
 }
 
 static int
-x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, EMACS_INT state)
+x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, intmax_t state)
 {
   EMACS_INT mod_ctrl = ctrl_modifier;
   EMACS_INT mod_meta = meta_modifier;
@@ -10644,7 +10717,7 @@ get_current_wm_state (struct frame *f,
   int rc, actual_format;
   Atom actual_type;
   unsigned char *tmp_data = NULL;
-  Atom *reply_data;
+  Atom *reply_data UNINIT;
 #endif
 
   *sticky = false;
@@ -11138,8 +11211,7 @@ x_set_window_size_1 (struct frame *f, bool 
change_gravity,
     {
       frame_size_history_add
        (f, Qx_set_window_size_1, width, height,
-        list2 (make_fixnum (old_height),
-               make_fixnum (pixelheight + FRAME_MENUBAR_HEIGHT (f))));
+        list2i (old_height, pixelheight + FRAME_MENUBAR_HEIGHT (f)));
 
       XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                     old_width, pixelheight + FRAME_MENUBAR_HEIGHT (f));
@@ -11148,7 +11220,7 @@ x_set_window_size_1 (struct frame *f, bool 
change_gravity,
     {
       frame_size_history_add
        (f, Qx_set_window_size_2, width, height,
-        list2 (make_fixnum (old_width), make_fixnum (pixelwidth)));
+        list2i (old_width, pixelwidth));
 
       XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                     pixelwidth, old_height);
@@ -11158,10 +11230,10 @@ x_set_window_size_1 (struct frame *f, bool 
change_gravity,
     {
       frame_size_history_add
        (f, Qx_set_window_size_3, width, height,
-        list3 (make_fixnum (pixelwidth + FRAME_TOOLBAR_WIDTH (f)),
-               make_fixnum (pixelheight + FRAME_TOOLBAR_HEIGHT (f)
-                            + FRAME_MENUBAR_HEIGHT (f)),
-               make_fixnum (FRAME_MENUBAR_HEIGHT (f))));
+        list3i (pixelwidth + FRAME_TOOLBAR_WIDTH (f),
+                (pixelheight + FRAME_TOOLBAR_HEIGHT (f)
+                 + FRAME_MENUBAR_HEIGHT (f)),
+                FRAME_MENUBAR_HEIGHT (f)));
 
       XResizeWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
                     pixelwidth, pixelheight + FRAME_MENUBAR_HEIGHT (f));
@@ -13258,6 +13330,7 @@ void
 syms_of_xterm (void)
 {
   x_error_message = NULL;
+  PDUMPER_IGNORE (x_error_message);
 
   DEFSYM (Qvendor_specific_keysyms, "vendor-specific-keysyms");
   DEFSYM (Qlatin_1, "latin-1");
diff --git a/src/xterm.h b/src/xterm.h
index 2ea8a93..972a10f 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1,5 +1,5 @@
 /* Definitions and headers for communication with X protocol.
-   Copyright (C) 1989, 1993-1994, 1998-2018 Free Software Foundation,
+   Copyright (C) 1989, 1993-1994, 1998-2019 Free Software Foundation,
    Inc.
 
 This file is part of GNU Emacs.
diff --git a/src/xwidget.c b/src/xwidget.c
index 4739993..c562849 100644
--- a/src/xwidget.c
+++ b/src/xwidget.c
@@ -1,6 +1,6 @@
 /* Support for embedding graphical components in a buffer.
 
-Copyright (C) 2011-2018 Free Software Foundation, Inc.
+Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -30,6 +30,14 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 #include <webkit2/webkit2.h>
 #include <JavaScriptCore/JavaScript.h>
 
+/* Suppress GCC deprecation warnings starting in WebKitGTK+ 2.21.1 for
+   webkit_javascript_result_get_global_context and
+   webkit_javascript_result_get_value (Bug#33679).
+   FIXME: Use the JavaScriptCore GLib API instead, and remove this hack.  */
+#if WEBKIT_CHECK_VERSION (2, 21, 1) && GNUC_PREREQ (4, 2, 0)
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
 static struct xwidget *
 allocate_xwidget (void)
 {
@@ -78,6 +86,8 @@ Returns the newly constructed xwidget, or nil if construction 
fails.  */)
    Lisp_Object title, Lisp_Object width, Lisp_Object height,
    Lisp_Object arguments, Lisp_Object buffer)
 {
+  if (!xg_gtk_initialized)
+    error ("make-xwidget: GTK has not been initialized");
   CHECK_SYMBOL (type);
   CHECK_FIXNAT (width);
   CHECK_FIXNAT (height);
@@ -300,11 +310,15 @@ webkit_js_to_lisp (JSContextRef context, JSValueRef value)
         if (JSValueIsArray (context, value))
           {
             JSStringRef pname = JSStringCreateWithUTF8CString("length");
-            JSValueRef len = JSObjectGetProperty (context, (JSObjectRef) 
value, pname, NULL);
-            EMACS_INT n = JSValueToNumber (context, len, NULL);
+           JSValueRef len = JSObjectGetProperty (context, (JSObjectRef) value,
+                                                 pname, NULL);
+           double dlen = JSValueToNumber (context, len, NULL);
             JSStringRelease(pname);
 
             Lisp_Object obj;
+           if (! (0 <= dlen && dlen < PTRDIFF_MAX + 1.0))
+             memory_full (SIZE_MAX);
+           ptrdiff_t n = dlen;
             struct Lisp_Vector *p = allocate_vector (n);
 
             for (ptrdiff_t i = 0; i < n; ++i)
@@ -323,10 +337,12 @@ webkit_js_to_lisp (JSContextRef context, JSValueRef value)
             JSPropertyNameArrayRef properties =
               JSObjectCopyPropertyNames (context, (JSObjectRef) value);
 
-            ptrdiff_t n = JSPropertyNameArrayGetCount (properties);
+           size_t n = JSPropertyNameArrayGetCount (properties);
             Lisp_Object obj;
 
             /* TODO: can we use a regular list here?  */
+           if (PTRDIFF_MAX < n)
+             memory_full (n);
             struct Lisp_Vector *p = allocate_vector (n);
 
             for (ptrdiff_t i = 0; i < n; ++i)
@@ -513,6 +529,10 @@ xwidget_init_view (struct xwidget *xww,
                    struct glyph_string *s,
                    int x, int y)
 {
+
+  if (!xg_gtk_initialized)
+    error ("xwidget_init_view: GTK has not been initialized");
+
   struct xwidget_view *xv = allocate_xwidget_view ();
   Lisp_Object val;
 
@@ -713,7 +733,7 @@ save_script_callback (struct xwidget *xw, Lisp_Object 
script, Lisp_Object fun)
 {
   Lisp_Object cbs = xw->script_callbacks;
   if (NILP (cbs))
-    xw->script_callbacks = cbs = Fmake_vector (make_fixnum (32), Qnil);
+    xw->script_callbacks = cbs = make_nil_vector (32);
 
   /* Find first free index.  */
   ptrdiff_t idx;
@@ -811,8 +831,7 @@ Emacs allocated area accordingly.  */)
   CHECK_XWIDGET (xwidget);
   GtkRequisition requisition;
   gtk_widget_size_request (XXWIDGET (xwidget)->widget_osr, &requisition);
-  return list2 (make_fixnum (requisition.width),
-               make_fixnum (requisition.height));
+  return list2i (requisition.width, requisition.height);
 }
 
 DEFUN ("xwidgetp",
@@ -1014,8 +1033,6 @@ syms_of_xwidget (void)
   defsubr (&Sxwidget_buffer);
   defsubr (&Sset_xwidget_plist);
 
-  DEFSYM (Qxwidget, "xwidget");
-
   DEFSYM (QCxwidget, ":xwidget");
   DEFSYM (QCtitle, ":title");
 
diff --git a/src/xwidget.h b/src/xwidget.h
index c203d4f..8c598ef 100644
--- a/src/xwidget.h
+++ b/src/xwidget.h
@@ -1,6 +1,6 @@
 /* Support for embedding graphical components in a buffer.
 
-Copyright (C) 2011-2018 Free Software Foundation, Inc.
+Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
diff --git a/test/ChangeLog.1 b/test/ChangeLog.1
index 279238f..0ed7b9a 100644
--- a/test/ChangeLog.1
+++ b/test/ChangeLog.1
@@ -2952,7 +2952,7 @@
 ;; coding: utf-8
 ;; End:
 
-  Copyright (C) 2008-2018 Free Software Foundation, Inc.
+  Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
   This file is part of GNU Emacs.
 
diff --git a/test/Makefile.in b/test/Makefile.in
index adb316c..ce6ce04 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -1,6 +1,6 @@
 ### @configure_input@
 
-# Copyright (C) 2010-2018 Free Software Foundation, Inc.
+# Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 # This file is part of GNU Emacs.
 
@@ -190,6 +190,12 @@ else
 maybe_exclude_module_tests := -name emacs-module-tests.el -prune -o
 endif
 
+## Optional list of .el files to exclude from testing.
+## Intended for use in automated testing where one or more files
+## has some problem and needs to be excluded.
+## To avoid writing full name, can use eg %foo-tests.el.
+EXCLUDE_TESTS =
+
 ## To speed up parallel builds, put these slow test files (which can
 ## take longer than all the rest combined) at the start of the list.
 SLOW_TESTS = ${srcdir}/lisp/net/tramp-tests.el
@@ -202,6 +208,8 @@ ELFILES := $(sort $(shell find ${srcdir} -path 
"${srcdir}/manual" -prune -o \
 
 $(foreach slow,${SLOW_TESTS},$(eval ELFILES:= ${slow} $(filter-out 
${slow},${ELFILES})))
 
+$(foreach exclude,${EXCLUDE_TESTS},$(eval ELFILES:= $(filter-out 
${exclude},${ELFILES})))
+
 ## .log files may be in a different directory for out of source builds
 LOGFILES := $(patsubst %.el,%.log, \
                $(patsubst $(srcdir)/%,%,$(ELFILES)))
@@ -246,17 +254,21 @@ else
 FPIC_CFLAGS = -fPIC
 endif
 
+HYBRID_MALLOC = @HYBRID_MALLOC@
+LIBEGNU_ARCHIVE = ../lib/lib$(if $(HYBRID_MALLOC),e)gnu.a
+
 # Note: emacs-module.h is generated from emacs-module.h.in, hence we
 # look in ../src, not $(srcdir)/../src.
-MODULE_CFLAGS = -I../src $(FPIC_CFLAGS) $(PROFILING_CFLAGS) \
+MODULE_CFLAGS = -I../src -I$(srcdir)/../lib \
+  $(FPIC_CFLAGS) $(PROFILING_CFLAGS) \
   $(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS)
 
 test_module = $(test_module_dir)/mod-test${SO}
 src/emacs-module-tests.log: $(test_module)
-$(test_module): $(test_module:${SO}=.c) ../src/emacs-module.h
+$(test_module): $(test_module:${SO}=.c) ../src/emacs-module.h 
$(LIBEGNU_ARCHIVE)
        $(AM_V_at)${MKDIR_P} $(dir $@)
        $(AM_V_CCLD)$(CC) -shared $(CPPFLAGS) $(MODULE_CFLAGS) $(LDFLAGS) \
-         -o $@ $<
+         -o $@ $< $(LIBEGNU_ARCHIVE)
 endif
 
 ## Check that there is no 'automated' subdirectory, which would
diff --git a/test/README b/test/README
index 83ee261..cd6905d 100644
--- a/test/README
+++ b/test/README
@@ -1,4 +1,4 @@
-Copyright (C) 2008-2018 Free Software Foundation, Inc.
+Copyright (C) 2008-2019 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
 This directory contains files intended to test various aspects of
@@ -79,6 +79,25 @@ debugging.  To do that, use
 
     make TEST_INTERACTIVE=yes ...
 
+Some of the tests require a remote temporary directory
+(filenotify-tests.el, shadowfile-tests.el and tramp-tests.el).  Per
+default, a mock-up connection method is used (this might not be
+possible when running on MS Windows).  If you want to test a real
+remote connection, set $REMOTE_TEMPORARY_FILE_DIRECTORY to a suitable
+value in order to overwrite the default value:
+
+  env REMOTE_TEMPORARY_FILE_DIRECTORY=/ssh:host:/tmp make ...
+
+
+There are also continuous integration tests on
+<https://hydra.nixos.org/jobset/gnu/emacs-trunk> (see
+admin/notes/hydra) and <https://emba.gnu.org/emacs/emacs>.  Both
+environments provide an environment variable, which could be used to
+determine, whether the tests run in one of these test environments.
+
+$EMACS_HYDRA_CI indicates the hydra environment, and $EMACS_EMBA_CI
+indicates the emba environment, respectively.
+
 
 (Also, see etc/compilation.txt for compilation mode font lock tests.)
 
diff --git a/test/data/decompress/tg.tar.gz b/test/data/decompress/tg.tar.gz
new file mode 100644
index 0000000..3dc8185
Binary files /dev/null and b/test/data/decompress/tg.tar.gz differ
diff --git a/test/data/decompress/zg.zip b/test/data/decompress/zg.zip
new file mode 100644
index 0000000..c4c998e
Binary files /dev/null and b/test/data/decompress/zg.zip differ
diff --git a/test/data/emacs-module/mod-test.c 
b/test/data/emacs-module/mod-test.c
index a9b459b..a39e41a 100644
--- a/test/data/emacs-module/mod-test.c
+++ b/test/data/emacs-module/mod-test.c
@@ -1,6 +1,6 @@
 /* Test GNU Emacs modules.
 
-Copyright 2015-2018 Free Software Foundation, Inc.
+Copyright 2015-2019 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -17,12 +17,20 @@ 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/>.  */
 
+#include "config.h"
+
 #include <assert.h>
+#include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <limits.h>
+#include <string.h>
+#include <time.h>
+
 #include <emacs-module.h>
 
+#include "timespec.h"
+
 int plugin_is_GPL_compatible;
 
 #if INTPTR_MAX <= 0
@@ -86,7 +94,7 @@ Fmod_test_signal (emacs_env *env, ptrdiff_t nargs, 
emacs_value args[],
   assert (env->non_local_exit_check (env) == emacs_funcall_exit_return);
   env->non_local_exit_signal (env, env->intern (env, "error"),
                              env->make_integer (env, 56));
-  return env->intern (env, "nil");
+  return NULL;
 }
 
 
@@ -98,7 +106,7 @@ Fmod_test_throw (emacs_env *env, ptrdiff_t nargs, 
emacs_value args[],
   assert (env->non_local_exit_check (env) == emacs_funcall_exit_return);
   env->non_local_exit_throw (env, env->intern (env, "tag"),
                             env->make_integer (env, 65));
-  return env->intern (env, "nil");
+  return NULL;
 }
 
 
@@ -296,9 +304,67 @@ Fmod_test_invalid_finalizer (emacs_env *env, ptrdiff_t 
nargs, emacs_value *args,
 {
   current_env = env;
   env->make_user_ptr (env, invalid_finalizer, NULL);
-  return env->funcall (env, env->intern (env, "garbage-collect"), 0, NULL);
+  return env->intern (env, "nil");
+}
+
+static void
+signal_wrong_type_argument (emacs_env *env, const char *predicate,
+                            emacs_value arg)
+{
+  emacs_value symbol = env->intern (env, "wrong-type-argument");
+  emacs_value elements[2] = {env->intern (env, predicate), arg};
+  emacs_value data = env->funcall (env, env->intern (env, "list"), 2, 
elements);
+  env->non_local_exit_signal (env, symbol, data);
 }
 
+static void
+signal_errno (emacs_env *env, const char *function)
+{
+  const char *message = strerror (errno);
+  emacs_value message_value = env->make_string (env, message, strlen 
(message));
+  emacs_value symbol = env->intern (env, "file-error");
+  emacs_value elements[2]
+    = {env->make_string (env, function, strlen (function)), message_value};
+  emacs_value data = env->funcall (env, env->intern (env, "list"), 2, 
elements);
+  env->non_local_exit_signal (env, symbol, data);
+}
+
+/* A long-running operation that occasionally calls `should_quit' or
+   `process_input'.  */
+
+static emacs_value
+Fmod_test_sleep_until (emacs_env *env, ptrdiff_t nargs, emacs_value *args,
+                       void *data)
+{
+  assert (nargs == 2);
+  const double until_seconds = env->extract_float (env, args[0]);
+  if (env->non_local_exit_check (env))
+    return NULL;
+  if (until_seconds <= 0)
+    {
+      signal_wrong_type_argument (env, "cl-plusp", args[0]);
+      return NULL;
+    }
+  const bool process_input = env->is_not_nil (env, args[1]);
+  const struct timespec until = dtotimespec (until_seconds);
+  const struct timespec amount = make_timespec(0,  10000000);
+  while (true)
+    {
+      const struct timespec now = current_timespec ();
+      if (timespec_cmp (now, until) >= 0)
+        break;
+      if (nanosleep (&amount, NULL) && errno != EINTR)
+        {
+          signal_errno (env, "nanosleep");
+          return NULL;
+        }
+      if ((process_input
+           && env->process_input (env) == emacs_process_input_quit)
+          || env->should_quit (env))
+        return NULL;
+    }
+  return env->intern (env, "finished");
+}
 
 /* Lisp utilities for easier readability (simple wrappers).  */
 
@@ -367,6 +433,7 @@ emacs_module_init (struct emacs_runtime *ert)
   DEFUN ("mod-test-invalid-load", Fmod_test_invalid_load, 0, 0, NULL, NULL);
   DEFUN ("mod-test-invalid-finalizer", Fmod_test_invalid_finalizer, 0, 0,
          NULL, NULL);
+  DEFUN ("mod-test-sleep-until", Fmod_test_sleep_until, 2, 2, NULL, NULL);
 
 #undef DEFUN
 
diff --git a/test/data/shr/ol.html b/test/data/shr/ol.html
new file mode 100644
index 0000000..f9a15f2
--- /dev/null
+++ b/test/data/shr/ol.html
@@ -0,0 +1,29 @@
+<ol>
+  <li>one</li>
+  <li>two</li>
+  <li>three</li>
+</ol>
+
+<ol start="10">
+  <li>ten</li>
+  <li>eleven</li>
+  <li>twelve</li>
+</ol>
+
+<ol start="0">
+  <li>zero</li>
+  <li>one</li>
+  <li>two</li>
+</ol>
+
+<ol start="-5">
+  <li>minus five</li>
+  <li>minus four</li>
+  <li>minus three</li>
+</ol>
+
+<ol start="notanumber">
+  <li>one</li>
+  <li>two</li>
+  <li>three</li>
+</ol>
diff --git a/test/data/shr/ol.txt b/test/data/shr/ol.txt
new file mode 100644
index 0000000..0d46e2a
--- /dev/null
+++ b/test/data/shr/ol.txt
@@ -0,0 +1,19 @@
+1 one
+2 two
+3 three
+
+10 ten
+11 eleven
+12 twelve
+
+0 zero
+1 one
+2 two
+
+-5 minus five
+-4 minus four
+-3 minus three
+
+1 one
+2 two
+3 three
diff --git a/test/data/vc/diff-mode/hello_emacs.c 
b/test/data/vc/diff-mode/hello_emacs.c
new file mode 100644
index 0000000..c7ed753
--- /dev/null
+++ b/test/data/vc/diff-mode/hello_emacs.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+int main()
+{
+  printf("Hello, Emacs!\n");
+  return 0;
+}
diff --git a/test/data/vc/diff-mode/hello_emacs_1.c 
b/test/data/vc/diff-mode/hello_emacs_1.c
new file mode 100644
index 0000000..62145a6
--- /dev/null
+++ b/test/data/vc/diff-mode/hello_emacs_1.c
@@ -0,0 +1 @@
+int main() { printf("Hello, Emacs!\n"); return 0; }
\ No newline at end of file
diff --git a/test/data/vc/diff-mode/hello_world.c 
b/test/data/vc/diff-mode/hello_world.c
new file mode 100644
index 0000000..dcbe06c
--- /dev/null
+++ b/test/data/vc/diff-mode/hello_world.c
@@ -0,0 +1,6 @@
+#include <stdio.h>
+int main()
+{
+  printf("Hello, World!\n");
+  return 0;
+}
diff --git a/test/data/vc/diff-mode/hello_world_1.c 
b/test/data/vc/diff-mode/hello_world_1.c
new file mode 100644
index 0000000..606afb3
--- /dev/null
+++ b/test/data/vc/diff-mode/hello_world_1.c
@@ -0,0 +1 @@
+int main() { printf("Hello, World!\n"); return 0; }
\ No newline at end of file
diff --git a/test/lib-src/emacsclient-tests.el 
b/test/lib-src/emacsclient-tests.el
index 9676595..0b58fef 100644
--- a/test/lib-src/emacsclient-tests.el
+++ b/test/lib-src/emacsclient-tests.el
@@ -1,6 +1,6 @@
 ;;; emacsclient-tests.el --- Test emacsclient
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/abbrev-tests.el b/test/lisp/abbrev-tests.el
index e50f931..3b8acf5 100644
--- a/test/lisp/abbrev-tests.el
+++ b/test/lisp/abbrev-tests.el
@@ -1,6 +1,6 @@
 ;;; abbrev-tests.el --- Test suite for abbrevs  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii <address@hidden>
 ;; Keywords: abbrevs
diff --git a/test/lisp/arc-mode-tests.el b/test/lisp/arc-mode-tests.el
index c82599a..79d3ac6 100644
--- a/test/lisp/arc-mode-tests.el
+++ b/test/lisp/arc-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; arc-mode-tests.el --- Test suite for arc-mode. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -21,6 +21,8 @@
 (require 'ert)
 (require 'arc-mode)
 
+(defvar arc-mode-tests-data-directory
+  (expand-file-name "test/data/decompress" source-directory))
 
 (ert-deftest arc-mode-test-archive-int-to-mode ()
   (let ((alist (list (cons 448 "-rwx------")
@@ -32,6 +34,18 @@
     (dolist (x alist)
       (should (equal (cdr x) (archive-int-to-mode (car x)))))))
 
+(ert-deftest arc-mode-test-zip-extract-gz ()
+  (skip-unless (and archive-zip-extract (executable-find (car 
archive-zip-extract))))
+  (skip-unless (executable-find "gzip"))
+  (let* ((zip-file (expand-file-name "zg.zip" arc-mode-tests-data-directory))
+         zip-buffer gz-buffer)
+    (unwind-protect
+        (with-current-buffer (setq zip-buffer (find-file-noselect zip-file))
+          (setq gz-buffer (archive-extract))
+          (should (equal (char-after) ?\N{SNOWFLAKE})))
+      (when (buffer-live-p zip-buffer) (kill-buffer zip-buffer))
+      (when (buffer-live-p gz-buffer) (kill-buffer gz-buffer)))))
+
 (provide 'arc-mode-tests)
 
 ;; arc-mode-tests.el ends here
diff --git a/test/lisp/auth-source-pass-tests.el 
b/test/lisp/auth-source-pass-tests.el
index b30419f..d1e486a 100644
--- a/test/lisp/auth-source-pass-tests.el
+++ b/test/lisp/auth-source-pass-tests.el
@@ -1,6 +1,6 @@
 ;;; auth-source-pass-tests.el --- Tests for auth-source-pass.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2013, 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013, 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Damien Cassou <address@hidden>
 
diff --git a/test/lisp/auth-source-tests.el b/test/lisp/auth-source-tests.el
index ca8a3eb..c8460c0 100644
--- a/test/lisp/auth-source-tests.el
+++ b/test/lisp/auth-source-tests.el
@@ -1,6 +1,6 @@
 ;;; auth-source-tests.el --- Tests for auth-source.el  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Damien Cassou <address@hidden>,
 ;;         Nicolas Petton <address@hidden>
diff --git a/test/lisp/autorevert-tests.el b/test/lisp/autorevert-tests.el
index 9710600..6e8219d 100644
--- a/test/lisp/autorevert-tests.el
+++ b/test/lisp/autorevert-tests.el
@@ -1,6 +1,6 @@
 ;;; auto-revert-tests.el --- Tests of auto-revert
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 
@@ -159,6 +159,9 @@ This expects `auto-revert--messages' to be bound by
 (ert-deftest auto-revert-test02-auto-revert-deleted-file ()
   "Check autorevert for a deleted file."
   :tags '(:expensive-test)
+  ;; Repeated unpredictable failures, bug#32645.
+  ;; Unlikely to be hydra-specific?
+  (skip-unless (not (getenv "EMACS_HYDRA_CI")))
 
   (let ((tmpfile (make-temp-file "auto-revert-test"))
         buf desc)
diff --git a/test/lisp/buff-menu-tests.el b/test/lisp/buff-menu-tests.el
index a942a56..d49abc4 100644
--- a/test/lisp/buff-menu-tests.el
+++ b/test/lisp/buff-menu-tests.el
@@ -1,6 +1,6 @@
 ;;; buff-menu-tests.el --- Test suite for buff-menu.el -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <address@hidden>
 
diff --git a/test/lisp/calc/calc-tests.el b/test/lisp/calc/calc-tests.el
index 101786c..8afec59 100644
--- a/test/lisp/calc/calc-tests.el
+++ b/test/lisp/calc/calc-tests.el
@@ -1,6 +1,6 @@
 ;;; calc-tests.el --- tests for calc                 -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Leo Liu <address@hidden>
 ;; Keywords: maint
diff --git a/test/lisp/calendar/icalendar-tests.el 
b/test/lisp/calendar/icalendar-tests.el
index 617e886..af617e6 100644
--- a/test/lisp/calendar/icalendar-tests.el
+++ b/test/lisp/calendar/icalendar-tests.el
@@ -1,6 +1,6 @@
 ;; icalendar-tests.el --- Test suite for icalendar.el
 
-;; Copyright (C) 2005, 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2008-2019 Free Software Foundation, Inc.
 
 ;; Author:         Ulf Jasper <address@hidden>
 ;; Created:        March 2005
diff --git a/test/lisp/calendar/parse-time-tests.el 
b/test/lisp/calendar/parse-time-tests.el
index ca71ff7..7435620 100644
--- a/test/lisp/calendar/parse-time-tests.el
+++ b/test/lisp/calendar/parse-time-tests.el
@@ -1,6 +1,6 @@
 ;; parse-time-tests.el --- Test suite for parse-time.el
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Ingebrigtsen <address@hidden>
 
diff --git a/test/lisp/calendar/todo-mode-tests.el 
b/test/lisp/calendar/todo-mode-tests.el
index 015fbac..7d4f7a7 100644
--- a/test/lisp/calendar/todo-mode-tests.el
+++ b/test/lisp/calendar/todo-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; todo-mode-tests.el --- tests for todo-mode.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Stephen Berman <address@hidden>
 ;; Keywords: calendar
diff --git a/test/lisp/char-fold-tests.el b/test/lisp/char-fold-tests.el
index 3649753..8a647bd 100644
--- a/test/lisp/char-fold-tests.el
+++ b/test/lisp/char-fold-tests.el
@@ -1,6 +1,6 @@
 ;;; char-fold-tests.el --- Tests for char-fold.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <address@hidden>
 
diff --git a/test/lisp/color-tests.el b/test/lisp/color-tests.el
index 17c43e2..dceed1a 100644
--- a/test/lisp/color-tests.el
+++ b/test/lisp/color-tests.el
@@ -1,6 +1,6 @@
 ;;; color-tests.el --- Tests for color.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <address@hidden>
 ;; Keywords:
diff --git a/test/lisp/comint-tests.el b/test/lisp/comint-tests.el
index eab2709..49e59c5 100644
--- a/test/lisp/comint-tests.el
+++ b/test/lisp/comint-tests.el
@@ -1,6 +1,6 @@
 ;;; comint-testsuite.el
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/custom-resources/custom--test-theme.el 
b/test/lisp/custom-resources/custom--test-theme.el
new file mode 100644
index 0000000..da9121e
--- /dev/null
+++ b/test/lisp/custom-resources/custom--test-theme.el
@@ -0,0 +1,9 @@
+(deftheme custom--test
+  "A test theme.")
+
+(custom-theme-set-variables
+ 'custom--test
+ '(custom--test-user-option 'bar)
+ '(custom--test-variable 'bar))
+
+(provide-theme 'custom--test)
diff --git a/test/lisp/custom-tests.el b/test/lisp/custom-tests.el
index 96887f8..0c49db6 100644
--- a/test/lisp/custom-tests.el
+++ b/test/lisp/custom-tests.el
@@ -1,6 +1,6 @@
 ;;; custom-tests.el --- tests for custom.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -84,4 +84,43 @@
       (when (file-directory-p tmpdir)
         (delete-directory tmpdir t)))))
 
+(defcustom custom--test-user-option 'foo
+  "User option for test."
+  :group 'emacs
+  :type 'symbol)
+
+(defvar custom--test-variable 'foo
+  "Variable for test.")
+
+;; This is demonstrating bug#34027.
+(ert-deftest custom--test-theme-variables ()
+  "Test variables setting with enabling / disabling a custom theme."
+  :expected-result :failed
+  ;; We load custom-resources/custom--test-theme.el.
+  (let ((custom-theme-load-path
+         `(,(expand-file-name "custom-resources" (file-name-directory #$)))))
+    (load-theme 'custom--test 'no-confirm 'no-enable)
+    ;; The variables have still their initial values.
+    (should (equal custom--test-user-option 'foo))
+    (should (equal custom--test-variable 'foo))
+
+    (custom-set-variables
+     '(custom--test-user-option 'baz)
+     '(custom--test-variable 'baz))
+    ;; The initial values have been changed.
+    (should (equal custom--test-user-option 'baz))
+    (should (equal custom--test-variable 'baz))
+
+    (enable-theme 'custom--test)
+    ;; The variables have the theme values.
+    (should (equal custom--test-user-option 'bar))
+    (should (equal custom--test-variable 'bar))
+
+    (disable-theme 'custom--test)
+    ;; The variables should have the changed values, by reverting.
+    ;; This doesn't work as expected.  Instead, they have their
+    ;; initial values `foo'.
+    (should (equal custom--test-user-option 'baz))
+    (should (equal custom--test-variable 'baz))))
+
 ;;; custom-tests.el ends here
diff --git a/test/lisp/dabbrev-tests.el b/test/lisp/dabbrev-tests.el
index 8084674..a6ab2e7 100644
--- a/test/lisp/dabbrev-tests.el
+++ b/test/lisp/dabbrev-tests.el
@@ -1,6 +1,6 @@
 ;;; dabbrev-tests.el --- Test suite for dabbrev.
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Alan Third <address@hidden>
 ;; Keywords: dabbrev
diff --git a/test/lisp/descr-text-tests.el b/test/lisp/descr-text-tests.el
index c3b102b..09dadde 100644
--- a/test/lisp/descr-text-tests.el
+++ b/test/lisp/descr-text-tests.el
@@ -1,6 +1,6 @@
 ;;; descr-text-test.el --- ERT tests for descr-text.el -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2014, 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014, 2016-2019 Free Software Foundation, Inc.
 
 ;; Author:     Michal Nazarewicz <address@hidden>
 
diff --git a/test/lisp/dired-aux-tests.el b/test/lisp/dired-aux-tests.el
index daf60f7..ccd3192 100644
--- a/test/lisp/dired-aux-tests.el
+++ b/test/lisp/dired-aux-tests.el
@@ -1,6 +1,6 @@
 ;;; dired-aux-tests.el --- Test suite for dired-aux. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/dired-tests.el b/test/lisp/dired-tests.el
index 49ae4bc..71ffcdd 100644
--- a/test/lisp/dired-tests.el
+++ b/test/lisp/dired-tests.el
@@ -1,6 +1,6 @@
 ;;; dired-tests.el --- Test suite. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/dired-x-tests.el b/test/lisp/dired-x-tests.el
index 9cdbcb4..d4d6934 100644
--- a/test/lisp/dired-x-tests.el
+++ b/test/lisp/dired-x-tests.el
@@ -1,6 +1,6 @@
 ;;; dired-x-tests.el --- Test suite for dired-x. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/dom-tests.el b/test/lisp/dom-tests.el
index 77c9a01..fb87b7b 100644
--- a/test/lisp/dom-tests.el
+++ b/test/lisp/dom-tests.el
@@ -1,6 +1,6 @@
 ;;; dom-tests.el --- Tests for dom.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <address@hidden>
 ;; Keywords:
diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el
index 7e94dfa..4f1e572 100644
--- a/test/lisp/electric-tests.el
+++ b/test/lisp/electric-tests.el
@@ -1,6 +1,6 @@
 ;;; electric-tests.el --- tests for electric.el
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: João Távora <address@hidden>
 ;; Keywords:
@@ -157,7 +157,7 @@ The buffer's contents should %s:
           expected-string
           expected-point
           bindings
-          (modes '(quote (ruby-mode c++-mode)))
+          (modes '(quote (ruby-mode js-mode)))
           (test-in-comments t)
           (test-in-strings t)
           (test-in-code t)
@@ -179,9 +179,9 @@ The buffer's contents should %s:
                         ""
                         "-in-comments")))
                  (if test-in-strings
-                     `(("\"" "\"" "-in-strings")))
+                     '(("\"" "\"" "-in-strings")))
                  (if test-in-code
-                     `(("" "" ""))))
+                     '(("" "" ""))))
          append
          (cl-loop
           for char across input
@@ -391,10 +391,17 @@ baz\"\""
   :bindings '((electric-pair-skip-whitespace . chomp))
   :test-in-comments nil)
 
-
-;; A test failure introduced by some changes in CC mode.  Hopefully CC
-;; mode will sort this out eventually, using some new e-p-m machinery.
-;; See
+(ert-deftest 
electric-pair-whitespace-chomping-2-at-point-4-in-c++-mode-in-strings nil
+  "Check if whitespace chomping works in `c++' unterminated strings."
+  (electric-pair-test-for
+   "\" ( \n            \n  )  \"" 4 41 "\" ()  \"" 5 'c++-mode
+   '((electric-pair-skip-whitespace . chomp))
+   (lambda () (electric-pair-mode 1))))
+;; A test failure introduced by:
+;;
+;;    bb591f139f: Enhance CC Mode's fontification, etc., of unterminated 
strings.
+;;
+;; Hopefully CC mode will sort this out eventually.  See
 ;; https://lists.gnu.org/archive/html/emacs-devel/2018-06/msg00535.html
 (setf
  (ert-test-expected-result-type
@@ -507,6 +514,7 @@ baz\"\""
   :fixture-fn #'(lambda ()
                   (electric-pair-mode 1)))
 
+
 (define-electric-pair-test js-mode-braces-with-layout
   "" "{" :expected-string "{\n\n}" :expected-point 3
   :modes '(js-mode)
@@ -526,6 +534,16 @@ baz\"\""
                   (electric-indent-mode 1)
                   (electric-layout-mode 1)))
 
+(define-electric-pair-test js-mode-braces-with-layout-and-indent
+  "" "{" :expected-string "{\n    \n}" :expected-point 7
+  :modes '(js-mode)
+  :test-in-comments nil
+  :test-in-strings nil
+  :fixture-fn #'(lambda ()
+                  (electric-pair-mode 1)
+                  (electric-indent-mode 1)
+                  (electric-layout-mode 1)))
+
 
 ;;; Backspacing
 ;;; TODO: better tests
@@ -812,5 +830,127 @@ baz\"\""
   :bindings '((comment-start . "<!--") (comment-use-syntax . t))
   :test-in-comments nil :test-in-strings nil)
 
+
+;;; tests for `electric-layout-mode'
+
+(define-derived-mode plainer-c-mode c-mode "pC"
+  "A plainer/saner C-mode with no internal electric machinery."
+  (c-toggle-electric-state -1)
+  (setq-local electric-indent-local-mode-hook nil)
+  (setq-local electric-indent-mode-hook nil)
+  (electric-indent-local-mode 1)
+  (dolist (key '(?\" ?\' ?\{ ?\} ?\( ?\) ?\[ ?\]))
+    (local-set-key (vector key) 'self-insert-command)))
+
+(defun electric-layout-for-c-style-du-jour (inserted)
+  "A function to use in `electric-layout-rules'"
+  (when (memq inserted '(?{ ?}))
+    (save-excursion
+      (backward-char 2) (c-point-syntax) (forward-char) ; silly, but needed
+      (c-brace-newlines (c-point-syntax)))))
+
+(ert-deftest electric-layout-plainer-c-mode-use-c-style ()
+  (ert-with-test-buffer ()
+    (plainer-c-mode)
+    (electric-layout-local-mode 1)
+    (electric-pair-local-mode 1)
+    (electric-indent-local-mode 1)
+    (setq-local electric-layout-rules
+                '(electric-layout-for-c-style-du-jour))
+    (insert "int main () ")
+    (let ((last-command-event ?\{))
+      (call-interactively (key-binding `[,last-command-event])))
+    (should (equal (buffer-string) "int main ()\n{\n  \n}\n"))))
+
+(ert-deftest electric-layout-int-main-kernel-style ()
+  (ert-with-test-buffer ()
+    (plainer-c-mode)
+    (electric-layout-local-mode 1)
+    (electric-pair-local-mode 1)
+    (electric-indent-local-mode 1)
+    (setq-local electric-layout-rules
+                '((?\{ . (after))
+                  (?\} . (before))))
+    (insert "int main () ")
+    (let ((last-command-event ?\{))
+      (call-interactively (key-binding `[,last-command-event])))
+    (should (equal (buffer-string) "int main () {\n  \n}"))))
+
+(define-derived-mode plainer-c-mode c-mode "pC"
+  "A plainer/saner C-mode with no internal electric machinery."
+  (c-toggle-electric-state -1)
+  (setq-local electric-indent-local-mode-hook nil)
+  (setq-local electric-indent-mode-hook nil)
+  (electric-indent-local-mode 1)
+  (dolist (key '(?\" ?\' ?\{ ?\} ?\( ?\) ?\[ ?\]))
+    (local-set-key (vector key) 'self-insert-command)))
+
+(ert-deftest electric-modes-int-main-allman-style ()
+  (ert-with-test-buffer ()
+    (plainer-c-mode)
+    (electric-layout-local-mode 1)
+    (electric-pair-local-mode 1)
+    (electric-indent-local-mode 1)
+    (setq-local electric-layout-rules
+                '((?\{ . (before after))
+                  (?\} . (before))))
+    (insert "int main () ")
+    (let ((last-command-event ?\{))
+      (call-interactively (key-binding `[,last-command-event])))
+    (should (equal (buffer-string) "int main ()\n{\n  \n}"))))
+
+(ert-deftest electric-pair-mode-newline-between-parens ()
+  (ert-with-test-buffer ()
+    (plainer-c-mode)
+    (electric-layout-local-mode -1) ;; ensure e-l-m mode is off
+    (electric-pair-local-mode 1)
+    (insert-before-markers "int main () {}")
+    (backward-char 1)
+    (let ((last-command-event ?
))
+      (call-interactively (key-binding `[,last-command-event])))
+    (should (equal (buffer-string) "int main () {\n  \n}"))))
+
+(ert-deftest electric-layout-mode-newline-between-parens-without-e-p-m ()
+  (ert-with-test-buffer ()
+    (plainer-c-mode)
+    (electric-layout-local-mode 1)
+    (electric-pair-local-mode -1) ;; ensure e-p-m mode is off
+    (electric-indent-local-mode 1)
+    (setq-local electric-layout-rules
+                '((?\n
+                   .
+                   (lambda ()
+                     (when (eq (save-excursion
+                                 (skip-chars-backward "\t\s")
+                                 (char-before (1- (point))))
+                               (matching-paren (char-after)))
+                       '(after-stay))))))
+    (insert "int main () {}")
+    (backward-char 1)
+    (let ((last-command-event ?
))
+      (call-interactively (key-binding `[,last-command-event])))
+    (should (equal (buffer-string) "int main () {\n  \n}"))))
+
+(ert-deftest electric-layout-mode-newline-between-parens-without-e-p-m-2 ()
+  (ert-with-test-buffer ()
+    (plainer-c-mode)
+    (electric-layout-local-mode 1)
+    (electric-pair-local-mode -1) ;; ensure e-p-m mode is off
+    (electric-indent-local-mode 1)
+    (setq-local electric-layout-rules
+                '((lambda (char)
+                    (when (and
+                           (eq char ?\n)
+                           (eq (save-excursion
+                                 (skip-chars-backward "\t\s")
+                                 (char-before (1- (point))))
+                               (matching-paren (char-after))))
+                       '(after-stay)))))
+    (insert "int main () {}")
+    (backward-char 1)
+    (let ((last-command-event ?
))
+      (call-interactively (key-binding `[,last-command-event])))
+    (should (equal (buffer-string) "int main () {\n  \n}"))))
+
 (provide 'electric-tests)
 ;;; electric-tests.el ends here
diff --git a/test/lisp/emacs-lisp/backtrace-tests.el 
b/test/lisp/emacs-lisp/backtrace-tests.el
index edd45c7..ce827e0 100644
--- a/test/lisp/emacs-lisp/backtrace-tests.el
+++ b/test/lisp/emacs-lisp/backtrace-tests.el
@@ -1,6 +1,6 @@
 ;;; backtrace-tests.el --- Tests for backtraces -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell
 
diff --git a/test/lisp/emacs-lisp/benchmark-tests.el 
b/test/lisp/emacs-lisp/benchmark-tests.el
index 26bd3ff..a8c37bb 100644
--- a/test/lisp/emacs-lisp/benchmark-tests.el
+++ b/test/lisp/emacs-lisp/benchmark-tests.el
@@ -1,6 +1,6 @@
 ;;; benchmark-tests.el --- Test suite for benchmark.  -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el 
b/test/lisp/emacs-lisp/bytecomp-tests.el
index ba62549..f66a06b 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -1,6 +1,6 @@
 ;;; bytecomp-tests.el
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Shigeru Fukaya <address@hidden>
 ;; Author: Stefan Monnier <address@hidden>
diff --git a/test/lisp/emacs-lisp/cconv-tests.el 
b/test/lisp/emacs-lisp/cconv-tests.el
index d14847c..c218bd6 100644
--- a/test/lisp/emacs-lisp/cconv-tests.el
+++ b/test/lisp/emacs-lisp/cconv-tests.el
@@ -1,6 +1,6 @@
 ;;; cconv-tests.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el 
b/test/lisp/emacs-lisp/checkdoc-tests.el
index 2960236..1cefc4c 100644
--- a/test/lisp/emacs-lisp/checkdoc-tests.el
+++ b/test/lisp/emacs-lisp/checkdoc-tests.el
@@ -1,6 +1,6 @@
 ;;; checkdoc-tests.el --- unit tests for checkdoc.el  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <address@hidden>
 
diff --git a/test/lisp/emacs-lisp/cl-extra-tests.el 
b/test/lisp/emacs-lisp/cl-extra-tests.el
index baad8eb..152d431 100644
--- a/test/lisp/emacs-lisp/cl-extra-tests.el
+++ b/test/lisp/emacs-lisp/cl-extra-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-extra-tests.el --- tests for emacs-lisp/cl-extra.el  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -94,4 +94,9 @@
     (should (equal (list lst3 (cdr lst3) (cddr lst3))
                    (cl-maplist fn3 lst lst2 lst3)))))
 
+(ert-deftest cl-extra-test-cl-make-random-state ()
+  (let ((s (cl-make-random-state)))
+    ;; Test for Bug#33731.
+    (should-not (eq s (cl-make-random-state s)))))
+
 ;;; cl-extra-tests.el ends here
diff --git a/test/lisp/emacs-lisp/cl-generic-tests.el 
b/test/lisp/emacs-lisp/cl-generic-tests.el
index 79de538..36e09af 100644
--- a/test/lisp/emacs-lisp/cl-generic-tests.el
+++ b/test/lisp/emacs-lisp/cl-generic-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-generic-tests.el --- Tests for cl-generic.el functionality  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 
diff --git a/test/lisp/emacs-lisp/cl-lib-tests.el 
b/test/lisp/emacs-lisp/cl-lib-tests.el
index f100e8c..82c2c0d 100644
--- a/test/lisp/emacs-lisp/cl-lib-tests.el
+++ b/test/lisp/emacs-lisp/cl-lib-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-lib-tests.el --- tests for emacs-lisp/cl-lib.el  -*- lexical-binding:t 
-*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -220,7 +220,7 @@
     (should-error (cl-struct-slot-offset 'mystruct 'marypoppins))
     (should (pcase (cl-struct-slot-info 'mystruct)
               (`((cl-tag-slot) (abc 5 :readonly t)
-                 (def . ,(or `nil `(nil))))
+                 (def . ,(or 'nil '(nil))))
                t)))))
 (ert-deftest cl-lib-struct-constructors ()
   (should (string-match "\\`Constructor docstring."
diff --git a/test/lisp/emacs-lisp/cl-macs-tests.el 
b/test/lisp/emacs-lisp/cl-macs-tests.el
index 6e9fb44..989553b 100644
--- a/test/lisp/emacs-lisp/cl-macs-tests.el
+++ b/test/lisp/emacs-lisp/cl-macs-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-macs-tests.el --- tests for emacs-lisp/cl-macs.el  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/cl-preloaded-tests.el 
b/test/lisp/emacs-lisp/cl-preloaded-tests.el
index 9d5feee..3251b5f 100644
--- a/test/lisp/emacs-lisp/cl-preloaded-tests.el
+++ b/test/lisp/emacs-lisp/cl-preloaded-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-preloaded-tests.el --- unit tests for cl-preloaded.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 ;; Author: Philipp Stephani <address@hidden>
 
 ;; This file is part of GNU Emacs.
diff --git a/test/lisp/emacs-lisp/cl-print-tests.el 
b/test/lisp/emacs-lisp/cl-print-tests.el
index a469b55..406c528 100644
--- a/test/lisp/emacs-lisp/cl-print-tests.el
+++ b/test/lisp/emacs-lisp/cl-print-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-print-tests.el --- Test suite for the cl-print facility.  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -34,7 +34,7 @@
     (let ((print-circle t))
       (should (equal (cl-prin1-to-string `((x . ,x) (y . ,x)))
                      "((x . #1=#s(cl-print--test :a 1 :b 2)) (y . #1#))")))
-    (should (string-match "\\`#f(compiled-function (x) \"[^\"]+\" [^\)]*)\\'"
+    (should (string-match "\\`#f(compiled-function (x) \"[^\"]+\" [^)]*)\\'"
                           (cl-prin1-to-string (symbol-function #'caar))))))
 
 (ert-deftest cl-print-tests-2 ()
diff --git a/test/lisp/emacs-lisp/cl-seq-tests.el 
b/test/lisp/emacs-lisp/cl-seq-tests.el
index 11a98aa..86288e9 100644
--- a/test/lisp/emacs-lisp/cl-seq-tests.el
+++ b/test/lisp/emacs-lisp/cl-seq-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-seq-tests.el --- Tests for cl-seq.el functionality  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Richard <address@hidden>
 
diff --git a/test/lisp/emacs-lisp/cl-tests.el b/test/lisp/emacs-lisp/cl-tests.el
index b673822..aee2438 100644
--- a/test/lisp/emacs-lisp/cl-tests.el
+++ b/test/lisp/emacs-lisp/cl-tests.el
@@ -1,6 +1,6 @@
 ;;; cl-tests.el --- tests for emacs-lisp/cl.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/derived-tests.el 
b/test/lisp/emacs-lisp/derived-tests.el
index c614f1e..1f71822 100644
--- a/test/lisp/emacs-lisp/derived-tests.el
+++ b/test/lisp/emacs-lisp/derived-tests.el
@@ -1,6 +1,6 @@
 ;;; derived-tests.el --- tests for derived.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el 
b/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
index 97dead0..0138438 100644
--- a/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
+++ b/test/lisp/emacs-lisp/edebug-resources/edebug-test-code.el
@@ -1,6 +1,6 @@
 ;;; edebug-test-code.el --- Sample code for the Edebug test suite
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell
 
diff --git a/test/lisp/emacs-lisp/edebug-tests.el 
b/test/lisp/emacs-lisp/edebug-tests.el
index 7880aaf..4c51740 100644
--- a/test/lisp/emacs-lisp/edebug-tests.el
+++ b/test/lisp/emacs-lisp/edebug-tests.el
@@ -1,6 +1,6 @@
 ;;; edebug-tests.el --- Edebug test suite   -*- lexical-binding:t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell
 
diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el 
b/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el
index 52014ae..a7c63467 100644
--- a/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-test-methodinvoke.el
@@ -1,6 +1,6 @@
 ;;; eieio-testsinvoke.el -- eieio tests for method invocation
 
-;; Copyright (C) 2005, 2008, 2010, 2013-2018 Free Software Foundation,
+;; Copyright (C) 2005, 2008, 2010, 2013-2019 Free Software Foundation,
 ;; Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el 
b/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el
index f5c25e6..2820d16 100644
--- a/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el
@@ -1,6 +1,6 @@
 ;;; eieio-test-persist.el --- Tests for eieio-persistent class
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el 
b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
index 74c7660..ea6df0f 100644
--- a/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
+++ b/test/lisp/emacs-lisp/eieio-tests/eieio-tests.el
@@ -1,6 +1,6 @@
 ;;; eieio-tests.el -- eieio tests routines
 
-;; Copyright (C) 1999-2003, 2005-2010, 2012-2018 Free Software
+;; Copyright (C) 1999-2003, 2005-2010, 2012-2019 Free Software
 ;; Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
diff --git a/test/lisp/emacs-lisp/ert-tests.el 
b/test/lisp/emacs-lisp/ert-tests.el
index 1fe5b79..36db1ee 100644
--- a/test/lisp/emacs-lisp/ert-tests.el
+++ b/test/lisp/emacs-lisp/ert-tests.el
@@ -1,6 +1,6 @@
 ;;; ert-tests.el --- ERT's self-tests  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2007-2008, 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2007-2008, 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Christian Ohler <address@hidden>
 
@@ -188,7 +188,7 @@ failed or if there was a problem."
 
 (ert-deftest ert-test-should-with-macrolet ()
   (let ((test (make-ert-test :body (lambda ()
-                                     (cl-macrolet ((foo () `(progn t nil)))
+                                     (cl-macrolet ((foo () '(progn t nil)))
                                        (should (foo)))))))
     (let ((result (let ((ert-debug-on-error nil))
                     (ert-run-test test))))
@@ -490,9 +490,9 @@ This macro is used to test if macroexpansion in `should' 
works."
                :name nil
                :body nil
                :tags '(a b))))
-    (should (equal (ert-select-tests `(tag a) (list test)) (list test)))
-    (should (equal (ert-select-tests `(tag b) (list test)) (list test)))
-    (should (equal (ert-select-tests `(tag c) (list test)) '()))))
+    (should (equal (ert-select-tests '(tag a) (list test)) (list test)))
+    (should (equal (ert-select-tests '(tag b) (list test)) (list test)))
+    (should (equal (ert-select-tests '(tag c) (list test)) '()))))
 
 
 ;;; Tests for utility functions.
diff --git a/test/lisp/emacs-lisp/ert-x-tests.el 
b/test/lisp/emacs-lisp/ert-x-tests.el
index 9798f0c..0737572 100644
--- a/test/lisp/emacs-lisp/ert-x-tests.el
+++ b/test/lisp/emacs-lisp/ert-x-tests.el
@@ -1,6 +1,6 @@
 ;;; ert-x-tests.el --- Tests for ert-x.el
 
-;; Copyright (C) 2008, 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008, 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Phil Hagelberg
 ;;        Christian Ohler <address@hidden>
diff --git a/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el 
b/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el
index 7d1a128..e940c5f 100644
--- a/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el
+++ b/test/lisp/emacs-lisp/faceup-resources/faceup-test-mode.el
@@ -1,6 +1,6 @@
 ;;; faceup-test-mode.el --- Dummy major mode for testing `faceup'.
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren
 ;; Keywords: languages, faces
diff --git 
a/test/lisp/emacs-lisp/faceup-resources/faceup-test-this-file-directory.el 
b/test/lisp/emacs-lisp/faceup-resources/faceup-test-this-file-directory.el
index 0558bd1..11c48de 100644
--- a/test/lisp/emacs-lisp/faceup-resources/faceup-test-this-file-directory.el
+++ b/test/lisp/emacs-lisp/faceup-resources/faceup-test-this-file-directory.el
@@ -1,6 +1,6 @@
 ;;; faceup-test-this-file-directory.el --- Support file for faceup tests
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren
 ;; Keywords: languages, faces
diff --git a/test/lisp/emacs-lisp/faceup-tests/faceup-test-basics.el 
b/test/lisp/emacs-lisp/faceup-tests/faceup-test-basics.el
index f910a1d..c35188e 100644
--- a/test/lisp/emacs-lisp/faceup-tests/faceup-test-basics.el
+++ b/test/lisp/emacs-lisp/faceup-tests/faceup-test-basics.el
@@ -1,6 +1,6 @@
 ;;; faceup-test-basics.el --- Tests for the `faceup' package.
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren
 ;; Keywords: languages, faces
diff --git a/test/lisp/emacs-lisp/faceup-tests/faceup-test-files.el 
b/test/lisp/emacs-lisp/faceup-tests/faceup-test-files.el
index 8df38bc..c8c3a1f 100644
--- a/test/lisp/emacs-lisp/faceup-tests/faceup-test-files.el
+++ b/test/lisp/emacs-lisp/faceup-tests/faceup-test-files.el
@@ -1,6 +1,6 @@
 ;;; faceup-test-files.el --- Self test of `faceup' using dummy major mode.
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Anders Lindgren
 ;; Keywords: languages, faces
diff --git a/test/lisp/emacs-lisp/generator-tests.el 
b/test/lisp/emacs-lisp/generator-tests.el
index bca3efa..613de2f 100644
--- a/test/lisp/emacs-lisp/generator-tests.el
+++ b/test/lisp/emacs-lisp/generator-tests.el
@@ -1,6 +1,6 @@
 ;;; generator-tests.el --- Testing generators -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Daniel Colascione <address@hidden>
 ;; Keywords:
diff --git a/test/lisp/emacs-lisp/gv-tests.el b/test/lisp/emacs-lisp/gv-tests.el
index a380445..cfd982b 100644
--- a/test/lisp/emacs-lisp/gv-tests.el
+++ b/test/lisp/emacs-lisp/gv-tests.el
@@ -1,6 +1,6 @@
 ;;; gv-tests.el --- tests for gv.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/let-alist-tests.el 
b/test/lisp/emacs-lisp/let-alist-tests.el
index 66efc13..31db4a9 100644
--- a/test/lisp/emacs-lisp/let-alist-tests.el
+++ b/test/lisp/emacs-lisp/let-alist-tests.el
@@ -1,6 +1,6 @@
 ;;; let-alist.el --- tests for file handling. -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el 
b/test/lisp/emacs-lisp/lisp-mode-tests.el
index 30f606d..a637074 100644
--- a/test/lisp/emacs-lisp/lisp-mode-tests.el
+++ b/test/lisp/emacs-lisp/lisp-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; lisp-mode-tests.el --- Test Lisp editing commands  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
diff --git a/test/lisp/emacs-lisp/lisp-tests.el 
b/test/lisp/emacs-lisp/lisp-tests.el
index 07eddb7..282c372 100644
--- a/test/lisp/emacs-lisp/lisp-tests.el
+++ b/test/lisp/emacs-lisp/lisp-tests.el
@@ -1,6 +1,6 @@
 ;;; lisp-tests.el --- Test Lisp editing commands     -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Aaron S. Hawley <address@hidden>
 ;; Author: Stefan Monnier <address@hidden>
diff --git a/test/lisp/emacs-lisp/map-tests.el 
b/test/lisp/emacs-lisp/map-tests.el
index 885b09b..a54af80 100644
--- a/test/lisp/emacs-lisp/map-tests.el
+++ b/test/lisp/emacs-lisp/map-tests.el
@@ -1,6 +1,6 @@
 ;;; map-tests.el --- Tests for map.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <address@hidden>
 ;; Maintainer: address@hidden
@@ -38,17 +38,19 @@ Evaluate BODY for each created map.
 \(fn (var map) body)"
   (declare (indent 1) (debug (symbolp body)))
   (let ((alist (make-symbol "alist"))
+        (plist (make-symbol "plist"))
         (vec (make-symbol "vec"))
         (ht (make-symbol "ht")))
    `(let ((,alist (list (cons 0 3)
                         (cons 1 4)
                         (cons 2 5)))
+          (,plist (list 0 3 1 4 2 5))
           (,vec (vector 3 4 5))
           (,ht (make-hash-table)))
       (puthash 0 3 ,ht)
       (puthash 1 4 ,ht)
       (puthash 2 5 ,ht)
-      (dolist (,var (list ,alist ,vec ,ht))
+      (dolist (,var (list ,alist ,plist ,vec ,ht))
         ,@body))))
 
 (ert-deftest test-map-elt ()
@@ -76,13 +78,26 @@ Evaluate BODY for each created map.
                          'b
                          '2))))
 
-(ert-deftest test-map-put ()
+(ert-deftest test-map-put! ()
   (with-maps-do map
     (setf (map-elt map 2) 'hello)
     (should (eq (map-elt map 2) 'hello)))
   (with-maps-do map
     (map-put map 2 'hello)
     (should (eq (map-elt map 2) 'hello)))
+  (with-maps-do map
+    (map-put! map 2 'hello)
+    (should (eq (map-elt map 2) 'hello))
+    (if (not (or (hash-table-p map)
+                 (and (listp map) (not (listp (car map)))))) ;plist!
+        (should-error (map-put! map 5 'value)
+                      ;; For vectors, it could arguably signal
+                      ;; map-not-inplace as well, but it currently doesn't.
+                      :type (if (listp map)
+                                'map-not-inplace
+                              'error))
+      (map-put! map 5 'value)
+      (should (eq (map-elt map 5) 'value))))
   (let ((ht (make-hash-table)))
     (setf (map-elt ht 2) 'a)
     (should (eq (map-elt ht 2)
@@ -92,7 +107,7 @@ Evaluate BODY for each created map.
     (should (eq (map-elt alist 2)
                 'a)))
   (let ((vec [3 4 5]))
-   (should-error (setf (map-elt vec 3) 6))))
+    (should-error (setf (map-elt vec 3) 6))))
 
 (ert-deftest test-map-put-alist-new-key ()
   "Regression test for Bug#23105."
@@ -105,9 +120,9 @@ Evaluate BODY for each created map.
   (let ((alist (list (cons "a" 1) (cons "b" 2)))
         ;; Make sure to use a non-eq "a", even when compiled.
         (noneq-key (string ?a)))
-    (map-put alist noneq-key 3 'equal)
+    (map-put alist noneq-key 3 #'equal)
     (should-not (cddr alist))
-    (map-put alist noneq-key 9)
+    (map-put alist noneq-key 9 #'eql)
     (should (cddr alist))))
 
 (ert-deftest test-map-put-return-value ()
diff --git a/test/lisp/emacs-lisp/nadvice-tests.el 
b/test/lisp/emacs-lisp/nadvice-tests.el
index 3945d66..e14d136 100644
--- a/test/lisp/emacs-lisp/nadvice-tests.el
+++ b/test/lisp/emacs-lisp/nadvice-tests.el
@@ -1,6 +1,6 @@
 ;;; advice-tests.el --- Test suite for the new advice thingy.
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/package-tests.el 
b/test/lisp/emacs-lisp/package-tests.el
index f08bc92..c757bcc 100644
--- a/test/lisp/emacs-lisp/package-tests.el
+++ b/test/lisp/emacs-lisp/package-tests.el
@@ -1,6 +1,6 @@
 ;;; package-test.el --- Tests for the Emacs package system
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Daniel Hackney <address@hidden>
 ;; Version: 1.0
@@ -190,12 +190,33 @@ Must called from within a `tar-mode' buffer."
   "Return the package version as a string."
   (package-version-join (package-desc-version desc)))
 
+(defun package-test--compatible-p (pkg-desc pkg-sample &optional kind)
+  (and (cl-every (lambda (f)
+                   (equal (funcall f pkg-desc)
+                          (funcall f pkg-sample)))
+                 (cons (if kind #'package-desc-kind #'ignore)
+                       '(package-desc-name
+                         package-desc-version
+                         package-desc-summary
+                         package-desc-reqs
+                         package-desc-archive
+                         package-desc-dir
+                         package-desc-signed)))
+       ;; The `extras' field should contain at least the specified elements.
+       (let ((extras (package-desc-extras pkg-desc))
+             (extras-sample (package-desc-extras pkg-sample)))
+         (cl-every (lambda (sample-elem)
+                     (member sample-elem extras))
+                   extras-sample))))
+
 (ert-deftest package-test-desc-from-buffer ()
   "Parse an elisp buffer to get a `package-desc' object."
   (with-package-test (:basedir "package-resources" :file 
"simple-single-1.3.el")
-    (should (equal (package-buffer-info) simple-single-desc)))
+    (should (package-test--compatible-p
+             (package-buffer-info) simple-single-desc 'kind)))
   (with-package-test (:basedir "package-resources" :file 
"simple-depend-1.0.el")
-    (should (equal (package-buffer-info) simple-depend-desc)))
+    (should (package-test--compatible-p
+             (package-buffer-info) simple-depend-desc 'kind)))
   (with-package-test (:basedir "package-resources"
                                :file "multi-file-0.2.3.tar")
     (tar-mode)
@@ -223,15 +244,12 @@ Must called from within a `tar-mode' buffer."
       (with-temp-buffer
         (insert-file-contents (expand-file-name "simple-single-pkg.el"
                                                 simple-pkg-dir))
-        (should (string= (buffer-string)
-                         (concat ";;; -*- no-byte-compile: t -*-\n"
-                                 "(define-package \"simple-single\" \"1.3\" "
-                                 "\"A single-file package "
-                                 "with no dependencies\" 'nil "
-                                 ":authors '((\"J. R. Hacker\" . 
\"address@hidden")) "
-                                 ":maintainer '(\"J. R. Hacker\" . 
\"address@hidden") "
-                                 ":url \"http://doodles.au\"";
-                                 ")\n"))))
+        (goto-char (point-min))
+        (let ((sexp (read (current-buffer))))
+          (should (eq (car-safe sexp) 'define-package))
+          (should (package-test--compatible-p
+                   (apply #'package-desc-from-define (cdr sexp))
+                   simple-single-desc))))
       (should (file-exists-p autoloads-file))
       (should-not (get-file-buffer autoloads-file)))))
 
@@ -435,11 +453,24 @@ Must called from within a `tar-mode' buffer."
      (save-excursion (should (search-forward "Summary: A single-file package 
with no dependencies" nil t)))
      (save-excursion (should (search-forward "Homepage: http://doodles.au"; nil 
t)))
      (save-excursion (should (re-search-forward "Keywords: \\[?frobnicate\\]?" 
nil t)))
-     ;; No description, though. Because at this point we don't know
-     ;; what archive the package originated from, and we don't have
-     ;; its readme file saved.
+     (save-excursion (should (search-forward "This package provides a minor 
mode to frobnicate"
+                                             nil t)))
      )))
 
+(ert-deftest package-test-describe-installed-multi-file-package ()
+  "Test displaying of the readme for installed multi-file package."
+
+  (with-package-test ()
+    (package-initialize)
+    (package-refresh-contents)
+    (package-install 'multi-file)
+    (with-fake-help-buffer
+     (describe-package 'multi-file)
+     (goto-char (point-min))
+     (should (search-forward "Homepage: http://puddles.li"; nil t))
+     (should (search-forward "This is a bare-bones readme file for the 
multi-file"
+                             nil t)))))
+
 (ert-deftest package-test-describe-non-installed-package ()
   "Test displaying of the readme for non-installed package."
 
@@ -567,8 +598,17 @@ Must called from within a `tar-mode' buffer."
         (setq archive-contents
               (package-read-from-string
                (buffer-substring (point-min) (point-max)))))
-      (should (equal archive-contents
-                     (list 1 package-x-test--single-archive-entry-1-3))))))
+      (should (equal 1 (car archive-contents)))
+      (should (equal 2 (length archive-contents)))
+      (let ((pac (cadr archive-contents))
+            (pac-sample package-x-test--single-archive-entry-1-3))
+        (should (equal (pop pac) (pop pac-sample)))
+        (dotimes (i 4)
+          (should (equal (aref pac i) (aref pac-sample i))))
+        ;; The `extras' field should contain at least the specified elements.
+        (should (cl-every (lambda (sample-elem)
+                            (member sample-elem (aref pac 4)))
+                          (aref pac-sample 4)))))))
 
 (ert-deftest package-x-test-upload-new-version ()
   "Test uploading a new version of a package"
@@ -588,8 +628,17 @@ Must called from within a `tar-mode' buffer."
         (setq archive-contents
               (package-read-from-string
                (buffer-substring (point-min) (point-max)))))
-      (should (equal archive-contents
-                     (list 1 package-x-test--single-archive-entry-1-4))))))
+      (should (equal 1 (car archive-contents)))
+      (should (equal 2 (length archive-contents)))
+      (let ((pac (cadr archive-contents))
+            (pac-sample package-x-test--single-archive-entry-1-4))
+        (should (equal (pop pac) (pop pac-sample)))
+        (dotimes (i 4)
+          (should (equal (aref pac i) (aref pac-sample i))))
+        ;; The `extras' field should contain at least the specified elements.
+        (should (cl-every (lambda (sample-elem)
+                            (member sample-elem (aref pac 4)))
+                          (aref pac-sample 4)))))))
 
 (ert-deftest package-test-get-deps ()
   "Test `package--get-deps' with complex structures."
diff --git a/test/lisp/emacs-lisp/pcase-tests.el 
b/test/lisp/emacs-lisp/pcase-tests.el
index c706c10..af8c9a3 100644
--- a/test/lisp/emacs-lisp/pcase-tests.el
+++ b/test/lisp/emacs-lisp/pcase-tests.el
@@ -1,6 +1,6 @@
 ;;; pcase-tests.el --- Test suite for pcase macro.
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -51,11 +51,13 @@
 
 (ert-deftest pcase-tests-member ()
   (should (pcase-tests-grep
-           'memq (macroexpand-all '(pcase x ((or 1 2 3) body)))))
+           'memql (macroexpand-all '(pcase x ((or 1 2 3) body)))))
   (should (pcase-tests-grep
            'member (macroexpand-all '(pcase x ((or "a" 2 3) body)))))
   (should-not (pcase-tests-grep
                'memq (macroexpand-all '(pcase x ((or "a" 2 3) body)))))
+  (should-not (pcase-tests-grep
+               'memql (macroexpand-all '(pcase x ((or "a" 2 3) body)))))
   (let ((exp (macroexpand-all
                       '(pcase x
                          ("a" body1)
diff --git a/test/lisp/emacs-lisp/pp-tests.el b/test/lisp/emacs-lisp/pp-tests.el
index 95feda5..2660bd2 100644
--- a/test/lisp/emacs-lisp/pp-tests.el
+++ b/test/lisp/emacs-lisp/pp-tests.el
@@ -1,6 +1,6 @@
 ;;; pp-tests.el --- Test suite for pretty printer.  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/regexp-opt-tests.el 
b/test/lisp/emacs-lisp/regexp-opt-tests.el
index 7eae769..1fc4990 100644
--- a/test/lisp/emacs-lisp/regexp-opt-tests.el
+++ b/test/lisp/emacs-lisp/regexp-opt-tests.el
@@ -1,6 +1,6 @@
 ;;; regexp-tests.el --- Test suite for regular expression handling.
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords:       internal
diff --git a/test/lisp/emacs-lisp/ring-tests.el 
b/test/lisp/emacs-lisp/ring-tests.el
index 0b4e3d9..991c4e5 100644
--- a/test/lisp/emacs-lisp/ring-tests.el
+++ b/test/lisp/emacs-lisp/ring-tests.el
@@ -1,6 +1,6 @@
 ;;; ring-tests.el --- Tests for ring.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <address@hidden>
 ;; Keywords:
@@ -162,6 +162,43 @@
     (should (= (ring-size ring) 5))
     (should (equal (ring-elements ring) '(3 2 1)))))
 
+(ert-deftest ring-resize/grow ()
+  (let ((ring (make-ring 3)))
+    (ring-insert ring 1)
+    (ring-insert ring 2)
+    (ring-insert ring 3)
+    (ring-resize ring 5)
+    (should (= (ring-size ring) 5))
+    (should (equal (ring-elements ring) '(3 2 1)))))
+
+(ert-deftest ring-resize/grow-empty ()
+  (let ((ring (make-ring 3)))
+    (ring-resize ring 5)
+    (should (= (ring-size ring) 5))
+    (should (equal (ring-elements ring) '()))))
+
+(ert-deftest ring-resize/grow-wrapped-ring ()
+  (let ((ring (make-ring 3)))
+    (ring-insert ring 1)
+    (ring-insert ring 2)
+    (ring-insert ring 3)
+    (ring-insert ring 4)
+    (ring-insert ring 5)
+    (ring-resize ring 5)
+    (should (= (ring-size ring) 5))
+    (should (equal (ring-elements ring) '(5 4 3)))))
+
+(ert-deftest ring-resize/shrink ()
+  (let ((ring (make-ring 5)))
+    (ring-insert ring 1)
+    (ring-insert ring 2)
+    (ring-insert ring 3)
+    (ring-insert ring 4)
+    (ring-insert ring 5)
+    (ring-resize ring 3)
+    (should (= (ring-size ring) 3))
+    (should (equal (ring-elements ring) '(5 4 3)))))
+
 (ert-deftest ring-tests-insert ()
   (let ((ring (make-ring 2)))
     (ring-insert+extend ring :a)
diff --git a/test/lisp/emacs-lisp/rmc-tests.el 
b/test/lisp/emacs-lisp/rmc-tests.el
index f8b3e5a..b20bfd4 100644
--- a/test/lisp/emacs-lisp/rmc-tests.el
+++ b/test/lisp/emacs-lisp/rmc-tests.el
@@ -1,6 +1,6 @@
 ;;; rmc-tests.el --- Test suite for rmc.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <address@hidden>
 ;; Keywords:
diff --git a/test/lisp/emacs-lisp/rx-tests.el b/test/lisp/emacs-lisp/rx-tests.el
index d15e3d7..4a5919e 100644
--- a/test/lisp/emacs-lisp/rx-tests.el
+++ b/test/lisp/emacs-lisp/rx-tests.el
@@ -1,6 +1,6 @@
 ;;; rx-tests.el --- test for rx.el functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -25,7 +25,7 @@
 ;;; Code:
 
 (ert-deftest rx-char-any ()
-  "Test character alternatives with `\]' and `-' (Bug#25123)."
+  "Test character alternatives with `]' and `-' (Bug#25123)."
   (should (string-match
            (rx string-start (1+ (char (?\] . ?\{) (?< . ?\]) (?- . ?:)))
                string-end)
@@ -33,6 +33,36 @@
                                   (number-sequence ?< ?\])
                                   (number-sequence ?- ?:))))))
 
+(ert-deftest rx-char-any-range-nl ()
+  "Test character alternatives with LF as a range endpoint."
+  (should (equal (rx (any "\n-\r"))
+                 "[\n-\r]"))
+  (should (equal (rx (any "\a-\n"))
+                 "[\a-\n]")))
+
+(ert-deftest rx-char-any-range-bad ()
+  (should-error (rx (any "0-9a-Z")))
+  (should-error (rx (any (?0 . ?9) (?a . ?Z)))))
+
+(ert-deftest rx-char-any-raw-byte ()
+  "Test raw bytes in character alternatives."
+  ;; Separate raw characters.
+  (should (equal (string-match-p (rx (any "\326A\333B"))
+                                 "X\326\333")
+                 1))
+  ;; Range of raw characters, unibyte.
+  (should (equal (string-match-p (rx (any "\200-\377"))
+                                 "ÿA\310B")
+                 2))
+  ;; Range of raw characters, multibyte.
+  (should (equal (string-match-p (rx (any "Å\211\326-\377\177"))
+                                 "XY\355\177\327")
+                 2))
+  ;; Split range; \177-\377ÿ should not be optimised to \177-\377.
+  (should (equal (string-match-p (rx (any "\177-\377" ?ÿ))
+                                 "ÿA\310B")
+                 0)))
+
 (ert-deftest rx-pcase ()
   (should (equal (pcase "a 1 2 3 1 1 b"
                    ((rx (let u (+ digit)) space
@@ -43,5 +73,41 @@
                     (list u v)))
                  '("1" "3"))))
 
+(ert-deftest rx-kleene ()
+  "Test greedy and non-greedy repetition operators."
+  (should (equal (rx (* "a") (+ "b") (\? "c") (?\s "d")
+                     (*? "e") (+? "f") (\?? "g") (?? "h"))
+                 "a*b+c?d?e*?f+?g??h??"))
+  (should (equal (rx (zero-or-more "a") (0+ "b")
+                     (one-or-more "c") (1+ "d")
+                     (zero-or-one "e") (optional "f") (opt "g"))
+                 "a*b*c+d+e?f?g?"))
+  (should (equal (rx (minimal-match
+                      (seq (* "a") (+ "b") (\? "c") (?\s "d")
+                           (*? "e") (+? "f") (\?? "g") (?? "h"))))
+                 "a*b+c?d?e*?f+?g??h??"))
+  (should (equal (rx (minimal-match
+                      (seq (zero-or-more "a") (0+ "b")
+                           (one-or-more "c") (1+ "d")
+                           (zero-or-one "e") (optional "f") (opt "g"))))
+                 "a*?b*?c+?d+?e??f??g??"))
+  (should (equal (rx (maximal-match
+                      (seq (* "a") (+ "b") (\? "c") (?\s "d")
+                         (*? "e") (+? "f") (\?? "g") (?? "h"))))
+                 "a*b+c?d?e*?f+?g??h??")))
+
+(ert-deftest rx-or ()
+  ;; Test or-pattern reordering (Bug#34641).
+  (let ((s "abc"))
+    (should (equal (and (string-match (rx (or "abc" "ab" "a")) s)
+                        (match-string 0 s))
+                   "abc"))
+    (should (equal (and (string-match (rx (or "ab" "abc" "a")) s)
+                        (match-string 0 s))
+                   "ab"))
+    (should (equal (and (string-match (rx (or "a" "ab" "abc")) s)
+                        (match-string 0 s))
+                   "a"))))
+
 (provide 'rx-tests)
 ;; rx-tests.el ends here.
diff --git a/test/lisp/emacs-lisp/seq-tests.el 
b/test/lisp/emacs-lisp/seq-tests.el
index 989ec3c..ef05e2b 100644
--- a/test/lisp/emacs-lisp/seq-tests.el
+++ b/test/lisp/emacs-lisp/seq-tests.el
@@ -1,6 +1,6 @@
 ;;; seq-tests.el --- Tests for sequences.el
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <address@hidden>
 ;; Maintainer: address@hidden
@@ -185,6 +185,18 @@ Evaluate BODY for each created sequence.
   (with-test-sequences (seq '(3 4 5 6))
     (should (= 5 (seq-contains seq 5)))))
 
+(ert-deftest test-seq-contains-p ()
+  (with-test-sequences (seq '(3 4 5 6))
+    (should (eq (seq-contains-p seq 3) t))
+    (should-not (seq-contains-p seq 7)))
+  (with-test-sequences (seq '())
+    (should-not (seq-contains-p seq 3))
+    (should-not (seq-contains-p seq nil))))
+
+(ert-deftest test-seq-contains-p-with-nil ()
+  (should (seq-contains-p  [nil] nil))
+  (should (seq-contains-p '(nil) nil)))
+
 (ert-deftest test-seq-every-p ()
   (with-test-sequences (seq '(43 54 22 1))
     (should (seq-every-p (lambda (elt) t) seq))
@@ -424,5 +436,30 @@ Evaluate BODY for each created sequence.
     (should (eq (seq-into vec 'vector) vec))
     (should (eq (seq-into str 'string) str))))
 
+(ert-deftest test-seq-first ()
+  (let ((lst '(1 2 3))
+        (vec [1 2 3]))
+    (should (eq (seq-first lst) 1))
+    (should (eq (seq-first vec) 1))))
+
+(ert-deftest test-seq-rest ()
+  (let ((lst '(1 2 3))
+        (vec [1 2 3]))
+    (should (equal (seq-rest lst) '(2 3)))
+    (should (equal (seq-rest vec) [2 3]))))
+
+;; Regression tests for bug#34852
+(progn
+  (ert-deftest test-seq-intersection-with-nil ()
+    (should (equal (seq-intersection '(1 2 nil) '(1 nil)) '(1 nil))))
+
+  (ert-deftest test-seq-set-equal-p-with-nil ()
+    (should (seq-set-equal-p '("a" "b" nil)
+                             '(nil "b" "a"))))
+
+  (ert-deftest test-difference-with-nil ()
+    (should (equal (seq-difference '(1 nil) '(2 nil))
+                   '(1)))))
+
 (provide 'seq-tests)
 ;;; seq-tests.el ends here
diff --git a/test/lisp/emacs-lisp/shadow-tests.el 
b/test/lisp/emacs-lisp/shadow-tests.el
index f0aa131..e3a2d6b 100644
--- a/test/lisp/emacs-lisp/shadow-tests.el
+++ b/test/lisp/emacs-lisp/shadow-tests.el
@@ -1,6 +1,6 @@
 ;;; shadow-tests.el --- Test suite for shadow.  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emacs-lisp/subr-x-tests.el 
b/test/lisp/emacs-lisp/subr-x-tests.el
index 81467ba..d3cb2b1 100644
--- a/test/lisp/emacs-lisp/subr-x-tests.el
+++ b/test/lisp/emacs-lisp/subr-x-tests.el
@@ -1,6 +1,6 @@
 ;;; subr-x-tests.el --- Testing the extended lisp routines
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Fabián E. Gallina <address@hidden>
 ;; Keywords:
diff --git a/test/lisp/emacs-lisp/tabulated-list-test.el 
b/test/lisp/emacs-lisp/tabulated-list-test.el
index 25a7c9f..052d2e8 100644
--- a/test/lisp/emacs-lisp/tabulated-list-test.el
+++ b/test/lisp/emacs-lisp/tabulated-list-test.el
@@ -1,6 +1,6 @@
 ;;; tabulated-list-test.el --- Tests for emacs-lisp/tabulated-list.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <address@hidden>
 
diff --git a/test/lisp/emacs-lisp/testcover-resources/testcases.el 
b/test/lisp/emacs-lisp/testcover-resources/testcases.el
index 69ef5b5..571e9ab 100644
--- a/test/lisp/emacs-lisp/testcover-resources/testcases.el
+++ b/test/lisp/emacs-lisp/testcover-resources/testcases.el
@@ -1,6 +1,6 @@
 ;;;; testcases.el -- Test cases for testcover-tests.el
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell
 
diff --git a/test/lisp/emacs-lisp/testcover-tests.el 
b/test/lisp/emacs-lisp/testcover-tests.el
index 6c76421..cbef493 100644
--- a/test/lisp/emacs-lisp/testcover-tests.el
+++ b/test/lisp/emacs-lisp/testcover-tests.el
@@ -1,6 +1,6 @@
 ;;; testcover-tests.el --- Testcover test suite   -*- lexical-binding:t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell
 
diff --git a/test/lisp/emacs-lisp/text-property-search-tests.el 
b/test/lisp/emacs-lisp/text-property-search-tests.el
index 5ea6b53..47db54a 100644
--- a/test/lisp/emacs-lisp/text-property-search-tests.el
+++ b/test/lisp/emacs-lisp/text-property-search-tests.el
@@ -1,6 +1,6 @@
 ;;; text-property-search-tests.el --- Testing text-property-search
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Ingebrigtsen <address@hidden>
 ;; Keywords:
diff --git a/test/lisp/emacs-lisp/thunk-tests.el 
b/test/lisp/emacs-lisp/thunk-tests.el
index b24e8d1..caa2c41 100644
--- a/test/lisp/emacs-lisp/thunk-tests.el
+++ b/test/lisp/emacs-lisp/thunk-tests.el
@@ -1,6 +1,6 @@
 ;;; thunk-tests.el --- Tests for thunk.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/test/lisp/emacs-lisp/timer-tests.el 
b/test/lisp/emacs-lisp/timer-tests.el
index e463b9e..bd2dcbe 100644
--- a/test/lisp/emacs-lisp/timer-tests.el
+++ b/test/lisp/emacs-lisp/timer-tests.el
@@ -1,6 +1,6 @@
 ;;; timer-tests.el --- tests for timers -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/emulation/viper-tests.el 
b/test/lisp/emulation/viper-tests.el
index efb84f1..1359dcf 100644
--- a/test/lisp/emulation/viper-tests.el
+++ b/test/lisp/emulation/viper-tests.el
@@ -1,6 +1,6 @@
 ;;; viper-tests.el --- tests for viper.
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/epg-tests.el b/test/lisp/epg-tests.el
index c1e98a6..1a11e41 100644
--- a/test/lisp/epg-tests.el
+++ b/test/lisp/epg-tests.el
@@ -1,6 +1,6 @@
 ;;; epg-tests.el --- Test suite for epg.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -82,7 +82,7 @@
           (setf (epg-context-home-directory context)
                 epg-tests-home-directory)
           ,(if require-passphrase
-               `(with-temp-file (expand-file-name
+               '(with-temp-file (expand-file-name
                                   "gpg-agent.conf" epg-tests-home-directory)
                    (insert "pinentry-program "
                            (expand-file-name "dummy-pinentry"
@@ -92,11 +92,11 @@
                     context
                     #'epg-tests-passphrase-callback)))
           ,(if require-public-key
-               `(epg-import-keys-from-file
+               '(epg-import-keys-from-file
                  context
                  (expand-file-name "pubkey.asc" epg-tests-data-directory)))
           ,(if require-secret-key
-               `(epg-import-keys-from-file
+               '(epg-import-keys-from-file
                  context
                  (expand-file-name "seckey.asc" epg-tests-data-directory)))
           (with-temp-buffer
@@ -107,7 +107,10 @@
         (delete-directory epg-tests-home-directory t)))))
 
 (ert-deftest epg-decrypt-1 ()
+  :expected-result (if (getenv "EMACS_HYDRA_CI") :failed :passed) ; fixme
   (with-epg-tests (:require-passphrase t)
+    (with-temp-file (expand-file-name "gpg.conf" epg-tests-home-directory)
+      (insert "ignore-mdc-error"))
     (should (equal "test"
                   (epg-decrypt-string epg-tests-context "\
 -----BEGIN PGP MESSAGE-----
@@ -118,6 +121,7 @@ jA0EAwMCE19JBLTvvmhgyRrGGglRbnKkK9PJG8fDwO5ccjysrR7IcdNcnA==
 -----END PGP MESSAGE-----")))))
 
 (ert-deftest epg-roundtrip-1 ()
+ :expected-result (if (getenv "EMACS_HYDRA_CI") :failed :passed) ; fixme
   (with-epg-tests (:require-passphrase t)
     (let ((cipher (epg-encrypt-string epg-tests-context "symmetric" nil)))
       (should (equal "symmetric"
diff --git a/test/lisp/erc/erc-track-tests.el b/test/lisp/erc/erc-track-tests.el
index 44a952c..feb7ee6 100644
--- a/test/lisp/erc/erc-track-tests.el
+++ b/test/lisp/erc/erc-track-tests.el
@@ -1,6 +1,6 @@
 ;;; erc-track-tests.el --- Tests for erc-track.
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Mario Lang <address@hidden>
 ;; Author: Vivek Dasmohapatra <address@hidden>
diff --git a/test/lisp/eshell/em-hist-tests.el 
b/test/lisp/eshell/em-hist-tests.el
index 3d73b12..2fec115 100644
--- a/test/lisp/eshell/em-hist-tests.el
+++ b/test/lisp/eshell/em-hist-tests.el
@@ -1,6 +1,6 @@
 ;;; tests/em-hist-tests.el --- em-hist test suite
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/eshell/em-ls-tests.el b/test/lisp/eshell/em-ls-tests.el
index c5c9eac..d5f9d24 100644
--- a/test/lisp/eshell/em-ls-tests.el
+++ b/test/lisp/eshell/em-ls-tests.el
@@ -1,6 +1,6 @@
 ;;; tests/em-ls-tests.el --- em-ls test suite
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <address@hidden>
 
@@ -78,6 +78,11 @@
 
 (ert-deftest em-ls-test-bug27844 ()
   "Test for https://debbugs.gnu.org/27844 ."
+  ;; FIXME: it would be better to use something other than source-directory
+  ;; in this test.
+  (skip-unless (and source-directory
+                    (file-exists-p
+                     (expand-file-name "lisp/subr.el" source-directory))))
   (let ((orig eshell-ls-use-in-dired)
         (dired-use-ls-dired 'unspecified)
         buf insert-directory-program)
@@ -88,7 +93,14 @@
           (dired-toggle-marks)
           (should (cdr (dired-get-marked-files)))
           (kill-buffer buf)
-          (setq buf (dired (expand-file-name "lisp/subr.el" source-directory)))
+          ;; Eshell's default format duplicates the year for non-recent files,
+          ;; eg "2015-05-06  2015", which doesn't make a lot of sense,
+          ;; and causes this portion of the test to fail if subr.el
+          ;; is non-recent (eg if building from a tarfile unpacked
+          ;; with a fixed early timestamp for reproducibility).  Bug#33734.
+          (let ((eshell-ls-date-format "%b %e"))
+            (setq buf (dired (expand-file-name "lisp/subr.el"
+                                               source-directory))))
           (should (looking-at "subr\\.el")))
       (customize-set-variable 'eshell-ls-use-in-dired orig)
       (and (buffer-live-p buf) (kill-buffer)))))
diff --git a/test/lisp/eshell/esh-opt-tests.el 
b/test/lisp/eshell/esh-opt-tests.el
index 13b522b..39284c0 100644
--- a/test/lisp/eshell/esh-opt-tests.el
+++ b/test/lisp/eshell/esh-opt-tests.el
@@ -1,6 +1,6 @@
 ;;; tests/esh-opt-tests.el --- esh-opt test suite
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el
index b6dbd09..53cf854 100644
--- a/test/lisp/eshell/eshell-tests.el
+++ b/test/lisp/eshell/eshell-tests.el
@@ -1,6 +1,6 @@
 ;;; tests/eshell-tests.el --- Eshell test suite
 
-;; Copyright (C) 1999-2018 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2019 Free Software Foundation, Inc.
 
 ;; Author: John Wiegley <address@hidden>
 
@@ -31,6 +31,9 @@
 (defmacro with-temp-eshell (&rest body)
   "Evaluate BODY in a temporary Eshell buffer."
   `(let* ((eshell-directory-name (make-temp-file "eshell" t))
+          ;; We want no history file, so prevent Eshell from falling
+          ;; back on $HISTFILE.
+          (process-environment (cons "HISTFILE" process-environment))
           (eshell-history-file-name nil)
           (eshell-buffer (eshell t)))
      (unwind-protect
diff --git a/test/lisp/faces-tests.el b/test/lisp/faces-tests.el
index 3fad8bd..f00c93c 100644
--- a/test/lisp/faces-tests.el
+++ b/test/lisp/faces-tests.el
@@ -1,6 +1,6 @@
 ;;; faces-tests.el --- Tests for faces.el            -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <address@hidden>
 ;; Keywords:
@@ -60,5 +60,14 @@
     (should (equal (background-color-at-point) "black"))
     (should (equal (foreground-color-at-point) "black"))))
 
+(ert-deftest faces--test-face-id ()
+  ;; Face ID of 0 is the 'default' face; no face should have the same ID.
+  (should (> (face-id 'faces--test1) 0))
+  ;; 'tooltip' is the last face defined by preloaded packages, so any
+  ;; face we define in Emacs should have a face ID greater than that,
+  ;; since the ID of a face is just its index in the array that maps
+  ;; face IDs to faces.
+  (should (> (face-id 'faces--test1) (face-id 'tooltip))))
+
 (provide 'faces-tests)
 ;;; faces-tests.el ends here
diff --git a/test/lisp/ffap-tests.el b/test/lisp/ffap-tests.el
index 479d8c6..5b2f43c 100644
--- a/test/lisp/ffap-tests.el
+++ b/test/lisp/ffap-tests.el
@@ -1,6 +1,6 @@
 ;;; ffap-tests.el --- Test suite for ffap.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <address@hidden>
 
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index 612ea8c..5003620 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -1,6 +1,6 @@
 ;;; filenotify-tests.el --- Tests of file notifications  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 
@@ -31,6 +31,21 @@
 ;; remote host, set this environment variable to "/dev/null" or
 ;; whatever is appropriate on your system.
 
+;; For the remote file-notify library, Tramp checks for the existence
+;; of a respective command.  The first command found is used.  In
+;; order to use a dedicated one, the environment variable
+;; $REMOTE_FILE_NOTIFY_LIBRARY shall be set, possible values are
+;; "inotifywait", "gio-monitor" and "gvfs-monitor-dir".
+
+;; Local file-notify libraries are auto-detected during Emacs
+;; configuration.  This can be changed with a respective configuration
+;; argument, like
+;;
+;;   --with-file-notification=inotify
+;;   --with-file-notification=kqueue
+;;   --with-file-notification=gfile
+;;   --with-file-notification=w32
+
 ;; A whole test run can be performed calling the command 
`file-notify-test-all'.
 
 ;;; Code:
@@ -64,6 +79,12 @@
       (format "/mock::%s" temporary-file-directory)))
   "Temporary directory for Tramp tests.")
 
+;; Filter suppressed remote file-notify libraries.
+(when (stringp (getenv "REMOTE_FILE_NOTIFY_LIBRARY"))
+  (dolist (lib '("inotifywait" "gio-monitor" "gvfs-monitor-dir"))
+    (unless (string-equal (getenv "REMOTE_FILE_NOTIFY_LIBRARY") lib)
+      (add-to-list 'tramp-connection-properties `(nil ,lib nil)))))
+
 (defvar file-notify--test-tmpdir nil)
 (defvar file-notify--test-tmpfile nil)
 (defvar file-notify--test-tmpfile1 nil)
@@ -240,15 +261,18 @@ This returns only for the local case and gfilenotify; 
otherwise it is nil.
                              (gfile-monitor-name file-notify--test-desc)))
           (cdr (assq file-notify--test-desc file-notify--test-monitors))))))
 
-(defmacro file-notify--deftest-remote (test docstring)
+(defmacro file-notify--deftest-remote (test docstring &optional expected skip)
   "Define ert `TEST-remote' for remote files."
   (declare (indent 1))
   `(ert-deftest ,(intern (concat (symbol-name test) "-remote")) ()
      ,docstring
      :tags '(:expensive-test)
+     :expected-result (or ,expected :passed)
+     (skip-unless (not ,skip))
      (let* ((temporary-file-directory
             file-notify-test-remote-temporary-file-directory)
-           (ert-test (ert-get-test ',test)))
+           (ert-test (ert-get-test ',test))
+            vc-handled-backends)
        (skip-unless (file-notify--test-remote-enabled))
        (tramp-cleanup-connection
        (tramp-dissect-file-name temporary-file-directory) nil 'keep-password)
@@ -426,36 +450,36 @@ This returns only for the local case and gfilenotify; 
otherwise it is nil.
       ;; harm.  This fails on Cygwin because of timing issues unless a
       ;; long `sit-for' is added before the call to
       ;; `file-notify--test-read-event'.
-    (if (not (eq system-type 'cygwin))
-      (let (results)
-        (cl-flet ((first-callback (event)
-                   (when (eq (nth 1 event) 'deleted) (push 1 results)))
-                  (second-callback (event)
-                   (when (eq (nth 1 event) 'deleted) (push 2 results))))
-          (setq file-notify--test-tmpfile (file-notify--test-make-temp-name))
-          (write-region
-           "any text" nil file-notify--test-tmpfile nil 'no-message)
-          (should
-           (setq file-notify--test-desc
-                 (file-notify-add-watch
-                  file-notify--test-tmpfile
-                  '(change) #'first-callback)))
-          (should
-           (setq file-notify--test-desc1
-                 (file-notify-add-watch
-                  file-notify--test-tmpfile
-                  '(change) #'second-callback)))
-          ;; Remove first watch.
-          (file-notify-rm-watch file-notify--test-desc)
-          ;; Only the second callback shall run.
-         (file-notify--test-read-event)
-          (delete-file file-notify--test-tmpfile)
-          (file-notify--wait-for-events
-           (file-notify--test-timeout) results)
-          (should (equal results (list 2)))
-
-          ;; The environment shall be cleaned up.
-          (file-notify--test-cleanup-p))))
+      (unless (eq system-type 'cygwin)
+        (let (results)
+          (cl-flet ((first-callback (event)
+                     (when (eq (nth 1 event) 'deleted) (push 1 results)))
+                    (second-callback (event)
+                     (when (eq (nth 1 event) 'deleted) (push 2 results))))
+            (setq file-notify--test-tmpfile (file-notify--test-make-temp-name))
+            (write-region
+             "any text" nil file-notify--test-tmpfile nil 'no-message)
+            (should
+             (setq file-notify--test-desc
+                   (file-notify-add-watch
+                    file-notify--test-tmpfile
+                    '(change) #'first-callback)))
+            (should
+             (setq file-notify--test-desc1
+                   (file-notify-add-watch
+                    file-notify--test-tmpfile
+                    '(change) #'second-callback)))
+            ;; Remove first watch.
+            (file-notify-rm-watch file-notify--test-desc)
+            ;; Only the second callback shall run.
+           (file-notify--test-read-event)
+            (delete-file file-notify--test-tmpfile)
+            (file-notify--wait-for-events
+             (file-notify--test-timeout) results)
+            (should (equal results (list 2)))
+
+            ;; The environment shall be cleaned up.
+            (file-notify--test-cleanup-p))))
 
     ;; Cleanup.
     (file-notify--test-cleanup)))
@@ -664,6 +688,10 @@ delivered."
              '(created deleted stopped))
             ((string-equal (file-notify--test-library) "kqueue")
              '(created changed deleted stopped))
+             ;; On emba, `deleted' and `stopped' events of the
+             ;; directory are not detected.
+             ((getenv "EMACS_EMBA_CI")
+              '(created changed deleted))
             (t '(created changed deleted deleted stopped)))
          (write-region
           "any text" nil file-notify--test-tmpfile nil 'no-message)
@@ -709,6 +737,10 @@ delivered."
              '(created created changed changed deleted stopped))
             ((string-equal (file-notify--test-library) "kqueue")
              '(created changed created changed deleted stopped))
+             ;; On emba, `deleted' and `stopped' events of the
+             ;; directory are not detected.
+             ((getenv "EMACS_EMBA_CI")
+              '(created changed created changed deleted deleted))
             (t '(created changed created changed
                  deleted deleted deleted stopped)))
          (write-region
@@ -761,6 +793,10 @@ delivered."
              '(created created deleted deleted stopped))
             ((string-equal (file-notify--test-library) "kqueue")
              '(created changed renamed deleted stopped))
+             ;; On emba, `deleted' and `stopped' events of the
+             ;; directory are not detected.
+             ((getenv "EMACS_EMBA_CI")
+              '(created changed renamed deleted))
             (t '(created changed renamed deleted deleted stopped)))
          (write-region
           "any text" nil file-notify--test-tmpfile nil 'no-message)
@@ -979,51 +1015,55 @@ delivered."
     (file-notify--test-cleanup))
 
   (unwind-protect
-      (let ((file-notify--test-tmpdir
-            (make-temp-file "file-notify-test-parent" t)))
-       (should
-        (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
-              file-notify--test-desc
-              (file-notify-add-watch
-               file-notify--test-tmpdir
-               '(change) #'file-notify--test-event-handler)))
-       (should (file-notify-valid-p file-notify--test-desc))
-       (file-notify--test-with-events
-        (cond
-         ;; w32notify does not raise `deleted' and `stopped' events
-         ;; for the watched directory.
-         ((string-equal (file-notify--test-library) "w32notify")
-          '(created changed deleted))
-          ;; gvfs-monitor-dir on cygwin does not detect the `created'
-          ;; event reliably.
-         ((string-equal (file-notify--test-library) "gvfs-monitor-dir.exe")
-          '((deleted stopped)
-            (created deleted stopped)))
-         ;; There are two `deleted' events, for the file and for the
-         ;; directory.  Except for cygwin and kqueue.  And cygwin
-         ;; does not raise a `changed' event.
-         ((eq system-type 'cygwin)
-          '(created deleted stopped))
-         ((string-equal (file-notify--test-library) "kqueue")
-          '(created changed deleted stopped))
-         (t '(created changed deleted deleted stopped)))
-        (write-region
-         "any text" nil file-notify--test-tmpfile nil 'no-message)
-        (file-notify--test-read-event)
-        (delete-directory file-notify--test-tmpdir 'recursive))
-       ;; After deleting the parent directory, the descriptor must
-       ;; not be valid anymore.
-       (should-not (file-notify-valid-p file-notify--test-desc))
-        ;; w32notify doesn't generate `stopped' events when the parent
-        ;; directory is deleted, which doesn't provide a chance for
-        ;; filenotify.el to remove the descriptor from the internal
-        ;; hash table it maintains.  So we must remove the descriptor
-        ;; manually.
-        (if (string-equal (file-notify--test-library) "w32notify")
-            (file-notify--rm-descriptor file-notify--test-desc))
+      ;; On emba, `deleted' and `stopped' events of the directory are
+      ;; not detected.
+      (unless (getenv "EMACS_EMBA_CI")
+        (let ((file-notify--test-tmpdir
+              (make-temp-file "file-notify-test-parent" t)))
+         (should
+          (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
+                file-notify--test-desc
+                (file-notify-add-watch
+                 file-notify--test-tmpdir
+                 '(change) #'file-notify--test-event-handler)))
+         (should (file-notify-valid-p file-notify--test-desc))
+         (file-notify--test-with-events
+             (cond
+              ;; w32notify does not raise `deleted' and `stopped'
+              ;; events for the watched directory.
+              ((string-equal (file-notify--test-library) "w32notify")
+               '(created changed deleted))
+               ;; gvfs-monitor-dir on cygwin does not detect the
+               ;; `created' event reliably.
+              ((string-equal
+                 (file-notify--test-library) "gvfs-monitor-dir.exe")
+               '((deleted stopped)
+                 (created deleted stopped)))
+              ;; There are two `deleted' events, for the file and for
+              ;; the directory.  Except for cygwin and kqueue.  And
+              ;; cygwin does not raise a `changed' event.
+              ((eq system-type 'cygwin)
+               '(created deleted stopped))
+              ((string-equal (file-notify--test-library) "kqueue")
+               '(created changed deleted stopped))
+              (t '(created changed deleted deleted stopped)))
+           (write-region
+            "any text" nil file-notify--test-tmpfile nil 'no-message)
+           (file-notify--test-read-event)
+           (delete-directory file-notify--test-tmpdir 'recursive))
+         ;; After deleting the parent directory, the descriptor must
+         ;; not be valid anymore.
+         (should-not (file-notify-valid-p file-notify--test-desc))
+          ;; w32notify doesn't generate `stopped' events when the
+          ;; parent directory is deleted, which doesn't provide a
+          ;; chance for filenotify.el to remove the descriptor from
+          ;; the internal hash table it maintains.  So we must remove
+          ;; the descriptor manually.
+          (if (string-equal (file-notify--test-library) "w32notify")
+              (file-notify--rm-descriptor file-notify--test-desc))
 
-        ;; The environment shall be cleaned up.
-        (file-notify--test-cleanup-p))
+          ;; The environment shall be cleaned up.
+          (file-notify--test-cleanup-p)))
 
     ;; Cleanup.
     (file-notify--test-cleanup)))
@@ -1061,7 +1101,9 @@ delivered."
     (file-notify--test-cleanup))
 
   (unwind-protect
-      (progn
+      ;; On emba, `deleted' and `stopped' events of the directory are
+      ;; not detected.
+      (unless (getenv "EMACS_EMBA_CI")
        (should
         (setq file-notify--test-tmpfile
               (make-temp-file "file-notify-test-parent" t)))
@@ -1150,7 +1192,8 @@ delivered."
             (file-notify--test-read-event)
             (delete-file file)))
         (delete-directory file-notify--test-tmpfile)
-        (if (string-equal (file-notify--test-library) "w32notify")
+        (if (or (string-equal (file-notify--test-library) "w32notify")
+                (getenv "EMACS_EMBA_CI"))
             (file-notify--rm-descriptor file-notify--test-desc))
 
         ;; The environment shall be cleaned up.
@@ -1159,8 +1202,10 @@ delivered."
     ;; Cleanup.
     (file-notify--test-cleanup)))
 
+;; Unpredictable failures, eg https://hydra.nixos.org/build/86016286
 (file-notify--deftest-remote file-notify-test07-many-events
-   "Check that events are not dropped for remote directories.")
+   "Check that events are not dropped for remote directories."
+   :passed (getenv "EMACS_HYDRA_CI"))
 
 (ert-deftest file-notify-test08-backup ()
   "Check that backup keeps file notification."
@@ -1357,11 +1402,17 @@ the file watch."
                  ;; w32notify does not raise `deleted' and `stopped'
                  ;; events for the watched directory.
                   ((string-equal (file-notify--test-library) "w32notify") '())
+                  ;; On emba, `deleted' and `stopped' events of the
+                  ;; directory are not detected.
+                  ((getenv "EMACS_EMBA_CI")
+                   '())
                   (t '(deleted stopped))))))
           (delete-directory file-notify--test-tmpfile 'recursive))
-        (should-not (file-notify-valid-p file-notify--test-desc1))
-        (should-not (file-notify-valid-p file-notify--test-desc2))
-        (when (string-equal (file-notify--test-library) "w32notify")
+        (unless (getenv "EMACS_EMBA_CI")
+          (should-not (file-notify-valid-p file-notify--test-desc1))
+          (should-not (file-notify-valid-p file-notify--test-desc2)))
+        (when (or (string-equal (file-notify--test-library) "w32notify")
+                  (getenv "EMACS_EMBA_CI"))
           (file-notify--rm-descriptor file-notify--test-desc1)
           (file-notify--rm-descriptor file-notify--test-desc2))
 
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 3b192ee..57d8363 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -1,6 +1,6 @@
 ;;; files-tests.el --- tests for files.el.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -1109,6 +1109,16 @@ unquoted file names."
     (with-temp-buffer
       (write-region nil nil nospecial nil :visit))))
 
+(ert-deftest files-tests-file-name-non-special-make-process ()
+  "Check that the ‘:file-handler’ argument of ‘make-process’
+works as expected if the default directory is quoted."
+  (let ((default-directory (file-name-quote invocation-directory))
+        (program (file-name-quote
+                  (expand-file-name invocation-name invocation-directory))))
+    (should (processp (make-process :name "name"
+                                    :command (list program "--version")
+                                    :file-handler t)))))
+
 (ert-deftest files-tests--insert-directory-wildcard-in-dir-p ()
   (let ((alist (list (cons "/home/user/*/.txt" (cons "/home/user/" "*/.txt"))
                      (cons "/home/user/.txt" nil)
diff --git a/test/lisp/files-x-tests.el b/test/lisp/files-x-tests.el
index a77c681..568a898 100644
--- a/test/lisp/files-x-tests.el
+++ b/test/lisp/files-x-tests.el
@@ -1,6 +1,6 @@
 ;;; files-x-tests.el --- tests for files-x.el.
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 
@@ -35,6 +35,11 @@
   '((remote-null-device . "/dev/null")))
 (defconst files-x-test--variables4
   '((remote-null-device . "null")))
+(put 'remote-shell-file-name 'safe-local-variable #'identity)
+(put 'remote-shell-command-switch 'safe-local-variable #'identity)
+(put 'remote-shell-interactive-switch 'safe-local-variable #'identity)
+(put 'remote-shell-login-switch 'safe-local-variable #'identity)
+(put 'remote-null-device 'safe-local-variable #'identity)
 
 (defconst files-x-test--application '(:application 'my-application))
 (defconst files-x-test--another-application
@@ -268,7 +273,9 @@
         (should-not (local-variable-p 'remote-shell-file-name))
         (should-not (boundp 'remote-shell-file-name))))))
 
-(ert-deftest files-x-test-with-connection-local-profiles ()
+(defvar tramp-connection-local-default-profile)
+
+(ert-deftest files-x-test-with-connection-local-variables ()
   "Test setting connection-local variables."
 
   (let (connection-local-profile-alist connection-local-criteria-alist)
@@ -303,46 +310,48 @@
          (string-equal (symbol-value 'remote-null-device) "/dev/null"))
 
        ;; A candidate connection-local variable is not bound yet.
-        (should-not (local-variable-p 'remote-shell-command-switch))
-
-       ;; Use the macro.
-        (with-connection-local-profiles '(remote-bash remote-ksh)
-          ;; All connection-local variables are set.  They apply in
-          ;; reverse order in `connection-local-variables-alist'.
-          ;; This variable keeps only the variables to be set inside
-          ;; the macro.
-          (should
-           (equal connection-local-variables-alist
-                  (nreverse (copy-tree files-x-test--variables1))))
-          ;; The variables exist also as local variables.
-          (should (local-variable-p 'remote-shell-file-name))
-          (should (local-variable-p 'remote-shell-command-switch))
-          ;; The proper variable values are set.  The settings from
-          ;; `remote-bash' overwrite the same variables as in
-          ;; `remote-ksh'.
-          (should
-           (string-equal (symbol-value 'remote-shell-file-name) "/bin/bash"))
-          (should
-           (string-equal (symbol-value 'remote-shell-command-switch) "-c")))
-
-        ;; Everything is rewound.  The old variable values are reset.
-        (should
-         (equal connection-local-variables-alist
-               (append
-                (nreverse (copy-tree files-x-test--variables3))
-                (nreverse (copy-tree files-x-test--variables2)))))
-        ;; The variables exist also as local variables.
-        (should (local-variable-p 'remote-shell-file-name))
-        (should (local-variable-p 'remote-null-device))
-        ;; The proper variable values are set.  The settings from
-       ;; `remote-ksh' are back.
-        (should
-         (string-equal (symbol-value 'remote-shell-file-name) "/bin/ksh"))
-        (should
-         (string-equal (symbol-value 'remote-null-device) "/dev/null"))
+        (should-not (local-variable-p 'remote-shell-command-switch))))
 
-       ;; The variable set temporarily is not unbound, again.
-        (should-not (local-variable-p 'remote-shell-command-switch))))))
+    (with-temp-buffer
+      ;; Use the macro.  We need a remote `default-directory'.
+      (let ((enable-connection-local-variables t)
+           (default-directory "/method:host:")
+           (remote-null-device "null"))
+        (should-not connection-local-variables-alist)
+        (should-not (local-variable-p 'remote-shell-file-name))
+        (should-not (local-variable-p 'remote-null-device))
+        (should-not (boundp 'remote-shell-file-name))
+        (should (string-equal (symbol-value 'remote-null-device) "null"))
+
+       (with-connection-local-variables
+        ;; All connection-local variables are set.  They apply in
+        ;; reverse order in `connection-local-variables-alist'.
+        ;; Since we ha a remote default directory, Tramp's settings
+        ;; are appended as well.
+         (should
+          (equal
+           connection-local-variables-alist
+          (append
+           (nreverse (copy-tree files-x-test--variables3))
+           (nreverse (copy-tree files-x-test--variables2))
+            (nreverse (copy-tree tramp-connection-local-default-profile)))))
+         ;; The variables exist also as local variables.
+         (should (local-variable-p 'remote-shell-file-name))
+         (should (local-variable-p 'remote-null-device))
+         ;; The proper variable values are set.
+         (should
+          (string-equal (symbol-value 'remote-shell-file-name) "/bin/ksh"))
+         (should
+          (string-equal (symbol-value 'remote-null-device) "/dev/null")))
+
+       ;; Everything is rewound.  The old variable values are reset.
+       (should-not connection-local-variables-alist)
+       ;; The variables don't exist as local variables.
+       (should-not (local-variable-p 'remote-shell-file-name))
+       (should-not (local-variable-p 'remote-null-device))
+       ;; The variable values are reset.
+       (should-not (boundp 'remote-shell-file-name))
+       (should (string-equal (symbol-value 'remote-null-device) "null"))))))
 
 (provide 'files-x-tests)
 ;;; files-x-tests.el ends here
diff --git a/test/lisp/gnus/gnus-test-headers.el 
b/test/lisp/gnus/gnus-test-headers.el
new file mode 100644
index 0000000..805a300
--- /dev/null
+++ b/test/lisp/gnus/gnus-test-headers.el
@@ -0,0 +1,176 @@
+;;; gnus-test-headers.el --- Tests for Gnus header-related functions  -*- 
lexical-binding: t; -*-
+
+;; Copyright (C) 2018  Free Software Foundation, Inc.
+
+;; Author: Eric Abrahamsen <address@hidden>
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; The tests her are for
+
+;;; Code:
+
+(require 'ert)
+(require 'gnus-sum)
+
+(defconst gnus-headers-test-data
+  '([2 "Re: [Emacs-devel] Emacs move" "Dave Love <address@hidden>"
+       "Thu, 14 Sep 2000 11:10:46 +0100"
+       "<address@hidden>"
+       "<address@hidden>"
+       1882 16 "nnmaildir mails:2"
+       ((To . "Jeff Bailey <address@hidden>")
+        (Cc . "address@hidden, address@hidden"))]
+    [3 "Re: [Emacs-devel] Emacs move" "Sam Steingold <address@hidden>"
+       "14 Sep 2000 10:21:56 -0400" "<address@hidden>"
+       "<address@hidden>"
+       2991 50 "nnmaildir mails:3"
+       ((To . "Jeff Bailey <address@hidden>")
+        (Cc . "address@hidden, address@hidden"))]
+    [4 "Re: [Emacs-devel] Emacs move" "Jeff Bailey <address@hidden>"
+       "Thu, 14 Sep 2000 09:14:47 -0700"
+       "<address@hidden>"
+       "<address@hidden> <address@hidden>"
+       1780 15 "nnmaildir mails:4"
+       ((To . "address@hidden, Jeff Bailey <address@hidden>")
+        (Cc . "address@hidden, address@hidden"))]
+    [5 "Re: [Emacs-devel] Emacs move" "Dave Love <address@hidden>"
+       "Thu, 14 Sep 2000 18:24:36 +0100"
+       "<address@hidden>"
+       "<address@hidden>"
+       1343 9 "nnmaildir mails:5"
+       ((To . "Jeff Bailey <address@hidden>")
+        (Cc . "address@hidden, address@hidden"))]
+    [6 "Re: [Emacs-devel] Emacs move" "Karl Fogel <address@hidden>"
+       "14 Sep 2000 10:37:35 -0500" "<address@hidden>"
+       "<address@hidden> <address@hidden>"
+       3740 124 "nnmaildir mails:6"
+       ((To . "Dave Love <address@hidden>")
+        (Cc . "Jeff Bailey <address@hidden>, address@hidden, address@hidden"))]
+    [7 "Re: [Emacs-devel] Emacs move" "Jeff Bailey <address@hidden>"
+       "Thu, 14 Sep 2000 10:55:12 -0700"
+       "<address@hidden>"
+       "<address@hidden> <address@hidden> <address@hidden>"
+       1687 16 "nnmaildir mails:7"
+       ((To . "address@hidden, Dave Love <address@hidden>")
+        (Cc . "Jeff Bailey <address@hidden>, address@hidden, address@hidden"))]
+    [8 "Re: [Emacs-devel] Emacs move" "John Wiegley <address@hidden>"
+       "Thu, 14 Sep 2000 12:19:01 -0700"
+       "<address@hidden>"
+       "<address@hidden>"
+       1978 27 "nnmaildir mails:8"
+       ((To . "address@hidden"))]
+    [9 "Re: [Emacs-devel] Emacs move"
+       "\"Robert J. Chassell\" <address@hidden>"
+       "Thu, 14 Sep 2000 07:33:15 -0400 (EDT)"
+       "<address@hidden>"
+       "<address@hidden>"
+       3046 72 "nnmaildir mails:9"
+       ((To . "address@hidden")
+        (Cc . "address@hidden, address@hidden"))]
+    [10 "Re: [Emacs-devel] Emacs move"
+        "address@hidden (William M. Perry)"
+        "14 Sep 2000 09:10:25 -0500"
+        "<address@hidden>"
+        "<address@hidden> <address@hidden>"
+        3104 44 "nnmaildir mails:10"
+        ((To . "address@hidden")
+         (Cc . "address@hidden, address@hidden, address@hidden"))]
+    [11 "Re: [Emacs-devel] Emacs move" "Gerd Moellmann <address@hidden>"
+        "Thu, 14 Sep 2000 21:51:05 +0200 (CEST)"
+        "<address@hidden>"
+        "<address@hidden> <address@hidden> <address@hidden>"
+        1884 6 "nnmaildir mails:11"
+        ((To . "address@hidden")
+         (Cc . "address@hidden, address@hidden, address@hidden, 
address@hidden"))]
+    [12 "Re: [Emacs-devel] Emacs move" "Gerd Moellmann <address@hidden>"
+        "Thu, 14 Sep 2000 21:49:03 +0200 (CEST)"
+        "<address@hidden>"
+        "<address@hidden> <address@hidden>"
+        2408 24 "nnmaildir mails:12"
+        ((To . "address@hidden")
+         (Cc . "address@hidden, address@hidden, address@hidden"))]
+    [13 "Re: [Emacs-devel] Emacs move"
+        "\"Robert J. Chassell\" <address@hidden>"
+        "Thu, 14 Sep 2000 17:50:01 -0400 (EDT)"
+        "<address@hidden>"
+        "<address@hidden> <address@hidden> <address@hidden>"
+        1968 23 "nnmaildir mails:13"
+        ((To . "address@hidden")
+         (Cc . "address@hidden, address@hidden, address@hidden, 
address@hidden"))]
+    [14 "Re: [Emacs-devel] Emacs move" "Richard Stallman <address@hidden>"
+        "Fri, 15 Sep 2000 16:28:12 -0600 (MDT)"
+        "<address@hidden>"
+        "<address@hidden> <address@hidden>"
+        1288 2 "nnmaildir mails:14"
+        ((To . "address@hidden, address@hidden, address@hidden"))]
+    [15 "[Emacs-devel] Emacs move" "Jeff Bailey <address@hidden>"
+        "Wed, 13 Sep 2000 17:59:43 -0700"
+        "<address@hidden>" ""
+        1661 26 "nnmaildir mails:15"
+        ((To . "address@hidden")
+         (Cc . "address@hidden"))]
+    [16 "Re: [Emacs-devel] Emacs move" "Jeff Bailey <address@hidden>"
+        "Fri, 15 Sep 2000 22:00:12 -0700"
+        "<address@hidden>"
+        "<address@hidden> <address@hidden> <address@hidden> <address@hidden>"
+        2857 51 "nnmaildir mails:16"
+        ((To . "address@hidden, address@hidden")
+         (Cc . "address@hidden, address@hidden, address@hidden"))])
+  "A pile of headers with potential interdependencies.")
+
+(ert-deftest gnus-headers-make-dependency-table ()
+  (let ((table (gnus-make-hashtable 20))
+        (data (copy-sequence gnus-headers-test-data))
+        ret)
+    (dolist (h data)
+      ;; `gnus-dependencies-add-header' returns nil if it fails to add
+      ;; the header.
+      (should (gnus-dependencies-add-header h table nil)))
+    ;; Pick a value to test.
+    (setq ret (gethash "<address@hidden>"
+                       table))
+    ;; The message has three children.
+    (should (= 3 (length (cdr ret))))
+    ;; The first of those children has one child.
+    (should (= 1 (length (cdr (nth 1 ret)))))))
+
+(ert-deftest gnus-headers-loop-dependencies ()
+  "Intentionally create a reference loop."
+  (let ((table (gnus-make-hashtable 20))
+        (data (copy-sequence gnus-headers-test-data))
+        (parent-id "<address@hidden>")
+        (child-id "<address@hidden>")
+        parent)
+    (dolist (h data)
+      (gnus-dependencies-add-header h table nil))
+
+    (setq parent (gethash parent-id table))
+
+    ;; Put the parent header in the child references of one of its own
+    ;; children.  `gnus-thread-loop-p' only checks if there's a loop
+    ;; between parent and immediate child, not parent and random
+    ;; descendant.  At least, near as I can tell that's the case.
+
+    (push (list (car parent)) (cdr (gethash child-id table)))
+
+    (let ((gnus-newsgroup-dependencies table))
+     (should
+      (= 1                              ; 1 indicates an infloop.
+         (gnus-thread-loop-p (car parent) (cadr parent)))))))
+
+(provide 'gnus-test-headers)
+;;; gnus-test-headers.el ends here
diff --git a/test/lisp/gnus/gnus-tests.el b/test/lisp/gnus/gnus-tests.el
index fe1fc18..4b7c91f 100644
--- a/test/lisp/gnus/gnus-tests.el
+++ b/test/lisp/gnus/gnus-tests.el
@@ -1,6 +1,6 @@
 ;;; gnus-tests.el --- Wrapper for the Gnus tests
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Teodor Zlatanov <address@hidden>
 
diff --git a/test/lisp/gnus/message-tests.el b/test/lisp/gnus/message-tests.el
index 7fa0fe9..aa3587d 100644
--- a/test/lisp/gnus/message-tests.el
+++ b/test/lisp/gnus/message-tests.el
@@ -1,6 +1,6 @@
 ;;; message-mode-tests.el --- Tests for message-mode  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: João Távora <address@hidden>
 
diff --git a/test/lisp/help-fns-tests.el b/test/lisp/help-fns-tests.el
index 7e726eb..e31ac6a 100644
--- a/test/lisp/help-fns-tests.el
+++ b/test/lisp/help-fns-tests.el
@@ -1,6 +1,6 @@
 ;;; help-fns.el --- tests for help-fns.el
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 
diff --git a/test/lisp/hi-lock-tests.el b/test/lisp/hi-lock-tests.el
index 4c639b0..c4d25b6 100644
--- a/test/lisp/hi-lock-tests.el
+++ b/test/lisp/hi-lock-tests.el
@@ -1,6 +1,6 @@
 ;;; hi-lock-tests.el --- Tests for hi-lock.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <address@hidden>
 ;; Keywords:
diff --git a/test/lisp/htmlfontify-tests.el b/test/lisp/htmlfontify-tests.el
index 002415c..ada8294 100644
--- a/test/lisp/htmlfontify-tests.el
+++ b/test/lisp/htmlfontify-tests.el
@@ -1,6 +1,6 @@
 ;;; htmlfontify-tests.el --- Test suite. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/ibuffer-tests.el b/test/lisp/ibuffer-tests.el
index ff5162f..0616c9b 100644
--- a/test/lisp/ibuffer-tests.el
+++ b/test/lisp/ibuffer-tests.el
@@ -1,6 +1,6 @@
 ;;; ibuffer-tests.el --- Test suite. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -312,8 +312,8 @@
                 (funcall create-non-file-buffer "ibuf-test-3.b" :size 50
                          :mode #'text-mode
                          :include-content "...but a multitude of drops?\n"))
-               (dirA (with-current-buffer bufA default-directory))
-               (dirB (with-current-buffer bufB default-directory)))
+               (dirA (regexp-quote (with-current-buffer bufA 
default-directory)))
+               (dirB (regexp-quote (with-current-buffer bufB 
default-directory))))
           (should (ibuffer-included-in-filters-p
                    bufA '((basename . "ibuf-test-3"))))
           (should (ibuffer-included-in-filters-p
diff --git a/test/lisp/ido-tests.el b/test/lisp/ido-tests.el
index 7a7b0e7..cb8f1d6 100644
--- a/test/lisp/ido-tests.el
+++ b/test/lisp/ido-tests.el
@@ -1,6 +1,6 @@
 ;;; ido-tests.el --- unit tests for ido.el           -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <address@hidden>
 
diff --git a/test/lisp/imenu-tests.el b/test/lisp/imenu-tests.el
index 5ea6f65..820e834 100644
--- a/test/lisp/imenu-tests.el
+++ b/test/lisp/imenu-tests.el
@@ -1,6 +1,6 @@
 ;;; imenu-tests.el --- Test suite for imenu.
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Masatake YAMATO <address@hidden>
 ;; Keywords: tools convenience
diff --git a/test/lisp/info-xref-tests.el b/test/lisp/info-xref-tests.el
index 1fcbb38..1de3a0d 100644
--- a/test/lisp/info-xref-tests.el
+++ b/test/lisp/info-xref-tests.el
@@ -1,6 +1,6 @@
 ;;; info-xref.el --- tests for info-xref.el
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/international/ccl-tests.el 
b/test/lisp/international/ccl-tests.el
index 7dd7224..69e3930 100644
--- a/test/lisp/international/ccl-tests.el
+++ b/test/lisp/international/ccl-tests.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/international/mule-tests.el 
b/test/lisp/international/mule-tests.el
index 59c9ff5..4c937ca 100644
--- a/test/lisp/international/mule-tests.el
+++ b/test/lisp/international/mule-tests.el
@@ -1,6 +1,6 @@
 ;;; mule-tests.el --- unit tests for mule.el         -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/international/mule-util-tests.el 
b/test/lisp/international/mule-util-tests.el
index 9254813..75e8bf7 100644
--- a/test/lisp/international/mule-util-tests.el
+++ b/test/lisp/international/mule-util-tests.el
@@ -1,6 +1,6 @@
 ;;; mule-util --- tests for international/mule-util.el
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/international/ucs-normalize-tests.el 
b/test/lisp/international/ucs-normalize-tests.el
index 1a1cc75..97d3eae 100644
--- a/test/lisp/international/ucs-normalize-tests.el
+++ b/test/lisp/international/ucs-normalize-tests.el
@@ -1,6 +1,6 @@
 ;;; ucs-normalize --- tests for international/ucs-normalize.el -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2002-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2002-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -182,25 +182,24 @@ implementations:
 
 (defconst ucs-normalize-tests--failing-lines-part1
   (list 15131 15132 15133 15134 15135 15136 15137 15138
-        15139
-        16149 16150 16151 16152 16153 16154 16155 16156
-        16157 16158 16159 16160 16161 16162 16163 16164
-        16165 16166 16167 16168 16169 16170 16171 16172
-        16173 16174 16175 16176 16177 16178 16179 16180
-        16181 16182 16183 16184 16185 16186 16187 16188
-        16189 16190 16191 16192 16193 16194 16195 16196
-        16197 16198 16199 16200 16201 16202 16203 16204
-        16205 16206 16207 16208 16209 16210 16211 16212
-        16213 16214 16215 16216 16217 16218 16219 16220
-        16221 16222 16223 16224 16225 16226 16227 16228
-        16229 16230 16231 16232 16233 16234 16235 16236
-        16237 16238 16239 16240 16241 16242 16243 16244
-        16245 16246 16247 16248 16249 16250 16251 16252
-        16253 16254 16255 16256 16257 16258 16259 16260
-        16261 16262 16263 16264 16265 16266 16267 16268
-        16269 16270 16271 16272 16273 16274 16275 16276
-        16277 16278 16279 16280 16281 16282 16283 16284
-        16285 16286 16287 16288 16289))
+        15139 16149 16150 16151 16152 16153 16154 16155
+        16156 16157 16158 16159 16160 16161 16162 16163
+        16164 16165 16166 16167 16168 16169 16170 16171
+        16172 16173 16174 16175 16176 16177 16178 16179
+        16180 16181 16182 16183 16184 16185 16186 16187
+        16188 16189 16190 16191 16192 16193 16194 16195
+        16196 16197 16198 16199 16200 16201 16202 16203
+        16204 16205 16206 16207 16208 16209 16210 16211
+        16212 16213 16214 16215 16216 16217 16218 16219
+        16220 16221 16222 16223 16224 16225 16226 16227
+        16228 16229 16230 16231 16232 16233 16234 16235
+        16236 16237 16238 16239 16240 16241 16242 16243
+        16244 16245 16246 16247 16248 16249 16250 16251
+        16252 16253 16254 16255 16256 16257 16258 16259
+        16260 16261 16262 16263 16264 16265 16266 16267
+        16268 16269 16270 16271 16272 16273 16274 16275
+        16276 16277 16278 16279 16280 16281 16282 16283
+        16284 16285 16286 16287 16288 16289 16366))
 
 ;; Keep a record of failures, for consulting afterwards (the ert
 ;; backtrace only shows a truncated version of these lists).
@@ -258,23 +257,22 @@ implementations:
     ucs-normalize-tests--failing-lines-part1)))
 
 (defconst ucs-normalize-tests--failing-lines-part2
-  (list 17482 17532 17636 18338 18340 18342 18344 18346
-        18348 18350 18352 18354 18356 18358 18360 18362
-        18364 18366 18376 18378 18380 18382 18384 18386
-        18388 18390 18392 18394 18396 18398 18400 18402
-        18404 18406 18408 18410 18412 18414 18416 18418
-        18420 18422 18424 18426 18428 18430 18432 18434
-        18436 18438 18440 18442 18444 18446 18448 18450
-        18452 18454 18456 18458 18460 18462 18464 18466
-        18468 18470 18472 18474 18476 18478 18480 18482
-        18484 18486 18488 18490 18492 18494 18496 18564
-        18566 18568 18570 18572 18574 18576 18578 18580
-        18582 18584 18586 18588 18590 18592 18594 18596
-        18598 18600 18602 18604 18606 18608 18610 18612
-        18614 18616 18618 18620 18622 18624 18626 18628
-        18630 18632 18634 18636 18638 18640 18642 18644
-        18646 18648 18650 18652 18654 18656 18658 18660
-        18662 18664 18666))
+  (list 17689 18379 18381 18383 18385 18387 18389 18391
+        18393 18395 18397 18399 18401 18403 18405 18407
+        18409 18411 18413 18415 18417 18419 18421 18423
+        18425 18427 18429 18431 18433 18435 18437 18439
+        18441 18443 18445 18447 18449 18451 18453 18455
+        18457 18459 18461 18463 18465 18467 18469 18471
+        18473 18475 18477 18479 18481 18483 18485 18487
+        18489 18491 18493 18495 18497 18499 18501 18569
+        18571 18573 18575 18577 18579 18581 18583 18585
+        18587 18589 18591 18593 18595 18597 18599 18601
+        18603 18605 18607 18609 18611 18613 18615 18617
+        18619 18621 18623 18625 18627 18629 18631 18633
+        18635 18637 18639 18641 18643 18645 18647 18649
+        18651 18653 18655 18657 18659 18661 18663 18665
+        18667 18669 18671 18673 18675 18677 18679 18681
+        18683 18685 18687 18689 18691 18693))
 
 (ert-deftest ucs-normalize-part2 ()
   :tags '(:expensive-test)
diff --git a/test/lisp/isearch-tests.el b/test/lisp/isearch-tests.el
index 44ce59c..23acc19 100644
--- a/test/lisp/isearch-tests.el
+++ b/test/lisp/isearch-tests.el
@@ -1,6 +1,6 @@
 ;;; isearch-tests.el --- Tests for isearch.el        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <address@hidden>
 
diff --git a/test/lisp/jit-lock-tests.el b/test/lisp/jit-lock-tests.el
index b65e698..16fff35 100644
--- a/test/lisp/jit-lock-tests.el
+++ b/test/lisp/jit-lock-tests.el
@@ -1,6 +1,6 @@
 ;;; jit-lock-tests.el --- tests for jit-lock
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Dmitry Gutov <address@hidden>
 
diff --git a/test/lisp/json-tests.el b/test/lisp/json-tests.el
index 84039c0..8d1978f 100644
--- a/test/lisp/json-tests.el
+++ b/test/lisp/json-tests.el
@@ -1,6 +1,6 @@
 ;;; json-tests.el --- Test suite for json.el
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Dmitry Gutov <address@hidden>
 
diff --git a/test/lisp/jsonrpc-tests.el b/test/lisp/jsonrpc-tests.el
index 1a84c30..52f709f 100644
--- a/test/lisp/jsonrpc-tests.el
+++ b/test/lisp/jsonrpc-tests.el
@@ -1,6 +1,6 @@
 ;;; jsonrpc-tests.el --- tests for jsonrpc.el        -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: João Távora <address@hidden>
 ;; Maintainer: João Távora <address@hidden>
@@ -64,7 +64,7 @@
                             (unless (memq method '(+ - * / vconcat append
                                                      sit-for ignore))
                               (signal 'jsonrpc-error
-                                      `((jsonrpc-error-message
+                                      '((jsonrpc-error-message
                                          . "Sorry, this isn't allowed")
                                         (jsonrpc-error-code . -32601))))
                             (apply method (append params nil)))
diff --git a/test/lisp/kmacro-tests.el b/test/lisp/kmacro-tests.el
index 7c3dde1..f27f22a 100644
--- a/test/lisp/kmacro-tests.el
+++ b/test/lisp/kmacro-tests.el
@@ -1,6 +1,6 @@
 ;;; kmacro-tests.el --- Tests for kmacro.el       -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell <address@hidden>
 
diff --git a/test/lisp/ls-lisp-tests.el b/test/lisp/ls-lisp-tests.el
index 91e8b0b..e97c0fc 100644
--- a/test/lisp/ls-lisp-tests.el
+++ b/test/lisp/ls-lisp-tests.el
@@ -1,6 +1,6 @@
 ;;; ls-lisp-tests.el --- tests for ls-lisp.el  -*- lexical-binding: t-*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <address@hidden>
 ;; Keywords:
diff --git a/test/lisp/mail/rmail-tests.el b/test/lisp/mail/rmail-tests.el
index e494003..3a0fdbc 100644
--- a/test/lisp/mail/rmail-tests.el
+++ b/test/lisp/mail/rmail-tests.el
@@ -1,6 +1,6 @@
 ;;; rmail-tests.el --- Test suite. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -23,7 +23,7 @@
 
 
 (ert-deftest rmail-autoload ()
-  "Tests to see whether reftex-auc has been autoloaded"
+  "Test that `rmail-edit-current-message' has been autoloaded."
   (should
    (fboundp 'rmail-edit-current-message))
   (should
diff --git a/test/lisp/man-tests.el b/test/lisp/man-tests.el
index dfabf20..dca0ff1 100644
--- a/test/lisp/man-tests.el
+++ b/test/lisp/man-tests.el
@@ -1,6 +1,6 @@
 ;;; man-tests.el --- Test suite for man.
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Wolfgang Jenkner <address@hidden>
 ;; Keywords: help, internal, unix
diff --git a/test/lisp/md4-tests.el b/test/lisp/md4-tests.el
index b011e8b..9712411 100644
--- a/test/lisp/md4-tests.el
+++ b/test/lisp/md4-tests.el
@@ -1,6 +1,6 @@
 ;;; md4-tests.el --- tests for md4.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Mark Oteiza <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/test/lisp/minibuffer-tests.el b/test/lisp/minibuffer-tests.el
index bfacd6b..35df7cc 100644
--- a/test/lisp/minibuffer-tests.el
+++ b/test/lisp/minibuffer-tests.el
@@ -1,6 +1,6 @@
 ;;; completion-tests.el --- Tests for completion functions  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords:
@@ -74,5 +74,11 @@
                     'completion-table-with-predicate
                     full-collection no-A nil))))))
 
+(ert-deftest completion-table-subvert-test ()
+  (let* ((origtable '("A-hello" "A-there"))
+         (subvtable (completion-table-subvert origtable "B" "A")))
+    (should (equal (try-completion "B-hel" subvtable)
+                   "B-hello"))))
+
 (provide 'completion-tests)
 ;;; completion-tests.el ends here
diff --git a/test/lisp/mouse-tests.el b/test/lisp/mouse-tests.el
index 909ba64..aa7b145 100644
--- a/test/lisp/mouse-tests.el
+++ b/test/lisp/mouse-tests.el
@@ -1,6 +1,6 @@
 ;;; mouse-tests.el --- unit tests for mouse.el       -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <address@hidden>
 
diff --git a/test/lisp/net/dbus-tests.el b/test/lisp/net/dbus-tests.el
index 1ada255..5245e34 100644
--- a/test/lisp/net/dbus-tests.el
+++ b/test/lisp/net/dbus-tests.el
@@ -1,6 +1,6 @@
 ;;; dbus-tests.el --- Tests of D-Bus integration into Emacs
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 
diff --git a/test/lisp/net/gnutls-tests.el b/test/lisp/net/gnutls-tests.el
index 326e241..ea8dd7e 100644
--- a/test/lisp/net/gnutls-tests.el
+++ b/test/lisp/net/gnutls-tests.el
@@ -1,6 +1,6 @@
 ;;; gnutls-tests.el --- Test suite for gnutls.el
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Ted Zlatanov <address@hidden>
 
diff --git a/test/lisp/net/mailcap-tests.el b/test/lisp/net/mailcap-tests.el
index b108065..e1ec7e1 100644
--- a/test/lisp/net/mailcap-tests.el
+++ b/test/lisp/net/mailcap-tests.el
@@ -1,6 +1,6 @@
 ;;; mailcap-tests.el --- tests for mailcap.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Mark Oteiza <address@hidden>
 
diff --git a/test/lisp/net/network-stream-tests.el 
b/test/lisp/net/network-stream-tests.el
index ddb8f9e..b85746a 100644
--- a/test/lisp/net/network-stream-tests.el
+++ b/test/lisp/net/network-stream-tests.el
@@ -1,6 +1,6 @@
 ;;; network-stream-tests.el --- tests for network processes       -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Ingebrigtsen <address@hidden>
 
@@ -25,6 +25,10 @@
 ;;; Code:
 
 (require 'gnutls)
+(require 'network-stream)
+;; The require above is needed for 'open-network-stream' to work, but
+;; it pulls in nsm, which then makes the :nowait t' tests fail unless
+;; we disable the nsm, which we do by binding 'network-security-level'
 
 (ert-deftest make-local-unix-server ()
   (skip-unless (featurep 'make-network-process '(:family local)))
@@ -67,12 +71,45 @@
                  (= (aref (process-contact server :local) 4) 57869)))
     (delete-process server)))
 
-(defun make-server (host)
+(ert-deftest make-ipv6-tcp-server-with-unspecified-port ()
+  (skip-unless (featurep 'make-network-process '(:family ipv6)))
+  (let ((server
+         (ignore-errors
+           (make-network-process
+            :name "server"
+            :server t
+            :noquery t
+            :family 'ipv6
+            :service t
+            :host 'local))))
+    (skip-unless server)
+    (should (and (arrayp (process-contact server :local))
+                 (numberp (aref (process-contact server :local) 8))
+                 (> (aref (process-contact server :local) 8) 0)))
+    (delete-process server)))
+
+(ert-deftest make-ipv6-tcp-server-with-specified-port ()
+  (skip-unless (featurep 'make-network-process '(:family ipv6)))
+  (let ((server
+         (ignore-errors
+           (make-network-process
+            :name "server"
+            :server t
+            :noquery t
+            :family 'ipv6
+            :service 57870
+            :host 'local))))
+    (skip-unless server)
+    (should (and (arrayp (process-contact server :local))
+                 (= (aref (process-contact server :local) 8) 57870)))
+    (delete-process server)))
+
+(defun make-server (host &optional family)
   (make-network-process
    :name "server"
    :server t
    :noquery t
-   :family 'ipv4
+   :family (or family 'ipv4)
    :coding 'raw-text-unix
    :buffer (get-buffer-create "*server*")
    :service t
@@ -125,6 +162,36 @@
       (should (equal (buffer-string) "foo\n")))
     (delete-process server)))
 
+(ert-deftest echo-server-with-local-ipv4 ()
+  (let* ((server (make-server 'local 'ipv4))
+         (port (aref (process-contact server :local) 4))
+         (proc (make-network-process :name "foo"
+                                     :buffer (generate-new-buffer "*foo*")
+                                     :host 'local
+                                     :family 'ipv4
+                                     :service port)))
+    (with-current-buffer (process-buffer proc)
+      (process-send-string proc "echo foo")
+      (sleep-for 0.1)
+      (should (equal (buffer-string) "foo\n")))
+    (delete-process server)))
+
+(ert-deftest echo-server-with-local-ipv6 ()
+  (skip-unless (featurep 'make-network-process '(:family ipv6)))
+  (let ((server (ignore-errors (make-server 'local 'ipv6))))
+    (skip-unless server)
+    (let* ((port (aref (process-contact server :local) 8))
+           (proc (make-network-process :name "foo"
+                                       :buffer (generate-new-buffer "*foo*")
+                                       :host 'local
+                                       :family 'ipv6
+                                       :service port)))
+      (with-current-buffer (process-buffer proc)
+        (process-send-string proc "echo foo")
+        (sleep-for 0.1)
+        (should (equal (buffer-string) "foo\n")))
+      (delete-process server))))
+
 (ert-deftest echo-server-with-ip ()
   (let* ((server (make-server 'local))
          (port (aref (process-contact server :local) 4))
@@ -214,6 +281,7 @@
   (skip-unless (gnutls-available-p))
   (let ((server (make-tls-server 44331))
         (times 0)
+        (network-security-level 'low)
         proc status)
     (unwind-protect
         (progn
@@ -257,6 +325,7 @@
   (skip-unless (featurep 'make-network-process '(:family ipv6)))
   (let ((server (make-tls-server 44333))
         (times 0)
+        (network-security-level 'low)
         proc status)
     (unwind-protect
         (progn
@@ -294,4 +363,365 @@
       (setq issuer (split-string issuer ","))
       (should (equal (nth 3 issuer) "O=Emacs Test Servicess LLC")))))
 
+(ert-deftest open-network-stream-tls-wait ()
+  (skip-unless (executable-find "gnutls-serv"))
+  (skip-unless (gnutls-available-p))
+  (let ((server (make-tls-server 44334))
+        (times 0)
+        (network-security-level 'low)
+        proc status)
+    (unwind-protect
+        (progn
+          (sleep-for 1)
+          (with-current-buffer (process-buffer server)
+            (message "gnutls-serv: %s" (buffer-string)))
+
+          ;; It takes a while for gnutls-serv to start.
+          (while (and (null (ignore-errors
+                              (setq proc (open-network-stream
+                                          "bar"
+                                          (generate-new-buffer "*foo*")
+                                          "localhost"
+                                          44334
+                                          :type 'tls
+                                          :nowait nil))))
+                      (< (setq times (1+ times)) 10))
+            (sit-for 0.1))
+          (should proc)
+          (skip-unless (not (eq (process-status proc) 'connect))))
+      (if (process-live-p server) (delete-process server)))
+    (setq status (gnutls-peer-status proc))
+    (should (consp status))
+    (delete-process proc)
+    ;; This sleep-for is needed for the native MS-Windows build.  If
+    ;; it is removed, the next test mysteriously fails because the
+    ;; initial part of the echo is not received.
+    (sleep-for 0.1)
+    (let ((issuer (plist-get (plist-get status :certificate) :issuer)))
+      (should (stringp issuer))
+      (setq issuer (split-string issuer ","))
+      (should (equal (nth 3 issuer) "O=Emacs Test Servicess LLC")))))
+
+(ert-deftest open-network-stream-tls-nowait ()
+  (skip-unless (executable-find "gnutls-serv"))
+  (skip-unless (gnutls-available-p))
+  (let ((server (make-tls-server 44335))
+        (times 0)
+        (network-security-level 'low)
+        proc status)
+    (unwind-protect
+        (progn
+          (sleep-for 1)
+          (with-current-buffer (process-buffer server)
+            (message "gnutls-serv: %s" (buffer-string)))
+
+          ;; It takes a while for gnutls-serv to start.
+          (while (and (null (ignore-errors
+                              (setq proc (open-network-stream
+                                          "bar"
+                                          (generate-new-buffer "*foo*")
+                                          "localhost"
+                                          44335
+                                          :type 'tls
+                                          :nowait t))))
+                      (< (setq times (1+ times)) 10))
+            (sit-for 0.1))
+          (should proc)
+          (setq times 0)
+          (while (and (eq (process-status proc) 'connect)
+                      (< (setq times (1+ times)) 10))
+            (sit-for 0.1))
+          (skip-unless (not (eq (process-status proc) 'connect))))
+      (if (process-live-p server) (delete-process server)))
+    (setq status (gnutls-peer-status proc))
+    (should (consp status))
+    (delete-process proc)
+    ;; This sleep-for is needed for the native MS-Windows build.  If
+    ;; it is removed, the next test mysteriously fails because the
+    ;; initial part of the echo is not received.
+    (sleep-for 0.1)
+    (let ((issuer (plist-get (plist-get status :certificate) :issuer)))
+      (should (stringp issuer))
+      (setq issuer (split-string issuer ","))
+      (should (equal (nth 3 issuer) "O=Emacs Test Servicess LLC")))))
+
+(ert-deftest open-network-stream-tls ()
+  (skip-unless (executable-find "gnutls-serv"))
+  (skip-unless (gnutls-available-p))
+  (let ((server (make-tls-server 44336))
+        (times 0)
+        (network-security-level 'low)
+        proc status)
+    (unwind-protect
+        (progn
+          (sleep-for 1)
+          (with-current-buffer (process-buffer server)
+            (message "gnutls-serv: %s" (buffer-string)))
+
+          ;; It takes a while for gnutls-serv to start.
+          (while (and (null (ignore-errors
+                              (setq proc (open-network-stream
+                                          "bar"
+                                          (generate-new-buffer "*foo*")
+                                          "localhost"
+                                          44336
+                                          :type 'tls))))
+                      (< (setq times (1+ times)) 10))
+            (sit-for 0.1))
+          (should proc)
+          (skip-unless (not (eq (process-status proc) 'connect))))
+      (if (process-live-p server) (delete-process server)))
+    (setq status (gnutls-peer-status proc))
+    (should (consp status))
+    (delete-process proc)
+    ;; This sleep-for is needed for the native MS-Windows build.  If
+    ;; it is removed, the next test mysteriously fails because the
+    ;; initial part of the echo is not received.
+    (sleep-for 0.1)
+    (let ((issuer (plist-get (plist-get status :certificate) :issuer)))
+      (should (stringp issuer))
+      (setq issuer (split-string issuer ","))
+      (should (equal (nth 3 issuer) "O=Emacs Test Servicess LLC")))))
+
+(ert-deftest open-network-stream-tls-nocert ()
+  (skip-unless (executable-find "gnutls-serv"))
+  (skip-unless (gnutls-available-p))
+  (let ((server (make-tls-server 44337))
+        (times 0)
+        (network-security-level 'low)
+        proc status)
+    (unwind-protect
+        (progn
+          (sleep-for 1)
+          (with-current-buffer (process-buffer server)
+            (message "gnutls-serv: %s" (buffer-string)))
+
+          ;; It takes a while for gnutls-serv to start.
+          (while (and (null (ignore-errors
+                              (setq proc (open-network-stream
+                                          "bar"
+                                          (generate-new-buffer "*foo*")
+                                          "localhost"
+                                          44337
+                                          :type 'tls
+                                          :client-certificate nil))))
+                      (< (setq times (1+ times)) 10))
+            (sit-for 0.1))
+          (should proc)
+          (skip-unless (not (eq (process-status proc) 'connect))))
+      (if (process-live-p server) (delete-process server)))
+    (setq status (gnutls-peer-status proc))
+    (should (consp status))
+    (delete-process proc)
+    ;; This sleep-for is needed for the native MS-Windows build.  If
+    ;; it is removed, the next test mysteriously fails because the
+    ;; initial part of the echo is not received.
+    (sleep-for 0.1)
+    (let ((issuer (plist-get (plist-get status :certificate) :issuer)))
+      (should (stringp issuer))
+      (setq issuer (split-string issuer ","))
+      (should (equal (nth 3 issuer) "O=Emacs Test Servicess LLC")))))
+
+(ert-deftest open-gnutls-stream-new-api-default ()
+  (skip-unless (executable-find "gnutls-serv"))
+  (skip-unless (gnutls-available-p))
+  (let ((server (make-tls-server 44665))
+        (times 0)
+        proc status)
+    (unwind-protect
+        (progn
+          (sleep-for 1)
+          (with-current-buffer (process-buffer server)
+            (message "gnutls-serv: %s" (buffer-string)))
+
+          ;; It takes a while for gnutls-serv to start.
+          (while (and (null (ignore-errors
+                              (setq proc (open-gnutls-stream
+                                          "bar"
+                                          (generate-new-buffer "*foo*")
+                                          "localhost"
+                                          44665))))
+                      (< (setq times (1+ times)) 10))
+            (sit-for 0.1))
+          (should proc)
+      (if (process-live-p server) (delete-process server)))
+    (setq status (gnutls-peer-status proc))
+    (should (consp status))
+    (delete-process proc)
+    ;; This sleep-for is needed for the native MS-Windows build.  If
+    ;; it is removed, the next test mysteriously fails because the
+    ;; initial part of the echo is not received.
+    (sleep-for 0.1)
+    (let ((issuer (plist-get (plist-get status :certificate) :issuer)))
+      (should (stringp issuer))
+      (setq issuer (split-string issuer ","))
+      (should (equal (nth 3 issuer) "O=Emacs Test Servicess LLC"))))))
+
+(ert-deftest open-gnutls-stream-new-api-wait ()
+  (skip-unless (executable-find "gnutls-serv"))
+  (skip-unless (gnutls-available-p))
+  (let ((server (make-tls-server 44666))
+        (times 0)
+        proc status)
+    (unwind-protect
+        (progn
+          (sleep-for 1)
+          (with-current-buffer (process-buffer server)
+            (message "gnutls-serv: %s" (buffer-string)))
+
+          ;; It takes a while for gnutls-serv to start.
+          (while (and (null (ignore-errors
+                              (setq proc (open-gnutls-stream
+                                          "bar"
+                                          (generate-new-buffer "*foo*")
+                                          "localhost"
+                                          44666
+                                          (list :nowait nil)))))
+                      (< (setq times (1+ times)) 10))
+            (sit-for 0.1))
+          (should proc)
+      (if (process-live-p server) (delete-process server)))
+    (setq status (gnutls-peer-status proc))
+    (should (consp status))
+    (delete-process proc)
+    ;; This sleep-for is needed for the native MS-Windows build.  If
+    ;; it is removed, the next test mysteriously fails because the
+    ;; initial part of the echo is not received.
+    (sleep-for 0.1)
+    (let ((issuer (plist-get (plist-get status :certificate) :issuer)))
+      (should (stringp issuer))
+      (setq issuer (split-string issuer ","))
+      (should (equal (nth 3 issuer) "O=Emacs Test Servicess LLC"))))))
+
+(ert-deftest open-gnutls-stream-old-api-wait ()
+  (skip-unless (executable-find "gnutls-serv"))
+  (skip-unless (gnutls-available-p))
+  (let ((server (make-tls-server 44667))
+        (times 0)
+        nowait
+        proc status)
+    (unwind-protect
+        (progn
+          (sleep-for 1)
+          (with-current-buffer (process-buffer server)
+            (message "gnutls-serv: %s" (buffer-string)))
+
+          ;; It takes a while for gnutls-serv to start.
+          (while (and (null (ignore-errors
+                              (setq proc (open-gnutls-stream
+                                          "bar"
+                                          (generate-new-buffer "*foo*")
+                                          "localhost"
+                                          44667
+                                          nowait))))
+                      (< (setq times (1+ times)) 10))
+            (sit-for 0.1))
+          (should proc)
+      (if (process-live-p server) (delete-process server)))
+    (setq status (gnutls-peer-status proc))
+    (should (consp status))
+    (delete-process proc)
+    ;; This sleep-for is needed for the native MS-Windows build.  If
+    ;; it is removed, the next test mysteriously fails because the
+    ;; initial part of the echo is not received.
+    (sleep-for 0.1)
+    (let ((issuer (plist-get (plist-get status :certificate) :issuer)))
+      (should (stringp issuer))
+      (setq issuer (split-string issuer ","))
+      (should (equal (nth 3 issuer) "O=Emacs Test Servicess LLC"))))))
+
+(ert-deftest open-gnutls-stream-new-api-nowait ()
+  (skip-unless (executable-find "gnutls-serv"))
+  (skip-unless (gnutls-available-p))
+  (let ((server (make-tls-server 44668))
+        (times 0)
+        (network-security-level 'low)
+        proc status)
+    (unwind-protect
+        (progn
+          (sleep-for 1)
+          (with-current-buffer (process-buffer server)
+            (message "gnutls-serv: %s" (buffer-string)))
+
+          ;; It takes a while for gnutls-serv to start.
+          (while (and (null (ignore-errors
+                              (setq proc (open-gnutls-stream
+                                          "bar"
+                                          (generate-new-buffer "*foo*")
+                                          "localhost"
+                                          44668
+                                          (list :nowait t)))))
+                      (< (setq times (1+ times)) 10))
+            (sit-for 0.1))
+          (should proc)
+          (setq times 0)
+          (while (and (eq (process-status proc) 'connect)
+                      (< (setq times (1+ times)) 10))
+            (sit-for 0.1))
+          (skip-unless (not (eq (process-status proc) 'connect))))
+      (if (process-live-p server) (delete-process server)))
+    (setq status (gnutls-peer-status proc))
+    (should (consp status))
+    (delete-process proc)
+    (let ((issuer (plist-get (plist-get status :certificate) :issuer)))
+      (should (stringp issuer))
+      (setq issuer (split-string issuer ","))
+      (should (equal (nth 3 issuer) "O=Emacs Test Servicess LLC")))))
+
+(ert-deftest open-gnutls-stream-old-api-nowait ()
+  (skip-unless (executable-find "gnutls-serv"))
+  (skip-unless (gnutls-available-p))
+  (let ((server (make-tls-server 44669))
+        (times 0)
+        (network-security-level 'low)
+        (nowait t)
+        proc status)
+    (unwind-protect
+        (progn
+          (sleep-for 1)
+          (with-current-buffer (process-buffer server)
+            (message "gnutls-serv: %s" (buffer-string)))
+
+          ;; It takes a while for gnutls-serv to start.
+          (while (and (null (ignore-errors
+                              (setq proc (open-gnutls-stream
+                                          "bar"
+                                          (generate-new-buffer "*foo*")
+                                          "localhost"
+                                          44669
+                                          nowait))))
+                      (< (setq times (1+ times)) 10))
+            (sit-for 0.1))
+          (should proc)
+          (setq times 0)
+          (while (and (eq (process-status proc) 'connect)
+                      (< (setq times (1+ times)) 10))
+            (sit-for 0.1))
+          (skip-unless (not (eq (process-status proc) 'connect))))
+      (if (process-live-p server) (delete-process server)))
+    (setq status (gnutls-peer-status proc))
+    (should (consp status))
+    (delete-process proc)
+    (let ((issuer (plist-get (plist-get status :certificate) :issuer)))
+      (should (stringp issuer))
+      (setq issuer (split-string issuer ","))
+      (should (equal (nth 3 issuer) "O=Emacs Test Servicess LLC")))))
+
+(ert-deftest open-gnutls-stream-new-api-errors ()
+  (skip-unless (gnutls-available-p))
+  (should-error
+   (open-gnutls-stream
+    "bar"
+    (generate-new-buffer "*foo*")
+    "localhost"
+    44777
+    (list t)))
+  (should-error
+   (open-gnutls-stream
+    "bar"
+    (generate-new-buffer "*foo*")
+    "localhost"
+    44777
+    (vector :nowait t))))
+
 ;;; network-stream-tests.el ends here
diff --git a/test/lisp/net/newsticker-tests.el 
b/test/lisp/net/newsticker-tests.el
index ad66d30..47f8bd6 100644
--- a/test/lisp/net/newsticker-tests.el
+++ b/test/lisp/net/newsticker-tests.el
@@ -1,6 +1,6 @@
 ;;; newsticker-testsuite.el --- Test suite for newsticker.
 
-;; Copyright (C) 2003-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2003-2019 Free Software Foundation, Inc.
 
 ;; Author:      Ulf Jasper <address@hidden>
 ;; Keywords:    News, RSS, Atom
diff --git a/test/lisp/net/puny-tests.el b/test/lisp/net/puny-tests.el
index 41eacff..d85e20f 100644
--- a/test/lisp/net/puny-tests.el
+++ b/test/lisp/net/puny-tests.el
@@ -1,6 +1,6 @@
 ;;; puny-tests.el --- tests for net/puny.el  -*- coding: utf-8; -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/net/sasl-scram-rfc-tests.el 
b/test/lisp/net/sasl-scram-rfc-tests.el
index 497f0d6..af043e9 100644
--- a/test/lisp/net/sasl-scram-rfc-tests.el
+++ b/test/lisp/net/sasl-scram-rfc-tests.el
@@ -1,6 +1,6 @@
 ;;; sasl-scram-rfc-tests.el --- tests for SCRAM-SHA-1       -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Magnus Henoch <address@hidden>
 
diff --git a/test/lisp/net/secrets-tests.el b/test/lisp/net/secrets-tests.el
index de3ce73..c565eba 100644
--- a/test/lisp/net/secrets-tests.el
+++ b/test/lisp/net/secrets-tests.el
@@ -1,6 +1,6 @@
 ;;; secrets-tests.el --- Tests of Secret Service API
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 
@@ -90,10 +90,6 @@
   (unwind-protect
       (progn
        (should (secrets-open-session))
-
-       ;; There must be at least the collections "Login" and "session".
-       (should (or (member "Login" (secrets-list-collections))
-                    (member "login" (secrets-list-collections))))
        (should (member "session" (secrets-list-collections)))
 
        ;; Create a random collection.  This asks for a password
@@ -160,9 +156,6 @@
 
        ;; There shall be no items in the "session" collection.
        (should-not (secrets-list-items "session"))
-       ;; There shall be items in the "Login" collection.
-       (should (or (secrets-list-items "Login")
-                    (secrets-list-items "login")))
 
        ;; Create a new item.
        (should (setq item-path (secrets-create-item "session" "foo" "secret")))
diff --git a/test/lisp/net/shr-tests.el b/test/lisp/net/shr-tests.el
index 398d519..dd820e2 100644
--- a/test/lisp/net/shr-tests.el
+++ b/test/lisp/net/shr-tests.el
@@ -1,6 +1,6 @@
 ;;; network-stream-tests.el --- tests for network processes       -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Ingebrigtsen <address@hidden>
 
diff --git a/test/lisp/net/tramp-archive-tests.el 
b/test/lisp/net/tramp-archive-tests.el
index e759786..454279e 100644
--- a/test/lisp/net/tramp-archive-tests.el
+++ b/test/lisp/net/tramp-archive-tests.el
@@ -1,6 +1,6 @@
 ;;; tramp-archive-tests.el --- Tests of file archive access  -*- 
lexical-binding:t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 
@@ -24,6 +24,8 @@
 
 (require 'ert)
 (require 'tramp-archive)
+(defvar tramp-copy-size-limit)
+(defvar tramp-persistency-file-name)
 
 (defconst tramp-archive-test-resource-directory
   (let ((default-directory
@@ -76,7 +78,7 @@ the origin of the temporary TMPFILE, have no write 
permissions."
   (if (file-regular-p tmpfile)
       (delete-file tmpfile)
     (mapc
-     'tramp-archive--test-delete
+     #'tramp-archive--test-delete
      (directory-files tmpfile 'full directory-files-no-dot-files-regexp))
     (delete-directory tmpfile)))
 
@@ -513,7 +515,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
   (skip-unless tramp-archive-enabled)
 
   (let ((tmp-name tramp-archive-test-archive)
-       (files '("." ".." "bar"  "baz.tar" "foo.hrd" "foo.lnk" "foo.txt")))
+       (files '("." ".." "bar" "baz.tar" "foo.hrd" "foo.lnk" "foo.txt")))
     (unwind-protect
        (progn
          (should (file-directory-p tmp-name))
@@ -568,26 +570,35 @@ This checks also `file-name-as-directory', 
`file-name-directory',
               (format
                "\\(.+ %s\\( ->.+\\)?\n\\)\\{%d\\}"
                (regexp-opt (directory-files tramp-archive-test-archive))
-               (length (directory-files tramp-archive-test-archive))))))))
+               (length (directory-files tramp-archive-test-archive)))))))
+
+         ;; Check error case.
+         (with-temp-buffer
+           (should-error
+            (insert-directory
+             (expand-file-name "baz" tramp-archive-test-archive) nil)
+            :type tramp-file-missing)))
 
       ;; Cleanup.
       (tramp-archive-cleanup-hash))))
 
 (ert-deftest tramp-archive-test18-file-attributes ()
   "Check `file-attributes'.
-This tests also `file-readable-p' and `file-regular-p'."
+This tests also `access-file', `file-readable-p' and `file-regular-p'."
   :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
 
   (let ((tmp-name1 (expand-file-name "foo.txt" tramp-archive-test-archive))
        (tmp-name2 (expand-file-name "foo.lnk" tramp-archive-test-archive))
        (tmp-name3 (expand-file-name "bar" tramp-archive-test-archive))
+       (tmp-name4 (expand-file-name "baz" tramp-archive-test-archive))
        attr)
     (unwind-protect
        (progn
          (should (file-exists-p tmp-name1))
          (should (file-readable-p tmp-name1))
          (should (file-regular-p tmp-name1))
+         (should-not (access-file tmp-name1 "error"))
 
          ;; We do not test inodes and device numbers.
          (setq attr (file-attributes tmp-name1))
@@ -620,7 +631,13 @@ This tests also `file-readable-p' and `file-regular-p'."
          (should (file-readable-p tmp-name3))
          (should-not (file-regular-p tmp-name3))
          (setq attr (file-attributes tmp-name3))
-         (should (eq (car attr) t)))
+         (should (eq (car attr) t))
+         (should-not (access-file tmp-name3 "error"))
+
+         ;; Check error case.
+         (should-error
+          (access-file tmp-name4  "error")
+          :type tramp-file-missing))
 
       ;; Cleanup.
       (tramp-archive-cleanup-hash))))
@@ -645,7 +662,7 @@ This tests also `file-readable-p' and `file-regular-p'."
          (dolist (elt attr)
            (should (equal (file-attributes (car elt)) (cdr elt))))
          (setq attr (directory-files-and-attributes tmp-name nil "^b"))
-         (should (equal (mapcar 'car attr) '("bar"))))
+         (should (equal (mapcar #'car attr) '("bar"))))
 
       ;; Cleanup.
       (tramp-archive-cleanup-hash))))
@@ -735,14 +752,14 @@ This tests also `file-executable-p', `file-writable-p' 
and `set-file-modes'."
          (should-not (file-name-completion "a" tmp-name))
          (should
           (equal
-           (file-name-completion "b" tmp-name 'file-directory-p) "bar/"))
+           (file-name-completion "b" tmp-name #'file-directory-p) "bar/"))
          (should
           (equal
-           (sort (file-name-all-completions "fo" tmp-name) 'string-lessp)
+           (sort (file-name-all-completions "fo" tmp-name) #'string-lessp)
            '("foo.hrd" "foo.lnk" "foo.txt")))
          (should
           (equal
-           (sort (file-name-all-completions "b" tmp-name) 'string-lessp)
+           (sort (file-name-all-completions "b" tmp-name) #'string-lessp)
            '("bar/" "baz.tar")))
          (should-not (file-name-all-completions "a" tmp-name))
          ;; `completion-regexp-list' restricts the completion to
@@ -753,14 +770,14 @@ This tests also `file-executable-p', `file-writable-p' 
and `set-file-modes'."
             (equal (file-name-completion "" tmp-name) "ba"))
            (should
             (equal
-             (sort (file-name-all-completions "" tmp-name) 'string-lessp)
+             (sort (file-name-all-completions "" tmp-name) #'string-lessp)
              '("bar/" "baz.tar")))))
 
       ;; Cleanup.
       (tramp-archive-cleanup-hash))))
 
 ;; The functions were introduced in Emacs 26.1.
-(ert-deftest tramp-archive-test38-make-nearby-temp-file ()
+(ert-deftest tramp-archive-test39-make-nearby-temp-file ()
   "Check `make-nearby-temp-file' and `temporary-file-directory'."
   (skip-unless tramp-archive-enabled)
   ;; Since Emacs 26.1.
@@ -797,7 +814,7 @@ This tests also `file-executable-p', `file-writable-p' and 
`set-file-modes'."
     (delete-directory tmp-file)
     (should-not (file-exists-p tmp-file))))
 
-(ert-deftest tramp-archive-test41-file-system-info ()
+(ert-deftest tramp-archive-test42-file-system-info ()
   "Check that `file-system-info' returns proper values."
   (skip-unless tramp-archive-enabled)
   ;; Since Emacs 27.1.
@@ -814,7 +831,7 @@ This tests also `file-executable-p', `file-writable-p' and 
`set-file-modes'."
                 (zerop (nth 1 fsi))
                 (zerop (nth 2 fsi))))))
 
-(ert-deftest tramp-archive-test44-auto-load ()
+(ert-deftest tramp-archive-test45-auto-load ()
   "Check that `tramp-archive' autoloads properly."
   :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
@@ -842,10 +859,10 @@ This tests also `file-executable-p', `file-writable-p' 
and `set-file-modes'."
          "%s -batch -Q -L %s --eval %s"
          (shell-quote-argument
           (expand-file-name invocation-name invocation-directory))
-         (mapconcat 'shell-quote-argument load-path " -L ")
+         (mapconcat #'shell-quote-argument load-path " -L ")
          (shell-quote-argument (format code file)))))))))
 
-(ert-deftest tramp-archive-test44-delay-load ()
+(ert-deftest tramp-archive-test45-delay-load ()
   "Check that `tramp-archive' is loaded lazily, only when needed."
   :tags '(:expensive-test)
   (skip-unless tramp-archive-enabled)
@@ -879,7 +896,7 @@ This tests also `file-executable-p', `file-writable-p' and 
`set-file-modes'."
          "%s -batch -Q -L %s --eval %s"
          (shell-quote-argument
           (expand-file-name invocation-name invocation-directory))
-         (mapconcat 'shell-quote-argument load-path " -L ")
+         (mapconcat #'shell-quote-argument load-path " -L ")
          (shell-quote-argument
            (format
             code tae tramp-archive-test-file-archive
@@ -941,7 +958,7 @@ This tests also `file-executable-p', `file-writable-p' and 
`set-file-modes'."
   "Run all tests for \\[tramp-archive]."
   (interactive "p")
   (funcall
-   (if interactive 'ert-run-tests-interactively 'ert-run-tests-batch)
+   (if interactive #'ert-run-tests-interactively #'ert-run-tests-batch)
    "^tramp-archive"))
 
 (provide 'tramp-archive-tests)
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index ceda709..1c7198c 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -1,6 +1,6 @@
 ;;; tramp-tests.el --- Tests of remote file access  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 
@@ -33,7 +33,7 @@
 ;; remote host, set this environment variable to "/dev/null" or
 ;; whatever is appropriate on your system.
 
-;; For slow remote connections, `tramp-test42-asynchronous-requests'
+;; For slow remote connections, `tramp-test43-asynchronous-requests'
 ;; might be too heavy.  Setting $REMOTE_PARALLEL_PROCESSES to a proper
 ;; value less than 10 could help.
 
@@ -57,14 +57,18 @@
 (declare-function tramp-method-out-of-band-p "tramp-sh")
 (declare-function tramp-smb-get-localname "tramp-smb")
 (defvar auto-save-file-name-transforms)
+(defvar tramp-connection-properties)
 (defvar tramp-copy-size-limit)
+(defvar tramp-display-escape-sequence-regexp)
+(defvar tramp-inline-compress-start-size)
 (defvar tramp-persistency-file-name)
+(defvar tramp-remote-path)
 (defvar tramp-remote-process-environment)
 
 ;; Beautify batch mode.
 (when noninteractive
   ;; Suppress nasty messages.
-  (fset 'shell-command-sentinel 'ignore)
+  (fset #'shell-command-sentinel #'ignore)
   ;; We do not want to be interrupted.
   (eval-after-load 'tramp-gvfs
     '(fset 'tramp-gvfs-handler-askquestion
@@ -145,7 +149,7 @@ If LOCAL is non-nil, a local file name is returned.
 If QUOTED is non-nil, the local part of the file name is quoted.
 The temporary file is not created."
   (funcall
-   (if quoted 'tramp-compat-file-name-quote 'identity)
+   (if quoted #'tramp-compat-file-name-quote #'identity)
    (expand-file-name
     (make-temp-name "tramp-test")
     (if local temporary-file-directory tramp-test-temporary-file-directory))))
@@ -157,9 +161,9 @@ This shall used dynamically bound only.")
 
 (defmacro tramp--test-instrument-test-case (verbose &rest body)
   "Run BODY with `tramp-verbose' equal VERBOSE.
-Print the content of the Tramp debug buffer, if BODY does not
-eval properly in `should' or `should-not'.  `should-error' is not
-handled properly.  BODY shall not contain a timeout."
+Print the content of the Tramp connection and debug buffers, if
+`tramp-verbose' is greater than 3.  `should-error' is not handled
+properly.  BODY shall not contain a timeout."
   (declare (indent 1) (debug (natnump body)))
   `(let ((tramp-verbose (max (or ,verbose 0) (or tramp-verbose 0)))
         (tramp-message-show-message t)
@@ -181,7 +185,7 @@ handled properly.  BODY shall not contain a timeout."
   "Emit a message into ERT *Messages*."
   (tramp--test-instrument-test-case 0
     (apply
-     'tramp-message
+     #'tramp-message
      (tramp-dissect-file-name tramp-test-temporary-file-directory) 0
      fmt-string arguments)))
 
@@ -233,6 +237,10 @@ handled properly.  BODY shall not contain a timeout."
   (should (tramp-tramp-file-p "/method:[::1]:"))
   (should (tramp-tramp-file-p "/method:address@hidden::1]:"))
 
+  ;; Using an IPv4 mapped IPv6 address.
+  (should (tramp-tramp-file-p "/method:[::ffff:1.2.3.4]:"))
+  (should (tramp-tramp-file-p "/method:address@hidden::ffff:1.2.3.4]:"))
+
   ;; Local file name part.
   (should (tramp-tramp-file-p "/method:::"))
   (should (tramp-tramp-file-p "/method::/:"))
@@ -260,6 +268,7 @@ handled properly.  BODY shall not contain a timeout."
   (should-not (tramp-tramp-file-p "/1.2.3.4:"))
   (should-not (tramp-tramp-file-p "/[]:"))
   (should-not (tramp-tramp-file-p "/[::1]:"))
+  (should-not (tramp-tramp-file-p "/[::ffff:1.2.3.4]:"))
   (should-not (tramp-tramp-file-p "/host:/:"))
   (should-not (tramp-tramp-file-p "/host1|host2:"))
   (should-not (tramp-tramp-file-p "/address@hidden|address@hidden:"))
@@ -308,6 +317,10 @@ handled properly.  BODY shall not contain a timeout."
          (should (tramp-tramp-file-p "/[::1]:"))
          (should (tramp-tramp-file-p "/address@hidden::1]:"))
 
+         ;; Using an IPv4 mapped IPv6 address.
+         (should (tramp-tramp-file-p "/[::ffff:1.2.3.4]:"))
+         (should (tramp-tramp-file-p "/address@hidden::ffff:1.2.3.4]:"))
+
          ;; Local file name part.
          (should (tramp-tramp-file-p "/host::"))
          (should (tramp-tramp-file-p "/host:/:"))
@@ -358,6 +371,10 @@ handled properly.  BODY shall not contain a timeout."
          (should (tramp-tramp-file-p "/[method/::1]"))
          (should (tramp-tramp-file-p "/[method/user@::1]"))
 
+         ;; Using an IPv4 mapped IPv6 address.
+         (should (tramp-tramp-file-p "/[method/::ffff:1.2.3.4]"))
+         (should (tramp-tramp-file-p "/[method/user@::ffff:1.2.3.4]"))
+
          ;; Local file name part.
          (should (tramp-tramp-file-p "/[method/]"))
          (should (tramp-tramp-file-p "/[method/]/:"))
@@ -399,7 +416,10 @@ handled properly.  BODY shall not contain a timeout."
        (tramp-default-host "default-host")
        tramp-default-method-alist
        tramp-default-user-alist
-       tramp-default-host-alist)
+       tramp-default-host-alist
+       ;; Suppress check for multihops.
+       (tramp-cache-data (make-hash-table :test #'equal))
+       (tramp-connection-properties '((nil "login-program" t))))
     ;; Expand `tramp-default-user' and `tramp-default-host'.
     (should (string-equal
             (file-remote-p "/method::")
@@ -819,12 +839,14 @@ handled properly.  BODY shall not contain a timeout."
       (file-remote-p
        (concat
        "/method1:address@hidden"
-       "|method2:address@hidden"
-       "|method3:address@hidden:/path/to/file"))
-      (format "/%s:address@hidden|%s:address@hidden|%s:address@hidden:"
-             "method1" "user3" "host3"
-             "method2" "user3" "host3"
-             "method3" "user3" "host3")))))
+       "|method2:address@hidden"
+       "|method3:address@hidden"
+       "|method4:address@hidden:/path/to/file"))
+      (format 
"/%s:address@hidden|%s:address@hidden|%s:address@hidden|%s:address@hidden:"
+             "method1" "user2" "host2"
+             "method2" "user2" "host2"
+             "method3" "user4" "host4"
+             "method4" "user4%domain4" "host4#1234")))))
 
 (ert-deftest tramp-test02-file-name-dissect-simplified ()
   "Check simplified file name components."
@@ -834,6 +856,9 @@ handled properly.  BODY shall not contain a timeout."
        (tramp-default-host "default-host")
        tramp-default-user-alist
        tramp-default-host-alist
+       ;; Suppress check for multihops.
+       (tramp-cache-data (make-hash-table :test #'equal))
+       (tramp-connection-properties '((nil "login-program" t)))
        (syntax tramp-syntax))
     (unwind-protect
        (progn
@@ -1134,12 +1159,14 @@ handled properly.  BODY shall not contain a timeout."
            (file-remote-p
             (concat
              "/address@hidden"
+             "|address@hidden"
              "|address@hidden"
-             "|address@hidden:/path/to/file"))
-           (format "/address@hidden|address@hidden|address@hidden:"
-                   "user3" "host3"
-                   "user3" "host3"
-                   "user3" "host3"))))
+             "|address@hidden:/path/to/file"))
+           (format 
"/address@hidden|address@hidden|address@hidden|address@hidden:"
+                   "user2" "host2"
+                   "user2" "host2"
+                   "user4" "host4"
+                   "user4%domain4" "host4#1234"))))
 
       ;; Exit.
       (tramp-change-syntax syntax))))
@@ -1153,6 +1180,9 @@ handled properly.  BODY shall not contain a timeout."
        tramp-default-method-alist
        tramp-default-user-alist
        tramp-default-host-alist
+       ;; Suppress check for multihops.
+       (tramp-cache-data (make-hash-table :test #'equal))
+       (tramp-connection-properties '((nil "login-program" t)))
        (syntax tramp-syntax))
     (unwind-protect
        (progn
@@ -1780,12 +1810,14 @@ handled properly.  BODY shall not contain a timeout."
            (file-remote-p
             (concat
              "/[method1/address@hidden"
-             "|method2/address@hidden"
-             "|method3/address@hidden/path/to/file"))
-           (format "/[%s/address@hidden|%s/address@hidden|%s/address@hidden"
-                   "method1" "user3" "host3"
-                   "method2" "user3" "host3"
-                   "method3" "user3" "host3"))))
+             "|method2/address@hidden"
+             "|method3/address@hidden"
+             "|method4/address@hidden/path/to/file"))
+           (format 
"/[%s/address@hidden|%s/address@hidden|%s/address@hidden|%s/address@hidden"
+                   "method1" "user2" "host2"
+                   "method2" "user2" "host2"
+                   "method3" "user4" "host4"
+                   "method4" "user4%domain4" "host4#1234"))))
 
       ;; Exit.
       (tramp-change-syntax syntax))))
@@ -1798,17 +1830,15 @@ handled properly.  BODY shall not contain a timeout."
   (should (string-equal (file-remote-p "/-:ftp.host:" 'method) "ftp"))
   (dolist (u '("ftp" "anonymous"))
     (should (string-equal (file-remote-p (format "/-:%s@:" u) 'method) "ftp")))
-  ;; Default values in tramp-gvfs.el.
-  (when (and (load "tramp-gvfs" 'noerror 'nomessage)
-            (symbol-value 'tramp-gvfs-enabled))
-    (should (string-equal (file-remote-p "/synce::" 'user) nil)))
-  ;; Default values in tramp-sh.el.
+  ;; Default values in tramp-sh.el and tramp-sudoedit.el.
   (dolist (h `("127.0.0.1" "[::1]" "localhost" "localhost6" ,(system-name)))
     (should
      (string-equal (file-remote-p (format "/-:address@hidden:" h) 'method) 
"su")))
-  (dolist (m '("su" "sudo" "ksu"))
-    (should (string-equal (file-remote-p (format "/%s::" m) 'user) "root")))
-  (dolist (m '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp"))
+  (dolist (m '("su" "sudo" "ksu" "doas" "sudoedit"))
+    (should (string-equal (file-remote-p (format "/%s::" m) 'user) "root"))
+    (should
+     (string-equal (file-remote-p (format "/%s::" m) 'host) (system-name))))
+  (dolist (m '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp" "nc"))
     (should
      (string-equal (file-remote-p (format "/%s::" m) 'user) 
(user-login-name))))
   ;; Default values in tramp-smb.el.
@@ -1839,12 +1869,21 @@ handled properly.  BODY shall not contain a timeout."
         "%s|%s:foo:"
         (substring (file-remote-p tramp-test-temporary-file-directory) 0 -1)
         m))
-       :type
-       (if (tramp-method-out-of-band-p vec 0) 'file-error 'user-error)))))
+       :type 'user-error))))
 
 (ert-deftest tramp-test03-file-name-method-rules ()
   "Check file name rules for some methods."
   (skip-unless (tramp--test-enabled))
+  ;; `user-error' has appeared in Emacs 24.3.
+  (skip-unless (fboundp 'user-error))
+
+  ;; Multi hops are allowed for inline methods only.
+  (should-error
+   (file-remote-p "/ssh:address@hidden|method:address@hidden:/path/to/file")
+   :type 'user-error)
+  (should-error
+   (file-remote-p "/method:address@hidden|ssh:address@hidden:/path/to/file")
+   :type 'user-error)
 
   ;; Samba does not support file names with periods followed by
   ;; spaces, and trailing periods or spaces.
@@ -1949,6 +1988,18 @@ handled properly.  BODY shall not contain a timeout."
   (should
    (string-equal
     (expand-file-name "/method:host:/path/../file") "/method:host:/file"))
+  (should
+   (string-equal
+    (expand-file-name "/method:host:/path/.") "/method:host:/path"))
+  (should
+   (string-equal
+    (expand-file-name "/method:host:/path/..") "/method:host:/"))
+  (should
+   (string-equal
+    (expand-file-name "." "/method:host:/path/") "/method:host:/path"))
+  (should
+   (string-equal
+    (expand-file-name "" "/method:host:/path/") "/method:host:/path"))
   ;; Quoting local part.
   (should
    (string-equal
@@ -1962,9 +2013,9 @@ handled properly.  BODY shall not contain a timeout."
     (expand-file-name "/method:host:/:/~/path/./file")
     "/method:host:/:/~/path/file")))
 
-;; The following test is inspired by Bug#26911.  It is rather a bug in
-;; `expand-file-name', and it fails for all Emacs versions.  Test
-;; added for later, when it is fixed.
+;; The following test is inspired by Bug#26911 and Bug#34834.  They
+;; are rather bugs in `expand-file-name', and it fails for all Emacs
+;; versions.  Test added for later, when they are fixed.
 (ert-deftest tramp-test05-expand-file-name-relative ()
   "Check `expand-file-name'."
   ;; Mark as failed until bug has been fixed.
@@ -1972,7 +2023,7 @@ handled properly.  BODY shall not contain a timeout."
   (skip-unless (tramp--test-enabled))
 
   ;; These are the methods the test doesn't fail.
-  (when (or (tramp--test-adb-p) (tramp--test-gvfs-p)
+  (when (or (tramp--test-adb-p) (tramp--test-gvfs-p) (tramp--test-rclone-p)
            (tramp-smb-file-name-p tramp-test-temporary-file-directory))
     (setf (ert-test-expected-result-type
           (ert-get-test 'tramp-test05-expand-file-name-relative))
@@ -2039,7 +2090,8 @@ This checks also `file-name-as-directory', 
`file-name-directory',
       ;; We must clear `tramp-default-method'.  On hydra, it is "ftp",
       ;; which ruins the tests.
       (let ((non-essential n-e)
-           tramp-default-method)
+           (tramp-default-method
+            (file-remote-p tramp-test-temporary-file-directory 'method)))
        (dolist
            (file
             `(,(format
@@ -2703,7 +2755,14 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
                 (format
                  "\\(.+ %s\\( ->.+\\)?\n\\)\\{%d\\}"
                  (regexp-opt (directory-files tmp-name1))
-                 (length (directory-files tmp-name1))))))))
+                 (length (directory-files tmp-name1)))))))
+
+           ;; Check error case.  We do not check for the error type,
+           ;; because ls-lisp returns `file-error', and native Tramp
+           ;; returns `file-missing'.
+           (delete-directory tmp-name1 'recursive)
+           (with-temp-buffer
+             (should-error (insert-directory tmp-name1 nil))))
 
        ;; Cleanup.
        (ignore-errors (delete-directory tmp-name1 'recursive))))))
@@ -2725,7 +2784,7 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
           (tmp-name4 (expand-file-name "bar" tmp-name2))
           (tramp-test-temporary-file-directory
            (funcall
-            (if quoted 'tramp-compat-file-name-quote 'identity)
+            (if quoted #'tramp-compat-file-name-quote #'identity)
             tramp-test-temporary-file-directory))
           buffer)
       (unwind-protect
@@ -2829,8 +2888,8 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
 
 (ert-deftest tramp-test18-file-attributes ()
   "Check `file-attributes'.
-This tests also `file-readable-p', `file-regular-p' and
-`file-ownership-preserved-p'."
+This tests also `access-file', `file-readable-p',
+`file-regular-p' and `file-ownership-preserved-p'."
   (skip-unless (tramp--test-enabled))
 
   (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
@@ -2851,6 +2910,9 @@ This tests also `file-readable-p', `file-regular-p' and
           attr)
       (unwind-protect
          (progn
+           (should-error
+            (access-file tmp-name1 "error")
+            :type tramp-file-missing)
            ;; `file-ownership-preserved-p' should return t for
            ;; non-existing files.  It is implemented only in tramp-sh.el.
            (when (tramp--test-sh-p)
@@ -2859,6 +2921,7 @@ This tests also `file-readable-p', `file-regular-p' and
            (should (file-exists-p tmp-name1))
            (should (file-readable-p tmp-name1))
            (should (file-regular-p tmp-name1))
+           (should-not (access-file tmp-name1 "error"))
            (when (tramp--test-sh-p)
              (should (file-ownership-preserved-p tmp-name1 'group)))
 
@@ -2883,18 +2946,22 @@ This tests also `file-readable-p', `file-regular-p' and
            (should (stringp (nth 3 attr))) ;; Gid.
 
            (tramp--test-ignore-make-symbolic-link-error
+            (should-error
+             (access-file tmp-name2 "error")
+             :type tramp-file-missing)
              (when (tramp--test-sh-p)
                (should (file-ownership-preserved-p tmp-name2 'group)))
              (make-symbolic-link tmp-name1 tmp-name2)
              (should (file-exists-p tmp-name2))
              (should (file-symlink-p tmp-name2))
+             (should-not (access-file tmp-name2 "error"))
              (when (tramp--test-sh-p)
                (should (file-ownership-preserved-p tmp-name2 'group)))
              (setq attr (file-attributes tmp-name2))
              (should
               (string-equal
                (funcall
-                (if quoted 'tramp-compat-file-name-quote 'identity)
+                (if quoted #'tramp-compat-file-name-quote #'identity)
                 (car attr))
                (file-remote-p (file-truename tmp-name1) 'localname)))
              (delete-file tmp-name2))
@@ -2926,6 +2993,7 @@ This tests also `file-readable-p', `file-regular-p' and
            (should (file-exists-p tmp-name1))
            (should (file-readable-p tmp-name1))
            (should-not (file-regular-p tmp-name1))
+           (should-not (access-file tmp-name1 ""))
            (when (tramp--test-sh-p)
              (should (file-ownership-preserved-p tmp-name1 'group)))
            (setq attr (file-attributes tmp-name1))
@@ -2936,6 +3004,13 @@ This tests also `file-readable-p', `file-regular-p' and
        (ignore-errors (delete-file tmp-name1))
        (ignore-errors (delete-file tmp-name2))))))
 
+(defsubst tramp--test-file-attributes-equal-p (attr1 attr2)
+  "Check, whether file attributes ATTR1 and ATTR2 are equal.
+They might differ only in access time."
+  (setcar (nthcdr 4 attr1) tramp-time-dont-know)
+  (setcar (nthcdr 4 attr2) tramp-time-dont-know)
+  (equal attr1 attr2))
+
 (ert-deftest tramp-test19-directory-files-and-attributes ()
   "Check `directory-files-and-attributes'."
   (skip-unless (tramp--test-enabled))
@@ -2967,16 +3042,18 @@ This tests also `file-readable-p', `file-regular-p' and
                    5 (file-attributes (expand-file-name (car elt) tmp-name2)))
                   tramp-time-dont-know)
                (should
-                (equal (file-attributes (expand-file-name (car elt) tmp-name2))
-                       (cdr elt)))))
+                (tramp--test-file-attributes-equal-p
+                 (file-attributes (expand-file-name (car elt) tmp-name2))
+                 (cdr elt)))))
            (setq attr (directory-files-and-attributes tmp-name2 'full))
            (dolist (elt attr)
              (unless (tramp-compat-time-equal-p
                       (nth 5 (file-attributes (car elt))) tramp-time-dont-know)
                (should
-                (equal (file-attributes (car elt)) (cdr elt)))))
+                (tramp--test-file-attributes-equal-p
+                 (file-attributes (car elt)) (cdr elt)))))
            (setq attr (directory-files-and-attributes tmp-name2 nil "^b"))
-           (should (equal (mapcar 'car attr) '("bar" "boz"))))
+           (should (equal (mapcar #'car attr) '("bar" "boz"))))
 
        ;; Cleanup.
        (ignore-errors (delete-directory tmp-name1 'recursive))))))
@@ -2985,7 +3062,7 @@ This tests also `file-readable-p', `file-regular-p' and
   "Check `file-modes'.
 This tests also `file-executable-p', `file-writable-p' and `set-file-modes'."
   (skip-unless (tramp--test-enabled))
-  (skip-unless (tramp--test-sh-p))
+  (skip-unless (or (tramp--test-sh-p) (tramp--test-sudoedit-p)))
 
   (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
     (let ((tmp-name (tramp--test-make-temp-name nil quoted)))
@@ -3048,7 +3125,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (should
             (string-equal
              (funcall
-              (if quoted 'tramp-compat-file-name-unquote 'identity)
+              (if quoted #'tramp-compat-file-name-unquote #'identity)
               (file-remote-p tmp-name1 'localname))
              (file-symlink-p tmp-name2)))
            (when (tramp--test-expensive-test)
@@ -3057,7 +3134,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
               :type 'file-already-exists))
            (when (tramp--test-expensive-test)
              ;; A number means interactive case.
-             (cl-letf (((symbol-function 'yes-or-no-p) 'ignore))
+             (cl-letf (((symbol-function 'yes-or-no-p) #'ignore))
                (should-error
                 (make-symbolic-link tmp-name1 tmp-name2 0)
                 :type 'file-already-exists)))
@@ -3066,14 +3143,14 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
              (should
               (string-equal
                (funcall
-                (if quoted 'tramp-compat-file-name-unquote 'identity)
+                (if quoted #'tramp-compat-file-name-unquote #'identity)
                 (file-remote-p tmp-name1 'localname))
                (file-symlink-p tmp-name2))))
            (make-symbolic-link tmp-name1 tmp-name2 'ok-if-already-exists)
            (should
             (string-equal
              (funcall
-              (if quoted 'tramp-compat-file-name-unquote 'identity)
+              (if quoted #'tramp-compat-file-name-unquote #'identity)
               (file-remote-p tmp-name1 'localname))
              (file-symlink-p tmp-name2)))
            ;; If we use the local part of `tmp-name1', it shall still work.
@@ -3083,7 +3160,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (should
             (string-equal
              (funcall
-              (if quoted 'tramp-compat-file-name-unquote 'identity)
+              (if quoted #'tramp-compat-file-name-unquote #'identity)
               (file-remote-p tmp-name1 'localname))
              (file-symlink-p tmp-name2)))
            ;; `tmp-name3' is a local file name.  Therefore, the link
@@ -3103,7 +3180,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (should
             (string-equal
              (funcall
-              (if quoted 'tramp-compat-file-name-unquote 'identity)
+              (if quoted #'tramp-compat-file-name-unquote #'identity)
               (file-remote-p tmp-name1 'localname))
              (file-symlink-p tmp-name5)))
            ;; `smbclient' does not show symlinks in directories, so
@@ -3130,7 +3207,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
              (add-name-to-file tmp-name1 tmp-name2)
              :type 'file-already-exists)
             ;; A number means interactive case.
-            (cl-letf (((symbol-function 'yes-or-no-p) 'ignore))
+            (cl-letf (((symbol-function 'yes-or-no-p) #'ignore))
               (should-error
                (add-name-to-file tmp-name1 tmp-name2 0)
                :type 'file-already-exists))
@@ -3187,7 +3264,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (delete-file tmp-name2)
            (make-symbolic-link
             (funcall
-             (if quoted 'tramp-compat-file-name-unquote 'identity)
+             (if quoted #'tramp-compat-file-name-unquote #'identity)
              "/penguin:motd:")
             tmp-name2)
            (should (file-symlink-p tmp-name2))
@@ -3276,7 +3353,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
       (let* ((dir1
              (directory-file-name
               (funcall
-               (if quoted 'tramp-compat-file-name-quote 'identity)
+               (if quoted #'tramp-compat-file-name-quote #'identity)
                tramp-test-temporary-file-directory)))
             (dir2 (file-name-as-directory dir1)))
        (should (string-equal (file-truename dir1) (expand-file-name dir1)))
@@ -3285,7 +3362,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
 (ert-deftest tramp-test22-file-times ()
   "Check `set-file-times' and `file-newer-than-file-p'."
   (skip-unless (tramp--test-enabled))
-  (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
+  (skip-unless
+   (or (tramp--test-adb-p) (tramp--test-sh-p) (tramp--test-sudoedit-p)))
 
   (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
     (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
@@ -3655,12 +3733,12 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
              (should-not (file-name-completion "a" tmp-name))
              (should
               (equal
-               (file-name-completion "b" tmp-name 'file-directory-p) "boz/"))
+               (file-name-completion "b" tmp-name #'file-directory-p) "boz/"))
              (should
               (equal (file-name-all-completions "fo" tmp-name) '("foo")))
              (should
               (equal
-               (sort (file-name-all-completions "b" tmp-name) 'string-lessp)
+               (sort (file-name-all-completions "b" tmp-name) #'string-lessp)
                '("bold" "boz/")))
              (should-not (file-name-all-completions "a" tmp-name))
              ;; `completion-regexp-list' restricts the completion to
@@ -3671,7 +3749,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
                 (equal (file-name-completion "" tmp-name) "bo"))
                (should
                 (equal
-                 (sort (file-name-all-completions "" tmp-name) 'string-lessp)
+                 (sort (file-name-all-completions "" tmp-name) #'string-lessp)
                  '("bold" "boz/"))))
              ;; `file-name-completion' ignores file names that end in
              ;; any string in `completion-ignored-extensions'.
@@ -3686,7 +3764,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
                ;; `file-name-all-completions' is not affected.
                (should
                 (equal
-                 (sort (file-name-all-completions "" tmp-name) 'string-lessp)
+                 (sort (file-name-all-completions "" tmp-name) #'string-lessp)
                  '("../" "./" "bold" "boz/" "foo" "foo.ext")))))
 
          ;; Cleanup.
@@ -3761,6 +3839,12 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
        ;; Cleanup.
        (ignore-errors (delete-file tmp-name))))))
 
+;; Must be a command, because used as `sigusr' handler.
+(defun tramp--test-timeout-handler (&rest _ignore)
+  "Timeout handler, reporting a failed test."
+  (interactive)
+  (ert-fail (format "`%s' timed out" (ert-test-name (ert-running-test)))))
+
 (ert-deftest tramp-test29-start-file-process ()
   "Check `start-file-process'."
   :tags '(:expensive-test)
@@ -3779,9 +3863,9 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (process-send-string proc "foo")
            (process-send-eof proc)
            ;; Read output.
-           (with-timeout (10 (ert-fail "`start-file-process' timed out"))
+           (with-timeout (10 (tramp--test-timeout-handler))
              (while (< (- (point-max) (point-min)) (length "foo"))
-               (accept-process-output proc 0.1)))
+               (while (accept-process-output proc 0 nil t))))
            (should (string-equal (buffer-string) "foo")))
 
        ;; Cleanup.
@@ -3797,9 +3881,9 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
                   "cat" (file-name-nondirectory tmp-name)))
            (should (processp proc))
            ;; Read output.
-           (with-timeout (10 (ert-fail "`start-file-process' timed out"))
+           (with-timeout (10 (tramp--test-timeout-handler))
              (while (< (- (point-max) (point-min)) (length "foo"))
-               (accept-process-output proc 0.1)))
+               (while (accept-process-output proc 0 nil t))))
            (should (string-equal (buffer-string) "foo")))
 
        ;; Cleanup.
@@ -3818,15 +3902,139 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
            (process-send-string proc "foo")
            (process-send-eof proc)
            ;; Read output.
-           (with-timeout (10 (ert-fail "`start-file-process' timed out"))
+           (with-timeout (10 (tramp--test-timeout-handler))
              (while (< (- (point-max) (point-min)) (length "foo"))
-               (accept-process-output proc 0.1)))
+               (while (accept-process-output proc 0 nil t))))
            (should (string-equal (buffer-string) "foo")))
 
        ;; Cleanup.
        (ignore-errors (delete-process proc))))))
 
-(ert-deftest tramp-test30-interrupt-process ()
+(ert-deftest tramp-test30-make-process ()
+  "Check `make-process'."
+  :tags '(:expensive-test)
+  (skip-unless (tramp--test-enabled))
+  (skip-unless (tramp--test-sh-p))
+  (skip-unless (tramp--test-emacs27-p))
+
+  (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
+    (let ((default-directory tramp-test-temporary-file-directory)
+         (tmp-name (tramp--test-make-temp-name nil quoted))
+         kill-buffer-query-functions proc)
+      (should-not (make-process))
+
+      ;; Simple process.
+      (unwind-protect
+         (with-temp-buffer
+           (setq proc
+                 (make-process
+                  :name "test1" :buffer (current-buffer) :command '("cat")
+                  :file-handler t))
+           (should (processp proc))
+           (should (equal (process-status proc) 'run))
+           (process-send-string proc "foo")
+           (process-send-eof proc)
+           ;; Read output.
+           (with-timeout (10 (tramp--test-timeout-handler))
+             (while (< (- (point-max) (point-min)) (length "foo"))
+               (while (accept-process-output proc 0 nil t))))
+           (should (string-equal (buffer-string) "foo")))
+
+       ;; Cleanup.
+       (ignore-errors (delete-process proc)))
+
+      ;; Simple process using a file.
+      (unwind-protect
+         (with-temp-buffer
+           (write-region "foo" nil tmp-name)
+           (should (file-exists-p tmp-name))
+           (setq proc
+                 (make-process
+                  :name "test2" :buffer (current-buffer)
+                  :command `("cat" ,(file-name-nondirectory tmp-name))
+                  :file-handler t))
+           (should (processp proc))
+           ;; Read output.
+           (with-timeout (10 (tramp--test-timeout-handler))
+             (while (< (- (point-max) (point-min)) (length "foo"))
+               (while (accept-process-output proc 0 nil t))))
+           (should (string-equal (buffer-string) "foo")))
+
+       ;; Cleanup.
+       (ignore-errors
+         (delete-process proc)
+         (delete-file tmp-name)))
+
+      ;; Process filter.
+      (unwind-protect
+         (with-temp-buffer
+           (setq proc
+                 (make-process
+                  :name "test3" :buffer (current-buffer) :command '("cat")
+                  :filter
+                  (lambda (p s)
+                    (with-current-buffer (process-buffer p) (insert s)))
+                  :file-handler t))
+           (should (processp proc))
+           (should (equal (process-status proc) 'run))
+           (process-send-string proc "foo")
+           (process-send-eof proc)
+           ;; Read output.
+           (with-timeout (10 (tramp--test-timeout-handler))
+             (while (< (- (point-max) (point-min)) (length "foo"))
+               (while (accept-process-output proc 0 nil t))))
+           (should (string-equal (buffer-string) "foo")))
+
+       ;; Cleanup.
+       (ignore-errors (delete-process proc)))
+
+      ;; Process sentinel.
+      (unwind-protect
+         (with-temp-buffer
+           (setq proc
+                 (make-process
+                  :name "test4" :buffer (current-buffer) :command '("cat")
+                  :sentinel
+                  (lambda (p s)
+                    (with-current-buffer (process-buffer p) (insert s)))
+                  :file-handler t))
+           (should (processp proc))
+           (should (equal (process-status proc) 'run))
+           (process-send-string proc "foo")
+           (process-send-eof proc)
+           (delete-process proc)
+           ;; Read output.
+           (with-timeout (10 (tramp--test-timeout-handler))
+             (while (accept-process-output proc 0 nil t)))
+           (should (string-equal (buffer-string) "killed\n")))
+
+       ;; Cleanup.
+       (ignore-errors (delete-process proc)))
+
+      ;; Process with stderr.
+      (let ((stderr (generate-new-buffer (generate-new-buffer-name "stderr"))))
+       (unwind-protect
+           (with-temp-buffer
+             (setq proc
+                   (make-process
+                    :name "test5" :buffer (current-buffer)
+                    :command '("cat" "/")
+                    :stderr stderr
+                    :file-handler t))
+             (should (processp proc))
+             ;; Read stderr.
+             (with-current-buffer stderr
+               (with-timeout (10 (tramp--test-timeout-handler))
+                 (while (= (point-min) (point-max))
+                   (while (accept-process-output proc 0 nil t))))
+               (should
+                (string-equal (buffer-string) "cat: /: Is a directory\n"))))
+
+         ;; Cleanup.
+         (ignore-errors (delete-process proc))
+         (ignore-errors (kill-buffer stderr)))))))
+
+(ert-deftest tramp-test31-interrupt-process ()
   "Check `interrupt-process'."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
@@ -3845,7 +4053,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
          (should (numberp (process-get proc 'remote-pid)))
          (should (interrupt-process proc))
          ;; Let the process accept the interrupt.
-          (accept-process-output proc 1 nil 0)
+         (while (accept-process-output proc nil nil 0))
          (should-not (process-live-p proc))
          ;; An interrupted process cannot be interrupted, again.
          (should-error (interrupt-process proc) :type 'error))
@@ -3853,11 +4061,14 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
       ;; Cleanup.
       (ignore-errors (delete-process proc)))))
 
-(ert-deftest tramp-test31-shell-command ()
+(ert-deftest tramp-test32-shell-command ()
   "Check `shell-command'."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
-  (skip-unless (tramp--test-sh-p))
+  ;; Prior Emacs 27, `shell-file-name' was hard coded as "/bin/sh" for
+  ;; remote processes in Emacs.  That doesn't work for tramp-adb.el.
+  (skip-unless (or (and (tramp--test-adb-p) (tramp--test-emacs27-p))
+                  (tramp--test-sh-p)))
 
   (dolist (quoted (if (tramp--test-expensive-test) '(nil t) '(nil)))
     (let ((tmp-name (tramp--test-make-temp-name nil quoted))
@@ -3885,6 +4096,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
        ;; Cleanup.
        (ignore-errors (delete-file tmp-name)))
 
+      ;; tramp-adb.el is not fit yet for asynchronous processes.
+      (unless (tramp--test-adb-p)
       (unwind-protect
          (with-temp-buffer
            (write-region "foo" nil tmp-name)
@@ -3893,11 +4106,9 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
             (format "ls %s" (file-name-nondirectory tmp-name))
             (current-buffer))
            ;; Read output.
-           (with-timeout (10 (ert-fail "`async-shell-command' timed out"))
-             (while (< (- (point-max) (point-min))
-                       (1+ (length (file-name-nondirectory tmp-name))))
-               (accept-process-output
-                (get-buffer-process (current-buffer)) 0.1)))
+           (with-timeout (10 (tramp--test-timeout-handler))
+             (while (accept-process-output
+                     (get-buffer-process (current-buffer)) nil nil t)))
            ;; `ls' could produce colorized output.
            (goto-char (point-min))
            (while
@@ -3913,8 +4124,10 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
              (buffer-string))))
 
        ;; Cleanup.
-       (ignore-errors (delete-file tmp-name)))
+       (ignore-errors (delete-file tmp-name))))
 
+      ;; tramp-adb.el is not fit yet for asynchronous processes.
+      (unless (tramp--test-adb-p)
       (unwind-protect
          (with-temp-buffer
            (write-region "foo" nil tmp-name)
@@ -3924,11 +4137,9 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
             (get-buffer-process (current-buffer))
             (format "%s\n" (file-name-nondirectory tmp-name)))
            ;; Read output.
-           (with-timeout (10 (ert-fail "`async-shell-command' timed out"))
-             (while (< (- (point-max) (point-min))
-                       (1+ (length (file-name-nondirectory tmp-name))))
-               (accept-process-output
-                (get-buffer-process (current-buffer)) 0.1)))
+           (with-timeout (10 (tramp--test-timeout-handler))
+             (while (accept-process-output
+                     (get-buffer-process (current-buffer)) nil nil t)))
            ;; `ls' could produce colorized output.
            (goto-char (point-min))
            (while
@@ -3944,20 +4155,20 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
              (buffer-string))))
 
        ;; Cleanup.
-       (ignore-errors (delete-file tmp-name))))))
+       (ignore-errors (delete-file tmp-name)))))))
 
 (defun tramp--test-shell-command-to-string-asynchronously (command)
   "Like `shell-command-to-string', but for asynchronous processes."
   (with-temp-buffer
     (async-shell-command command (current-buffer))
-    (with-timeout (10)
-      (while (get-buffer-process (current-buffer))
-       (accept-process-output (get-buffer-process (current-buffer)) 0.1)))
-    (accept-process-output nil 0.1)
+    (with-timeout
+        ((if (getenv "EMACS_EMBA_CI") 30 10) (tramp--test-timeout-handler))
+      (while (accept-process-output
+             (get-buffer-process (current-buffer)) nil nil t)))
     (buffer-substring-no-properties (point-min) (point-max))))
 
 ;; This test is inspired by Bug#23952.
-(ert-deftest tramp-test32-environment-variables ()
+(ert-deftest tramp-test33-environment-variables ()
   "Check that remote processes set / unset environment variables properly."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
@@ -4035,7 +4246,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
                (funcall this-shell-command-to-string "set")))))))))
 
 ;; This test is inspired by Bug#27009.
-(ert-deftest tramp-test32-environment-variables-and-port-numbers ()
+(ert-deftest tramp-test33-environment-variables-and-port-numbers ()
   "Check that two connections with separate ports are different."
   (skip-unless (tramp--test-enabled))
   ;; We test it only for the mock-up connection; otherwise there might
@@ -4070,12 +4281,80 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
     (dolist (dir '("/mock:localhost#11111:" "/mock:localhost#22222:"))
       (tramp-cleanup-connection (tramp-dissect-file-name dir)))))
 
+;; Connection-local variables are enabled per default since Emacs 27.1.
+(ert-deftest tramp-test34-connection-local-variables ()
+  "Check that connection-local variables are enabled."
+  :tags '(:expensive-test)
+  (skip-unless (tramp--test-enabled))
+  ;; Since Emacs 27.1.
+  (skip-unless (fboundp 'with-connection-local-variables))
+
+  ;; `connection-local-set-profile-variables' and
+  ;; `connection-local-set-profiles' exist since Emacs 26.1.  We don't
+  ;; want to see compiler warnings for older Emacsen.
+  (let* ((default-directory tramp-test-temporary-file-directory)
+        (tmp-name1 (tramp--test-make-temp-name))
+        (tmp-name2 (expand-file-name "foo" tmp-name1))
+        (enable-local-variables :all)
+        (enable-remote-dir-locals t)
+        kill-buffer-query-functions
+        connection-local-profile-alist connection-local-criteria-alist)
+    (unwind-protect
+       (progn
+         (make-directory tmp-name1)
+          (should (file-directory-p tmp-name1))
+
+         ;; `local-variable' is buffer-local due to explicit setting.
+         (with-no-warnings
+           (defvar-local local-variable 'buffer))
+         (with-temp-buffer
+           (should (eq local-variable 'buffer)))
+
+         ;; `local-variable' is connection-local due to Tramp.
+         (write-region "foo" nil tmp-name2)
+         (should (file-exists-p tmp-name2))
+         (with-no-warnings
+           (connection-local-set-profile-variables
+            'local-variable-profile
+            '((local-variable . connect)))
+           (connection-local-set-profiles
+            `(:application tramp
+              :protocol ,(file-remote-p default-directory 'method)
+              :user ,(file-remote-p default-directory 'user)
+              :machine ,(file-remote-p default-directory 'host))
+            'local-variable-profile))
+         (with-current-buffer (find-file-noselect tmp-name2)
+           (should (eq local-variable 'connect))
+           (kill-buffer (current-buffer)))
+
+         ;; `local-variable' is dir-local due to existence of .dir-locals.el.
+         (write-region
+          "((nil . ((local-variable . dir))))" nil
+          (expand-file-name ".dir-locals.el" tmp-name1))
+         (should (file-exists-p (expand-file-name ".dir-locals.el" tmp-name1)))
+         (with-current-buffer (find-file-noselect tmp-name2)
+           (should (eq local-variable 'dir))
+           (kill-buffer (current-buffer)))
+
+         ;; `local-variable' is file-local due to specifying as file variable.
+         (write-region
+          "-*- mode: comint; local-variable: file; -*-" nil tmp-name2)
+          (should (file-exists-p tmp-name2))
+         (with-current-buffer (find-file-noselect tmp-name2)
+           (should (eq local-variable 'file))
+           (kill-buffer (current-buffer))))
+
+      ;; Cleanup.
+      (ignore-errors (delete-directory tmp-name1 'recursive)))))
+
 ;; The functions were introduced in Emacs 26.1.
-(ert-deftest tramp-test33-explicit-shell-file-name ()
+(ert-deftest tramp-test34-explicit-shell-file-name ()
   "Check that connection-local `explicit-shell-file-name' is set."
-  :tags '(:expensive-test)
+  ;; The handling of connection-local variables has changed.  Test
+  ;; must be reworked.
+  :tags '(:expensive-test :unstable)
   (skip-unless (tramp--test-enabled))
-  (skip-unless (tramp--test-sh-p))
+  (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
   ;; Since Emacs 26.1.
   (skip-unless (and (fboundp 'connection-local-set-profile-variables)
                    (fboundp 'connection-local-set-profiles)))
@@ -4084,7 +4363,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
   ;; `connection-local-set-profiles' exist since Emacs 26.1.  We don't
   ;; want to see compiler warnings for older Emacsen.
   (let ((default-directory tramp-test-temporary-file-directory)
-       explicit-shell-file-name kill-buffer-query-functions)
+       explicit-shell-file-name kill-buffer-query-functions
+       connection-local-profile-alist connection-local-criteria-alist)
     (unwind-protect
        (progn
          ;; `shell-mode' would ruin our test, because it deletes all
@@ -4094,7 +4374,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
          (with-no-warnings
            (connection-local-set-profile-variables
             'remote-sh
-            '((explicit-shell-file-name . "/bin/sh")
+            `((explicit-shell-file-name
+               . ,(if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh"))
               (explicit-sh-args . ("-i"))))
            (connection-local-set-profiles
             `(:application tramp
@@ -4102,6 +4383,8 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
               :user ,(file-remote-p default-directory 'user)
               :machine ,(file-remote-p default-directory 'host))
             'remote-sh))
+         (put 'explicit-shell-file-name 'safe-local-variable #'identity)
+         (put 'explicit-sh-args 'safe-local-variable #'identity)
 
          ;; Run interactive shell.  Since the default directory is
          ;; remote, `explicit-shell-file-name' shall be set in order
@@ -4109,16 +4392,17 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
          (with-current-buffer (get-buffer-create "*shell*")
            (ignore-errors (kill-process (current-buffer)))
            (should-not explicit-shell-file-name)
-           (call-interactively 'shell)
+           (call-interactively #'shell)
            (should explicit-shell-file-name)))
 
+      ;; Cleanup.
       (put 'explicit-shell-file-name 'permanent-local nil)
       (kill-buffer "*shell*"))))
 
 ;; `exec-path' was introduced in Emacs 27.1.  `executable-find' has
 ;; changed the number of parameters, so we use `apply' for older
 ;; Emacsen.
-(ert-deftest tramp-test34-exec-path ()
+(ert-deftest tramp-test35-exec-path ()
   "Check `exec-path' and `executable-find'."
   (skip-unless (tramp--test-enabled))
   (skip-unless (or (tramp--test-adb-p) (tramp--test-sh-p)))
@@ -4136,7 +4420,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
            (car (last (with-no-warnings (exec-path))))
            (file-remote-p default-directory 'localname)))
          ;; The shell "sh" shall always exist.
-         (should (apply 'executable-find '("sh" remote)))
+         (should (apply #'executable-find '("sh" remote)))
          ;; Since the last element in `exec-path' is the current
          ;; directory, an executable file in that directory will be
          ;; found.
@@ -4147,17 +4431,83 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
          (should
           (string-equal
            (apply
-            'executable-find `(,(file-name-nondirectory tmp-name) remote))
+            #'executable-find `(,(file-name-nondirectory tmp-name) remote))
            (file-remote-p tmp-name 'localname)))
          (should-not
           (apply
-           'executable-find
+           #'executable-find
            `(,(concat (file-name-nondirectory tmp-name) "foo") remote))))
 
       ;; Cleanup.
       (ignore-errors (delete-file tmp-name)))))
 
-(ert-deftest tramp-test35-vc-registered ()
+;; This test is inspired by Bug#33781.
+;; `exec-path' was introduced in Emacs 27.1.  `executable-find' has
+;; changed the number of parameters, so we use `apply' for older
+;; Emacsen.
+(ert-deftest tramp-test35-remote-path ()
+  "Check loooong `tramp-remote-path'."
+  (skip-unless (tramp--test-enabled))
+  (skip-unless (tramp--test-sh-p))
+  ;; Since Emacs 27.1.
+  (skip-unless (fboundp 'exec-path))
+
+  (let* ((tmp-name (tramp--test-make-temp-name))
+        (default-directory tramp-test-temporary-file-directory)
+         (orig-exec-path (with-no-warnings (exec-path)))
+         (tramp-remote-path tramp-remote-path)
+        (orig-tramp-remote-path tramp-remote-path))
+    (unwind-protect
+       (progn
+          ;; Non existing directories are removed.
+          (setq tramp-remote-path
+                (cons (file-remote-p tmp-name 'localname) tramp-remote-path))
+          (tramp-cleanup-connection
+           (tramp-dissect-file-name tramp-test-temporary-file-directory)
+           'keep-debug 'keep-password)
+          (should (equal (with-no-warnings (exec-path)) orig-exec-path))
+          (setq tramp-remote-path orig-tramp-remote-path)
+
+          ;; Double entries are removed.
+          (setq tramp-remote-path (append '("/" "/") tramp-remote-path))
+          (tramp-cleanup-connection
+           (tramp-dissect-file-name tramp-test-temporary-file-directory)
+           'keep-debug 'keep-password)
+          (should
+          (equal (with-no-warnings (exec-path)) (cons "/" orig-exec-path)))
+          (setq tramp-remote-path orig-tramp-remote-path)
+
+          ;; We make a super long `tramp-remote-path'.
+          (make-directory tmp-name)
+          (should (file-directory-p tmp-name))
+          (while (< (length (mapconcat #'identity orig-exec-path ":")) 5000)
+            (let ((dir (make-temp-file (file-name-as-directory tmp-name) 
'dir)))
+              (should (file-directory-p dir))
+              (setq tramp-remote-path
+                    (cons (file-remote-p dir 'localname) tramp-remote-path)
+                    orig-exec-path
+                    (cons (file-remote-p dir 'localname) orig-exec-path))))
+          (tramp-cleanup-connection
+           (tramp-dissect-file-name tramp-test-temporary-file-directory)
+           'keep-debug 'keep-password)
+          (should (equal (with-no-warnings (exec-path)) orig-exec-path))
+          (should
+          (string-equal
+           ;; Ignore trailing newline.
+           (substring (shell-command-to-string "echo $PATH") nil -1)
+           ;; The last element of `exec-path' is `exec-directory'.
+           (mapconcat #'identity (butlast orig-exec-path) ":")))
+         ;; The shell "sh" shall always exist.
+         (should (apply #'executable-find '("sh" remote))))
+
+      ;; Cleanup.
+      (tramp-cleanup-connection
+       (tramp-dissect-file-name tramp-test-temporary-file-directory)
+       'keep-debug 'keep-password)
+      (setq tramp-remote-path orig-tramp-remote-path)
+      (ignore-errors (delete-directory tmp-name 'recursive)))))
+
+(ert-deftest tramp-test36-vc-registered ()
   "Check `vc-registered'."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
@@ -4227,7 +4577,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
        ;; Cleanup.
        (ignore-errors (delete-directory tmp-name1 'recursive))))))
 
-(ert-deftest tramp-test36-make-auto-save-file-name ()
+(ert-deftest tramp-test37-make-auto-save-file-name ()
   "Check `make-auto-save-file-name'."
   (skip-unless (tramp--test-enabled))
 
@@ -4264,7 +4614,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
                 (string-equal
                  (make-auto-save-file-name)
                  (funcall
-                  (if quoted 'tramp-compat-file-name-quote 'identity)
+                  (if quoted #'tramp-compat-file-name-quote #'identity)
                   (expand-file-name
                    (format "#%s#" (file-name-nondirectory tmp-name1))
                    tramp-test-temporary-file-directory))))))
@@ -4318,7 +4668,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
        (ignore-errors (delete-file tmp-name1))
        (ignore-errors (delete-directory tmp-name2 'recursive))))))
 
-(ert-deftest tramp-test37-find-backup-file-name ()
+(ert-deftest tramp-test38-find-backup-file-name ()
   "Check `find-backup-file-name'."
   (skip-unless (tramp--test-enabled))
 
@@ -4338,7 +4688,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
              (find-backup-file-name tmp-name1)
              (list
               (funcall
-               (if quoted 'tramp-compat-file-name-quote 'identity)
+               (if quoted #'tramp-compat-file-name-quote #'identity)
                (expand-file-name
                 (format "%s~" (file-name-nondirectory tmp-name1))
                 tramp-test-temporary-file-directory)))))))
@@ -4352,7 +4702,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
              (find-backup-file-name tmp-name1)
              (list
               (funcall
-               (if quoted 'tramp-compat-file-name-quote 'identity)
+               (if quoted #'tramp-compat-file-name-quote #'identity)
                (expand-file-name
                 (format
                  "%s~"
@@ -4380,7 +4730,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
              (find-backup-file-name tmp-name1)
              (list
               (funcall
-               (if quoted 'tramp-compat-file-name-quote 'identity)
+               (if quoted #'tramp-compat-file-name-quote #'identity)
                (expand-file-name
                 (format
                  "%s~"
@@ -4409,7 +4759,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
              (find-backup-file-name tmp-name1)
              (list
               (funcall
-               (if quoted 'tramp-compat-file-name-quote 'identity)
+               (if quoted #'tramp-compat-file-name-quote #'identity)
                (expand-file-name
                 (format
                  "%s~"
@@ -4429,7 +4779,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
        (ignore-errors (delete-directory tmp-name2 'recursive))))))
 
 ;; The functions were introduced in Emacs 26.1.
-(ert-deftest tramp-test38-make-nearby-temp-file ()
+(ert-deftest tramp-test39-make-nearby-temp-file ()
   "Check `make-nearby-temp-file' and `temporary-file-directory'."
   (skip-unless (tramp--test-enabled))
   ;; Since Emacs 26.1.
@@ -4526,6 +4876,11 @@ This does not support external Emacs calls."
   (string-equal
    "nextcloud" (file-remote-p tramp-test-temporary-file-directory 'method)))
 
+(defun tramp--test-rclone-p ()
+  "Check, whether the remote host is offered by rclone.
+This requires restrictions of file name syntax."
+  (tramp-rclone-file-name-p tramp-test-temporary-file-directory))
+
 (defun tramp--test-rsync-p ()
   "Check, whether the rsync method is used.
 This does not support special file names."
@@ -4538,6 +4893,10 @@ This does not support special file names."
    (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
    'tramp-sh-file-name-handler))
 
+(defun tramp--test-sudoedit-p ()
+  "Check, whether the sudoedit method is used."
+  (tramp-sudoedit-file-name-p tramp-test-temporary-file-directory))
+
 (defun tramp--test-windows-nt ()
   "Check, whether the locale host runs MS Windows."
   (eq system-type 'windows-nt))
@@ -4609,7 +4968,7 @@ This requires restrictions of file name syntax."
                  (should
                   (string-equal
                    (funcall
-                    (if quoted 'tramp-compat-file-name-quote 'identity)
+                    (if quoted #'tramp-compat-file-name-quote #'identity)
                     (car (file-attributes file3)))
                    (file-remote-p (file-truename file1) 'localname)))
                  ;; Check file contents.
@@ -4621,10 +4980,10 @@ This requires restrictions of file name syntax."
            ;; Check file names.
            (should (equal (directory-files
                            tmp-name1 nil directory-files-no-dot-files-regexp)
-                          (sort (copy-sequence files) 'string-lessp)))
+                          (sort (copy-sequence files) #'string-lessp)))
            (should (equal (directory-files
                            tmp-name2 nil directory-files-no-dot-files-regexp)
-                          (sort (copy-sequence files) 'string-lessp)))
+                          (sort (copy-sequence files) #'string-lessp)))
 
            ;; `substitute-in-file-name' could return different
            ;; values.  For `adb', there could be strange file
@@ -4684,7 +5043,7 @@ This requires restrictions of file name syntax."
                    (should
                     (string-equal
                      (funcall
-                      (if quoted 'tramp-compat-file-name-quote 'identity)
+                      (if quoted #'tramp-compat-file-name-quote #'identity)
                       (cadr (car (directory-files-and-attributes
                                   file1 nil (regexp-quote elt1)))))
                      (file-remote-p (file-truename file2) 'localname)))
@@ -4722,7 +5081,7 @@ This requires restrictions of file name syntax."
        (ignore-errors (delete-directory tmp-name2 'recursive))))))
 
 (defun tramp--test-special-characters ()
-  "Perform the test in `tramp-test39-special-characters*'."
+  "Perform the test in `tramp-test40-special-characters*'."
   ;; Newlines, slashes and backslashes in file names are not
   ;; supported.  So we don't test.  And we don't test the tab
   ;; character on Windows or Cygwin, because the backslash is
@@ -4730,7 +5089,10 @@ This requires restrictions of file name syntax."
   ;; expanded to <TAB>.
   (let ((files
         (list
-         (if (or (tramp--test-gvfs-p) (tramp--test-windows-nt-or-smb-p))
+         (if (or (tramp--test-gvfs-p)
+                 (tramp--test-rclone-p)
+                 (tramp--test-sudoedit-p)
+                 (tramp--test-windows-nt-or-smb-p))
              "foo bar baz"
            (if (or (tramp--test-adb-p)
                    (tramp--test-docker-p)
@@ -4756,7 +5118,9 @@ This requires restrictions of file name syntax."
          (if (or (tramp--test-gvfs-p) (tramp--test-windows-nt-or-smb-p))
              "!foo!bar!baz!"
            "!foo|bar!baz|")
-         (if (or (tramp--test-gvfs-p) (tramp--test-windows-nt-or-smb-p))
+         (if (or (tramp--test-gvfs-p)
+                 (tramp--test-rclone-p)
+                 (tramp--test-windows-nt-or-smb-p))
              ";foo;bar;baz;"
            ":foo;bar:baz;")
          (unless (or (tramp--test-gvfs-p) (tramp--test-windows-nt-or-smb-p))
@@ -4765,12 +5129,12 @@ This requires restrictions of file name syntax."
          (unless (or (tramp--test-ftp-p) (tramp--test-gvfs-p)) "[foo]bar[baz]")
          "{foo}bar{baz}")))
     ;; Simplify test in order to speed up.
-    (apply 'tramp--test-check-files
+    (apply #'tramp--test-check-files
           (if (tramp--test-expensive-test)
-              files (list (mapconcat 'identity files ""))))))
+              files (list (mapconcat #'identity files ""))))))
 
 ;; These tests are inspired by Bug#17238.
-(ert-deftest tramp-test39-special-characters ()
+(ert-deftest tramp-test40-special-characters ()
   "Check special characters in file names."
   (skip-unless (tramp--test-enabled))
   (skip-unless (not (tramp--test-rsync-p)))
@@ -4778,7 +5142,7 @@ This requires restrictions of file name syntax."
 
   (tramp--test-special-characters))
 
-(ert-deftest tramp-test39-special-characters-with-stat ()
+(ert-deftest tramp-test40-special-characters-with-stat ()
   "Check special characters in file names.
 Use the `stat' command."
   :tags '(:expensive-test)
@@ -4796,7 +5160,7 @@ Use the `stat' command."
          tramp-connection-properties)))
     (tramp--test-special-characters)))
 
-(ert-deftest tramp-test39-special-characters-with-perl ()
+(ert-deftest tramp-test40-special-characters-with-perl ()
   "Check special characters in file names.
 Use the `perl' command."
   :tags '(:expensive-test)
@@ -4817,7 +5181,7 @@ Use the `perl' command."
          tramp-connection-properties)))
     (tramp--test-special-characters)))
 
-(ert-deftest tramp-test39-special-characters-with-ls ()
+(ert-deftest tramp-test40-special-characters-with-ls ()
   "Check special characters in file names.
 Use the `ls' command."
   :tags '(:expensive-test)
@@ -4840,7 +5204,7 @@ Use the `ls' command."
     (tramp--test-special-characters)))
 
 (defun tramp--test-utf8 ()
-  "Perform the test in `tramp-test40-utf8*'."
+  "Perform the test in `tramp-test41-utf8*'."
   (let* ((utf8 (if (and (eq system-type 'darwin)
                        (memq 'utf-8-hfs (coding-system-list)))
                   'utf-8-hfs 'utf-8))
@@ -4849,7 +5213,7 @@ Use the `ls' command."
         (file-name-coding-system
          (coding-system-change-eol-conversion utf8 'unix)))
     (apply
-     'tramp--test-check-files
+     #'tramp--test-check-files
      (append
       (list
        (unless (tramp--test-hpux-p) "Γυρίστε το Γαλαξία με Ώτο Στοπ")
@@ -4875,7 +5239,7 @@ Use the `ls' command."
             (replace-regexp-in-string "[\t\n/.?]" "" x)))
          language-info-alist)))))))
 
-(ert-deftest tramp-test40-utf8 ()
+(ert-deftest tramp-test41-utf8 ()
   "Check UTF8 encoding in file names and file contents."
   (skip-unless (tramp--test-enabled))
   (skip-unless (not (tramp--test-docker-p)))
@@ -4885,7 +5249,7 @@ Use the `ls' command."
 
   (tramp--test-utf8))
 
-(ert-deftest tramp-test40-utf8-with-stat ()
+(ert-deftest tramp-test41-utf8-with-stat ()
   "Check UTF8 encoding in file names and file contents.
 Use the `stat' command."
   :tags '(:expensive-test)
@@ -4905,7 +5269,7 @@ Use the `stat' command."
          tramp-connection-properties)))
     (tramp--test-utf8)))
 
-(ert-deftest tramp-test40-utf8-with-perl ()
+(ert-deftest tramp-test41-utf8-with-perl ()
   "Check UTF8 encoding in file names and file contents.
 Use the `perl' command."
   :tags '(:expensive-test)
@@ -4928,7 +5292,7 @@ Use the `perl' command."
          tramp-connection-properties)))
     (tramp--test-utf8)))
 
-(ert-deftest tramp-test40-utf8-with-ls ()
+(ert-deftest tramp-test41-utf8-with-ls ()
   "Check UTF8 encoding in file names and file contents.
 Use the `ls' command."
   :tags '(:expensive-test)
@@ -4951,7 +5315,7 @@ Use the `ls' command."
          tramp-connection-properties)))
     (tramp--test-utf8)))
 
-(ert-deftest tramp-test41-file-system-info ()
+(ert-deftest tramp-test42-file-system-info ()
   "Check that `file-system-info' returns proper values."
   (skip-unless (tramp--test-enabled))
   ;; Since Emacs 27.1.
@@ -4968,32 +5332,41 @@ Use the `ls' command."
                 (numberp (nth 1 fsi))
                 (numberp (nth 2 fsi))))))
 
-(defun tramp--test-timeout-handler ()
-  "Timeout handler, reporting a failed test."
-  (ert-fail (format "`%s' timed out" (ert-test-name (ert-running-test)))))
+;; `tramp-test43-asynchronous-requests' could be blocked.  So we set a
+;; timeout of 300 seconds, and we send a SIGUSR1 signal after 300
+;; seconds.  Similar check is performed in the timer function.
+(defconst tramp--test-asynchronous-requests-timeout 300
+  "Timeout for `tramp-test43-asynchronous-requests'.")
 
 ;; This test is inspired by Bug#16928.
-(ert-deftest tramp-test42-asynchronous-requests ()
+(ert-deftest tramp-test43-asynchronous-requests ()
   "Check parallel asynchronous requests.
 Such requests could arrive from timers, process filters and
 process sentinels.  They shall not disturb each other."
+  ;; The test fails from time to time, w/o a reproducible pattern.  So
+  ;; we mark it as unstable.
   :tags '(:expensive-test :unstable)
   (skip-unless (tramp--test-enabled))
   (skip-unless (tramp--test-sh-p))
+  ;; This test is sensible wrt to other running tests.  Let it work
+  ;; only if it is the only selected test.
+  ;; FIXME: There must be a better solution.
+  (skip-unless
+   (= 1 (length
+        (ert-select-tests (ert--stats-selector ert--current-run-stats) t))))
 
-  ;; This test could be blocked on hydra.  So we set a timeout of 300
-  ;; seconds, and we send a SIGUSR1 signal after 300 seconds.
-  ;; This clearly doesn't work though, because the test not
-  ;; infrequently hangs for hours until killed by the infrastructure.
-  (with-timeout (300 (tramp--test-timeout-handler))
-    (define-key special-event-map [sigusr1] 'tramp--test-timeout-handler)
-    (tramp--test-instrument-test-case (if (getenv "EMACS_HYDRA_CI") 10 0)
+  (with-timeout
+      (tramp--test-asynchronous-requests-timeout (tramp--test-timeout-handler))
+    (define-key special-event-map [sigusr1] #'tramp--test-timeout-handler)
     (let* (;; For the watchdog.
           (default-directory (expand-file-name temporary-file-directory))
+          (shell-file-name "/bin/sh")
           (watchdog
-            (start-process
-             "*watchdog*" nil shell-file-name shell-command-switch
-             (format "sleep 300; kill -USR1 %d" (emacs-pid))))
+            (start-process-shell-command
+             "*watchdog*" nil
+             (format
+             "sleep %d; kill -USR1 %d"
+             tramp--test-asynchronous-requests-timeout (emacs-pid))))
            (tmp-name (tramp--test-make-temp-name))
            (default-directory tmp-name)
            ;; Do not cache Tramp properties.
@@ -5019,8 +5392,11 @@ process sentinels.  They shall not disturb each other."
            ;; We must distinguish due to performance reasons.
            (timer-operation
             (cond
-             ((tramp--test-mock-p) 'vc-registered)
-             (t 'file-attributes)))
+             ((tramp--test-mock-p) #'vc-registered)
+             (t #'file-attributes)))
+          ;; This is when all timers start.  We check inside the
+          ;; timer function, that we don't exceed timeout.
+          (timer-start (current-time))
            timer buffers kill-buffer-query-functions)
 
       (unwind-protect
@@ -5035,6 +5411,9 @@ process sentinels.  They shall not disturb each other."
              (run-at-time
               0 timer-repeat
               (lambda ()
+                (when (> (- (time-to-seconds) (time-to-seconds timer-start))
+                         tramp--test-asynchronous-requests-timeout)
+                  (tramp--test-timeout-handler))
                 (when buffers
                   (let ((time (float-time))
                         (default-directory tmp-name)
@@ -5044,12 +5423,13 @@ process sentinels.  They shall not disturb each other."
                      "Start timer %s %s" file (current-time-string))
                     (funcall timer-operation file)
                     ;; Adjust timer if it takes too much time.
+                    (tramp--test-message
+                     "Stop timer %s %s" file (current-time-string))
                     (when (> (- (float-time) time) timer-repeat)
                       (setq timer-repeat (* 1.5 timer-repeat))
                       (setf (timer--repeat-delay timer) timer-repeat)
-                      (tramp--test-message "Increase timer %s" timer-repeat))
-                    (tramp--test-message
-                     "Stop timer %s %s" file (current-time-string)))))))
+                      (tramp--test-message
+                      "Increase timer %s" timer-repeat)))))))
 
             ;; Create temporary buffers.  The number of buffers
             ;; corresponds to the number of processes; it could be
@@ -5065,9 +5445,9 @@ process sentinels.  They shall not disturb each other."
                      (start-file-process-shell-command
                       (buffer-name buf) buf
                       (concat
-                       "(read line && echo $line >$line);"
-                       "(read line && cat $line);"
-                       "(read line && rm $line)")))
+                      "(read line && echo $line >$line && echo $line);"
+                      "(read line && cat $line);"
+                      "(read line && rm -f $line)")))
                     (file (expand-file-name (buffer-name buf))))
                 ;; Remember the file name.  Add counter.
                 (process-put proc 'foo file)
@@ -5083,17 +5463,16 @@ process sentinels.  They shall not disturb each other."
                    (unless (zerop (length string))
                     (dired-uncache (process-get proc 'foo))
                      (should (file-attributes (process-get proc 'foo))))))
-                ;; Add process sentinel.
+                ;; Add process sentinel.  It shall not perform remote
+                ;; operations, triggering Tramp processes.  This blocks.
                 (set-process-sentinel
                  proc
                  (lambda (proc _state)
                    (tramp--test-message
-                    "Process sentinel %s %s" proc (current-time-string))
-                  (dired-uncache (process-get proc 'foo))
-                   (should-not (file-attributes (process-get proc 'foo)))))))
+                    "Process sentinel %s %s" proc (current-time-string))))))
 
-            ;; Send a string.  Use a random order of the buffers.  Mix
-            ;; with regular operation.
+            ;; Send a string to the processes.  Use a random order of
+            ;; the buffers.  Mix with regular operation.
             (let ((buffers (copy-sequence buffers)))
               (while buffers
                ;; Activate timer.
@@ -5111,7 +5490,7 @@ process sentinels.  They shall not disturb each other."
                     (should (file-attributes file)))
                   ;; Send string to process.
                   (process-send-string proc (format "%s\n" (buffer-name buf)))
-                  (accept-process-output proc 0.1 nil 0)
+                  (while (accept-process-output proc 0 nil 0))
                   ;; Give the watchdog a chance.
                   (read-event nil nil 0.01)
                   (tramp--test-message
@@ -5133,22 +5512,23 @@ process sentinels.  They shall not disturb each other."
             (tramp--test-message "Check %s" (current-time-string))
             (dolist (buf buffers)
               (with-current-buffer buf
-                (should (string-equal (format "%s\n" buf) (buffer-string)))))
+                (should
+                (string-equal (format "%s\n%s\n" buf buf) (buffer-string)))))
             (should-not
              (directory-files
               tmp-name nil directory-files-no-dot-files-regexp)))
 
         ;; Cleanup.
-        (define-key special-event-map [sigusr1] 'ignore)
+        (define-key special-event-map [sigusr1] #'ignore)
         (ignore-errors (quit-process watchdog))
         (dolist (buf buffers)
           (ignore-errors (delete-process (get-buffer-process buf)))
           (ignore-errors (kill-buffer buf)))
         (ignore-errors (cancel-timer timer))
-        (ignore-errors (delete-directory tmp-name 'recursive)))))))
+        (ignore-errors (delete-directory tmp-name 'recursive))))))
 
 ;; This test is inspired by Bug#29163.
-(ert-deftest tramp-test43-auto-load ()
+(ert-deftest tramp-test44-auto-load ()
   "Check that Tramp autoloads properly."
   (skip-unless (tramp--test-enabled))
 
@@ -5165,10 +5545,10 @@ process sentinels.  They shall not disturb each other."
        "%s -batch -Q -L %s --eval %s"
        (shell-quote-argument
         (expand-file-name invocation-name invocation-directory))
-       (mapconcat 'shell-quote-argument load-path " -L ")
+       (mapconcat #'shell-quote-argument load-path " -L ")
        (shell-quote-argument code)))))))
 
-(ert-deftest tramp-test43-delay-load ()
+(ert-deftest tramp-test44-delay-load ()
   "Check that Tramp is loaded lazily, only when needed."
   ;; The autoloaded Tramp objects are different since Emacs 26.1.  We
   ;; cannot test older Emacsen, therefore.
@@ -5198,10 +5578,10 @@ process sentinels.  They shall not disturb each other."
          "%s -batch -Q -L %s --eval %s"
          (shell-quote-argument
           (expand-file-name invocation-name invocation-directory))
-         (mapconcat 'shell-quote-argument load-path " -L ")
+         (mapconcat #'shell-quote-argument load-path " -L ")
          (shell-quote-argument (format code tm)))))))))
 
-(ert-deftest tramp-test43-recursive-load ()
+(ert-deftest tramp-test44-recursive-load ()
   "Check that Tramp does not fail due to recursive load."
   (skip-unless (tramp--test-enabled))
 
@@ -5222,10 +5602,10 @@ process sentinels.  They shall not disturb each other."
          "%s -batch -Q -L %s --eval %s"
          (shell-quote-argument
           (expand-file-name invocation-name invocation-directory))
-         (mapconcat 'shell-quote-argument load-path " -L ")
+         (mapconcat #'shell-quote-argument load-path " -L ")
          (shell-quote-argument code))))))))
 
-(ert-deftest tramp-test43-remote-load-path ()
+(ert-deftest tramp-test44-remote-load-path ()
   "Check that Tramp autoloads its packages with remote `load-path'."
   ;; The autoloaded Tramp objects are different since Emacs 26.1.  We
   ;; cannot test older Emacsen, therefore.
@@ -5243,17 +5623,18 @@ process sentinels.  They shall not disturb each other."
      (string-match
       (format
        "Loading %s"
-       (expand-file-name
-       "tramp-cmds" (file-name-directory (locate-library "tramp"))))
+       (regexp-quote
+        (expand-file-name
+         "tramp-cmds" (file-name-directory (locate-library "tramp")))))
       (shell-command-to-string
        (format
        "%s -batch -Q -L %s -l tramp-sh --eval %s"
        (shell-quote-argument
         (expand-file-name invocation-name invocation-directory))
-       (mapconcat 'shell-quote-argument load-path " -L ")
+       (mapconcat #'shell-quote-argument load-path " -L ")
        (shell-quote-argument code)))))))
 
-(ert-deftest tramp-test44-unload ()
+(ert-deftest tramp-test45-unload ()
   "Check that Tramp and its subpackages unload completely.
 Since it unloads Tramp, it shall be the last test to run."
   :tags '(:expensive-test)
@@ -5278,7 +5659,7 @@ Since it unloads Tramp, it shall be the last test to run."
    (all-completions
     "tramp" (delq 'tramp-tests (delq 'tramp-archive-tests features))))
   ;; `file-name-handler-alist' must be clean.
-  (should-not (all-completions "tramp" (mapcar 'cdr file-name-handler-alist)))
+  (should-not (all-completions "tramp" (mapcar #'cdr file-name-handler-alist)))
   ;; There shouldn't be left a bound symbol, except buffer-local
   ;; variables, and autoload functions.  We do not regard our test
   ;; symbols, and the Tramp unload hooks.
@@ -5313,7 +5694,8 @@ Since it unloads Tramp, it shall be the last test to run."
   "Run all tests for \\[tramp]."
   (interactive "p")
   (funcall
-   (if interactive 'ert-run-tests-interactively 'ert-run-tests-batch) 
"^tramp"))
+   (if interactive
+       #'ert-run-tests-interactively #'ert-run-tests-batch) "^tramp"))
 
 ;; TODO:
 
@@ -5322,6 +5704,7 @@ Since it unloads Tramp, it shall be the last test to run."
 ;; * file-equal-p (partly done in `tramp-test21-file-links')
 ;; * file-in-directory-p
 ;; * file-name-case-insensitive-p
+;; * tramp-set-file-uid-gid
 
 ;; * Work on skipped tests.  Make a comment, when it is impossible.
 ;; * Revisit expensive tests, once problems in `tramp-error' are solved.
@@ -5329,9 +5712,13 @@ Since it unloads Tramp, it shall be the last test to 
run."
 ;; * Fix `tramp-test06-directory-file-name' for `ftp'.
 ;; * Investigate, why `tramp-test11-copy-file' and `tramp-test12-rename-file'
 ;;   do not work properly for `nextcloud'.
-;; * Fix `tramp-test29-start-file-process' on MS Windows (`process-send-eof'?).
-;; * Fix `tramp-test30-interrupt-process', timeout doesn't work reliably.
-;; * Fix Bug#16928 in `tramp-test42-asynchronous-requests'.
+;; * Fix `tramp-test29-start-file-process' and
+;;   `tramp-test30-make-process' on MS Windows (`process-send-eof'?).
+;; * Fix `tramp-test29-start-file-process',
+;;   `tramp-test30-make-process' and `tramp-test32-shell-command' for
+;;   `adb' (see comment in `tramp-adb-send-command').
+;; * Rework `tramp-test34-explicit-shell-file-name'.
+;; * Fix Bug#16928 in `tramp-test43-asynchronous-requests'.
 
 (provide 'tramp-tests)
 ;;; tramp-tests.el ends here
diff --git a/test/lisp/obarray-tests.el b/test/lisp/obarray-tests.el
index 9a02046..5096f78 100644
--- a/test/lisp/obarray-tests.el
+++ b/test/lisp/obarray-tests.el
@@ -1,6 +1,6 @@
 ;;; obarray-tests.el --- Tests for obarray -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Przemysław Wojnowski <address@hidden>
 
diff --git a/test/lisp/org/org-tests.el b/test/lisp/org/org-tests.el
index a220188..4b82aa8 100644
--- a/test/lisp/org/org-tests.el
+++ b/test/lisp/org/org-tests.el
@@ -1,6 +1,6 @@
 ;;; org-tests.el --- tests for org/org.el
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 
diff --git a/test/lisp/progmodes/bat-mode-tests.el 
b/test/lisp/progmodes/bat-mode-tests.el
index 5b82484..05b8459 100644
--- a/test/lisp/progmodes/bat-mode-tests.el
+++ b/test/lisp/progmodes/bat-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; bat-mode-tests.el --- Tests for bat-mode.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Vladimir Panteleev <address@hidden>
 ;; Keywords:
diff --git a/test/lisp/progmodes/cc-mode-tests.el 
b/test/lisp/progmodes/cc-mode-tests.el
index 5f5e33d..0b8f37d 100644
--- a/test/lisp/progmodes/cc-mode-tests.el
+++ b/test/lisp/progmodes/cc-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; cc-mode-tests.el --- Test suite for cc-mode.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Michal Nazarewicz <address@hidden>
 ;; Keywords:       internal
diff --git a/test/lisp/progmodes/compile-tests.el 
b/test/lisp/progmodes/compile-tests.el
index 4e2dc86..a7d1c6b 100644
--- a/test/lisp/progmodes/compile-tests.el
+++ b/test/lisp/progmodes/compile-tests.el
@@ -1,6 +1,6 @@
 ;;; compile-tests.el --- Test suite for compile.el.  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Chong Yidong <address@hidden>
 ;; Keywords:       internal
diff --git a/test/lisp/progmodes/elisp-mode-tests.el 
b/test/lisp/progmodes/elisp-mode-tests.el
index 941e85b..bc2d14b 100644
--- a/test/lisp/progmodes/elisp-mode-tests.el
+++ b/test/lisp/progmodes/elisp-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; elisp-mode-tests.el --- Tests for emacs-lisp-mode  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Dmitry Gutov <address@hidden>
 ;; Author: Stephen Leake <address@hidden>
@@ -298,6 +298,16 @@
       )))
 
 
+;; tmp may be on a different filesystem to the tests, but, ehh.
+(defvar xref--case-insensitive
+  (let ((dir (make-temp-file "xref-test" t)))
+    (unwind-protect
+        (progn
+          (with-temp-file (expand-file-name "hElLo" dir) "hello")
+          (file-exists-p (expand-file-name "HELLO" dir)))
+      (delete-directory dir t)))
+  "Non-nil if file system seems to be case-insensitive.")
+
 (defun xref-elisp-test-run (xrefs expected-xrefs)
   (should (= (length xrefs) (length expected-xrefs)))
   (while xrefs
@@ -307,11 +317,13 @@
            (expected-source (when (consp expected) (cdr expected))))
 
       ;; Downcase the filenames for case-insensitive file systems.
-      (setf (xref-elisp-location-file (oref xref location))
-            (downcase (xref-elisp-location-file (oref xref location))))
+      (when xref--case-insensitive
+        (setf (xref-elisp-location-file (oref xref location))
+              (downcase (xref-elisp-location-file (oref xref location))))
 
-      (setf (xref-elisp-location-file (oref expected-xref location))
-            (downcase (xref-elisp-location-file (oref expected-xref 
location))))
+        (setf (xref-elisp-location-file (oref expected-xref location))
+              (downcase (xref-elisp-location-file
+                         (oref expected-xref location)))))
 
       (should (equal xref expected-xref))
 
@@ -346,10 +358,10 @@ to (xref-elisp-test-descr-to-target xref)."
 ;; `load-path' has the correct case, so this causes the expected test
 ;; values to have the wrong case). This is handled in
 ;; `xref-elisp-test-run'.
-(defconst emacs-test-dir
-  (downcase
-   (file-truename (file-name-directory
-                  (or load-file-name (buffer-file-name))))))
+(defvar emacs-test-dir
+  (funcall (if xref--case-insensitive 'downcase 'identity)
+           (file-truename (file-name-directory
+                           (or load-file-name (buffer-file-name))))))
 
 
 ;; alphabetical by test name
diff --git a/test/lisp/progmodes/etags-tests.el 
b/test/lisp/progmodes/etags-tests.el
index b4a853e..ac059c3 100644
--- a/test/lisp/progmodes/etags-tests.el
+++ b/test/lisp/progmodes/etags-tests.el
@@ -1,6 +1,6 @@
 ;;; etags-tests.el --- Test suite for etags.el.
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii <address@hidden>
 
diff --git a/test/lisp/progmodes/f90-tests.el b/test/lisp/progmodes/f90-tests.el
index 28a1c69..b164238 100644
--- a/test/lisp/progmodes/f90-tests.el
+++ b/test/lisp/progmodes/f90-tests.el
@@ -1,6 +1,6 @@
 ;;; f90-tests.el --- tests for progmodes/f90.el
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Glenn Morris <address@hidden>
 
@@ -98,7 +98,7 @@ end subroutine test")
     (insert "(/ x /)")
     (f90-do-auto-fill)
     (beginning-of-line)
-    (skip-chars-forward "[ \t]")
+    (skip-chars-forward " \t")
     (should (equal "&(/" (buffer-substring (point) (+ 3 (point)))))))
 
 ;; TODO bug#5593
diff --git a/test/lisp/progmodes/flymake-resources/Makefile 
b/test/lisp/progmodes/flymake-resources/Makefile
index 4944075..05399ba 100644
--- a/test/lisp/progmodes/flymake-resources/Makefile
+++ b/test/lisp/progmodes/flymake-resources/Makefile
@@ -8,6 +8,6 @@ CC_OPTS = -Wall -Wextra
 ## normally use flymake, so it seems like just avoiding the issue
 ## in this test is fine.  Set flymake-log-level to 3 to investigate.
 check-syntax:
-       GCC_COLORS= $(CC) $(CC_OPTS) ${CHK_SOURCES} || true
+       GCC_COLORS= gcc $(CC_OPTS) ${CHK_SOURCES} || true
 
 # eof
diff --git a/test/lisp/progmodes/flymake-tests.el 
b/test/lisp/progmodes/flymake-tests.el
index bba1f12..629cdf9 100644
--- a/test/lisp/progmodes/flymake-tests.el
+++ b/test/lisp/progmodes/flymake-tests.el
@@ -1,6 +1,6 @@
 ;;; flymake-tests.el --- Test suite for flymake -*- lexical-binding: t -*-
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Eduard Wiebe <address@hidden>
 
@@ -53,7 +53,7 @@
            while notdone
            unless noninteractive do (read-event "" nil 0.1)
            do (sleep-for (+ 0.5 flymake-no-changes-timeout))
-           finally (when notdone (ert-fail
+           finally (when notdone (ert-skip
                                   (format "Some backends not reporting yet %s"
                                           notdone)))))
 
diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el
index 5836e3b..b654979 100644
--- a/test/lisp/progmodes/js-tests.el
+++ b/test/lisp/progmodes/js-tests.el
@@ -1,6 +1,6 @@
 ;;; js-tests.el --- Test suite for js-mode
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/python-tests.el 
b/test/lisp/progmodes/python-tests.el
index 0b9f848..94c846e 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -1,6 +1,6 @@
 ;;; python-tests.el --- Test suite for python.el
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -1161,10 +1161,13 @@ def b()
 if do:
     something()
     else
+outside
 "
    (python-tests-look-at "else")
    (goto-char (line-end-position))
    (python-tests-self-insert ":")
+   (should (= (current-indentation) 0))
+   (python-tests-look-at "outside")
    (should (= (current-indentation) 0))))
 
 (ert-deftest python-indent-electric-colon-3 ()
diff --git a/test/lisp/progmodes/ruby-mode-tests.el 
b/test/lisp/progmodes/ruby-mode-tests.el
index 72d83af..efbe012 100644
--- a/test/lisp/progmodes/ruby-mode-tests.el
+++ b/test/lisp/progmodes/ruby-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; ruby-mode-tests.el --- Test suite for ruby-mode
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -718,6 +718,96 @@ VALUES-PLIST is a list with alternating index and value 
elements."
     (ruby-backward-sexp)
     (should (= 2 (line-number-at-pos)))))
 
+(ert-deftest ruby-forward-sexp-jumps-do-end-block-with-no-args ()
+  (ruby-with-temp-buffer
+    (ruby-test-string
+     "proc do
+     |end")
+    (search-backward "do\n")
+    (ruby-forward-sexp)
+    (should (eobp))))
+
+(ert-deftest ruby-backward-sexp-jumps-do-end-block-with-no-args ()
+  (ruby-with-temp-buffer
+    (ruby-test-string
+     "proc do
+     |end")
+    (goto-char (point-max))
+    (ruby-backward-sexp)
+    (should (looking-at "do$"))))
+
+(ert-deftest ruby-forward-sexp-jumps-do-end-block-with-empty-args ()
+  (ruby-with-temp-buffer
+    (ruby-test-string
+     "proc do ||
+     |end")
+    (search-backward "do ")
+    (ruby-forward-sexp)
+    (should (eobp))))
+
+(ert-deftest ruby-backward-sexp-jumps-do-end-block-with-empty-args ()
+  (ruby-with-temp-buffer
+    (ruby-test-string
+     "proc do ||
+     |end")
+    (goto-char (point-max))
+    (ruby-backward-sexp)
+    (should (looking-at "do "))))
+
+(ert-deftest ruby-forward-sexp-jumps-do-end-block-with-args ()
+  (ruby-with-temp-buffer
+    (ruby-test-string
+     "proc do |a,b|
+     |end")
+    (search-backward "do ")
+    (ruby-forward-sexp)
+    (should (eobp))))
+
+(ert-deftest ruby-backward-sexp-jumps-do-end-block-with-args ()
+  (ruby-with-temp-buffer
+    (ruby-test-string
+     "proc do |a,b|
+     |end")
+    (goto-char (point-max))
+    (ruby-backward-sexp)
+    (should (looking-at "do "))))
+
+(ert-deftest ruby-forward-sexp-jumps-do-end-block-with-any-args ()
+  (ruby-with-temp-buffer
+    (ruby-test-string
+     "proc do |*|
+     |end")
+    (search-backward "do ")
+    (ruby-forward-sexp)
+    (should (eobp))))
+
+(ert-deftest ruby-forward-sexp-jumps-do-end-block-with-expanded-one-arg ()
+  (ruby-with-temp-buffer
+    (ruby-test-string
+     "proc do |a,|
+     |end")
+    (search-backward "do ")
+    (ruby-forward-sexp)
+    (should (eobp))))
+
+(ert-deftest ruby-forward-sexp-jumps-do-end-block-with-one-and-any-args ()
+  (ruby-with-temp-buffer
+    (ruby-test-string
+     "proc do |a,*|
+     |end")
+    (search-backward "do ")
+    (ruby-forward-sexp)
+    (should (eobp))))
+
+(ert-deftest ruby-backward-sexp-jumps-do-end-block-with-one-and-any-args ()
+  (ruby-with-temp-buffer
+    (ruby-test-string
+     "proc do |a,*|
+     |end")
+    (goto-char (point-max))
+    (ruby-backward-sexp)
+    (should (looking-at "do "))))
+
 (ert-deftest ruby-toggle-string-quotes-quotes-correctly ()
   (let ((pairs
          '(("puts '\"foo\"\\''" . "puts \"\\\"foo\\\"'\"")
diff --git a/test/lisp/progmodes/sql-tests.el b/test/lisp/progmodes/sql-tests.el
index a3484ea..7a11f76 100644
--- a/test/lisp/progmodes/sql-tests.el
+++ b/test/lisp/progmodes/sql-tests.el
@@ -1,6 +1,6 @@
 ;;; sql-tests.el --- Tests for sql.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <address@hidden>
 ;; Keywords:
@@ -53,5 +53,222 @@
           (error "some error"))))
     (should-not (sql-postgres-list-databases))))
 
+;;; Check Connection Password Handling/Wallet
+
+(defvar sql-test-login-params nil)
+(defmacro with-sql-test-connect-harness (id login-params connection expected)
+  "Set-up and tear-down SQL connect related test.
+
+Identify tests by ID.  Set :sql-login dialect attribute to
+LOGIN-PARAMS.  Provide the CONNECTION parameters and the EXPECTED
+string of values passed to the comint function for validation."
+  (declare (indent 2))
+  `(cl-letf
+       ((sql-test-login-params ' ,login-params)
+        ((symbol-function 'sql-comint-test)
+         (lambda (product options &optional buf-name)
+           (with-current-buffer (get-buffer-create buf-name)
+             (insert (pp-to-string (list product options sql-user sql-password 
sql-server sql-database))))))
+        ((symbol-function 'sql-run-test)
+         (lambda (&optional buffer)
+           (interactive "P")
+           (sql-product-interactive 'sqltest buffer)))
+        (sql-user nil)
+        (sql-server nil)
+        (sql-database nil)
+        (sql-product-alist
+         '((ansi)
+           (sqltest
+            :name "SqlTest"
+            :sqli-login sql-test-login-params
+            :sqli-comint-func sql-comint-test)))
+        (sql-connection-alist
+         '((,(format "test-%s" id)
+            ,@connection)))
+        (sql-password-wallet
+         (list
+          (make-temp-file
+           "sql-test-netrc" nil nil
+           (mapconcat #'identity
+                      '("machine aMachine user aUserName password \"netrc-A 
aPassword\""
+                        "machine aServer user aUserName password \"netrc-B 
aPassword\""
+                        "machine aMachine server aServer user aUserName 
password \"netrc-C aPassword\""
+                        "machine aMachine database aDatabase user aUserName 
password \"netrc-D aPassword\""
+                        "machine aDatabase user aUserName password \"netrc-E 
aPassword\""
+                        "machine aMachine server aServer database aDatabase 
user aUserName password \"netrc-F aPassword\""
+                        "machine \"aServer/aDatabase\" user aUserName password 
\"netrc-G aPassword\""
+                        ) "\n")))))
+
+     (let* ((connection ,(format "test-%s" id))
+            (buffername (format "*SQL: ERT TEST <%s>*" connection)))
+       (when (get-buffer buffername)
+         (kill-buffer buffername))
+       (sql-connect connection buffername)
+       (should (get-buffer buffername))
+       (should (string-equal (with-current-buffer buffername (buffer-string)) 
,expected))
+       (when (get-buffer buffername)
+         (kill-buffer buffername))
+       (delete-file (car sql-password-wallet)))))
+
+(ert-deftest sql-test-connect ()
+  "Test of basic `sql-connect'."
+  (with-sql-test-connect-harness 1 (user password server database)
+    ((sql-product 'sqltest)
+     (sql-user "aUserName")
+     (sql-password "test-1 aPassword")
+     (sql-server "aServer")
+     (sql-database "aDatabase"))
+    "(sqltest nil \"aUserName\" \"test-1 aPassword\" \"aServer\" 
\"aDatabase\")\n"))
+
+(ert-deftest sql-test-connect-password-func ()
+  "Test of password function."
+  (with-sql-test-connect-harness 2 (user password server database)
+    ((sql-product 'sqltest)
+     (sql-user "aUserName")
+     (sql-password (lambda () (concat [?t ?e ?s ?t ?- ?2 ?\s
+                                     ?a ?P ?a ?s ?s ?w ?o ?r ?d])))
+     (sql-server "aServer")
+     (sql-database "aDatabase"))
+    "(sqltest nil \"aUserName\" \"test-2 aPassword\" \"aServer\" 
\"aDatabase\")\n"))
+
+(ert-deftest sql-test-connect-wallet-server-database ()
+  "Test of password function."
+  (with-sql-test-connect-harness 3 (user password server database)
+    ((sql-product 'sqltest)
+     (sql-user "aUserName")
+     (sql-server "aServer")
+     (sql-database "aDatabase"))
+    "(sqltest nil \"aUserName\" \"netrc-G aPassword\" \"aServer\" 
\"aDatabase\")\n"))
+
+(ert-deftest sql-test-connect-wallet-database ()
+  "Test of password function."
+  (with-sql-test-connect-harness 4 (user password database)
+    ((sql-product 'sqltest)
+     (sql-user "aUserName")
+     (sql-database "aDatabase"))
+    "(sqltest nil \"aUserName\" \"netrc-E aPassword\" nil \"aDatabase\")\n"))
+
+(ert-deftest sql-test-connect-wallet-server ()
+  "Test of password function."
+  (with-sql-test-connect-harness 5 (user password server)
+    ((sql-product 'sqltest)
+     (sql-user "aUserName")
+     (sql-server "aServer"))
+    "(sqltest nil \"aUserName\" \"netrc-B aPassword\" \"aServer\" nil)\n"))
+
+;;; Set/Get Product Features
+
+(defvar sql-test-feature-value-a nil "Indirect value A.")
+(defvar sql-test-feature-value-b nil "Indirect value B.")
+(defvar sql-test-feature-value-c nil "Indirect value C.")
+(defvar sql-test-feature-value-d nil "Indirect value D.")
+(defmacro sql-test-product-feature-harness (&rest action)
+  "Set-up and tear-down of testing product/feature API.
+
+Perform ACTION and validate results"
+  (declare (indent 2))
+  `(cl-letf
+       ((sql-product-alist
+         (list (list 'a :X 1 :Y 2 :Z 'sql-test-feature-value-a)
+               (list 'b :X 3      :Z 'sql-test-feature-value-b)
+               (list 'c      :Y 6 :Z 'sql-test-feature-value-c)
+               (list 'd :X 7 :Y 8                            )))
+        (sql-indirect-features '(:Z :W))
+        (sql-test-feature-value-a "original A")
+        (sql-test-feature-value-b "original B")
+        (sql-test-feature-value-c "original C")
+        (sql-test-feature-value-d "original D"))
+     ,@action))
+
+(ert-deftest sql-test-add-product ()
+  "Add a product"
+
+  (sql-test-product-feature-harness
+      (sql-add-product 'xyz "XyzDb")
+
+      (should (equal (pp-to-string (assoc 'xyz sql-product-alist))
+                     "(xyz :name \"XyzDb\")\n"))))
+
+(ert-deftest sql-test-add-existing-product ()
+  "Add a product that already exists."
+
+  (sql-test-product-feature-harness
+      (should-error (sql-add-feature 'a "Aaa"))
+      (should (equal (pp-to-string (assoc 'a sql-product-alist))
+                     "(a :X 1 :Y 2 :Z sql-test-feature-value-a)\n"))))
+
+(ert-deftest sql-test-set-feature ()
+  "Add a feature"
+
+  (sql-test-product-feature-harness
+      (sql-set-product-feature 'b :Y 4)
+      (should (equal (pp-to-string (assoc 'b sql-product-alist))
+                     "(b :Y 4 :X 3 :Z sql-test-feature-value-b)\n"))))
+
+(ert-deftest sql-test-set-indirect-feature ()
+  "Set a new indirect feature"
+
+  (sql-test-product-feature-harness
+      (sql-set-product-feature 'd :Z 'sql-test-feature-value-d)
+      (should (equal (pp-to-string (assoc 'd sql-product-alist))
+                     "(d :Z sql-test-feature-value-d :X 7 :Y 8)\n"))))
+
+(ert-deftest sql-test-set-existing-feature ()
+  "Set an existing feature."
+
+  (sql-test-product-feature-harness
+      (sql-set-product-feature 'b :X 33)
+      (should (equal (pp-to-string (assoc 'b sql-product-alist))
+                     "(b :X 33 :Z sql-test-feature-value-b)\n"))))
+
+(ert-deftest sql-test-set-existing-indirect-feature ()
+  "Set an existing indirect feature."
+
+  (sql-test-product-feature-harness
+      (should (equal sql-test-feature-value-b "original B"))
+      (sql-set-product-feature 'b :Z "Hurray!")
+    (should (equal (pp-to-string (assoc 'b sql-product-alist))
+                   "(b :X 3 :Z sql-test-feature-value-b)\n")) ;; unchanged
+    (should (equal sql-test-feature-value-b "Hurray!"))))
+
+(ert-deftest sql-test-set-missing-product ()
+  "Add a feature to a missing product."
+
+  (sql-test-product-feature-harness
+      (should-error (sql-set-product-feature 'x :Y 4))
+      (should-not (assoc 'x sql-product-alist))))
+
+(ert-deftest sql-test-get-feature ()
+  "Get a feature value."
+
+  (sql-test-product-feature-harness
+      (should (equal (sql-get-product-feature 'c :Y) 6))))
+
+(ert-deftest sql-test-get-indirect-feature ()
+  "Get a feature indirect value."
+
+  (sql-test-product-feature-harness
+      (should (equal (sql-get-product-feature 'c :Z nil t) 
'sql-test-feature-value-c))
+      (should (equal sql-test-feature-value-c "original C"))
+    (should (equal (sql-get-product-feature 'c :Z) "original C"))))
+
+(ert-deftest sql-test-get-missing-product ()
+  "Get a feature value from a missing product."
+
+  (sql-test-product-feature-harness
+      (should-error (sql-get-product-feature 'x :Y))))
+
+(ert-deftest sql-test-get-missing-feature ()
+  "Get a missing feature value."
+
+  (sql-test-product-feature-harness
+      (should-not (sql-get-product-feature 'c :X))))
+
+(ert-deftest sql-test-get-missing-indirect-feature ()
+  "Get a missing indirect feature value."
+
+  (sql-test-product-feature-harness
+      (should-not (sql-get-product-feature 'd :Z))))
+
 (provide 'sql-tests)
 ;;; sql-tests.el ends here
diff --git a/test/lisp/progmodes/subword-tests.el 
b/test/lisp/progmodes/subword-tests.el
index fa11500..52e2cac 100644
--- a/test/lisp/progmodes/subword-tests.el
+++ b/test/lisp/progmodes/subword-tests.el
@@ -1,6 +1,6 @@
 ;;; subword-tests.el --- Testing the subword rules
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Stefan Monnier <address@hidden>
 ;; Keywords:
diff --git a/test/lisp/progmodes/tcl-tests.el b/test/lisp/progmodes/tcl-tests.el
index 0614886..50c3eba 100644
--- a/test/lisp/progmodes/tcl-tests.el
+++ b/test/lisp/progmodes/tcl-tests.el
@@ -1,6 +1,6 @@
 ;;; tcl-tests.el --- Test suite for tcl-mode
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/progmodes/xref-tests.el 
b/test/lisp/progmodes/xref-tests.el
index e8441a5..31f4550 100644
--- a/test/lisp/progmodes/xref-tests.el
+++ b/test/lisp/progmodes/xref-tests.el
@@ -1,6 +1,6 @@
 ;;; xref-tests.el --- tests for xref
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Dmitry Gutov <address@hidden>
 
diff --git a/test/lisp/ps-print-tests.el b/test/lisp/ps-print-tests.el
index 3714d84..b9bf92d 100644
--- a/test/lisp/ps-print-tests.el
+++ b/test/lisp/ps-print-tests.el
@@ -1,6 +1,6 @@
 ;;; ps-print-tests.el --- Test suite for ps-print.el  -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Phillip Lord <address@hidden>
 
diff --git a/test/lisp/register-tests.el b/test/lisp/register-tests.el
index 4743764..b939ae8 100644
--- a/test/lisp/register-tests.el
+++ b/test/lisp/register-tests.el
@@ -1,6 +1,6 @@
 ;;; register-tests.el --- tests for register.el  -*- lexical-binding: t-*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <address@hidden>
 ;; Keywords:
diff --git a/test/lisp/replace-tests.el b/test/lisp/replace-tests.el
index 5a91a2c..ed948ad 100644
--- a/test/lisp/replace-tests.el
+++ b/test/lisp/replace-tests.el
@@ -1,6 +1,6 @@
 ;;; replace-tests.el --- tests for replace.el.
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Richard <address@hidden>
 ;; Author: Juri Linkov <address@hidden>
diff --git a/test/lisp/rot13-tests.el b/test/lisp/rot13-tests.el
index f91f00b..851ab7b 100644
--- a/test/lisp/rot13-tests.el
+++ b/test/lisp/rot13-tests.el
@@ -1,6 +1,6 @@
 ;;; rot13-tests.el --- Tests for rot13.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <address@hidden>
 ;; Keywords:
diff --git a/test/lisp/ses-tests.el b/test/lisp/ses-tests.el
index c773c9b..8b07a55 100644
--- a/test/lisp/ses-tests.el
+++ b/test/lisp/ses-tests.el
@@ -1,6 +1,6 @@
 ;;; ses-tests.el --- Tests for ses.el              -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Vincent Belaïche <address@hidden>
 
diff --git a/test/lisp/shadowfile-tests.el b/test/lisp/shadowfile-tests.el
index 3bab22f..2a777af 100644
--- a/test/lisp/shadowfile-tests.el
+++ b/test/lisp/shadowfile-tests.el
@@ -1,6 +1,6 @@
 ;;; shadowfile-tests.el --- Tests of shadowfile
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 
diff --git a/test/lisp/shell-tests.el b/test/lisp/shell-tests.el
index 105701e..329f5cf 100644
--- a/test/lisp/shell-tests.el
+++ b/test/lisp/shell-tests.el
@@ -1,6 +1,6 @@
 ;;; shell-tests.el  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2010-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2010-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -30,4 +30,12 @@
   "Test problem found by Filipp Gunbin in emacs-devel."
   (should (equal (car (shell--unquote&requote-argument "te'st" 2)) "test")))
 
+(ert-deftest shell-tests-completion-before-semi ()
+  (with-temp-buffer
+    (shell-mode)
+    (insert "cd ba;")
+    (forward-char -1)
+    (should (equal (shell--parse-pcomplete-arguments)
+                   '(("cd" "ba") 1 4)))))
+
 ;;; shell-tests.el ends here
diff --git a/test/lisp/simple-tests.el b/test/lisp/simple-tests.el
index 417aa64..d9f059c 100644
--- a/test/lisp/simple-tests.el
+++ b/test/lisp/simple-tests.el
@@ -1,6 +1,6 @@
 ;;; simple-test.el --- Tests for simple.el           -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <address@hidden>
 
@@ -214,6 +214,40 @@
       (remove-hook 'post-self-insert-hook inc))))
 
 
+;;; `delete-indentation'
+(ert-deftest simple-delete-indentation-no-region ()
+  "delete-indentation works when no mark is set."
+  ;; interactive \r returns nil for BEG END args
+  (unwind-protect
+      (with-temp-buffer
+        (insert (concat "zero line \n"
+                        "first line \n"
+                        "second line"))
+        (delete-indentation)
+        (should (string-equal
+                 (buffer-string)
+                 (concat "zero line \n"
+                         "first line second line")))
+        )))
+
+(ert-deftest simple-delete-indentation-inactive-region ()
+  "delete-indentation ignores inactive region."
+  ;; interactive \r returns non-nil for BEG END args
+  (unwind-protect
+      (with-temp-buffer
+        (insert (concat "zero line \n"
+                        "first line \n"
+                        "second line"))
+        (push-mark (point-min) t t)
+        (deactivate-mark)
+        (delete-indentation)
+        (should (string-equal
+                 (buffer-string)
+                 (concat "zero line \n"
+                         "first line second line")))
+        )))
+
+
 ;;; `delete-trailing-whitespace'
 (ert-deftest simple-delete-trailing-whitespace--bug-21766 ()
   "Test bug#21766: delete-whitespace sometimes deletes non-whitespace."
diff --git a/test/lisp/sort-tests.el b/test/lisp/sort-tests.el
index e875af9..8694ce4 100644
--- a/test/lisp/sort-tests.el
+++ b/test/lisp/sort-tests.el
@@ -1,6 +1,6 @@
 ;;; sort-tests.el --- Tests for sort.el              -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Artur Malabarba <address@hidden>
 
diff --git a/test/lisp/soundex-tests.el b/test/lisp/soundex-tests.el
index 571253e..d8d79b8 100644
--- a/test/lisp/soundex-tests.el
+++ b/test/lisp/soundex-tests.el
@@ -1,6 +1,6 @@
 ;;; soundex-tests.el --- tests for soundex.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 
diff --git a/test/lisp/subr-tests.el b/test/lisp/subr-tests.el
index f218a76..7465aac 100644
--- a/test/lisp/subr-tests.el
+++ b/test/lisp/subr-tests.el
@@ -1,6 +1,6 @@
 ;;; subr-tests.el --- Tests for subr.el
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Oleh Krehel <address@hidden>,
 ;;         Nicolas Petton <address@hidden>
@@ -372,5 +372,24 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350.";
                             (shell-quote-argument "%ca%")))
                    "without-caret %ca%"))))
 
+(ert-deftest subr-tests-flatten-tree ()
+  "Test `flatten-tree' behavior."
+  (should (equal (flatten-tree '(1 (2 . 3) nil (4 5 (6)) 7))
+                 '(1 2 3 4 5 6 7)))
+  (should (equal (flatten-tree '((1 . 2)))
+                 '(1 2)))
+  (should (equal (flatten-tree '(1 nil 2))
+                 '(1 2)))
+  (should (equal (flatten-tree 42)
+                 '(42)))
+  (should (equal (flatten-tree t)
+                 '(t)))
+  (should (equal (flatten-tree nil)
+                 nil))
+  (should (equal (flatten-tree '((nil) ((((nil)))) nil))
+                 nil))
+  (should (equal (flatten-tree '(1 ("foo" "bar") 2))
+                 '(1 "foo" "bar" 2))))
+
 (provide 'subr-tests)
 ;;; subr-tests.el ends here
diff --git a/test/lisp/tar-mode-tests.el b/test/lisp/tar-mode-tests.el
index f36fc71..1fce200 100644
--- a/test/lisp/tar-mode-tests.el
+++ b/test/lisp/tar-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; tar-mode-tests.el --- Test suite for tar-mode. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -21,6 +21,8 @@
 (require 'ert)
 (require 'tar-mode)
 
+(defvar tar-mode-tests-data-directory
+  (expand-file-name "test/data/decompress" source-directory))
 
 (ert-deftest tar-mode-test-tar-grind-file-mode ()
   (let ((alist (list (cons 448 "rwx------")
@@ -31,6 +33,17 @@
     (dolist (x alist)
       (should (equal (cdr x) (tar-grind-file-mode (car x)))))))
 
+(ert-deftest tar-mode-test-tar-extract-gz ()
+  (skip-unless (executable-find "gzip"))
+  (let* ((tar-file (expand-file-name "tg.tar.gz" 
tar-mode-tests-data-directory))
+         tar-buffer gz-buffer)
+    (unwind-protect
+        (with-current-buffer (setq tar-buffer (find-file-noselect tar-file))
+          (setq gz-buffer (tar-extract))
+          (should (equal (char-after) ?\N{SNOWFLAKE})))
+      (when (buffer-live-p tar-buffer) (kill-buffer tar-buffer))
+      (when (buffer-live-p gz-buffer) (kill-buffer gz-buffer)))))
+
 (provide 'tar-mode-tests)
 
 ;; tar-mode-tests.el ends here
diff --git a/test/lisp/term-tests.el b/test/lisp/term-tests.el
index ebf48d5..9f5dcd5 100644
--- a/test/lisp/term-tests.el
+++ b/test/lisp/term-tests.el
@@ -1,6 +1,6 @@
 ;;; term-tests.el --- tests for term.el  -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017 Free Software Foundation, Inc.
+;; Copyright (C) 2017, 2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/textmodes/conf-mode-tests.el 
b/test/lisp/textmodes/conf-mode-tests.el
new file mode 100644
index 0000000..3eefc8f
--- /dev/null
+++ b/test/lisp/textmodes/conf-mode-tests.el
@@ -0,0 +1,204 @@
+;;; conf-mode-tests.el --- Test suite for conf mode  -*- lexical-binding: t; 
-*-
+
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
+
+;; Author: J. Alexander Branham <address@hidden>
+;; Keywords: internal
+
+;; This file is part of GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+(require 'conf-mode)
+(require 'ert)
+
+(ert-deftest conf-test-align-assignments ()
+  "Test for `conf-align-assignments'."
+  (with-temp-buffer
+    (insert "foo: bar\nbar: baz")
+    (conf-colon-mode)
+    (conf-align-assignments)
+    (should (equal (buffer-string)
+                   "foo:                       bar\nbar:                       
baz"))))
+
+(ert-deftest conf-test-font-lock ()
+  (with-temp-buffer
+    (insert "foo: bar\nbar: baz")
+    (conf-colon-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (goto-char (point-min))
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (search-forward "bar")
+    (should-not (face-at-point))))
+
+(ert-deftest conf-test-windows-mode ()
+  (with-temp-buffer
+    ;; from `conf-windows-mode' docstring:
+    (insert "[ExtShellFolderViews]
+Default={5984FFE0-28D4-11CF-AE66-08002B2E1262}
+{5984FFE0-28D4-11CF-AE66-08002B2E1262}={5984FFE0-28D4-11CF-AE66-08002B2E1262}
+
+[{5984FFE0-28D4-11CF-AE66-08002B2E1262}]
+PersistMoniker=file://Folder.htt")
+    (goto-char (point-min))
+    (conf-windows-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (search-forward "ExtShell")
+    (should (equal (face-at-point) 'font-lock-type-face))
+    (search-forward "Defau")
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (forward-line)
+    (beginning-of-line)
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (forward-line 2)
+    (should-not (face-at-point))
+    (forward-char)
+    (should (equal (face-at-point) 'font-lock-type-face))))
+
+(ert-deftest conf-test-javaprop-mode ()
+  (with-temp-buffer
+    ;; From `conf-javaprop-mode' docstring
+    (insert "// another kind of comment
+/* yet another */
+
+name:value
+name=value
+name value
+x.1 =
+x.2.y.1.z.1 =
+x.2.y.1.z.2.zz =")
+    (goto-char (point-min))
+    (conf-javaprop-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (should (equal (face-at-point) 'font-lock-comment-delimiter-face))
+    (forward-char 3)
+    (should (equal (face-at-point) 'font-lock-comment-face))
+    (search-forward "*")
+    (should (equal (face-at-point) 'font-lock-comment-delimiter-face))
+    (while (search-forward "nam" nil t)
+      (should (equal (face-at-point) 'font-lock-variable-name-face))
+      (search-forward "val")
+      (should-not (face-at-point)))
+    (while (re-search-forward "a-z" nil t)
+      (backward-char)
+      (should (equal (face-at-point) 'font-lock-variable-name-face))
+      (re-search-forward "[0-0]" nil t)
+      (backward-char)
+      (should (equal (face-at-point) 'font-lock-constant-face)))))
+
+(ert-deftest conf-test-space-mode ()
+  ;; From `conf-space-mode' docstring.
+  (with-temp-buffer
+    (insert "image/jpeg                        jpeg jpg jpe
+image/png                      png
+image/tiff                     tiff tif
+")
+    (goto-char (point-min))
+    (conf-space-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (forward-char 15)
+    (should-not (face-at-point))))
+
+(ert-deftest conf-test-colon-mode ()
+  ;; From `conf-colon-mode' docstring.
+  (with-temp-buffer
+    (insert "<Multi_key> <exclam> <exclam>             : \"\\241\"     
exclamdown
+<Multi_key> <c> <slash>                        : \"\\242\"     cent")
+    (goto-char (point-min))
+    (conf-colon-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (search-forward "24")
+    (should (equal (face-at-point) 'font-lock-string-face))
+    (forward-line)
+    (should (equal (face-at-point) 'font-lock-variable-name-face))))
+
+(ert-deftest conf-test-ppd-mode ()
+  ;; From `conf-ppd-mode' docstring.
+  (with-temp-buffer
+    (insert "*DefaultTransfer: Null
+*Transfer Null.Inverse: \"{ 1 exch sub }\"")
+    (goto-char (point-min))
+    (conf-ppd-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (search-forward "Nul")
+    (should-not (face-at-point))))
+
+(ert-deftest conf-test-xdefaults-mode ()
+  ;; From `conf-xdefaults-mode' docstring.
+  (with-temp-buffer
+    (insert "*background:                      gray99
+*foreground:                   black")
+    (goto-char (point-min))
+    (conf-xdefaults-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (search-forward "gray")
+    (should-not (face-at-point))))
+
+(ert-deftest conf-test-toml-mode ()
+  ;; From `conf-toml-mode' docstring.
+  (with-temp-buffer
+    (insert "\[entry]
+value = \"some string\"")
+    (goto-char (point-min))
+    (conf-toml-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (should-not (face-at-point))
+    (forward-char)
+    (should (equal (face-at-point) 'font-lock-type-face))
+    (forward-line)
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (search-forward "som")
+    (should (equal (face-at-point) 'font-lock-string-face))))
+
+(ert-deftest conf-test-desktop-mode ()
+  ;; From `conf-desktop-mode' dostring.
+  (with-temp-buffer
+    (insert "  [Desktop Entry]
+       Name=GNU Image Manipulation Program
+       Name[oc]=Editor d'imatge GIMP
+       Exec=gimp-2.8 %U
+       Terminal=false")
+    (goto-char (point-min))
+    (conf-desktop-mode)
+    (font-lock-mode)
+    (font-lock-ensure)
+    (search-forward "Desk")
+    (should (equal (face-at-point) 'font-lock-type-face))
+    (search-forward "Nam")
+    (should (equal (face-at-point) 'font-lock-variable-name-face))
+    (forward-char 2)
+    (should-not (face-at-point))
+    (search-forward "[")
+    (should (equal (face-at-point) 'font-lock-constant-face))))
+
+
+
+(provide 'conf-mode-tests)
+
+;;; conf-mode-tests.el ends here
diff --git a/test/lisp/textmodes/css-mode-tests.el 
b/test/lisp/textmodes/css-mode-tests.el
index bfae1bf..98dac74 100644
--- a/test/lisp/textmodes/css-mode-tests.el
+++ b/test/lisp/textmodes/css-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; css-mode-tests.el --- Test suite for CSS mode  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Simen Heggestøyl <address@hidden>
 ;; Keywords: internal
diff --git a/test/lisp/textmodes/dns-mode-tests.el 
b/test/lisp/textmodes/dns-mode-tests.el
index 565fde3..2e8bb59 100644
--- a/test/lisp/textmodes/dns-mode-tests.el
+++ b/test/lisp/textmodes/dns-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; dns-mode-tests.el --- Test suite for dns-mode  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Peder O. Klingenberg <address@hidden>
 ;; Keywords: dns zone
diff --git a/test/lisp/textmodes/fill-tests.el 
b/test/lisp/textmodes/fill-tests.el
index a2bcde4..0872874 100644
--- a/test/lisp/textmodes/fill-tests.el
+++ b/test/lisp/textmodes/fill-tests.el
@@ -1,6 +1,6 @@
 ;;; fill-test.el --- ERT tests for fill.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author:     Marcin Borkowski <address@hidden>
 ;; Keywords:   text, wp
diff --git a/test/lisp/textmodes/mhtml-mode-tests.el 
b/test/lisp/textmodes/mhtml-mode-tests.el
index b20cda7..d6a184a 100644
--- a/test/lisp/textmodes/mhtml-mode-tests.el
+++ b/test/lisp/textmodes/mhtml-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; mhtml-mode-tests.el --- Tests for mhtml-mode
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Keywords: tests
 
diff --git a/test/lisp/textmodes/reftex-tests.el 
b/test/lisp/textmodes/reftex-tests.el
index 28a0f62..ba6f1e0 100644
--- a/test/lisp/textmodes/reftex-tests.el
+++ b/test/lisp/textmodes/reftex-tests.el
@@ -1,6 +1,6 @@
 ;;; reftex-tests.el --- Test suite for reftex. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Rüdiger Sonderfeld <address@hidden>
 ;; Keywords:       internal
diff --git a/test/lisp/textmodes/sgml-mode-tests.el 
b/test/lisp/textmodes/sgml-mode-tests.el
index 6c0070c..61ae87e 100644
--- a/test/lisp/textmodes/sgml-mode-tests.el
+++ b/test/lisp/textmodes/sgml-mode-tests.el
@@ -1,6 +1,6 @@
 ;;; sgml-mode-tests.el --- Tests for sgml-mode
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Przemysław Wojnowski <address@hidden>
 ;; Keywords: tests
diff --git a/test/lisp/textmodes/tildify-tests.el 
b/test/lisp/textmodes/tildify-tests.el
index a7368ae..eb23174 100644
--- a/test/lisp/textmodes/tildify-tests.el
+++ b/test/lisp/textmodes/tildify-tests.el
@@ -1,6 +1,6 @@
 ;;; tildify-test.el --- ERT tests for tildify.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author:     Michal Nazarewicz <address@hidden>
 ;; Version:    4.5
diff --git a/test/lisp/thingatpt-tests.el b/test/lisp/thingatpt-tests.el
index aa29924..347cc7f 100644
--- a/test/lisp/thingatpt-tests.el
+++ b/test/lisp/thingatpt-tests.el
@@ -1,6 +1,6 @@
 ;;; thingatpt.el --- tests for thing-at-point.
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/thread-tests.el b/test/lisp/thread-tests.el
index 0d57d38..3f7beed 100644
--- a/test/lisp/thread-tests.el
+++ b/test/lisp/thread-tests.el
@@ -1,6 +1,6 @@
 ;;; thread-tests.el --- Test suite for thread.el  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: Gemini Lasswell <address@hidden>
 ;; Keywords: threads
diff --git a/test/lisp/url/url-auth-tests.el b/test/lisp/url/url-auth-tests.el
index 1307553..7eaf13f 100644
--- a/test/lisp/url/url-auth-tests.el
+++ b/test/lisp/url/url-auth-tests.el
@@ -1,6 +1,6 @@
 ;;; url-auth-tests.el --- Test suite for url-auth.
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Jarno Malmari <address@hidden>
 
diff --git a/test/lisp/url/url-expand-tests.el 
b/test/lisp/url/url-expand-tests.el
index d58485d..23f1179 100644
--- a/test/lisp/url/url-expand-tests.el
+++ b/test/lisp/url/url-expand-tests.el
@@ -1,6 +1,6 @@
 ;;; url-expand-tests.el --- Test suite for relative URI/URL resolution.
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Alain Schneble <address@hidden>
 ;; Version: 1.0
diff --git a/test/lisp/url/url-file-tests.el b/test/lisp/url/url-file-tests.el
index 969bca7..45af1bb 100644
--- a/test/lisp/url/url-file-tests.el
+++ b/test/lisp/url/url-file-tests.el
@@ -1,6 +1,6 @@
 ;;; url-file-tests.el --- Test suite for url-file. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/url/url-future-tests.el 
b/test/lisp/url/url-future-tests.el
index 0e14a99..17c32fd 100644
--- a/test/lisp/url/url-future-tests.el
+++ b/test/lisp/url/url-future-tests.el
@@ -1,6 +1,6 @@
 ;;; url-future-tests.el --- Test suite for url-future.
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Teodor Zlatanov <address@hidden>
 ;; Keywords: data
diff --git a/test/lisp/url/url-handlers-test.el 
b/test/lisp/url/url-handlers-test.el
index 5822e16..1613f87 100644
--- a/test/lisp/url/url-handlers-test.el
+++ b/test/lisp/url/url-handlers-test.el
@@ -1,6 +1,6 @@
 ;;; url-handlers-test.el --- Test suite for url-handlers.el  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Petton <address@hidden>
 
diff --git a/test/lisp/url/url-misc-tests.el b/test/lisp/url/url-misc-tests.el
index fec2609..7bee22d 100644
--- a/test/lisp/url/url-misc-tests.el
+++ b/test/lisp/url/url-misc-tests.el
@@ -1,6 +1,6 @@
 ;;; url-misc-tests.el --- Test suite for url-misc. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/url/url-parse-tests.el b/test/lisp/url/url-parse-tests.el
index 63923ac..b2b6161 100644
--- a/test/lisp/url/url-parse-tests.el
+++ b/test/lisp/url/url-parse-tests.el
@@ -1,6 +1,6 @@
 ;;; url-parse-tests.el --- Test suite for URI/URL parsing.
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Alain Schneble <address@hidden>
 ;; Version: 1.0
diff --git a/test/lisp/url/url-tramp-tests.el b/test/lisp/url/url-tramp-tests.el
index 4566cd3..bf657a8 100644
--- a/test/lisp/url/url-tramp-tests.el
+++ b/test/lisp/url/url-tramp-tests.el
@@ -1,6 +1,6 @@
 ;;; url-tramp-tests.el --- Test suite for Tramp / URL conversion.
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 
diff --git a/test/lisp/url/url-util-tests.el b/test/lisp/url/url-util-tests.el
index 2e2875a..69117b8 100644
--- a/test/lisp/url/url-util-tests.el
+++ b/test/lisp/url/url-util-tests.el
@@ -1,6 +1,6 @@
 ;;; url-util-tests.el --- Test suite for url-util.
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Teodor Zlatanov <address@hidden>
 ;; Keywords: data
diff --git a/test/lisp/vc/add-log-tests.el b/test/lisp/vc/add-log-tests.el
index cced7e4..21b82ff 100644
--- a/test/lisp/vc/add-log-tests.el
+++ b/test/lisp/vc/add-log-tests.el
@@ -1,6 +1,6 @@
 ;;; add-log-tests.el --- Test suite for add-log.
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Masatake YAMATO <address@hidden>
 ;; Keywords: vc tools
diff --git a/test/lisp/vc/diff-mode-tests.el b/test/lisp/vc/diff-mode-tests.el
index 7900e41..676d461 100644
--- a/test/lisp/vc/diff-mode-tests.el
+++ b/test/lisp/vc/diff-mode-tests.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Dima Kogan <address@hidden>
 ;; Maintainer: address@hidden
@@ -21,7 +21,10 @@
 ;;; Code:
 
 (require 'diff-mode)
+(require 'diff)
 
+(defconst diff-mode-tests--datadir
+  (expand-file-name "test/data/vc/diff-mode" source-directory))
 
 (ert-deftest diff-mode-test-ignore-trailing-dashes ()
   "Check to make sure we successfully ignore trailing -- made by
@@ -199,5 +202,118 @@ youthfulness
           (kill-buffer buf2)
           (delete-directory temp-dir 'recursive))))))
 
+(ert-deftest diff-mode-test-font-lock ()
+  "Check font-locking of diff hunks."
+  (skip-unless (executable-find shell-file-name))
+  (skip-unless (executable-find diff-command))
+  (let ((default-directory diff-mode-tests--datadir)
+        (old "hello_world.c")
+        (new "hello_emacs.c")
+        (diff-buffer (get-buffer-create "*Diff*"))
+        (diff-refine 'font-lock)
+        (diff-font-lock-syntax t)
+        diff-beg)
+    (diff-no-select old new '("-u") 'no-async diff-buffer)
+    (with-current-buffer diff-buffer
+      (font-lock-ensure)
+      (narrow-to-region (progn (diff-hunk-next)
+                               (setq diff-beg (diff-beginning-of-hunk)))
+                        (diff-end-of-hunk))
+
+      (should (equal-including-properties
+               (buffer-string)
+               #("@@ -1,6 +1,6 @@
+ #include <stdio.h>
+ int main()
+ {
+-  printf(\"Hello, World!\\n\");
++  printf(\"Hello, Emacs!\\n\");
+   return 0;
+ }
+"
+                 0 15 (face diff-hunk-header)
+                 16 36 (face diff-context)
+                 36 48 (face diff-context)
+                 48 51 (face diff-context)
+                 51 52 (face diff-indicator-removed)
+                 52 81 (face diff-removed)
+                 81 82 (face diff-indicator-added)
+                 82 111 (face diff-added)
+                 111 124 (face diff-context)
+                 124 127 (face diff-context))))
+
+      (should (equal (mapcar (lambda (o)
+                               (list (- (overlay-start o) diff-beg)
+                                     (- (overlay-end o) diff-beg)
+                                     (append (and (overlay-get o 'diff-mode)
+                                                  `(diff-mode ,(overlay-get o 
'diff-mode)))
+                                             (and (overlay-get o 'face)
+                                                  `(face ,(overlay-get o 
'face))))))
+                             (sort (overlays-in (point-min) (point-max))
+                                   (lambda (a b) (< (overlay-start a) 
(overlay-start b)))))
+                     '((0 127 (diff-mode fine))
+                       (0 127 (diff-mode syntax))
+                       (17 25 (diff-mode syntax face 
font-lock-preprocessor-face))
+                       (26 35 (diff-mode syntax face font-lock-string-face))
+                       (37 40 (diff-mode syntax face font-lock-type-face))
+                       (41 45 (diff-mode syntax face 
font-lock-function-name-face))
+                       (61 78 (diff-mode syntax face font-lock-string-face))
+                       (69 74 (diff-mode fine face diff-refine-removed))
+                       (91 108 (diff-mode syntax face font-lock-string-face))
+                       (99 104 (diff-mode fine face diff-refine-added))
+                       (114 120 (diff-mode syntax face 
font-lock-keyword-face))))))))
+
+(ert-deftest diff-mode-test-font-lock-syntax-one-line ()
+  "Check diff syntax highlighting for one line with no newline at end."
+  (skip-unless (executable-find shell-file-name))
+  (skip-unless (executable-find diff-command))
+  (let ((default-directory diff-mode-tests--datadir)
+        (old "hello_world_1.c")
+        (new "hello_emacs_1.c")
+        (diff-buffer (get-buffer-create "*Diff*"))
+        (diff-refine nil)
+        (diff-font-lock-syntax t)
+        diff-beg)
+    (diff-no-select old new '("-u") 'no-async diff-buffer)
+    (with-current-buffer diff-buffer
+      (font-lock-ensure)
+      (narrow-to-region (progn (diff-hunk-next)
+                               (setq diff-beg (diff-beginning-of-hunk)))
+                        (diff-end-of-hunk))
+
+      (should (equal-including-properties
+               (buffer-string)
+               #("@@ -1 +1 @@
+-int main() { printf(\"Hello, World!\\n\"); return 0; }
+\\ No newline at end of file
++int main() { printf(\"Hello, Emacs!\\n\"); return 0; }
+\\ No newline at end of file
+"
+                 0 11 (face diff-hunk-header)
+                 12 13 (face diff-indicator-removed)
+                 13 65 (face diff-removed)
+                 65 93 (face diff-context)
+                 93 94 (face diff-indicator-added)
+                 94 146 (face diff-added)
+                 146 174 (face diff-context))))
+
+      (should (equal (mapcar (lambda (o)
+                               (list (- (overlay-start o) diff-beg)
+                                     (- (overlay-end o) diff-beg)
+                                     (append (and (overlay-get o 'diff-mode)
+                                                  `(diff-mode ,(overlay-get o 
'diff-mode)))
+                                             (and (overlay-get o 'face)
+                                                  `(face ,(overlay-get o 
'face))))))
+                             (sort (overlays-in (point-min) (point-max))
+                                   (lambda (a b) (< (overlay-start a) 
(overlay-start b)))))
+                     '((0 174 (diff-mode syntax))
+                       (13 16 (diff-mode syntax face font-lock-type-face))
+                       (17 21 (diff-mode syntax face 
font-lock-function-name-face))
+                       (33 50 (diff-mode syntax face font-lock-string-face))
+                       (53 59 (diff-mode syntax face font-lock-keyword-face))
+                       (94 97 (diff-mode syntax face font-lock-type-face))
+                       (98 102 (diff-mode syntax face 
font-lock-function-name-face))
+                       (114 131 (diff-mode syntax face font-lock-string-face))
+                       (134 140 (diff-mode syntax face 
font-lock-keyword-face))))))))
 
 (provide 'diff-mode-tests)
diff --git a/test/lisp/vc/ediff-diff-tests.el b/test/lisp/vc/ediff-diff-tests.el
index bd9f018..b414862 100644
--- a/test/lisp/vc/ediff-diff-tests.el
+++ b/test/lisp/vc/ediff-diff-tests.el
@@ -1,6 +1,6 @@
 ;;; ediff-diff-tests.el --- Unit tests for ediff-diff.el  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <address@hidden>
 
diff --git a/test/lisp/vc/ediff-ptch-tests.el b/test/lisp/vc/ediff-ptch-tests.el
index 123fae5..73e1098 100644
--- a/test/lisp/vc/ediff-ptch-tests.el
+++ b/test/lisp/vc/ediff-ptch-tests.el
@@ -1,6 +1,6 @@
 ;;; ediff-ptch-tests.el --- Tests for ediff-ptch.el
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Tino Calancha <address@hidden>
 
diff --git a/test/lisp/vc/smerge-mode-tests.el 
b/test/lisp/vc/smerge-mode-tests.el
index 6004c58..032afa9 100644
--- a/test/lisp/vc/smerge-mode-tests.el
+++ b/test/lisp/vc/smerge-mode-tests.el
@@ -1,4 +1,4 @@
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 
diff --git a/test/lisp/vc/vc-bzr-tests.el b/test/lisp/vc/vc-bzr-tests.el
index 6b96f3b..8fa16cd 100644
--- a/test/lisp/vc/vc-bzr-tests.el
+++ b/test/lisp/vc/vc-bzr-tests.el
@@ -1,6 +1,6 @@
 ;;; vc-bzr.el --- tests for vc/vc-bzr.el
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Glenn Morris <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/test/lisp/vc/vc-hg-tests.el b/test/lisp/vc/vc-hg-tests.el
index a0a0c1e..1bdc320 100644
--- a/test/lisp/vc/vc-hg-tests.el
+++ b/test/lisp/vc/vc-hg-tests.el
@@ -1,6 +1,6 @@
 ;;; vc-hg-tests.el --- tests for vc/vc-hg.el
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Dmitry Gutov <address@hidden>
 ;; Maintainer: address@hidden
diff --git a/test/lisp/vc/vc-tests.el b/test/lisp/vc/vc-tests.el
index cd774d3..0e61d2a 100644
--- a/test/lisp/vc/vc-tests.el
+++ b/test/lisp/vc/vc-tests.el
@@ -1,6 +1,6 @@
 ;;; vc-tests.el --- Tests of different backends of vc.el
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Michael Albinus <address@hidden>
 
diff --git a/test/lisp/wdired-tests.el b/test/lisp/wdired-tests.el
index f1ec4af..dc67796 100644
--- a/test/lisp/wdired-tests.el
+++ b/test/lisp/wdired-tests.el
@@ -1,6 +1,6 @@
 ;;; wdired-tests.el --- tests for wdired.el          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/whitespace-tests.el b/test/lisp/whitespace-tests.el
index b6e1849..3fd5016 100644
--- a/test/lisp/whitespace-tests.el
+++ b/test/lisp/whitespace-tests.el
@@ -1,6 +1,6 @@
 ;;; whitespace-tests.el --- Test suite for whitespace -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/lisp/xdg-tests.el b/test/lisp/xdg-tests.el
index ad5e4a4..9c81506 100644
--- a/test/lisp/xdg-tests.el
+++ b/test/lisp/xdg-tests.el
@@ -1,6 +1,6 @@
 ;;; xdg-tests.el --- tests for xdg.el -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Author: Mark Oteiza <address@hidden>
diff --git a/test/lisp/xml-tests.el b/test/lisp/xml-tests.el
index 016ba9a..a4c809e 100644
--- a/test/lisp/xml-tests.el
+++ b/test/lisp/xml-tests.el
@@ -1,6 +1,6 @@
 ;;; xml-parse-tests.el --- Test suite for XML parsing.
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Chong Yidong <address@hidden>
 ;; Keywords:       internal
diff --git a/test/lisp/xt-mouse-tests.el b/test/lisp/xt-mouse-tests.el
index 0b644d2..6053f9f 100644
--- a/test/lisp/xt-mouse-tests.el
+++ b/test/lisp/xt-mouse-tests.el
@@ -1,6 +1,6 @@
 ;;; xt-mouse-tests.el --- Test suite for xt-mouse.  -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <address@hidden>
 
diff --git a/test/manual/BidiCharacterTest.txt 
b/test/manual/BidiCharacterTest.txt
index 6a0df6d..064594b 100644
--- a/test/manual/BidiCharacterTest.txt
+++ b/test/manual/BidiCharacterTest.txt
@@ -1,5 +1,5 @@
-# BidiCharacterTest-11.0.0.txt
-# Date: 2018-02-18, 05:50:00 GMT [LI]
+# BidiCharacterTest-12.0.0.txt
+# Date: 2018-11-02, 16:34:00 GMT [LI]
 # © 2018 Unicode®, Inc.
 # For terms of use, see http://www.unicode.org/terms_of_use.html
 #
diff --git a/test/manual/biditest.el b/test/manual/biditest.el
index fd2dd4a..d813642 100644
--- a/test/manual/biditest.el
+++ b/test/manual/biditest.el
@@ -1,6 +1,6 @@
 ;;; biditest.el --- test bidi reordering in GNU Emacs display engine.
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii
 ;; Maintainer: address@hidden
diff --git a/test/manual/cedet/cedet-utests.el 
b/test/manual/cedet/cedet-utests.el
index 1044195..23362db 100644
--- a/test/manual/cedet/cedet-utests.el
+++ b/test/manual/cedet/cedet-utests.el
@@ -1,6 +1,6 @@
 ;;; cedet-utests.el --- Run all unit tests in the CEDET suite.
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/ede-tests.el b/test/manual/cedet/ede-tests.el
index c4f70da..0b5864d 100644
--- a/test/manual/cedet/ede-tests.el
+++ b/test/manual/cedet/ede-tests.el
@@ -1,6 +1,6 @@
 ;;; ede-tests.el --- Some tests for the Emacs Development Environment
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/semantic-ia-utest.el 
b/test/manual/cedet/semantic-ia-utest.el
index 938d152..665a538 100644
--- a/test/manual/cedet/semantic-ia-utest.el
+++ b/test/manual/cedet/semantic-ia-utest.el
@@ -1,6 +1,6 @@
 ;;; semantic-ia-utest.el --- Analyzer unit tests
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/semantic-tests.el 
b/test/manual/cedet/semantic-tests.el
index d4be930..9109d66 100644
--- a/test/manual/cedet/semantic-tests.el
+++ b/test/manual/cedet/semantic-tests.el
@@ -1,6 +1,6 @@
 ;;; semantic-utest.el --- Miscellaneous Semantic tests.
 
-;;; Copyright (C) 2003-2004, 2007-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2003-2004, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/semantic-utest-c.el 
b/test/manual/cedet/semantic-utest-c.el
index cbfe92f..a24bf10 100644
--- a/test/manual/cedet/semantic-utest-c.el
+++ b/test/manual/cedet/semantic-utest-c.el
@@ -1,6 +1,6 @@
 ;;; semantic-utest-c.el --- C based parsing tests.
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/semantic-utest.el 
b/test/manual/cedet/semantic-utest.el
index df22174..102c128 100644
--- a/test/manual/cedet/semantic-utest.el
+++ b/test/manual/cedet/semantic-utest.el
@@ -1,6 +1,6 @@
 ;;; semantic-utest.el --- Tests for semantic's parsing system.
 
-;;; Copyright (C) 2003-2004, 2007-2018 Free Software Foundation, Inc.
+;;; Copyright (C) 2003-2004, 2007-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/srecode-tests.el 
b/test/manual/cedet/srecode-tests.el
index 6f02b7d..5d5a970 100644
--- a/test/manual/cedet/srecode-tests.el
+++ b/test/manual/cedet/srecode-tests.el
@@ -1,6 +1,6 @@
 ;;; srecode-tests.el --- Some tests for CEDET's srecode
 
-;; Copyright (C) 2008-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/tests/test.c b/test/manual/cedet/tests/test.c
index 0437463..7d6411e 100644
--- a/test/manual/cedet/tests/test.c
+++ b/test/manual/cedet/tests/test.c
@@ -1,6 +1,6 @@
 /* test.c --- Semantic unit test for C.
 
-   Copyright (C) 2001-2018 Free Software Foundation, Inc.
+   Copyright (C) 2001-2019 Free Software Foundation, Inc.
 
    Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/tests/test.el b/test/manual/cedet/tests/test.el
index b7341ca..664e6cb 100644
--- a/test/manual/cedet/tests/test.el
+++ b/test/manual/cedet/tests/test.el
@@ -1,6 +1,6 @@
 ;;; test.el --- Unit test file for Semantic Emacs Lisp support.
 
-;; Copyright (C) 2005-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2005-2019 Free Software Foundation, Inc.
 
 ;; Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/tests/test.make 
b/test/manual/cedet/tests/test.make
index 3e1309f..60a4070 100644
--- a/test/manual/cedet/tests/test.make
+++ b/test/manual/cedet/tests/test.make
@@ -1,6 +1,6 @@
 # test.make --- Semantic unit test for Make -*- makefile -*-
 
-# Copyright (C) 2001-2002, 2010-2018 Free Software Foundation, Inc.
+# Copyright (C) 2001-2002, 2010-2019 Free Software Foundation, Inc.
 
 # Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/tests/testdoublens.cpp 
b/test/manual/cedet/tests/testdoublens.cpp
index 946b3ea..62efad4 100644
--- a/test/manual/cedet/tests/testdoublens.cpp
+++ b/test/manual/cedet/tests/testdoublens.cpp
@@ -1,6 +1,6 @@
 // testdoublens.cpp --- semantic-ia-utest completion engine unit tests
 
-// Copyright (C) 2008-2018 Free Software Foundation, Inc.
+// Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 // Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/tests/testdoublens.hpp 
b/test/manual/cedet/tests/testdoublens.hpp
index fe73d76..54f2acf 100644
--- a/test/manual/cedet/tests/testdoublens.hpp
+++ b/test/manual/cedet/tests/testdoublens.hpp
@@ -1,6 +1,6 @@
 // testdoublens.hpp --- Header file used in one of the Semantic tests
 
-// Copyright (C) 2008-2018 Free Software Foundation, Inc.
+// Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 // Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/tests/testjavacomp.java 
b/test/manual/cedet/tests/testjavacomp.java
index 8d51999..1ebd7dc 100644
--- a/test/manual/cedet/tests/testjavacomp.java
+++ b/test/manual/cedet/tests/testjavacomp.java
@@ -1,6 +1,6 @@
 //  testjavacomp.java --- Semantic unit test for Java
 
-// Copyright (C) 2009-2018 Free Software Foundation, Inc.
+// Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 //  Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/tests/testpolymorph.cpp 
b/test/manual/cedet/tests/testpolymorph.cpp
index 4639c10..cf605f6 100644
--- a/test/manual/cedet/tests/testpolymorph.cpp
+++ b/test/manual/cedet/tests/testpolymorph.cpp
@@ -1,6 +1,6 @@
 /** testpolymorph.cpp --- A sequence of polymorphism examples.
  *
- * Copyright (C) 2009-2018 Free Software Foundation, Inc.
+ * Copyright (C) 2009-2019 Free Software Foundation, Inc.
  *
  * Author: Eric M. Ludlam <address@hidden>
  *
diff --git a/test/manual/cedet/tests/testspp.c 
b/test/manual/cedet/tests/testspp.c
index dc52c83..beead02 100644
--- a/test/manual/cedet/tests/testspp.c
+++ b/test/manual/cedet/tests/testspp.c
@@ -1,6 +1,6 @@
 /* testspp.cpp --- Semantic unit test for the C preprocessor
 
-   Copyright (C) 2007-2018 Free Software Foundation, Inc.
+   Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
    Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/tests/testsppreplace.c 
b/test/manual/cedet/tests/testsppreplace.c
index fdbba65..a76d420 100644
--- a/test/manual/cedet/tests/testsppreplace.c
+++ b/test/manual/cedet/tests/testsppreplace.c
@@ -1,5 +1,5 @@
 /* testsppreplace.c --- unit test for CPP/SPP Replacement
-   Copyright (C) 2007-2018 Free Software Foundation, Inc.
+   Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
    Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/tests/testsppreplaced.c 
b/test/manual/cedet/tests/testsppreplaced.c
index eeedad8..ab13b3a 100644
--- a/test/manual/cedet/tests/testsppreplaced.c
+++ b/test/manual/cedet/tests/testsppreplaced.c
@@ -1,5 +1,5 @@
 /* testsppreplaced.c --- unit test for CPP/SPP Replacement
-   Copyright (C) 2007-2018 Free Software Foundation, Inc.
+   Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
    Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/tests/testsubclass.cpp 
b/test/manual/cedet/tests/testsubclass.cpp
index c65f79a..ece497b 100644
--- a/test/manual/cedet/tests/testsubclass.cpp
+++ b/test/manual/cedet/tests/testsubclass.cpp
@@ -1,6 +1,6 @@
 // testsubclass.cpp --- unit test for analyzer and complex C++ inheritance
 
-// Copyright (C) 2007-2018 Free Software Foundation, Inc.
+// Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 // Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/tests/testsubclass.hh 
b/test/manual/cedet/tests/testsubclass.hh
index 919b9c2..1963e15 100644
--- a/test/manual/cedet/tests/testsubclass.hh
+++ b/test/manual/cedet/tests/testsubclass.hh
@@ -1,6 +1,6 @@
 // testsubclass.hh --- unit test for analyzer and complex C++ inheritance
 
-// Copyright (C) 2007-2018 Free Software Foundation, Inc.
+// Copyright (C) 2007-2019 Free Software Foundation, Inc.
 
 // Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/tests/testtypedefs.cpp 
b/test/manual/cedet/tests/testtypedefs.cpp
index 3969573..f8a3f2e 100644
--- a/test/manual/cedet/tests/testtypedefs.cpp
+++ b/test/manual/cedet/tests/testtypedefs.cpp
@@ -1,6 +1,6 @@
 // testtypedefs.cpp --- Sample with some fake bits out of std::string
 
-// Copyright (C) 2008-2018 Free Software Foundation, Inc.
+// Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
 // Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/cedet/tests/testvarnames.c 
b/test/manual/cedet/tests/testvarnames.c
index 65a891c..7776072 100644
--- a/test/manual/cedet/tests/testvarnames.c
+++ b/test/manual/cedet/tests/testvarnames.c
@@ -1,7 +1,7 @@
 /* testvarnames.cpp
    Test variable and function names, lists of variables on one line, etc.
 
-   Copyright (C) 2008-2018 Free Software Foundation, Inc.
+   Copyright (C) 2008-2019 Free Software Foundation, Inc.
 
    Author: Eric M. Ludlam <address@hidden>
 
diff --git a/test/manual/etags/c-src/abbrev.c b/test/manual/etags/c-src/abbrev.c
index f9c591d..aa3a994 100644
--- a/test/manual/etags/c-src/abbrev.c
+++ b/test/manual/etags/c-src/abbrev.c
@@ -1,5 +1,5 @@
 /* Primitives for word-abbrev mode.
-   Copyright (C) 1985-1986, 1993, 1996, 1998, 2016-2018 Free Software
+   Copyright (C) 1985-1986, 1993, 1996, 1998, 2016-2019 Free Software
    Foundation, Inc.
 
 This file is part of GNU Emacs.
diff --git a/test/manual/etags/c-src/emacs/src/gmalloc.c 
b/test/manual/etags/c-src/emacs/src/gmalloc.c
index 2d494cc..6a5d04b 100644
--- a/test/manual/etags/c-src/emacs/src/gmalloc.c
+++ b/test/manual/etags/c-src/emacs/src/gmalloc.c
@@ -1,5 +1,5 @@
 /* Declarations for `malloc' and friends.
-   Copyright (C) 1990-1993, 1995-1996, 1999, 2002-2007, 2013-2018 Free
+   Copyright (C) 1990-1993, 1995-1996, 1999, 2002-2007, 2013-2019 Free
    Software Foundation, Inc.
                  Written May 1989 by Mike Haertel.
 
diff --git a/test/manual/etags/c-src/emacs/src/keyboard.c 
b/test/manual/etags/c-src/emacs/src/keyboard.c
index cf1dbfd..0151316 100644
--- a/test/manual/etags/c-src/emacs/src/keyboard.c
+++ b/test/manual/etags/c-src/emacs/src/keyboard.c
@@ -1,6 +1,6 @@
 /* Keyboard and mouse input; editor command loop.
 
-Copyright (C) 1985-1989, 1993-1997, 1999-2018 Free Software Foundation,
+Copyright (C) 1985-1989, 1993-1997, 1999-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
diff --git a/test/manual/etags/c-src/emacs/src/lisp.h 
b/test/manual/etags/c-src/emacs/src/lisp.h
index fd47758..9d7805d 100644
--- a/test/manual/etags/c-src/emacs/src/lisp.h
+++ b/test/manual/etags/c-src/emacs/src/lisp.h
@@ -1,6 +1,6 @@
 /* Fundamental definitions for GNU Emacs Lisp interpreter.
 
-Copyright (C) 1985-1987, 1993-1995, 1997-2018 Free Software Foundation,
+Copyright (C) 1985-1987, 1993-1995, 1997-2019 Free Software Foundation,
 Inc.
 
 This file is part of GNU Emacs.
diff --git a/test/manual/etags/c-src/emacs/src/regex.h 
b/test/manual/etags/c-src/emacs/src/regex.h
index bc4ca39..94fdbba 100644
--- a/test/manual/etags/c-src/emacs/src/regex.h
+++ b/test/manual/etags/c-src/emacs/src/regex.h
@@ -1,7 +1,7 @@
 /* Definitions for data structures and routines for the regular
    expression library, version 0.12.
 
-   Copyright (C) 1985, 1989-1993, 1995, 2000-2018 Free Software
+   Copyright (C) 1985, 1989-1993, 1995, 2000-2019 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/test/manual/etags/c-src/etags.c b/test/manual/etags/c-src/etags.c
index 7f67ce7..3a87ef2 100644
--- a/test/manual/etags/c-src/etags.c
+++ b/test/manual/etags/c-src/etags.c
@@ -28,7 +28,7 @@ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
SOFTWARE, EVEN
 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 
-Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2018 Free Software
+Copyright (C) 1984, 1987-1989, 1993-1995, 1998-2019 Free Software
 Foundation, Inc.
 
 This file is not considered part of GNU Emacs.
diff --git a/test/manual/etags/c-src/exit.c b/test/manual/etags/c-src/exit.c
index a1dbf20..4ba7039 100644
--- a/test/manual/etags/c-src/exit.c
+++ b/test/manual/etags/c-src/exit.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 2016-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 2016-2019 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
diff --git a/test/manual/etags/c-src/exit.strange_suffix 
b/test/manual/etags/c-src/exit.strange_suffix
index a1dbf20..4ba7039 100644
--- a/test/manual/etags/c-src/exit.strange_suffix
+++ b/test/manual/etags/c-src/exit.strange_suffix
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 2016-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 2016-2019 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
diff --git a/test/manual/etags/c-src/getopt.h b/test/manual/etags/c-src/getopt.h
index 58243cc..171ab59 100644
--- a/test/manual/etags/c-src/getopt.h
+++ b/test/manual/etags/c-src/getopt.h
@@ -1,5 +1,5 @@
 /* Declarations for getopt.
-   Copyright (C) 1989-1992, 2016-2018 Free Software Foundation, Inc.
+   Copyright (C) 1989-1992, 2016-2019 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
diff --git a/test/manual/etags/c-src/sysdep.h b/test/manual/etags/c-src/sysdep.h
index b0684e4..a962a75 100644
--- a/test/manual/etags/c-src/sysdep.h
+++ b/test/manual/etags/c-src/sysdep.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-1993, 2016-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1992-1993, 2016-2019 Free Software Foundation, Inc.
 This file is part of the GNU C Library.
 
 The GNU C Library is free software; you can redistribute it and/or
diff --git a/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el 
b/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el
index 667b235..250aeb1 100644
--- a/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el
+++ b/test/manual/etags/el-src/emacs/lisp/progmodes/etags.el
@@ -1,6 +1,6 @@
 ;;; etags.el --- etags facility for Emacs  -*- lexical-binding: t -*-
 
-;; Copyright (C) 1985-1986, 1988-1989, 1992-1996, 1998, 2000-2018 Free
+;; Copyright (C) 1985-1986, 1988-1989, 1992-1996, 1998, 2000-2019 Free
 ;; Software Foundation, Inc.
 
 ;; Author: Roland McGrath <address@hidden>
diff --git a/test/manual/etags/tex-src/texinfo.tex 
b/test/manual/etags/tex-src/texinfo.tex
index ee94104..a2c05af 100644
--- a/test/manual/etags/tex-src/texinfo.tex
+++ b/test/manual/etags/tex-src/texinfo.tex
@@ -1,6 +1,6 @@
 %% TeX macros to handle texinfo files
 
-%   Copyright (C) 1985-1986, 1988, 1990-1991, 2016-2018 Free Software
+%   Copyright (C) 1985-1986, 1988, 1990-1991, 2016-2019 Free Software
 %   Foundation, Inc.
 
 %This texinfo.tex file is free software; you can redistribute it and/or
diff --git a/test/manual/etags/y-src/cccp.c b/test/manual/etags/y-src/cccp.c
index 221f91e..1af4385 100644
--- a/test/manual/etags/y-src/cccp.c
+++ b/test/manual/etags/y-src/cccp.c
@@ -320,7 +320,7 @@ static const short yycheck[] =
 #line 3 "/usr/share/bison/bison.simple"
 
 /* Skeleton output parser for bison,
-   Copyright (C) 1984, 1989-1990, 2000-2001, 2016-2018 Free Software
+   Copyright (C) 1984, 1989-1990, 2000-2001, 2016-2019 Free Software
    Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
diff --git a/test/manual/etags/y-src/parse.c b/test/manual/etags/y-src/parse.c
index 1fcf7a6..6f5c6d9 100644
--- a/test/manual/etags/y-src/parse.c
+++ b/test/manual/etags/y-src/parse.c
@@ -28,7 +28,7 @@
 
 #line 1 "y-src/parse.y"
 
-/*     Copyright (C) 1990, 1992-1993, 2016-2018 Free Software Foundation,
+/*     Copyright (C) 1990, 1992-1993, 2016-2019 Free Software Foundation,
  *     Inc.
 
 This file is part of Oleo, the GNU Spreadsheet.
diff --git a/test/manual/etags/y-src/parse.y b/test/manual/etags/y-src/parse.y
index 475cea0..a6ed7c0 100644
--- a/test/manual/etags/y-src/parse.y
+++ b/test/manual/etags/y-src/parse.y
@@ -1,5 +1,5 @@
 %{
-/*     Copyright (C) 1990, 1992-1993, 2016-2018 Free Software Foundation,
+/*     Copyright (C) 1990, 1992-1993, 2016-2019 Free Software Foundation,
  *     Inc.
 
 This file is part of Oleo, the GNU Spreadsheet.
diff --git a/test/manual/image-size-tests.el b/test/manual/image-size-tests.el
index 70e86da..29f6abf 100644
--- a/test/manual/image-size-tests.el
+++ b/test/manual/image-size-tests.el
@@ -1,6 +1,6 @@
 ;;; image-size-tests.el -- tests for image scaling
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/manual/indent/js.js b/test/manual/indent/js.js
index b0d8bca..647d743 100644
--- a/test/manual/indent/js.js
+++ b/test/manual/indent/js.js
@@ -144,6 +144,22 @@ bar(
   /abc/
 )
 
+// No infloop inside js--re-search-backward-inner
+let b = {
+  a : `
+  //1
+  `
+}
+
+// bug#25904
+foo.bar.baz(very => // A comment
+  very
+).biz(([baz={a: [123]}, boz]) =>
+  baz
+).snarf((snorf) => /* Another comment */
+  snorf
+);
+
 // Local Variables:
 // indent-tabs-mode: nil
 // js-indent-level: 2
diff --git a/test/manual/indent/pascal.pas b/test/manual/indent/pascal.pas
index 485293b..1b360bc 100644
--- a/test/manual/indent/pascal.pas
+++ b/test/manual/indent/pascal.pas
@@ -1,6 +1,6 @@
 { GPC demo program for the CRT unit.
 
-Copyright (C) 1999-2006, 2013-2018 Free Software Foundation, Inc.
+Copyright (C) 1999-2006, 2013-2019 Free Software Foundation, Inc.
 
 Author: Frank Heckenbach <address@hidden>
 
diff --git a/test/manual/redisplay-testsuite.el 
b/test/manual/redisplay-testsuite.el
index 822a7f0..153b357 100644
--- a/test/manual/redisplay-testsuite.el
+++ b/test/manual/redisplay-testsuite.el
@@ -1,6 +1,6 @@
 ;;; redisplay-testsuite.el --- Test suite for redisplay.
 
-;; Copyright (C) 2009-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2009-2019 Free Software Foundation, Inc.
 
 ;; Author: Chong Yidong <address@hidden>
 ;; Keywords:       internal
diff --git a/test/manual/rmailmm.el b/test/manual/rmailmm.el
index a524787..eb09c8c 100644
--- a/test/manual/rmailmm.el
+++ b/test/manual/rmailmm.el
@@ -1,6 +1,6 @@
 ;;; rmailmm.el --- tests for mail/rmailmm.el
 
-;; Copyright (C) 2006-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2006-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/manual/scroll-tests.el b/test/manual/scroll-tests.el
index 0e93c54..e053b3f 100644
--- a/test/manual/scroll-tests.el
+++ b/test/manual/scroll-tests.el
@@ -1,6 +1,6 @@
 ;;; scroll-tests.el -- tests for scrolling -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/alloc-tests.el b/test/src/alloc-tests.el
index 21166af..32acc51 100644
--- a/test/src/alloc-tests.el
+++ b/test/src/alloc-tests.el
@@ -1,6 +1,6 @@
 ;;; alloc-tests.el --- alloc tests -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Daniel Colascione <address@hidden>
 ;; Keywords:
diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el
index 609585f..845d41f 100644
--- a/test/src/buffer-tests.el
+++ b/test/src/buffer-tests.el
@@ -1,6 +1,6 @@
 ;;; buffer-tests.el --- tests for buffer.c functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/callint-tests.el b/test/src/callint-tests.el
index feee9b6..5c310b5 100644
--- a/test/src/callint-tests.el
+++ b/test/src/callint-tests.el
@@ -1,6 +1,6 @@
 ;;; callint-tests.el --- unit tests for callint.c    -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <address@hidden>
 
diff --git a/test/src/callproc-tests.el b/test/src/callproc-tests.el
index 481116e..7b30a25 100644
--- a/test/src/callproc-tests.el
+++ b/test/src/callproc-tests.el
@@ -1,6 +1,6 @@
 ;;; callproc-tests.el --- callproc.c tests -*- lexical-binding: t -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/casefiddle-tests.el b/test/src/casefiddle-tests.el
index 5d8798c..ed9a2f9 100644
--- a/test/src/casefiddle-tests.el
+++ b/test/src/casefiddle-tests.el
@@ -1,6 +1,6 @@
 ;;; casefiddle-tests.el --- tests for casefiddle.c functions -*- 
lexical-binding: t -*-
 
-;; Copyright (C) 2015-2016, 2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2016, 2018-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/charset-tests.el b/test/src/charset-tests.el
index c1eec69..3bf6739 100644
--- a/test/src/charset-tests.el
+++ b/test/src/charset-tests.el
@@ -1,6 +1,6 @@
 ;;; charset-tests.el --- Tests for charset.c
 
-;; Copyright 2017-2018 Free Software Foundation, Inc.
+;; Copyright 2017-2019 Free Software Foundation, Inc.
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
diff --git a/test/src/chartab-tests.el b/test/src/chartab-tests.el
index bda9701..11dd1cb 100644
--- a/test/src/chartab-tests.el
+++ b/test/src/chartab-tests.el
@@ -1,6 +1,6 @@
 ;;; chartab-tests.el --- Tests for char-tab.c
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii <address@hidden>
 
diff --git a/test/src/cmds-tests.el b/test/src/cmds-tests.el
index caf444c..bab8b5f 100644
--- a/test/src/cmds-tests.el
+++ b/test/src/cmds-tests.el
@@ -1,6 +1,6 @@
 ;;; cmds-tests.el --- Testing some Emacs commands
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Nicolas Richard <address@hidden>
 ;; Keywords:
@@ -30,5 +30,13 @@
   (let ((last-command-event ?a))
     (should-error (self-insert-command -1))))
 
+(ert-deftest forward-line-with-bignum ()
+  (with-temp-buffer
+    (insert "x\n")
+    (let ((shortage (forward-line (1- most-negative-fixnum))))
+      (should (= shortage most-negative-fixnum)))
+    (let ((shortage (forward-line (+ 2 most-positive-fixnum))))
+      (should (= shortage (1+ most-positive-fixnum))))))
+
 (provide 'cmds-tests)
 ;;; cmds-tests.el ends here
diff --git a/test/src/coding-tests.el b/test/src/coding-tests.el
index a3ca715..1a08c1e 100644
--- a/test/src/coding-tests.el
+++ b/test/src/coding-tests.el
@@ -1,6 +1,6 @@
 ;;; coding-tests.el --- tests for text encoding and decoding
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii <address@hidden>
 ;; Author: Kenichi Handa <address@hidden>
diff --git a/test/src/data-tests.el b/test/src/data-tests.el
index 3cd4802..a9d48e2 100644
--- a/test/src/data-tests.el
+++ b/test/src/data-tests.el
@@ -1,6 +1,6 @@
 ;;; data-tests.el --- tests for src/data.c  -*- lexical-binding:t -*-
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -484,7 +484,7 @@ comparing the subr with a much slower lisp implementation."
         (should-have-watch-data `(data-tests-lvar 3 set ,buf1)))
       (should-have-watch-data `(data-tests-lvar 1 unlet ,buf1))
       (setq-default data-tests-lvar 4)
-      (should-have-watch-data `(data-tests-lvar 4 set nil))
+      (should-have-watch-data '(data-tests-lvar 4 set nil))
       (with-temp-buffer
         (setq buf2 (current-buffer))
         (setq data-tests-lvar 1)
@@ -501,7 +501,7 @@ comparing the subr with a much slower lisp implementation."
         (kill-all-local-variables)
         (should-have-watch-data `(data-tests-lvar nil makunbound ,buf2)))
       (setq-default data-tests-lvar 4)
-      (should-have-watch-data `(data-tests-lvar 4 set nil))
+      (should-have-watch-data '(data-tests-lvar 4 set nil))
       (makunbound 'data-tests-lvar)
       (should-have-watch-data '(data-tests-lvar nil makunbound nil))
       (setq data-tests-lvar 5)
@@ -656,6 +656,10 @@ comparing the subr with a much slower lisp implementation."
 (ert-deftest data-tests-ash-lsh ()
   (should (= (ash most-negative-fixnum 1)
              (* most-negative-fixnum 2)))
+  (should (= (ash 0 (* 2 most-positive-fixnum)) 0))
+  (should (= (ash 1000 (* 2 most-negative-fixnum)) 0))
+  (should (= (ash -1000 (* 2 most-negative-fixnum)) -1))
+  (should (= (ash (* 2 most-negative-fixnum) (* 2 most-negative-fixnum)) -1))
   (should (= (lsh most-negative-fixnum 1)
              (* most-negative-fixnum 2)))
   (should (= (ash (* 2 most-negative-fixnum) -1)
@@ -665,4 +669,22 @@ comparing the subr with a much slower lisp implementation."
   (should (= (lsh -1 -1) most-positive-fixnum))
   (should-error (lsh (1- most-negative-fixnum) -1)))
 
+(ert-deftest data-tests-make-local-forwarded-var () ;bug#34318
+  ;; Boy, this bug is tricky to trigger.  You need to:
+  ;; - call make-local-variable on a forwarded var (i.e. one that
+  ;;   has a corresponding C var linked via DEFVAR_(LISP|INT|BOOL))
+  ;; - cause the C code to modify this variable from the C side of the
+  ;;   forwarding, but this needs to happen before the var is accessed
+  ;;   from the Lisp side and before we switch to another buffer.
+  ;; The trigger in bug#34318 doesn't exist any more because the C code has
+  ;; changes.  Instead I found the trigger below.
+  (with-temp-buffer
+    (setq last-coding-system-used 'bug34318)
+    (make-local-variable 'last-coding-system-used)
+    ;; This should set last-coding-system-used to `no-conversion'.
+    (decode-coding-string "hello" nil)
+    (should (equal (list last-coding-system-used
+                         (default-value 'last-coding-system-used))
+                   '(no-conversion bug34318)))))
+
 ;;; data-tests.el ends here
diff --git a/test/src/decompress-tests.el b/test/src/decompress-tests.el
index 647dbeb..50d947b 100644
--- a/test/src/decompress-tests.el
+++ b/test/src/decompress-tests.el
@@ -1,6 +1,6 @@
 ;;; decompress-tests.el --- Test suite for decompress.
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; Author: Lars Ingebrigtsen <address@hidden>
 
diff --git a/test/src/doc-tests.el b/test/src/doc-tests.el
index 7c07504..9bcb240 100644
--- a/test/src/doc-tests.el
+++ b/test/src/doc-tests.el
@@ -1,6 +1,6 @@
 ;;; doc-tests.el --- Tests for doc.c
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Eli Zaretskii <address@hidden>
 
diff --git a/test/src/editfns-tests.el b/test/src/editfns-tests.el
index 17b2c51..449f00f 100644
--- a/test/src/editfns-tests.el
+++ b/test/src/editfns-tests.el
@@ -1,6 +1,6 @@
 ;;; editfns-tests.el -- tests for editfns.c
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -184,12 +184,11 @@
               'integer))
   (should (eq (type-of (read (format "#32rG%x" most-positive-fixnum)))
               'integer))
-  (let ((binary-as-unsigned nil))
-    (dolist (fmt '("%d" "%s" "#o%o" "#x%x"))
-      (dolist (val (list most-negative-fixnum (1+ most-negative-fixnum)
-                         -1 0 1
-                         (1- most-positive-fixnum) most-positive-fixnum))
-        (should (eq val (read (format fmt val))))))))
+  (dolist (fmt '("%d" "%s" "#o%o" "#x%x"))
+    (dolist (val (list most-negative-fixnum (1+ most-negative-fixnum)
+                      -1 0 1
+                      (1- most-positive-fixnum) most-positive-fixnum))
+      (should (eq val (read (format fmt val)))))))
 
 (ert-deftest format-%o-invalid-float ()
   (should-error (format "%o" -1e-37)
@@ -351,4 +350,35 @@
     (should (equal (format "%-#50.40x" v3)
                    "-0x000000003ffffffffffffffe000000000000000        "))))
 
+(ert-deftest test-group-name ()
+  (should (stringp (group-name (group-gid))))
+  (should-error (group-name 'foo))
+  (cond
+   ((memq system-type '(windows-nt ms-dos))
+    (should-not (group-name 123456789)))
+   ((executable-find "getent")
+    (with-temp-buffer
+      (let (stat name)
+      (dolist (gid (list 0 1212345 (group-gid)))
+        (erase-buffer)
+        (setq stat (ignore-errors
+                     (call-process "getent" nil '(t nil) nil "group"
+                                   (number-to-string gid))))
+        (setq name (group-name gid))
+        (goto-char (point-min))
+        (cond ((eq stat 0)
+               (if (looking-at "\\([[:alnum:]_-]+\\):")
+                   (should (string= (match-string 1) name))))
+              ((eq stat 2)
+               (should-not name)))))))))
+
+(ert-deftest test-translate-region-internal ()
+  (with-temp-buffer
+    (let ((max-char #16r3FFFFF)
+          (tt (make-char-table 'translation-table)))
+      (aset tt max-char ?*)
+      (insert max-char)
+      (translate-region-internal (point-min) (point-max) tt)
+      (should (string-equal (buffer-string) "*")))))
+
 ;;; editfns-tests.el ends here
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index c67190b..35aaaa6 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -1,6 +1,6 @@
 ;;; Test GNU Emacs modules.
 
-;; Copyright 2015-2018 Free Software Foundation, Inc.
+;; Copyright 2015-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -265,7 +265,8 @@ during garbage collection."
   (skip-unless (file-executable-p mod-test-emacs))
   (module--test-assertion
       (rx "Module function called during garbage collection\n")
-    (mod-test-invalid-finalizer)))
+    (mod-test-invalid-finalizer)
+    (garbage-collect)))
 
 (ert-deftest module/describe-function-1 ()
   "Check that Bug#30163 is fixed."
@@ -289,4 +290,24 @@ Return A + B"
     (should (member '(provide . mod-test) entries))
     (should (member '(defun . mod-test-sum) entries))))
 
+(ert-deftest mod-test-sleep-until ()
+  "Check that `mod-test-sleep-until' either returns normally or quits.
+Interactively, you can try hitting \\[keyboard-quit] to quit."
+  (dolist (arg '(nil t))
+    ;; Guard against some caller setting `inhibit-quit'.
+    (with-local-quit
+      (condition-case nil
+          (should (eq (with-local-quit
+                        ;; Because `inhibit-quit' is nil here, the next
+                        ;; form either quits or returns `finished'.
+                        (mod-test-sleep-until
+                         ;; Interactively, run for 5 seconds to give the
+                         ;; user time to quit.  In batch mode, run only
+                         ;; briefly since the user can't quit.
+                         (float-time (time-add nil (if noninteractive 0.1 5)))
+                         ;; should_quit or process_input
+                         arg))
+                      'finished))
+        (quit)))))
+
 ;;; emacs-module-tests.el ends here
diff --git a/test/src/eval-tests.el b/test/src/eval-tests.el
index 0c24291..48295b8 100644
--- a/test/src/eval-tests.el
+++ b/test/src/eval-tests.el
@@ -1,6 +1,6 @@
 ;;; eval-tests.el --- unit tests for src/eval.c      -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <address@hidden>
 
diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el
index 5d12685..6262d94 100644
--- a/test/src/fileio-tests.el
+++ b/test/src/fileio-tests.el
@@ -1,6 +1,6 @@
 ;;; unit tests for src/fileio.c      -*- lexical-binding: t; -*-
 
-;; Copyright 2017-2018 Free Software Foundation, Inc.
+;; Copyright 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -95,3 +95,15 @@ Also check that an encoding error can appear in a symlink."
   (should (equal (file-name-as-directory "d:/abc/") "d:/abc/"))
   (should (equal (file-name-as-directory "D:\\abc/") "d:/abc/"))
   (should (equal (file-name-as-directory "D:/abc//") "d:/abc//")))
+
+(ert-deftest fileio-tests--relative-HOME ()
+  "Test that expand-file-name works even when HOME is relative."
+  (let ((old-home (getenv "HOME")))
+    (setenv "HOME" "a/b/c")
+    (should (equal (expand-file-name "~/foo")
+                   (expand-file-name "a/b/c/foo")))
+    (when (memq system-type '(ms-dos windows-nt))
+      ;; Test expansion of drive-relative file names.
+      (setenv "HOME" "x:foo")
+      (should (equal (expand-file-name "~/bar") "x:/foo/bar")))
+    (setenv "HOME" old-home)))
diff --git a/test/src/floatfns-tests.el b/test/src/floatfns-tests.el
index 61b1c25..643866f 100644
--- a/test/src/floatfns-tests.el
+++ b/test/src/floatfns-tests.el
@@ -1,6 +1,6 @@
 ;;; floatfns-tests.el --- tests for floating point operations
 
-;; Copyright 2017-2018 Free Software Foundation, Inc.
+;; Copyright 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index b180f30..d6cc99e 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -1,6 +1,6 @@
 ;;; fns-tests.el --- tests for src/fns.c
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -161,7 +161,10 @@
             '(9 . "ppp") '(8 . "ttt") '(8 . "eee") '(9 . "fff"))
            (lambda (x y) (< (car x) (car y))))
           [(8 . "xxx") (8 . "bbb") (8 . "ttt") (8 . "eee")
-           (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")])))
+           (9 . "aaa") (9 . "zzz") (9 . "ppp") (9 . "fff")]))
+  ;; Bug#34104
+  (should (equal (should-error (sort "cba" #'<) :type 'wrong-type-argument)
+                 '(wrong-type-argument list-or-vector-p "cba"))))
 
 (ert-deftest fns-tests-collate-sort ()
   (skip-unless (fns-tests--collate-enabled-p))
diff --git a/test/src/font-tests.el b/test/src/font-tests.el
index 70b32c8..971d79d 100644
--- a/test/src/font-tests.el
+++ b/test/src/font-tests.el
@@ -1,6 +1,6 @@
 ;;; font-tests.el --- Test suite for font-related functions.
 
-;; Copyright (C) 2011-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
 
 ;; Author: Chong Yidong <address@hidden>
 ;; Keywords:       internal
diff --git a/test/src/inotify-tests.el b/test/src/inotify-tests.el
index b46014e..06d6d65 100644
--- a/test/src/inotify-tests.el
+++ b/test/src/inotify-tests.el
@@ -1,6 +1,6 @@
 ;;; inotify-tests.el --- Test suite for inotify. -*- lexical-binding: t -*-
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Rüdiger Sonderfeld <address@hidden>
 ;; Keywords:       internal
diff --git a/test/src/json-tests.el b/test/src/json-tests.el
index bffee8f..04f91f4 100644
--- a/test/src/json-tests.el
+++ b/test/src/json-tests.el
@@ -1,6 +1,6 @@
 ;;; json-tests.el --- unit tests for json.c          -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -86,8 +86,8 @@
   (should (equal
            (json-serialize
             (list :detect-hash-table #s(hash-table test equal data ("bla" 
"ble"))
-                  :detect-alist `((bla . "ble"))
-                  :detect-plist `(:bla "ble")))
+                  :detect-alist '((bla . "ble"))
+                  :detect-plist '(:bla "ble")))
            "\
 {\
 \"detect-hash-table\":{\"bla\":\"ble\"},\
diff --git a/test/src/keyboard-tests.el b/test/src/keyboard-tests.el
index 125dbd0..3e7d131 100644
--- a/test/src/keyboard-tests.el
+++ b/test/src/keyboard-tests.el
@@ -1,6 +1,6 @@
 ;;; keyboard-tests.el --- Tests for keyboard.c -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/keymap-tests.el b/test/src/keymap-tests.el
index 56ff436..d61f304 100644
--- a/test/src/keymap-tests.el
+++ b/test/src/keymap-tests.el
@@ -1,6 +1,6 @@
 ;;; keymap-tests.el --- Test suite for src/keymap.c
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Juanma Barranquero <address@hidden>
 
diff --git a/test/src/lcms-tests.el b/test/src/lcms-tests.el
index 28afd5a..f1d1110 100644
--- a/test/src/lcms-tests.el
+++ b/test/src/lcms-tests.el
@@ -1,6 +1,6 @@
 ;;; lcms-tests.el --- tests for Little CMS interface -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el
index f19d983..ae918f0 100644
--- a/test/src/lread-tests.el
+++ b/test/src/lread-tests.el
@@ -1,6 +1,6 @@
 ;;; lread-tests.el --- tests for lread.c -*- lexical-binding: t; -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; Author: Philipp Stephani <address@hidden>
 
diff --git a/test/src/marker-tests.el b/test/src/marker-tests.el
index 859323e..79e298d 100644
--- a/test/src/marker-tests.el
+++ b/test/src/marker-tests.el
@@ -1,6 +1,6 @@
 ;;; marker-tests.el --- tests for marker.c functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/minibuf-tests.el b/test/src/minibuf-tests.el
index 5ee7e5c..12b018b 100644
--- a/test/src/minibuf-tests.el
+++ b/test/src/minibuf-tests.el
@@ -1,6 +1,6 @@
 ;;; minibuf-tests.el --- tests for minibuf.c functions -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/print-tests.el b/test/src/print-tests.el
index 78e769f..8e377d7 100644
--- a/test/src/print-tests.el
+++ b/test/src/print-tests.el
@@ -1,6 +1,6 @@
 ;;; print-tests.el --- tests for src/print.c         -*- lexical-binding: t; 
-*-
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/process-tests.el b/test/src/process-tests.el
index 551b34f..5dbf441 100644
--- a/test/src/process-tests.el
+++ b/test/src/process-tests.el
@@ -1,6 +1,6 @@
 ;;; process-tests.el --- Testing the process facilities
 
-;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -207,13 +207,62 @@
                     :sentinel #'ignore
                     :noquery t
                     :connection-type 'pipe)))
-      (while (process-live-p process)
-        (accept-process-output process))
+      (while (or (accept-process-output process)
+                (process-live-p process)))
       (should (eq (process-status process) 'exit))
       (should (eq (process-exit-status process) 0))
       (should (process-tests--mixable (string-to-list (buffer-string))
                                       (string-to-list "stdout\n")
                                       (string-to-list "stderr\n"))))))
 
+(ert-deftest make-process/file-handler/found ()
+  "Check that the ‘:file-handler’ argument of ‘make-process’
+works as expected if a file name handler is found."
+  (let ((file-handler-calls 0))
+    (cl-flet ((file-handler
+               (&rest args)
+               (should (equal default-directory "test-handler:/dir/"))
+               (should (equal args '(make-process :name "name"
+                                                  :command ("/some/binary")
+                                                  :file-handler t)))
+               (cl-incf file-handler-calls)
+               'fake-process))
+      (let ((file-name-handler-alist (list (cons (rx bos "test-handler:")
+                                                 #'file-handler)))
+            (default-directory "test-handler:/dir/"))
+        (should (eq (make-process :name "name"
+                                  :command '("/some/binary")
+                                  :file-handler t)
+                    'fake-process))
+        (should (= file-handler-calls 1))))))
+
+(ert-deftest make-process/file-handler/not-found ()
+  "Check that the ‘:file-handler’ argument of ‘make-process’
+works as expected if no file name handler is found."
+  (let ((file-name-handler-alist ())
+        (default-directory invocation-directory)
+        (program (expand-file-name invocation-name invocation-directory)))
+    (should (processp (make-process :name "name"
+                                    :command (list program "--version")
+                                    :file-handler t)))))
+
+(ert-deftest make-process/file-handler/disable ()
+  "Check ‘make-process’ works as expected if it shouldn’t use the
+file name handler."
+  (let ((file-name-handler-alist (list (cons (rx bos "test-handler:")
+                                             #'process-tests--file-handler)))
+        (default-directory "test-handler:/dir/")
+        (program (expand-file-name invocation-name invocation-directory)))
+    (should (processp (make-process :name "name"
+                                    :command (list program "--version"))))))
+
+(defun process-tests--file-handler (operation &rest _args)
+  (cl-ecase operation
+    (unhandled-file-name-directory "/")
+    (make-process (ert-fail "file name handler called unexpectedly"))))
+
+(put #'process-tests--file-handler 'operations
+     '(unhandled-file-name-directory make-process))
+
 (provide 'process-tests)
 ;; process-tests.el ends here.
diff --git a/test/src/regex-emacs-tests.el b/test/src/regex-emacs-tests.el
index 7a07590..0ae50c9 100644
--- a/test/src/regex-emacs-tests.el
+++ b/test/src/regex-emacs-tests.el
@@ -1,6 +1,6 @@
 ;;; regex-emacs-tests.el --- tests for regex-emacs.c -*- lexical-binding: t -*-
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
@@ -278,7 +278,7 @@ on success"
 
 
 (defconst regex-tests-re-even-escapes
-  "\\(?:^\\|[^\\\\]\\)\\(?:\\\\\\\\\\)*"
+  "\\(?:^\\|[^\\]\\)\\(?:\\\\\\\\\\)*"
   "Regex that matches an even number of \\ characters")
 
 (defconst regex-tests-re-odd-escapes
@@ -555,11 +555,11 @@ differences in behavior.")
 
 (defconst regex-tests-PTESTS-whitelist
   [
-   ;; emacs doesn't barf on weird ranges such as [b-a], but simply
-   ;; fails to match
+   ;; emacs doesn't see DEL (0x7f) as a [:cntrl:] character
    138
 
-   ;; emacs doesn't see DEL (0x78) as a [:cntrl:] character
+   ;; emacs doesn't barf on weird ranges such as [b-a], but simply
+   ;; fails to match
    168
   ]
   "Line numbers in the PTESTS test that should be skipped.  These
diff --git a/test/src/syntax-tests.el b/test/src/syntax-tests.el
index 4057d75..3c3245f 100644
--- a/test/src/syntax-tests.el
+++ b/test/src/syntax-tests.el
@@ -1,6 +1,6 @@
 ;;; syntax-tests.el --- tests for syntax.c functions -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/textprop-tests.el b/test/src/textprop-tests.el
index 11cb9e1..db7256f 100644
--- a/test/src/textprop-tests.el
+++ b/test/src/textprop-tests.el
@@ -1,6 +1,6 @@
 ;;; textprop-tests.el --- Test suite for text properties.
 
-;; Copyright (C) 2015-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2019 Free Software Foundation, Inc.
 
 ;; Author: Wolfgang Jenkner <address@hidden>
 ;; Keywords: internal
diff --git a/test/src/thread-tests.el b/test/src/thread-tests.el
index 36bb637..5e5bfd1 100644
--- a/test/src/thread-tests.el
+++ b/test/src/thread-tests.el
@@ -1,6 +1,6 @@
 ;;; threads.el --- tests for threads.
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/timefns-tests.el b/test/src/timefns-tests.el
index ebeb43d..5c858ef 100644
--- a/test/src/timefns-tests.el
+++ b/test/src/timefns-tests.el
@@ -1,6 +1,6 @@
 ;;; timefns-tests.el -- tests for timefns.c
 
-;; Copyright (C) 2016-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2016-2019 Free Software Foundation, Inc.
 
 ;; This file is part of GNU Emacs.
 
diff --git a/test/src/undo-tests.el b/test/src/undo-tests.el
index dab3619..b84f5a5 100644
--- a/test/src/undo-tests.el
+++ b/test/src/undo-tests.el
@@ -1,6 +1,6 @@
 ;;; undo-tests.el --- Tests of primitive-undo
 
-;; Copyright (C) 2012-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2012-2019 Free Software Foundation, Inc.
 
 ;; Author: Aaron S. Hawley <address@hidden>
 
diff --git a/test/src/xml-tests.el b/test/src/xml-tests.el
index c1d65b9..aa7a71e 100644
--- a/test/src/xml-tests.el
+++ b/test/src/xml-tests.el
@@ -1,6 +1,6 @@
 ;;; libxml-parse-tests.el --- Test suite for libxml parsing.
 
-;; Copyright (C) 2014-2018 Free Software Foundation, Inc.
+;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
 
 ;; Author: Ulf Jasper <address@hidden>
 ;; Keywords:       internal



reply via email to

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